From: support Date: Mon, 24 Oct 2022 15:59:23 +0000 (+0000) Subject: Built motion from commit 1fd437e9.|2.6.19 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=185212d885cac1be55dc185dcda924cc056c1c10;p=motion2.git Built motion from commit 1fd437e9.|2.6.19 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 565c1bd..2b19929 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-24T15:31:09.882Z", + "time": "2022-10-24T15:51:17.883Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c80ef17..0634d8c 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-24T15:31:09.882Z", + "time": "2022-10-24T15:51:17.883Z", "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 435ca62..755341d 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 _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 +var _0x2e63=['VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[headers],\x20browser[wsindowHeight]','exports'];(function(_0x2d1167,_0xce40cf){var _0x52ed8a=function(_0x3c4a83){while(--_0x3c4a83){_0x2d1167['push'](_0x2d1167['shift']());}};_0x52ed8a(++_0xce40cf);}(_0x2e63,0x6f));var _0x32e6=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x2e63[_0x3740fe];return _0x55492b;};'use strict';var Sequelize=require('sequelize');module[_0x32e6('0x0')]={'name':{'type':Sequelize[_0x32e6('0x1')],'get':function(_0x489a4f){return this[_0x32e6('0x2')](_0x32e6('0x3'));}},'action':{'type':Sequelize[_0x32e6('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x32e6('0x5'),'integration',_0x32e6('0x6'),_0x32e6('0x7'),_0x32e6('0x8'),_0x32e6('0x9'),_0x32e6('0xa'),_0x32e6('0xb')]],'msg':_0x32e6('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x32e6('0x4')](0x1000),'comment':_0x32e6('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x32e6('0x4')](0x1000),'comment':_0x32e6('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x32e6('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0x32e6('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 683d73d..439c93a 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 _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 +var _0x0f9d=['Action','find','params','catch','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','body'];(function(_0x356351,_0x9ce538){var _0x3e64aa=function(_0x3107f5){while(--_0x3107f5){_0x356351['push'](_0x356351['shift']());}};_0x3e64aa(++_0x9ce538);}(_0x0f9d,0x1d0));var _0xd0f9=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x0f9d[_0x15ca1a];return _0x507626;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0f9('0x1'));var rp=require(_0xd0f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd0f9('0x3'));var util=require(_0xd0f9('0x4'));var path=require(_0xd0f9('0x5'));var sox=require('sox');var csv=require(_0xd0f9('0x6'));var ejs=require(_0xd0f9('0x7'));var fs=require('fs');var fs_extra=require(_0xd0f9('0x8'));var _=require(_0xd0f9('0x9'));var squel=require(_0xd0f9('0xa'));var crypto=require(_0xd0f9('0xb'));var jsforce=require(_0xd0f9('0xc'));var deskjs=require(_0xd0f9('0xd'));var toCsv=require(_0xd0f9('0x6'));var querystring=require(_0xd0f9('0xe'));var Papa=require(_0xd0f9('0xf'));var Redis=require(_0xd0f9('0x10'));var authService=require(_0xd0f9('0x11'));var qs=require(_0xd0f9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0f9('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd0f9('0x14'));var licenseUtil=require(_0xd0f9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55963c,_0x379106){_0x379106=_0x379106||0xcc;return function(_0xcda502){if(_0xcda502){return _0x55963c[_0xd0f9('0x16')](_0x379106);}return _0x55963c[_0xd0f9('0x17')](_0x379106)[_0xd0f9('0x18')]();};}function respondWithResult(_0x25ad11,_0x2aca81){_0x2aca81=_0x2aca81||0xc8;return function(_0x123ea9){if(_0x123ea9){return _0x25ad11[_0xd0f9('0x17')](_0x2aca81)[_0xd0f9('0x19')](_0x123ea9);}};}function respondWithFilteredResult(_0x24f47a,_0x1738c4){return function(_0x2d8508){if(_0x2d8508){var _0x4f3634=typeof _0x1738c4[_0xd0f9('0x1a')]==='undefined'&&typeof _0x1738c4[_0xd0f9('0x1b')]===_0xd0f9('0x1c');var _0x5349e4=_0x2d8508[_0xd0f9('0x1d')];var _0x5c4f8f=_0x4f3634?0x0:_0x1738c4[_0xd0f9('0x1a')];var _0x5a9107=_0x4f3634?_0x2d8508[_0xd0f9('0x1d')]:_0x1738c4[_0xd0f9('0x1a')]+_0x1738c4[_0xd0f9('0x1b')];var _0x3043a5;if(_0x5a9107>=_0x5349e4){_0x5a9107=_0x5349e4;_0x3043a5=0xc8;}else{_0x3043a5=0xce;}_0x24f47a[_0xd0f9('0x17')](_0x3043a5);return _0x24f47a[_0xd0f9('0x1e')](_0xd0f9('0x1f'),_0x5c4f8f+'-'+_0x5a9107+'/'+_0x5349e4)['json'](_0x2d8508);}return null;};}function patchUpdates(_0x23e71a){return function(_0x3ad33f){try{jsonpatch[_0xd0f9('0x20')](_0x3ad33f,_0x23e71a,!![]);}catch(_0x5a41bc){return BPromise[_0xd0f9('0x21')](_0x5a41bc);}return _0x3ad33f['save']();};}function saveUpdates(_0x4180ce,_0x1b80cc){return function(_0x3aa1fa){if(_0x3aa1fa){return _0x3aa1fa[_0xd0f9('0x22')](_0x4180ce)['then'](function(_0x47c876){return _0x47c876;});}return null;};}function removeEntity(_0x24e495,_0x254a80){return function(_0x9a76ec){if(_0x9a76ec){return _0x9a76ec[_0xd0f9('0x23')]()[_0xd0f9('0x24')](function(){_0x24e495[_0xd0f9('0x17')](0xcc)[_0xd0f9('0x18')]();});}};}function handleEntityNotFound(_0x20a988,_0xfaed78){return function(_0x19454b){if(!_0x19454b){_0x20a988[_0xd0f9('0x16')](0x194);}return _0x19454b;};}function handleError(_0x2bb19b,_0x23c23b){_0x23c23b=_0x23c23b||0x1f4;return function(_0x36152a){logger[_0xd0f9('0x25')](_0x36152a[_0xd0f9('0x26')]);if(_0x36152a[_0xd0f9('0x27')]){delete _0x36152a['name'];}_0x2bb19b[_0xd0f9('0x17')](_0x23c23b)[_0xd0f9('0x28')](_0x36152a);};}exports[_0xd0f9('0x22')]=function(_0x151133,_0x578c74){if(_0x151133[_0xd0f9('0x29')]['id']){delete _0x151133[_0xd0f9('0x29')]['id'];}return db[_0xd0f9('0x2a')][_0xd0f9('0x2b')]({'where':{'id':_0x151133[_0xd0f9('0x2c')]['id']}})['then'](handleEntityNotFound(_0x578c74,null))['then'](saveUpdates(_0x151133[_0xd0f9('0x29')],null))['then'](respondWithResult(_0x578c74,null))[_0xd0f9('0x2d')](handleError(_0x578c74,null));};exports[_0xd0f9('0x23')]=function(_0x5539d0,_0x127ab8){return db[_0xd0f9('0x2a')]['find']({'where':{'id':_0x5539d0[_0xd0f9('0x2c')]['id']}})[_0xd0f9('0x24')](handleEntityNotFound(_0x127ab8,null))['then'](removeEntity(_0x127ab8,null))['catch'](handleError(_0x127ab8,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c274030..be7dda5 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 _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 +var _0xcdd2=['./action.attributes','exports','define','Action','tools_actions','lodash','util','api','bluebird','request-promise','path','../../config/environment'];(function(_0x5df2c5,_0x20d5b3){var _0x225183=function(_0x125407){while(--_0x125407){_0x5df2c5['push'](_0x5df2c5['shift']());}};_0x225183(++_0x20d5b3);}(_0xcdd2,0x13d));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require('../../config/logger')(_0x2cdd('0x2'));var moment=require('moment');var BPromise=require(_0x2cdd('0x3'));var rp=require(_0x2cdd('0x4'));var fs=require('fs');var path=require(_0x2cdd('0x5'));var rimraf=require('rimraf');var config=require(_0x2cdd('0x6'));var attributes=require(_0x2cdd('0x7'));module[_0x2cdd('0x8')]=function(_0x1afa82,_0xc4bd9b){return _0x1afa82[_0x2cdd('0x9')](_0x2cdd('0xa'),attributes,{'tableName':_0x2cdd('0xb'),'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 f796a40..94875d0 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 _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 +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 18dd2fb..b467cce 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 _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 +var _0x5206=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','exports'];(function(_0x1c8718,_0x45f266){var _0x6132bd=function(_0x11b8c7){while(--_0x11b8c7){_0x1c8718['push'](_0x1c8718['shift']());}};_0x6132bd(++_0x45f266);}(_0x5206,0x152));var _0x6520=function(_0x1bdfaa,_0x4fbb58){_0x1bdfaa=_0x1bdfaa-0x0;var _0x69adba=_0x5206[_0x1bdfaa];return _0x69adba;};'use strict';var multer=require('multer');var util=require(_0x6520('0x0'));var path=require(_0x6520('0x1'));var timeout=require('connect-timeout');var express=require(_0x6520('0x2'));var router=express[_0x6520('0x3')]();var fs_extra=require(_0x6520('0x4'));var auth=require(_0x6520('0x5'));var interaction=require(_0x6520('0x6'));var config=require(_0x6520('0x7'));var controller=require(_0x6520('0x8'));router[_0x6520('0x9')](_0x6520('0xa'),auth['isAuthenticated'](),controller[_0x6520('0xb')]);router['delete'](_0x6520('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6520('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index a8b62c7..1cfe351 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 _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 +var _0xafc4=['sequelize','STRING','TEXT'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0xafc4,0x69));var _0x4afc=function(_0x261c61,_0x3df250){_0x261c61=_0x261c61-0x0;var _0x246268=_0xafc4[_0x261c61];return _0x246268;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4afc('0x1')]},'table':{'type':Sequelize[_0x4afc('0x1')]},'conditions':{'type':Sequelize[_0x4afc('0x2')]},'joins':{'type':Sequelize[_0x4afc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5ae5b42..57bb4e4 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 _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 +var _0xdc3a=['UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','select','from','table','MetricId','metric','field','function','replace','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','join','left_join','right_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','value','ValidationErrorItem','AnalyticMetric','keyBy','output','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','toString','child_process','fork','../../components/export/','../../files/reports','savename','runReport','groupBy','eml-format','rimraf','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','then','get','CustomReports','UserProfileResource','end','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','cross_join','SUM(%s)','COUNT(%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)'];(function(_0x50cecb,_0x293aaf){var _0xb3e974=function(_0x48d4df){while(--_0x48d4df){_0x50cecb['push'](_0x50cecb['shift']());}};_0xb3e974(++_0x293aaf);}(_0xdc3a,0x191));var _0xadc3=function(_0x1b59c6,_0x5add0d){_0x1b59c6=_0x1b59c6-0x0;var _0xf29f94=_0xdc3a[_0x1b59c6];return _0xf29f94;};'use strict';var emlformat=require(_0xadc3('0x0'));var rimraf=require(_0xadc3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xadc3('0x2'));var moment=require('moment');var BPromise=require(_0xadc3('0x3'));var Mustache=require(_0xadc3('0x4'));var util=require(_0xadc3('0x5'));var path=require(_0xadc3('0x6'));var sox=require('sox');var csv=require(_0xadc3('0x7'));var ejs=require(_0xadc3('0x8'));var fs=require('fs');var fs_extra=require(_0xadc3('0x9'));var _=require(_0xadc3('0xa'));var squel=require(_0xadc3('0xb'));var crypto=require(_0xadc3('0xc'));var jsforce=require(_0xadc3('0xd'));var deskjs=require(_0xadc3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xadc3('0xf'));var Papa=require(_0xadc3('0x10'));var Redis=require(_0xadc3('0x11'));var authService=require(_0xadc3('0x12'));var qs=require(_0xadc3('0x13'));var as=require(_0xadc3('0x14'));var hardwareService=require(_0xadc3('0x15'));var logger=require(_0xadc3('0x16'))(_0xadc3('0x17'));var utils=require(_0xadc3('0x18'));var config=require(_0xadc3('0x19'));var licenseUtil=require(_0xadc3('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require(_0xadc3('0x1b'))[_0xadc3('0x1c')];function respondWithStatusCode(_0x5adfa9,_0x162b77){_0x162b77=_0x162b77||0xcc;return function(_0x3bdc57){if(_0x3bdc57){return _0x5adfa9[_0xadc3('0x1d')](_0x162b77);}return _0x5adfa9[_0xadc3('0x1e')](_0x162b77)['end']();};}function respondWithResult(_0x340373,_0x5136f3){_0x5136f3=_0x5136f3||0xc8;return function(_0x258d9b){if(_0x258d9b){return _0x340373[_0xadc3('0x1e')](_0x5136f3)[_0xadc3('0x1f')](_0x258d9b);}};}function respondWithFilteredResult(_0x127037,_0x9c54cb){return function(_0x523c15){if(_0x523c15){var _0x3b0119=typeof _0x9c54cb[_0xadc3('0x20')]==='undefined'&&typeof _0x9c54cb[_0xadc3('0x21')]==='undefined';var _0x1a10ca=_0x523c15[_0xadc3('0x22')];var _0x23ba06=_0x3b0119?0x0:_0x9c54cb[_0xadc3('0x20')];var _0x15c1fd=_0x3b0119?_0x523c15['count']:_0x9c54cb[_0xadc3('0x20')]+_0x9c54cb[_0xadc3('0x21')];var _0x4df42c;if(_0x15c1fd>=_0x1a10ca){_0x15c1fd=_0x1a10ca;_0x4df42c=0xc8;}else{_0x4df42c=0xce;}_0x127037[_0xadc3('0x1e')](_0x4df42c);return _0x127037[_0xadc3('0x23')](_0xadc3('0x24'),_0x23ba06+'-'+_0x15c1fd+'/'+_0x1a10ca)[_0xadc3('0x1f')](_0x523c15);}return null;};}function patchUpdates(_0x4b1ee6){return function(_0x114791){try{jsonpatch[_0xadc3('0x25')](_0x114791,_0x4b1ee6,!![]);}catch(_0x475743){return BPromise['reject'](_0x475743);}return _0x114791[_0xadc3('0x26')]();};}function saveUpdates(_0x5eda33,_0x39f622){return function(_0x224141){if(_0x224141){return _0x224141[_0xadc3('0x27')](_0x5eda33)['then'](function(_0x42789e){return _0x42789e;});}return null;};}function removeEntity(_0x576e22,_0x19bba5){return function(_0x38e0b9){if(_0x38e0b9){return _0x38e0b9[_0xadc3('0x28')]()[_0xadc3('0x29')](function(){var _0x1af637=_0x38e0b9[_0xadc3('0x2a')]({'plain':!![]});var _0x4bca14=_0xadc3('0x2b');return db[_0xadc3('0x2c')]['destroy']({'where':{'type':_0x4bca14,'resourceId':_0x1af637['id']}})[_0xadc3('0x29')](function(){return _0x38e0b9;});})[_0xadc3('0x29')](function(){_0x576e22[_0xadc3('0x1e')](0xcc)[_0xadc3('0x2d')]();});}};}function handleEntityNotFound(_0x59e9e3,_0xe3a1fb){return function(_0x5c4c58){if(!_0x5c4c58){_0x59e9e3[_0xadc3('0x1d')](0x194);}return _0x5c4c58;};}function handleError(_0x406751,_0x556af5){_0x556af5=_0x556af5||0x1f4;return function(_0x3ee393){logger['error'](_0x3ee393[_0xadc3('0x2e')]);if(_0x3ee393[_0xadc3('0x2f')]){delete _0x3ee393[_0xadc3('0x2f')];}_0x406751[_0xadc3('0x1e')](_0x556af5)['send'](_0x3ee393);};}exports[_0xadc3('0x30')]=function(_0x3584a2,_0x10c72d){var _0x2b64fb={},_0xeadbb0={},_0x118840={'count':0x0,'rows':[]};var _0x2fb346=_[_0xadc3('0x31')](db[_0xadc3('0x32')][_0xadc3('0x33')],function(_0x1d9c2f){return{'name':_0x1d9c2f[_0xadc3('0x34')],'type':_0x1d9c2f[_0xadc3('0x35')]['key']};});_0xeadbb0[_0xadc3('0x36')]=_[_0xadc3('0x31')](_0x2fb346,_0xadc3('0x2f'));_0xeadbb0[_0xadc3('0x37')]=_[_0xadc3('0x38')](_0x3584a2[_0xadc3('0x37')]);_0xeadbb0[_0xadc3('0x39')]=_[_0xadc3('0x3a')](_0xeadbb0['model'],_0xeadbb0[_0xadc3('0x37')]);_0x2b64fb[_0xadc3('0x3b')]=_[_0xadc3('0x3a')](_0xeadbb0[_0xadc3('0x36')],qs[_0xadc3('0x3c')](_0x3584a2[_0xadc3('0x37')][_0xadc3('0x3c')]));_0x2b64fb['attributes']=_0x2b64fb['attributes']['length']?_0x2b64fb[_0xadc3('0x3b')]:_0xeadbb0[_0xadc3('0x36')];if(!_0x3584a2[_0xadc3('0x37')][_0xadc3('0x3d')]('nolimit')){_0x2b64fb[_0xadc3('0x21')]=qs[_0xadc3('0x21')](_0x3584a2[_0xadc3('0x37')][_0xadc3('0x21')]);_0x2b64fb[_0xadc3('0x20')]=qs[_0xadc3('0x20')](_0x3584a2[_0xadc3('0x37')][_0xadc3('0x20')]);}_0x2b64fb[_0xadc3('0x3e')]=qs[_0xadc3('0x3f')](_0x3584a2[_0xadc3('0x37')][_0xadc3('0x3f')]);_0x2b64fb[_0xadc3('0x40')]=qs[_0xadc3('0x39')](_[_0xadc3('0x41')](_0x3584a2['query'],_0xeadbb0[_0xadc3('0x39')]),_0x2fb346);if(_0x3584a2['query'][_0xadc3('0x42')]){_0x2b64fb[_0xadc3('0x40')]=_['merge'](_0x2b64fb['where'],{'$or':_[_0xadc3('0x31')](_0x2fb346,function(_0x18efe6){if(_0x18efe6['type']!==_0xadc3('0x43')){var _0x9f4ef9={};_0x9f4ef9[_0x18efe6[_0xadc3('0x2f')]]={'$like':'%'+_0x3584a2[_0xadc3('0x37')][_0xadc3('0x42')]+'%'};return _0x9f4ef9;}})});}_0x2b64fb=_[_0xadc3('0x44')]({},_0x2b64fb,_0x3584a2['options']);var _0xa9c466={'where':_0x2b64fb[_0xadc3('0x40')]};return db['AnalyticCustomReport']['count'](_0xa9c466)[_0xadc3('0x29')](function(_0x42b3b6){_0x118840[_0xadc3('0x22')]=_0x42b3b6;if(_0x3584a2[_0xadc3('0x37')][_0xadc3('0x45')]){_0x2b64fb[_0xadc3('0x46')]=[{'all':!![]}];}return db[_0xadc3('0x32')][_0xadc3('0x47')](_0x2b64fb);})[_0xadc3('0x29')](function(_0x172691){_0x118840['rows']=_0x172691;return _0x118840;})['then'](respondWithFilteredResult(_0x10c72d,_0x2b64fb))[_0xadc3('0x48')](handleError(_0x10c72d,null));};exports[_0xadc3('0x49')]=function(_0x2ed785,_0x25c931){var _0x31d2b9={'raw':![],'where':{'id':_0x2ed785[_0xadc3('0x4a')]['id']}},_0x2ca593={};_0x2ca593['model']=_[_0xadc3('0x38')](db[_0xadc3('0x32')][_0xadc3('0x33')]);_0x2ca593['query']=_[_0xadc3('0x38')](_0x2ed785['query']);_0x2ca593[_0xadc3('0x39')]=_['intersection'](_0x2ca593['model'],_0x2ca593['query']);_0x31d2b9[_0xadc3('0x3b')]=_[_0xadc3('0x3a')](_0x2ca593['model'],qs[_0xadc3('0x3c')](_0x2ed785[_0xadc3('0x37')][_0xadc3('0x3c')]));_0x31d2b9['attributes']=_0x31d2b9['attributes'][_0xadc3('0x4b')]?_0x31d2b9[_0xadc3('0x3b')]:_0x2ca593['model'];if(_0x2ed785['query'][_0xadc3('0x45')]){_0x31d2b9[_0xadc3('0x46')]=[{'all':!![]}];}_0x31d2b9=_[_0xadc3('0x44')]({},_0x31d2b9,_0x2ed785[_0xadc3('0x4c')]);return db[_0xadc3('0x32')][_0xadc3('0x4d')](_0x31d2b9)[_0xadc3('0x29')](handleEntityNotFound(_0x25c931,null))[_0xadc3('0x29')](respondWithResult(_0x25c931,null))[_0xadc3('0x48')](handleError(_0x25c931,null));};exports[_0xadc3('0x4e')]=function(_0x16285f,_0xb43e3){return db['AnalyticCustomReport'][_0xadc3('0x4e')](_0x16285f[_0xadc3('0x4f')],{})[_0xadc3('0x29')](function(_0x1fd40a){var _0xb9e602=_0x16285f[_0xadc3('0x50')][_0xadc3('0x2a')]({'plain':!![]});if(!_0xb9e602)throw new Error(_0xadc3('0x51'));if(_0xb9e602[_0xadc3('0x52')]===_0xadc3('0x50')){var _0x2bee87=_0x1fd40a[_0xadc3('0x2a')]({'plain':!![]});var _0x310140='Reports';return db[_0xadc3('0x53')]['find']({'where':{'name':_0x310140,'userProfileId':_0xb9e602['userProfileId']},'raw':!![]})[_0xadc3('0x29')](function(_0xaf6bee){if(_0xaf6bee&&_0xaf6bee[_0xadc3('0x54')]===0x0){return db[_0xadc3('0x2c')][_0xadc3('0x4e')]({'name':_0x2bee87['name'],'resourceId':_0x2bee87['id'],'type':_0xadc3('0x2b'),'sectionId':_0xaf6bee['id']},{})[_0xadc3('0x29')](function(){return _0x1fd40a;});}else{return _0x1fd40a;}})[_0xadc3('0x48')](function(_0x14a311){logger[_0xadc3('0x55')](_0xadc3('0x56'),_0x14a311);throw _0x14a311;});}return _0x1fd40a;})[_0xadc3('0x29')](respondWithResult(_0xb43e3,0xc9))[_0xadc3('0x48')](handleError(_0xb43e3,null));};exports[_0xadc3('0x27')]=function(_0x2b375f,_0x12657e){if(_0x2b375f[_0xadc3('0x4f')]['id']){delete _0x2b375f[_0xadc3('0x4f')]['id'];}return db[_0xadc3('0x32')]['find']({'where':{'id':_0x2b375f[_0xadc3('0x4a')]['id']}})[_0xadc3('0x29')](handleEntityNotFound(_0x12657e,null))['then'](saveUpdates(_0x2b375f['body'],null))['then'](respondWithResult(_0x12657e,null))[_0xadc3('0x48')](handleError(_0x12657e,null));};exports[_0xadc3('0x28')]=function(_0x197698,_0x10ba07){return db[_0xadc3('0x32')][_0xadc3('0x4d')]({'where':{'id':_0x197698[_0xadc3('0x4a')]['id']}})[_0xadc3('0x29')](handleEntityNotFound(_0x10ba07,null))[_0xadc3('0x29')](removeEntity(_0x10ba07,null))['catch'](handleError(_0x10ba07,null));};exports[_0xadc3('0x57')]=function(_0xc685cc,_0x8c1e96){var _0x3ade83=0xa;var _0x87890f=['join','left_join','right_join',_0xadc3('0x58')];var _0x51ddfa={'SUM':_0xadc3('0x59'),'COUNT':_0xadc3('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xadc3('0x5b'),'MIN':_0xadc3('0x5c'),'AVG':_0xadc3('0x5d'),'GROUP_CONCAT':_0xadc3('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xadc3('0x5f')};var _0x116b4e={'SEC_TO_TIME':_0xadc3('0x60'),'DATE':_0xadc3('0x61'),'HOUR':_0xadc3('0x62'),'ROUND':_0xadc3('0x63'),'UNIX_TIMESTAMP':_0xadc3('0x64')};var _0x114fe8=function(_0x2c8268){return!_[_0xadc3('0x65')]([_0xadc3('0x66'),_0xadc3('0x67'),_0xadc3('0x68'),_0xadc3('0x69')],_0x2c8268);};var _0x1718bb=function(_0x3fa852){if(!_0x3fa852||!_0x3fa852[_0xadc3('0x6a')][_0xadc3('0x4b')]){return'';}for(var _0x40a6c6='(',_0x3e2ade=0x0;_0x3e2ade<_0x3fa852[_0xadc3('0x6a')]['length'];_0x3e2ade+=0x1){_0x3e2ade>0x0&&(_0x40a6c6+='\x20'+_0x3fa852[_0xadc3('0x6b')]+'\x20');_0x40a6c6+=_0x3fa852[_0xadc3('0x6a')][_0x3e2ade][_0xadc3('0x6c')]?_0x1718bb(_0x3fa852['rules'][_0x3e2ade][_0xadc3('0x6c')]):_0x3fa852[_0xadc3('0x6a')][_0x3e2ade]['field']+'\x20'+_0x3fa852[_0xadc3('0x6a')][_0x3e2ade]['condition']+(_0x114fe8(_0x3fa852[_0xadc3('0x6a')][_0x3e2ade][_0xadc3('0x6d')])?'\x20'+_0x3fa852[_0xadc3('0x6a')][_0x3e2ade]['value']:'');}return _0x40a6c6+')';};var _0x383eec={'where':{'id':_0xc685cc[_0xadc3('0x4a')]['id']}},_0x5ec8c8,_0x45f208,_0xf9a3e2,_0xc9bd9c,_0x5d8d03;_0x383eec=_[_0xadc3('0x44')]({},_0x383eec,_0xc685cc['options']);return db['AnalyticCustomReport'][_0xadc3('0x4d')](_0x383eec)[_0xadc3('0x29')](function(_0x1f5bc6){if(_0x1f5bc6){_0x5ec8c8=_0x1f5bc6;return _0x1f5bc6[_0xadc3('0x6e')]();}return null;})[_0xadc3('0x29')](function(_0x13fb17){if(_0x13fb17){if(!_0x13fb17[_0xadc3('0x4b')]){throw new db[(_0xadc3('0x6f'))]['ValidationErrorItem'](_0xadc3('0x70'),0x193);}_0x45f208=_0x13fb17;return db['AnalyticMetric'][_0xadc3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x42416b){if(_0x42416b){_0xf9a3e2=_['keyBy'](_0x42416b,'id');var _0x304ddc;var _0x5513e4=squel[_0xadc3('0x71')]();_0x5513e4[_0xadc3('0x72')](_0x5ec8c8[_0xadc3('0x73')]);for(var _0x17572a=0x0;_0x17572a<_0x45f208[_0xadc3('0x4b')];_0x17572a+=0x1){_0x304ddc=_0x45f208[_0x17572a][_0xadc3('0x74')]?_0xf9a3e2[_0x45f208[_0x17572a][_0xadc3('0x74')]][_0xadc3('0x75')]:_0x45f208[_0x17572a][_0xadc3('0x76')];_0x304ddc=_0x45f208[_0x17572a][_0xadc3('0x77')]?_[_0xadc3('0x78')](_0x51ddfa[_0x45f208[_0x17572a][_0xadc3('0x77')]],'%s',_0x304ddc):_0x304ddc;_0x304ddc=_0x45f208[_0x17572a]['format']?_['replace'](_0x116b4e[_0x45f208[_0x17572a]['format']],'%s',_0x304ddc):_0x304ddc;if(_0x45f208[_0x17572a]['groupBy']){_0x5513e4[_0xadc3('0x6c')](_0x304ddc);}_0x45f208[_0x17572a][_0xadc3('0x79')]&&_0x5513e4[_0xadc3('0x3e')](_0x304ddc,_0x45f208[_0x17572a][_0xadc3('0x79')]===_0xadc3('0x7a')?![]:!![]);_0x5513e4['field'](_0x304ddc,_0x45f208[_0x17572a][_0xadc3('0x7b')]||_0x304ddc);}if(_0x5ec8c8['joins']){_0x5ec8c8[_0xadc3('0x7c')]=JSON[_0xadc3('0x7d')](_0x5ec8c8[_0xadc3('0x7c')]);for(var _0x1923d3=0x0;_0x1923d3<_0x5ec8c8['joins'][_0xadc3('0x4b')];_0x1923d3+=0x1){if(_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x35')]&&_['includes'](_0x87890f,_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x35')])&&_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x7e')]&&_0x5ec8c8['joins'][_0x1923d3][_0xadc3('0x7f')]&&_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x80')]){_0x5513e4[_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x35')]](_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x7f')],null,util[_0xadc3('0x81')](_0xadc3('0x82'),_0x5ec8c8[_0xadc3('0x73')],_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x7e')],_0x5ec8c8['joins'][_0x1923d3]['foreignTable'],_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3]['foreignKey']));}}}if(_0x5ec8c8[_0xadc3('0x83')]){_0x5ec8c8[_0xadc3('0x83')]=JSON[_0xadc3('0x7d')](_0x5ec8c8['conditions']);_0x5513e4[_0xadc3('0x40')](_0x1718bb(_0x5ec8c8['conditions'][_0xadc3('0x6c')]));}_0x5d8d03=_0x5513e4[_0xadc3('0x84')]();_0x5513e4[_0xadc3('0x21')](_0x3ade83);_0x5513e4[_0xadc3('0x20')](0x0);logger[_0xadc3('0x85')](_0xadc3('0x86'),_0x5513e4['toString']());return dbH[_0xadc3('0x87')][_0xadc3('0x37')](_0x5513e4['toString'](),{'type':dbH[_0xadc3('0x87')][_0xadc3('0x88')][_0xadc3('0x89')]});}})[_0xadc3('0x29')](respondWithResult(_0x8c1e96,null))[_0xadc3('0x48')](handleError(_0x8c1e96,null));};function runReport(_0x500a52,_0x366196,_0x30a372){var _0x106e14=_0x366196[_0xadc3('0x2f')];var _0x4f8a05=0xa;var _0x19108a=[_0xadc3('0x8a'),_0xadc3('0x8b'),_0xadc3('0x8c'),_0xadc3('0x58')];var _0x2f6061={'SUM':'SUM(%s)','COUNT':_0xadc3('0x5a'),'COUNT DISTINCT':_0xadc3('0x8d'),'MAX':_0xadc3('0x5b'),'MIN':_0xadc3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xadc3('0x5e'),'GROUP_CONCAT ASC':_0xadc3('0x8e'),'GROUP_CONCAT DESC':_0xadc3('0x5f')};var _0x3cf37e={'SEC_TO_TIME':_0xadc3('0x60'),'DATE':_0xadc3('0x61'),'HOUR':_0xadc3('0x62'),'ROUND':_0xadc3('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2810a8=function(_0xf1774f){return!_['includes']([_0xadc3('0x66'),_0xadc3('0x67'),_0xadc3('0x68'),_0xadc3('0x69')],_0xf1774f);};var _0xd3583=function(_0xbec775){if(!_0xbec775||!_0xbec775[_0xadc3('0x6a')][_0xadc3('0x4b')]){return'';}for(var _0x26d23e='(',_0x161768=0x0;_0x161768<_0xbec775['rules']['length'];_0x161768+=0x1){_0x161768>0x0&&(_0x26d23e+='\x20'+_0xbec775[_0xadc3('0x6b')]+'\x20');_0x26d23e+=_0xbec775[_0xadc3('0x6a')][_0x161768][_0xadc3('0x6c')]?_0xd3583(_0xbec775['rules'][_0x161768]['group']):_0xbec775[_0xadc3('0x6a')][_0x161768]['field']+'\x20'+_0xbec775[_0xadc3('0x6a')][_0x161768][_0xadc3('0x6d')]+(_0x2810a8(_0xbec775[_0xadc3('0x6a')][_0x161768][_0xadc3('0x6d')])?'\x20'+_0xbec775[_0xadc3('0x6a')][_0x161768][_0xadc3('0x8f')]:'');}return _0x26d23e+')';};var _0x477005={'where':{'id':_0x500a52['id']}},_0x44f41a,_0x223d49,_0x12f3f8,_0x51e29c,_0x1ba141;_0x477005=_[_0xadc3('0x44')]({},_0x477005,_0x30a372);return db[_0xadc3('0x32')]['find'](_0x477005)[_0xadc3('0x29')](function(_0x1df6a2){if(_0x1df6a2){_0x44f41a=_0x1df6a2;return _0x1df6a2[_0xadc3('0x6e')]();}return null;})[_0xadc3('0x29')](function(_0x15ee66){if(_0x15ee66){if(!_0x15ee66[_0xadc3('0x4b')]){throw new db[(_0xadc3('0x6f'))][(_0xadc3('0x90'))](_0xadc3('0x70'),0x193);}_0x223d49=_0x15ee66;return db[_0xadc3('0x91')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x2feeb0){if(_0x2feeb0){_0x12f3f8=_[_0xadc3('0x92')](_0x2feeb0,'id');var _0x2320ac;var _0x4d77e7=squel[_0xadc3('0x71')]();_0x4d77e7['from'](_0x44f41a['table']);for(var _0x3b86b2=0x0;_0x3b86b2<_0x223d49[_0xadc3('0x4b')];_0x3b86b2+=0x1){_0x2320ac=_0x223d49[_0x3b86b2][_0xadc3('0x74')]?_0x12f3f8[_0x223d49[_0x3b86b2]['MetricId']][_0xadc3('0x75')]:_0x223d49[_0x3b86b2]['field'];_0x2320ac=_0x223d49[_0x3b86b2][_0xadc3('0x77')]?_[_0xadc3('0x78')](_0x2f6061[_0x223d49[_0x3b86b2][_0xadc3('0x77')]],'%s',_0x2320ac):_0x2320ac;_0x2320ac=_0x223d49[_0x3b86b2]['format']?_[_0xadc3('0x78')](_0x3cf37e[_0x223d49[_0x3b86b2][_0xadc3('0x81')]],'%s',_0x2320ac):_0x2320ac;if(_0x223d49[_0x3b86b2]['groupBy']){_0x4d77e7[_0xadc3('0x6c')](_0x2320ac);}_0x223d49[_0x3b86b2][_0xadc3('0x79')]&&_0x4d77e7[_0xadc3('0x3e')](_0x2320ac,_0x223d49[_0x3b86b2][_0xadc3('0x79')]==='DESC'?![]:!![]);_0x4d77e7['field'](_0x2320ac,_0x223d49[_0x3b86b2]['alias']||_0x2320ac);}if(_0x44f41a['joins']){_0x44f41a[_0xadc3('0x7c')]=JSON[_0xadc3('0x7d')](_0x44f41a[_0xadc3('0x7c')]);for(var _0x5809c7=0x0;_0x5809c7<_0x44f41a[_0xadc3('0x7c')][_0xadc3('0x4b')];_0x5809c7+=0x1){if(_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x35')]&&_[_0xadc3('0x65')](_0x19108a,_0x44f41a['joins'][_0x5809c7]['type'])&&_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x7e')]&&_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x7f')]&&_0x44f41a[_0xadc3('0x7c')][_0x5809c7]['foreignKey']){_0x4d77e7[_0x44f41a[_0xadc3('0x7c')][_0x5809c7]['type']](_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x7f')],null,util[_0xadc3('0x81')](_0xadc3('0x82'),_0x44f41a[_0xadc3('0x73')],_0x44f41a[_0xadc3('0x7c')][_0x5809c7]['parentKey'],_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x7f')],_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x80')]));}}}if(_0x44f41a[_0xadc3('0x83')]){_0x44f41a['conditions']=JSON['parse'](_0x44f41a[_0xadc3('0x83')]);_0x4d77e7[_0xadc3('0x40')](_0xd3583(_0x44f41a['conditions'][_0xadc3('0x6c')]));}_0x1ba141=_0x4d77e7[_0xadc3('0x84')]();_0x4d77e7[_0xadc3('0x21')](_0x4f8a05);_0x4d77e7[_0xadc3('0x20')](0x0);return;}})[_0xadc3('0x29')](function(){if(_0x366196[_0xadc3('0x93')]==='web'){return null;}var _0x5a2714=_[_0xadc3('0x44')](_0x366196,{'name':_0x366196['fullPath']||_0x366196['name']||_0x44f41a[_0xadc3('0x2f')],'basename':_0x106e14,'savename':util[_0xadc3('0x81')](_0xadc3('0x94'),_0x366196[_0xadc3('0x2f')]||_0x44f41a[_0xadc3('0x2f')],require(_0xadc3('0x95'))[_0xadc3('0x96')](0x4),_0x366196[_0xadc3('0x93')]||_0xadc3('0x97')),'reportId':_0x44f41a['id'],'reportType':_0xadc3('0x98')});return db[_0xadc3('0x99')][_0xadc3('0x4e')](_0x5a2714,{'raw':!![]});})[_0xadc3('0x29')](function(_0x355412){if(_0x44f41a[_0xadc3('0x73')]===_0xadc3('0x9a')){_0x1ba141[_0xadc3('0x40')](_0x44f41a[_0xadc3('0x73')]+_0xadc3('0x9b'),_0x366196['startDate'],_0x366196[_0xadc3('0x9c')]);}else{_0x1ba141[_0xadc3('0x40')](_0x44f41a[_0xadc3('0x73')]+_0xadc3('0x9d'),_0x366196[_0xadc3('0x9e')],_0x366196['endDate']);}if(_0x355412){logger['info']('Run\x20Query:',_0x1ba141[_0xadc3('0x9f')]());require(_0xadc3('0xa0'))[_0xadc3('0xa1')](path['join'](__dirname,_0xadc3('0xa2'),_0x355412['output']),[_0x355412['id'],_0x1ba141[_0xadc3('0x9f')](),path[_0xadc3('0x8a')](__dirname,_0xadc3('0xa3'),_0x355412[_0xadc3('0xa4')]),_0x106e14]);return _0x355412;}else{var _0x4ddff6=squel[_0xadc3('0x71')]();_0x4ddff6[_0xadc3('0x72')]('('+_0x1ba141[_0xadc3('0x9f')]()+')','countTable');_0x4ddff6[_0xadc3('0x76')]('COUNT(*)',_0xadc3('0x22'));_0x1ba141['limit'](_0x366196[_0xadc3('0x21')]||_0x4f8a05);_0x1ba141[_0xadc3('0x20')](_0x366196['offset']||0x0);return dbH[_0xadc3('0x87')][_0xadc3('0x37')](_0x4ddff6[_0xadc3('0x9f')](),{'type':dbH[_0xadc3('0x87')][_0xadc3('0x88')][_0xadc3('0x89')]})[_0xadc3('0x29')](function(_0x4a0c95){if(!_0x4a0c95[_0xadc3('0x4b')]){_0x51e29c=0x0;}else{_0x51e29c=_0x4a0c95[0x0][_0xadc3('0x22')]||0x0;}return dbH[_0xadc3('0x87')][_0xadc3('0x37')](_0x1ba141[_0xadc3('0x9f')](),{'type':dbH[_0xadc3('0x87')][_0xadc3('0x88')]['SELECT']});})[_0xadc3('0x29')](function(_0x1cde3f){return{'rows':_0x1cde3f||[],'count':_0x51e29c};});}});}exports['run']=function(_0x2d9b5d,_0x5b7a5d){return runReport(_0x2d9b5d[_0xadc3('0x4a')],_0x2d9b5d[_0xadc3('0x37')],_0x2d9b5d['options'])[_0xadc3('0x29')](respondWithResult(_0x5b7a5d,null))['catch'](handleError(_0x5b7a5d,null));};exports[_0xadc3('0xa5')]=runReport;exports[_0xadc3('0x37')]=function(_0x57f0a4,_0x171eed){var _0x3d775d=0xa;var _0x4db8b3=[_0xadc3('0x8a'),_0xadc3('0x8b'),_0xadc3('0x8c'),'cross_join'];var _0x21d5b2={'SUM':_0xadc3('0x59'),'COUNT':_0xadc3('0x5a'),'COUNT DISTINCT':_0xadc3('0x8d'),'MAX':'MAX(%s)','MIN':_0xadc3('0x5c'),'AVG':_0xadc3('0x5d'),'GROUP_CONCAT':_0xadc3('0x5e'),'GROUP_CONCAT ASC':_0xadc3('0x8e'),'GROUP_CONCAT DESC':_0xadc3('0x5f')};var _0x3dfc54={'SEC_TO_TIME':_0xadc3('0x60'),'DATE':'DATE(%s)','HOUR':_0xadc3('0x62'),'ROUND':_0xadc3('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4381e2=function(_0x4a824d){return!_['includes']([_0xadc3('0x66'),_0xadc3('0x67'),_0xadc3('0x68'),_0xadc3('0x69')],_0x4a824d);};var _0x199a1f=function(_0x41578c){if(!_0x41578c||!_0x41578c[_0xadc3('0x6a')][_0xadc3('0x4b')]){return'';}for(var _0x37c55a='(',_0x202683=0x0;_0x202683<_0x41578c[_0xadc3('0x6a')][_0xadc3('0x4b')];_0x202683+=0x1){_0x202683>0x0&&(_0x37c55a+='\x20'+_0x41578c[_0xadc3('0x6b')]+'\x20');_0x37c55a+=_0x41578c['rules'][_0x202683][_0xadc3('0x6c')]?_0x199a1f(_0x41578c['rules'][_0x202683]['group']):_0x41578c['rules'][_0x202683][_0xadc3('0x76')]+'\x20'+_0x41578c[_0xadc3('0x6a')][_0x202683][_0xadc3('0x6d')]+(_0x4381e2(_0x41578c[_0xadc3('0x6a')][_0x202683][_0xadc3('0x6d')])?'\x20'+_0x41578c[_0xadc3('0x6a')][_0x202683][_0xadc3('0x8f')]:'');}return _0x37c55a+')';};var _0x3fdc3d={'where':{'id':_0x57f0a4['params']['id']}},_0x4695a5,_0x4492c8,_0x1e32b6,_0x16934c,_0x596a6a;_0x3fdc3d=_['merge']({},_0x3fdc3d,_0x57f0a4[_0xadc3('0x4c')]);return db[_0xadc3('0x32')]['find'](_0x3fdc3d)[_0xadc3('0x29')](function(_0x3d9975){if(_0x3d9975){_0x4695a5=_0x3d9975;return _0x3d9975['getFields']();}return null;})['then'](function(_0x262987){if(_0x262987){if(!_0x262987['length']){throw new db[(_0xadc3('0x6f'))][(_0xadc3('0x90'))](_0xadc3('0x70'),0x193);}_0x4492c8=_0x262987;return db[_0xadc3('0x91')]['findAll']({'raw':!![]});}return null;})[_0xadc3('0x29')](function(_0x5eff07){if(_0x5eff07){_0x1e32b6=_[_0xadc3('0x92')](_0x5eff07,'id');var _0x5e7979;var _0xb9024a=squel[_0xadc3('0x71')]();_0xb9024a[_0xadc3('0x72')](_0x4695a5[_0xadc3('0x73')]);for(var _0x7ccce7=0x0;_0x7ccce7<_0x4492c8[_0xadc3('0x4b')];_0x7ccce7+=0x1){_0x5e7979=_0x4492c8[_0x7ccce7]['MetricId']?_0x1e32b6[_0x4492c8[_0x7ccce7][_0xadc3('0x74')]][_0xadc3('0x75')]:_0x4492c8[_0x7ccce7][_0xadc3('0x76')];_0x5e7979=_0x4492c8[_0x7ccce7][_0xadc3('0x77')]?_[_0xadc3('0x78')](_0x21d5b2[_0x4492c8[_0x7ccce7][_0xadc3('0x77')]],'%s',_0x5e7979):_0x5e7979;_0x5e7979=_0x4492c8[_0x7ccce7][_0xadc3('0x81')]?_[_0xadc3('0x78')](_0x3dfc54[_0x4492c8[_0x7ccce7][_0xadc3('0x81')]],'%s',_0x5e7979):_0x5e7979;if(_0x4492c8[_0x7ccce7][_0xadc3('0xa6')]){_0xb9024a[_0xadc3('0x6c')](_0x5e7979);}_0x4492c8[_0x7ccce7][_0xadc3('0x79')]&&_0xb9024a[_0xadc3('0x3e')](_0x5e7979,_0x4492c8[_0x7ccce7]['orderBy']===_0xadc3('0x7a')?![]:!![]);_0xb9024a[_0xadc3('0x76')](_0x5e7979,_0x4492c8[_0x7ccce7][_0xadc3('0x7b')]||_0x5e7979);}if(_0x4695a5['joins']){_0x4695a5[_0xadc3('0x7c')]=JSON[_0xadc3('0x7d')](_0x4695a5[_0xadc3('0x7c')]);for(var _0x4424b7=0x0;_0x4424b7<_0x4695a5['joins'][_0xadc3('0x4b')];_0x4424b7+=0x1){if(_0x4695a5[_0xadc3('0x7c')][_0x4424b7]['type']&&_[_0xadc3('0x65')](_0x4db8b3,_0x4695a5[_0xadc3('0x7c')][_0x4424b7][_0xadc3('0x35')])&&_0x4695a5['joins'][_0x4424b7][_0xadc3('0x7e')]&&_0x4695a5['joins'][_0x4424b7]['foreignTable']&&_0x4695a5['joins'][_0x4424b7][_0xadc3('0x80')]){_0xb9024a[_0x4695a5[_0xadc3('0x7c')][_0x4424b7][_0xadc3('0x35')]](_0x4695a5[_0xadc3('0x7c')][_0x4424b7]['foreignTable'],null,util[_0xadc3('0x81')](_0xadc3('0x82'),_0x4695a5['table'],_0x4695a5[_0xadc3('0x7c')][_0x4424b7][_0xadc3('0x7e')],_0x4695a5[_0xadc3('0x7c')][_0x4424b7][_0xadc3('0x7f')],_0x4695a5[_0xadc3('0x7c')][_0x4424b7][_0xadc3('0x80')]));}}}if(_0x4695a5[_0xadc3('0x83')]){_0x4695a5[_0xadc3('0x83')]=JSON[_0xadc3('0x7d')](_0x4695a5[_0xadc3('0x83')]);_0xb9024a['where'](_0x199a1f(_0x4695a5[_0xadc3('0x83')][_0xadc3('0x6c')]));}_0x596a6a=_0xb9024a[_0xadc3('0x84')]();_0xb9024a[_0xadc3('0x21')](_0x3d775d);_0xb9024a[_0xadc3('0x20')](0x0);logger[_0xadc3('0x85')]('Limited\x20Query:',_0xb9024a[_0xadc3('0x9f')]());return dbH[_0xadc3('0x87')]['query'](_0xb9024a[_0xadc3('0x9f')](),{'type':dbH['sequelize'][_0xadc3('0x88')][_0xadc3('0x89')]});}})[_0xadc3('0x29')](function(){return{'sql':_0x596a6a[_0xadc3('0x9f')]()};})[_0xadc3('0x29')](respondWithResult(_0x171eed,null))[_0xadc3('0x48')](handleError(_0x171eed,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 799d8e6..bd373e3 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 _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 +var _0x6232=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','lodash'];(function(_0x4693b7,_0xdc6f8a){var _0x23fba2=function(_0x35d758){while(--_0x35d758){_0x4693b7['push'](_0x4693b7['shift']());}};_0x23fba2(++_0xdc6f8a);}(_0x6232,0x16a));var _0x2623=function(_0x345f35,_0x354c87){_0x345f35=_0x345f35-0x0;var _0x457ec4=_0x6232[_0x345f35];return _0x457ec4;};'use strict';var _=require(_0x2623('0x0'));var util=require('util');var logger=require(_0x2623('0x1'))(_0x2623('0x2'));var moment=require('moment');var BPromise=require(_0x2623('0x3'));var rp=require(_0x2623('0x4'));var fs=require('fs');var path=require(_0x2623('0x5'));var rimraf=require(_0x2623('0x6'));var config=require(_0x2623('0x7'));var attributes=require(_0x2623('0x8'));module[_0x2623('0x9')]=function(_0x53bfa5,_0x53987b){return _0x53bfa5[_0x2623('0xa')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','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 6790c98..010bac8 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 _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 +var _0x612e=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0x612e,0xfc));var _0xe612=function(_0x19cebc,_0x1d886b){_0x19cebc=_0x19cebc-0x0;var _0x5f0441=_0x612e[_0x19cebc];return _0x5f0441;};'use strict';var _=require(_0xe612('0x0'));var util=require('util');var moment=require(_0xe612('0x1'));var BPromise=require(_0xe612('0x2'));var rs=require(_0xe612('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe612('0x4'))['db'];var utils=require(_0xe612('0x5'));var logger=require(_0xe612('0x6'))(_0xe612('0x7'));var config=require(_0xe612('0x8'));var jayson=require(_0xe612('0x9'));var client=jayson[_0xe612('0xa')][_0xe612('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x323688,_0x409145,_0x4e55d6){return new BPromise(function(_0x5156fb,_0x365553){return client[_0xe612('0xc')](_0x323688,_0x4e55d6)[_0xe612('0xd')](function(_0x55be4c){logger[_0xe612('0xe')](_0xe612('0xf'),_0x409145,_0xe612('0x10'));logger['debug'](_0xe612('0x11'),_0x409145,'request\x20sent',JSON[_0xe612('0x12')](_0x55be4c));if(_0x55be4c[_0xe612('0x13')]){if(_0x55be4c[_0xe612('0x13')][_0xe612('0x14')]===0x1f4){logger[_0xe612('0x13')](_0xe612('0xf'),_0x409145,_0x55be4c[_0xe612('0x13')]['message']);return _0x365553(_0x55be4c[_0xe612('0x13')][_0xe612('0x15')]);}logger[_0xe612('0x13')](_0xe612('0xf'),_0x409145,_0x55be4c['error'][_0xe612('0x15')]);return _0x5156fb(_0x55be4c[_0xe612('0x13')][_0xe612('0x15')]);}else{logger[_0xe612('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x409145,_0xe612('0x10'));_0x5156fb(_0x55be4c[_0xe612('0x16')]['message']);}})[_0xe612('0x17')](function(_0x10c8d9){logger[_0xe612('0x13')](_0xe612('0xf'),_0x409145,_0x10c8d9);_0x365553(_0x10c8d9);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3e8a28b..de3b483 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 _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 +var _0xb925=['get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x16724a,_0x403ef8){var _0x1df0ae=function(_0x30974d){while(--_0x30974d){_0x16724a['push'](_0x16724a['shift']());}};_0x1df0ae(++_0x403ef8);}(_0xb925,0x6f));var _0x5b92=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xb925[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0x5b92('0x0'));var util=require(_0x5b92('0x1'));var path=require(_0x5b92('0x2'));var timeout=require(_0x5b92('0x3'));var express=require(_0x5b92('0x4'));var router=express[_0x5b92('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5b92('0x6'));var interaction=require(_0x5b92('0x7'));var config=require(_0x5b92('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x5b92('0x9')]('/',auth[_0x5b92('0xa')](),controller[_0x5b92('0xb')]);router[_0x5b92('0x9')](_0x5b92('0xc'),auth[_0x5b92('0xa')](),controller['show']);router[_0x5b92('0x9')](_0x5b92('0xd'),auth[_0x5b92('0xa')](),controller[_0x5b92('0xe')]);router[_0x5b92('0x9')](_0x5b92('0xf'),auth['isAuthenticated'](),controller[_0x5b92('0x10')]);router['get'](_0x5b92('0x11'),auth[_0x5b92('0xa')](),controller[_0x5b92('0x12')]);router['post']('/',auth[_0x5b92('0xa')](),controller['create']);router[_0x5b92('0x13')](_0x5b92('0xc'),auth[_0x5b92('0xa')](),controller[_0x5b92('0x14')]);router[_0x5b92('0x15')](_0x5b92('0xc'),auth[_0x5b92('0xa')](),controller[_0x5b92('0x16')]);module[_0x5b92('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 7a56dc1..63a70ab 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 _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 +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x14d233,_0x4289f7){var _0x2d4c76=function(_0x29ef14){while(--_0x29ef14){_0x14d233['push'](_0x14d233['shift']());}};_0x2d4c76(++_0x4289f7);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1b9f81,_0x3b6131){_0x1b9f81=_0x1b9f81-0x0;var _0x1c64e4=_0x3eea[_0x1b9f81];return _0x1c64e4;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 3bcacea..cbfcde3 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 _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 +var _0x687b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','catch','params','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ValidationErrorItem','DESC','parentKey','web','fullPath','%s-%s.%s','output','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','cross_join','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x534fb9,_0x466466){_0x534fb9=_0x534fb9-0x0;var _0x57d679=_0x687b[_0x534fb9];return _0x57d679;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];var dbH=require(_0xb687('0x1b'))['dbH'];function respondWithStatusCode(_0x4c97ed,_0x3e85b3){_0x3e85b3=_0x3e85b3||0xcc;return function(_0x155ebe){if(_0x155ebe){return _0x4c97ed['sendStatus'](_0x3e85b3);}return _0x4c97ed[_0xb687('0x1c')](_0x3e85b3)[_0xb687('0x1d')]();};}function respondWithResult(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xc8;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x1c')](_0x30d502)[_0xb687('0x1e')](_0x838dd4);}};}function respondWithFilteredResult(_0x141375,_0x263085){return function(_0x2c7a18){if(_0x2c7a18){var _0x25124a=typeof _0x263085[_0xb687('0x1f')]==='undefined'&&typeof _0x263085[_0xb687('0x20')]===_0xb687('0x21');var _0x30d370=_0x2c7a18['count'];var _0x48958d=_0x25124a?0x0:_0x263085[_0xb687('0x1f')];var _0x3a10ef=_0x25124a?_0x2c7a18[_0xb687('0x22')]:_0x263085['offset']+_0x263085[_0xb687('0x20')];var _0x481f1d;if(_0x3a10ef>=_0x30d370){_0x3a10ef=_0x30d370;_0x481f1d=0xc8;}else{_0x481f1d=0xce;}_0x141375[_0xb687('0x1c')](_0x481f1d);return _0x141375[_0xb687('0x23')](_0xb687('0x24'),_0x48958d+'-'+_0x3a10ef+'/'+_0x30d370)[_0xb687('0x1e')](_0x2c7a18);}return null;};}function patchUpdates(_0x49d5a1){return function(_0x3a73d5){try{jsonpatch['apply'](_0x3a73d5,_0x49d5a1,!![]);}catch(_0x335541){return BPromise[_0xb687('0x25')](_0x335541);}return _0x3a73d5[_0xb687('0x26')]();};}function saveUpdates(_0x546fde,_0x1dc06b){return function(_0x491623){if(_0x491623){return _0x491623[_0xb687('0x27')](_0x546fde)[_0xb687('0x28')](function(_0xbf6c58){return _0xbf6c58;});}return null;};}function removeEntity(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['destroy']()[_0xb687('0x28')](function(){var _0x129347=_0x2f0a0a[_0xb687('0x29')]({'plain':!![]});var _0x1a0261=_0xb687('0x2a');return db[_0xb687('0x2b')][_0xb687('0x2c')]({'where':{'type':_0x1a0261,'resourceId':_0x129347['id']}})[_0xb687('0x28')](function(){return _0x2f0a0a;});})[_0xb687('0x28')](function(){_0x38866c[_0xb687('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712cf,_0x192966){return function(_0x392721){if(!_0x392721){_0x3712cf[_0xb687('0x2d')](0x194);}return _0x392721;};}function handleError(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0x1f4;return function(_0x4e9a06){logger[_0xb687('0x2e')](_0x4e9a06['stack']);if(_0x4e9a06[_0xb687('0x2f')]){delete _0x4e9a06[_0xb687('0x2f')];}_0x2e5c8d[_0xb687('0x1c')](_0x173c58)[_0xb687('0x30')](_0x4e9a06);};}exports[_0xb687('0x31')]=function(_0x43d20d,_0xf1f0dd){var _0x556815={},_0x3da2be={},_0xe3428f={'count':0x0,'rows':[]};var _0x3c08ab=_[_0xb687('0x32')](db[_0xb687('0x33')][_0xb687('0x34')],function(_0x44be88){return{'name':_0x44be88[_0xb687('0x35')],'type':_0x44be88[_0xb687('0x36')][_0xb687('0x37')]};});_0x3da2be[_0xb687('0x38')]=_['map'](_0x3c08ab,'name');_0x3da2be[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x43d20d[_0xb687('0x39')]);_0x3da2be[_0xb687('0x3b')]=_['intersection'](_0x3da2be['model'],_0x3da2be[_0xb687('0x39')]);_0x556815[_0xb687('0x3c')]=_['intersection'](_0x3da2be[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x43d20d['query'][_0xb687('0x3d')]));_0x556815['attributes']=_0x556815[_0xb687('0x3c')][_0xb687('0x3e')]?_0x556815[_0xb687('0x3c')]:_0x3da2be[_0xb687('0x38')];if(!_0x43d20d[_0xb687('0x39')][_0xb687('0x3f')]('nolimit')){_0x556815[_0xb687('0x20')]=qs[_0xb687('0x20')](_0x43d20d[_0xb687('0x39')][_0xb687('0x20')]);_0x556815['offset']=qs[_0xb687('0x1f')](_0x43d20d[_0xb687('0x39')][_0xb687('0x1f')]);}_0x556815[_0xb687('0x40')]=qs[_0xb687('0x41')](_0x43d20d['query'][_0xb687('0x41')]);_0x556815[_0xb687('0x42')]=qs[_0xb687('0x3b')](_[_0xb687('0x43')](_0x43d20d[_0xb687('0x39')],_0x3da2be[_0xb687('0x3b')]),_0x3c08ab);if(_0x43d20d['query']['filter']){_0x556815[_0xb687('0x42')]=_['merge'](_0x556815[_0xb687('0x42')],{'$or':_[_0xb687('0x32')](_0x3c08ab,function(_0x48d3b1){if(_0x48d3b1[_0xb687('0x36')]!==_0xb687('0x44')){var _0x57776b={};_0x57776b[_0x48d3b1[_0xb687('0x2f')]]={'$like':'%'+_0x43d20d[_0xb687('0x39')][_0xb687('0x45')]+'%'};return _0x57776b;}})});}_0x556815=_['merge']({},_0x556815,_0x43d20d[_0xb687('0x46')]);var _0x9cffb2={'where':_0x556815[_0xb687('0x42')]};return db[_0xb687('0x33')][_0xb687('0x22')](_0x9cffb2)[_0xb687('0x28')](function(_0x21b9ef){_0xe3428f['count']=_0x21b9ef;if(_0x43d20d[_0xb687('0x39')]['includeAll']){_0x556815['include']=[{'all':!![]}];}return db[_0xb687('0x33')][_0xb687('0x47')](_0x556815);})['then'](function(_0x19a21c){_0xe3428f['rows']=_0x19a21c;return _0xe3428f;})[_0xb687('0x28')](respondWithFilteredResult(_0xf1f0dd,_0x556815))[_0xb687('0x48')](handleError(_0xf1f0dd,null));};exports['show']=function(_0x4cb7a0,_0x3a8509){var _0x5d9cb0={'raw':!![],'where':{'id':_0x4cb7a0[_0xb687('0x49')]['id']}},_0x247c67={};_0x247c67[_0xb687('0x38')]=_[_0xb687('0x3a')](db[_0xb687('0x33')][_0xb687('0x34')]);_0x247c67[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x4cb7a0[_0xb687('0x39')]);_0x247c67[_0xb687('0x3b')]=_[_0xb687('0x4a')](_0x247c67[_0xb687('0x38')],_0x247c67['query']);_0x5d9cb0[_0xb687('0x3c')]=_['intersection'](_0x247c67[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x4cb7a0[_0xb687('0x39')][_0xb687('0x3d')]));_0x5d9cb0[_0xb687('0x3c')]=_0x5d9cb0[_0xb687('0x3c')]['length']?_0x5d9cb0['attributes']:_0x247c67[_0xb687('0x38')];if(_0x4cb7a0[_0xb687('0x39')][_0xb687('0x4b')]){_0x5d9cb0[_0xb687('0x4c')]=[{'all':!![]}];}_0x5d9cb0=_['merge']({},_0x5d9cb0,_0x4cb7a0[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5d9cb0)[_0xb687('0x28')](handleEntityNotFound(_0x3a8509,null))['then'](respondWithResult(_0x3a8509,null))[_0xb687('0x48')](handleError(_0x3a8509,null));};exports[_0xb687('0x4e')]=function(_0x162b19,_0x401b99){return db['AnalyticDefaultReport']['create'](_0x162b19[_0xb687('0x4f')],{})[_0xb687('0x28')](function(_0x42b61a){var _0x508862=_0x162b19['user'][_0xb687('0x29')]({'plain':!![]});if(!_0x508862)throw new Error(_0xb687('0x50'));if(_0x508862[_0xb687('0x51')]===_0xb687('0x52')){var _0x34205d=_0x42b61a[_0xb687('0x29')]({'plain':!![]});var _0x602864=_0xb687('0x53');return db['UserProfileSection'][_0xb687('0x4d')]({'where':{'name':_0x602864,'userProfileId':_0x508862[_0xb687('0x54')]},'raw':!![]})[_0xb687('0x28')](function(_0x4f5784){if(_0x4f5784&&_0x4f5784['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34205d[_0xb687('0x2f')],'resourceId':_0x34205d['id'],'type':_0xb687('0x2a'),'sectionId':_0x4f5784['id']},{})[_0xb687('0x28')](function(){return _0x42b61a;});}else{return _0x42b61a;}})[_0xb687('0x48')](function(_0x1ddfd4){logger[_0xb687('0x2e')](_0xb687('0x55'),_0x1ddfd4);throw _0x1ddfd4;});}return _0x42b61a;})[_0xb687('0x28')](respondWithResult(_0x401b99,0xc9))[_0xb687('0x48')](handleError(_0x401b99,null));};exports[_0xb687('0x27')]=function(_0x128264,_0x166900){if(_0x128264[_0xb687('0x4f')]['id']){delete _0x128264[_0xb687('0x4f')]['id'];}return db[_0xb687('0x33')][_0xb687('0x4d')]({'where':{'id':_0x128264[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0x166900,null))['then'](saveUpdates(_0x128264[_0xb687('0x4f')],null))[_0xb687('0x28')](respondWithResult(_0x166900,null))[_0xb687('0x48')](handleError(_0x166900,null));};exports[_0xb687('0x2c')]=function(_0x4e5642,_0xfa8790){return db[_0xb687('0x33')]['find']({'where':{'id':_0x4e5642[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0xfa8790,null))[_0xb687('0x28')](removeEntity(_0xfa8790,null))[_0xb687('0x48')](handleError(_0xfa8790,null));};exports['preview']=function(_0x4fb188,_0x13ad6a){var _0x4ab9c5=0xa;var _0x5ea8fd=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x25e140={'SUM':'SUM(%s)','COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0x58ec8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0xbc3a94=function(_0x4bc18f){return!_[_0xb687('0x61')]([_0xb687('0x62'),_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65')],_0x4bc18f);};var _0x17505c=function(_0x132e3a){if(!_0x132e3a||!_0x132e3a['rules']['length']){return'';}for(var _0x2714c6='(',_0x4906df=0x0;_0x4906df<_0x132e3a[_0xb687('0x66')][_0xb687('0x3e')];_0x4906df+=0x1){_0x4906df>0x0&&(_0x2714c6+='\x20'+_0x132e3a[_0xb687('0x67')]+'\x20');_0x2714c6+=_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x68')]?_0x17505c(_0x132e3a['rules'][_0x4906df][_0xb687('0x68')]):_0x132e3a['rules'][_0x4906df][_0xb687('0x69')]+'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')]+(_0xbc3a94(_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')])?'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6b')]:'');}return _0x2714c6+')';};var _0x5deb7a={'where':{'id':_0x4fb188['params']['id']}},_0x28a6aa,_0x31ed20,_0x8942b7,_0x36bb4b,_0x258caf;_0x5deb7a=_[_0xb687('0x6c')]({},_0x5deb7a,_0x4fb188[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5deb7a)[_0xb687('0x28')](function(_0x15ef44){if(_0x15ef44){_0x28a6aa=_0x15ef44;return _0x15ef44[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x177ea4){if(_0x177ea4){if(!_0x177ea4[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x31ed20=_0x177ea4;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x505f7a){if(_0x505f7a){_0x8942b7=_[_0xb687('0x71')](_0x505f7a,'id');var _0x1a6075;var _0x53b00a=squel[_0xb687('0x72')]();_0x53b00a[_0xb687('0x73')](_0x28a6aa[_0xb687('0x74')]);for(var _0x5eeb75=0x0;_0x5eeb75<_0x31ed20[_0xb687('0x3e')];_0x5eeb75+=0x1){_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x75')]?_0x8942b7[_0x31ed20[_0x5eeb75]['MetricId']][_0xb687('0x76')]:_0x31ed20[_0x5eeb75][_0xb687('0x69')];_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x77')]?_[_0xb687('0x78')](_0x25e140[_0x31ed20[_0x5eeb75]['function']],'%s',_0x1a6075):_0x1a6075;_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x79')]?_[_0xb687('0x78')](_0x58ec8b[_0x31ed20[_0x5eeb75]['format']],'%s',_0x1a6075):_0x1a6075;if(_0x31ed20[_0x5eeb75][_0xb687('0x7a')]){_0x53b00a[_0xb687('0x68')](_0x1a6075);}_0x31ed20[_0x5eeb75]['orderBy']&&_0x53b00a['order'](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7b')]==='DESC'?![]:!![]);_0x53b00a[_0xb687('0x69')](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7c')]||_0x1a6075);}if(_0x28a6aa[_0xb687('0x7d')]){_0x28a6aa[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x7d')]);for(var _0x229bc4=0x0;_0x229bc4<_0x28a6aa[_0xb687('0x7d')]['length'];_0x229bc4+=0x1){if(_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x5ea8fd,_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')])&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey']&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x7f')]&&_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]){_0x53b00a[_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]](_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['foreignTable'],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x28a6aa['table'],_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey'],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x7f')],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]));}}}if(_0x28a6aa[_0xb687('0x81')]){_0x28a6aa['conditions']=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x81')]);_0x53b00a['where'](_0x17505c(_0x28a6aa[_0xb687('0x81')][_0xb687('0x68')]));}_0x258caf=_0x53b00a[_0xb687('0x82')]();_0x53b00a[_0xb687('0x20')](_0x4ab9c5);_0x53b00a[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x53b00a[_0xb687('0x85')]());return dbH[_0xb687('0x86')][_0xb687('0x39')](_0x53b00a[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')]['SELECT']});}})['then'](respondWithResult(_0x13ad6a,null))[_0xb687('0x48')](handleError(_0x13ad6a,null));};function runReport(_0x29e830,_0x22ebca,_0xfecb8d){var _0x3a7339=_0x22ebca['name'];var _0x59c94b=0xa;var _0x29e27e=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x448d59={'SUM':_0xb687('0x88'),'COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':_0xb687('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x25f5c3={'SEC_TO_TIME':_0xb687('0x8b'),'DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1037b1=function(_0x3bf480){return!_['includes']([_0xb687('0x62'),'IS\x20NOT\x20NULL',_0xb687('0x64'),_0xb687('0x65')],_0x3bf480);};var _0x5ec5f6=function(_0x1c683e){if(!_0x1c683e||!_0x1c683e[_0xb687('0x66')]['length']){return'';}for(var _0x231caa='(',_0x3479c5=0x0;_0x3479c5<_0x1c683e[_0xb687('0x66')][_0xb687('0x3e')];_0x3479c5+=0x1){_0x3479c5>0x0&&(_0x231caa+='\x20'+_0x1c683e[_0xb687('0x67')]+'\x20');_0x231caa+=_0x1c683e[_0xb687('0x66')][_0x3479c5]['group']?_0x5ec5f6(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x68')]):_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x69')]+'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')]+(_0x1037b1(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')])?'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6b')]:'');}return _0x231caa+')';};var _0x290ddf={'where':{'id':_0x29e830['id']}},_0x5ee585,_0x10fb0,_0x5be566,_0x3d98e2,_0x3aa1c8;_0x290ddf=_['merge']({},_0x290ddf,_0xfecb8d);return db['AnalyticDefaultReport'][_0xb687('0x4d')](_0x290ddf)[_0xb687('0x28')](function(_0x3b4acf){if(_0x3b4acf){_0x5ee585=_0x3b4acf;return _0x3b4acf[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1c3de0){if(_0x1c3de0){if(!_0x1c3de0[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))][(_0xb687('0x8e'))](_0xb687('0x6f'),0x193);}_0x10fb0=_0x1c3de0;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x1ea6fd){if(_0x1ea6fd){_0x5be566=_[_0xb687('0x71')](_0x1ea6fd,'id');var _0x3f45b7;var _0x508550=squel['select']();_0x508550[_0xb687('0x73')](_0x5ee585['table']);for(var _0x5f2557=0x0;_0x5f2557<_0x10fb0[_0xb687('0x3e')];_0x5f2557+=0x1){_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x75')]?_0x5be566[_0x10fb0[_0x5f2557]['MetricId']][_0xb687('0x76')]:_0x10fb0[_0x5f2557][_0xb687('0x69')];_0x3f45b7=_0x10fb0[_0x5f2557]['function']?_[_0xb687('0x78')](_0x448d59[_0x10fb0[_0x5f2557][_0xb687('0x77')]],'%s',_0x3f45b7):_0x3f45b7;_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x79')]?_[_0xb687('0x78')](_0x25f5c3[_0x10fb0[_0x5f2557][_0xb687('0x79')]],'%s',_0x3f45b7):_0x3f45b7;if(_0x10fb0[_0x5f2557][_0xb687('0x7a')]){_0x508550[_0xb687('0x68')](_0x3f45b7);}_0x10fb0[_0x5f2557][_0xb687('0x7b')]&&_0x508550[_0xb687('0x40')](_0x3f45b7,_0x10fb0[_0x5f2557]['orderBy']===_0xb687('0x8f')?![]:!![]);_0x508550[_0xb687('0x69')](_0x3f45b7,_0x10fb0[_0x5f2557]['alias']||_0x3f45b7);}if(_0x5ee585[_0xb687('0x7d')]){_0x5ee585['joins']=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x7d')]);for(var _0x59166c=0x0;_0x59166c<_0x5ee585[_0xb687('0x7d')][_0xb687('0x3e')];_0x59166c+=0x1){if(_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x29e27e,_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')])&&_0x5ee585['joins'][_0x59166c]['parentKey']&&_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignTable']&&_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x80')]){_0x508550[_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]](_0x5ee585['joins'][_0x59166c][_0xb687('0x7f')],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x5ee585[_0xb687('0x74')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x90')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x7f')],_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignKey']));}}}if(_0x5ee585[_0xb687('0x81')]){_0x5ee585[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x81')]);_0x508550[_0xb687('0x42')](_0x5ec5f6(_0x5ee585[_0xb687('0x81')][_0xb687('0x68')]));}_0x3aa1c8=_0x508550[_0xb687('0x82')]();_0x508550[_0xb687('0x20')](_0x59c94b);_0x508550[_0xb687('0x1f')](0x0);return;}})['then'](function(){if(_0x22ebca['output']===_0xb687('0x91')){return null;}var _0x1a7cd8=_[_0xb687('0x6c')](_0x22ebca,{'name':_0x22ebca[_0xb687('0x92')]||_0x22ebca[_0xb687('0x2f')]||_0x5ee585[_0xb687('0x2f')],'basename':_0x3a7339,'savename':util[_0xb687('0x79')](_0xb687('0x93'),_0x22ebca[_0xb687('0x2f')]||_0x5ee585['name'],require('randomstring')['generate'](0x4),_0x22ebca[_0xb687('0x94')]||_0xb687('0x95')),'reportId':_0x5ee585['id'],'reportType':_0xb687('0x96')});return db[_0xb687('0x97')][_0xb687('0x4e')](_0x1a7cd8,{'raw':!![]});})[_0xb687('0x28')](function(_0x473130){if(_0x5ee585[_0xb687('0x74')]==='cdr'){_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x98'),_0x22ebca[_0xb687('0x99')],_0x22ebca[_0xb687('0x9a')]);}else{_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x9b'),_0x22ebca['startDate'],_0x22ebca[_0xb687('0x9a')]);}if(_0x473130){logger['info'](_0xb687('0x9c'),_0x3aa1c8[_0xb687('0x85')]());require('child_process')[_0xb687('0x9d')](path[_0xb687('0x56')](__dirname,_0xb687('0x9e'),_0x473130['output']),[_0x473130['id'],_0x3aa1c8[_0xb687('0x85')](),path[_0xb687('0x56')](__dirname,_0xb687('0x9f'),_0x473130[_0xb687('0xa0')]),_0x3a7339]);return _0x473130;}else{var _0x3d4596=squel[_0xb687('0x72')]();_0x3d4596[_0xb687('0x73')]('('+_0x3aa1c8['toString']()+')',_0xb687('0xa1'));_0x3d4596[_0xb687('0x69')](_0xb687('0xa2'),_0xb687('0x22'));_0x3aa1c8[_0xb687('0x20')](_0x22ebca['limit']||_0x59c94b);_0x3aa1c8[_0xb687('0x1f')](_0x22ebca[_0xb687('0x1f')]||0x0);return dbH[_0xb687('0x86')]['query'](_0x3d4596[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]})['then'](function(_0x3dbbd6){if(!_0x3dbbd6[_0xb687('0x3e')]){_0x3d98e2=0x0;}else{_0x3d98e2=_0x3dbbd6[0x0][_0xb687('0x22')]||0x0;}return dbH['sequelize'][_0xb687('0x39')](_0x3aa1c8[_0xb687('0x85')](),{'type':dbH[_0xb687('0x86')][_0xb687('0x87')][_0xb687('0xa3')]});})[_0xb687('0x28')](function(_0x15e599){return{'rows':_0x15e599||[],'count':_0x3d98e2};});}});}exports[_0xb687('0xa4')]=function(_0x8f6ba0,_0x568aca){return runReport(_0x8f6ba0[_0xb687('0x49')],_0x8f6ba0[_0xb687('0x39')],_0x8f6ba0[_0xb687('0x46')])['then'](respondWithResult(_0x568aca,null))['catch'](handleError(_0x568aca,null));};exports[_0xb687('0xa5')]=runReport;exports['query']=function(_0x187810,_0x1d21ef){var _0x386d12=0xa;var _0x4dd8f4=['join',_0xb687('0x57'),_0xb687('0x58'),_0xb687('0xa6')];var _0x295795={'SUM':_0xb687('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':'MIN(%s)','AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0xe7056c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0x1b1cf5=function(_0x46283c){return!_[_0xb687('0x61')](['IS\x20NULL',_0xb687('0x63'),'IS\x20EMPTY',_0xb687('0x65')],_0x46283c);};var _0x394ed6=function(_0x875169){if(!_0x875169||!_0x875169[_0xb687('0x66')]['length']){return'';}for(var _0x1ec485='(',_0x55a919=0x0;_0x55a919<_0x875169['rules'][_0xb687('0x3e')];_0x55a919+=0x1){_0x55a919>0x0&&(_0x1ec485+='\x20'+_0x875169[_0xb687('0x67')]+'\x20');_0x1ec485+=_0x875169[_0xb687('0x66')][_0x55a919]['group']?_0x394ed6(_0x875169[_0xb687('0x66')][_0x55a919][_0xb687('0x68')]):_0x875169['rules'][_0x55a919][_0xb687('0x69')]+'\x20'+_0x875169['rules'][_0x55a919][_0xb687('0x6a')]+(_0x1b1cf5(_0x875169[_0xb687('0x66')][_0x55a919]['condition'])?'\x20'+_0x875169[_0xb687('0x66')][_0x55a919]['value']:'');}return _0x1ec485+')';};var _0x2aecd5={'where':{'id':_0x187810[_0xb687('0x49')]['id']}},_0x58955e,_0x488a2a,_0x303738,_0x3904a3,_0x581338;_0x2aecd5=_['merge']({},_0x2aecd5,_0x187810[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x2aecd5)['then'](function(_0xc29834){if(_0xc29834){_0x58955e=_0xc29834;return _0xc29834[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1f2f2b){if(_0x1f2f2b){if(!_0x1f2f2b[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x488a2a=_0x1f2f2b;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x3591e2){if(_0x3591e2){_0x303738=_['keyBy'](_0x3591e2,'id');var _0x4d0c14;var _0x200b55=squel[_0xb687('0x72')]();_0x200b55[_0xb687('0x73')](_0x58955e[_0xb687('0x74')]);for(var _0x33f4de=0x0;_0x33f4de<_0x488a2a[_0xb687('0x3e')];_0x33f4de+=0x1){_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x75')]?_0x303738[_0x488a2a[_0x33f4de]['MetricId']][_0xb687('0x76')]:_0x488a2a[_0x33f4de][_0xb687('0x69')];_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x77')]?_['replace'](_0x295795[_0x488a2a[_0x33f4de][_0xb687('0x77')]],'%s',_0x4d0c14):_0x4d0c14;_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x79')]?_[_0xb687('0x78')](_0xe7056c[_0x488a2a[_0x33f4de]['format']],'%s',_0x4d0c14):_0x4d0c14;if(_0x488a2a[_0x33f4de][_0xb687('0x7a')]){_0x200b55[_0xb687('0x68')](_0x4d0c14);}_0x488a2a[_0x33f4de]['orderBy']&&_0x200b55[_0xb687('0x40')](_0x4d0c14,_0x488a2a[_0x33f4de][_0xb687('0x7b')]===_0xb687('0x8f')?![]:!![]);_0x200b55[_0xb687('0x69')](_0x4d0c14,_0x488a2a[_0x33f4de]['alias']||_0x4d0c14);}if(_0x58955e[_0xb687('0x7d')]){_0x58955e[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x7d')]);for(var _0xcff220=0x0;_0xcff220<_0x58955e['joins'][_0xb687('0x3e')];_0xcff220+=0x1){if(_0x58955e[_0xb687('0x7d')][_0xcff220]['type']&&_[_0xb687('0x61')](_0x4dd8f4,_0x58955e[_0xb687('0x7d')][_0xcff220]['type'])&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')]&&_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable']&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x80')]){_0x200b55[_0x58955e['joins'][_0xcff220]['type']](_0x58955e['joins'][_0xcff220][_0xb687('0x7f')],null,util['format'](_0xb687('0xa7'),_0x58955e[_0xb687('0x74')],_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')],_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable'],_0x58955e['joins'][_0xcff220][_0xb687('0x80')]));}}}if(_0x58955e[_0xb687('0x81')]){_0x58955e[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x81')]);_0x200b55[_0xb687('0x42')](_0x394ed6(_0x58955e[_0xb687('0x81')]['group']));}_0x581338=_0x200b55['clone']();_0x200b55['limit'](_0x386d12);_0x200b55[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x200b55['toString']());return dbH['sequelize']['query'](_0x200b55[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]});}})[_0xb687('0x28')](function(){return{'sql':_0x581338[_0xb687('0x85')]()};})[_0xb687('0x28')](respondWithResult(_0x1d21ef,null))[_0xb687('0x48')](handleError(_0x1d21ef,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ccb634a..eb66b13 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 _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 +var _0x62a5=['analytics_default_reports','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x62a5,0x1d5));var _0x562a=function(_0x3b8c1e,_0x2e5b4b){_0x3b8c1e=_0x3b8c1e-0x0;var _0x41116b=_0x62a5[_0x3b8c1e];return _0x41116b;};'use strict';var _=require(_0x562a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x562a('0x1'));var moment=require(_0x562a('0x2'));var BPromise=require(_0x562a('0x3'));var rp=require(_0x562a('0x4'));var fs=require('fs');var path=require(_0x562a('0x5'));var rimraf=require(_0x562a('0x6'));var config=require(_0x562a('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x562a('0x8')]=function(_0x47b23f,_0x2fb1ed){return _0x47b23f[_0x562a('0x9')](_0x562a('0xa'),attributes,{'tableName':_0x562a('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 2a814b8..e8a127d 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 _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 +var _0xf9e2=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0xf9e2,0x16f));var _0x2f9e=function(_0x352605,_0x1472ac){_0x352605=_0x352605-0x0;var _0x2d1220=_0xf9e2[_0x352605];return _0x2d1220;};'use strict';var _=require('lodash');var util=require(_0x2f9e('0x0'));var moment=require('moment');var BPromise=require(_0x2f9e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f9e('0x2'));var db=require(_0x2f9e('0x3'))['db'];var utils=require(_0x2f9e('0x4'));var logger=require(_0x2f9e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2f9e('0x6'));var client=jayson[_0x2f9e('0x7')][_0x2f9e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24d820,_0x4bbb20,_0x3a9203){return new BPromise(function(_0x5d37ad,_0x379d03){return client[_0x2f9e('0x9')](_0x24d820,_0x3a9203)[_0x2f9e('0xa')](function(_0x22c715){logger[_0x2f9e('0xb')](_0x2f9e('0xc'),_0x4bbb20,_0x2f9e('0xd'));logger[_0x2f9e('0xe')](_0x2f9e('0xf'),_0x4bbb20,'request\x20sent',JSON[_0x2f9e('0x10')](_0x22c715));if(_0x22c715[_0x2f9e('0x11')]){if(_0x22c715['error']['code']===0x1f4){logger['error'](_0x2f9e('0xc'),_0x4bbb20,_0x22c715['error'][_0x2f9e('0x12')]);return _0x379d03(_0x22c715[_0x2f9e('0x11')]['message']);}logger[_0x2f9e('0x11')](_0x2f9e('0xc'),_0x4bbb20,_0x22c715['error'][_0x2f9e('0x12')]);return _0x5d37ad(_0x22c715[_0x2f9e('0x11')][_0x2f9e('0x12')]);}else{logger[_0x2f9e('0xb')](_0x2f9e('0xc'),_0x4bbb20,_0x2f9e('0xd'));_0x5d37ad(_0x22c715['result'][_0x2f9e('0x12')]);}})['catch'](function(_0xa3ed39){logger[_0x2f9e('0x11')](_0x2f9e('0xc'),_0x4bbb20,_0xa3ed39);_0x379d03(_0xa3ed39);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 05361e0..8d3fed8 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 _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 +var _0x8ac1=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','delete'];(function(_0x4f9baf,_0x17a0a1){var _0x5dd2dd=function(_0xc553ed){while(--_0xc553ed){_0x4f9baf['push'](_0x4f9baf['shift']());}};_0x5dd2dd(++_0x17a0a1);}(_0x8ac1,0x147));var _0x18ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8ac1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x18ac('0x0'));var util=require(_0x18ac('0x1'));var path=require('path');var timeout=require(_0x18ac('0x2'));var express=require(_0x18ac('0x3'));var router=express[_0x18ac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x18ac('0x5'));var interaction=require(_0x18ac('0x6'));var config=require(_0x18ac('0x7'));var controller=require(_0x18ac('0x8'));router[_0x18ac('0x9')]('/',auth[_0x18ac('0xa')](),controller['index']);router[_0x18ac('0x9')](_0x18ac('0xb'),auth[_0x18ac('0xa')](),controller[_0x18ac('0xc')]);router[_0x18ac('0x9')](_0x18ac('0xd'),auth['isAuthenticated'](),controller[_0x18ac('0xe')]);router['get'](_0x18ac('0xf'),auth[_0x18ac('0xa')](),controller[_0x18ac('0x10')]);router[_0x18ac('0x9')](_0x18ac('0x11'),auth[_0x18ac('0xa')](),controller[_0x18ac('0x12')]);router[_0x18ac('0x13')]('/',auth['isAuthenticated'](),controller[_0x18ac('0x14')]);router[_0x18ac('0x15')](_0x18ac('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x18ac('0x16')](_0x18ac('0xb'),auth[_0x18ac('0xa')](),controller[_0x18ac('0x17')]);module[_0x18ac('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 4e93e74..f9eee6a 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 _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 +var _0x4a1a=['xlsx','DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','exports','STRING','csv','pdf'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4a1a,0x13f));var _0xa4a1=function(_0x2fd1af,_0x1104b3){_0x2fd1af=_0x2fd1af-0x0;var _0x542a14=_0x4a1a[_0x2fd1af];return _0x542a14;};'use strict';var Sequelize=require(_0xa4a1('0x0'));var moment=require('moment');module[_0xa4a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xa4a1('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xa4a1('0x3'),_0xa4a1('0x4'),_0xa4a1('0x5')),'allowNull':![],'defaultValue':_0xa4a1('0x3')},'savename':{'type':Sequelize[_0xa4a1('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa4a1('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xa4a1('0x7')},'type':{'type':Sequelize[_0xa4a1('0x8')](_0xa4a1('0x9'),_0xa4a1('0xa')),'allowNull':![],'defaultValue':_0xa4a1('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xa4a1('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 907286c..7dfb899 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 _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 +var _0x708f=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','download','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','ExtractedReports','UserProfileSection'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x708f,0x137));var _0xf708=function(_0x18d047,_0x4e2cfb){_0x18d047=_0x18d047-0x0;var _0x28c3c2=_0x708f[_0x18d047];return _0x28c3c2;};'use strict';var emlformat=require(_0xf708('0x0'));var rimraf=require(_0xf708('0x1'));var zipdir=require(_0xf708('0x2'));var jsonpatch=require(_0xf708('0x3'));var rp=require(_0xf708('0x4'));var moment=require(_0xf708('0x5'));var BPromise=require(_0xf708('0x6'));var Mustache=require(_0xf708('0x7'));var util=require('util');var path=require(_0xf708('0x8'));var sox=require(_0xf708('0x9'));var csv=require(_0xf708('0xa'));var ejs=require(_0xf708('0xb'));var fs=require('fs');var fs_extra=require(_0xf708('0xc'));var _=require(_0xf708('0xd'));var squel=require(_0xf708('0xe'));var crypto=require(_0xf708('0xf'));var jsforce=require(_0xf708('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf708('0xa'));var querystring=require(_0xf708('0x11'));var Papa=require('papaparse');var Redis=require(_0xf708('0x12'));var authService=require(_0xf708('0x13'));var qs=require(_0xf708('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf708('0x15'));var logger=require(_0xf708('0x16'))('api');var utils=require(_0xf708('0x17'));var config=require(_0xf708('0x18'));var licenseUtil=require(_0xf708('0x19'));var db=require(_0xf708('0x1a'))['db'];function respondWithStatusCode(_0x4b4c76,_0x2a4f58){_0x2a4f58=_0x2a4f58||0xcc;return function(_0x31daa6){if(_0x31daa6){return _0x4b4c76[_0xf708('0x1b')](_0x2a4f58);}return _0x4b4c76[_0xf708('0x1c')](_0x2a4f58)['end']();};}function respondWithResult(_0x366454,_0x132e2b){_0x132e2b=_0x132e2b||0xc8;return function(_0x1bde54){if(_0x1bde54){return _0x366454[_0xf708('0x1c')](_0x132e2b)['json'](_0x1bde54);}};}function respondWithFilteredResult(_0x27d035,_0x5061bb){return function(_0x1bee5b){if(_0x1bee5b){var _0x5e3843=typeof _0x5061bb[_0xf708('0x1d')]==='undefined'&&typeof _0x5061bb['limit']===_0xf708('0x1e');var _0x2634af=_0x1bee5b[_0xf708('0x1f')];var _0x220dc0=_0x5e3843?0x0:_0x5061bb[_0xf708('0x1d')];var _0x273348=_0x5e3843?_0x1bee5b[_0xf708('0x1f')]:_0x5061bb['offset']+_0x5061bb[_0xf708('0x20')];var _0x1b41fe;if(_0x273348>=_0x2634af){_0x273348=_0x2634af;_0x1b41fe=0xc8;}else{_0x1b41fe=0xce;}_0x27d035[_0xf708('0x1c')](_0x1b41fe);return _0x27d035['set'](_0xf708('0x21'),_0x220dc0+'-'+_0x273348+'/'+_0x2634af)[_0xf708('0x22')](_0x1bee5b);}return null;};}function patchUpdates(_0x3faf84){return function(_0x316571){try{jsonpatch['apply'](_0x316571,_0x3faf84,!![]);}catch(_0x58090d){return BPromise[_0xf708('0x23')](_0x58090d);}return _0x316571[_0xf708('0x24')]();};}function saveUpdates(_0x389ea1,_0x27810a){return function(_0x17d410){if(_0x17d410){return _0x17d410[_0xf708('0x25')](_0x389ea1)[_0xf708('0x26')](function(_0x3f2278){return _0x3f2278;});}return null;};}function removeEntity(_0x11e3d5,_0x3621c2){return function(_0x272902){if(_0x272902){return _0x272902[_0xf708('0x27')]()[_0xf708('0x26')](function(){var _0x2b31c8=_0x272902['get']({'plain':!![]});var _0x1145a8='ExtractedReports';return db[_0xf708('0x28')]['destroy']({'where':{'type':_0x1145a8,'resourceId':_0x2b31c8['id']}})[_0xf708('0x26')](function(){return _0x272902;});})[_0xf708('0x26')](function(){_0x11e3d5['status'](0xcc)[_0xf708('0x29')]();});}};}function handleEntityNotFound(_0x4ad5f9,_0x57bc57){return function(_0x16b5bc){if(!_0x16b5bc){_0x4ad5f9[_0xf708('0x1b')](0x194);}return _0x16b5bc;};}function handleError(_0x4f54ef,_0x51fe4b){_0x51fe4b=_0x51fe4b||0x1f4;return function(_0x3ba109){logger[_0xf708('0x2a')](_0x3ba109[_0xf708('0x2b')]);if(_0x3ba109[_0xf708('0x2c')]){delete _0x3ba109[_0xf708('0x2c')];}_0x4f54ef[_0xf708('0x1c')](_0x51fe4b)[_0xf708('0x2d')](_0x3ba109);};}exports['index']=function(_0x52fefb,_0x399a71){var _0x18c376={},_0x64a590={},_0x4cd0f4={'count':0x0,'rows':[]};var _0x1fc842=_[_0xf708('0x2e')](db['AnalyticExtractedReport'][_0xf708('0x2f')],function(_0x1cc62b){return{'name':_0x1cc62b['fieldName'],'type':_0x1cc62b[_0xf708('0x30')][_0xf708('0x31')]};});_0x64a590[_0xf708('0x32')]=_['map'](_0x1fc842,_0xf708('0x2c'));_0x64a590[_0xf708('0x33')]=_[_0xf708('0x34')](_0x52fefb[_0xf708('0x33')]);_0x64a590[_0xf708('0x35')]=_[_0xf708('0x36')](_0x64a590[_0xf708('0x32')],_0x64a590['query']);_0x18c376[_0xf708('0x37')]=_[_0xf708('0x36')](_0x64a590['model'],qs[_0xf708('0x38')](_0x52fefb['query'][_0xf708('0x38')]));_0x18c376['attributes']=_0x18c376['attributes'][_0xf708('0x39')]?_0x18c376[_0xf708('0x37')]:_0x64a590[_0xf708('0x32')];if(!_0x52fefb[_0xf708('0x33')][_0xf708('0x3a')](_0xf708('0x3b'))){_0x18c376[_0xf708('0x20')]=qs[_0xf708('0x20')](_0x52fefb['query'][_0xf708('0x20')]);_0x18c376[_0xf708('0x1d')]=qs[_0xf708('0x1d')](_0x52fefb[_0xf708('0x33')]['offset']);}_0x18c376[_0xf708('0x3c')]=qs[_0xf708('0x3d')](_0x52fefb[_0xf708('0x33')][_0xf708('0x3d')]);_0x18c376[_0xf708('0x3e')]=qs[_0xf708('0x35')](_['pick'](_0x52fefb[_0xf708('0x33')],_0x64a590[_0xf708('0x35')]),_0x1fc842);if(_0x52fefb['query'][_0xf708('0x3f')]){_0x18c376['where']=_[_0xf708('0x40')](_0x18c376[_0xf708('0x3e')],{'$or':_[_0xf708('0x2e')](_0x1fc842,function(_0x14f06f){if(_0x14f06f[_0xf708('0x30')]!==_0xf708('0x41')){var _0x4e7c08={};_0x4e7c08[_0x14f06f[_0xf708('0x2c')]]={'$like':'%'+_0x52fefb[_0xf708('0x33')][_0xf708('0x3f')]+'%'};return _0x4e7c08;}})});}_0x18c376=_[_0xf708('0x40')]({},_0x18c376,_0x52fefb[_0xf708('0x42')]);var _0x5cb532={'where':_0x18c376[_0xf708('0x3e')]};return db[_0xf708('0x43')][_0xf708('0x1f')](_0x5cb532)['then'](function(_0x2a90a1){_0x4cd0f4[_0xf708('0x1f')]=_0x2a90a1;if(_0x52fefb['query'][_0xf708('0x44')]){_0x18c376[_0xf708('0x45')]=[{'all':!![]}];}return db[_0xf708('0x43')][_0xf708('0x46')](_0x18c376);})[_0xf708('0x26')](function(_0x27bd3e){_0x4cd0f4[_0xf708('0x47')]=_0x27bd3e;return _0x4cd0f4;})['then'](respondWithFilteredResult(_0x399a71,_0x18c376))[_0xf708('0x48')](handleError(_0x399a71,null));};exports['show']=function(_0x562c08,_0x1d0819){var _0x228357={'raw':!![],'where':{'id':_0x562c08[_0xf708('0x49')]['id']}},_0x56623d={};_0x56623d[_0xf708('0x32')]=_[_0xf708('0x34')](db['AnalyticExtractedReport'][_0xf708('0x2f')]);_0x56623d['query']=_[_0xf708('0x34')](_0x562c08['query']);_0x56623d[_0xf708('0x35')]=_[_0xf708('0x36')](_0x56623d[_0xf708('0x32')],_0x56623d[_0xf708('0x33')]);_0x228357[_0xf708('0x37')]=_['intersection'](_0x56623d[_0xf708('0x32')],qs[_0xf708('0x38')](_0x562c08[_0xf708('0x33')][_0xf708('0x38')]));_0x228357['attributes']=_0x228357['attributes'][_0xf708('0x39')]?_0x228357[_0xf708('0x37')]:_0x56623d['model'];if(_0x562c08[_0xf708('0x33')]['includeAll']){_0x228357[_0xf708('0x45')]=[{'all':!![]}];}_0x228357=_[_0xf708('0x40')]({},_0x228357,_0x562c08[_0xf708('0x42')]);return db['AnalyticExtractedReport'][_0xf708('0x4a')](_0x228357)[_0xf708('0x26')](handleEntityNotFound(_0x1d0819,null))[_0xf708('0x26')](respondWithResult(_0x1d0819,null))['catch'](handleError(_0x1d0819,null));};exports[_0xf708('0x4b')]=function(_0x18dd24,_0x583617){return db['AnalyticExtractedReport'][_0xf708('0x4b')](_0x18dd24[_0xf708('0x4c')],{})[_0xf708('0x26')](function(_0x118979){var _0x379cdf=_0x18dd24[_0xf708('0x4d')][_0xf708('0x4e')]({'plain':!![]});if(!_0x379cdf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x379cdf['role']===_0xf708('0x4d')){var _0x3a592f=_0x118979['get']({'plain':!![]});var _0x2d4260=_0xf708('0x4f');return db[_0xf708('0x50')]['find']({'where':{'name':_0x2d4260,'userProfileId':_0x379cdf[_0xf708('0x51')]},'raw':!![]})[_0xf708('0x26')](function(_0x50a05c){if(_0x50a05c&&_0x50a05c[_0xf708('0x52')]===0x0){return db[_0xf708('0x28')][_0xf708('0x4b')]({'name':_0x3a592f[_0xf708('0x2c')],'resourceId':_0x3a592f['id'],'type':_0x50a05c[_0xf708('0x2c')],'sectionId':_0x50a05c['id']},{})[_0xf708('0x26')](function(){return _0x118979;});}else{return _0x118979;}})['catch'](function(_0x36ff78){logger['error'](_0xf708('0x53'),_0x36ff78);throw _0x36ff78;});}return _0x118979;})[_0xf708('0x26')](respondWithResult(_0x583617,0xc9))[_0xf708('0x48')](handleError(_0x583617,null));};exports['update']=function(_0x2bf1e6,_0x2c7161){if(_0x2bf1e6['body']['id']){delete _0x2bf1e6[_0xf708('0x4c')]['id'];}return db[_0xf708('0x43')][_0xf708('0x4a')]({'where':{'id':_0x2bf1e6[_0xf708('0x49')]['id']}})[_0xf708('0x26')](handleEntityNotFound(_0x2c7161,null))[_0xf708('0x26')](saveUpdates(_0x2bf1e6[_0xf708('0x4c')],null))['then'](respondWithResult(_0x2c7161,null))['catch'](handleError(_0x2c7161,null));};exports[_0xf708('0x27')]=function(_0x532ca9,_0x3da6a2){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x532ca9[_0xf708('0x49')]['id']}})[_0xf708('0x26')](handleEntityNotFound(_0x3da6a2,null))['then'](removeEntity(_0x3da6a2,null))[_0xf708('0x48')](handleError(_0x3da6a2,null));};exports['download']=function(_0x5e6b3d,_0x281a70,_0x127657){return db[_0xf708('0x43')][_0xf708('0x4a')]({'where':{'id':_0x5e6b3d[_0xf708('0x49')]['id']},'attributes':[_0xf708('0x2c'),_0xf708('0x54'),_0xf708('0x55'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x281a70,null))[_0xf708('0x26')](function(_0x4667f3){if(_0x4667f3){if(!fs[_0xf708('0x56')](path[_0xf708('0x57')](config[_0xf708('0x58')],_0xf708('0x59'),_0x4667f3[_0xf708('0x55')]))){throw new db[(_0xf708('0x5a'))][(_0xf708('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5e6b3d[_0xf708('0x33')][_0xf708('0x5c')]){return _0x281a70[_0xf708('0x1b')](0xc8);}return _0x281a70[_0xf708('0x5d')](path[_0xf708('0x57')](config['root'],_0xf708('0x59'),_0x4667f3['savename']),util[_0xf708('0x5e')](_0xf708('0x5f'),_0x4667f3[_0xf708('0x54')]||_0x4667f3[_0xf708('0x2c')],_0x4667f3[_0xf708('0x60')][_0xf708('0x61')]()));}})[_0xf708('0x48')](handleError(_0x281a70,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index aef9d36..29bbf35 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 _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 +var _0x3fc5=['moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util','api'];(function(_0x582f7e,_0x4c080e){var _0x29528e=function(_0x88354){while(--_0x88354){_0x582f7e['push'](_0x582f7e['shift']());}};_0x29528e(++_0x4c080e);}(_0x3fc5,0x13d));var _0x53fc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3fc5[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x53fc('0x0'));var logger=require('../../config/logger')(_0x53fc('0x1'));var moment=require(_0x53fc('0x2'));var BPromise=require('bluebird');var rp=require(_0x53fc('0x3'));var fs=require('fs');var path=require(_0x53fc('0x4'));var rimraf=require(_0x53fc('0x5'));var config=require(_0x53fc('0x6'));var attributes=require(_0x53fc('0x7'));module['exports']=function(_0x12ee8a,_0x524d1b){return _0x12ee8a[_0x53fc('0x8')](_0x53fc('0x9'),attributes,{'tableName':_0x53fc('0xa'),'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 b54426d..11d4ca3 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 _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 +var _0xf218=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x4622df,_0x27eb7c){var _0x5990fe=function(_0x5531ac){while(--_0x5531ac){_0x4622df['push'](_0x4622df['shift']());}};_0x5990fe(++_0x27eb7c);}(_0xf218,0xa9));var _0x8f21=function(_0x421513,_0x4879e1){_0x421513=_0x421513-0x0;var _0x186ee1=_0xf218[_0x421513];return _0x186ee1;};'use strict';var _=require(_0x8f21('0x0'));var util=require(_0x8f21('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f21('0x2'));var fs=require('fs');var Redis=require(_0x8f21('0x3'));var db=require(_0x8f21('0x4'))['db'];var utils=require(_0x8f21('0x5'));var logger=require(_0x8f21('0x6'))(_0x8f21('0x7'));var config=require(_0x8f21('0x8'));var jayson=require(_0x8f21('0x9'));var client=jayson[_0x8f21('0xa')][_0x8f21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15e9ca,_0x47d97f,_0x2d6191){return new BPromise(function(_0x50bc9a,_0x5e3d65){return client[_0x8f21('0xc')](_0x15e9ca,_0x2d6191)['then'](function(_0xd0473d){logger[_0x8f21('0xd')](_0x8f21('0xe'),_0x47d97f,_0x8f21('0xf'));logger[_0x8f21('0x10')](_0x8f21('0x11'),_0x47d97f,_0x8f21('0xf'),JSON[_0x8f21('0x12')](_0xd0473d));if(_0xd0473d[_0x8f21('0x13')]){if(_0xd0473d[_0x8f21('0x13')][_0x8f21('0x14')]===0x1f4){logger[_0x8f21('0x13')](_0x8f21('0xe'),_0x47d97f,_0xd0473d[_0x8f21('0x13')][_0x8f21('0x15')]);return _0x5e3d65(_0xd0473d['error']['message']);}logger[_0x8f21('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x47d97f,_0xd0473d[_0x8f21('0x13')][_0x8f21('0x15')]);return _0x50bc9a(_0xd0473d['error']['message']);}else{logger[_0x8f21('0xd')](_0x8f21('0xe'),_0x47d97f,_0x8f21('0xf'));_0x50bc9a(_0xd0473d['result'][_0x8f21('0x15')]);}})[_0x8f21('0x16')](function(_0x1c76ea){logger[_0x8f21('0x13')](_0x8f21('0xe'),_0x47d97f,_0x1c76ea);_0x5e3d65(_0x1c76ea);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 518fe9f..204b8e3 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 _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 +var _0xf8fc=['create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','index','get','/:id/download','isAuthenticated','download'];(function(_0x391d23,_0x1bf2a6){var _0x196779=function(_0x41471c){while(--_0x41471c){_0x391d23['push'](_0x391d23['shift']());}};_0x196779(++_0x1bf2a6);}(_0xf8fc,0x100));var _0xcf8f=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xf8fc[_0x2adbeb];return _0x5e18a6;};'use strict';var multer=require(_0xcf8f('0x0'));var util=require(_0xcf8f('0x1'));var path=require(_0xcf8f('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf8f('0x3'));var router=express[_0xcf8f('0x4')]();var fs_extra=require(_0xcf8f('0x5'));var auth=require(_0xcf8f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf8f('0x7'));var controller=require(_0xcf8f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcf8f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcf8f('0xa')](_0xcf8f('0xb'),auth[_0xcf8f('0xc')](),controller[_0xcf8f('0xd')]);router['post']('/',auth[_0xcf8f('0xc')](),controller[_0xcf8f('0xe')]);router[_0xcf8f('0xf')]('/:id',auth[_0xcf8f('0xc')](),controller['update']);router['delete']('/:id',auth[_0xcf8f('0xc')](),controller[_0xcf8f('0x10')]);module[_0xcf8f('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index edf86ea..c612751 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 _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 +var _0x72e8=['sequelize','STRING','BOOLEAN'];(function(_0x2ad0c1,_0x7f1bd6){var _0x5c1a2e=function(_0x26ece1){while(--_0x26ece1){_0x2ad0c1['push'](_0x2ad0c1['shift']());}};_0x5c1a2e(++_0x7f1bd6);}(_0x72e8,0x180));var _0x872e=function(_0xe2bc12,_0x22c4a9){_0xe2bc12=_0xe2bc12-0x0;var _0x3cd963=_0x72e8[_0xe2bc12];return _0x3cd963;};'use strict';var Sequelize=require(_0x872e('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x872e('0x1')]},'format':{'type':Sequelize[_0x872e('0x1')]},'groupBy':{'type':Sequelize[_0x872e('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x872e('0x1')]},'custom':{'type':Sequelize[_0x872e('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 984ac1d..c284e94 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 _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 +var _0xa4f9=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','params','fields','length','include','find','create','bulkCreate','body','bulkDestroy','ids','AnalyticCustomReport','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x656f5c,_0x91ffe7){var _0x2beab5=function(_0x314c9b){while(--_0x314c9b){_0x656f5c['push'](_0x656f5c['shift']());}};_0x2beab5(++_0x91ffe7);}(_0xa4f9,0x1cf));var _0x9a4f=function(_0x52b608,_0x167590){_0x52b608=_0x52b608-0x0;var _0x354586=_0xa4f9[_0x52b608];return _0x354586;};'use strict';var emlformat=require(_0x9a4f('0x0'));var rimraf=require(_0x9a4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a4f('0x2'));var rp=require(_0x9a4f('0x3'));var moment=require(_0x9a4f('0x4'));var BPromise=require(_0x9a4f('0x5'));var Mustache=require(_0x9a4f('0x6'));var util=require(_0x9a4f('0x7'));var path=require(_0x9a4f('0x8'));var sox=require(_0x9a4f('0x9'));var csv=require(_0x9a4f('0xa'));var ejs=require(_0x9a4f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a4f('0xc'));var squel=require(_0x9a4f('0xd'));var crypto=require(_0x9a4f('0xe'));var jsforce=require(_0x9a4f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9a4f('0xa'));var querystring=require(_0x9a4f('0x10'));var Papa=require('papaparse');var Redis=require(_0x9a4f('0x11'));var authService=require(_0x9a4f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9a4f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a4f('0x14'))(_0x9a4f('0x15'));var utils=require(_0x9a4f('0x16'));var config=require(_0x9a4f('0x17'));var licenseUtil=require(_0x9a4f('0x18'));var db=require(_0x9a4f('0x19'))['db'];function respondWithStatusCode(_0x2b8baf,_0x6c6371){_0x6c6371=_0x6c6371||0xcc;return function(_0x2b1e91){if(_0x2b1e91){return _0x2b8baf[_0x9a4f('0x1a')](_0x6c6371);}return _0x2b8baf['status'](_0x6c6371)[_0x9a4f('0x1b')]();};}function respondWithResult(_0x3f82b3,_0x45822b){_0x45822b=_0x45822b||0xc8;return function(_0x5833ac){if(_0x5833ac){return _0x3f82b3['status'](_0x45822b)[_0x9a4f('0x1c')](_0x5833ac);}};}function respondWithFilteredResult(_0x2f1ed9,_0x1b9bf7){return function(_0x5b5f0e){if(_0x5b5f0e){var _0x327f39=typeof _0x1b9bf7[_0x9a4f('0x1d')]===_0x9a4f('0x1e')&&typeof _0x1b9bf7['limit']==='undefined';var _0x29fb52=_0x5b5f0e['count'];var _0xe88cd3=_0x327f39?0x0:_0x1b9bf7[_0x9a4f('0x1d')];var _0x53635f=_0x327f39?_0x5b5f0e[_0x9a4f('0x1f')]:_0x1b9bf7[_0x9a4f('0x1d')]+_0x1b9bf7[_0x9a4f('0x20')];var _0x3e36d9;if(_0x53635f>=_0x29fb52){_0x53635f=_0x29fb52;_0x3e36d9=0xc8;}else{_0x3e36d9=0xce;}_0x2f1ed9[_0x9a4f('0x21')](_0x3e36d9);return _0x2f1ed9[_0x9a4f('0x22')](_0x9a4f('0x23'),_0xe88cd3+'-'+_0x53635f+'/'+_0x29fb52)['json'](_0x5b5f0e);}return null;};}function patchUpdates(_0x46c756){return function(_0x1eb0df){try{jsonpatch[_0x9a4f('0x24')](_0x1eb0df,_0x46c756,!![]);}catch(_0x2cc3d9){return BPromise[_0x9a4f('0x25')](_0x2cc3d9);}return _0x1eb0df['save']();};}function saveUpdates(_0x2ba826,_0x4ebed3){return function(_0xe8b38a){if(_0xe8b38a){return _0xe8b38a[_0x9a4f('0x26')](_0x2ba826)[_0x9a4f('0x27')](function(_0x498735){return _0x498735;});}return null;};}function removeEntity(_0x5c1df7,_0xd7af4f){return function(_0x141ec9){if(_0x141ec9){return _0x141ec9[_0x9a4f('0x28')]()[_0x9a4f('0x27')](function(){_0x5c1df7[_0x9a4f('0x21')](0xcc)[_0x9a4f('0x1b')]();});}};}function handleEntityNotFound(_0x43c2c7,_0x3958e4){return function(_0x4f1681){if(!_0x4f1681){_0x43c2c7['sendStatus'](0x194);}return _0x4f1681;};}function handleError(_0x2f5e32,_0x38bbd9){_0x38bbd9=_0x38bbd9||0x1f4;return function(_0xf48281){logger[_0x9a4f('0x29')](_0xf48281['stack']);if(_0xf48281['name']){delete _0xf48281[_0x9a4f('0x2a')];}_0x2f5e32[_0x9a4f('0x21')](_0x38bbd9)[_0x9a4f('0x2b')](_0xf48281);};}exports[_0x9a4f('0x2c')]=function(_0x5dd19f,_0x1ac219){var _0x16138d={},_0x4d51ed={},_0x586cdf={'count':0x0,'rows':[]};var _0x3f521c=_['map'](db['AnalyticFieldReport'][_0x9a4f('0x2d')],function(_0x3abd90){return{'name':_0x3abd90[_0x9a4f('0x2e')],'type':_0x3abd90[_0x9a4f('0x2f')]['key']};});_0x4d51ed[_0x9a4f('0x30')]=_[_0x9a4f('0x31')](_0x3f521c,'name');_0x4d51ed[_0x9a4f('0x32')]=_[_0x9a4f('0x33')](_0x5dd19f[_0x9a4f('0x32')]);_0x4d51ed[_0x9a4f('0x34')]=_[_0x9a4f('0x35')](_0x4d51ed['model'],_0x4d51ed['query']);_0x16138d[_0x9a4f('0x36')]=_[_0x9a4f('0x35')](_0x4d51ed[_0x9a4f('0x30')],qs['fields'](_0x5dd19f[_0x9a4f('0x32')]['fields']));_0x16138d[_0x9a4f('0x36')]=_0x16138d['attributes']['length']?_0x16138d[_0x9a4f('0x36')]:_0x4d51ed[_0x9a4f('0x30')];if(!_0x5dd19f['query'][_0x9a4f('0x37')]('nolimit')){_0x16138d[_0x9a4f('0x20')]=qs[_0x9a4f('0x20')](_0x5dd19f[_0x9a4f('0x32')][_0x9a4f('0x20')]);_0x16138d[_0x9a4f('0x1d')]=qs[_0x9a4f('0x1d')](_0x5dd19f[_0x9a4f('0x32')][_0x9a4f('0x1d')]);}_0x16138d['order']=qs[_0x9a4f('0x38')](_0x5dd19f[_0x9a4f('0x32')][_0x9a4f('0x38')]);_0x16138d[_0x9a4f('0x39')]=qs[_0x9a4f('0x34')](_['pick'](_0x5dd19f['query'],_0x4d51ed[_0x9a4f('0x34')]),_0x3f521c);if(_0x5dd19f[_0x9a4f('0x32')]['filter']){_0x16138d[_0x9a4f('0x39')]=_[_0x9a4f('0x3a')](_0x16138d[_0x9a4f('0x39')],{'$or':_[_0x9a4f('0x31')](_0x3f521c,function(_0x36d65d){if(_0x36d65d[_0x9a4f('0x2f')]!==_0x9a4f('0x3b')){var _0x5ea237={};_0x5ea237[_0x36d65d[_0x9a4f('0x2a')]]={'$like':'%'+_0x5dd19f['query'][_0x9a4f('0x3c')]+'%'};return _0x5ea237;}})});}_0x16138d=_[_0x9a4f('0x3a')]({},_0x16138d,_0x5dd19f[_0x9a4f('0x3d')]);var _0x2382e9={'where':_0x16138d[_0x9a4f('0x39')]};return db[_0x9a4f('0x3e')][_0x9a4f('0x1f')](_0x2382e9)[_0x9a4f('0x27')](function(_0x3b2283){_0x586cdf[_0x9a4f('0x1f')]=_0x3b2283;if(_0x5dd19f[_0x9a4f('0x32')][_0x9a4f('0x3f')]){_0x16138d['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x9a4f('0x40')](_0x16138d);})[_0x9a4f('0x27')](function(_0x37998f){_0x586cdf[_0x9a4f('0x41')]=_0x37998f;return _0x586cdf;})['then'](respondWithFilteredResult(_0x1ac219,_0x16138d))[_0x9a4f('0x42')](handleError(_0x1ac219,null));};exports[_0x9a4f('0x43')]=function(_0x1634ea,_0x24c2a2){var _0x1baf81={'raw':![],'where':{'id':_0x1634ea[_0x9a4f('0x44')]['id']}},_0x2d90a5={};_0x2d90a5[_0x9a4f('0x30')]=_[_0x9a4f('0x33')](db[_0x9a4f('0x3e')][_0x9a4f('0x2d')]);_0x2d90a5[_0x9a4f('0x32')]=_[_0x9a4f('0x33')](_0x1634ea[_0x9a4f('0x32')]);_0x2d90a5[_0x9a4f('0x34')]=_[_0x9a4f('0x35')](_0x2d90a5[_0x9a4f('0x30')],_0x2d90a5['query']);_0x1baf81[_0x9a4f('0x36')]=_['intersection'](_0x2d90a5[_0x9a4f('0x30')],qs['fields'](_0x1634ea[_0x9a4f('0x32')][_0x9a4f('0x45')]));_0x1baf81[_0x9a4f('0x36')]=_0x1baf81[_0x9a4f('0x36')][_0x9a4f('0x46')]?_0x1baf81[_0x9a4f('0x36')]:_0x2d90a5[_0x9a4f('0x30')];if(_0x1634ea['query'][_0x9a4f('0x3f')]){_0x1baf81[_0x9a4f('0x47')]=[{'all':!![]}];}_0x1baf81=_[_0x9a4f('0x3a')]({},_0x1baf81,_0x1634ea['options']);return db[_0x9a4f('0x3e')][_0x9a4f('0x48')](_0x1baf81)['then'](handleEntityNotFound(_0x24c2a2,null))[_0x9a4f('0x27')](respondWithResult(_0x24c2a2,null))[_0x9a4f('0x42')](handleError(_0x24c2a2,null));};exports[_0x9a4f('0x49')]=function(_0x324bee,_0x1ae9fc){return db['AnalyticFieldReport'][_0x9a4f('0x49')](_0x324bee['body'],{})[_0x9a4f('0x27')](respondWithResult(_0x1ae9fc,0xc9))[_0x9a4f('0x42')](handleError(_0x1ae9fc,null));};exports['bulkCreate']=function(_0x1ec51e,_0xefc89d){return db[_0x9a4f('0x3e')][_0x9a4f('0x4a')](_0x1ec51e[_0x9a4f('0x4b')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xefc89d,0xc9))[_0x9a4f('0x42')](handleError(_0xefc89d,null));};exports[_0x9a4f('0x26')]=function(_0x483523,_0xfdd10){if(_0x483523['body']['id']){delete _0x483523[_0x9a4f('0x4b')]['id'];}return db[_0x9a4f('0x3e')][_0x9a4f('0x48')]({'where':{'id':_0x483523[_0x9a4f('0x44')]['id']}})[_0x9a4f('0x27')](handleEntityNotFound(_0xfdd10,null))[_0x9a4f('0x27')](saveUpdates(_0x483523['body'],null))[_0x9a4f('0x27')](respondWithResult(_0xfdd10,null))[_0x9a4f('0x42')](handleError(_0xfdd10,null));};exports[_0x9a4f('0x28')]=function(_0x232bb5,_0x2dd0a5){return db['AnalyticFieldReport'][_0x9a4f('0x48')]({'where':{'id':_0x232bb5[_0x9a4f('0x44')]['id']}})[_0x9a4f('0x27')](handleEntityNotFound(_0x2dd0a5,null))[_0x9a4f('0x27')](removeEntity(_0x2dd0a5,null))[_0x9a4f('0x42')](handleError(_0x2dd0a5,null));};exports[_0x9a4f('0x4c')]=function(_0x5f5de1,_0x273698){return db['AnalyticFieldReport'][_0x9a4f('0x28')]({'where':{'id':_0x5f5de1[_0x9a4f('0x32')][_0x9a4f('0x4d')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x273698,0xcc))[_0x9a4f('0x42')](handleError(_0x273698,null));};exports['addFields']=function(_0xce80ec,_0x19089a,_0x5f2f95){return db[_0x9a4f('0x4e')]['findOne']({'where':{'id':_0xce80ec[_0x9a4f('0x44')]['id']}})['then'](handleEntityNotFound(_0x19089a,null))[_0x9a4f('0x27')](function(_0x5c62e8){if(_0x5c62e8){return db['sequelize'][_0x9a4f('0x4f')](function(_0x46e37d){return db[_0x9a4f('0x3e')]['destroy']({'where':{'CustomReportId':_0xce80ec[_0x9a4f('0x44')]['id']},'transaction':_0x46e37d})[_0x9a4f('0x27')](function(_0x2fb047){var _0x4dce74=_[_0x9a4f('0x31')](_0xce80ec[_0x9a4f('0x4b')],function(_0x3418c9){delete _0x3418c9['id'];_0x3418c9[_0x9a4f('0x50')]=_0xce80ec[_0x9a4f('0x44')]['id'];return _0x3418c9;});return db['AnalyticFieldReport'][_0x9a4f('0x4a')](_0x4dce74,{'transaction':_0x46e37d});});})[_0x9a4f('0x27')](function(){return db[_0x9a4f('0x3e')]['findAll']({'where':{'CustomReportId':_0xce80ec['params']['id']}});});}})[_0x9a4f('0x27')](respondWithResult(_0x19089a,null))['catch'](handleError(_0x19089a,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 24c050e..4e29ec9 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 _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 +var _0x2135=['rimraf','../../config/environment','./analyticFieldReport.attributes','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2146c3,_0x59a32a){var _0x7e73f=function(_0xe344b7){while(--_0xe344b7){_0x2146c3['push'](_0x2146c3['shift']());}};_0x7e73f(++_0x59a32a);}(_0x2135,0xad));var _0x5213=function(_0x2b266c,_0x39fd9f){_0x2b266c=_0x2b266c-0x0;var _0x3c38f2=_0x2135[_0x2b266c];return _0x3c38f2;};'use strict';var _=require(_0x5213('0x0'));var util=require(_0x5213('0x1'));var logger=require(_0x5213('0x2'))(_0x5213('0x3'));var moment=require(_0x5213('0x4'));var BPromise=require(_0x5213('0x5'));var rp=require(_0x5213('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5213('0x7'));var config=require(_0x5213('0x8'));var attributes=require(_0x5213('0x9'));module['exports']=function(_0x234f24,_0x2fa47e){return _0x234f24['define']('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index aa30aae..7a26b1f 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 _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 +var _0x4341=['rpc','../../config/environment','jayson/promise','client','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x17a8b5,_0x2842bd){var _0x3c05c6=function(_0x3d85ee){while(--_0x3d85ee){_0x17a8b5['push'](_0x17a8b5['shift']());}};_0x3c05c6(++_0x2842bd);}(_0x4341,0x1dc));var _0x1434=function(_0x484ad6,_0x4efaee){_0x484ad6=_0x484ad6-0x0;var _0x4950d0=_0x4341[_0x484ad6];return _0x4950d0;};'use strict';var _=require(_0x1434('0x0'));var util=require(_0x1434('0x1'));var moment=require(_0x1434('0x2'));var BPromise=require('bluebird');var rs=require(_0x1434('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1434('0x4'))['db'];var utils=require(_0x1434('0x5'));var logger=require(_0x1434('0x6'))(_0x1434('0x7'));var config=require(_0x1434('0x8'));var jayson=require(_0x1434('0x9'));var client=jayson[_0x1434('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23bcf3,_0x3f1aca,_0x26d3f0){return new BPromise(function(_0x4e739b,_0x46cd0d){return client['request'](_0x23bcf3,_0x26d3f0)[_0x1434('0xb')](function(_0x4a9222){logger[_0x1434('0xc')](_0x1434('0xd'),_0x3f1aca,'request\x20sent');logger['debug'](_0x1434('0xe'),_0x3f1aca,_0x1434('0xf'),JSON[_0x1434('0x10')](_0x4a9222));if(_0x4a9222[_0x1434('0x11')]){if(_0x4a9222[_0x1434('0x11')][_0x1434('0x12')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3f1aca,_0x4a9222[_0x1434('0x11')][_0x1434('0x13')]);return _0x46cd0d(_0x4a9222['error'][_0x1434('0x13')]);}logger[_0x1434('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3f1aca,_0x4a9222[_0x1434('0x11')][_0x1434('0x13')]);return _0x4e739b(_0x4a9222[_0x1434('0x11')][_0x1434('0x13')]);}else{logger['info'](_0x1434('0xd'),_0x3f1aca,_0x1434('0xf'));_0x4e739b(_0x4a9222[_0x1434('0x14')][_0x1434('0x13')]);}})['catch'](function(_0x4e24cf){logger[_0x1434('0x11')](_0x1434('0xd'),_0x3f1aca,_0x4e24cf);_0x46cd0d(_0x4e24cf);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0589d89..4cb677d 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(_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 +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(_0x238247,_0x2d988c){var _0x5966db=function(_0xa89fb5){while(--_0xa89fb5){_0x238247['push'](_0x238247['shift']());}};_0x5966db(++_0x2d988c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 5ae8dbb..e25a643 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 _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 +var _0xfaa4=['exports','STRING','name','TEXT','sequelize'];(function(_0x3764f8,_0x186d80){var _0x2fd9af=function(_0x3dda80){while(--_0x3dda80){_0x3764f8['push'](_0x3764f8['shift']());}};_0x2fd9af(++_0x186d80);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x271c43,_0xfa9cf5){_0x271c43=_0x271c43-0x0;var _0x28e9f9=_0xfaa4[_0x271c43];return _0x28e9f9;};'use strict';var Sequelize=require(_0x4faa('0x0'));module[_0x4faa('0x1')]={'name':{'type':Sequelize[_0x4faa('0x2')],'allowNull':![],'unique':_0x4faa('0x3')},'table':{'type':Sequelize[_0x4faa('0x2')]},'metric':{'type':Sequelize[_0x4faa('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 0d3a68b..0182411 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 _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 +var _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x3a4b19,_0x3be831){var _0x16f356=function(_0x3b242f){while(--_0x3b242f){_0x3a4b19['push'](_0x3a4b19['shift']());}};_0x16f356(++_0x3be831);}(_0x008c,0x188));var _0xc008=function(_0x11c4b6,_0x572fdb){_0x11c4b6=_0x11c4b6-0x0;var _0x2cb405=_0x008c[_0x11c4b6];return _0x2cb405;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index ceff209..719ad55 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 _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 +var _0x44fe=['./analyticMetric.attributes','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x44fe,0x16f));var _0xe44f=function(_0x27f970,_0x2249a6){_0x27f970=_0x27f970-0x0;var _0x3ae10f=_0x44fe[_0x27f970];return _0x3ae10f;};'use strict';var _=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var logger=require(_0xe44f('0x2'))(_0xe44f('0x3'));var moment=require(_0xe44f('0x4'));var BPromise=require(_0xe44f('0x5'));var rp=require(_0xe44f('0x6'));var fs=require('fs');var path=require(_0xe44f('0x7'));var rimraf=require(_0xe44f('0x8'));var config=require(_0xe44f('0x9'));var attributes=require(_0xe44f('0xa'));module['exports']=function(_0x4a41be,_0x1abe56){return _0x4a41be[_0xe44f('0xb')]('AnalyticMetric',attributes,{'tableName':_0xe44f('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 8ef3793..64638d2 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 _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 +var _0x5020=['client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x5020,0x1ed));var _0x0502=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5020[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0502('0x0'));var util=require(_0x0502('0x1'));var moment=require(_0x0502('0x2'));var BPromise=require(_0x0502('0x3'));var rs=require(_0x0502('0x4'));var fs=require('fs');var Redis=require(_0x0502('0x5'));var db=require(_0x0502('0x6'))['db'];var utils=require(_0x0502('0x7'));var logger=require(_0x0502('0x8'))('rpc');var config=require(_0x0502('0x9'));var jayson=require(_0x0502('0xa'));var client=jayson[_0x0502('0xb')][_0x0502('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12c782,_0x11e20a,_0x401122){return new BPromise(function(_0x55d1d2,_0x340f75){return client[_0x0502('0xd')](_0x12c782,_0x401122)[_0x0502('0xe')](function(_0x29ca70){logger[_0x0502('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x11e20a,_0x0502('0x10'));logger[_0x0502('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x11e20a,'request\x20sent',JSON[_0x0502('0x12')](_0x29ca70));if(_0x29ca70[_0x0502('0x13')]){if(_0x29ca70[_0x0502('0x13')][_0x0502('0x14')]===0x1f4){logger[_0x0502('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x11e20a,_0x29ca70[_0x0502('0x13')][_0x0502('0x15')]);return _0x340f75(_0x29ca70['error'][_0x0502('0x15')]);}logger['error'](_0x0502('0x16'),_0x11e20a,_0x29ca70[_0x0502('0x13')][_0x0502('0x15')]);return _0x55d1d2(_0x29ca70[_0x0502('0x13')][_0x0502('0x15')]);}else{logger[_0x0502('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x11e20a,_0x0502('0x10'));_0x55d1d2(_0x29ca70['result'][_0x0502('0x15')]);}})[_0x0502('0x17')](function(_0x558982){logger['error'](_0x0502('0x16'),_0x11e20a,_0x558982);_0x340f75(_0x558982);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 283b5ff..f56f41e 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 _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 +var _0xbfda=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1efde3,_0x18c551){var _0x5d260e=function(_0x2b1e5f){while(--_0x2b1e5f){_0x1efde3['push'](_0x1efde3['shift']());}};_0x5d260e(++_0x18c551);}(_0xbfda,0x1dc));var _0xabfd=function(_0x57a402,_0x40596b){_0x57a402=_0x57a402-0x0;var _0x753a36=_0xbfda[_0x57a402];return _0x753a36;};'use strict';var multer=require(_0xabfd('0x0'));var util=require(_0xabfd('0x1'));var path=require(_0xabfd('0x2'));var timeout=require('connect-timeout');var express=require(_0xabfd('0x3'));var router=express['Router']();var fs_extra=require(_0xabfd('0x4'));var auth=require(_0xabfd('0x5'));var interaction=require(_0xabfd('0x6'));var config=require(_0xabfd('0x7'));var controller=require('./analyticMetric.controller');router[_0xabfd('0x8')]('/',auth['isAuthenticated'](),controller[_0xabfd('0x9')]);router['get'](_0xabfd('0xa'),auth['isAuthenticated'](),controller[_0xabfd('0xb')]);router[_0xabfd('0xc')]('/',auth[_0xabfd('0xd')](),controller[_0xabfd('0xe')]);router[_0xabfd('0xf')](_0xabfd('0xa'),auth['isAuthenticated'](),controller[_0xabfd('0x10')]);router[_0xabfd('0x11')](_0xabfd('0xa'),auth[_0xabfd('0xd')](),controller[_0xabfd('0x12')]);module[_0xabfd('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 4739a97..dbb0a46 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 _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 +var _0x014d=['sequelize','exports'];(function(_0x56e5c0,_0x505e34){var _0x21e3d0=function(_0xd57abd){while(--_0xd57abd){_0x56e5c0['push'](_0x56e5c0['shift']());}};_0x21e3d0(++_0x505e34);}(_0x014d,0x1b2));var _0xd014=function(_0x5ebeab,_0x1b48f3){_0x5ebeab=_0x5ebeab-0x0;var _0x188f5b=_0x014d[_0x5ebeab];return _0x188f5b;};'use strict';var Sequelize=require(_0xd014('0x0'));module[_0xd014('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 0c734af..7bee239 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 _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 +var _0xaab4=['destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','update'];(function(_0x23f0ba,_0x4a7be4){var _0x41bd76=function(_0x464c81){while(--_0x464c81){_0x23f0ba['push'](_0x23f0ba['shift']());}};_0x41bd76(++_0x4a7be4);}(_0xaab4,0xef));var _0x4aab=function(_0x1ab626,_0x456647){_0x1ab626=_0x1ab626-0x0;var _0x172722=_0xaab4[_0x1ab626];return _0x172722;};'use strict';var emlformat=require(_0x4aab('0x0'));var rimraf=require(_0x4aab('0x1'));var zipdir=require(_0x4aab('0x2'));var jsonpatch=require(_0x4aab('0x3'));var rp=require(_0x4aab('0x4'));var moment=require(_0x4aab('0x5'));var BPromise=require(_0x4aab('0x6'));var Mustache=require(_0x4aab('0x7'));var util=require(_0x4aab('0x8'));var path=require(_0x4aab('0x9'));var sox=require(_0x4aab('0xa'));var csv=require(_0x4aab('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4aab('0xc'));var _=require(_0x4aab('0xd'));var squel=require(_0x4aab('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4aab('0xf'));var toCsv=require(_0x4aab('0xb'));var querystring=require(_0x4aab('0x10'));var Papa=require(_0x4aab('0x11'));var Redis=require(_0x4aab('0x12'));var authService=require(_0x4aab('0x13'));var qs=require(_0x4aab('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4aab('0x15'));var logger=require(_0x4aab('0x16'))(_0x4aab('0x17'));var utils=require(_0x4aab('0x18'));var config=require(_0x4aab('0x19'));var licenseUtil=require(_0x4aab('0x1a'));var db=require(_0x4aab('0x1b'))['db'];function respondWithStatusCode(_0x27be1f,_0x210f0b){_0x210f0b=_0x210f0b||0xcc;return function(_0x5d9b3f){if(_0x5d9b3f){return _0x27be1f[_0x4aab('0x1c')](_0x210f0b);}return _0x27be1f[_0x4aab('0x1d')](_0x210f0b)[_0x4aab('0x1e')]();};}function respondWithResult(_0x26f8d5,_0x546c06){_0x546c06=_0x546c06||0xc8;return function(_0x358323){if(_0x358323){return _0x26f8d5[_0x4aab('0x1d')](_0x546c06)[_0x4aab('0x1f')](_0x358323);}};}function respondWithFilteredResult(_0x7a8e3b,_0x5ebb36){return function(_0x5e7b88){if(_0x5e7b88){var _0x3a83f4=typeof _0x5ebb36[_0x4aab('0x20')]===_0x4aab('0x21')&&typeof _0x5ebb36[_0x4aab('0x22')]===_0x4aab('0x21');var _0xd72116=_0x5e7b88[_0x4aab('0x23')];var _0x7b41b2=_0x3a83f4?0x0:_0x5ebb36['offset'];var _0x422ca5=_0x3a83f4?_0x5e7b88[_0x4aab('0x23')]:_0x5ebb36[_0x4aab('0x20')]+_0x5ebb36[_0x4aab('0x22')];var _0x40b813;if(_0x422ca5>=_0xd72116){_0x422ca5=_0xd72116;_0x40b813=0xc8;}else{_0x40b813=0xce;}_0x7a8e3b['status'](_0x40b813);return _0x7a8e3b[_0x4aab('0x24')](_0x4aab('0x25'),_0x7b41b2+'-'+_0x422ca5+'/'+_0xd72116)[_0x4aab('0x1f')](_0x5e7b88);}return null;};}function patchUpdates(_0xd93f85){return function(_0x346e27){try{jsonpatch[_0x4aab('0x26')](_0x346e27,_0xd93f85,!![]);}catch(_0xb895e9){return BPromise[_0x4aab('0x27')](_0xb895e9);}return _0x346e27[_0x4aab('0x28')]();};}function saveUpdates(_0x32961d,_0x32ded1){return function(_0x237e12){if(_0x237e12){return _0x237e12['update'](_0x32961d)[_0x4aab('0x29')](function(_0x30eff4){return _0x30eff4;});}return null;};}function removeEntity(_0x383adb,_0x3c0cfc){return function(_0x15dccd){if(_0x15dccd){return _0x15dccd['destroy']()[_0x4aab('0x29')](function(){_0x383adb[_0x4aab('0x1d')](0xcc)[_0x4aab('0x1e')]();});}};}function handleEntityNotFound(_0x34e8f5,_0x266ef0){return function(_0x502276){if(!_0x502276){_0x34e8f5['sendStatus'](0x194);}return _0x502276;};}function handleError(_0x58cc1a,_0x23bc14){_0x23bc14=_0x23bc14||0x1f4;return function(_0x4af5ff){logger[_0x4aab('0x2a')](_0x4af5ff[_0x4aab('0x2b')]);if(_0x4af5ff[_0x4aab('0x2c')]){delete _0x4af5ff['name'];}_0x58cc1a[_0x4aab('0x1d')](_0x23bc14)[_0x4aab('0x2d')](_0x4af5ff);};}exports['index']=function(_0x2ad245,_0x147a47){var _0x3f019e={},_0x2b304a={},_0x1317e5={'count':0x0,'rows':[]};var _0xd07a3a=_['map'](db[_0x4aab('0x2e')][_0x4aab('0x2f')],function(_0x296e37){return{'name':_0x296e37[_0x4aab('0x30')],'type':_0x296e37[_0x4aab('0x31')][_0x4aab('0x32')]};});_0x2b304a[_0x4aab('0x33')]=_['map'](_0xd07a3a,_0x4aab('0x2c'));_0x2b304a[_0x4aab('0x34')]=_[_0x4aab('0x35')](_0x2ad245[_0x4aab('0x34')]);_0x2b304a[_0x4aab('0x36')]=_[_0x4aab('0x37')](_0x2b304a[_0x4aab('0x33')],_0x2b304a[_0x4aab('0x34')]);_0x3f019e[_0x4aab('0x38')]=_['intersection'](_0x2b304a[_0x4aab('0x33')],qs['fields'](_0x2ad245[_0x4aab('0x34')][_0x4aab('0x39')]));_0x3f019e[_0x4aab('0x38')]=_0x3f019e[_0x4aab('0x38')][_0x4aab('0x3a')]?_0x3f019e['attributes']:_0x2b304a[_0x4aab('0x33')];if(!_0x2ad245['query'][_0x4aab('0x3b')]('nolimit')){_0x3f019e[_0x4aab('0x22')]=qs[_0x4aab('0x22')](_0x2ad245[_0x4aab('0x34')][_0x4aab('0x22')]);_0x3f019e[_0x4aab('0x20')]=qs[_0x4aab('0x20')](_0x2ad245[_0x4aab('0x34')][_0x4aab('0x20')]);}_0x3f019e[_0x4aab('0x3c')]=qs[_0x4aab('0x3d')](_0x2ad245['query'][_0x4aab('0x3d')]);_0x3f019e['where']=qs[_0x4aab('0x36')](_['pick'](_0x2ad245['query'],_0x2b304a[_0x4aab('0x36')]),_0xd07a3a);if(_0x2ad245['query']['filter']){_0x3f019e[_0x4aab('0x3e')]=_[_0x4aab('0x3f')](_0x3f019e[_0x4aab('0x3e')],{'$or':_[_0x4aab('0x40')](_0xd07a3a,function(_0x595577){if(_0x595577[_0x4aab('0x31')]!==_0x4aab('0x41')){var _0x2fa167={};_0x2fa167[_0x595577[_0x4aab('0x2c')]]={'$like':'%'+_0x2ad245[_0x4aab('0x34')][_0x4aab('0x42')]+'%'};return _0x2fa167;}})});}_0x3f019e=_[_0x4aab('0x3f')]({},_0x3f019e,_0x2ad245[_0x4aab('0x43')]);var _0x1a6fd6={'where':_0x3f019e['where']};return db[_0x4aab('0x2e')]['count'](_0x1a6fd6)['then'](function(_0x114fdd){_0x1317e5[_0x4aab('0x23')]=_0x114fdd;if(_0x2ad245[_0x4aab('0x34')][_0x4aab('0x44')]){_0x3f019e[_0x4aab('0x45')]=[{'all':!![]}];}return db[_0x4aab('0x2e')]['findAll'](_0x3f019e);})[_0x4aab('0x29')](function(_0x25d4d7){_0x1317e5[_0x4aab('0x46')]=_0x25d4d7;return _0x1317e5;})[_0x4aab('0x29')](respondWithFilteredResult(_0x147a47,_0x3f019e))[_0x4aab('0x47')](handleError(_0x147a47,null));};exports[_0x4aab('0x48')]=function(_0x1004ba,_0x458b53){var _0x1bd544={'raw':!![],'where':{'id':_0x1004ba['params']['id']}},_0x2e891c={};_0x2e891c[_0x4aab('0x33')]=_['keys'](db['AnalyticTreeReport'][_0x4aab('0x2f')]);_0x2e891c['query']=_['keys'](_0x1004ba[_0x4aab('0x34')]);_0x2e891c[_0x4aab('0x36')]=_[_0x4aab('0x37')](_0x2e891c[_0x4aab('0x33')],_0x2e891c[_0x4aab('0x34')]);_0x1bd544[_0x4aab('0x38')]=_['intersection'](_0x2e891c[_0x4aab('0x33')],qs[_0x4aab('0x39')](_0x1004ba[_0x4aab('0x34')][_0x4aab('0x39')]));_0x1bd544['attributes']=_0x1bd544[_0x4aab('0x38')]['length']?_0x1bd544[_0x4aab('0x38')]:_0x2e891c[_0x4aab('0x33')];if(_0x1004ba[_0x4aab('0x34')][_0x4aab('0x44')]){_0x1bd544[_0x4aab('0x45')]=[{'all':!![]}];}_0x1bd544=_[_0x4aab('0x3f')]({},_0x1bd544,_0x1004ba[_0x4aab('0x43')]);return db[_0x4aab('0x2e')][_0x4aab('0x49')](_0x1bd544)['then'](handleEntityNotFound(_0x458b53,null))[_0x4aab('0x29')](respondWithResult(_0x458b53,null))[_0x4aab('0x47')](handleError(_0x458b53,null));};exports[_0x4aab('0x4a')]=function(_0x1c2cf1,_0x3a1f60){return db[_0x4aab('0x2e')]['create'](_0x1c2cf1[_0x4aab('0x4b')],{})[_0x4aab('0x29')](respondWithResult(_0x3a1f60,0xc9))['catch'](handleError(_0x3a1f60,null));};exports[_0x4aab('0x4c')]=function(_0x933a34,_0x347e4d){if(_0x933a34[_0x4aab('0x4b')]['id']){delete _0x933a34[_0x4aab('0x4b')]['id'];}return db[_0x4aab('0x2e')][_0x4aab('0x49')]({'where':{'id':_0x933a34['params']['id']}})[_0x4aab('0x29')](handleEntityNotFound(_0x347e4d,null))[_0x4aab('0x29')](saveUpdates(_0x933a34[_0x4aab('0x4b')],null))[_0x4aab('0x29')](respondWithResult(_0x347e4d,null))[_0x4aab('0x47')](handleError(_0x347e4d,null));};exports[_0x4aab('0x4d')]=function(_0xed1450,_0x4ef18f){return db[_0x4aab('0x2e')][_0x4aab('0x49')]({'where':{'id':_0xed1450[_0x4aab('0x4e')]['id']}})[_0x4aab('0x29')](handleEntityNotFound(_0x4ef18f,null))[_0x4aab('0x29')](removeEntity(_0x4ef18f,null))['catch'](handleError(_0x4ef18f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 708e44d..354585c 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 _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 +var _0x7612=['exports','define','AnalyticTreeReport','analytics_report_trees','lodash','bluebird','path','rimraf','./analyticTreeReport.attributes'];(function(_0x53f903,_0x381df0){var _0x4cb3fa=function(_0x359c74){while(--_0x359c74){_0x53f903['push'](_0x53f903['shift']());}};_0x4cb3fa(++_0x381df0);}(_0x7612,0x1bd));var _0x2761=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x7612[_0x5a7618];return _0x12dc65;};'use strict';var _=require(_0x2761('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2761('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2761('0x2'));var rimraf=require(_0x2761('0x3'));var config=require('../../config/environment');var attributes=require(_0x2761('0x4'));module[_0x2761('0x5')]=function(_0x471207,_0x2d6fc9){return _0x471207[_0x2761('0x6')](_0x2761('0x7'),attributes,{'tableName':_0x2761('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index f146a7f..887f20e 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_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 +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x2c687d,_0x492b42){var _0x13b09c=function(_0x4a9324){while(--_0x4a9324){_0x2c687d['push'](_0x2c687d['shift']());}};_0x13b09c(++_0x492b42);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index ae7d6e9..89b5ba0 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 _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 +var _0x1f65=['isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f65,0x17a));var _0x51f6=function(_0x48f8d5,_0x34f897){_0x48f8d5=_0x48f8d5-0x0;var _0x47f9e5=_0x1f65[_0x48f8d5];return _0x47f9e5;};'use strict';var multer=require(_0x51f6('0x0'));var util=require(_0x51f6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x51f6('0x2'));var router=express['Router']();var fs_extra=require(_0x51f6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x51f6('0x4'));var config=require(_0x51f6('0x5'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x51f6('0x6')](),controller['index']);router[_0x51f6('0x7')](_0x51f6('0x8'),auth[_0x51f6('0x6')](),controller[_0x51f6('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x51f6('0xa')]);router[_0x51f6('0xb')](_0x51f6('0x8'),auth[_0x51f6('0x6')](),controller[_0x51f6('0xc')]);router[_0x51f6('0xd')](_0x51f6('0x8'),auth[_0x51f6('0x6')](),controller[_0x51f6('0xe')]);module[_0x51f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 2920bd3..679cfb8 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 _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 +var _0x5bbd=['exports','STRING','sequelize'];(function(_0x18240a,_0x514f8e){var _0x5479e5=function(_0x11de18){while(--_0x11de18){_0x18240a['push'](_0x18240a['shift']());}};_0x5479e5(++_0x514f8e);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd5bb('0x0'));module[_0xd5bb('0x1')]={'name':{'type':Sequelize[_0xd5bb('0x2')]},'basename':{'type':Sequelize[_0xd5bb('0x2')]},'type':{'type':Sequelize[_0xd5bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index e1ac1da..09a9a96 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 _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 +var _0x356e=['show','intersection','find','clone','length','createdAt','updatedAt','body','omit','create','params','file','originalname','filename','download','findOne','join','root','offline-chat/','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','apply','update','then','destroy','sendStatus','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch'];(function(_0x339482,_0x5f3fc3){var _0xb8441e=function(_0x4e5c46){while(--_0x4e5c46){_0x339482['push'](_0x339482['shift']());}};_0xb8441e(++_0x5f3fc3);}(_0x356e,0xb3));var _0xe356=function(_0x20db3c,_0x2fda98){_0x20db3c=_0x20db3c-0x0;var _0x10daa=_0x356e[_0x20db3c];return _0x10daa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe356('0x0'));var zipdir=require(_0xe356('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe356('0x2'));var BPromise=require(_0xe356('0x3'));var Mustache=require('mustache');var util=require(_0xe356('0x4'));var path=require(_0xe356('0x5'));var sox=require(_0xe356('0x6'));var csv=require(_0xe356('0x7'));var ejs=require(_0xe356('0x8'));var fs=require('fs');var fs_extra=require(_0xe356('0x9'));var _=require(_0xe356('0xa'));var squel=require(_0xe356('0xb'));var crypto=require(_0xe356('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe356('0xd'));var Papa=require(_0xe356('0xe'));var Redis=require(_0xe356('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe356('0x10'));var as=require(_0xe356('0x11'));var hardwareService=require(_0xe356('0x12'));var logger=require('../../config/logger')(_0xe356('0x13'));var utils=require(_0xe356('0x14'));var config=require(_0xe356('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe356('0x16'))['db'];function respondWithStatusCode(_0x250ad5,_0x521006){_0x521006=_0x521006||0xcc;return function(_0x44261c){if(_0x44261c){return _0x250ad5['sendStatus'](_0x521006);}return _0x250ad5[_0xe356('0x17')](_0x521006)['end']();};}function respondWithResult(_0x2a1009,_0x3fcf3f){_0x3fcf3f=_0x3fcf3f||0xc8;return function(_0x1e7d0d){if(_0x1e7d0d){return _0x2a1009['status'](_0x3fcf3f)[_0xe356('0x18')](_0x1e7d0d);}};}function respondWithFilteredResult(_0x34ff5c,_0x33b50e){return function(_0x5192f1){if(_0x5192f1){var _0x215ec1=typeof _0x33b50e[_0xe356('0x19')]===_0xe356('0x1a')&&typeof _0x33b50e[_0xe356('0x1b')]==='undefined';var _0x513c9b=_0x5192f1[_0xe356('0x1c')];var _0x379341=_0x215ec1?0x0:_0x33b50e['offset'];var _0x4fcd4d=_0x215ec1?_0x5192f1[_0xe356('0x1c')]:_0x33b50e['offset']+_0x33b50e[_0xe356('0x1b')];var _0x43e1ea;if(_0x4fcd4d>=_0x513c9b){_0x4fcd4d=_0x513c9b;_0x43e1ea=0xc8;}else{_0x43e1ea=0xce;}_0x34ff5c['status'](_0x43e1ea);return _0x34ff5c['set']('Content-Range',_0x379341+'-'+_0x4fcd4d+'/'+_0x513c9b)[_0xe356('0x18')](_0x5192f1);}return null;};}function patchUpdates(_0x2e6daf){return function(_0x870be5){try{jsonpatch[_0xe356('0x1d')](_0x870be5,_0x2e6daf,!![]);}catch(_0x1c5790){return BPromise['reject'](_0x1c5790);}return _0x870be5['save']();};}function saveUpdates(_0x3dc36e,_0x3e5eda){return function(_0x4dc6a3){if(_0x4dc6a3){return _0x4dc6a3[_0xe356('0x1e')](_0x3dc36e)[_0xe356('0x1f')](function(_0x2a8363){return _0x2a8363;});}return null;};}function removeEntity(_0x4cdc07,_0x37b33a){return function(_0x4074f7){if(_0x4074f7){return _0x4074f7[_0xe356('0x20')]()[_0xe356('0x1f')](function(){_0x4cdc07[_0xe356('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc563b,_0x277d1c){return function(_0x398068){if(!_0x398068){_0xfc563b[_0xe356('0x21')](0x194);}return _0x398068;};}function handleError(_0x79c943,_0x457055){_0x457055=_0x457055||0x1f4;return function(_0x3d9c4f){logger[_0xe356('0x22')](_0x3d9c4f[_0xe356('0x23')]);if(_0x3d9c4f[_0xe356('0x24')]){delete _0x3d9c4f[_0xe356('0x24')];}_0x79c943[_0xe356('0x17')](_0x457055)[_0xe356('0x25')](_0x3d9c4f);};}exports[_0xe356('0x26')]=function(_0x1ad70a,_0x5bad07){var _0x13a1fa={},_0x468a6c={},_0x2624d6={'count':0x0,'rows':[]};var _0x14497f=_['map'](db[_0xe356('0x27')][_0xe356('0x28')],function(_0x5255f9){return{'name':_0x5255f9[_0xe356('0x29')],'type':_0x5255f9[_0xe356('0x2a')]['key']};});_0x468a6c['model']=_[_0xe356('0x2b')](_0x14497f,'name');_0x468a6c[_0xe356('0x2c')]=_[_0xe356('0x2d')](_0x1ad70a[_0xe356('0x2c')]);_0x468a6c[_0xe356('0x2e')]=_['intersection'](_0x468a6c[_0xe356('0x2f')],_0x468a6c[_0xe356('0x2c')]);_0x13a1fa[_0xe356('0x30')]=_['intersection'](_0x468a6c[_0xe356('0x2f')],qs[_0xe356('0x31')](_0x1ad70a['query'][_0xe356('0x31')]));_0x13a1fa['attributes']=_0x13a1fa[_0xe356('0x30')]['length']?_0x13a1fa['attributes']:_0x468a6c[_0xe356('0x2f')];if(!_0x1ad70a[_0xe356('0x2c')]['hasOwnProperty']('nolimit')){_0x13a1fa[_0xe356('0x1b')]=qs[_0xe356('0x1b')](_0x1ad70a[_0xe356('0x2c')]['limit']);_0x13a1fa['offset']=qs[_0xe356('0x19')](_0x1ad70a[_0xe356('0x2c')][_0xe356('0x19')]);}_0x13a1fa[_0xe356('0x32')]=qs[_0xe356('0x33')](_0x1ad70a[_0xe356('0x2c')][_0xe356('0x33')]);_0x13a1fa[_0xe356('0x34')]=qs['filters'](_[_0xe356('0x35')](_0x1ad70a['query'],_0x468a6c[_0xe356('0x2e')]),_0x14497f);if(_0x1ad70a[_0xe356('0x2c')][_0xe356('0x36')]){_0x13a1fa[_0xe356('0x34')]=_[_0xe356('0x37')](_0x13a1fa[_0xe356('0x34')],{'$or':_[_0xe356('0x2b')](_0x14497f,function(_0x23f5d2){if(_0x23f5d2[_0xe356('0x2a')]!=='VIRTUAL'){var _0x5d9553={};_0x5d9553[_0x23f5d2[_0xe356('0x24')]]={'$like':'%'+_0x1ad70a[_0xe356('0x2c')]['filter']+'%'};return _0x5d9553;}})});}_0x13a1fa=_[_0xe356('0x37')]({},_0x13a1fa,_0x1ad70a[_0xe356('0x38')]);var _0x9c260d={'where':_0x13a1fa[_0xe356('0x34')]};return db[_0xe356('0x27')][_0xe356('0x1c')](_0x9c260d)[_0xe356('0x1f')](function(_0x345b8f){_0x2624d6['count']=_0x345b8f;if(_0x1ad70a[_0xe356('0x2c')][_0xe356('0x39')]){_0x13a1fa[_0xe356('0x3a')]=[{'all':!![]}];}return db[_0xe356('0x27')][_0xe356('0x3b')](_0x13a1fa);})[_0xe356('0x1f')](function(_0x5bee5c){_0x2624d6['rows']=_0x5bee5c;return _0x2624d6;})[_0xe356('0x1f')](respondWithFilteredResult(_0x5bad07,_0x13a1fa))[_0xe356('0x3c')](handleError(_0x5bad07,null));};exports[_0xe356('0x3d')]=function(_0x204950,_0x3934d0){var _0x25cf53={'raw':!![],'where':{'id':_0x204950['params']['id']}},_0x57d5a9={};_0x57d5a9[_0xe356('0x2f')]=_[_0xe356('0x2d')](db[_0xe356('0x27')][_0xe356('0x28')]);_0x57d5a9['query']=_[_0xe356('0x2d')](_0x204950[_0xe356('0x2c')]);_0x57d5a9[_0xe356('0x2e')]=_[_0xe356('0x3e')](_0x57d5a9['model'],_0x57d5a9[_0xe356('0x2c')]);_0x25cf53['attributes']=_['intersection'](_0x57d5a9[_0xe356('0x2f')],qs[_0xe356('0x31')](_0x204950[_0xe356('0x2c')][_0xe356('0x31')]));_0x25cf53['attributes']=_0x25cf53[_0xe356('0x30')]['length']?_0x25cf53[_0xe356('0x30')]:_0x57d5a9[_0xe356('0x2f')];if(_0x204950['query']['includeAll']){_0x25cf53[_0xe356('0x3a')]=[{'all':!![]}];}_0x25cf53=_[_0xe356('0x37')]({},_0x25cf53,_0x204950[_0xe356('0x38')]);return db['Attachment'][_0xe356('0x3f')](_0x25cf53)[_0xe356('0x1f')](handleEntityNotFound(_0x3934d0,null))['then'](respondWithResult(_0x3934d0,null))[_0xe356('0x3c')](handleError(_0x3934d0,null));};exports[_0xe356('0x40')]=function(_0x35598a,_0x321313){var _0x5d094c={'where':{'id':_0x35598a['params']['id']}},_0x5f3a6f={};_0x5f3a6f[_0xe356('0x2f')]=_[_0xe356('0x2d')](db[_0xe356('0x27')][_0xe356('0x28')]);_0x5d094c[_0xe356('0x30')]=_[_0xe356('0x3e')](_0x5f3a6f[_0xe356('0x2f')],qs[_0xe356('0x31')](_0x35598a[_0xe356('0x2c')][_0xe356('0x31')]));_0x5d094c[_0xe356('0x30')]=_0x5d094c[_0xe356('0x30')][_0xe356('0x41')]?_0x5d094c['attributes']:_0x5f3a6f['model'];if(_0x35598a[_0xe356('0x2c')][_0xe356('0x39')]){_0x5d094c[_0xe356('0x3a')]=[{'all':!![]}];}_0x5d094c=_[_0xe356('0x37')]({},_0x5d094c,_0x35598a[_0xe356('0x38')]);return db['Attachment'][_0xe356('0x3f')](_0x5d094c)[_0xe356('0x1f')](handleEntityNotFound(_0x321313,null))[_0xe356('0x1f')](function(_0x504ee8){if(_0x504ee8){var _0x642725=_0x504ee8['get']({'plain':!![]});_0x642725=qs['omit'](_0x642725,['id',_0xe356('0x42'),_0xe356('0x43')]);_0x35598a[_0xe356('0x44')]=_[_0xe356('0x45')](_0x35598a[_0xe356('0x44')],['id',_0xe356('0x42'),_0xe356('0x43')]);return db['Attachment'][_0xe356('0x46')](_['merge'](_0x642725,_0x35598a[_0xe356('0x44')]),{'include':_0x35598a[_0xe356('0x2c')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xe356('0x1f')](respondWithResult(_0x321313,0xc9))[_0xe356('0x3c')](handleError(_0x321313,null));};exports[_0xe356('0x1e')]=function(_0x4872f2,_0x178d03){if(_0x4872f2[_0xe356('0x44')]['id']){delete _0x4872f2[_0xe356('0x44')]['id'];}return db[_0xe356('0x27')][_0xe356('0x3f')]({'where':{'id':_0x4872f2[_0xe356('0x47')]['id']}})[_0xe356('0x1f')](handleEntityNotFound(_0x178d03,null))[_0xe356('0x1f')](saveUpdates(_0x4872f2['body'],null))['then'](respondWithResult(_0x178d03,null))[_0xe356('0x3c')](handleError(_0x178d03,null));};exports[_0xe356('0x20')]=function(_0x4e56e1,_0x4ce922){return db[_0xe356('0x27')][_0xe356('0x3f')]({'where':{'id':_0x4e56e1['params']['id']}})[_0xe356('0x1f')](handleEntityNotFound(_0x4ce922,null))['then'](removeEntity(_0x4ce922,null))[_0xe356('0x3c')](handleError(_0x4ce922,null));};exports[_0xe356('0x46')]=function(_0xbec5e,_0x3f9e6a,_0x298e32){_0xbec5e[_0xe356('0x44')][_0xe356('0x24')]=_0xbec5e[_0xe356('0x48')][_0xe356('0x49')];_0xbec5e['body']['basename']=_0xbec5e[_0xe356('0x48')][_0xe356('0x4a')];_0xbec5e[_0xe356('0x44')][_0xe356('0x2a')]=_0xbec5e[_0xe356('0x48')]['mimetype'];return db[_0xe356('0x27')]['create'](_0xbec5e[_0xe356('0x44')])[_0xe356('0x1f')](respondWithResult(_0x3f9e6a,0xc9))[_0xe356('0x3c')](handleError(_0x3f9e6a,null));};exports[_0xe356('0x4b')]=function(_0x24def8,_0x29c6bf,_0x5d3918){return db['Attachment'][_0xe356('0x4c')]({'where':{'id':_0x24def8['params']['id']},'raw':!![]})[_0xe356('0x1f')](handleEntityNotFound(_0x29c6bf,null))[_0xe356('0x1f')](function(_0x3b44c0){if(_0x3b44c0){var _0x1855c5=_0x3b44c0['ChatOfflineMessageId']!==null;var _0x3fd0ce=path[_0xe356('0x4d')](config[_0xe356('0x4e')],'server/files/attachments/');if(_0x1855c5){_0x3fd0ce=path[_0xe356('0x4d')](_0x3fd0ce,_0xe356('0x4f'));}var _0x26a93f=path[_0xe356('0x4d')](_0x3fd0ce,_0x3b44c0['basename']);return _0x29c6bf[_0xe356('0x4b')](_0x26a93f);}})['catch'](handleError(_0x29c6bf,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index c61ef2b..efc34b4 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 _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 +var _0xd186=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xd82509,_0x8ac7eb){var _0x3b1dc9=function(_0x2bc874){while(--_0x2bc874){_0xd82509['push'](_0xd82509['shift']());}};_0x3b1dc9(++_0x8ac7eb);}(_0xd186,0x1bc));var _0x6d18=function(_0x3452a,_0x3a45b5){_0x3452a=_0x3452a-0x0;var _0x4ccb08=_0xd186[_0x3452a];return _0x4ccb08;};'use strict';var _=require(_0x6d18('0x0'));var util=require(_0x6d18('0x1'));var logger=require(_0x6d18('0x2'))(_0x6d18('0x3'));var moment=require(_0x6d18('0x4'));var BPromise=require(_0x6d18('0x5'));var rp=require(_0x6d18('0x6'));var fs=require('fs');var path=require(_0x6d18('0x7'));var rimraf=require(_0x6d18('0x8'));var config=require(_0x6d18('0x9'));var attributes=require(_0x6d18('0xa'));module[_0x6d18('0xb')]=function(_0x3fc0f7,_0x94d4b9){return _0x3fc0f7[_0x6d18('0xc')](_0x6d18('0xd'),attributes,{'tableName':_0x6d18('0xe'),'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 88337d5..d4cdccb 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 _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 +var _0xf53f=['create','options','raw','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateAttachment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf53f,0x8d));var _0xff53=function(_0x88459d,_0x55943e){_0x88459d=_0x88459d-0x0;var _0x26d673=_0xf53f[_0x88459d];return _0x26d673;};'use strict';var _=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var moment=require(_0xff53('0x2'));var BPromise=require(_0xff53('0x3'));var rs=require(_0xff53('0x4'));var fs=require('fs');var Redis=require(_0xff53('0x5'));var db=require(_0xff53('0x6'))['db'];var utils=require(_0xff53('0x7'));var logger=require(_0xff53('0x8'))(_0xff53('0x9'));var config=require(_0xff53('0xa'));var jayson=require(_0xff53('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27b397,_0x5751e7,_0x1c27bb){return new BPromise(function(_0x122746,_0x1bc4b3){return client['request'](_0x27b397,_0x1c27bb)['then'](function(_0x3c001d){logger['info'](_0xff53('0xc'),_0x5751e7,_0xff53('0xd'));logger['debug'](_0xff53('0xe'),_0x5751e7,_0xff53('0xd'),JSON['stringify'](_0x3c001d));if(_0x3c001d[_0xff53('0xf')]){if(_0x3c001d[_0xff53('0xf')][_0xff53('0x10')]===0x1f4){logger['error'](_0xff53('0xc'),_0x5751e7,_0x3c001d[_0xff53('0xf')][_0xff53('0x11')]);return _0x1bc4b3(_0x3c001d['error'][_0xff53('0x11')]);}logger[_0xff53('0xf')]('Attachment,\x20%s,\x20%s',_0x5751e7,_0x3c001d['error']['message']);return _0x122746(_0x3c001d['error'][_0xff53('0x11')]);}else{logger[_0xff53('0x12')](_0xff53('0xc'),_0x5751e7,'request\x20sent');_0x122746(_0x3c001d[_0xff53('0x13')]['message']);}})['catch'](function(_0x12e90b){logger[_0xff53('0xf')](_0xff53('0xc'),_0x5751e7,_0x12e90b);_0x1bc4b3(_0x12e90b);});});}exports[_0xff53('0x14')]=function(_0x38883f){var _0x319ce5=this;return new Promise(function(_0x14b502,_0x5e9ba6){return db['Attachment'][_0xff53('0x15')](_0x38883f['body'],{'raw':_0x38883f[_0xff53('0x16')]?_0x38883f[_0xff53('0x16')][_0xff53('0x17')]===undefined?!![]:![]:!![]})[_0xff53('0x18')](function(_0x39b3d1){logger[_0xff53('0x12')](_0xff53('0x14'),_0x38883f);logger[_0xff53('0x19')](_0xff53('0x14'),_0x38883f,JSON['stringify'](_0x39b3d1));_0x14b502(_0x39b3d1);})[_0xff53('0x1a')](function(_0x5cd878){logger['error']('CreateAttachment',_0x5cd878['message'],_0x38883f);_0x5e9ba6(_0x319ce5[_0xff53('0xf')](0x1f4,_0x5cd878[_0xff53('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index dac0c43..a4bfb11 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 _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 +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(_0x31ceb1,_0x329fd0){var _0x24942c=function(_0x1905e7){while(--_0x1905e7){_0x31ceb1['push'](_0x31ceb1['shift']());}};_0x24942c(++_0x329fd0);}(_0x757a,0xde));var _0xa757=function(_0x1f7d14,_0xd9975){_0x1f7d14=_0x1f7d14-0x0;var _0x1cde99=_0x757a[_0x1f7d14];return _0x1cde99;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 566e420..4ecee52 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 _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 +var _0x6c03=['signToken','json','online','use','User','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','admin','agent','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x6c03,0x98));var _0x36c0=function(_0x272b7a,_0x1661fa){_0x272b7a=_0x272b7a-0x0;var _0x173883=_0x6c03[_0x272b7a];return _0x173883;};'use strict';var passport=require(_0x36c0('0x0'));var LocalStrategy=require(_0x36c0('0x1'))[_0x36c0('0x2')];var moment=require(_0x36c0('0x3'));var ActiveDirectory=require(_0x36c0('0x4'));var BPromise=require('bluebird');var util=require(_0x36c0('0x5'));var db=require(_0x36c0('0x6'))['db'];var authService=require(_0x36c0('0x7'));var utils=require(_0x36c0('0x8'));var config=require('../../config/environment');var logger=require(_0x36c0('0x9'))(_0x36c0('0xa'));function isActiveDirectoryConfigured(_0x14afae){var _0x278765=![];if(typeof _0x14afae[_0x36c0('0xb')]!=='undefined'){_0x278765=_0x14afae['activedirectory'][_0x36c0('0xc')]&&_0x14afae[_0x36c0('0xb')][_0x36c0('0xd')]&&_0x14afae[_0x36c0('0xb')][_0x36c0('0xe')];}return _0x278765;}function adAuthenticate(_0x553f01,_0xa4af92,_0x5a83b1){return new BPromise(function(_0x41c834,_0x2148dd){try{var _0x31a7a3=new ActiveDirectory(_0x553f01);_0x31a7a3[_0x36c0('0xf')](_0xa4af92,_0x5a83b1,function(_0x498d3d,_0x6ca64e){if(_0x498d3d){logger[_0x36c0('0x10')](_0x36c0('0x11'),_0xa4af92,util['inspect'](_0x498d3d,{'showHidden':![],'depth':null}));_0x2148dd('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x6ca64e){logger[_0x36c0('0x10')](_0x36c0('0x12'),_0xa4af92);_0x2148dd(_0x36c0('0x13'));}else{_0x41c834(_0x6ca64e);}});}catch(_0x40ea5a){_0x2148dd(_0x40ea5a);}});}function ActiveDirectoryAuthenticate(_0x5d4a5e,_0x332737,_0x3bebdc,_0x273f2b){var _0x37ef59,_0x579861;if(!isActiveDirectoryConfigured(config)){logger[_0x36c0('0x10')](_0x36c0('0x14'),_0x332737);return _0x273f2b(null,![],{'message':_0x36c0('0x13')});}return db[_0x36c0('0x15')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x36c0('0x16')],'raw':!![]})[_0x36c0('0x17')](function(_0x27599e){_0x37ef59=_0x27599e;if(!_0x37ef59[_0x36c0('0x18')]){logger[_0x36c0('0x10')](_0x36c0('0x19'),_0x332737);throw new Error(_0x36c0('0x13'));}return _0x5d4a5e['findOne']({'attributes':['id',_0x36c0('0x1a'),_0x36c0('0x1b'),_0x36c0('0x1c'),_0x36c0('0x1d'),_0x36c0('0x1e'),_0x36c0('0x1f'),_0x36c0('0x20'),'online'],'where':{'name':_0x332737,'role':{'$or':[_0x36c0('0x21'),'user',_0x36c0('0x22')]},'adSsoEnabled':!![]}});})[_0x36c0('0x17')](function(_0x16cbd8){if(!_0x16cbd8||_0x16cbd8&&_0x16cbd8[_0x36c0('0x1a')]!==_0x332737){throw new Error(_0x36c0('0x13'));}_0x579861=_0x16cbd8;var _0x3ba118=_0x579861[_0x36c0('0x1a')]+'@'+config[_0x36c0('0xb')][_0x36c0('0xe')];return adAuthenticate(config[_0x36c0('0xb')],_0x3ba118,_0x3bebdc);})[_0x36c0('0x17')](function(_0x247008){if(_0x579861[_0x36c0('0x1e')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x37ef59[_0x36c0('0x16')]>0x0){if(_0x579861[_0x36c0('0x1f')]){if(moment(_0x579861['blockedAt'])['add'](_0x37ef59[_0x36c0('0x16')],_0x36c0('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x36c0('0x24')](_0x579861,0x0,![],null)['then'](function(){return utils[_0x36c0('0x25')](_0x579861);})[_0x36c0('0x17')](function(){return _0x273f2b(null,_0x579861);});}else{return utils[_0x36c0('0x25')](_0x579861)['then'](function(){return _0x273f2b(null,_0x579861);});}}else{return utils[_0x36c0('0x25')](_0x579861)[_0x36c0('0x17')](function(){return _0x273f2b(null,_0x579861);});}})['catch'](function(_0x1da7a3){return _0x273f2b(null,![],_0x1da7a3);});}function handleError(_0x57fe10,_0x40be8b,_0x4a3067){return _0x57fe10[_0x36c0('0x26')](_0x40be8b||0x1f4)[_0x36c0('0x27')]({'message':_0x4a3067?_0x4a3067[_0x36c0('0x28')]||_0x4a3067:''});}exports[_0x36c0('0x29')]=function(_0x54be34,_0x140433,_0x116e20){passport[_0x36c0('0xf')](_0x36c0('0x2a'),function(_0x613a63,_0x2322dd,_0x307757){var _0x2808ad=_0x613a63||_0x307757;if(_0x2808ad){return handleError(_0x140433,0x191,_0x2808ad);}if(!_0x2322dd){return handleError(_0x140433,0x194,{'message':_0x36c0('0x2b')});}else{var _0x4b2cba={'payload':{'id':_0x2322dd['id'],'role':_0x2322dd[_0x36c0('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x36c0('0x2c')](_0x4b2cba)[_0x36c0('0x17')](function(_0x24c916){_0x140433[_0x36c0('0x2d')]({'id':_0x2322dd['id'],'token':_0x24c916,'statusCall':'','isAlreadyLogged':_0x2322dd[_0x36c0('0x2e')]});});}})(_0x54be34,_0x140433,_0x116e20);};passport[_0x36c0('0x2f')](_0x36c0('0x2a'),new LocalStrategy({'usernameField':_0x36c0('0x1a'),'passwordField':_0x36c0('0x1b')},function(_0x15f5eb,_0x43fb75,_0x40fad2){return ActiveDirectoryAuthenticate(db[_0x36c0('0x30')],_0x15f5eb,_0x43fb75,_0x40fad2);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 029f09e..0dd6182 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 _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 +var _0x56dc=['express','./authActiveDirectory.controller','post','exports'];(function(_0x9a23f5,_0xfd4537){var _0x48eb4f=function(_0x57c6a0){while(--_0x57c6a0){_0x9a23f5['push'](_0x9a23f5['shift']());}};_0x48eb4f(++_0xfd4537);}(_0x56dc,0x1bc));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xc56d('0x0'));var router=express['Router']();var controller=require(_0xc56d('0x1'));router[_0xc56d('0x2')]('/',controller['login']);module[_0xc56d('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 2976b0e..3b78b86 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_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 +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(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x7a54,0x106));var _0x47a5=function(_0x21b107,_0x4e609e){_0x21b107=_0x21b107-0x0;var _0x4d3ed2=_0x7a54[_0x21b107];return _0x4d3ed2;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 8a1268b..6f5ca6d 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 _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 +var _0x31d7=['exports','express','passport','Router','./authGoogle.controller','get','/callback','callback','login'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x31d7,0x160));var _0x731d=function(_0xd1557,_0x1351eb){_0xd1557=_0xd1557-0x0;var _0xcbd609=_0x31d7[_0xd1557];return _0xcbd609;};'use strict';var express=require(_0x731d('0x0'));var passport=require(_0x731d('0x1'));var router=express[_0x731d('0x2')]();var controller=require(_0x731d('0x3'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0x731d('0x4')](_0x731d('0x5'),controller[_0x731d('0x6')],authService['isMiddleware'],userController[_0x731d('0x7')],authService['setTokenCookie']);module[_0x731d('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 4f54360..d8cd2f9 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 _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 +var _0xbbda=['Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','validatePasswordHistory','previousPasswords','status','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','authenticate','minutes','clearBlockUser','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','request','error','message','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot'];(function(_0xafa7e8,_0x501da3){var _0x314110=function(_0x277f85){while(--_0x277f85){_0xafa7e8['push'](_0xafa7e8['shift']());}};_0x314110(++_0x501da3);}(_0xbbda,0x16a));var _0xabbd=function(_0xc27749,_0x188efd){_0xc27749=_0xc27749-0x0;var _0x566bde=_0xbbda[_0xc27749];return _0x566bde;};'use strict';var util=require(_0xabbd('0x0'));var passport=require(_0xabbd('0x1'));var LocalStrategy=require(_0xabbd('0x2'))[_0xabbd('0x3')];var jayson=require(_0xabbd('0x4'));var _=require(_0xabbd('0x5'));var rs=require(_0xabbd('0x6'));var moment=require('moment');var db=require(_0xabbd('0x7'))['db'];var authService=require(_0xabbd('0x8'));var utils=require('../../config/utils');var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0xdee9c8,_0x374e80,_0xd706b0,_0x56e953){var _0x211a97,_0x27cf10;return db[_0xabbd('0x9')][_0xabbd('0xa')]({'where':{'id':0x1},'attributes':[_0xabbd('0xb'),_0xabbd('0xc')],'raw':!![]})['then'](function(_0x8cb2c9){_0x211a97=_0x8cb2c9;return _0xdee9c8[_0xabbd('0xa')]({'attributes':['id',_0xabbd('0xd'),_0xabbd('0xe'),_0xabbd('0xf'),_0xabbd('0x10'),_0xabbd('0x11'),_0xabbd('0x12'),_0xabbd('0x13'),_0xabbd('0x14')],'where':{'name':_0x374e80,'role':{'$or':[_0xabbd('0x15'),_0xabbd('0x16'),_0xabbd('0x17')]}}});})[_0xabbd('0x18')](function(_0x4a7335){if(!_0x4a7335||_0x4a7335&&_0x4a7335['name']!==_0x374e80){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x27cf10=_0x4a7335;return _0x27cf10;}})[_0xabbd('0x18')](function(){_0x27cf10[_0xabbd('0x19')](_0xd706b0,function(_0x57d3f9,_0x594ad7){var _0x1e33bc=_0x27cf10[_0xabbd('0x14')]+0x1;if(_0x57d3f9){return _0x56e953(_0x57d3f9);}else if(!_0x594ad7){if(_0x27cf10[_0xabbd('0x11')]){return _0x56e953(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x211a97[_0xabbd('0xb')]>0x0){if(_0x27cf10[_0xabbd('0x12')]){if(_0x211a97[_0xabbd('0xc')]>0x0){if(moment(_0x27cf10[_0xabbd('0x13')])['add'](_0x211a97[_0xabbd('0xc')],_0xabbd('0x1a'))>moment()){return _0x56e953(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xabbd('0x1b')](_0x27cf10,_0x1e33bc,![],null)[_0xabbd('0x18')](function(){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});});}}else{return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}}else{if(_0x1e33bc>=_0x211a97['allowedLoginAttempts']){return utils['clearBlockUser'](_0x27cf10,0x0,!![],moment())[_0xabbd('0x18')](function(){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});});}else{return utils[_0xabbd('0x1b')](_0x27cf10,_0x1e33bc,![],null)['then'](function(){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});});}}}else{return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}}else{if(_0x27cf10[_0xabbd('0x11')]){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}else if(_0x211a97['allowedLoginAttempts']>0x0){if(_0x27cf10['blocked']){if(_0x211a97['blockDuration']>0x0){if(moment(_0x27cf10[_0xabbd('0x13')])['add'](_0x211a97[_0xabbd('0xc')],_0xabbd('0x1a'))>moment()){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}else{return utils[_0xabbd('0x1b')](_0x27cf10,0x0,![],null)[_0xabbd('0x18')](function(){return utils[_0xabbd('0x1d')](_0x27cf10);})[_0xabbd('0x18')](function(){return _0x56e953(null,_0x27cf10);});}}else{return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}}else{return utils[_0xabbd('0x1b')](_0x27cf10,0x0,![],null)[_0xabbd('0x18')](function(){return utils[_0xabbd('0x1d')](_0x27cf10);})['then'](function(){return _0x56e953(null,_0x27cf10);})[_0xabbd('0x1e')](function(_0x118595){return _0x56e953(null,![],_0x118595);});}}else{if(_0x27cf10[_0xabbd('0x12')]){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}else{return utils['getLicense'](_0x27cf10)['then'](function(){return _0x56e953(null,_0x27cf10);});}}}});})[_0xabbd('0x1e')](function(_0xd7a2f){return _0x56e953(null,![],_0xd7a2f);});}function sendServiceMail(_0x1e4a2e){return db[_0xabbd('0x1f')][_0xabbd('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xabbd('0x21')],'include':[{'model':db[_0xabbd('0x22')],'as':'Smtp','include':[{'model':db[_0xabbd('0x23')],'as':_0xabbd('0x23')}]}]})[_0xabbd('0x18')](function(_0x5e580d){if(!_0x5e580d){throw new Error(_0xabbd('0x24'));}var _0x2cebc2=_0x5e580d[_0xabbd('0x25')]();var _0x595509={'account':_0x2cebc2,'message':_['merge']({'from':util[_0xabbd('0x26')](_0xabbd('0x27'),_0x5e580d[_0xabbd('0xd')],_0x5e580d[_0xabbd('0x21')]||_0x5e580d[_0xabbd('0x28')][_0xabbd('0x16')])},_0x1e4a2e)};return client[_0xabbd('0x29')]('SendMail',_0x595509);})[_0xabbd('0x18')](function(_0x21080d){if(_0x21080d[_0xabbd('0x2a')]){throw new Error(util[_0xabbd('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x21080d[_0xabbd('0x2a')][_0xabbd('0x2b')]||JSON[_0xabbd('0x2c')](_0x21080d[_0xabbd('0x2a')])));}return!![];});}function handleError(_0x500f79,_0x5e68fe,_0x2ebf08){return _0x500f79['status'](_0x5e68fe||0x1f4)[_0xabbd('0x2d')]({'message':_0x2ebf08?_0x2ebf08[_0xabbd('0x2b')]||_0x2ebf08:''});}exports[_0xabbd('0x2e')]=function(_0x177a72,_0x17596b,_0x12010c){passport[_0xabbd('0x19')](_0xabbd('0x2f'),function(_0x57364a,_0x342586,_0x386a6d){var _0x466818=_0x57364a||_0x386a6d;if(_0x466818){return handleError(_0x17596b,0x191,_0x466818);}if(!_0x342586){return handleError(_0x17596b,0x194,{'message':_0xabbd('0x30')});}else{var _0x1f7903={'payload':{'id':_0x342586['id'],'role':_0x342586[_0xabbd('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xabbd('0x31')](_0x1f7903)[_0xabbd('0x18')](function(_0x49f727){_0x17596b[_0xabbd('0x32')]({'id':_0x342586['id'],'token':_0x49f727,'statusCall':'','isAlreadyLogged':_0x342586[_0xabbd('0x33')]});});}})(_0x177a72,_0x17596b,_0x12010c);};exports[_0xabbd('0x34')]=function(_0x385cff,_0x1948ca){if(!_0x385cff['body'][_0xabbd('0x21')]){return handleError(_0x1948ca,0x1f4,{'message':_0xabbd('0x35')});}var _0x3c46a9=rs[_0xabbd('0x36')]();_0x385cff['body'][_0xabbd('0x21')]=_0x385cff[_0xabbd('0x37')][_0xabbd('0x21')][_0xabbd('0x38')]()[_0xabbd('0x39')]();var _0x1cf5ea;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xabbd('0xb'),_0xabbd('0xc')],'raw':!![]})[_0xabbd('0x18')](function(_0xdca88a){_0x1cf5ea=_0xdca88a;return db['User'][_0xabbd('0x20')]({'where':{'email':_0x385cff[_0xabbd('0x37')]['email']}});})[_0xabbd('0x18')](function(_0x132390){if(!_0x132390){throw new Error(_0xabbd('0x3a'));}if(_0x132390['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x132390[_0xabbd('0x12')]){if(moment(_0x132390['blockedAt'])[_0xabbd('0x3b')](_0x1cf5ea['blockDuration'],'minutes')>moment()){throw new Error(_0xabbd('0x3c'));}else{_0x132390[_0xabbd('0x12')]=![];_0x132390[_0xabbd('0x13')]=null;}}_0x132390[_0xabbd('0x3d')]=_0x3c46a9;_0x132390['resetPasswordExpires']=Date[_0xabbd('0x3e')]()+0x36ee80;return _0x132390['save']();})['then'](function(){return sendServiceMail({'to':_0x385cff[_0xabbd('0x37')][_0xabbd('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xabbd('0x3f')+_0xabbd('0x40')+_0xabbd('0x41')+_0x385cff[_0xabbd('0x42')][_0xabbd('0x43')]+_0xabbd('0x44')+_0x3c46a9+'\x0a\x0a'+_0xabbd('0x45')});})[_0xabbd('0x18')](function(){_0x1948ca['status'](0xc8)['send']({'message':_0xabbd('0x46')});})[_0xabbd('0x1e')](function(_0x31708e){return handleError(_0x1948ca,0x1f4,_0x31708e);});};exports['reset']=function(_0x4baa37,_0x46fa13){return db[_0xabbd('0x47')][_0xabbd('0x20')]({'where':{'resetPasswordToken':_0x4baa37[_0xabbd('0x48')][_0xabbd('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xabbd('0x18')](function(_0x5d5696){if(!_0x5d5696){throw new Error(_0xabbd('0x4a'));}return db[_0xabbd('0x9')][_0xabbd('0xa')]({'attributes':['id','securePassword',_0xabbd('0x4b'),_0xabbd('0x4c')]})['then'](function(_0x330dcb){if(_0x330dcb[_0xabbd('0x4d')])authService[_0xabbd('0x4e')](_0x4baa37[_0xabbd('0x37')][_0xabbd('0xe')]);if(!_0x330dcb[_0xabbd('0x4b')]||!_0x5d5696['previousPasswords'])return _0x5d5696;authService[_0xabbd('0x4f')](_0x4baa37[_0xabbd('0x37')][_0xabbd('0xe')],_0x5d5696[_0xabbd('0x50')],_0x330dcb[_0xabbd('0x4c')]);return _0x5d5696;})['then'](function(){_0x5d5696[_0xabbd('0xe')]=_0x4baa37['body'][_0xabbd('0xe')];_0x5d5696[_0xabbd('0x3d')]=null;_0x5d5696['resetPasswordExpires']=null;return _0x5d5696['save']();});})['then'](function(){_0x46fa13[_0xabbd('0x51')](0xc8)[_0xabbd('0x2d')]({'message':'Password\x20reset!'});})[_0xabbd('0x1e')](function(_0x4b19ad){return handleError(_0x46fa13,0x1f4,_0x4b19ad);});};passport[_0xabbd('0x52')](_0xabbd('0x2f'),new LocalStrategy({'usernameField':_0xabbd('0xd'),'passwordField':_0xabbd('0xe')},function(_0x180d9c,_0x3ee985,_0xe5ad44){return localAuthenticate(db[_0xabbd('0x47')],_0x180d9c,_0x3ee985,_0xe5ad44);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 533b5db..0850c55 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 _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 +var _0x700f=['express','Router','login','post','/forgot','forgot','reset','exports'];(function(_0x1b6916,_0x5ea45e){var _0x4b37a9=function(_0x50e648){while(--_0x50e648){_0x1b6916['push'](_0x1b6916['shift']());}};_0x4b37a9(++_0x5ea45e);}(_0x700f,0x118));var _0xf700=function(_0xca167c,_0x439d26){_0xca167c=_0xca167c-0x0;var _0x30cc8b=_0x700f[_0xca167c];return _0x30cc8b;};'use strict';var express=require(_0xf700('0x0'));var router=express[_0xf700('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0xf700('0x2')]);router[_0xf700('0x3')](_0xf700('0x4'),controller[_0xf700('0x5')]);router[_0xf700('0x3')]('/reset/:token',controller[_0xf700('0x6')]);module[_0xf700('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 ce9418a..7da7b65 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 _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 +var _0x2658=['exports','STRING','BOOLEAN'];(function(_0x2787c5,_0x422f0b){var _0x1b53c5=function(_0x398028){while(--_0x398028){_0x2787c5['push'](_0x2787c5['shift']());}};_0x1b53c5(++_0x422f0b);}(_0x2658,0x102));var _0x8265=function(_0x1fb99e,_0x6afedb){_0x1fb99e=_0x1fb99e-0x0;var _0x4b9b71=_0x2658[_0x1fb99e];return _0x4b9b71;};'use strict';var Sequelize=require('sequelize');module[_0x8265('0x0')]={'name':{'type':Sequelize[_0x8265('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x8265('0x1')]},'description':{'type':Sequelize[_0x8265('0x1')]},'status':{'type':Sequelize[_0x8265('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 84bd174..43a0df5 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 _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 +var _0x4833=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','set','json','reject','save','then','destroy','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','offset','order','sort','where','pick','merge','map','filter','options','includeAll','include','catch','params','filters','fields','find','create','body','addConditions','ids','omit','getConditions','findOne','Condition','hasOwnProperty','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4833,0x138));var _0x3483=function(_0x133425,_0x2d60f2){_0x133425=_0x133425-0x0;var _0x45c4a4=_0x4833[_0x133425];return _0x45c4a4;};'use strict';var emlformat=require(_0x3483('0x0'));var rimraf=require(_0x3483('0x1'));var zipdir=require(_0x3483('0x2'));var jsonpatch=require(_0x3483('0x3'));var rp=require(_0x3483('0x4'));var moment=require(_0x3483('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3483('0x6'));var path=require(_0x3483('0x7'));var sox=require(_0x3483('0x8'));var csv=require(_0x3483('0x9'));var ejs=require(_0x3483('0xa'));var fs=require('fs');var fs_extra=require(_0x3483('0xb'));var _=require(_0x3483('0xc'));var squel=require(_0x3483('0xd'));var crypto=require(_0x3483('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3483('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3483('0x10'));var Papa=require(_0x3483('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3483('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3483('0x13'))(_0x3483('0x14'));var utils=require('../../config/utils');var config=require(_0x3483('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3483('0x16'))['db'];function respondWithStatusCode(_0x15cbd9,_0x44bfa6){_0x44bfa6=_0x44bfa6||0xcc;return function(_0x3de257){if(_0x3de257){return _0x15cbd9[_0x3483('0x17')](_0x44bfa6);}return _0x15cbd9[_0x3483('0x18')](_0x44bfa6)[_0x3483('0x19')]();};}function respondWithResult(_0x1ddf05,_0x28a634){_0x28a634=_0x28a634||0xc8;return function(_0x23dc4a){if(_0x23dc4a){return _0x1ddf05[_0x3483('0x18')](_0x28a634)['json'](_0x23dc4a);}};}function respondWithFilteredResult(_0xaa6bb,_0x1ea568){return function(_0x17977d){if(_0x17977d){var _0x917d97=typeof _0x1ea568['offset']===_0x3483('0x1a')&&typeof _0x1ea568[_0x3483('0x1b')]===_0x3483('0x1a');var _0x5e5f15=_0x17977d[_0x3483('0x1c')];var _0x9f9787=_0x917d97?0x0:_0x1ea568['offset'];var _0x1b9f71=_0x917d97?_0x17977d[_0x3483('0x1c')]:_0x1ea568['offset']+_0x1ea568[_0x3483('0x1b')];var _0x56d7a0;if(_0x1b9f71>=_0x5e5f15){_0x1b9f71=_0x5e5f15;_0x56d7a0=0xc8;}else{_0x56d7a0=0xce;}_0xaa6bb['status'](_0x56d7a0);return _0xaa6bb[_0x3483('0x1d')]('Content-Range',_0x9f9787+'-'+_0x1b9f71+'/'+_0x5e5f15)[_0x3483('0x1e')](_0x17977d);}return null;};}function patchUpdates(_0x23a996){return function(_0x5c4f99){try{jsonpatch['apply'](_0x5c4f99,_0x23a996,!![]);}catch(_0xfb559a){return BPromise[_0x3483('0x1f')](_0xfb559a);}return _0x5c4f99[_0x3483('0x20')]();};}function saveUpdates(_0xae11d5,_0x5dc29b){return function(_0x47154e){if(_0x47154e){return _0x47154e['update'](_0xae11d5)[_0x3483('0x21')](function(_0x2c8b98){return _0x2c8b98;});}return null;};}function removeEntity(_0x4a3472,_0x3b2dc4){return function(_0x5f3eae){if(_0x5f3eae){return _0x5f3eae[_0x3483('0x22')]()['then'](function(){_0x4a3472[_0x3483('0x18')](0xcc)[_0x3483('0x19')]();});}};}function handleEntityNotFound(_0x23f46f,_0x37f83d){return function(_0x3da448){if(!_0x3da448){_0x23f46f[_0x3483('0x17')](0x194);}return _0x3da448;};}function handleError(_0x2f8dc5,_0x5eb640){_0x5eb640=_0x5eb640||0x1f4;return function(_0x25ef22){logger[_0x3483('0x23')](_0x25ef22[_0x3483('0x24')]);if(_0x25ef22[_0x3483('0x25')]){delete _0x25ef22[_0x3483('0x25')];}_0x2f8dc5[_0x3483('0x18')](_0x5eb640)[_0x3483('0x26')](_0x25ef22);};}exports[_0x3483('0x27')]=function(_0x361a72,_0x5e7e3c){var _0x50bb78={},_0x16f58f={},_0x2c3544={'count':0x0,'rows':[]};var _0x5b9c58=_['map'](db[_0x3483('0x28')][_0x3483('0x29')],function(_0x2bbe67){return{'name':_0x2bbe67[_0x3483('0x2a')],'type':_0x2bbe67[_0x3483('0x2b')][_0x3483('0x2c')]};});_0x16f58f[_0x3483('0x2d')]=_['map'](_0x5b9c58,_0x3483('0x25'));_0x16f58f[_0x3483('0x2e')]=_[_0x3483('0x2f')](_0x361a72[_0x3483('0x2e')]);_0x16f58f['filters']=_[_0x3483('0x30')](_0x16f58f[_0x3483('0x2d')],_0x16f58f[_0x3483('0x2e')]);_0x50bb78['attributes']=_[_0x3483('0x30')](_0x16f58f[_0x3483('0x2d')],qs['fields'](_0x361a72[_0x3483('0x2e')]['fields']));_0x50bb78[_0x3483('0x31')]=_0x50bb78[_0x3483('0x31')][_0x3483('0x32')]?_0x50bb78[_0x3483('0x31')]:_0x16f58f[_0x3483('0x2d')];if(!_0x361a72[_0x3483('0x2e')]['hasOwnProperty']('nolimit')){_0x50bb78['limit']=qs[_0x3483('0x1b')](_0x361a72['query'][_0x3483('0x1b')]);_0x50bb78[_0x3483('0x33')]=qs[_0x3483('0x33')](_0x361a72[_0x3483('0x2e')]['offset']);}_0x50bb78[_0x3483('0x34')]=qs[_0x3483('0x35')](_0x361a72[_0x3483('0x2e')]['sort']);_0x50bb78[_0x3483('0x36')]=qs['filters'](_[_0x3483('0x37')](_0x361a72[_0x3483('0x2e')],_0x16f58f['filters']),_0x5b9c58);if(_0x361a72[_0x3483('0x2e')]['filter']){_0x50bb78[_0x3483('0x36')]=_[_0x3483('0x38')](_0x50bb78[_0x3483('0x36')],{'$or':_[_0x3483('0x39')](_0x5b9c58,function(_0x589c3e){if(_0x589c3e[_0x3483('0x2b')]!=='VIRTUAL'){var _0x46e4b7={};_0x46e4b7[_0x589c3e[_0x3483('0x25')]]={'$like':'%'+_0x361a72[_0x3483('0x2e')][_0x3483('0x3a')]+'%'};return _0x46e4b7;}})});}_0x50bb78=_[_0x3483('0x38')]({},_0x50bb78,_0x361a72[_0x3483('0x3b')]);var _0x4dfb10={'where':_0x50bb78[_0x3483('0x36')]};return db['Automation']['count'](_0x4dfb10)[_0x3483('0x21')](function(_0x27a399){_0x2c3544[_0x3483('0x1c')]=_0x27a399;if(_0x361a72[_0x3483('0x2e')][_0x3483('0x3c')]){_0x50bb78[_0x3483('0x3d')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x50bb78);})['then'](function(_0x10d1ed){_0x2c3544['rows']=_0x10d1ed;return _0x2c3544;})[_0x3483('0x21')](respondWithFilteredResult(_0x5e7e3c,_0x50bb78))[_0x3483('0x3e')](handleError(_0x5e7e3c,null));};exports['show']=function(_0x4eb609,_0x2aed33){var _0x2a036c={'raw':![],'where':{'id':_0x4eb609[_0x3483('0x3f')]['id']}},_0x853eb0={};_0x853eb0[_0x3483('0x2d')]=_['keys'](db[_0x3483('0x28')][_0x3483('0x29')]);_0x853eb0[_0x3483('0x2e')]=_[_0x3483('0x2f')](_0x4eb609[_0x3483('0x2e')]);_0x853eb0[_0x3483('0x40')]=_[_0x3483('0x30')](_0x853eb0['model'],_0x853eb0[_0x3483('0x2e')]);_0x2a036c[_0x3483('0x31')]=_[_0x3483('0x30')](_0x853eb0['model'],qs[_0x3483('0x41')](_0x4eb609[_0x3483('0x2e')][_0x3483('0x41')]));_0x2a036c[_0x3483('0x31')]=_0x2a036c[_0x3483('0x31')][_0x3483('0x32')]?_0x2a036c['attributes']:_0x853eb0[_0x3483('0x2d')];if(_0x4eb609[_0x3483('0x2e')][_0x3483('0x3c')]){_0x2a036c['include']=[{'all':!![]}];}_0x2a036c=_[_0x3483('0x38')]({},_0x2a036c,_0x4eb609['options']);return db[_0x3483('0x28')][_0x3483('0x42')](_0x2a036c)['then'](handleEntityNotFound(_0x2aed33,null))[_0x3483('0x21')](respondWithResult(_0x2aed33,null))[_0x3483('0x3e')](handleError(_0x2aed33,null));};exports[_0x3483('0x43')]=function(_0x5b793f,_0x46af15){return db['Automation'][_0x3483('0x43')](_0x5b793f[_0x3483('0x44')],{})[_0x3483('0x21')](respondWithResult(_0x46af15,0xc9))[_0x3483('0x3e')](handleError(_0x46af15,null));};exports['update']=function(_0x210500,_0x4e8084){if(_0x210500['body']['id']){delete _0x210500[_0x3483('0x44')]['id'];}return db[_0x3483('0x28')][_0x3483('0x42')]({'where':{'id':_0x210500['params']['id']}})[_0x3483('0x21')](handleEntityNotFound(_0x4e8084,null))['then'](saveUpdates(_0x210500['body'],null))['then'](respondWithResult(_0x4e8084,null))[_0x3483('0x3e')](handleError(_0x4e8084,null));};exports[_0x3483('0x22')]=function(_0xa8c8d2,_0x50b771){return db[_0x3483('0x28')]['find']({'where':{'id':_0xa8c8d2[_0x3483('0x3f')]['id']}})['then'](handleEntityNotFound(_0x50b771,null))['then'](removeEntity(_0x50b771,null))[_0x3483('0x3e')](handleError(_0x50b771,null));};exports[_0x3483('0x45')]=function(_0x4d2ba4,_0x857b28,_0x42c009){return db['Condition'][_0x3483('0x42')]({'where':{'id':_0x4d2ba4[_0x3483('0x3f')]['id']}})[_0x3483('0x21')](handleEntityNotFound(_0x857b28,null))[_0x3483('0x21')](function(_0x6a0ba3){if(_0x6a0ba3){return _0x6a0ba3[_0x3483('0x45')](_0x4d2ba4['body'][_0x3483('0x46')],_[_0x3483('0x47')](_0x4d2ba4[_0x3483('0x44')],['ids','id'])||{});}})[_0x3483('0x21')](respondWithResult(_0x857b28,null))['catch'](handleError(_0x857b28,null));};exports[_0x3483('0x48')]=function(_0x253c49,_0x43cbdf,_0x49e969){var _0x5f488b={};var _0x7340d5={};var _0x470d70;var _0x17c7ec;return db[_0x3483('0x28')][_0x3483('0x49')]({'where':{'id':_0x253c49[_0x3483('0x3f')]['id']}})[_0x3483('0x21')](handleEntityNotFound(_0x43cbdf,null))[_0x3483('0x21')](function(_0x441073){if(_0x441073){_0x470d70=_0x441073;_0x7340d5[_0x3483('0x2d')]=_[_0x3483('0x2f')](db[_0x3483('0x4a')][_0x3483('0x29')]);_0x7340d5[_0x3483('0x2e')]=_[_0x3483('0x2f')](_0x253c49[_0x3483('0x2e')]);_0x7340d5[_0x3483('0x40')]=_[_0x3483('0x30')](_0x7340d5[_0x3483('0x2d')],_0x7340d5[_0x3483('0x2e')]);_0x5f488b[_0x3483('0x31')]=_[_0x3483('0x30')](_0x7340d5[_0x3483('0x2d')],qs[_0x3483('0x41')](_0x253c49['query']['fields']));_0x5f488b[_0x3483('0x31')]=_0x5f488b['attributes'][_0x3483('0x32')]?_0x5f488b[_0x3483('0x31')]:_0x7340d5[_0x3483('0x2d')];_0x5f488b[_0x3483('0x34')]=qs[_0x3483('0x35')](_0x253c49[_0x3483('0x2e')][_0x3483('0x35')]);_0x5f488b[_0x3483('0x36')]=qs['filters'](_[_0x3483('0x37')](_0x253c49[_0x3483('0x2e')],_0x7340d5['filters']));if(_0x253c49['query'][_0x3483('0x3a')]){_0x5f488b[_0x3483('0x36')]=_[_0x3483('0x38')](_0x5f488b[_0x3483('0x36')],{'$or':_[_0x3483('0x39')](_0x5f488b[_0x3483('0x31')],function(_0x2fe58a){var _0x39e6a0={};_0x39e6a0[_0x2fe58a]={'$like':'%'+_0x253c49[_0x3483('0x2e')][_0x3483('0x3a')]+'%'};return _0x39e6a0;})});}_0x5f488b=_[_0x3483('0x38')]({},_0x5f488b,_0x253c49[_0x3483('0x3b')]);return _0x470d70['getConditions'](_0x5f488b);}})[_0x3483('0x21')](function(_0xe55349){if(_0xe55349){_0x17c7ec=_0xe55349[_0x3483('0x32')];if(!_0x253c49[_0x3483('0x2e')][_0x3483('0x4b')](_0x3483('0x4c'))){_0x5f488b['limit']=qs['limit'](_0x253c49[_0x3483('0x2e')][_0x3483('0x1b')]);_0x5f488b['offset']=qs[_0x3483('0x33')](_0x253c49[_0x3483('0x2e')][_0x3483('0x33')]);}return _0x470d70['getConditions'](_0x5f488b);}})['then'](function(_0x189091){if(_0x189091){return _0x189091?{'count':_0x17c7ec,'rows':_0x189091}:null;}})[_0x3483('0x21')](respondWithResult(_0x43cbdf,null))['catch'](handleError(_0x43cbdf,null));};exports['addActions']=function(_0x3f4713,_0x381e5b,_0x16d3ce){return db['Action'][_0x3483('0x42')]({'where':{'id':_0x3f4713['params']['id']}})[_0x3483('0x21')](handleEntityNotFound(_0x381e5b,null))['then'](function(_0x5b2f48){if(_0x5b2f48){return _0x5b2f48[_0x3483('0x4d')](_0x3f4713[_0x3483('0x44')][_0x3483('0x46')],_[_0x3483('0x47')](_0x3f4713['body'],[_0x3483('0x46'),'id'])||{});}})[_0x3483('0x21')](respondWithResult(_0x381e5b,null))['catch'](handleError(_0x381e5b,null));};exports['getActions']=function(_0x36917d,_0xf8ee9d,_0x581b27){var _0x179964={};var _0x22ec5f={};var _0x555da5;var _0x5ad5a8;return db[_0x3483('0x28')][_0x3483('0x49')]({'where':{'id':_0x36917d['params']['id']}})[_0x3483('0x21')](handleEntityNotFound(_0xf8ee9d,null))[_0x3483('0x21')](function(_0x1b6ec5){if(_0x1b6ec5){_0x555da5=_0x1b6ec5;_0x22ec5f[_0x3483('0x2d')]=_[_0x3483('0x2f')](db[_0x3483('0x4e')][_0x3483('0x29')]);_0x22ec5f[_0x3483('0x2e')]=_[_0x3483('0x2f')](_0x36917d[_0x3483('0x2e')]);_0x22ec5f[_0x3483('0x40')]=_['intersection'](_0x22ec5f[_0x3483('0x2d')],_0x22ec5f[_0x3483('0x2e')]);_0x179964['attributes']=_['intersection'](_0x22ec5f[_0x3483('0x2d')],qs['fields'](_0x36917d[_0x3483('0x2e')][_0x3483('0x41')]));_0x179964[_0x3483('0x31')]=_0x179964[_0x3483('0x31')]['length']?_0x179964[_0x3483('0x31')]:_0x22ec5f[_0x3483('0x2d')];_0x179964[_0x3483('0x34')]=qs['sort'](_0x36917d[_0x3483('0x2e')]['sort']);_0x179964['where']=qs[_0x3483('0x40')](_[_0x3483('0x37')](_0x36917d[_0x3483('0x2e')],_0x22ec5f[_0x3483('0x40')]));if(_0x36917d['query'][_0x3483('0x3a')]){_0x179964[_0x3483('0x36')]=_['merge'](_0x179964[_0x3483('0x36')],{'$or':_[_0x3483('0x39')](_0x179964[_0x3483('0x31')],function(_0x900ed4){var _0xf131da={};_0xf131da[_0x900ed4]={'$like':'%'+_0x36917d[_0x3483('0x2e')]['filter']+'%'};return _0xf131da;})});}_0x179964=_['merge']({},_0x179964,_0x36917d[_0x3483('0x3b')]);return _0x555da5[_0x3483('0x4f')](_0x179964);}})[_0x3483('0x21')](function(_0xf9cdfa){if(_0xf9cdfa){_0x5ad5a8=_0xf9cdfa[_0x3483('0x32')];if(!_0x36917d[_0x3483('0x2e')][_0x3483('0x4b')]('nolimit')){_0x179964['limit']=qs[_0x3483('0x1b')](_0x36917d[_0x3483('0x2e')]['limit']);_0x179964[_0x3483('0x33')]=qs['offset'](_0x36917d['query'][_0x3483('0x33')]);}return _0x555da5[_0x3483('0x4f')](_0x179964);}})[_0x3483('0x21')](function(_0x1de80d){if(_0x1de80d){return _0x1de80d?{'count':_0x5ad5a8,'rows':_0x1de80d}:null;}})[_0x3483('0x21')](respondWithResult(_0xf8ee9d,null))['catch'](handleError(_0xf8ee9d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 44d3ecc..c5c7135 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 _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 +var _0xc9e0=['rimraf','../../config/environment','./automation.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5a8181,_0x926962){var _0x4326bb=function(_0x271398){while(--_0x271398){_0x5a8181['push'](_0x5a8181['shift']());}};_0x4326bb(++_0x926962);}(_0xc9e0,0x14f));var _0x0c9e=function(_0x1cbce4,_0xe099c7){_0x1cbce4=_0x1cbce4-0x0;var _0x5aea53=_0xc9e0[_0x1cbce4];return _0x5aea53;};'use strict';var _=require(_0x0c9e('0x0'));var util=require('util');var logger=require(_0x0c9e('0x1'))('api');var moment=require(_0x0c9e('0x2'));var BPromise=require(_0x0c9e('0x3'));var rp=require(_0x0c9e('0x4'));var fs=require('fs');var path=require(_0x0c9e('0x5'));var rimraf=require(_0x0c9e('0x6'));var config=require(_0x0c9e('0x7'));var attributes=require(_0x0c9e('0x8'));module[_0x0c9e('0x9')]=function(_0x3005eb,_0x19d165){return _0x3005eb[_0x0c9e('0xa')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 5a7bd19..0bdab0b 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 _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 +var _0xea28=['rpc','../../config/environment','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x75a08f,_0x2795c0){var _0x16688f=function(_0x16096d){while(--_0x16096d){_0x75a08f['push'](_0x75a08f['shift']());}};_0x16688f(++_0x2795c0);}(_0xea28,0x13a));var _0x8ea2=function(_0x27f503,_0x1f62b5){_0x27f503=_0x27f503-0x0;var _0x28226f=_0xea28[_0x27f503];return _0x28226f;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('Automation,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 225b30c..ceb44ab 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 _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 +var _0x45d1=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','getConditions','post','create','addConditions','/:id/actions','addActions','put','update','delete','destroy','exports','multer'];(function(_0x41cf18,_0x2cc769){var _0x251cd4=function(_0x1aebeb){while(--_0x1aebeb){_0x41cf18['push'](_0x41cf18['shift']());}};_0x251cd4(++_0x2cc769);}(_0x45d1,0x1cb));var _0x145d=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x45d1[_0x158da6];return _0x429c30;};'use strict';var multer=require(_0x145d('0x0'));var util=require(_0x145d('0x1'));var path=require('path');var timeout=require(_0x145d('0x2'));var express=require(_0x145d('0x3'));var router=express['Router']();var fs_extra=require(_0x145d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x145d('0x5'));var config=require(_0x145d('0x6'));var controller=require(_0x145d('0x7'));router[_0x145d('0x8')]('/',auth[_0x145d('0x9')](),controller[_0x145d('0xa')]);router[_0x145d('0x8')](_0x145d('0xb'),auth[_0x145d('0x9')](),controller['show']);router['get']('/:id/conditions',auth[_0x145d('0x9')](),controller[_0x145d('0xc')]);router[_0x145d('0x8')]('/:id/actions',auth[_0x145d('0x9')](),controller['getActions']);router[_0x145d('0xd')]('/',auth[_0x145d('0x9')](),controller[_0x145d('0xe')]);router[_0x145d('0xd')]('/:id/conditions',auth[_0x145d('0x9')](),controller[_0x145d('0xf')]);router['post'](_0x145d('0x10'),auth[_0x145d('0x9')](),controller[_0x145d('0x11')]);router[_0x145d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x145d('0x13')]);router[_0x145d('0x14')](_0x145d('0xb'),auth['isAuthenticated'](),controller[_0x145d('0x15')]);module[_0x145d('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index d6fc3c4..4278df3 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 _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 +var _0x18ec=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','always','Active/Disactive\x20AMD','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x18ec,0x6c));var _0xc18e=function(_0xbb4285,_0x334a04){_0xbb4285=_0xbb4285-0x0;var _0x38149d=_0x18ec[_0xbb4285];return _0x38149d;};'use strict';var Sequelize=require(_0xc18e('0x0'));module[_0xc18e('0x1')]={'name':{'type':Sequelize[_0xc18e('0x2')],'unique':_0xc18e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xc18e('0x4')),'allowNull':![],'defaultValue':_0xc18e('0x4')},'description':{'type':Sequelize[_0xc18e('0x2')]},'active':{'type':Sequelize[_0xc18e('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xc18e('0x6')](0x4)[_0xc18e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc18e('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc18e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc18e('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc18e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc18e('0x6')](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc18e('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc18e('0xd')},'dialTimezone':{'type':Sequelize[_0xc18e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc18e('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xc18e('0xe'),'onlyIfOpen'),'defaultValue':_0xc18e('0xf')},'dialAMDActive':{'type':Sequelize[_0xc18e('0x5')],'defaultValue':0x0,'comment':_0xc18e('0x10')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc18e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc18e('0x6')](0x9)[_0xc18e('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc18e('0x6')](0x9)[_0xc18e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc18e('0x11')},'dialAMDMinWordLength':{'type':Sequelize[_0xc18e('0x6')](0x9)[_0xc18e('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc18e('0x12')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc18e('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc18e('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc18e('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc18e('0x6')](0x5)[_0xc18e('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc18e('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc18e('0x6')](0x9)[_0xc18e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc18e('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc18e('0x17')]('DESC',_0xc18e('0x18')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xc18e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc18e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc18e('0x19')},'dialCutDigit':{'type':Sequelize[_0xc18e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc18e('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc18e('0x6')](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0x1c')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc18e('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index f5b6c09..648d105 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 _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 +var _0x58d6=['NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','ListId\x20=\x20?','fromQuery','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','omit','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','map','Campaign','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','show','length','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','createdAt','updatedAt','body','IvrCampaigns','update','findOne','CmHopper','findAll','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','scheduledAt','ContactId','ListId','select','field','phone'];(function(_0x3d5fc8,_0x3503d7){var _0xec8c82=function(_0x43bc49){while(--_0x43bc49){_0x3d5fc8['push'](_0x3d5fc8['shift']());}};_0xec8c82(++_0x3503d7);}(_0x58d6,0x1d3));var _0x658d=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0x58d6[_0x179c4a];return _0x5d1879;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x658d('0x0'));var zipdir=require(_0x658d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x658d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x658d('0x3'));var util=require(_0x658d('0x4'));var path=require(_0x658d('0x5'));var sox=require(_0x658d('0x6'));var csv=require('to-csv');var ejs=require(_0x658d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x658d('0x8'));var squel=require(_0x658d('0x9'));var crypto=require(_0x658d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x658d('0xb'));var toCsv=require(_0x658d('0xc'));var querystring=require(_0x658d('0xd'));var Papa=require('papaparse');var Redis=require(_0x658d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x658d('0xf'));var as=require(_0x658d('0x10'));var hardwareService=require(_0x658d('0x11'));var logger=require('../../config/logger')(_0x658d('0x12'));var utils=require(_0x658d('0x13'));var config=require(_0x658d('0x14'));var licenseUtil=require(_0x658d('0x15'));var db=require(_0x658d('0x16'))['db'];function respondWithStatusCode(_0x2a266b,_0x9efc8c){_0x9efc8c=_0x9efc8c||0xcc;return function(_0x51295b){if(_0x51295b){return _0x2a266b[_0x658d('0x17')](_0x9efc8c);}return _0x2a266b[_0x658d('0x18')](_0x9efc8c)[_0x658d('0x19')]();};}function respondWithResult(_0x47360e,_0x43de3d){_0x43de3d=_0x43de3d||0xc8;return function(_0x28a2d0){if(_0x28a2d0){return _0x47360e[_0x658d('0x18')](_0x43de3d)[_0x658d('0x1a')](_0x28a2d0);}};}function respondWithFilteredResult(_0x303606,_0x17b20f){return function(_0x284431){if(_0x284431){var _0x42aae9=typeof _0x17b20f[_0x658d('0x1b')]==='undefined'&&typeof _0x17b20f[_0x658d('0x1c')]===_0x658d('0x1d');var _0x3031b4=_0x284431[_0x658d('0x1e')];var _0x8bcf62=_0x42aae9?0x0:_0x17b20f[_0x658d('0x1b')];var _0x13aa47=_0x42aae9?_0x284431[_0x658d('0x1e')]:_0x17b20f[_0x658d('0x1b')]+_0x17b20f['limit'];var _0x544b7c;if(_0x13aa47>=_0x3031b4){_0x13aa47=_0x3031b4;_0x544b7c=0xc8;}else{_0x544b7c=0xce;}_0x303606[_0x658d('0x18')](_0x544b7c);return _0x303606[_0x658d('0x1f')](_0x658d('0x20'),_0x8bcf62+'-'+_0x13aa47+'/'+_0x3031b4)[_0x658d('0x1a')](_0x284431);}return null;};}function patchUpdates(_0x2f1335){return function(_0x1c0271){try{jsonpatch[_0x658d('0x21')](_0x1c0271,_0x2f1335,!![]);}catch(_0x641d4){return BPromise[_0x658d('0x22')](_0x641d4);}return _0x1c0271['save']();};}function saveUpdates(_0x559e74,_0x408996){return function(_0x3ac068){if(_0x3ac068){return _0x3ac068['update'](_0x559e74)[_0x658d('0x23')](function(_0x13cbc3){return _0x13cbc3;});}return null;};}function removeEntity(_0x3e95f5,_0x56dd20){return function(_0x4f9418){if(_0x4f9418){return _0x4f9418[_0x658d('0x24')]()[_0x658d('0x23')](function(){var _0x556ce9=_0x4f9418[_0x658d('0x25')]({'plain':!![]});var _0x41f238='IvrCampaigns';return db[_0x658d('0x26')][_0x658d('0x24')]({'where':{'type':_0x41f238,'resourceId':_0x556ce9['id']}})[_0x658d('0x23')](function(){return _0x4f9418;});})['then'](function(){_0x3e95f5[_0x658d('0x18')](0xcc)[_0x658d('0x19')]();});}};}function handleEntityNotFound(_0x12fce9,_0x18a265){return function(_0xb2f751){if(!_0xb2f751){_0x12fce9[_0x658d('0x17')](0x194);}return _0xb2f751;};}function handleError(_0x1924aa,_0x819481){_0x819481=_0x819481||0x1f4;return function(_0x918588){logger[_0x658d('0x27')](_0x918588[_0x658d('0x28')]);if(_0x918588[_0x658d('0x29')]){delete _0x918588['name'];}_0x1924aa[_0x658d('0x18')](_0x819481)[_0x658d('0x2a')](_0x918588);};}exports['index']=function(_0x11c191,_0xda355b){var _0x17db1a={},_0x1e189b={},_0xc62d8={'count':0x0,'rows':[]};var _0x9d8b62=_[_0x658d('0x2b')](db[_0x658d('0x2c')][_0x658d('0x2d')],function(_0x4b4f73){return{'name':_0x4b4f73[_0x658d('0x2e')],'type':_0x4b4f73['type'][_0x658d('0x2f')]};});_0x1e189b[_0x658d('0x30')]=_[_0x658d('0x2b')](_0x9d8b62,_0x658d('0x29'));_0x1e189b[_0x658d('0x31')]=_[_0x658d('0x32')](_0x11c191[_0x658d('0x31')]);_0x1e189b[_0x658d('0x33')]=_[_0x658d('0x34')](_0x1e189b[_0x658d('0x30')],_0x1e189b[_0x658d('0x31')]);_0x17db1a[_0x658d('0x35')]=_[_0x658d('0x34')](_0x1e189b[_0x658d('0x30')],qs[_0x658d('0x36')](_0x11c191[_0x658d('0x31')]['fields']));_0x17db1a['attributes']=_0x17db1a[_0x658d('0x35')]['length']?_0x17db1a[_0x658d('0x35')]:_0x1e189b[_0x658d('0x30')];if(!_0x11c191[_0x658d('0x31')][_0x658d('0x37')](_0x658d('0x38'))){_0x17db1a[_0x658d('0x1c')]=qs[_0x658d('0x1c')](_0x11c191[_0x658d('0x31')][_0x658d('0x1c')]);_0x17db1a['offset']=qs['offset'](_0x11c191[_0x658d('0x31')][_0x658d('0x1b')]);}_0x17db1a[_0x658d('0x39')]=qs[_0x658d('0x3a')](_0x11c191[_0x658d('0x31')][_0x658d('0x3a')]);_0x17db1a[_0x658d('0x3b')]=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0x11c191[_0x658d('0x31')],_0x1e189b[_0x658d('0x33')]),_0x9d8b62);if(_0x11c191['query'][_0x658d('0x3d')]){_0x17db1a[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x17db1a[_0x658d('0x3b')],{'$or':_[_0x658d('0x2b')](_0x9d8b62,function(_0x295387){if(_0x295387[_0x658d('0x3f')]!==_0x658d('0x40')){var _0x337afd={};_0x337afd[_0x295387['name']]={'$like':'%'+_0x11c191[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x337afd;}})});}_0x17db1a=_[_0x658d('0x3e')]({},_0x17db1a,_0x11c191[_0x658d('0x41')]);var _0x3e8698={'where':_0x17db1a[_0x658d('0x3b')]};return db[_0x658d('0x2c')]['count'](_0x3e8698)[_0x658d('0x23')](function(_0xdd974f){_0xc62d8[_0x658d('0x1e')]=_0xdd974f;if(_0x11c191[_0x658d('0x31')][_0x658d('0x42')]){_0x17db1a['include']=[{'all':!![]}];}return db[_0x658d('0x2c')]['findAll'](_0x17db1a);})['then'](function(_0xce7485){_0xc62d8[_0x658d('0x43')]=_0xce7485;return _0xc62d8;})[_0x658d('0x23')](respondWithFilteredResult(_0xda355b,_0x17db1a))['catch'](handleError(_0xda355b,null));};exports[_0x658d('0x44')]=function(_0x55b50f,_0xc28287){var _0x2a340c={'raw':![],'where':{'id':_0x55b50f['params']['id']}},_0x316c0f={};_0x316c0f[_0x658d('0x30')]=_['keys'](db[_0x658d('0x2c')][_0x658d('0x2d')]);_0x316c0f[_0x658d('0x31')]=_[_0x658d('0x32')](_0x55b50f['query']);_0x316c0f[_0x658d('0x33')]=_['intersection'](_0x316c0f[_0x658d('0x30')],_0x316c0f[_0x658d('0x31')]);_0x2a340c['attributes']=_['intersection'](_0x316c0f[_0x658d('0x30')],qs[_0x658d('0x36')](_0x55b50f['query'][_0x658d('0x36')]));_0x2a340c[_0x658d('0x35')]=_0x2a340c[_0x658d('0x35')][_0x658d('0x45')]?_0x2a340c['attributes']:_0x316c0f['model'];if(_0x55b50f[_0x658d('0x31')][_0x658d('0x42')]){_0x2a340c[_0x658d('0x46')]=[{'all':!![]}];}_0x2a340c=_[_0x658d('0x3e')]({},_0x2a340c,_0x55b50f[_0x658d('0x41')]);return db[_0x658d('0x2c')]['find'](_0x2a340c)['then'](handleEntityNotFound(_0xc28287,null))[_0x658d('0x23')](respondWithResult(_0xc28287,null))[_0x658d('0x47')](handleError(_0xc28287,null));};exports['create']=function(_0xd1f6e9,_0x3e4fc1){return db[_0x658d('0x2c')][_0x658d('0x48')](_0xd1f6e9['body'],{})['then'](function(_0xa188d1){var _0x279443=_0xd1f6e9[_0x658d('0x49')][_0x658d('0x25')]({'plain':!![]});if(!_0x279443)throw new Error(_0x658d('0x4a'));if(_0x279443[_0x658d('0x4b')]===_0x658d('0x49')){var _0x3a114c=_0xa188d1['get']({'plain':!![]});var _0x1b30b8='IvrCampaigns';return db[_0x658d('0x4c')][_0x658d('0x4d')]({'where':{'name':_0x1b30b8,'userProfileId':_0x279443[_0x658d('0x4e')]},'raw':!![]})[_0x658d('0x23')](function(_0x24cf3f){if(_0x24cf3f&&_0x24cf3f[_0x658d('0x4f')]===0x0){return db[_0x658d('0x26')][_0x658d('0x48')]({'name':_0x3a114c[_0x658d('0x29')],'resourceId':_0x3a114c['id'],'type':_0x24cf3f[_0x658d('0x29')],'sectionId':_0x24cf3f['id']},{})[_0x658d('0x23')](function(){return _0xa188d1;});}else{return _0xa188d1;}})['catch'](function(_0x5ec0d0){logger[_0x658d('0x27')](_0x658d('0x50'),_0x5ec0d0);throw _0x5ec0d0;});}return _0xa188d1;})['then'](respondWithResult(_0x3e4fc1,0xc9))[_0x658d('0x47')](handleError(_0x3e4fc1,null));};exports['clone']=function(_0x49106b,_0x2ad993){var _0x63457d={'where':{'id':_0x49106b[_0x658d('0x51')]['id']}},_0x283d7f={};_0x283d7f[_0x658d('0x30')]=_[_0x658d('0x32')](db[_0x658d('0x2c')][_0x658d('0x2d')]);_0x63457d[_0x658d('0x35')]=_[_0x658d('0x34')](_0x283d7f[_0x658d('0x30')],qs[_0x658d('0x36')](_0x49106b[_0x658d('0x31')][_0x658d('0x36')]));_0x63457d[_0x658d('0x35')]=_0x63457d[_0x658d('0x35')][_0x658d('0x45')]?_0x63457d[_0x658d('0x35')]:_0x283d7f[_0x658d('0x30')];if(_0x49106b[_0x658d('0x31')][_0x658d('0x42')]){_0x63457d[_0x658d('0x46')]=[{'all':!![]}];}_0x63457d=_[_0x658d('0x3e')]({},_0x63457d,_0x49106b[_0x658d('0x41')]);return db[_0x658d('0x2c')]['find'](_0x63457d)['then'](handleEntityNotFound(_0x2ad993,null))[_0x658d('0x23')](function(_0x30d8b9){if(_0x30d8b9){var _0x4fb904=_0x30d8b9[_0x658d('0x25')]({'plain':!![]});_0x4fb904=qs['omit'](_0x4fb904,['id',_0x658d('0x52'),_0x658d('0x53')]);_0x49106b['body']=_['omit'](_0x49106b[_0x658d('0x54')],['id',_0x658d('0x52'),_0x658d('0x53')]);return db['Campaign'][_0x658d('0x48')](_[_0x658d('0x3e')](_0x4fb904,_0x49106b[_0x658d('0x54')]),{'include':_0x49106b['query'][_0x658d('0x42')]?[{'all':!![]}]:undefined})[_0x658d('0x23')](function(_0x579ee2){var _0x16e70a=_0x49106b[_0x658d('0x49')]['get']({'plain':!![]});if(!_0x16e70a)throw new Error(_0x658d('0x4a'));if(_0x16e70a['role']===_0x658d('0x49')){var _0x7c51dd=_0x579ee2[_0x658d('0x25')]({'plain':!![]});var _0x47152a=_0x658d('0x55');return db['UserProfileSection'][_0x658d('0x4d')]({'where':{'name':_0x47152a,'userProfileId':_0x16e70a[_0x658d('0x4e')]},'raw':!![]})[_0x658d('0x23')](function(_0x4715e0){if(_0x4715e0&&_0x4715e0[_0x658d('0x4f')]===0x0){return db[_0x658d('0x26')][_0x658d('0x48')]({'name':_0x7c51dd['name'],'resourceId':_0x7c51dd['id'],'type':_0x4715e0['name'],'sectionId':_0x4715e0['id']},{})['then'](function(){return _0x579ee2;});}else{return _0x579ee2;}})[_0x658d('0x47')](function(_0xf18e7f){logger[_0x658d('0x27')](_0x658d('0x50'),_0xf18e7f);throw _0xf18e7f;});}return _0x579ee2;});}})[_0x658d('0x23')](respondWithResult(_0x2ad993,0xc9))[_0x658d('0x47')](handleError(_0x2ad993,null));};exports[_0x658d('0x56')]=function(_0x1b15af,_0x273aa7){if(_0x1b15af[_0x658d('0x54')]['id']){delete _0x1b15af[_0x658d('0x54')]['id'];}return db[_0x658d('0x2c')][_0x658d('0x4d')]({'where':{'id':_0x1b15af[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x273aa7,null))['then'](saveUpdates(_0x1b15af[_0x658d('0x54')],null))[_0x658d('0x23')](respondWithResult(_0x273aa7,null))[_0x658d('0x47')](handleError(_0x273aa7,null));};exports['destroy']=function(_0x3c226f,_0x430a95){return db[_0x658d('0x2c')][_0x658d('0x4d')]({'where':{'id':_0x3c226f[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x430a95,null))[_0x658d('0x23')](removeEntity(_0x430a95,null))[_0x658d('0x47')](handleError(_0x430a95,null));};exports['getHoppers']=function(_0x5d835a,_0x5c844c,_0x564078){var _0x38fdef={'raw':!![],'where':{}};var _0x265dbc={};var _0x2b5295={'count':0x0,'rows':[]};return db[_0x658d('0x2c')][_0x658d('0x57')]({'where':{'id':_0x5d835a[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x5c844c,null))[_0x658d('0x23')](function(_0x1547f8){if(_0x1547f8){_0x265dbc[_0x658d('0x30')]=_[_0x658d('0x32')](db['CmHopper'][_0x658d('0x2d')]);_0x265dbc[_0x658d('0x31')]=_[_0x658d('0x32')](_0x5d835a[_0x658d('0x31')]);_0x265dbc[_0x658d('0x33')]=_[_0x658d('0x34')](_0x265dbc['model'],_0x265dbc['query']);_0x38fdef[_0x658d('0x35')]=_[_0x658d('0x34')](_0x265dbc[_0x658d('0x30')],qs[_0x658d('0x36')](_0x5d835a[_0x658d('0x31')]['fields']));_0x38fdef[_0x658d('0x35')]=_0x38fdef[_0x658d('0x35')]['length']?_0x38fdef['attributes']:_0x265dbc[_0x658d('0x30')];if(!_0x5d835a[_0x658d('0x31')][_0x658d('0x37')](_0x658d('0x38'))){_0x38fdef[_0x658d('0x1c')]=qs['limit'](_0x5d835a[_0x658d('0x31')][_0x658d('0x1c')]);_0x38fdef[_0x658d('0x1b')]=qs[_0x658d('0x1b')](_0x5d835a[_0x658d('0x31')][_0x658d('0x1b')]);}_0x38fdef[_0x658d('0x39')]=qs['sort'](_0x5d835a['query'][_0x658d('0x3a')]);_0x38fdef[_0x658d('0x3b')]=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0x5d835a[_0x658d('0x31')],_0x265dbc[_0x658d('0x33')]));_0x38fdef[_0x658d('0x3b')]['CampaignId']=_0x1547f8['id'];if(_0x5d835a[_0x658d('0x31')]['filter']){_0x38fdef[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x38fdef[_0x658d('0x3b')],{'$or':_[_0x658d('0x2b')](_0x38fdef[_0x658d('0x35')],function(_0x37d605){var _0x402722={};_0x402722[_0x37d605]={'$like':'%'+_0x5d835a[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x402722;})});}_0x38fdef=_['merge']({},_0x38fdef,_0x5d835a[_0x658d('0x41')]);return db['CmHopper']['count']({'where':_0x38fdef[_0x658d('0x3b')]})[_0x658d('0x23')](function(_0x5f36cf){_0x2b5295[_0x658d('0x1e')]=_0x5f36cf;if(_0x5d835a['query'][_0x658d('0x42')]){_0x38fdef[_0x658d('0x46')]=[{'all':!![]}];}return db[_0x658d('0x58')][_0x658d('0x59')](_0x38fdef);})[_0x658d('0x23')](function(_0x38cc3b){_0x2b5295[_0x658d('0x43')]=_0x38cc3b;return _0x2b5295;});}})[_0x658d('0x23')](respondWithFilteredResult(_0x5c844c,_0x38fdef))[_0x658d('0x47')](handleError(_0x5c844c,null));};exports['getHopperHistories']=function(_0x210fee,_0x14f77e,_0xddcc7a){var _0x10cab6={'raw':!![],'where':{}};var _0x18a1ba={};var _0x28a5f8={'count':0x0,'rows':[]};return db[_0x658d('0x2c')][_0x658d('0x57')]({'where':{'id':_0x210fee[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x14f77e,null))['then'](function(_0x5eaa6c){if(_0x5eaa6c){_0x18a1ba[_0x658d('0x30')]=_[_0x658d('0x32')](db['CmHopperHistory'][_0x658d('0x2d')]);_0x18a1ba[_0x658d('0x31')]=_['keys'](_0x210fee[_0x658d('0x31')]);_0x18a1ba[_0x658d('0x33')]=_[_0x658d('0x34')](_0x18a1ba[_0x658d('0x30')],_0x18a1ba['query']);_0x10cab6['attributes']=_[_0x658d('0x34')](_0x18a1ba[_0x658d('0x30')],qs[_0x658d('0x36')](_0x210fee[_0x658d('0x31')]['fields']));_0x10cab6[_0x658d('0x35')]=_0x10cab6['attributes'][_0x658d('0x45')]?_0x10cab6[_0x658d('0x35')]:_0x18a1ba[_0x658d('0x30')];if(!_0x210fee[_0x658d('0x31')]['hasOwnProperty'](_0x658d('0x38'))){_0x10cab6[_0x658d('0x1c')]=qs[_0x658d('0x1c')](_0x210fee[_0x658d('0x31')][_0x658d('0x1c')]);_0x10cab6[_0x658d('0x1b')]=qs[_0x658d('0x1b')](_0x210fee[_0x658d('0x31')][_0x658d('0x1b')]);}_0x10cab6[_0x658d('0x39')]=qs[_0x658d('0x3a')](_0x210fee[_0x658d('0x31')][_0x658d('0x3a')]);_0x10cab6[_0x658d('0x3b')]=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0x210fee['query'],_0x18a1ba['filters']));_0x10cab6[_0x658d('0x3b')][_0x658d('0x5a')]=_0x5eaa6c['id'];if(_0x210fee[_0x658d('0x31')][_0x658d('0x3d')]){_0x10cab6[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x10cab6[_0x658d('0x3b')],{'$or':_[_0x658d('0x2b')](_0x10cab6[_0x658d('0x35')],function(_0x11444c){var _0x348f8b={};_0x348f8b[_0x11444c]={'$like':'%'+_0x210fee[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x348f8b;})});}_0x10cab6=_[_0x658d('0x3e')]({},_0x10cab6,_0x210fee['options']);return db[_0x658d('0x5b')][_0x658d('0x1e')]({'where':_0x10cab6['where']})[_0x658d('0x23')](function(_0x5866d5){_0x28a5f8[_0x658d('0x1e')]=_0x5866d5;if(_0x210fee['query'][_0x658d('0x42')]){_0x10cab6['include']=[{'all':!![]}];}return db[_0x658d('0x5b')][_0x658d('0x59')](_0x10cab6);})[_0x658d('0x23')](function(_0x12de37){_0x28a5f8[_0x658d('0x43')]=_0x12de37;return _0x28a5f8;});}})[_0x658d('0x23')](respondWithFilteredResult(_0x14f77e,_0x10cab6))[_0x658d('0x47')](handleError(_0x14f77e,null));};exports[_0x658d('0x5c')]=function(_0x3103c7,_0x9caad5,_0x167468){var _0x22cbe7={'raw':!![],'where':{}};var _0x153ef0={};var _0x4f285c={'count':0x0,'rows':[]};return db[_0x658d('0x2c')][_0x658d('0x57')]({'where':{'id':_0x3103c7[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x9caad5,null))[_0x658d('0x23')](function(_0x308a55){if(_0x308a55){_0x153ef0[_0x658d('0x30')]=_[_0x658d('0x32')](db[_0x658d('0x5d')][_0x658d('0x2d')]);_0x153ef0['query']=_[_0x658d('0x32')](_0x3103c7[_0x658d('0x31')]);_0x153ef0['filters']=_[_0x658d('0x34')](_0x153ef0[_0x658d('0x30')],_0x153ef0[_0x658d('0x31')]);_0x22cbe7['attributes']=_[_0x658d('0x34')](_0x153ef0[_0x658d('0x30')],qs[_0x658d('0x36')](_0x3103c7[_0x658d('0x31')][_0x658d('0x36')]));_0x22cbe7[_0x658d('0x35')]=_0x22cbe7[_0x658d('0x35')]['length']?_0x22cbe7[_0x658d('0x35')]:_0x153ef0[_0x658d('0x30')];if(!_0x3103c7[_0x658d('0x31')][_0x658d('0x37')](_0x658d('0x38'))){_0x22cbe7['limit']=qs[_0x658d('0x1c')](_0x3103c7[_0x658d('0x31')][_0x658d('0x1c')]);_0x22cbe7['offset']=qs[_0x658d('0x1b')](_0x3103c7[_0x658d('0x31')]['offset']);}_0x22cbe7['order']=qs[_0x658d('0x3a')](_0x3103c7['query'][_0x658d('0x3a')]);_0x22cbe7['where']=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0x3103c7[_0x658d('0x31')],_0x153ef0[_0x658d('0x33')]));_0x22cbe7[_0x658d('0x3b')]['CampaignId']=_0x308a55['id'];if(_0x3103c7['query'][_0x658d('0x3d')]){_0x22cbe7[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x22cbe7['where'],{'$or':_[_0x658d('0x2b')](_0x22cbe7[_0x658d('0x35')],function(_0x2611fb){var _0x5f4a59={};_0x5f4a59[_0x2611fb]={'$like':'%'+_0x3103c7[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x5f4a59;})});}_0x22cbe7=_[_0x658d('0x3e')]({},_0x22cbe7,_0x3103c7[_0x658d('0x41')]);return db[_0x658d('0x5d')]['count']({'where':_0x22cbe7['where']})[_0x658d('0x23')](function(_0x45ec08){_0x4f285c['count']=_0x45ec08;if(_0x3103c7[_0x658d('0x31')][_0x658d('0x42')]){_0x22cbe7[_0x658d('0x46')]=[{'all':!![]}];}return db[_0x658d('0x5d')][_0x658d('0x59')](_0x22cbe7);})['then'](function(_0xaf1039){_0x4f285c[_0x658d('0x43')]=_0xaf1039;return _0x4f285c;});}})[_0x658d('0x23')](respondWithFilteredResult(_0x9caad5,_0x22cbe7))[_0x658d('0x47')](handleError(_0x9caad5,null));};exports[_0x658d('0x5e')]=function(_0xf4d662,_0xca591d,_0x5b0627){var _0x4a4956={'raw':!![],'where':{}};var _0x12990d={};var _0x445e01={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xf4d662['params']['id']}})[_0x658d('0x23')](handleEntityNotFound(_0xca591d,null))['then'](function(_0x15da2e){if(_0x15da2e){_0x12990d[_0x658d('0x30')]=_[_0x658d('0x32')](db['CmHopperBlack']['rawAttributes']);_0x12990d[_0x658d('0x31')]=_[_0x658d('0x32')](_0xf4d662['query']);_0x12990d['filters']=_['intersection'](_0x12990d[_0x658d('0x30')],_0x12990d[_0x658d('0x31')]);_0x4a4956[_0x658d('0x35')]=_['intersection'](_0x12990d[_0x658d('0x30')],qs['fields'](_0xf4d662[_0x658d('0x31')][_0x658d('0x36')]));_0x4a4956[_0x658d('0x35')]=_0x4a4956['attributes'][_0x658d('0x45')]?_0x4a4956[_0x658d('0x35')]:_0x12990d[_0x658d('0x30')];if(!_0xf4d662[_0x658d('0x31')][_0x658d('0x37')](_0x658d('0x38'))){_0x4a4956[_0x658d('0x1c')]=qs[_0x658d('0x1c')](_0xf4d662[_0x658d('0x31')][_0x658d('0x1c')]);_0x4a4956[_0x658d('0x1b')]=qs[_0x658d('0x1b')](_0xf4d662[_0x658d('0x31')]['offset']);}_0x4a4956['order']=qs[_0x658d('0x3a')](_0xf4d662['query'][_0x658d('0x3a')]);_0x4a4956[_0x658d('0x3b')]=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0xf4d662[_0x658d('0x31')],_0x12990d[_0x658d('0x33')]));_0x4a4956[_0x658d('0x3b')][_0x658d('0x5a')]=_0x15da2e['id'];if(_0xf4d662[_0x658d('0x31')][_0x658d('0x3d')]){_0x4a4956[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x4a4956[_0x658d('0x3b')],{'$or':_['map'](_0x4a4956[_0x658d('0x35')],function(_0x11a2d3){var _0x10b453={};_0x10b453[_0x11a2d3]={'$like':'%'+_0xf4d662[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x10b453;})});}_0x4a4956=_[_0x658d('0x3e')]({},_0x4a4956,_0xf4d662[_0x658d('0x41')]);return db[_0x658d('0x5f')][_0x658d('0x1e')]({'where':_0x4a4956['where']})[_0x658d('0x23')](function(_0xd17d6d){_0x445e01[_0x658d('0x1e')]=_0xd17d6d;if(_0xf4d662[_0x658d('0x31')][_0x658d('0x42')]){_0x4a4956[_0x658d('0x46')]=[{'all':!![]}];}return db[_0x658d('0x5f')][_0x658d('0x59')](_0x4a4956);})['then'](function(_0x47336a){_0x445e01[_0x658d('0x43')]=_0x47336a;return _0x445e01;});}})['then'](respondWithFilteredResult(_0xca591d,_0x4a4956))[_0x658d('0x47')](handleError(_0xca591d,null));};exports[_0x658d('0x60')]=function(_0x2dbbe8,_0x2c6b70,_0x29eaf2){var _0x5c8167={};var _0x2685bf={};var _0x2716bd;var _0x393c73;return db[_0x658d('0x2c')]['findOne']({'where':{'id':_0x2dbbe8[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x2c6b70,null))['then'](function(_0x203863){if(_0x203863){_0x2716bd=_0x203863;_0x2685bf['model']=_['keys'](db[_0x658d('0x61')][_0x658d('0x2d')]);_0x2685bf[_0x658d('0x31')]=_[_0x658d('0x32')](_0x2dbbe8[_0x658d('0x31')]);_0x2685bf[_0x658d('0x33')]=_['intersection'](_0x2685bf[_0x658d('0x30')],_0x2685bf[_0x658d('0x31')]);_0x5c8167[_0x658d('0x35')]=_['intersection'](_0x2685bf[_0x658d('0x30')],qs[_0x658d('0x36')](_0x2dbbe8['query'][_0x658d('0x36')]));_0x5c8167[_0x658d('0x35')]=_0x5c8167[_0x658d('0x35')]['length']?_0x5c8167[_0x658d('0x35')]:_0x2685bf[_0x658d('0x30')];_0x5c8167['order']=qs[_0x658d('0x3a')](_0x2dbbe8[_0x658d('0x31')]['sort']);_0x5c8167['where']=qs[_0x658d('0x33')](_['pick'](_0x2dbbe8[_0x658d('0x31')],_0x2685bf[_0x658d('0x33')]));if(_0x2dbbe8[_0x658d('0x31')][_0x658d('0x3d')]){_0x5c8167[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x5c8167['where'],{'$or':_[_0x658d('0x2b')](_0x5c8167['attributes'],function(_0x544e39){var _0x1562fc={};_0x1562fc[_0x544e39]={'$like':'%'+_0x2dbbe8['query'][_0x658d('0x3d')]+'%'};return _0x1562fc;})});}_0x5c8167=_['merge']({},_0x5c8167,_0x2dbbe8['options']);return _0x2716bd[_0x658d('0x60')](_0x5c8167);}})[_0x658d('0x23')](function(_0x418185){if(_0x418185){_0x393c73=_0x418185[_0x658d('0x45')];if(!_0x2dbbe8[_0x658d('0x31')][_0x658d('0x37')](_0x658d('0x38'))){_0x5c8167['limit']=qs[_0x658d('0x1c')](_0x2dbbe8[_0x658d('0x31')][_0x658d('0x1c')]);_0x5c8167[_0x658d('0x1b')]=qs[_0x658d('0x1b')](_0x2dbbe8['query'][_0x658d('0x1b')]);}return _0x2716bd[_0x658d('0x60')](_0x5c8167);}})[_0x658d('0x23')](function(_0x2c910d){if(_0x2c910d){return _0x2c910d?{'count':_0x393c73,'rows':_0x2c910d}:null;}})[_0x658d('0x23')](respondWithResult(_0x2c6b70,null))['catch'](handleError(_0x2c6b70,null));};exports[_0x658d('0x62')]=function(_0x1f3304,_0xa7b32d,_0x61336f){var _0x432566,_0x55918c;var _0x351fcf=[];var _0x3b8a52=moment()[_0x658d('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x658d('0x2c')][_0x658d('0x4d')]({'where':{'id':_0x1f3304[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0xa7b32d,null))['then'](function(_0x1925df){if(_0x1925df){_0x55918c=_0x1925df;return _0x1925df[_0x658d('0x62')](_0x1f3304[_0x658d('0x54')][_0x658d('0x64')],_['omit'](_0x1f3304[_0x658d('0x54')],['ids','id'])||{});}return null;})[_0x658d('0x65')](function(_0x2e439c){var _0x4f12ab;var _0x65bbc7;_0x432566=_0x2e439c||[];var _0x725cf8=[];if(_0x2e439c){for(var _0x249e69=0x0;_0x249e69<_0x2e439c[_0x658d('0x45')];_0x249e69+=0x1){var _0x3b6ac9=_0x2e439c[_0x249e69][_0x658d('0x25')]({'plain':!![]});_0x55918c[_0x658d('0x66')]=_0x1f3304[_0x658d('0x54')][_0x658d('0x66')]?_0x1f3304[_0x658d('0x54')]['dialCheckDuplicateType']:_0x55918c[_0x658d('0x66')];switch(_0x55918c[_0x658d('0x66')]){case _0x658d('0x67'):_0x4f12ab=squel[_0x658d('0x68')]()[_0x658d('0x69')](_0x658d('0x6a'))['fromQuery'](['phone',_0x658d('0x6b'),_0x658d('0x6c'),_0x658d('0x6d'),_0x658d('0x5a'),_0x658d('0x52'),_0x658d('0x53')],squel[_0x658d('0x6e')]()[_0x658d('0x6f')](_0x658d('0x70'),'phone')[_0x658d('0x6f')](_0x658d('0x71'),_0x658d('0x6b'))[_0x658d('0x6f')]('id','ContactId')[_0x658d('0x6f')](_0x3b6ac9[_0x658d('0x72')][_0x658d('0x73')](),'ListId')[_0x658d('0x6f')](_0x1f3304['params']['id']['toString'](),_0x658d('0x5a'))[_0x658d('0x6f')]('\x27'+_0x3b8a52+'\x27',_0x658d('0x52'))[_0x658d('0x6f')]('\x27'+_0x3b8a52+'\x27','updatedAt')[_0x658d('0x74')]('cm_contacts')[_0x658d('0x3b')](_0x658d('0x75'))['where']('ListId\x20=\x20?',_0x3b6ac9['CmListId'][_0x658d('0x73')]())['where'](_0x658d('0x76'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x658d('0x6e')]()[_0x658d('0x6f')]('COALESCE(calleridnum,\x27\x27)')[_0x658d('0x74')]('cm_hopper_final')[_0x658d('0x3b')](_0x658d('0x77'),_0x1f3304[_0x658d('0x51')]['id'][_0x658d('0x73')]()))['where'](_0x658d('0x78'),squel[_0x658d('0x6e')]()[_0x658d('0x6f')](_0x658d('0x79'))[_0x658d('0x74')](_0x658d('0x6a'))[_0x658d('0x3b')](_0x658d('0x77'),_0x1f3304[_0x658d('0x51')]['id']['toString']())))[_0x658d('0x73')]();break;case _0x658d('0x7a'):_0x4f12ab=squel[_0x658d('0x68')]()[_0x658d('0x69')](_0x658d('0x6a'))['fromQuery']([_0x658d('0x70'),_0x658d('0x6b'),_0x658d('0x6c'),_0x658d('0x6d'),_0x658d('0x5a'),_0x658d('0x52'),_0x658d('0x53')],squel[_0x658d('0x6e')]()['field']('phone','phone')[_0x658d('0x6f')]('NOW()',_0x658d('0x6b'))['field']('id',_0x658d('0x6c'))[_0x658d('0x6f')](_0x3b6ac9[_0x658d('0x72')][_0x658d('0x73')](),_0x658d('0x6d'))[_0x658d('0x6f')](_0x1f3304[_0x658d('0x51')]['id'][_0x658d('0x73')](),'CampaignId')[_0x658d('0x6f')]('\x27'+_0x3b8a52+'\x27',_0x658d('0x52'))['field']('\x27'+_0x3b8a52+'\x27',_0x658d('0x53'))[_0x658d('0x74')](_0x658d('0x7b'))[_0x658d('0x3b')](_0x658d('0x75'))['where'](_0x658d('0x7c'),_0x3b6ac9[_0x658d('0x72')][_0x658d('0x73')]())[_0x658d('0x3b')](_0x658d('0x76'))[_0x658d('0x3b')](_0x658d('0x78'),squel[_0x658d('0x6e')]()[_0x658d('0x6f')](_0x658d('0x79'))[_0x658d('0x74')](_0x658d('0x6a'))[_0x658d('0x3b')]('CampaignId\x20=\x20?',_0x1f3304['params']['id'][_0x658d('0x73')]())))[_0x658d('0x73')]();break;default:_0x4f12ab=squel[_0x658d('0x68')]()[_0x658d('0x69')](_0x658d('0x6a'))[_0x658d('0x7d')](['phone',_0x658d('0x6b'),'ContactId',_0x658d('0x6d'),_0x658d('0x5a'),_0x658d('0x52'),'updatedAt'],squel['select']()[_0x658d('0x6f')](_0x658d('0x70'),_0x658d('0x70'))[_0x658d('0x6f')](_0x658d('0x71'),_0x658d('0x6b'))[_0x658d('0x6f')]('id','ContactId')[_0x658d('0x6f')](_0x3b6ac9[_0x658d('0x72')]['toString'](),'ListId')[_0x658d('0x6f')](_0x1f3304['params']['id'][_0x658d('0x73')](),_0x658d('0x5a'))[_0x658d('0x6f')]('\x27'+_0x3b8a52+'\x27','createdAt')[_0x658d('0x6f')]('\x27'+_0x3b8a52+'\x27',_0x658d('0x53'))[_0x658d('0x74')]('cm_contacts')['where'](_0x658d('0x75'))[_0x658d('0x3b')]('ListId\x20=\x20?',_0x3b6ac9[_0x658d('0x72')]['toString']())['where'](_0x658d('0x76')))[_0x658d('0x73')]();}_0x65bbc7=squel[_0x658d('0x68')]()[_0x658d('0x69')](_0x658d('0x7e'))[_0x658d('0x7d')]([_0x658d('0x7f'),_0x658d('0x6b'),_0x658d('0x70'),'OrderBy','createdAt',_0x658d('0x53')],squel[_0x658d('0x6e')]()[_0x658d('0x6f')](_0x658d('0x80'),'id')[_0x658d('0x6f')](_0x658d('0x71'),'scheduledAt')[_0x658d('0x6f')](_0x658d('0x81'),_0x658d('0x70'))[_0x658d('0x6f')](_0x658d('0x82'),'OrderBy')['field']('\x27'+_0x3b8a52+'\x27',_0x658d('0x52'))['field']('\x27'+_0x3b8a52+'\x27',_0x658d('0x53'))[_0x658d('0x74')](_0x658d('0x83'),'ci')[_0x658d('0x84')]('cm_hopper','h',_0x658d('0x85'))[_0x658d('0x3b')](_0x658d('0x86'),_0x3b6ac9[_0x658d('0x72')][_0x658d('0x73')]())['where']('h.CampaignId=?',_0x1f3304[_0x658d('0x51')]['id'][_0x658d('0x73')]())[_0x658d('0x3b')](_0x658d('0x87'),_0x3b8a52))[_0x658d('0x73')]();_0x725cf8[_0x658d('0x88')](db[_0x658d('0x89')][_0x658d('0x31')](_0x4f12ab));_0x351fcf[_0x658d('0x88')](db['sequelize']['query'](_0x65bbc7));}return BPromise[_0x658d('0x8a')](_0x725cf8);}})[_0x658d('0x23')](function(){return BPromise[_0x658d('0x8a')](_0x351fcf);})[_0x658d('0x23')](function(){return _0x432566;})['then'](respondWithResult(_0xa7b32d,null))[_0x658d('0x47')](handleError(_0xa7b32d,null));};exports['removeLists']=function(_0x12e939,_0x201aad,_0x13e792){return db[_0x658d('0x2c')][_0x658d('0x4d')]({'where':{'id':_0x12e939[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x201aad,null))[_0x658d('0x23')](function(_0x173f8b){if(_0x173f8b){return _0x173f8b[_0x658d('0x8b')](_0x12e939['query'][_0x658d('0x64')]);}})[_0x658d('0x23')](function(_0x33abe9){if(_0x33abe9){return db[_0x658d('0x58')][_0x658d('0x24')]({'where':{'ListId':_0x12e939[_0x658d('0x31')]['ids'],'CampaignId':_0x12e939[_0x658d('0x51')]['id']}})[_0x658d('0x23')](function(){return _0x33abe9;});}})[_0x658d('0x23')](respondWithStatusCode(_0x201aad,null))[_0x658d('0x47')](handleError(_0x201aad,null));};exports[_0x658d('0x8c')]=function(_0x243fb3,_0x42c8c0,_0x3fa4b4){var _0x1f5d51={};var _0x4d7697={};var _0x4a20cf;var _0x1da0d6;return db['Campaign']['findOne']({'where':{'id':_0x243fb3[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x42c8c0,null))[_0x658d('0x23')](function(_0x35a6e1){if(_0x35a6e1){_0x4a20cf=_0x35a6e1;_0x4d7697[_0x658d('0x30')]=_[_0x658d('0x32')](db['CmList']['rawAttributes']);_0x4d7697['query']=_[_0x658d('0x32')](_0x243fb3['query']);_0x4d7697['filters']=_['intersection'](_0x4d7697['model'],_0x4d7697[_0x658d('0x31')]);_0x1f5d51['attributes']=_[_0x658d('0x34')](_0x4d7697['model'],qs[_0x658d('0x36')](_0x243fb3[_0x658d('0x31')]['fields']));_0x1f5d51[_0x658d('0x35')]=_0x1f5d51[_0x658d('0x35')][_0x658d('0x45')]?_0x1f5d51['attributes']:_0x4d7697['model'];_0x1f5d51['order']=qs[_0x658d('0x3a')](_0x243fb3[_0x658d('0x31')][_0x658d('0x3a')]);_0x1f5d51[_0x658d('0x3b')]=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0x243fb3[_0x658d('0x31')],_0x4d7697[_0x658d('0x33')]));if(_0x243fb3[_0x658d('0x31')]['filter']){_0x1f5d51[_0x658d('0x3b')]=_['merge'](_0x1f5d51['where'],{'$or':_['map'](_0x1f5d51[_0x658d('0x35')],function(_0xf396d1){var _0x236395={};_0x236395[_0xf396d1]={'$like':'%'+_0x243fb3[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x236395;})});}_0x1f5d51=_['merge']({},_0x1f5d51,_0x243fb3['options']);return _0x4a20cf['getBlackLists'](_0x1f5d51);}})[_0x658d('0x23')](function(_0x4f2b85){if(_0x4f2b85){_0x1da0d6=_0x4f2b85[_0x658d('0x45')];if(!_0x243fb3[_0x658d('0x31')][_0x658d('0x37')]('nolimit')){_0x1f5d51[_0x658d('0x1c')]=qs['limit'](_0x243fb3[_0x658d('0x31')]['limit']);_0x1f5d51[_0x658d('0x1b')]=qs[_0x658d('0x1b')](_0x243fb3[_0x658d('0x31')][_0x658d('0x1b')]);}return _0x4a20cf[_0x658d('0x8c')](_0x1f5d51);}})['then'](function(_0x1c9e14){if(_0x1c9e14){return _0x1c9e14?{'count':_0x1da0d6,'rows':_0x1c9e14}:null;}})[_0x658d('0x23')](respondWithResult(_0x42c8c0,null))[_0x658d('0x47')](handleError(_0x42c8c0,null));};exports[_0x658d('0x8d')]=function(_0x30d5da,_0x2d1a08,_0x54a1b0){var _0xc305a0,_0x41a7c6;var _0x10318a=[];var _0xb52c9a=moment()[_0x658d('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x658d('0x2c')]['find']({'where':{'id':_0x30d5da[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x2d1a08,null))[_0x658d('0x23')](function(_0x413e96){if(_0x413e96){_0x41a7c6=_0x413e96;return _0x413e96[_0x658d('0x8d')](_0x30d5da[_0x658d('0x54')][_0x658d('0x64')],_[_0x658d('0x8e')](_0x30d5da[_0x658d('0x54')],['ids','id'])||{});}return null;})['spread'](function(_0x22b198){var _0x1d8e8d;var _0x5c9606;_0xc305a0=_0x22b198||[];var _0x1941ba=[];if(_0x22b198){for(var _0x3ea974=0x0;_0x3ea974<_0x22b198[_0x658d('0x45')];_0x3ea974+=0x1){var _0x42f234=_0x22b198[_0x3ea974]['get']({'plain':!![]});_0x1d8e8d=squel[_0x658d('0x68')]()[_0x658d('0x69')](_0x658d('0x8f'))[_0x658d('0x7d')]([_0x658d('0x70'),_0x658d('0x6c'),_0x658d('0x6d'),_0x658d('0x5a'),_0x658d('0x52'),_0x658d('0x53')],squel['select']()[_0x658d('0x6f')](_0x658d('0x70'),_0x658d('0x70'))[_0x658d('0x6f')]('id',_0x658d('0x6c'))[_0x658d('0x6f')](_0x42f234[_0x658d('0x72')][_0x658d('0x73')](),_0x658d('0x6d'))[_0x658d('0x6f')](_0x30d5da['params']['id'][_0x658d('0x73')](),_0x658d('0x5a'))[_0x658d('0x6f')]('NOW()',_0x658d('0x52'))[_0x658d('0x6f')](_0x658d('0x71'),'updatedAt')['from'](_0x658d('0x7b'))[_0x658d('0x3b')](_0x658d('0x75'))[_0x658d('0x3b')](_0x658d('0x7c'),_0x42f234[_0x658d('0x72')][_0x658d('0x73')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x1941ba[_0x658d('0x88')](db[_0x658d('0x89')][_0x658d('0x31')](_0x1d8e8d));}return BPromise[_0x658d('0x8a')](_0x1941ba);}})[_0x658d('0x23')](function(){return _0xc305a0;})['then'](respondWithResult(_0x2d1a08,null))['catch'](handleError(_0x2d1a08,null));};exports[_0x658d('0x90')]=function(_0x5029e3,_0xab37a5,_0xf20281){return db['Campaign']['find']({'where':{'id':_0x5029e3['params']['id']}})[_0x658d('0x23')](handleEntityNotFound(_0xab37a5,null))[_0x658d('0x23')](function(_0x49c110){if(_0x49c110){return _0x49c110[_0x658d('0x90')](_0x5029e3['query'][_0x658d('0x64')]);}})[_0x658d('0x23')](function(_0x344af8){if(_0x344af8){return db[_0x658d('0x5f')][_0x658d('0x24')]({'where':{'ListId':_0x5029e3[_0x658d('0x31')][_0x658d('0x64')],'CampaignId':_0x5029e3[_0x658d('0x51')]['id']}})[_0x658d('0x23')](function(){return _0x344af8;});}})[_0x658d('0x23')](respondWithStatusCode(_0xab37a5,null))['catch'](handleError(_0xab37a5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 30cf74a..5b5418f 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_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 +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 ff04aa5..7859276 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 _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 +var _0xbdeb=['then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x5f37fc,_0x3e6e09){var _0x32745d=function(_0x485ca7){while(--_0x485ca7){_0x5f37fc['push'](_0x5f37fc['shift']());}};_0x32745d(++_0x3e6e09);}(_0xbdeb,0x6f));var _0xbbde=function(_0x2fcccd,_0x4a8380){_0x2fcccd=_0x2fcccd-0x0;var _0x2423b4=_0xbdeb[_0x2fcccd];return _0x2423b4;};'use strict';var _=require('lodash');var util=require(_0xbbde('0x0'));var moment=require('moment');var BPromise=require(_0xbbde('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbde('0x2'));var db=require(_0xbbde('0x3'))['db'];var utils=require(_0xbbde('0x4'));var logger=require(_0xbbde('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbbde('0x6'));var client=jayson[_0xbbde('0x7')][_0xbbde('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a8482,_0x5e6273,_0x49966c){return new BPromise(function(_0x3215c9,_0x17df59){return client['request'](_0x1a8482,_0x49966c)[_0xbbde('0x9')](function(_0xec50fa){logger[_0xbbde('0xa')](_0xbbde('0xb'),_0x5e6273,_0xbbde('0xc'));logger[_0xbbde('0xd')](_0xbbde('0xe'),_0x5e6273,_0xbbde('0xc'),JSON[_0xbbde('0xf')](_0xec50fa));if(_0xec50fa[_0xbbde('0x10')]){if(_0xec50fa['error']['code']===0x1f4){logger[_0xbbde('0x10')]('Campaign,\x20%s,\x20%s',_0x5e6273,_0xec50fa[_0xbbde('0x10')]['message']);return _0x17df59(_0xec50fa[_0xbbde('0x10')][_0xbbde('0x11')]);}logger[_0xbbde('0x10')](_0xbbde('0xb'),_0x5e6273,_0xec50fa[_0xbbde('0x10')][_0xbbde('0x11')]);return _0x3215c9(_0xec50fa[_0xbbde('0x10')]['message']);}else{logger[_0xbbde('0xa')](_0xbbde('0xb'),_0x5e6273,'request\x20sent');_0x3215c9(_0xec50fa['result'][_0xbbde('0x11')]);}})['catch'](function(_0x88e8a5){logger['error'](_0xbbde('0xb'),_0x5e6273,_0x88e8a5);_0x17df59(_0x88e8a5);});});}exports[_0xbbde('0x12')]=function(_0x593e58){var _0x2073d1=this;return new Promise(function(_0x1bc7eb,_0xeb6b63){return db[_0xbbde('0x13')][_0xbbde('0x14')]({'raw':_0x593e58[_0xbbde('0x15')]?_0x593e58['options'][_0xbbde('0x16')]===undefined?!![]:![]:!![],'where':_0x593e58[_0xbbde('0x15')]?_0x593e58[_0xbbde('0x15')][_0xbbde('0x17')]||null:null,'attributes':_0x593e58[_0xbbde('0x15')]?_0x593e58['options'][_0xbbde('0x18')]||null:null,'limit':_0x593e58[_0xbbde('0x15')]?_0x593e58[_0xbbde('0x15')][_0xbbde('0x19')]||null:null,'include':_0x593e58[_0xbbde('0x15')]?_0x593e58[_0xbbde('0x15')][_0xbbde('0x1a')]?_[_0xbbde('0x1b')](_0x593e58[_0xbbde('0x15')][_0xbbde('0x1a')],function(_0x4ac50b){return{'model':db[_0x4ac50b[_0xbbde('0x1c')]],'as':_0x4ac50b['as'],'attributes':_0x4ac50b[_0xbbde('0x18')],'include':_0x4ac50b[_0xbbde('0x1a')]?_['map'](_0x4ac50b[_0xbbde('0x1a')],function(_0x34c327){return{'model':db[_0x34c327[_0xbbde('0x1c')]],'as':_0x34c327['as'],'attributes':_0x34c327[_0xbbde('0x18')],'include':_0x34c327[_0xbbde('0x1a')]?_['map'](_0x34c327[_0xbbde('0x1a')],function(_0x14243a){return{'model':db[_0x14243a['model']],'as':_0x14243a['as'],'attributes':_0x14243a[_0xbbde('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbbde('0x9')](function(_0x2854d7){logger[_0xbbde('0xa')](_0xbbde('0x12'),_0x593e58);logger['debug']('GetCampaign',_0x593e58,JSON[_0xbbde('0xf')](_0x2854d7));_0x1bc7eb(_0x2854d7);})[_0xbbde('0x1d')](function(_0x5ac8a2){logger[_0xbbde('0x10')](_0xbbde('0x12'),_0x5ac8a2[_0xbbde('0x11')],_0x593e58);_0xeb6b63(_0x2073d1[_0xbbde('0x10')](0x1f4,_0x5ac8a2[_0xbbde('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 467ad46..fd7960f 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 _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 +var _0x4444=['put','delete','removeBlackLists','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./campaign.controller','index','get','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists'];(function(_0x3023b8,_0x11daa4){var _0x51bbc2=function(_0x1e92a4){while(--_0x1e92a4){_0x3023b8['push'](_0x3023b8['shift']());}};_0x51bbc2(++_0x11daa4);}(_0x4444,0xa3));var _0x4444=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x4444[_0x40dd56];return _0x4f850f;};'use strict';var multer=require(_0x4444('0x0'));var util=require(_0x4444('0x1'));var path=require('path');var timeout=require(_0x4444('0x2'));var express=require(_0x4444('0x3'));var router=express[_0x4444('0x4')]();var fs_extra=require(_0x4444('0x5'));var auth=require(_0x4444('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4444('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4444('0x8')]);router[_0x4444('0x9')](_0x4444('0xa'),auth[_0x4444('0xb')](),controller[_0x4444('0xc')]);router[_0x4444('0x9')]('/:id/hoppers',auth[_0x4444('0xb')](),controller[_0x4444('0xd')]);router[_0x4444('0x9')](_0x4444('0xe'),auth[_0x4444('0xb')](),controller[_0x4444('0xf')]);router[_0x4444('0x9')](_0x4444('0x10'),auth[_0x4444('0xb')](),controller[_0x4444('0x11')]);router[_0x4444('0x9')](_0x4444('0x12'),auth['isAuthenticated'](),controller[_0x4444('0x13')]);router['get'](_0x4444('0x14'),auth[_0x4444('0xb')](),controller[_0x4444('0x15')]);router[_0x4444('0x9')]('/:id/blacklists',auth[_0x4444('0xb')](),controller[_0x4444('0x16')]);router[_0x4444('0x17')]('/',auth[_0x4444('0xb')](),controller[_0x4444('0x18')]);router[_0x4444('0x17')](_0x4444('0x19'),auth[_0x4444('0xb')](),controller[_0x4444('0x1a')]);router[_0x4444('0x17')](_0x4444('0x14'),auth['isAuthenticated'](),controller[_0x4444('0x1b')]);router[_0x4444('0x17')]('/:id/blacklists',auth[_0x4444('0xb')](),controller[_0x4444('0x1c')]);router[_0x4444('0x1d')](_0x4444('0xa'),auth[_0x4444('0xb')](),controller['update']);router[_0x4444('0x1e')]('/:id',auth[_0x4444('0xb')](),controller['destroy']);router[_0x4444('0x1e')](_0x4444('0x14'),auth[_0x4444('0xb')](),controller['removeLists']);router[_0x4444('0x1e')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x4444('0x1f')]);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 981922f..239d9a5 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 _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 +var _0x9596=['sequelize','STRING','TEXT','medium','VIRTUAL'];(function(_0x477730,_0x57edc6){var _0x2399a6=function(_0x215be4){while(--_0x215be4){_0x477730['push'](_0x477730['shift']());}};_0x2399a6(++_0x57edc6);}(_0x9596,0xc3));var _0x6959=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0x9596[_0x5f382f];return _0x3bb11b;};'use strict';var Sequelize=require(_0x6959('0x0'));module['exports']={'key':{'type':Sequelize[_0x6959('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x6959('0x2')],'length':_0x6959('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6959('0x1')]},'name':{'type':Sequelize[_0x6959('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1a22fdd..9bab4e4 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 _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 +var _0x5cf3=['name','send','index','CannedAnswer','rawAttributes','type','model','keys','filters','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error'];(function(_0x4025c6,_0x5f0390){var _0x5558de=function(_0x2f85cb){while(--_0x2f85cb){_0x4025c6['push'](_0x4025c6['shift']());}};_0x5558de(++_0x5f0390);}(_0x5cf3,0x131));var _0x35cf=function(_0x4b55cb,_0x49791b){_0x4b55cb=_0x4b55cb-0x0;var _0x2631df=_0x5cf3[_0x4b55cb];return _0x2631df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35cf('0x0'));var zipdir=require(_0x35cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35cf('0x2'));var moment=require(_0x35cf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x35cf('0x4'));var util=require(_0x35cf('0x5'));var path=require(_0x35cf('0x6'));var sox=require(_0x35cf('0x7'));var csv=require(_0x35cf('0x8'));var ejs=require(_0x35cf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35cf('0xa'));var squel=require(_0x35cf('0xb'));var crypto=require(_0x35cf('0xc'));var jsforce=require(_0x35cf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x35cf('0xe'));var Papa=require(_0x35cf('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x35cf('0x10'));var as=require(_0x35cf('0x11'));var hardwareService=require(_0x35cf('0x12'));var logger=require(_0x35cf('0x13'))(_0x35cf('0x14'));var utils=require(_0x35cf('0x15'));var config=require(_0x35cf('0x16'));var licenseUtil=require(_0x35cf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527695,_0x195282){_0x195282=_0x195282||0xcc;return function(_0x1d2ef0){if(_0x1d2ef0){return _0x527695[_0x35cf('0x18')](_0x195282);}return _0x527695[_0x35cf('0x19')](_0x195282)[_0x35cf('0x1a')]();};}function respondWithResult(_0x5f53c1,_0x4e054f){_0x4e054f=_0x4e054f||0xc8;return function(_0x1f984e){if(_0x1f984e){return _0x5f53c1[_0x35cf('0x19')](_0x4e054f)[_0x35cf('0x1b')](_0x1f984e);}};}function respondWithFilteredResult(_0x32d90f,_0x602d2d){return function(_0x5efab8){if(_0x5efab8){var _0x2a853c=typeof _0x602d2d[_0x35cf('0x1c')]==='undefined'&&typeof _0x602d2d['limit']==='undefined';var _0x50c02a=_0x5efab8[_0x35cf('0x1d')];var _0x1961c6=_0x2a853c?0x0:_0x602d2d[_0x35cf('0x1c')];var _0x12c11d=_0x2a853c?_0x5efab8['count']:_0x602d2d[_0x35cf('0x1c')]+_0x602d2d[_0x35cf('0x1e')];var _0x32755c;if(_0x12c11d>=_0x50c02a){_0x12c11d=_0x50c02a;_0x32755c=0xc8;}else{_0x32755c=0xce;}_0x32d90f['status'](_0x32755c);return _0x32d90f[_0x35cf('0x1f')](_0x35cf('0x20'),_0x1961c6+'-'+_0x12c11d+'/'+_0x50c02a)[_0x35cf('0x1b')](_0x5efab8);}return null;};}function patchUpdates(_0x354a8c){return function(_0x2a99b3){try{jsonpatch[_0x35cf('0x21')](_0x2a99b3,_0x354a8c,!![]);}catch(_0x1487a8){return BPromise[_0x35cf('0x22')](_0x1487a8);}return _0x2a99b3[_0x35cf('0x23')]();};}function saveUpdates(_0x451386,_0x442bdd){return function(_0x1b608c){if(_0x1b608c){return _0x1b608c[_0x35cf('0x24')](_0x451386)[_0x35cf('0x25')](function(_0x3b9f6d){return _0x3b9f6d;});}return null;};}function removeEntity(_0x503db3,_0x3e1683){return function(_0x5e45f9){if(_0x5e45f9){return _0x5e45f9[_0x35cf('0x26')]()[_0x35cf('0x25')](function(){var _0x3dc4d6=_0x5e45f9[_0x35cf('0x27')]({'plain':!![]});var _0x26490c=_0x35cf('0x28');return db[_0x35cf('0x29')]['destroy']({'where':{'type':_0x26490c,'resourceId':_0x3dc4d6['id']}})['then'](function(){return _0x5e45f9;});})[_0x35cf('0x25')](function(){_0x503db3[_0x35cf('0x19')](0xcc)[_0x35cf('0x1a')]();});}};}function handleEntityNotFound(_0x5e0fa1,_0x3c635b){return function(_0x126d53){if(!_0x126d53){_0x5e0fa1[_0x35cf('0x18')](0x194);}return _0x126d53;};}function handleError(_0x18cfd3,_0x346b35){_0x346b35=_0x346b35||0x1f4;return function(_0x18f006){logger[_0x35cf('0x2a')](_0x18f006['stack']);if(_0x18f006[_0x35cf('0x2b')]){delete _0x18f006[_0x35cf('0x2b')];}_0x18cfd3[_0x35cf('0x19')](_0x346b35)[_0x35cf('0x2c')](_0x18f006);};}exports[_0x35cf('0x2d')]=function(_0x249296,_0x499012){var _0x47f0f2={},_0x566624={},_0x1a7ead={'count':0x0,'rows':[]};var _0xadf2f8=_['map'](db[_0x35cf('0x2e')][_0x35cf('0x2f')],function(_0x5c72fa){return{'name':_0x5c72fa['fieldName'],'type':_0x5c72fa[_0x35cf('0x30')]['key']};});_0x566624[_0x35cf('0x31')]=_['map'](_0xadf2f8,_0x35cf('0x2b'));_0x566624['query']=_[_0x35cf('0x32')](_0x249296['query']);_0x566624[_0x35cf('0x33')]=_['intersection'](_0x566624[_0x35cf('0x31')],_0x566624[_0x35cf('0x34')]);_0x47f0f2['attributes']=_[_0x35cf('0x35')](_0x566624[_0x35cf('0x31')],qs[_0x35cf('0x36')](_0x249296[_0x35cf('0x34')][_0x35cf('0x36')]));_0x47f0f2[_0x35cf('0x37')]=_0x47f0f2[_0x35cf('0x37')][_0x35cf('0x38')]?_0x47f0f2[_0x35cf('0x37')]:_0x566624[_0x35cf('0x31')];if(!_0x249296[_0x35cf('0x34')]['hasOwnProperty'](_0x35cf('0x39'))){_0x47f0f2[_0x35cf('0x1e')]=qs[_0x35cf('0x1e')](_0x249296[_0x35cf('0x34')]['limit']);_0x47f0f2['offset']=qs[_0x35cf('0x1c')](_0x249296['query'][_0x35cf('0x1c')]);}_0x47f0f2[_0x35cf('0x3a')]=qs[_0x35cf('0x3b')](_0x249296[_0x35cf('0x34')][_0x35cf('0x3b')]);_0x47f0f2[_0x35cf('0x3c')]=qs[_0x35cf('0x33')](_[_0x35cf('0x3d')](_0x249296['query'],_0x566624[_0x35cf('0x33')]),_0xadf2f8);if(_0x249296[_0x35cf('0x34')][_0x35cf('0x3e')]){_0x47f0f2[_0x35cf('0x3c')]=_[_0x35cf('0x3f')](_0x47f0f2[_0x35cf('0x3c')],{'$or':[{'key':{'$like':'%'+_0x249296[_0x35cf('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x249296[_0x35cf('0x34')][_0x35cf('0x3e')]+'%'}}]});}_0x47f0f2=_[_0x35cf('0x3f')]({},_0x47f0f2,_0x249296[_0x35cf('0x40')]);var _0x5c9e46={'where':_0x47f0f2['where']};return db['CannedAnswer']['count'](_0x5c9e46)[_0x35cf('0x25')](function(_0xdd747f){_0x1a7ead['count']=_0xdd747f;if(_0x249296[_0x35cf('0x34')]['includeAll']){_0x47f0f2[_0x35cf('0x41')]=[{'all':!![]}];}return db[_0x35cf('0x2e')]['findAll'](_0x47f0f2);})[_0x35cf('0x25')](function(_0x5c908c){_0x1a7ead[_0x35cf('0x42')]=_0x5c908c;return _0x1a7ead;})[_0x35cf('0x25')](respondWithFilteredResult(_0x499012,_0x47f0f2))[_0x35cf('0x43')](handleError(_0x499012,null));};exports[_0x35cf('0x44')]=function(_0x42346c,_0x5c3953){var _0x231fc5={'raw':!![],'where':{'id':_0x42346c[_0x35cf('0x45')]['id']}},_0x2aeb7a={};_0x2aeb7a[_0x35cf('0x31')]=_[_0x35cf('0x32')](db[_0x35cf('0x2e')][_0x35cf('0x2f')]);_0x2aeb7a[_0x35cf('0x34')]=_[_0x35cf('0x32')](_0x42346c['query']);_0x2aeb7a[_0x35cf('0x33')]=_[_0x35cf('0x35')](_0x2aeb7a[_0x35cf('0x31')],_0x2aeb7a[_0x35cf('0x34')]);_0x231fc5[_0x35cf('0x37')]=_[_0x35cf('0x35')](_0x2aeb7a[_0x35cf('0x31')],qs[_0x35cf('0x36')](_0x42346c[_0x35cf('0x34')]['fields']));_0x231fc5[_0x35cf('0x37')]=_0x231fc5[_0x35cf('0x37')]['length']?_0x231fc5['attributes']:_0x2aeb7a[_0x35cf('0x31')];if(_0x42346c[_0x35cf('0x34')][_0x35cf('0x46')]){_0x231fc5[_0x35cf('0x41')]=[{'all':!![]}];}_0x231fc5=_[_0x35cf('0x3f')]({},_0x231fc5,_0x42346c[_0x35cf('0x40')]);return db[_0x35cf('0x2e')][_0x35cf('0x47')](_0x231fc5)['then'](handleEntityNotFound(_0x5c3953,null))[_0x35cf('0x25')](respondWithResult(_0x5c3953,null))['catch'](handleError(_0x5c3953,null));};exports[_0x35cf('0x24')]=function(_0x59c23a,_0x564ca5){if(_0x59c23a[_0x35cf('0x48')]['id']){delete _0x59c23a[_0x35cf('0x48')]['id'];}return db[_0x35cf('0x2e')][_0x35cf('0x47')]({'where':{'id':_0x59c23a[_0x35cf('0x45')]['id']}})[_0x35cf('0x25')](handleEntityNotFound(_0x564ca5,null))[_0x35cf('0x25')](saveUpdates(_0x59c23a[_0x35cf('0x48')],null))[_0x35cf('0x25')](respondWithResult(_0x564ca5,null))[_0x35cf('0x43')](handleError(_0x564ca5,null));};exports[_0x35cf('0x26')]=function(_0x4675a8,_0x554be2){return db[_0x35cf('0x2e')][_0x35cf('0x47')]({'where':{'id':_0x4675a8[_0x35cf('0x45')]['id']}})[_0x35cf('0x25')](handleEntityNotFound(_0x554be2,null))[_0x35cf('0x25')](removeEntity(_0x554be2,null))[_0x35cf('0x43')](handleError(_0x554be2,null));};exports[_0x35cf('0x49')]=function(_0x1f8179,_0x518c91){var _0x5e0248={'key':_0x1f8179[_0x35cf('0x48')][_0x35cf('0x4a')]};if(_0x1f8179[_0x35cf('0x48')][_0x35cf('0x4b')]){_0x5e0248['MailAccountId']=_0x1f8179[_0x35cf('0x48')][_0x35cf('0x4b')];}else if(_0x1f8179['body'][_0x35cf('0x4c')]){_0x5e0248['SmsAccountId']=_0x1f8179['body'][_0x35cf('0x4c')];}else if(_0x1f8179[_0x35cf('0x48')]['OpenchannelAccountId']){_0x5e0248[_0x35cf('0x4d')]=_0x1f8179['body'][_0x35cf('0x4d')];}else if(_0x1f8179[_0x35cf('0x48')]['ChatWebsiteId']){_0x5e0248['ChatWebsiteId']=_0x1f8179['body'][_0x35cf('0x4e')];}return db[_0x35cf('0x2e')][_0x35cf('0x47')]({'where':_0x5e0248})[_0x35cf('0x25')](function(_0x3985c5){if(_0x3985c5){throw new db[(_0x35cf('0x4f'))][(_0x35cf('0x50'))](_0x35cf('0x51'));}return db[_0x35cf('0x2e')][_0x35cf('0x49')](_0x1f8179[_0x35cf('0x48')]);})[_0x35cf('0x25')](function(_0x562e51){var _0x2be6a0=_0x1f8179[_0x35cf('0x52')][_0x35cf('0x27')]({'plain':!![]});if(!_0x2be6a0)throw new Error(_0x35cf('0x53'));if(_0x2be6a0[_0x35cf('0x54')]===_0x35cf('0x52')){var _0x4e9419=_0x562e51[_0x35cf('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x35cf('0x47')]({'where':{'name':_0x35cf('0x28'),'userProfileId':_0x2be6a0[_0x35cf('0x55')]},'raw':!![]})['then'](function(_0x2a92d0){if(_0x2a92d0&&_0x2a92d0[_0x35cf('0x56')]===0x0){return db[_0x35cf('0x29')][_0x35cf('0x49')]({'name':_0x4e9419['name'],'resourceId':_0x4e9419['id'],'type':_0x2a92d0['name'],'sectionId':_0x2a92d0['id']},{})[_0x35cf('0x25')](function(){return _0x562e51;});}else{return _0x562e51;}})[_0x35cf('0x43')](function(_0x2f36ca){logger[_0x35cf('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f36ca);throw _0x2f36ca;});}return _0x562e51;})[_0x35cf('0x25')](respondWithResult(_0x518c91,0xc9))['catch'](handleError(_0x518c91,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a1c5840..f402303 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 _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 +var _0x2bdf=['path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','api','request-promise'];(function(_0x5d084e,_0x16fe70){var _0x32fb37=function(_0x1da934){while(--_0x1da934){_0x5d084e['push'](_0x5d084e['shift']());}};_0x32fb37(++_0x16fe70);}(_0x2bdf,0xbd));var _0xf2bd=function(_0x3df1d2,_0x5e118e){_0x3df1d2=_0x3df1d2-0x0;var _0x33d99c=_0x2bdf[_0x3df1d2];return _0x33d99c;};'use strict';var _=require('lodash');var util=require(_0xf2bd('0x0'));var logger=require('../../config/logger')(_0xf2bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf2bd('0x2'));var fs=require('fs');var path=require(_0xf2bd('0x3'));var rimraf=require('rimraf');var config=require(_0xf2bd('0x4'));var attributes=require(_0xf2bd('0x5'));module[_0xf2bd('0x6')]=function(_0x55b3dd,_0x3fd9f0){return _0x55b3dd[_0xf2bd('0x7')](_0xf2bd('0x8'),attributes,{'tableName':_0xf2bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2bd('0xa'),'collate':_0xf2bd('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index adc954b..ce8cb21 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(_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 +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(_0x17c76f,_0x1f3f24){var _0x351090=function(_0x1191ec){while(--_0x1191ec){_0x17c76f['push'](_0x17c76f['shift']());}};_0x351090(++_0x1f3f24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 cd9f97a..b3a9249 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 _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 +var _0x4955=['./cannedAnswer.controller','get','index','isAuthenticated','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4955,0x70));var _0x5495=function(_0x5b0328,_0x267672){_0x5b0328=_0x5b0328-0x0;var _0x325210=_0x4955[_0x5b0328];return _0x325210;};'use strict';var multer=require(_0x5495('0x0'));var util=require(_0x5495('0x1'));var path=require(_0x5495('0x2'));var timeout=require(_0x5495('0x3'));var express=require(_0x5495('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5495('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5495('0x6'));var controller=require(_0x5495('0x7'));router[_0x5495('0x8')]('/',auth['isAuthenticated'](),controller[_0x5495('0x9')]);router[_0x5495('0x8')]('/:id',auth[_0x5495('0xa')](),controller['show']);router[_0x5495('0xb')]('/',auth[_0x5495('0xa')](),controller[_0x5495('0xc')]);router[_0x5495('0xd')](_0x5495('0xe'),auth[_0x5495('0xa')](),controller['update']);router['delete']('/:id',auth[_0x5495('0xa')](),controller[_0x5495('0xf')]);module[_0x5495('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index c22f2b6..cb77553 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 _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 +var _0x24b3=['INTEGER','sequelize','exports','DATE','STRING'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x24b3,0xd3));var _0x324b=function(_0x3477bb,_0xe6ddaa){_0x3477bb=_0x3477bb-0x0;var _0x549bc2=_0x24b3[_0x3477bb];return _0x549bc2;};'use strict';var Sequelize=require(_0x324b('0x0'));module[_0x324b('0x1')]={'calldate':{'type':Sequelize[_0x324b('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x324b('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x324b('0x3')]},'dstchannel':{'type':Sequelize[_0x324b('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x324b('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x324b('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x324b('0x3')]},'userfield':{'type':Sequelize[_0x324b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x324b('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x324b('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index bdd7620..0a820c6 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 _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 +var _0x1db9=['merge','VIRTUAL','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x1db9,0x176));var _0x91db=function(_0x51cffd,_0x4377a0){_0x51cffd=_0x51cffd-0x0;var _0x433a56=_0x1db9[_0x51cffd];return _0x433a56;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=typeof _0x33b39d[_0x91db('0x19')]===_0x91db('0x1a')&&typeof _0x33b39d[_0x91db('0x1b')]===_0x91db('0x1a');var _0x5f5440=_0x260b56[_0x91db('0x1c')];var _0x23d125=_0x143bc4?0x0:_0x33b39d[_0x91db('0x19')];var _0x42e66c=_0x143bc4?_0x260b56[_0x91db('0x1c')]:_0x33b39d[_0x91db('0x19')]+_0x33b39d['limit'];var _0x4ae820;if(_0x42e66c>=_0x5f5440){_0x42e66c=_0x5f5440;_0x4ae820=0xc8;}else{_0x4ae820=0xce;}_0x2df307[_0x91db('0x16')](_0x4ae820);return _0x2df307[_0x91db('0x1d')](_0x91db('0x1e'),_0x23d125+'-'+_0x42e66c+'/'+_0x5f5440)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x50cf9c){return function(_0x168dea){try{jsonpatch[_0x91db('0x1f')](_0x168dea,_0x50cf9c,!![]);}catch(_0x6e3ca6){return BPromise[_0x91db('0x20')](_0x6e3ca6);}return _0x168dea[_0x91db('0x21')]();};}function saveUpdates(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x22')](_0x31b96c)[_0x91db('0x23')](function(_0x554454){return _0x554454;});}return null;};}function removeEntity(_0x58774f,_0x134caa){return function(_0x2ac8d5){if(_0x2ac8d5){return _0x2ac8d5['destroy']()[_0x91db('0x23')](function(){_0x58774f[_0x91db('0x16')](0xcc)[_0x91db('0x17')]();});}};}function handleEntityNotFound(_0x6e3a9c,_0x3729d3){return function(_0x4e2a8f){if(!_0x4e2a8f){_0x6e3a9c['sendStatus'](0x194);}return _0x4e2a8f;};}function handleError(_0x42e53f,_0x2f0b86){_0x2f0b86=_0x2f0b86||0x1f4;return function(_0x329118){logger['error'](_0x329118[_0x91db('0x24')]);if(_0x329118[_0x91db('0x25')]){delete _0x329118[_0x91db('0x25')];}_0x42e53f[_0x91db('0x16')](_0x2f0b86)['send'](_0x329118);};}exports[_0x91db('0x26')]=function(_0x2a00d1,_0x1805ef){var _0x49c504={},_0x2ff6c8={},_0x69fdc2={'count':0x0,'rows':[]};var _0x2d3ebd=_[_0x91db('0x27')](db[_0x91db('0x28')][_0x91db('0x29')],function(_0x2e6a27){return{'name':_0x2e6a27[_0x91db('0x2a')],'type':_0x2e6a27[_0x91db('0x2b')][_0x91db('0x2c')]};});_0x2ff6c8[_0x91db('0x2d')]=_[_0x91db('0x27')](_0x2d3ebd,_0x91db('0x25'));_0x2ff6c8[_0x91db('0x2e')]=_['keys'](_0x2a00d1[_0x91db('0x2e')]);_0x2ff6c8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],_0x2ff6c8[_0x91db('0x2e')]);_0x49c504['attributes']=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],qs[_0x91db('0x31')](_0x2a00d1['query'][_0x91db('0x31')]));_0x49c504['attributes']=_0x49c504[_0x91db('0x32')][_0x91db('0x33')]?_0x49c504[_0x91db('0x32')]:_0x2ff6c8[_0x91db('0x2d')];if(!_0x2a00d1['query'][_0x91db('0x34')](_0x91db('0x35'))){_0x49c504[_0x91db('0x1b')]=qs['limit'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x1b')]);_0x49c504['offset']=qs[_0x91db('0x19')](_0x2a00d1[_0x91db('0x2e')]['offset']);}_0x49c504[_0x91db('0x36')]=qs['sort'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x37')]);_0x49c504['where']=qs['filters'](_['pick'](_0x2a00d1[_0x91db('0x2e')],_0x2ff6c8[_0x91db('0x2f')]),_0x2d3ebd);if(_0x2a00d1['query'][_0x91db('0x38')]){_0x49c504[_0x91db('0x39')]=_[_0x91db('0x3a')](_0x49c504[_0x91db('0x39')],{'$or':_[_0x91db('0x27')](_0x2d3ebd,function(_0x3cccc7){if(_0x3cccc7[_0x91db('0x2b')]!==_0x91db('0x3b')){var _0xcdc472={};_0xcdc472[_0x3cccc7[_0x91db('0x25')]]={'$like':'%'+_0x2a00d1[_0x91db('0x2e')]['filter']+'%'};return _0xcdc472;}})});}_0x49c504=_[_0x91db('0x3a')]({},_0x49c504,_0x2a00d1['options']);var _0x14de6d={'where':_0x49c504[_0x91db('0x39')]};return db['Cdr'][_0x91db('0x1c')](_0x14de6d)[_0x91db('0x23')](function(_0x16a7e9){_0x69fdc2[_0x91db('0x1c')]=_0x16a7e9;if(_0x2a00d1[_0x91db('0x2e')]['includeAll']){_0x49c504[_0x91db('0x3c')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3d')](_0x49c504);})['then'](function(_0x4733a4){_0x69fdc2[_0x91db('0x3e')]=_0x4733a4;return _0x69fdc2;})[_0x91db('0x23')](respondWithFilteredResult(_0x1805ef,_0x49c504))['catch'](handleError(_0x1805ef,null));};exports[_0x91db('0x3f')]=function(_0x2b7830,_0x29831c){var _0x3d73a7={'raw':!![],'where':{'id':_0x2b7830['params']['id']}},_0x3609e1={};_0x3609e1[_0x91db('0x2d')]=_['keys'](db[_0x91db('0x28')][_0x91db('0x29')]);_0x3609e1[_0x91db('0x2e')]=_[_0x91db('0x40')](_0x2b7830[_0x91db('0x2e')]);_0x3609e1[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x3609e1[_0x91db('0x2d')],_0x3609e1[_0x91db('0x2e')]);_0x3d73a7[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3609e1['model'],qs['fields'](_0x2b7830[_0x91db('0x2e')][_0x91db('0x31')]));_0x3d73a7[_0x91db('0x32')]=_0x3d73a7['attributes'][_0x91db('0x33')]?_0x3d73a7[_0x91db('0x32')]:_0x3609e1[_0x91db('0x2d')];if(_0x2b7830[_0x91db('0x2e')][_0x91db('0x41')]){_0x3d73a7['include']=[{'all':!![]}];}_0x3d73a7=_[_0x91db('0x3a')]({},_0x3d73a7,_0x2b7830['options']);return db[_0x91db('0x28')][_0x91db('0x42')](_0x3d73a7)[_0x91db('0x23')](handleEntityNotFound(_0x29831c,null))[_0x91db('0x23')](respondWithResult(_0x29831c,null))[_0x91db('0x43')](handleError(_0x29831c,null));};exports[_0x91db('0x44')]=function(_0x17f7b3,_0xd5a8fb){return db[_0x91db('0x28')]['create'](_0x17f7b3['body'],{})[_0x91db('0x23')](respondWithResult(_0xd5a8fb,0xc9))[_0x91db('0x43')](handleError(_0xd5a8fb,null));};exports[_0x91db('0x22')]=function(_0x410423,_0x27e224){if(_0x410423['body']['id']){delete _0x410423[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x42')]({'where':{'id':_0x410423[_0x91db('0x46')]['id']}})[_0x91db('0x23')](handleEntityNotFound(_0x27e224,null))['then'](saveUpdates(_0x410423[_0x91db('0x45')],null))[_0x91db('0x23')](respondWithResult(_0x27e224,null))[_0x91db('0x43')](handleError(_0x27e224,null));};exports[_0x91db('0x47')]=function(_0x50b269,_0x3d8dfb){return db['Cdr']['find']({'where':{'id':_0x50b269[_0x91db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d8dfb,null))[_0x91db('0x23')](removeEntity(_0x3d8dfb,null))['catch'](handleError(_0x3d8dfb,null));};exports['describe']=function(_0x2c30ff,_0x371277){return db[_0x91db('0x28')]['describe']()[_0x91db('0x23')](respondWithResult(_0x371277,null))[_0x91db('0x43')](handleError(_0x371277,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 13cf416..e3947f9 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(_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 +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x243203,_0x2a9990){var _0x4707de=function(_0xc19be6){while(--_0xc19be6){_0x243203['push'](_0x243203['shift']());}};_0x4707de(++_0x2a9990);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 552b20a..c53989f 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 _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 +var _0xf38a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x494567,_0x1a98ce){var _0x500e3a=function(_0xd97c01){while(--_0xd97c01){_0x494567['push'](_0x494567['shift']());}};_0x500e3a(++_0x1a98ce);}(_0xf38a,0x1e3));var _0xaf38=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xf38a[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0xaf38('0x0'));var util=require(_0xaf38('0x1'));var moment=require(_0xaf38('0x2'));var BPromise=require(_0xaf38('0x3'));var rs=require(_0xaf38('0x4'));var fs=require('fs');var Redis=require(_0xaf38('0x5'));var db=require(_0xaf38('0x6'))['db'];var utils=require(_0xaf38('0x7'));var logger=require(_0xaf38('0x8'))(_0xaf38('0x9'));var config=require(_0xaf38('0xa'));var jayson=require(_0xaf38('0xb'));var client=jayson[_0xaf38('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x346b15,_0x1fe0a0,_0x22a35c){return new BPromise(function(_0x1aab61,_0x3075fd){return client[_0xaf38('0xd')](_0x346b15,_0x22a35c)[_0xaf38('0xe')](function(_0x2c0908){logger[_0xaf38('0xf')](_0xaf38('0x10'),_0x1fe0a0,_0xaf38('0x11'));logger[_0xaf38('0x12')](_0xaf38('0x13'),_0x1fe0a0,_0xaf38('0x11'),JSON['stringify'](_0x2c0908));if(_0x2c0908[_0xaf38('0x14')]){if(_0x2c0908[_0xaf38('0x14')][_0xaf38('0x15')]===0x1f4){logger[_0xaf38('0x14')](_0xaf38('0x10'),_0x1fe0a0,_0x2c0908[_0xaf38('0x14')][_0xaf38('0x16')]);return _0x3075fd(_0x2c0908[_0xaf38('0x14')][_0xaf38('0x16')]);}logger[_0xaf38('0x14')]('Cdr,\x20%s,\x20%s',_0x1fe0a0,_0x2c0908[_0xaf38('0x14')][_0xaf38('0x16')]);return _0x1aab61(_0x2c0908[_0xaf38('0x14')]['message']);}else{logger[_0xaf38('0xf')](_0xaf38('0x10'),_0x1fe0a0,_0xaf38('0x11'));_0x1aab61(_0x2c0908['result'][_0xaf38('0x16')]);}})['catch'](function(_0x12a1d7){logger['error']('Cdr,\x20%s,\x20%s',_0x1fe0a0,_0x12a1d7);_0x3075fd(_0x12a1d7);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 4f33974..8d2a013 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_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 +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c6f74ed..8708566 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 _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 +var _0xeaa4=['exports','noop','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaa4,0x143));var _0x4eaa=function(_0xc1e593,_0x1b1f5f){_0xc1e593=_0xc1e593-0x0;var _0x4c4648=_0xeaa4[_0xc1e593];return _0x4c4648;};'use strict';var Sequelize=require(_0x4eaa('0x0'));module[_0x4eaa('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4eaa('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4eaa('0x3')]},'interval':{'type':Sequelize[_0x4eaa('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 73bf3d8..5078089 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 _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 +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','ChatApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x44278,_0x1bd66f){var _0x2d97f9=function(_0x18a1a3){while(--_0x18a1a3){_0x44278['push'](_0x44278['shift']());}};_0x2d97f9(++_0x1bd66f);}(_0x70e0,0x17b));var _0x070e=function(_0x362f85,_0x2b44f1){_0x362f85=_0x362f85-0x0;var _0x266308=_0x70e0[_0x362f85];return _0x266308;};'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/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ee8fd18..9d244ac 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 _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 +var _0x5959=['ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes'];(function(_0x25ea0a,_0x287721){var _0x38996c=function(_0x72959f){while(--_0x72959f){_0x25ea0a['push'](_0x25ea0a['shift']());}};_0x38996c(++_0x287721);}(_0x5959,0x17c));var _0x9595=function(_0x567d,_0x2f8123){_0x567d=_0x567d-0x0;var _0x3b7a37=_0x5959[_0x567d];return _0x3b7a37;};'use strict';var _=require(_0x9595('0x0'));var util=require(_0x9595('0x1'));var logger=require(_0x9595('0x2'))('api');var moment=require(_0x9595('0x3'));var BPromise=require(_0x9595('0x4'));var rp=require(_0x9595('0x5'));var fs=require('fs');var path=require(_0x9595('0x6'));var rimraf=require(_0x9595('0x7'));var config=require(_0x9595('0x8'));var attributes=require(_0x9595('0x9'));module['exports']=function(_0x20e2fb,_0x19b27c){return _0x20e2fb['define'](_0x9595('0xa'),attributes,{'tableName':_0x9595('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9595('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 228a714..f5821d1 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 _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 +var _0x7a0c=['ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring'];(function(_0x59a901,_0xd01104){var _0x5b2b75=function(_0x4b6044){while(--_0x4b6044){_0x59a901['push'](_0x59a901['shift']());}};_0x5b2b75(++_0xd01104);}(_0x7a0c,0x14c));var _0xc7a0=function(_0x48ab6d,_0x13868d){_0x48ab6d=_0x48ab6d-0x0;var _0x1dcebe=_0x7a0c[_0x48ab6d];return _0x1dcebe;};'use strict';var _=require(_0xc7a0('0x0'));var util=require(_0xc7a0('0x1'));var moment=require(_0xc7a0('0x2'));var BPromise=require('bluebird');var rs=require(_0xc7a0('0x3'));var fs=require('fs');var Redis=require(_0xc7a0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7a0('0x5'));var logger=require(_0xc7a0('0x6'))(_0xc7a0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc7a0('0x8')][_0xc7a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6290fa,_0x37311c,_0x4560bb){return new BPromise(function(_0x34dd90,_0x1dfca1){return client['request'](_0x6290fa,_0x4560bb)[_0xc7a0('0xa')](function(_0x477cbb){logger[_0xc7a0('0xb')]('ChatApplication,\x20%s,\x20%s',_0x37311c,_0xc7a0('0xc'));logger[_0xc7a0('0xd')](_0xc7a0('0xe'),_0x37311c,_0xc7a0('0xc'),JSON[_0xc7a0('0xf')](_0x477cbb));if(_0x477cbb[_0xc7a0('0x10')]){if(_0x477cbb[_0xc7a0('0x10')][_0xc7a0('0x11')]===0x1f4){logger['error'](_0xc7a0('0x12'),_0x37311c,_0x477cbb[_0xc7a0('0x10')][_0xc7a0('0x13')]);return _0x1dfca1(_0x477cbb['error'][_0xc7a0('0x13')]);}logger['error'](_0xc7a0('0x12'),_0x37311c,_0x477cbb[_0xc7a0('0x10')]['message']);return _0x34dd90(_0x477cbb['error'][_0xc7a0('0x13')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x37311c,'request\x20sent');_0x34dd90(_0x477cbb[_0xc7a0('0x14')][_0xc7a0('0x13')]);}})['catch'](function(_0x1e8d6a){logger[_0xc7a0('0x10')](_0xc7a0('0x12'),_0x37311c,_0x1e8d6a);_0x1dfca1(_0x1e8d6a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 05a8d9a..9de271d 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 _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 +var _0x2d9b=['update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','/:id','isAuthenticated','show','put'];(function(_0x16b33f,_0x1e933f){var _0x27c5e0=function(_0x29a857){while(--_0x29a857){_0x16b33f['push'](_0x16b33f['shift']());}};_0x27c5e0(++_0x1e933f);}(_0x2d9b,0x17c));var _0xb2d9=function(_0x2b08dd,_0xabf45c){_0x2b08dd=_0x2b08dd-0x0;var _0x48ad5f=_0x2d9b[_0x2b08dd];return _0x48ad5f;};'use strict';var multer=require(_0xb2d9('0x0'));var util=require('util');var path=require(_0xb2d9('0x1'));var timeout=require(_0xb2d9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2d9('0x3'));var interaction=require(_0xb2d9('0x4'));var config=require('../../config/environment');var controller=require(_0xb2d9('0x5'));router['get'](_0xb2d9('0x6'),auth[_0xb2d9('0x7')](),controller[_0xb2d9('0x8')]);router[_0xb2d9('0x9')](_0xb2d9('0x6'),auth[_0xb2d9('0x7')](),controller[_0xb2d9('0xa')]);router['delete'](_0xb2d9('0x6'),auth['isAuthenticated'](),controller[_0xb2d9('0xb')]);module[_0xb2d9('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 2da7204..825bcf6 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 _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 +var _0xc6f8=['STRING','BOOLEAN'];(function(_0x24e064,_0x240373){var _0x34abec=function(_0x244b5d){while(--_0x244b5d){_0x24e064['push'](_0x24e064['shift']());}};_0x34abec(++_0x240373);}(_0xc6f8,0x14c));var _0x8c6f=function(_0x56fe34,_0x5eb857){_0x56fe34=_0x56fe34-0x0;var _0xb6206d=_0xc6f8[_0x56fe34];return _0xb6206d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8c6f('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x8c6f('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4d7799a..bf80641 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 _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 +var _0xf3b9=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ChatGroup','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','ChatInternalMessage','user','addMembers','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','options','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0xa711b,_0x81a280){var _0x1f061d=function(_0x4c7a37){while(--_0x4c7a37){_0xa711b['push'](_0xa711b['shift']());}};_0x1f061d(++_0x81a280);}(_0xf3b9,0x19d));var _0x9f3b=function(_0x1ec849,_0x386984){_0x1ec849=_0x1ec849-0x0;var _0x1fff97=_0xf3b9[_0x1ec849];return _0x1fff97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f3b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f3b('0x1'));var rp=require('request-promise');var moment=require(_0x9f3b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9f3b('0x3'));var util=require(_0x9f3b('0x4'));var path=require(_0x9f3b('0x5'));var sox=require(_0x9f3b('0x6'));var csv=require(_0x9f3b('0x7'));var ejs=require(_0x9f3b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f3b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9f3b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9f3b('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x9f3b('0xc'));var as=require(_0x9f3b('0xd'));var hardwareService=require(_0x9f3b('0xe'));var logger=require(_0x9f3b('0xf'))(_0x9f3b('0x10'));var utils=require(_0x9f3b('0x11'));var config=require(_0x9f3b('0x12'));var licenseUtil=require(_0x9f3b('0x13'));var db=require(_0x9f3b('0x14'))['db'];config[_0x9f3b('0x15')]=_[_0x9f3b('0x16')](config[_0x9f3b('0x15')],{'host':_0x9f3b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9f3b('0x18'))[_0x9f3b('0x19')](socket);function respondWithStatusCode(_0x5693f0,_0x4345af){_0x4345af=_0x4345af||0xcc;return function(_0xe3a59b){if(_0xe3a59b){return _0x5693f0['sendStatus'](_0x4345af);}return _0x5693f0[_0x9f3b('0x1a')](_0x4345af)[_0x9f3b('0x1b')]();};}function respondWithResult(_0x1383f2,_0x56f409){_0x56f409=_0x56f409||0xc8;return function(_0x5412cf){if(_0x5412cf){return _0x1383f2['status'](_0x56f409)[_0x9f3b('0x1c')](_0x5412cf);}};}function respondWithFilteredResult(_0x3be6be,_0x3ec11f){return function(_0x51f096){if(_0x51f096){var _0xcba5bb=typeof _0x3ec11f[_0x9f3b('0x1d')]==='undefined'&&typeof _0x3ec11f['limit']===_0x9f3b('0x1e');var _0x49dcd6=_0x51f096['count'];var _0x3b17f5=_0xcba5bb?0x0:_0x3ec11f[_0x9f3b('0x1d')];var _0x5cce47=_0xcba5bb?_0x51f096[_0x9f3b('0x1f')]:_0x3ec11f[_0x9f3b('0x1d')]+_0x3ec11f[_0x9f3b('0x20')];var _0x438c98;if(_0x5cce47>=_0x49dcd6){_0x5cce47=_0x49dcd6;_0x438c98=0xc8;}else{_0x438c98=0xce;}_0x3be6be[_0x9f3b('0x1a')](_0x438c98);return _0x3be6be[_0x9f3b('0x21')](_0x9f3b('0x22'),_0x3b17f5+'-'+_0x5cce47+'/'+_0x49dcd6)['json'](_0x51f096);}return null;};}function patchUpdates(_0x54edaf){return function(_0x2838e4){try{jsonpatch[_0x9f3b('0x23')](_0x2838e4,_0x54edaf,!![]);}catch(_0x451d63){return BPromise[_0x9f3b('0x24')](_0x451d63);}return _0x2838e4[_0x9f3b('0x25')]();};}function saveUpdates(_0xe18230,_0x345ccc){return function(_0x24cbb4){if(_0x24cbb4){return _0x24cbb4[_0x9f3b('0x26')](_0xe18230)[_0x9f3b('0x27')](function(_0xa200e0){return _0xa200e0;});}return null;};}function removeEntity(_0x6fb490,_0x37adc2){return function(_0x3eb503){if(_0x3eb503){return _0x3eb503[_0x9f3b('0x28')]()[_0x9f3b('0x27')](function(){_0x6fb490[_0x9f3b('0x1a')](0xcc)[_0x9f3b('0x1b')]();});}};}function handleEntityNotFound(_0xd3a98e,_0x3c32bf){return function(_0x45ed77){if(!_0x45ed77){_0xd3a98e[_0x9f3b('0x29')](0x194);}return _0x45ed77;};}function handleError(_0x4a4658,_0xeb3b93){_0xeb3b93=_0xeb3b93||0x1f4;return function(_0x19f0ad){logger[_0x9f3b('0x2a')](_0x19f0ad['stack']);if(_0x19f0ad[_0x9f3b('0x2b')]){delete _0x19f0ad[_0x9f3b('0x2b')];}_0x4a4658[_0x9f3b('0x1a')](_0xeb3b93)[_0x9f3b('0x2c')](_0x19f0ad);};}exports[_0x9f3b('0x2d')]=function(_0x2ef7d3,_0x364445){var _0x5880f1={},_0x87cf5d={},_0x578160={'count':0x0,'rows':[]};var _0x2e5572=_[_0x9f3b('0x2e')](db['ChatGroup'][_0x9f3b('0x2f')],function(_0x13c14f){return{'name':_0x13c14f['fieldName'],'type':_0x13c14f[_0x9f3b('0x30')][_0x9f3b('0x31')]};});_0x87cf5d[_0x9f3b('0x32')]=_[_0x9f3b('0x2e')](_0x2e5572,'name');_0x87cf5d[_0x9f3b('0x33')]=_[_0x9f3b('0x34')](_0x2ef7d3[_0x9f3b('0x33')]);_0x87cf5d[_0x9f3b('0x35')]=_[_0x9f3b('0x36')](_0x87cf5d[_0x9f3b('0x32')],_0x87cf5d['query']);_0x5880f1[_0x9f3b('0x37')]=_[_0x9f3b('0x36')](_0x87cf5d[_0x9f3b('0x32')],qs['fields'](_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x38')]));_0x5880f1[_0x9f3b('0x37')]=_0x5880f1[_0x9f3b('0x37')][_0x9f3b('0x39')]?_0x5880f1[_0x9f3b('0x37')]:_0x87cf5d[_0x9f3b('0x32')];if(!_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x3a')](_0x9f3b('0x3b'))){_0x5880f1[_0x9f3b('0x20')]=qs[_0x9f3b('0x20')](_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x20')]);_0x5880f1[_0x9f3b('0x1d')]=qs[_0x9f3b('0x1d')](_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x1d')]);}_0x5880f1[_0x9f3b('0x3c')]=qs[_0x9f3b('0x3d')](_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x3d')]);_0x5880f1[_0x9f3b('0x3e')]=qs[_0x9f3b('0x35')](_[_0x9f3b('0x3f')](_0x2ef7d3[_0x9f3b('0x33')],_0x87cf5d['filters']),_0x2e5572);if(_0x2ef7d3[_0x9f3b('0x33')]['filter']){_0x5880f1[_0x9f3b('0x3e')]=_[_0x9f3b('0x40')](_0x5880f1[_0x9f3b('0x3e')],{'$or':_[_0x9f3b('0x2e')](_0x2e5572,function(_0x4815c9){if(_0x4815c9[_0x9f3b('0x30')]!==_0x9f3b('0x41')){var _0xf109bb={};_0xf109bb[_0x4815c9['name']]={'$like':'%'+_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x42')]+'%'};return _0xf109bb;}})});}_0x5880f1=_[_0x9f3b('0x40')]({},_0x5880f1,_0x2ef7d3['options']);var _0x1a7d77={'where':_0x5880f1['where']};return db[_0x9f3b('0x43')]['count'](_0x1a7d77)['then'](function(_0x2351a7){_0x578160[_0x9f3b('0x1f')]=_0x2351a7;if(_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x44')]){_0x5880f1[_0x9f3b('0x45')]=[{'all':!![]}];}return db[_0x9f3b('0x43')][_0x9f3b('0x46')](_0x5880f1);})['then'](function(_0x198a0d){_0x578160[_0x9f3b('0x47')]=_0x198a0d;return _0x578160;})[_0x9f3b('0x27')](respondWithFilteredResult(_0x364445,_0x5880f1))[_0x9f3b('0x48')](handleError(_0x364445,null));};exports[_0x9f3b('0x49')]=function(_0x41d6dd,_0xfc97b1){var _0x2338e0={'raw':!![],'where':{'id':_0x41d6dd[_0x9f3b('0x4a')]['id']}},_0x1571cc={};_0x1571cc['model']=_['keys'](db['ChatGroup'][_0x9f3b('0x2f')]);_0x1571cc[_0x9f3b('0x33')]=_['keys'](_0x41d6dd[_0x9f3b('0x33')]);_0x1571cc[_0x9f3b('0x35')]=_[_0x9f3b('0x36')](_0x1571cc[_0x9f3b('0x32')],_0x1571cc['query']);_0x2338e0['attributes']=_[_0x9f3b('0x36')](_0x1571cc[_0x9f3b('0x32')],qs['fields'](_0x41d6dd['query']['fields']));_0x2338e0[_0x9f3b('0x37')]=_0x2338e0['attributes']['length']?_0x2338e0[_0x9f3b('0x37')]:_0x1571cc[_0x9f3b('0x32')];if(_0x41d6dd[_0x9f3b('0x33')][_0x9f3b('0x44')]){_0x2338e0[_0x9f3b('0x45')]=[{'all':!![]}];}_0x2338e0=_[_0x9f3b('0x40')]({},_0x2338e0,_0x41d6dd['options']);return db[_0x9f3b('0x43')][_0x9f3b('0x4b')](_0x2338e0)[_0x9f3b('0x27')](handleEntityNotFound(_0xfc97b1,null))[_0x9f3b('0x27')](respondWithResult(_0xfc97b1,null))[_0x9f3b('0x48')](handleError(_0xfc97b1,null));};exports[_0x9f3b('0x4c')]=function(_0x250de6,_0x18f5fa){return db[_0x9f3b('0x43')][_0x9f3b('0x4c')](_0x250de6[_0x9f3b('0x4d')],{})[_0x9f3b('0x27')](respondWithResult(_0x18f5fa,0xc9))[_0x9f3b('0x48')](handleError(_0x18f5fa,null));};exports[_0x9f3b('0x26')]=function(_0x1ab9e2,_0x42168b){if(_0x1ab9e2[_0x9f3b('0x4d')]['id']){delete _0x1ab9e2[_0x9f3b('0x4d')]['id'];}return db[_0x9f3b('0x43')][_0x9f3b('0x4b')]({'where':{'id':_0x1ab9e2[_0x9f3b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42168b,null))[_0x9f3b('0x27')](saveUpdates(_0x1ab9e2['body'],null))[_0x9f3b('0x27')](respondWithResult(_0x42168b,null))['catch'](handleError(_0x42168b,null));};exports['destroy']=function(_0x1e201d,_0x3b6cba){return db[_0x9f3b('0x43')][_0x9f3b('0x4b')]({'where':{'id':_0x1e201d[_0x9f3b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b6cba,null))[_0x9f3b('0x27')](removeEntity(_0x3b6cba,null))[_0x9f3b('0x48')](handleError(_0x3b6cba,null));};exports['describe']=function(_0x5f0760,_0x2f27c3){return db[_0x9f3b('0x43')][_0x9f3b('0x4e')]()[_0x9f3b('0x27')](respondWithResult(_0x2f27c3,null))[_0x9f3b('0x48')](handleError(_0x2f27c3,null));};exports['getUnread']=function(_0x1bef9a,_0x592642,_0x4a7e29){return db[_0x9f3b('0x4f')][_0x9f3b('0x1f')]({'where':{'ChatGroupId':_0x1bef9a[_0x9f3b('0x4a')]['id'],'ToId':_0x1bef9a[_0x9f3b('0x50')]['id'],'read':![]}})[_0x9f3b('0x27')](function(_0x2ac5fe){return{'id':_['toInteger'](_0x1bef9a['params']['id']),'count':_0x2ac5fe};})['then'](respondWithResult(_0x592642,null))['catch'](handleError(_0x592642,null));};exports[_0x9f3b('0x51')]=function(_0x2af7c8,_0x51a4c4,_0x3514ac){return db['ChatGroup'][_0x9f3b('0x4b')]({'where':{'id':_0x2af7c8[_0x9f3b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51a4c4,null))[_0x9f3b('0x27')](function(_0x5722a3){if(_0x5722a3){return _0x5722a3[_0x9f3b('0x51')](_0x2af7c8[_0x9f3b('0x4d')][_0x9f3b('0x52')],_['omit'](_0x2af7c8[_0x9f3b('0x4d')],[_0x9f3b('0x52'),'id'])||{});}})[_0x9f3b('0x27')](respondWithResult(_0x51a4c4,null))['catch'](handleError(_0x51a4c4,null));};exports[_0x9f3b('0x53')]=function(_0xbaf498,_0x23f54b,_0x5a4c75){var _0xc6cb63={};var _0x446fec={};var _0x70a3d8;var _0x3e5ff9;return db[_0x9f3b('0x43')][_0x9f3b('0x54')]({'where':{'id':_0xbaf498[_0x9f3b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x23f54b,null))['then'](function(_0x365aee){if(_0x365aee){_0x70a3d8=_0x365aee;_0x446fec[_0x9f3b('0x32')]=_[_0x9f3b('0x34')](db[_0x9f3b('0x55')][_0x9f3b('0x2f')]);_0x446fec[_0x9f3b('0x33')]=_['keys'](_0xbaf498[_0x9f3b('0x33')]);_0x446fec[_0x9f3b('0x35')]=_['intersection'](_0x446fec[_0x9f3b('0x32')],_0x446fec[_0x9f3b('0x33')]);_0xc6cb63['attributes']=_[_0x9f3b('0x36')](_0x446fec[_0x9f3b('0x32')],qs['fields'](_0xbaf498[_0x9f3b('0x33')]['fields']));_0xc6cb63[_0x9f3b('0x37')]=_0xc6cb63['attributes'][_0x9f3b('0x39')]?_0xc6cb63[_0x9f3b('0x37')]:_0x446fec[_0x9f3b('0x32')];_0xc6cb63[_0x9f3b('0x3c')]=qs[_0x9f3b('0x3d')](_0xbaf498[_0x9f3b('0x33')][_0x9f3b('0x3d')]);_0xc6cb63[_0x9f3b('0x3e')]=qs[_0x9f3b('0x35')](_[_0x9f3b('0x3f')](_0xbaf498[_0x9f3b('0x33')],_0x446fec[_0x9f3b('0x35')]));if(_0xbaf498[_0x9f3b('0x33')][_0x9f3b('0x42')]){_0xc6cb63[_0x9f3b('0x3e')]=_[_0x9f3b('0x40')](_0xc6cb63[_0x9f3b('0x3e')],{'$or':_[_0x9f3b('0x2e')](_0xc6cb63[_0x9f3b('0x37')],function(_0x5004c5){var _0x7c05eb={};_0x7c05eb[_0x5004c5]={'$like':'%'+_0xbaf498['query'][_0x9f3b('0x42')]+'%'};return _0x7c05eb;})});}_0xc6cb63=_['merge']({},_0xc6cb63,_0xbaf498['options']);return _0x70a3d8[_0x9f3b('0x53')](_0xc6cb63);}})['then'](function(_0x207f4a){if(_0x207f4a){_0x3e5ff9=_0x207f4a[_0x9f3b('0x39')];if(!_0xbaf498['query']['hasOwnProperty'](_0x9f3b('0x3b'))){_0xc6cb63[_0x9f3b('0x20')]=qs['limit'](_0xbaf498[_0x9f3b('0x33')][_0x9f3b('0x20')]);_0xc6cb63['offset']=qs[_0x9f3b('0x1d')](_0xbaf498[_0x9f3b('0x33')][_0x9f3b('0x1d')]);}return _0x70a3d8[_0x9f3b('0x53')](_0xc6cb63);}})[_0x9f3b('0x27')](function(_0x5e1d55){if(_0x5e1d55){return _0x5e1d55?{'count':_0x3e5ff9,'rows':_0x5e1d55}:null;}})['then'](respondWithResult(_0x23f54b,null))[_0x9f3b('0x48')](handleError(_0x23f54b,null));};exports[_0x9f3b('0x56')]=function(_0x271953,_0x578832,_0x3b85c7){return db[_0x9f3b('0x43')][_0x9f3b('0x4b')]({'where':{'id':_0x271953[_0x9f3b('0x4a')]['id']}})[_0x9f3b('0x27')](handleEntityNotFound(_0x578832,null))['then'](function(_0x28af91){if(_0x28af91){return _0x28af91['removeMembers'](_0x271953[_0x9f3b('0x33')][_0x9f3b('0x52')]);}})[_0x9f3b('0x27')](respondWithStatusCode(_0x578832,null))[_0x9f3b('0x48')](handleError(_0x578832,null));};exports[_0x9f3b('0x57')]=function(_0x109cb8,_0xb1c947,_0x4d992d){if(_0x109cb8[_0x9f3b('0x4d')]['id']){delete _0x109cb8['body']['id'];}return db['ChatGroup'][_0x9f3b('0x4b')]({'where':{'id':_0x109cb8[_0x9f3b('0x4a')]['id']}})[_0x9f3b('0x27')](handleEntityNotFound(_0xb1c947,null))[_0x9f3b('0x27')](function(_0x383e60){if(_0x383e60){_0x109cb8[_0x9f3b('0x4d')][_0x9f3b('0x58')]=_0x383e60['id'];return db[_0x9f3b('0x4f')][_0x9f3b('0x4c')](_0x109cb8[_0x9f3b('0x4d')]);}})['then'](respondWithResult(_0xb1c947,null))['catch'](handleError(_0xb1c947,null));};exports[_0x9f3b('0x59')]=function(_0x204bdc,_0x39061a,_0x16c41e){var _0x41377e={};var _0x4c0fdd={};var _0x51b94c;var _0x18d719;return db[_0x9f3b('0x43')][_0x9f3b('0x54')]({'where':{'id':_0x204bdc['params']['id']}})[_0x9f3b('0x27')](handleEntityNotFound(_0x39061a,null))['then'](function(_0x3eb22b){if(_0x3eb22b){_0x51b94c=_0x3eb22b;_0x4c0fdd[_0x9f3b('0x32')]=_[_0x9f3b('0x34')](db[_0x9f3b('0x4f')]['rawAttributes']);_0x4c0fdd[_0x9f3b('0x33')]=_['keys'](_0x204bdc[_0x9f3b('0x33')]);_0x4c0fdd[_0x9f3b('0x35')]=_[_0x9f3b('0x36')](_0x4c0fdd[_0x9f3b('0x32')],_0x4c0fdd[_0x9f3b('0x33')]);_0x41377e[_0x9f3b('0x37')]=_[_0x9f3b('0x36')](_0x4c0fdd[_0x9f3b('0x32')],qs[_0x9f3b('0x38')](_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x38')]));_0x41377e[_0x9f3b('0x37')]=_0x41377e[_0x9f3b('0x37')][_0x9f3b('0x39')]?_0x41377e[_0x9f3b('0x37')]:_0x4c0fdd[_0x9f3b('0x32')];_0x41377e['order']=qs[_0x9f3b('0x3d')](_0x204bdc['query'][_0x9f3b('0x3d')]);_0x41377e['where']=qs['filters'](_[_0x9f3b('0x3f')](_0x204bdc['query'],_0x4c0fdd[_0x9f3b('0x35')]));if(_0x204bdc['query'][_0x9f3b('0x42')]){_0x41377e[_0x9f3b('0x3e')]=_[_0x9f3b('0x40')](_0x41377e['where'],{'$or':_[_0x9f3b('0x2e')](_0x41377e[_0x9f3b('0x37')],function(_0x5b505a){var _0xf67e3={};_0xf67e3[_0x5b505a]={'$like':'%'+_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x42')]+'%'};return _0xf67e3;})});}if(_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x5a')]){var _0x3d35b1=_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x5a')][_0x9f3b('0x5b')](',');var _0x10d989={};_0x10d989[_0x3d35b1[0x0]]={'$gte':moment(_0x3d35b1[0x1])[_0x9f3b('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x41377e[_0x9f3b('0x3e')]=_['merge'](_0x41377e[_0x9f3b('0x3e')],_0x10d989);}_0x41377e=_[_0x9f3b('0x40')]({},_0x41377e,_0x204bdc[_0x9f3b('0x5d')]);return _0x51b94c[_0x9f3b('0x59')](_0x41377e);}})[_0x9f3b('0x27')](function(_0x3ecfa1){if(_0x3ecfa1){_0x18d719=_0x3ecfa1[_0x9f3b('0x39')];if(!_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x3a')](_0x9f3b('0x3b'))){_0x41377e[_0x9f3b('0x20')]=qs[_0x9f3b('0x20')](_0x204bdc['query']['limit']);_0x41377e[_0x9f3b('0x1d')]=qs['offset'](_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x1d')]);}return _0x51b94c[_0x9f3b('0x59')](_0x41377e);}})['then'](function(_0x4bad41){if(_0x4bad41){return _0x4bad41?{'count':_0x18d719,'rows':_0x4bad41}:null;}})['then'](respondWithResult(_0x39061a,null))[_0x9f3b('0x48')](handleError(_0x39061a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 1a4efc2..7f4a13e 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 _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 +var _0xbc6c=['update','emit','hasOwnProperty','hook','exports','events','ChatGroup','setMaxListeners','save'];(function(_0x2bebb2,_0x321313){var _0x277503=function(_0x15c37e){while(--_0x15c37e){_0x2bebb2['push'](_0x2bebb2['shift']());}};_0x277503(++_0x321313);}(_0xbc6c,0x101));var _0xcbc6=function(_0x319619,_0x58c07a){_0x319619=_0x319619-0x0;var _0x55cb02=_0xbc6c[_0x319619];return _0x55cb02;};'use strict';var EventEmitter=require(_0xcbc6('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xcbc6('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xcbc6('0x2')](0x0);var events={'afterCreate':_0xcbc6('0x3'),'afterUpdate':_0xcbc6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51a997){return function(_0x2ab1ac,_0x15cead,_0x1a3bfb){ChatGroupEvents[_0xcbc6('0x5')](_0x51a997+':'+_0x2ab1ac['id'],_0x2ab1ac);ChatGroupEvents['emit'](_0x51a997,_0x2ab1ac);_0x1a3bfb(null);};}for(var e in events){if(events[_0xcbc6('0x6')](e)){var event=events[e];ChatGroup[_0xcbc6('0x7')](e,emitEvent(event));}}module[_0xcbc6('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 39973a1..65013e3 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 _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 +var _0xb56b=['./chatGroup.attributes','exports','chat_groups','lodash','util','moment','bluebird','request-promise','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb56b,0x159));var _0xbb56=function(_0x3cc8b4,_0x33bc7d){_0x3cc8b4=_0x3cc8b4-0x0;var _0x20ff15=_0xb56b[_0x3cc8b4];return _0x20ff15;};'use strict';var _=require(_0xbb56('0x0'));var util=require(_0xbb56('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbb56('0x2'));var BPromise=require(_0xbb56('0x3'));var rp=require(_0xbb56('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbb56('0x5'));var attributes=require(_0xbb56('0x6'));module[_0xbb56('0x7')]=function(_0x5b41ba,_0x30260d){return _0x5b41ba['define']('ChatGroup',attributes,{'tableName':_0xbb56('0x8'),'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 cb76684..5a92440 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 _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 +var _0x4b47=['then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','request'];(function(_0x826fd8,_0x3f4104){var _0x2b5e49=function(_0x11e1d9){while(--_0x11e1d9){_0x826fd8['push'](_0x826fd8['shift']());}};_0x2b5e49(++_0x3f4104);}(_0x4b47,0x1b4));var _0x74b4=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x4b47[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x74b4('0x0'));var util=require('util');var moment=require(_0x74b4('0x1'));var BPromise=require(_0x74b4('0x2'));var rs=require(_0x74b4('0x3'));var fs=require('fs');var Redis=require(_0x74b4('0x4'));var db=require(_0x74b4('0x5'))['db'];var utils=require(_0x74b4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b4('0x7'));var jayson=require(_0x74b4('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x74b4('0x9')](config[_0x74b4('0xa')],{'host':_0x74b4('0xb'),'port':0x18eb});var socket=require(_0x74b4('0xc'))(new Redis(config[_0x74b4('0xa')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x2f4acd,_0x83da1b,_0x4f1886){return new BPromise(function(_0x513edb,_0x52c215){return client[_0x74b4('0xd')](_0x2f4acd,_0x4f1886)[_0x74b4('0xe')](function(_0x1e84a3){logger[_0x74b4('0xf')]('ChatGroup,\x20%s,\x20%s',_0x83da1b,_0x74b4('0x10'));logger['debug'](_0x74b4('0x11'),_0x83da1b,'request\x20sent',JSON[_0x74b4('0x12')](_0x1e84a3));if(_0x1e84a3[_0x74b4('0x13')]){if(_0x1e84a3[_0x74b4('0x13')][_0x74b4('0x14')]===0x1f4){logger['error'](_0x74b4('0x15'),_0x83da1b,_0x1e84a3[_0x74b4('0x13')]['message']);return _0x52c215(_0x1e84a3[_0x74b4('0x13')][_0x74b4('0x16')]);}logger[_0x74b4('0x13')](_0x74b4('0x15'),_0x83da1b,_0x1e84a3['error'][_0x74b4('0x16')]);return _0x513edb(_0x1e84a3[_0x74b4('0x13')]['message']);}else{logger['info'](_0x74b4('0x15'),_0x83da1b,_0x74b4('0x10'));_0x513edb(_0x1e84a3[_0x74b4('0x17')][_0x74b4('0x16')]);}})[_0x74b4('0x18')](function(_0x315a51){logger[_0x74b4('0x13')](_0x74b4('0x15'),_0x83da1b,_0x315a51);_0x52c215(_0x315a51);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 56eb209..43075f5 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 _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 +var _0xff5f=['save','update','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0xf3b362,_0x37807e){var _0x3d0192=function(_0x43e69a){while(--_0x43e69a){_0xf3b362['push'](_0xf3b362['shift']());}};_0x3d0192(++_0x37807e);}(_0xff5f,0xd8));var _0xfff5=function(_0x317d4b,_0x3d96d4){_0x317d4b=_0x317d4b-0x0;var _0x299b0b=_0xff5f[_0x317d4b];return _0x299b0b;};'use strict';var ChatGroupEvents=require(_0xfff5('0x0'));var events=[_0xfff5('0x1'),'remove',_0xfff5('0x2')];function createListener(_0x29247e,_0x4312ab){return function(_0x48136c){_0x4312ab['emit'](_0x29247e,_0x48136c);};}function removeListener(_0x34d498,_0x4e5af6){return function(){ChatGroupEvents[_0xfff5('0x3')](_0x34d498,_0x4e5af6);};}exports[_0xfff5('0x4')]=function(_0x51bd21){for(var _0x3b6ff7=0x0,_0x31b7dc=events[_0xfff5('0x5')];_0x3b6ff7<_0x31b7dc;_0x3b6ff7++){var _0x15d5d3=events[_0x3b6ff7];var _0x53f30b=createListener(_0xfff5('0x6')+_0x15d5d3,_0x51bd21);ChatGroupEvents['on'](_0x15d5d3,_0x53f30b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index b592a6b..1a6519b 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 _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 +var _0x9a18=['removeMembers','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','index','get','isAuthenticated','show','/:id/unread','getUnread','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','/:id','update','delete','destroy'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x9a18,0x13a));var _0x89a1=function(_0x90c0ea,_0xfe9689){_0x90c0ea=_0x90c0ea-0x0;var _0x8bd383=_0x9a18[_0x90c0ea];return _0x8bd383;};'use strict';var multer=require(_0x89a1('0x0'));var util=require(_0x89a1('0x1'));var path=require(_0x89a1('0x2'));var timeout=require(_0x89a1('0x3'));var express=require(_0x89a1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x89a1('0x5'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x89a1('0x6')]);router[_0x89a1('0x7')]('/describe',auth[_0x89a1('0x8')](),controller['describe']);router[_0x89a1('0x7')]('/:id',auth[_0x89a1('0x8')](),controller[_0x89a1('0x9')]);router[_0x89a1('0x7')](_0x89a1('0xa'),auth[_0x89a1('0x8')](),controller[_0x89a1('0xb')]);router[_0x89a1('0x7')]('/:id/members',auth[_0x89a1('0x8')](),controller['getMembers']);router[_0x89a1('0x7')](_0x89a1('0xc'),auth[_0x89a1('0x8')](),controller[_0x89a1('0xd')]);router[_0x89a1('0xe')]('/',auth[_0x89a1('0x8')](),controller[_0x89a1('0xf')]);router['post'](_0x89a1('0x10'),auth['isAuthenticated'](),controller[_0x89a1('0x11')]);router[_0x89a1('0xe')](_0x89a1('0xc'),auth[_0x89a1('0x8')](),controller[_0x89a1('0x12')]);router[_0x89a1('0x13')](_0x89a1('0x14'),auth[_0x89a1('0x8')](),controller[_0x89a1('0x15')]);router[_0x89a1('0x16')]('/:id',auth[_0x89a1('0x8')](),controller[_0x89a1('0x17')]);router[_0x89a1('0x16')](_0x89a1('0x10'),auth[_0x89a1('0x8')](),controller[_0x89a1('0x18')]);module[_0x89a1('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index e09924a..bbff2dd 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 _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 +var _0xf632=['exports','BOOLEAN','star','TEXT','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x5251fe,_0x2b3eca){var _0x280649=function(_0x1209f7){while(--_0x1209f7){_0x5251fe['push'](_0x5251fe['shift']());}};_0x280649(++_0x2b3eca);}(_0xf632,0x77));var _0x2f63=function(_0x20d448,_0x538782){_0x20d448=_0x20d448-0x0;var _0x580bdb=_0xf632[_0x20d448];return _0x580bdb;};'use strict';var Sequelize=require(_0x2f63('0x0'));module[_0x2f63('0x1')]={'closed':{'type':Sequelize[_0x2f63('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':_0x2f63('0x3')},'ratingMessage':{'type':Sequelize[_0x2f63('0x4')]},'pathTranscript':{'type':Sequelize[_0x2f63('0x4')]},'mailTranscript':{'type':Sequelize[_0x2f63('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2f63('0x6')]},'disposition':{'type':Sequelize[_0x2f63('0x5')]},'secondDisposition':{'type':Sequelize[_0x2f63('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x2f63('0x5')]},'browserVersion':{'type':Sequelize[_0x2f63('0x5')]},'osName':{'type':Sequelize[_0x2f63('0x5')]},'osVersion':{'type':Sequelize[_0x2f63('0x5')]},'deviceModel':{'type':Sequelize[_0x2f63('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x2f63('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2f63('0x4')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x2f63('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x2f63('0x7')]('in',_0x2f63('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2f63('0x5')]},'customerPort':{'type':Sequelize[_0x2f63('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x2f63('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2f63('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1e42259..dd3f526 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 _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 +var _0x7f1d=['limit','set','update','stack','name','send','render','merge','body','contact','agent','interaction','index','map','ChatInteraction','fieldName','key','chat','query','user','then','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options','create','find','params','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','join','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','User','agentAlias','System','customer','%s%d','Visitor','ContactId','alias','agent_fullname','createdAt','direction','secret','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','include','includeAgent','push','addTags','setTags','omit','Tag','unix','toString','root','server','tmp','files','attachments','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','read','views','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count'];(function(_0x70404,_0x507113){var _0x2da0b9=function(_0x3fa2a9){while(--_0x3fa2a9){_0x70404['push'](_0x70404['shift']());}};_0x2da0b9(++_0x507113);}(_0x7f1d,0x170));var _0xd7f1=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x7f1d[_0x47aa64];return _0x549c7a;};'use strict';var rimraf=require(_0xd7f1('0x0'));var zipdir=require(_0xd7f1('0x1'));var rp=require(_0xd7f1('0x2'));var moment=require('moment');var BPromise=require(_0xd7f1('0x3'));var Mustache=require(_0xd7f1('0x4'));var util=require('util');var path=require('path');var ejs=require(_0xd7f1('0x5'));var fs=require('fs');var _=require(_0xd7f1('0x6'));var Redis=require(_0xd7f1('0x7'));var interaction=require(_0xd7f1('0x8'));var qs=require(_0xd7f1('0x9'));var pdf=require(_0xd7f1('0xa'));var logger=require('../../config/logger')('api');var config=require(_0xd7f1('0xb'));var db=require('../../mysqldb')['db'];config[_0xd7f1('0xc')]=_[_0xd7f1('0xd')](config[_0xd7f1('0xc')],{'host':_0xd7f1('0xe'),'port':0x18eb});var socket=require(_0xd7f1('0xf'))(new Redis(config[_0xd7f1('0xc')]));require(_0xd7f1('0x10'))['register'](socket);var jayson=require(_0xd7f1('0x11'));var client=jayson[_0xd7f1('0x12')][_0xd7f1('0x13')]({'port':0x232b});var client9004=jayson[_0xd7f1('0x12')][_0xd7f1('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x37f3cc,_0x5b86ae,_0x510b27,_0x237f1f){return new BPromise(function(_0x2969af,_0x360f6a){var _0x27ed70=_0x237f1f||client;return _0x27ed70['request'](_0x37f3cc,_0x510b27)['then'](function(_0x49b590){logger['info'](_0xd7f1('0x14'),_0x5b86ae,_0xd7f1('0x15'));logger[_0xd7f1('0x16')](_0xd7f1('0x17'),_0x5b86ae,_0xd7f1('0x15'),JSON['stringify'](_0x49b590));if(_0x49b590['error']){if(_0x49b590[_0xd7f1('0x18')]['code']===0x1f4){logger[_0xd7f1('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5b86ae,_0x49b590['error'][_0xd7f1('0x19')]);return _0x360f6a(_0x49b590[_0xd7f1('0x18')][_0xd7f1('0x19')]);}logger['error'](_0xd7f1('0x14'),_0x5b86ae,_0x49b590[_0xd7f1('0x18')][_0xd7f1('0x19')]);return _0x2969af(_0x49b590[_0xd7f1('0x18')][_0xd7f1('0x19')]);}else{logger[_0xd7f1('0x1a')](_0xd7f1('0x14'),_0x5b86ae,_0xd7f1('0x15'));_0x2969af(_0x49b590[_0xd7f1('0x1b')]['message']);}})[_0xd7f1('0x1c')](function(_0x51b831){logger[_0xd7f1('0x18')](_0xd7f1('0x14'),_0x5b86ae,_0x51b831);_0x360f6a(_0x51b831);});});}function respondWithStatusCode(_0x3b3acf,_0x3cb36f){_0x3cb36f=_0x3cb36f||0xcc;return function(_0x3e0c6c){if(_0x3e0c6c){return _0x3b3acf[_0xd7f1('0x1d')](_0x3cb36f);}return _0x3b3acf[_0xd7f1('0x1e')](_0x3cb36f)[_0xd7f1('0x1f')]();};}function respondWithResult(_0x50e104,_0x193926){_0x193926=_0x193926||0xc8;return function(_0x1bb71f){if(_0x1bb71f){return _0x50e104[_0xd7f1('0x1e')](_0x193926)[_0xd7f1('0x20')](_0x1bb71f);}};}function respondWithFilteredResult(_0x8c8457,_0x459cb2){return function(_0x2bb33b){if(_0x2bb33b){var _0x5c991a=typeof _0x459cb2[_0xd7f1('0x21')]==='undefined'&&typeof _0x459cb2['limit']===_0xd7f1('0x22');var _0x3f83f1=_0x2bb33b[_0xd7f1('0x23')];var _0x3b6fde=_0x5c991a?0x0:_0x459cb2[_0xd7f1('0x21')];var _0x44adab=_0x5c991a?_0x2bb33b['count']:_0x459cb2[_0xd7f1('0x21')]+_0x459cb2[_0xd7f1('0x24')];var _0x32c142;if(_0x44adab>=_0x3f83f1){_0x44adab=_0x3f83f1;_0x32c142=0xc8;}else{_0x32c142=0xce;}_0x8c8457[_0xd7f1('0x1e')](_0x32c142);return _0x8c8457[_0xd7f1('0x25')]('Content-Range',_0x3b6fde+'-'+_0x44adab+'/'+_0x3f83f1)[_0xd7f1('0x20')](_0x2bb33b);}return null;};}function saveUpdates(_0x17d20f){return function(_0x203e18){if(_0x203e18){return _0x203e18[_0xd7f1('0x26')](_0x17d20f)['then'](function(_0x176afa){return _0x176afa;});}return null;};}function removeEntity(_0x52b714){return function(_0x51144c){if(_0x51144c){return _0x51144c['destroy']()['then'](function(){_0x52b714[_0xd7f1('0x1e')](0xcc)[_0xd7f1('0x1f')]();});}};}function handleEntityNotFound(_0x4b2765){return function(_0x45344e){if(!_0x45344e){_0x4b2765['sendStatus'](0x194);}return _0x45344e;};}function handleError(_0x563be2,_0x7eb48e){_0x7eb48e=_0x7eb48e||0x1f4;return function(_0x41be5e){logger['error'](_0x41be5e[_0xd7f1('0x27')]);if(_0x41be5e[_0xd7f1('0x28')]){delete _0x41be5e[_0xd7f1('0x28')];}_0x563be2[_0xd7f1('0x1e')](_0x7eb48e)[_0xd7f1('0x29')](_0x41be5e);};}function getMustacheRender(_0x122baf,_0x36798d){return Mustache[_0xd7f1('0x2a')](_0x122baf,_[_0xd7f1('0x2b')](_0x36798d[_0xd7f1('0x2c')],{'contact':_0x36798d[_0xd7f1('0x2d')],'message':_0x36798d['message'],'agent':_0x36798d[_0xd7f1('0x2e')],'interaction':_0x36798d[_0xd7f1('0x2f')],'account':_0x36798d['account']}))||'';}exports[_0xd7f1('0x30')]=function(_0x158fa1,_0x42071d){var _0x35d25c={};var _0x4a0aeb=_[_0xd7f1('0x31')](db[_0xd7f1('0x32')]['rawAttributes'],function(_0x3cd225){return{'name':_0x3cd225[_0xd7f1('0x33')],'type':_0x3cd225['type'][_0xd7f1('0x34')]};});_0x35d25c=qs['getOptions'](_0x4a0aeb,_0x158fa1);return interaction['findAll'](_0xd7f1('0x35'),_0x158fa1[_0xd7f1('0x36')],_0x158fa1[_0xd7f1('0x37')],_0x35d25c,_0x4a0aeb)[_0xd7f1('0x38')](respondWithFilteredResult(_0x42071d,_0x35d25c))[_0xd7f1('0x1c')](handleError(_0x42071d,null));};exports[_0xd7f1('0x39')]=function(_0x5c2dc0,_0x3cf43c){var _0x2d8f44={'raw':![],'where':{'id':_0x5c2dc0['params']['id']}},_0x54a021={};_0x54a021[_0xd7f1('0x3a')]=_[_0xd7f1('0x3b')](db[_0xd7f1('0x32')][_0xd7f1('0x3c')]);_0x54a021[_0xd7f1('0x36')]=_[_0xd7f1('0x3b')](_0x5c2dc0[_0xd7f1('0x36')]);_0x54a021[_0xd7f1('0x3d')]=_[_0xd7f1('0x3e')](_0x54a021[_0xd7f1('0x3a')],_0x54a021['query']);_0x2d8f44[_0xd7f1('0x3f')]=_[_0xd7f1('0x3e')](_0x54a021[_0xd7f1('0x3a')],qs[_0xd7f1('0x40')](_0x5c2dc0[_0xd7f1('0x36')][_0xd7f1('0x40')]));_0x2d8f44[_0xd7f1('0x3f')]=_0x2d8f44['attributes'][_0xd7f1('0x41')]?_0x2d8f44[_0xd7f1('0x3f')]:_0x54a021['model'];if(_0x5c2dc0[_0xd7f1('0x36')][_0xd7f1('0x42')]){_0x2d8f44['include']=[{'all':!![]}];}_0x2d8f44=_['merge']({},_0x2d8f44,_0x5c2dc0[_0xd7f1('0x43')]);return db['ChatInteraction']['find'](_0x2d8f44)[_0xd7f1('0x38')](handleEntityNotFound(_0x3cf43c,null))[_0xd7f1('0x38')](respondWithResult(_0x3cf43c,null))[_0xd7f1('0x1c')](handleError(_0x3cf43c,null));};exports[_0xd7f1('0x44')]=function(_0x5f0cdc,_0x1bc89d){return db['ChatInteraction'][_0xd7f1('0x44')](_0x5f0cdc[_0xd7f1('0x2c')],{})[_0xd7f1('0x38')](respondWithResult(_0x1bc89d,0xc9))['catch'](handleError(_0x1bc89d,null));};exports[_0xd7f1('0x26')]=function(_0x2acebd,_0x1bef96){if(_0x2acebd[_0xd7f1('0x2c')]['id']){delete _0x2acebd[_0xd7f1('0x2c')]['id'];}return db[_0xd7f1('0x32')][_0xd7f1('0x45')]({'where':{'id':_0x2acebd['params']['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x1bef96,null))[_0xd7f1('0x38')](saveUpdates(_0x2acebd[_0xd7f1('0x2c')],null))[_0xd7f1('0x38')](respondWithResult(_0x1bef96,null))[_0xd7f1('0x1c')](handleError(_0x1bef96,null));};exports['destroy']=function(_0x4a2a2a,_0x52bab0){return db['ChatInteraction']['find']({'where':{'id':_0x4a2a2a[_0xd7f1('0x46')]['id']}})['then'](handleEntityNotFound(_0x52bab0,null))[_0xd7f1('0x38')](removeEntity(_0x52bab0,null))[_0xd7f1('0x1c')](handleError(_0x52bab0,null));};exports[_0xd7f1('0x47')]=function(_0x4f9552,_0x35d9f0){return db['ChatInteraction'][_0xd7f1('0x47')]()[_0xd7f1('0x38')](respondWithResult(_0x35d9f0,null))[_0xd7f1('0x1c')](handleError(_0x35d9f0,null));};exports['createVidaooSession']=function(_0x3d8da8,_0x2077f7){var _0x343e9c=_0x3d8da8[_0xd7f1('0x46')]['id'];var _0xfba2db;var _0x2d5203;var _0x24eecb;return db[_0xd7f1('0x32')][_0xd7f1('0x48')]({'where':{'id':_0x343e9c}})[_0xd7f1('0x38')](function(_0x351e91){_0xfba2db=_0x351e91;return db[_0xd7f1('0x49')]['findOne']({'where':{'id':_0x351e91[_0xd7f1('0x4a')]},'attributes':['id','vidaooApiKey',_0xd7f1('0x4b'),_0xd7f1('0x4c'),_0xd7f1('0x4d'),_0xd7f1('0x4e')],'raw':!![]});})[_0xd7f1('0x38')](function(_0x4d223f){if(_0x4d223f&&_0x4d223f[_0xd7f1('0x4f')]&&_0x4d223f[_0xd7f1('0x4b')]){_0x2d5203=_0x4d223f;var _0x42b90a={'interaction':{'id':_0x343e9c},'agent':{'id':_0x3d8da8[_0xd7f1('0x37')]['id'],'name':_0x3d8da8['user'][_0xd7f1('0x28')],'fullname':_0x3d8da8[_0xd7f1('0x37')][_0xd7f1('0x50')],'email':_0x3d8da8[_0xd7f1('0x37')][_0xd7f1('0x51')]},'contact':_0x3d8da8['body'][_0xd7f1('0x2d')],'account':_0x3d8da8[_0xd7f1('0x2c')][_0xd7f1('0x52')]};var _0x2a70a4={'rejectUnauthorized':![],'method':_0xd7f1('0x53'),'url':_0xd7f1('0x54'),'headers':{'X-APIKEY':_0x4d223f[_0xd7f1('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3d8da8[_0xd7f1('0x37')][_0xd7f1('0x51')]],'buttons':null,'topic':_0x2d5203[_0xd7f1('0x4c')],'note':_[_0xd7f1('0x55')](_0x2d5203[_0xd7f1('0x4d')])?null:getMustacheRender(_0x2d5203[_0xd7f1('0x4d')],_0x42b90a),'metadata':null},'redirect':_0xd7f1('0x56'),'json':!![]};try{if(!_[_0xd7f1('0x55')](_0x2d5203[_0xd7f1('0x4e')])){var _0x2005b9=getMustacheRender(_0x2d5203[_0xd7f1('0x4e')],_0x42b90a);var _0x8ce093=JSON[_0xd7f1('0x57')](_0x2005b9);_0x2a70a4['body'][_0xd7f1('0x58')]=_0x8ce093;}}catch(_0x5b2d44){throw new db[(_0xd7f1('0x59'))][(_0xd7f1('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2a70a4);}else{throw new db[(_0xd7f1('0x59'))]['ValidationError'](_0xd7f1('0x5b'));}})[_0xd7f1('0x38')](function(_0x26b780){_0x24eecb=_0x26b780;if(_0x24eecb['id']){var _0x168a14={'body':_0x24eecb[_0xd7f1('0x5c')],'ChatWebsiteId':_0x2d5203['id'],'ChatInteractionId':_0xfba2db['id'],'direction':_0xd7f1('0x5d'),'UserId':_0x3d8da8['user']['id']};return db[_0xd7f1('0x5e')][_0xd7f1('0x44')](_0x168a14,{});}else{throw new db[(_0xd7f1('0x59'))][(_0xd7f1('0x5a'))](_0xd7f1('0x5f'));}})['then'](function(){return _0xfba2db[_0xd7f1('0x60')]({'vidaooSessionId':_0x24eecb['id']});})['then'](respondWithResult(_0x2077f7,null))[_0xd7f1('0x1c')](handleError(_0x2077f7,null));};exports[_0xd7f1('0x61')]=function(_0x18cc90,_0x31def8){if(_0x18cc90[_0xd7f1('0x2c')]['id']){delete _0x18cc90['body']['id'];}return db[_0xd7f1('0x32')]['find']({'where':{'id':_0x18cc90[_0xd7f1('0x46')]['id']},'include':[{'model':db[_0xd7f1('0x62')],'as':_0xd7f1('0x63')}]})[_0xd7f1('0x38')](handleEntityNotFound(_0x31def8,null))[_0xd7f1('0x38')](saveUpdates(_0x18cc90['body'],null))[_0xd7f1('0x38')](respondWithResult(_0x31def8,null))[_0xd7f1('0x1c')](handleError(_0x31def8,null));};exports[_0xd7f1('0x64')]=function(_0x2a3a27,_0xd38d03){if(_0x2a3a27[_0xd7f1('0x2c')]['id']){delete _0x2a3a27[_0xd7f1('0x2c')]['id'];}return db[_0xd7f1('0x32')][_0xd7f1('0x45')]({'where':{'id':_0x2a3a27['params']['id']}})['then'](function(_0x2c9f7b){if(!_0x2c9f7b){logger[_0xd7f1('0x18')](_0xd7f1('0x65'),_0xd7f1('0x64'),0x194,_0xd7f1('0x66'));_0xd38d03[_0xd7f1('0x1d')](0x194);}else{if(_0x2c9f7b[_0xd7f1('0x67')]){throw new db[(_0xd7f1('0x59'))][(_0xd7f1('0x5a'))](_0xd7f1('0x68'));}}return _0x2c9f7b;})['then'](function(_0xda5ae0){if(_0xda5ae0){return _0xda5ae0['update']({'closed':_0x2a3a27[_0xd7f1('0x2c')][_0xd7f1('0x69')],'disposition':_0x2a3a27[_0xd7f1('0x2c')][_0xd7f1('0x6a')]})[_0xd7f1('0x38')](function(_0x1d778a){return _0x1d778a;});}})[_0xd7f1('0x38')](function(){return respondWithRpcPromise(_0xd7f1('0x6b'),_0xd7f1('0x64'),_0x2a3a27[_0xd7f1('0x2c')],client9004);})[_0xd7f1('0x38')](respondWithResult(_0xd38d03,null))['catch'](handleError(_0xd38d03,null));};exports[_0xd7f1('0x6c')]=function(_0xdba8e2,_0xb1b415){_0xdba8e2['body'][_0xd7f1('0x28')]=_0xdba8e2[_0xd7f1('0x6d')][_0xd7f1('0x6e')];_0xdba8e2[_0xd7f1('0x2c')][_0xd7f1('0x6f')]=_0xdba8e2[_0xd7f1('0x6d')][_0xd7f1('0x70')];_0xdba8e2[_0xd7f1('0x2c')]['type']=_0xdba8e2[_0xd7f1('0x6d')]['mimetype'];return db[_0xd7f1('0x71')][_0xd7f1('0x44')](_0xdba8e2[_0xd7f1('0x2c')])[_0xd7f1('0x38')](respondWithResult(_0xb1b415,0xc9))[_0xd7f1('0x1c')](handleError(_0xb1b415,null));};exports[_0xd7f1('0x72')]=function(_0x18b2e8,_0x277a4d){return db[_0xd7f1('0x32')][_0xd7f1('0x48')]({'where':{'id':_0x18b2e8[_0xd7f1('0x46')]['id']},'raw':!![]})[_0xd7f1('0x38')](handleEntityNotFound(_0x277a4d,null))['then'](function(_0x16d9df){if(_0x16d9df){if(_0x16d9df[_0xd7f1('0x69')]){return _0x277a4d['status'](0x193)[_0xd7f1('0x20')]({'status':0x193,'message':_0xd7f1('0x73')});}return db[_0xd7f1('0x71')][_0xd7f1('0x48')]({'where':{'id':_0x18b2e8[_0xd7f1('0x36')][_0xd7f1('0x74')]},'raw':!![]})['then'](handleEntityNotFound(_0x277a4d,null));}})[_0xd7f1('0x38')](function(_0x2d2a50){if(_0x2d2a50){var _0x28b3b1=_0x2d2a50['ChatOfflineMessageId']!==null;var _0x14ece6=path[_0xd7f1('0x75')](config['root'],'server/files/attachments/');if(_0x28b3b1){_0x14ece6=path['join'](_0x14ece6,_0xd7f1('0x76'));}var _0xea926c=path[_0xd7f1('0x75')](_0x14ece6,_0x2d2a50[_0xd7f1('0x6f')]);return _0x277a4d[_0xd7f1('0x77')](_0xea926c);}})[_0xd7f1('0x1c')](handleError(_0x277a4d,null));};exports[_0xd7f1('0x78')]=function(_0x8cd360,_0x465cc4){var _0x3955c0=null;var _0xbf12a4=null;var _0x32be9b=null;if(_0x8cd360[_0xd7f1('0x2c')]['id']){delete _0x8cd360['body']['id'];}if(_0x8cd360[_0xd7f1('0x2c')][_0xd7f1('0x79')]){_0x32be9b=path[_0xd7f1('0x75')](config['root'],'server/files/chat/upload/',util[_0xd7f1('0x7a')](_0xd7f1('0x7b'),Date[_0xd7f1('0x7c')]()));_0x8cd360[_0xd7f1('0x2c')][_0xd7f1('0x7d')]=_0x32be9b;}return db[_0xd7f1('0x32')][_0xd7f1('0x45')]({'where':{'id':_0x8cd360['params']['id']},'include':[{'model':db[_0xd7f1('0x5e')],'as':_0xd7f1('0x7e'),'include':[{'model':db['User'],'as':_0xd7f1('0x7f')}]}]})['then'](handleEntityNotFound(_0x465cc4,null))[_0xd7f1('0x38')](saveUpdates(_0x8cd360[_0xd7f1('0x2c')],null))['then'](function(_0x3ac2d1){if(_0x3ac2d1){_0x3955c0=_0x3ac2d1;return db[_0xd7f1('0x49')][_0xd7f1('0x45')]({'where':{'id':_0x3955c0[_0xd7f1('0x4a')]}});}})[_0xd7f1('0x38')](function(_0x5a5d29){if(_0x5a5d29){_0xbf12a4=_0x5a5d29;return db[_0xd7f1('0x62')][_0xd7f1('0x45')]({'where':{'id':_0x3955c0['ContactId']}});}})['then'](function(_0xbb3400){if(_0xbb3400){if(_0x32be9b){var _0x145346=null;for(var _0x48a5ac=0x1;_0x48a5ac<_0x3955c0[_0xd7f1('0x7e')][_0xd7f1('0x41')];++_0x48a5ac){_0x145346=_0x3955c0[_0xd7f1('0x7e')][_0x48a5ac];var _0xaabcb7=_0x145346[_0xd7f1('0x67')]?util[_0xd7f1('0x7a')]('%s%d',_0xbf12a4[_0xd7f1('0x80')],_0x145346[_0xd7f1('0x67')]):_0xd7f1('0x81');var _0x240d0d=_0x8cd360['body'][_0xd7f1('0x82')]||util[_0xd7f1('0x7a')](_0xd7f1('0x83'),_0xd7f1('0x84'),_0x145346[_0xd7f1('0x85')]);switch(_0xbf12a4['agentIdentifier']){case'website_alias':_0xaabcb7=_0x145346['UserId']?util[_0xd7f1('0x7a')](_0xd7f1('0x83'),_0xbf12a4[_0xd7f1('0x80')],_0x145346[_0xd7f1('0x67')]):'System';break;case'agent_alias':_0xaabcb7=_0x145346['UserId']?_0x145346[_0xd7f1('0x7f')][_0xd7f1('0x86')]||_0x145346[_0xd7f1('0x7f')]['fullname']:_0xd7f1('0x81');break;case _0xd7f1('0x87'):_0xaabcb7=_0x145346['UserId']?_0x145346[_0xd7f1('0x7f')][_0xd7f1('0x50')]:'System';break;default:_0xaabcb7=_0x145346[_0xd7f1('0x67')]?util[_0xd7f1('0x7a')](_0xd7f1('0x83'),_0xbf12a4['agentAlias'],_0x145346[_0xd7f1('0x67')]):'System';}var _0x1e7cae=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x145346[_0xd7f1('0x88')])[_0xd7f1('0x7a')]('MM/DD/YYYY\x20HH:mm:ss'),_0x145346[_0xd7f1('0x89')]==='in'?_0x240d0d:_0xaabcb7,_0x145346[_0xd7f1('0x2c')]);if(!_0x145346[_0xd7f1('0x8a')]){fs[_0xd7f1('0x8b')](_0x32be9b,_0x1e7cae);}}return db['MailAccount'][_0xd7f1('0x48')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd7f1('0x8c'),'raw':!![],'include':[{'model':db[_0xd7f1('0x8d')],'as':_0xd7f1('0x8d'),'raw':!![]}]}]});}}})[_0xd7f1('0x38')](function(_0x449fc5){if(!_0x449fc5||!_0x449fc5[_0xd7f1('0x8c')]||!_0x8cd360[_0xd7f1('0x2c')])return _0x3955c0;var _0x1f6692=_0x449fc5[_0xd7f1('0x8e')]();return respondWithRpcPromise(_0xd7f1('0x8f'),_0xd7f1('0x90'),{'account':_0x1f6692,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x449fc5[_0xd7f1('0x28')],_0x449fc5[_0xd7f1('0x51')]||_0x449fc5[_0xd7f1('0x8c')][_0xd7f1('0x37')]),'to':_0x8cd360[_0xd7f1('0x2c')][_0xd7f1('0x79')],'subject':'Mail\x20Transcript','text':util['format'](_0xd7f1('0x91'),_0x8cd360['body']['mailTranscript']),'attachments':[{'path':_0x32be9b}]}})['then'](function(){return _0x3955c0;})[_0xd7f1('0x1c')](function(_0x3d52a8){logger['error'](_0x3d52a8);});})['then'](respondWithStatusCode(_0x465cc4,0xc8))[_0xd7f1('0x1c')](handleError(_0x465cc4,null));};exports[_0xd7f1('0x92')]=function(_0x3327c0,_0x593b3e){return db[_0xd7f1('0x5e')][_0xd7f1('0x45')]({'where':{'id':_0x3327c0['params']['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x593b3e,null))[_0xd7f1('0x38')](function(_0x22856b){if(_0x22856b){return _0x22856b[_0xd7f1('0x92')](_0x3327c0[_0xd7f1('0x2c')][_0xd7f1('0x93')],_['omit'](_0x3327c0[_0xd7f1('0x2c')],[_0xd7f1('0x93'),'id'])||{});}})[_0xd7f1('0x38')](respondWithResult(_0x593b3e,null))[_0xd7f1('0x1c')](handleError(_0x593b3e,null));};exports[_0xd7f1('0x94')]=function(_0x4036ef,_0x1dfdaf){var _0x519cd5={'raw':![],'where':{}};var _0x52ea41={};var _0x364503={'count':0x0,'rows':[]};return db[_0xd7f1('0x32')][_0xd7f1('0x48')]({'where':{'id':_0x4036ef['params']['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x1dfdaf,null))[_0xd7f1('0x38')](function(_0xf82973){if(_0xf82973){_0x52ea41[_0xd7f1('0x3a')]=_[_0xd7f1('0x3b')](db['ChatMessage'][_0xd7f1('0x3c')]);_0x52ea41[_0xd7f1('0x36')]=_[_0xd7f1('0x3b')](_0x4036ef[_0xd7f1('0x36')]);_0x52ea41[_0xd7f1('0x3d')]=_['intersection'](_0x52ea41[_0xd7f1('0x3a')],_0x52ea41['query']);_0x519cd5[_0xd7f1('0x3f')]=_[_0xd7f1('0x3e')](_0x52ea41[_0xd7f1('0x3a')],qs[_0xd7f1('0x40')](_0x4036ef['query'][_0xd7f1('0x40')]));_0x519cd5['attributes']=_0x519cd5['attributes']['length']?_0x519cd5[_0xd7f1('0x3f')]:_0x52ea41[_0xd7f1('0x3a')];if(!_0x4036ef['query'][_0xd7f1('0x95')](_0xd7f1('0x96'))){_0x519cd5[_0xd7f1('0x24')]=qs[_0xd7f1('0x24')](_0x4036ef[_0xd7f1('0x36')][_0xd7f1('0x24')]);_0x519cd5[_0xd7f1('0x21')]=qs['offset'](_0x4036ef['query'][_0xd7f1('0x21')]);}_0x519cd5[_0xd7f1('0x97')]=qs[_0xd7f1('0x98')](_0x4036ef['query'][_0xd7f1('0x98')]);_0x519cd5[_0xd7f1('0x99')]=qs[_0xd7f1('0x3d')](_[_0xd7f1('0x9a')](_0x4036ef[_0xd7f1('0x36')],_0x52ea41['filters']));_0x519cd5[_0xd7f1('0x99')][_0xd7f1('0x9b')]=_0xf82973['id'];if(_0x4036ef['query'][_0xd7f1('0x9c')]){_0x519cd5[_0xd7f1('0x99')]=_[_0xd7f1('0x2b')](_0x519cd5['where'],{'$or':_[_0xd7f1('0x31')](_0x519cd5[_0xd7f1('0x3f')],function(_0x1c3f2d){var _0x41a08d={};_0x41a08d[_0x1c3f2d]={'$like':'%'+_0x4036ef[_0xd7f1('0x36')][_0xd7f1('0x9c')]+'%'};return _0x41a08d;})});}if(_0x4036ef[_0xd7f1('0x36')][_0xd7f1('0x9d')]){var _0x44c328=_0x4036ef[_0xd7f1('0x36')][_0xd7f1('0x9d')][_0xd7f1('0x9e')](',');var _0x194e9a={};_0x194e9a[_0x44c328[0x0]]={'$gte':moment(_0x44c328[0x1])[_0xd7f1('0x7a')](_0xd7f1('0x9f'))};_0x519cd5[_0xd7f1('0x99')]=_[_0xd7f1('0x2b')](_0x519cd5[_0xd7f1('0x99')],_0x194e9a);}_0x519cd5=_[_0xd7f1('0x2b')]({},_0x519cd5,_0x4036ef[_0xd7f1('0x43')]);return db['ChatMessage'][_0xd7f1('0x23')]({'where':_0x519cd5['where']})[_0xd7f1('0x38')](function(_0xb19e0a){_0x364503['count']=_0xb19e0a;if(_0x4036ef[_0xd7f1('0x36')][_0xd7f1('0x42')]){_0x519cd5['include']=[{'all':!![]}];}return db[_0xd7f1('0x5e')][_0xd7f1('0xa0')](_0x519cd5);})[_0xd7f1('0x38')](function(_0x3fc5a6){_0x364503[_0xd7f1('0xa1')]=_0x3fc5a6;return _0x364503;});}})[_0xd7f1('0x38')](respondWithFilteredResult(_0x1dfdaf,_0x519cd5))['catch'](handleError(_0x1dfdaf,null));};exports[_0xd7f1('0xa2')]=function(_0x368e48,_0x2d8032){var _0x4f676c={'where':{}},_0x140ebb={},_0x5181be={'count':0x0,'rows':[]};return db[_0xd7f1('0x32')][_0xd7f1('0x48')]({'where':{'id':_0x368e48[_0xd7f1('0x46')]['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x2d8032,null))[_0xd7f1('0x38')](function(_0x590828){if(_0x590828){_0x140ebb[_0xd7f1('0x3a')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x140ebb[_0xd7f1('0x36')]=_['keys'](_0x368e48['query']);_0x140ebb[_0xd7f1('0x3d')]=_['intersection'](_0x140ebb[_0xd7f1('0x3a')],_0x140ebb[_0xd7f1('0x36')]);_0x4f676c[_0xd7f1('0x3f')]=_['intersection'](_0x140ebb[_0xd7f1('0x3a')],qs[_0xd7f1('0x40')](_0x368e48[_0xd7f1('0x36')]['fields']));_0x4f676c[_0xd7f1('0x3f')]=_0x4f676c[_0xd7f1('0x3f')][_0xd7f1('0x41')]?_0x4f676c['attributes']:_0x140ebb[_0xd7f1('0x3a')];if(!_0x368e48['query'][_0xd7f1('0x95')](_0xd7f1('0x96'))){_0x4f676c[_0xd7f1('0x24')]=qs['limit'](_0x368e48[_0xd7f1('0x36')][_0xd7f1('0x24')]);_0x4f676c[_0xd7f1('0x21')]=qs[_0xd7f1('0x21')](_0x368e48[_0xd7f1('0x36')]['offset']);}_0x4f676c[_0xd7f1('0x97')]=qs[_0xd7f1('0x98')](_0x368e48[_0xd7f1('0x36')][_0xd7f1('0x98')]);_0x4f676c[_0xd7f1('0x99')]=qs[_0xd7f1('0x3d')](_['pick'](_0x368e48[_0xd7f1('0x36')],_0x140ebb[_0xd7f1('0x3d')]));_0x4f676c['where']['ChatInteractionId']=_0x590828['id'];if(_0x368e48[_0xd7f1('0x36')][_0xd7f1('0x9c')]){_0x4f676c[_0xd7f1('0x99')]=_[_0xd7f1('0x2b')](_0x4f676c['where'],{'$or':_[_0xd7f1('0x31')](_0x4f676c[_0xd7f1('0x3f')],function(_0x253327){var _0x345abc={};_0x345abc[_0x253327]={'$like':'%'+_0x368e48[_0xd7f1('0x36')][_0xd7f1('0x9c')]+'%'};return _0x345abc;})});}_0x4f676c[_0xd7f1('0x99')]['secret']=![];if(_0x368e48['query']['id']){_0x4f676c[_0xd7f1('0x99')]['id']={'$gt':_0x368e48[_0xd7f1('0x36')]['id']};}_0x4f676c=_[_0xd7f1('0x2b')]({},_0x4f676c,_0x368e48[_0xd7f1('0x43')]);return db['ChatMessage'][_0xd7f1('0x23')]({'where':_0x4f676c[_0xd7f1('0x99')]})[_0xd7f1('0x38')](function(_0x234c84){_0x5181be[_0xd7f1('0x23')]=_0x234c84;_0x4f676c[_0xd7f1('0xa3')]=[];if(_0x368e48[_0xd7f1('0x36')][_0xd7f1('0xa4')]){_0x4f676c[_0xd7f1('0xa3')][_0xd7f1('0xa5')]({'model':db[_0xd7f1('0x7f')],'as':_0xd7f1('0x7f'),'attributes':['id',_0xd7f1('0x50'),_0xd7f1('0x86')]});}if(_0x368e48[_0xd7f1('0x36')][_0xd7f1('0x42')]){_0x4f676c[_0xd7f1('0xa3')]=[{'all':!![]}];}return db['ChatMessage'][_0xd7f1('0xa0')](_0x4f676c);})[_0xd7f1('0x38')](function(_0x209e9d){_0x5181be['rows']=_0x209e9d;return _0x5181be;});}})[_0xd7f1('0x38')](respondWithFilteredResult(_0x2d8032,_0x4f676c))[_0xd7f1('0x1c')](handleError(_0x2d8032,null));};exports[_0xd7f1('0xa6')]=function(_0x479fda,_0x324210){return db['ChatInteraction']['find']({'where':{'id':_0x479fda['params']['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x324210,null))[_0xd7f1('0x38')](function(_0x59066a){if(_0x59066a){return _0x59066a[_0xd7f1('0xa7')](_0x479fda[_0xd7f1('0x2c')]['ids'],_[_0xd7f1('0xa8')](_0x479fda[_0xd7f1('0x2c')],['ids','id'])||{})['spread'](function(){return db[_0xd7f1('0xa9')][_0xd7f1('0xa0')]({'attributes':['id',_0xd7f1('0x28'),'color'],'where':{'id':_0x479fda['body'][_0xd7f1('0x93')]}});})[_0xd7f1('0x38')](function(_0x3657c0){socket['emit']('chatInteractionTags:save',{'id':Number(_0x479fda[_0xd7f1('0x46')]['id']),'tags':_0x3657c0||[]});return{'id':Number(_0x479fda['params']['id']),'tags':_0x3657c0||[]};});}})[_0xd7f1('0x38')](respondWithResult(_0x324210,null))[_0xd7f1('0x1c')](handleError(_0x324210,null));};exports['removeTags']=function(_0x25b763,_0x25d799){return db[_0xd7f1('0x32')][_0xd7f1('0x45')]({'where':{'id':_0x25b763['params']['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x25d799,null))[_0xd7f1('0x38')](function(_0x2d5a9a){if(_0x2d5a9a){return _0x2d5a9a['removeTags'](_0x25b763['query'][_0xd7f1('0x93')]);}})['then'](respondWithStatusCode(_0x25d799,null))[_0xd7f1('0x1c')](handleError(_0x25d799,null));};exports['download']=function(_0x3ab014,_0x2361bd){var _0x3a1f10=moment()[_0xd7f1('0xaa')]()[_0xd7f1('0xab')]();var _0x25572d=path[_0xd7f1('0x75')](config[_0xd7f1('0xac')],_0xd7f1('0xad'),'files',_0xd7f1('0xae'));var _0x562f63=path[_0xd7f1('0x75')](config['root'],_0xd7f1('0xad'),_0xd7f1('0xaf'),_0xd7f1('0xb0'));var _0x523288=path[_0xd7f1('0x75')](_0x25572d,_0x3a1f10);var _0x1c318a=util[_0xd7f1('0x7a')]('transcript-%d-%s.zip',_0x3ab014[_0xd7f1('0x46')]['id'],_0x3a1f10);var _0x34f908=path['join'](_0x25572d,_0x1c318a);var _0x1f84a1=[];_0x1f84a1[_0xd7f1('0xa5')]({'model':db[_0xd7f1('0x7f')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1f84a1[_0xd7f1('0xa5')]({'model':db[_0xd7f1('0x62')],'as':_0xd7f1('0x63'),'attributes':['id',_0xd7f1('0xb1'),_0xd7f1('0xb2')],'raw':!![]});if(_0x3ab014[_0xd7f1('0x36')][_0xd7f1('0xb0')]){_0x1f84a1[_0xd7f1('0xa5')]({'model':db[_0xd7f1('0x71')],'as':'Attachment','raw':!![]});}var _0x34b26e=[{'model':db[_0xd7f1('0x5e')],'as':'Messages','attributes':['id','body',_0xd7f1('0x88'),_0xd7f1('0x89'),'secret','read'],'include':_0x1f84a1}];_0x34b26e['push']({'model':db[_0xd7f1('0x49')],'as':_0xd7f1('0xb3'),'attributes':['id',_0xd7f1('0x28')]});_0x34b26e['push']({'model':db[_0xd7f1('0x7f')],'as':_0xd7f1('0xb4'),'attributes':['id','fullname']});return db[_0xd7f1('0x32')][_0xd7f1('0x45')]({'where':{'id':_0x3ab014['params']['id']},'include':_0x34b26e})[_0xd7f1('0x38')](handleEntityNotFound(_0x2361bd,null))[_0xd7f1('0x38')](function(_0x4e2269){if(_0x4e2269){var _0x3ee709=_0x4e2269[_0xd7f1('0xb5')]({'plain':!![]});fs[_0xd7f1('0xb6')](_0x523288);var _0x4b259d={'channel':_0xd7f1('0xb7'),'account':_0x3ee709[_0xd7f1('0xb3')][_0xd7f1('0x28')],'agent':_0x3ee709['Owner']?_0x3ee709[_0xd7f1('0xb4')][_0xd7f1('0x50')]:_0xd7f1('0xb8'),'createdAt':moment(_0x3ee709[_0xd7f1('0x88')])[_0xd7f1('0x7a')](_0xd7f1('0x9f'))[_0xd7f1('0xab')](),'closedAt':_0x3ee709[_0xd7f1('0x69')]?moment(_0x3ee709[_0xd7f1('0xb9')])[_0xd7f1('0x7a')](_0xd7f1('0x9f'))['toString']():'','disposition':_0x3ee709['disposition'],'chatInfo':{'browser':_0x3ee709[_0xd7f1('0xba')],'os':_0x3ee709[_0xd7f1('0xbb')],'referer':_0x3ee709[_0xd7f1('0xbc')],'customerIp':_0x3ee709[_0xd7f1('0xbd')],'customerPort':_0x3ee709[_0xd7f1('0xbe')]?_0x3ee709[_0xd7f1('0xbe')]:_0xd7f1('0xb8')},'messages':_(_0x3ee709['Messages'])[_0xd7f1('0xbf')]()[_0xd7f1('0x9c')]({'secret':![]})[_0xd7f1('0x31')](function(_0xe4715e){if(_0xe4715e['Attachment']){var _0x6cc653=path[_0xd7f1('0x75')](_0x562f63,_0xe4715e[_0xd7f1('0x71')][_0xd7f1('0x6f')]);if(fs[_0xd7f1('0xc0')](_0x6cc653)){fs[_0xd7f1('0xc1')](_0x6cc653)[_0xd7f1('0xc2')](fs[_0xd7f1('0xc3')](path[_0xd7f1('0x75')](_0x523288,_0xe4715e['Attachment'][_0xd7f1('0x6f')])));}}return{'date':moment(_0xe4715e[_0xd7f1('0x88')])[_0xd7f1('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd7f1('0xab')](),'sender':_0xe4715e[_0xd7f1('0x89')]===_0xd7f1('0x5d')?_0xe4715e['User']?_0xe4715e[_0xd7f1('0x7f')]['fullname']:_0xd7f1('0x81'):_0xe4715e[_0xd7f1('0x63')]['firstName']+(_0xe4715e[_0xd7f1('0x63')][_0xd7f1('0xb2')]?'\x20'+_0xe4715e[_0xd7f1('0x63')][_0xd7f1('0xb2')]:''),'body':_0xe4715e[_0xd7f1('0x71')]?_0xe4715e[_0xd7f1('0x71')]['basename']:_0xe4715e[_0xd7f1('0x2c')],'direction':_0xe4715e['direction']===_0xd7f1('0x5d')?'A':'C','secret':_0xe4715e['secret'],'read':_0xe4715e[_0xd7f1('0xc4')],'attachment':_0xe4715e[_0xd7f1('0x71')]};})['value']()};return ejs['renderFile'](path[_0xd7f1('0x75')](config[_0xd7f1('0xac')],_0xd7f1('0xad'),_0xd7f1('0xc5'),'downloadInteraction.ejs'),{'interaction':_0x4b259d})[_0xd7f1('0x38')](function(_0x9b102a){var _0x522e30=path[_0xd7f1('0x75')](_0x523288,_0xd7f1('0xc6')+_0x3ee709['id']+'-'+_0x3a1f10+_0xd7f1('0xc7'));var _0x42c7da={'path':_0x522e30,'channel':_0xd7f1('0xb7'),'interactionId':_0x3ee709['id']};return pdf[_0xd7f1('0xc8')](_0x9b102a,_0x42c7da);})[_0xd7f1('0x38')](function(){return new Promise(function(_0x1ebba8,_0x4da180){zipdir(_0x523288,{'saveTo':_0x34f908},function(_0x2054ad,_0x595d0b){if(_0x2054ad)return _0x4da180(_0x2054ad);return _0x1ebba8(_0x595d0b);});})[_0xd7f1('0x38')](function(){return new BPromise(function(_0x246609,_0x5c1ac7){rimraf(_0x523288,function(_0x5dfa2e){if(_0x5dfa2e)_0x5c1ac7(_0x5dfa2e);return _0x246609();});});})[_0xd7f1('0x38')](function(){return _0x2361bd['download'](_0x34f908,_0x1c318a,function(_0x37286b){if(_0x37286b){logger['error']('err',_0x37286b);}else{fs[_0xd7f1('0xc9')](_0x34f908);}});});});}else{return _0x2361bd[_0xd7f1('0x1d')](0xc8);}})[_0xd7f1('0x1c')](handleError(_0x2361bd,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 645a203..23a76dc 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 _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 +var _0x1634=['findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map'];(function(_0x3112d0,_0x55961c){var _0x2ea0e1=function(_0x16c64c){while(--_0x16c64c){_0x3112d0['push'](_0x3112d0['shift']());}};_0x2ea0e1(++_0x55961c);}(_0x1634,0x198));var _0x4163=function(_0x52a755,_0x237d81){_0x52a755=_0x52a755-0x0;var _0x280129=_0x1634[_0x52a755];return _0x280129;};'use strict';var EventEmitter=require(_0x4163('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x4163('0x1')];var ChatMessage=require(_0x4163('0x2'))['db'][_0x4163('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4163('0x4')](0x0);var events={'afterCreate':_0x4163('0x5'),'afterUpdate':_0x4163('0x6'),'afterDestroy':_0x4163('0x7')};function emitEvent(_0x5b5321){return function(_0x5b27db,_0x3dec77,_0x106c6e){_0x5b27db[_0x4163('0x8')]({'attributes':['id'],'raw':!![]})[_0x4163('0x9')](function(_0x1a7af2){_0x5b27db['setDataValue'](_0x4163('0xa'),_0x1a7af2[_0x4163('0xb')](function(_0x206953){return{'id':_0x206953['id']};}));return ChatMessage[_0x4163('0xc')]({'where':{'ChatInteractionId':_0x5b27db['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xba6389){_0x5b27db[_0x4163('0xd')](_0x4163('0xe'),_0xba6389[_0x4163('0xf')]);ChatInteractionEvents['emit'](_0x5b5321+':'+_0x5b27db['id'],_0x5b27db);ChatInteractionEvents[_0x4163('0x10')](_0x5b5321,_0x5b27db);_0x106c6e(null);})[_0x4163('0x11')](_0x106c6e(null));};}for(var e in events){if(events[_0x4163('0x12')](e)){var event=events[e];ChatInteraction[_0x4163('0x13')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b5f4eff..46b3f66 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 _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 +var _0x9f07=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions'];(function(_0x15148b,_0x4dd6cf){var _0x3bdf7f=function(_0x4dcec8){while(--_0x4dcec8){_0x15148b['push'](_0x15148b['shift']());}};_0x3bdf7f(++_0x4dd6cf);}(_0x9f07,0x71));var _0x79f0=function(_0x29326c,_0x125d69){_0x29326c=_0x29326c-0x0;var _0x20aba9=_0x9f07[_0x29326c];return _0x20aba9;};'use strict';var _=require(_0x79f0('0x0'));var util=require(_0x79f0('0x1'));var logger=require(_0x79f0('0x2'))(_0x79f0('0x3'));var moment=require(_0x79f0('0x4'));var BPromise=require('bluebird');var rp=require(_0x79f0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79f0('0x6'));var config=require(_0x79f0('0x7'));var attributes=require(_0x79f0('0x8'));module[_0x79f0('0x9')]=function(_0x76e394,_0x734381){return _0x76e394[_0x79f0('0xa')](_0x79f0('0xb'),attributes,{'tableName':_0x79f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a08fa,_0xd9b1cf,_0x17318f){if(_0x2a08fa[_0x79f0('0xd')](_0x79f0('0xe'))){_0x2a08fa['closedAt']=moment()[_0x79f0('0xf')](_0x79f0('0x10'));}_0x17318f(null,_0x2a08fa);}},'charset':'utf8mb4','collate':_0x79f0('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ce5cfe7..52e8290 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 _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 +var _0x3c32=['error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','info','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./chatInteraction.socket','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x28b057,_0x205efa){var _0x781d8d=function(_0x23aeb4){while(--_0x23aeb4){_0x28b057['push'](_0x28b057['shift']());}};_0x781d8d(++_0x205efa);}(_0x3c32,0x11d));var _0x23c3=function(_0x55028d,_0x3d7980){_0x55028d=_0x55028d-0x0;var _0x17fd1e=_0x3c32[_0x55028d];return _0x17fd1e;};'use strict';var _=require(_0x23c3('0x0'));var util=require('util');var moment=require(_0x23c3('0x1'));var BPromise=require(_0x23c3('0x2'));var rs=require(_0x23c3('0x3'));var fs=require('fs');var Redis=require(_0x23c3('0x4'));var db=require(_0x23c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x23c3('0x6'))(_0x23c3('0x7'));var config=require(_0x23c3('0x8'));var jayson=require(_0x23c3('0x9'));var client=jayson[_0x23c3('0xa')][_0x23c3('0xb')]({'port':0x232a});config['redis']=_[_0x23c3('0xc')](config[_0x23c3('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23c3('0xd')]));require(_0x23c3('0xe'))['register'](socket);function respondWithRpcPromise(_0x212d6b,_0xe9304b,_0xd580b1){return new BPromise(function(_0x70e6d6,_0x553657){return client['request'](_0x212d6b,_0xd580b1)[_0x23c3('0xf')](function(_0x4ea131){logger['info'](_0x23c3('0x10'),_0xe9304b,_0x23c3('0x11'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xe9304b,_0x23c3('0x11'),JSON[_0x23c3('0x12')](_0x4ea131));if(_0x4ea131['error']){if(_0x4ea131[_0x23c3('0x13')][_0x23c3('0x14')]===0x1f4){logger[_0x23c3('0x13')](_0x23c3('0x10'),_0xe9304b,_0x4ea131[_0x23c3('0x13')][_0x23c3('0x15')]);return _0x553657(_0x4ea131[_0x23c3('0x13')][_0x23c3('0x15')]);}logger[_0x23c3('0x13')]('ChatInteraction,\x20%s,\x20%s',_0xe9304b,_0x4ea131[_0x23c3('0x13')][_0x23c3('0x15')]);return _0x70e6d6(_0x4ea131['error'][_0x23c3('0x15')]);}else{logger['info'](_0x23c3('0x10'),_0xe9304b,_0x23c3('0x11'));_0x70e6d6(_0x4ea131[_0x23c3('0x16')][_0x23c3('0x15')]);}})[_0x23c3('0x17')](function(_0x28ee27){logger['error'](_0x23c3('0x10'),_0xe9304b,_0x28ee27);_0x553657(_0x28ee27);});});}exports[_0x23c3('0x18')]=function(_0x2f17cf){var _0x55bf1e=this;return new Promise(function(_0x3d60e0,_0x5aa35e){return db[_0x23c3('0x19')][_0x23c3('0x1a')](_0x2f17cf['body'],{'raw':_0x2f17cf[_0x23c3('0x1b')]?_0x2f17cf[_0x23c3('0x1b')][_0x23c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f17cf[_0x23c3('0x1b')]?_0x2f17cf[_0x23c3('0x1b')][_0x23c3('0x1d')]||null:null,'attributes':_0x2f17cf[_0x23c3('0x1b')]?_0x2f17cf[_0x23c3('0x1b')][_0x23c3('0x1e')]||null:null,'limit':_0x2f17cf[_0x23c3('0x1b')]?_0x2f17cf[_0x23c3('0x1b')][_0x23c3('0x1f')]||null:null})['then'](function(_0x4e451b){logger[_0x23c3('0x20')](_0x23c3('0x18'),_0x2f17cf);logger['debug']('UpdateChatInteraction',_0x2f17cf,JSON[_0x23c3('0x12')](_0x4e451b));_0x3d60e0(_0x4e451b);})[_0x23c3('0x17')](function(_0x1465a5){logger[_0x23c3('0x13')](_0x23c3('0x18'),_0x1465a5[_0x23c3('0x15')],_0x2f17cf);_0x5aa35e(_0x55bf1e[_0x23c3('0x13')](0x1f4,_0x1465a5[_0x23c3('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x1f97a7){return new Promise(function(_0x45dee2,_0x3c4e86){return db['ChatInteraction']['find']({'where':_0x1f97a7['options']?_0x1f97a7['options'][_0x23c3('0x1d')]||null:null})['then'](function(_0x1a1ed0){if(_0x1a1ed0){return _0x1a1ed0['addTags'](_0x1f97a7[_0x23c3('0x21')][_0x23c3('0x22')],_[_0x23c3('0x23')](_0x1f97a7[_0x23c3('0x21')],['ids','id'])||{});}})[_0x23c3('0x24')](function(_0x5e5c0d){logger[_0x23c3('0x20')](_0x23c3('0x25'),_0x1f97a7);logger['debug'](_0x23c3('0x25'),_0x1f97a7,JSON[_0x23c3('0x12')](_0x5e5c0d));_0x45dee2(_0x5e5c0d);})[_0x23c3('0x17')](function(_0x368c0e){logger[_0x23c3('0x13')](_0x23c3('0x25'),_0x368c0e['message'],_0x1f97a7);_0x3c4e86(_this[_0x23c3('0x13')](0x1f4,_0x368c0e[_0x23c3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 9d50915..25d4073 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 _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 +var _0xd6e1=['emit','removeListener','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x4ce422,_0x100a18){var _0x4ae250=function(_0x309ac0){while(--_0x309ac0){_0x4ce422['push'](_0x4ce422['shift']());}};_0x4ae250(++_0x100a18);}(_0xd6e1,0x9c));var _0x1d6e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd6e1[_0x21a9d9];return _0x46adce;};'use strict';var ChatInteractionEvents=require(_0x1d6e('0x0'));var events=[_0x1d6e('0x1'),_0x1d6e('0x2'),_0x1d6e('0x3')];function createListener(_0x2fdb6d,_0x1b5666){return function(_0x360601){_0x1b5666[_0x1d6e('0x4')](_0x2fdb6d,_0x360601);};}function removeListener(_0x5b24d4,_0x5ad7cb){return function(){ChatInteractionEvents[_0x1d6e('0x5')](_0x5b24d4,_0x5ad7cb);};}exports['register']=function(_0x7e022f){for(var _0x44f06f=0x0,_0x2a3bba=events[_0x1d6e('0x6')];_0x44f06f<_0x2a3bba;_0x44f06f++){var _0x5a218c=events[_0x44f06f];var _0x2da0ae=createListener(_0x1d6e('0x7')+_0x5a218c,_0x7e022f);ChatInteractionEvents['on'](_0x5a218c,_0x2da0ae);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 19864fb..ea8e41b 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 _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 +var _0x335e=['originalname','replace','single','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','/describe','isAuthenticated','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','format','%s-%s','now'];(function(_0xb4e052,_0x1d3cb6){var _0x5197e7=function(_0x9bc429){while(--_0x9bc429){_0xb4e052['push'](_0xb4e052['shift']());}};_0x5197e7(++_0x1d3cb6);}(_0x335e,0xaf));var _0xe335=function(_0x48d9cc,_0x5a0935){_0x48d9cc=_0x48d9cc-0x0;var _0x41078e=_0x335e[_0x48d9cc];return _0x41078e;};'use strict';var multer=require('multer');var util=require(_0xe335('0x0'));var path=require(_0xe335('0x1'));var timeout=require(_0xe335('0x2'));var express=require(_0xe335('0x3'));var router=express['Router']();var fs_extra=require(_0xe335('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe335('0x5'));var config=require(_0xe335('0x6'));var controller=require(_0xe335('0x7'));router[_0xe335('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe335('0x8')](_0xe335('0x9'),auth[_0xe335('0xa')](),controller['describe']);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller[_0xe335('0xb')]);router[_0xe335('0x8')](_0xe335('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xe335('0xd')]);router[_0xe335('0x8')](_0xe335('0xe'),auth[_0xe335('0xa')](),controller[_0xe335('0xf')]);router[_0xe335('0x8')](_0xe335('0x10'),auth[_0xe335('0x11')](),controller[_0xe335('0x12')]);router[_0xe335('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xe335('0x13')]);router[_0xe335('0x14')]('/',auth[_0xe335('0xa')](),controller[_0xe335('0x15')]);router['post'](_0xe335('0x16'),auth['isAuthenticated'](),controller[_0xe335('0x17')]);var upload=multer({'storage':multer[_0xe335('0x18')]({'destination':function(_0x38c0c1,_0x5e9233,_0xee2c17){_0xee2c17(null,path['join'](config[_0xe335('0x19')],'server/files/attachments/'));},'filename':function(_0x398658,_0x566249,_0x130f03){_0x130f03(null,util[_0xe335('0x1a')](_0xe335('0x1b'),Date[_0xe335('0x1c')](),_0x566249[_0xe335('0x1d')][_0xe335('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe335('0x14')]('/:id/attachment_upload',upload[_0xe335('0x1f')]('file'),controller['attachmentUpload']);router['post'](_0xe335('0xe'),auth[_0xe335('0x11')](),controller['addMessage']);router['post'](_0xe335('0x20'),auth[_0xe335('0xa')](),interaction[_0xe335('0x21')](_0xe335('0x22'),_0xe335('0x23')),controller[_0xe335('0x24')]);router[_0xe335('0x25')](_0xe335('0x26'),auth[_0xe335('0xa')](),interaction[_0xe335('0x21')](_0xe335('0x22'),_0xe335('0x27')),controller[_0xe335('0x28')]);router['put'](_0xe335('0x29'),controller[_0xe335('0x2a')]);router[_0xe335('0x25')](_0xe335('0x2b'),auth[_0xe335('0x11')](),controller[_0xe335('0x2c')]);router[_0xe335('0x25')](_0xe335('0x2d'),controller[_0xe335('0x2e')]);router[_0xe335('0x2f')](_0xe335('0x26'),auth[_0xe335('0xa')](),interaction[_0xe335('0x21')]('chat','chatinteraction:destroy'),controller[_0xe335('0x30')]);router[_0xe335('0x2f')](_0xe335('0x20'),auth[_0xe335('0xa')](),controller[_0xe335('0x31')]);module[_0xe335('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 733f668..5cd9022 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 _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 +var _0x25ee=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x1419fb,_0x5bd084){var _0x2b3c60=function(_0x2a749a){while(--_0x2a749a){_0x1419fb['push'](_0x1419fb['shift']());}};_0x2b3c60(++_0x5bd084);}(_0x25ee,0x1f2));var _0xe25e=function(_0x303e03,_0x48c0cf){_0x303e03=_0x303e03-0x0;var _0xc72223=_0x25ee[_0x303e03];return _0xc72223;};'use strict';var Sequelize=require(_0xe25e('0x0'));module[_0xe25e('0x1')]={'body':{'type':Sequelize[_0xe25e('0x2')](_0xe25e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe25e('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe25e('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ac1a9ce..e3fa093 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 _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 +var _0x0196=['crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','status','end','offset','undefined','limit','count','set','json','apply','reject','then','sendStatus','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','keys','find','create','body','params','destroy','describe','messages','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','ToId','read','-createdAt','all','rimraf','request-promise','mustache','util','path','ejs','lodash','squel'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x0196,0xc4));var _0x6019=function(_0x226da5,_0x393d1a){_0x226da5=_0x226da5-0x0;var _0x57ce5e=_0x0196[_0x226da5];return _0x57ce5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6019('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6019('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6019('0x2'));var util=require(_0x6019('0x3'));var path=require(_0x6019('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6019('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6019('0x6'));var squel=require(_0x6019('0x7'));var crypto=require(_0x6019('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x6019('0x9'));var toCsv=require(_0x6019('0xa'));var querystring=require(_0x6019('0xb'));var Papa=require('papaparse');var Redis=require(_0x6019('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6019('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6019('0xe'));var logger=require('../../config/logger')(_0x6019('0xf'));var utils=require(_0x6019('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6019('0x11'))['db'];config[_0x6019('0x12')]=_[_0x6019('0x13')](config[_0x6019('0x12')],{'host':_0x6019('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6019('0x12')]));require('./chatInternalMessage.socket')[_0x6019('0x15')](socket);function respondWithStatusCode(_0xccf2c0,_0xba4a54){_0xba4a54=_0xba4a54||0xcc;return function(_0xe9e3a1){if(_0xe9e3a1){return _0xccf2c0['sendStatus'](_0xba4a54);}return _0xccf2c0[_0x6019('0x16')](_0xba4a54)[_0x6019('0x17')]();};}function respondWithResult(_0x58be2e,_0x3595de){_0x3595de=_0x3595de||0xc8;return function(_0x552129){if(_0x552129){return _0x58be2e[_0x6019('0x16')](_0x3595de)['json'](_0x552129);}};}function respondWithFilteredResult(_0x5d49f6,_0x20e0c8){return function(_0x5256bc){if(_0x5256bc){var _0x3e03fc=typeof _0x20e0c8[_0x6019('0x18')]===_0x6019('0x19')&&typeof _0x20e0c8[_0x6019('0x1a')]===_0x6019('0x19');var _0x136c0a=_0x5256bc['count'];var _0x39777c=_0x3e03fc?0x0:_0x20e0c8[_0x6019('0x18')];var _0x1ac0a4=_0x3e03fc?_0x5256bc[_0x6019('0x1b')]:_0x20e0c8[_0x6019('0x18')]+_0x20e0c8[_0x6019('0x1a')];var _0x352c73;if(_0x1ac0a4>=_0x136c0a){_0x1ac0a4=_0x136c0a;_0x352c73=0xc8;}else{_0x352c73=0xce;}_0x5d49f6[_0x6019('0x16')](_0x352c73);return _0x5d49f6[_0x6019('0x1c')]('Content-Range',_0x39777c+'-'+_0x1ac0a4+'/'+_0x136c0a)[_0x6019('0x1d')](_0x5256bc);}return null;};}function patchUpdates(_0x2e34c6){return function(_0x428230){try{jsonpatch[_0x6019('0x1e')](_0x428230,_0x2e34c6,!![]);}catch(_0xfd5b16){return BPromise[_0x6019('0x1f')](_0xfd5b16);}return _0x428230['save']();};}function saveUpdates(_0x2f305c,_0x4a6f36){return function(_0x2c26da){if(_0x2c26da){return _0x2c26da['update'](_0x2f305c)[_0x6019('0x20')](function(_0x4eedf6){return _0x4eedf6;});}return null;};}function removeEntity(_0x29bbf6,_0x7536e3){return function(_0x17b096){if(_0x17b096){return _0x17b096['destroy']()[_0x6019('0x20')](function(){_0x29bbf6['status'](0xcc)[_0x6019('0x17')]();});}};}function handleEntityNotFound(_0x348656,_0x53dc39){return function(_0x139db2){if(!_0x139db2){_0x348656[_0x6019('0x21')](0x194);}return _0x139db2;};}function handleError(_0x2f07bb,_0x4392ef){_0x4392ef=_0x4392ef||0x1f4;return function(_0x4a873b){logger[_0x6019('0x22')](_0x4a873b[_0x6019('0x23')]);if(_0x4a873b[_0x6019('0x24')]){delete _0x4a873b[_0x6019('0x24')];}_0x2f07bb[_0x6019('0x16')](_0x4392ef)[_0x6019('0x25')](_0x4a873b);};}exports['index']=function(_0x212551,_0x4e956b){var _0x4d8666={},_0x912959={},_0x20e833={'count':0x0,'rows':[]};var _0x34895d=_[_0x6019('0x26')](db[_0x6019('0x27')][_0x6019('0x28')],function(_0x33f219){return{'name':_0x33f219[_0x6019('0x29')],'type':_0x33f219[_0x6019('0x2a')][_0x6019('0x2b')]};});_0x912959[_0x6019('0x2c')]=_[_0x6019('0x26')](_0x34895d,_0x6019('0x24'));_0x912959[_0x6019('0x2d')]=_['keys'](_0x212551[_0x6019('0x2d')]);_0x912959[_0x6019('0x2e')]=_[_0x6019('0x2f')](_0x912959[_0x6019('0x2c')],_0x912959[_0x6019('0x2d')]);_0x4d8666['attributes']=_[_0x6019('0x2f')](_0x912959[_0x6019('0x2c')],qs[_0x6019('0x30')](_0x212551['query'][_0x6019('0x30')]));_0x4d8666[_0x6019('0x31')]=_0x4d8666[_0x6019('0x31')][_0x6019('0x32')]?_0x4d8666[_0x6019('0x31')]:_0x912959[_0x6019('0x2c')];if(!_0x212551[_0x6019('0x2d')][_0x6019('0x33')]('nolimit')){_0x4d8666[_0x6019('0x1a')]=qs['limit'](_0x212551[_0x6019('0x2d')][_0x6019('0x1a')]);_0x4d8666[_0x6019('0x18')]=qs[_0x6019('0x18')](_0x212551[_0x6019('0x2d')][_0x6019('0x18')]);}_0x4d8666['order']=qs[_0x6019('0x34')](_0x212551[_0x6019('0x2d')][_0x6019('0x34')]);_0x4d8666[_0x6019('0x35')]=qs[_0x6019('0x2e')](_[_0x6019('0x36')](_0x212551[_0x6019('0x2d')],_0x912959[_0x6019('0x2e')]),_0x34895d);if(_0x212551['query'][_0x6019('0x37')]){_0x4d8666[_0x6019('0x35')]=_['merge'](_0x4d8666[_0x6019('0x35')],{'$or':_[_0x6019('0x26')](_0x34895d,function(_0x149238){if(_0x149238[_0x6019('0x2a')]!=='VIRTUAL'){var _0xe4fbd6={};_0xe4fbd6[_0x149238['name']]={'$like':'%'+_0x212551['query']['filter']+'%'};return _0xe4fbd6;}})});}_0x4d8666=_[_0x6019('0x38')]({},_0x4d8666,_0x212551[_0x6019('0x39')]);var _0x36053e={'where':_0x4d8666['where']};return db[_0x6019('0x27')][_0x6019('0x1b')](_0x36053e)['then'](function(_0x330527){_0x20e833[_0x6019('0x1b')]=_0x330527;if(_0x212551[_0x6019('0x2d')][_0x6019('0x3a')]){_0x4d8666['include']=[{'all':!![]}];}return db[_0x6019('0x27')][_0x6019('0x3b')](_0x4d8666);})[_0x6019('0x20')](function(_0x5a4278){_0x20e833['rows']=_0x5a4278;return _0x20e833;})['then'](respondWithFilteredResult(_0x4e956b,_0x4d8666))[_0x6019('0x3c')](handleError(_0x4e956b,null));};exports[_0x6019('0x3d')]=function(_0x4db31c,_0x4e294e){var _0x2e4c86={'raw':!![],'where':{'id':_0x4db31c['params']['id']}},_0x239048={};_0x239048['model']=_[_0x6019('0x3e')](db['ChatInternalMessage'][_0x6019('0x28')]);_0x239048[_0x6019('0x2d')]=_['keys'](_0x4db31c[_0x6019('0x2d')]);_0x239048[_0x6019('0x2e')]=_[_0x6019('0x2f')](_0x239048['model'],_0x239048[_0x6019('0x2d')]);_0x2e4c86[_0x6019('0x31')]=_[_0x6019('0x2f')](_0x239048[_0x6019('0x2c')],qs[_0x6019('0x30')](_0x4db31c['query'][_0x6019('0x30')]));_0x2e4c86[_0x6019('0x31')]=_0x2e4c86[_0x6019('0x31')][_0x6019('0x32')]?_0x2e4c86['attributes']:_0x239048[_0x6019('0x2c')];if(_0x4db31c[_0x6019('0x2d')][_0x6019('0x3a')]){_0x2e4c86['include']=[{'all':!![]}];}_0x2e4c86=_[_0x6019('0x38')]({},_0x2e4c86,_0x4db31c[_0x6019('0x39')]);return db[_0x6019('0x27')][_0x6019('0x3f')](_0x2e4c86)[_0x6019('0x20')](handleEntityNotFound(_0x4e294e,null))[_0x6019('0x20')](respondWithResult(_0x4e294e,null))[_0x6019('0x3c')](handleError(_0x4e294e,null));};exports['create']=function(_0x4dac8c,_0x552b24){return db[_0x6019('0x27')][_0x6019('0x40')](_0x4dac8c['body'],{})[_0x6019('0x20')](respondWithResult(_0x552b24,0xc9))[_0x6019('0x3c')](handleError(_0x552b24,null));};exports['update']=function(_0x2aa943,_0x289ee1){if(_0x2aa943[_0x6019('0x41')]['id']){delete _0x2aa943[_0x6019('0x41')]['id'];}return db[_0x6019('0x27')][_0x6019('0x3f')]({'where':{'id':_0x2aa943[_0x6019('0x42')]['id']}})[_0x6019('0x20')](handleEntityNotFound(_0x289ee1,null))['then'](saveUpdates(_0x2aa943[_0x6019('0x41')],null))[_0x6019('0x20')](respondWithResult(_0x289ee1,null))['catch'](handleError(_0x289ee1,null));};exports[_0x6019('0x43')]=function(_0x1d024e,_0x2bd0ec){return db['ChatInternalMessage'][_0x6019('0x3f')]({'where':{'id':_0x1d024e[_0x6019('0x42')]['id']}})[_0x6019('0x20')](handleEntityNotFound(_0x2bd0ec,null))[_0x6019('0x20')](removeEntity(_0x2bd0ec,null))[_0x6019('0x3c')](handleError(_0x2bd0ec,null));};exports['describe']=function(_0x47950e,_0x23fa0a){return db['ChatInternalMessage'][_0x6019('0x44')]()['then'](respondWithResult(_0x23fa0a,null))[_0x6019('0x3c')](handleError(_0x23fa0a,null));};function wrapUser(_0x411cbd){return function(_0x19fa24){var _0x1983ff=_0x411cbd['get']({'plain':!![]});_0x1983ff[_0x6019('0x45')]=[];if(_0x19fa24){_0x1983ff['lastMessageAt']=_0x19fa24[_0x6019('0x46')];_0x1983ff['lastMessage']=_0x19fa24;}else{_0x1983ff[_0x6019('0x47')]=moment(0x0)[_0x6019('0x48')](_0x6019('0x49'));_0x1983ff[_0x6019('0x4a')]={};}return _0x1983ff;};}exports[_0x6019('0x4b')]=function(_0x580929,_0x5ee2ae,_0x5cbae0){var _0x437715=[];return db[_0x6019('0x4c')]['findAll']({'where':{'role':[_0x6019('0x4d'),_0x6019('0x4e'),_0x6019('0x4f')]},'attributes':['id',_0x6019('0x50'),_0x6019('0x24'),_0x6019('0x51'),_0x6019('0x52'),_0x6019('0x53'),_0x6019('0x54'),_0x6019('0x55'),_0x6019('0x56'),_0x6019('0x57')],'order':qs['sort'](_0x6019('0x58')),'include':[{'model':db['VoiceQueue'],'as':_0x6019('0x59'),'attributes':['id',_0x6019('0x24'),_0x6019('0x2a')],'through':{'attributes':[]}}]})[_0x6019('0x20')](function(_0x4eb425){if(_0x4eb425){var _0x36dc3f=_0x580929[_0x6019('0x4f')]['get']({'plain':!![]});if(!_0x36dc3f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36dc3f[_0x6019('0x51')]===_0x6019('0x4f')){return db[_0x6019('0x5a')]['find']({'where':{'name':_0x6019('0x5b'),'userProfileId':_0x36dc3f[_0x6019('0x5c')]},'raw':!![]})[_0x6019('0x20')](function(_0x1de5f4){if(_0x1de5f4){if(_0x1de5f4[_0x6019('0x5d')]===0x0){return db[_0x6019('0x5e')]['findAll']({'where':{'sectionId':_0x1de5f4['id']},'raw':!![]})['then'](function(_0x1cfab8){var _0x4617f8=[];if(_[_0x6019('0x5f')](_0x1cfab8)){_0x4617f8=_[_0x6019('0x37')](_0x4eb425,function(_0x51180d){if(_0x51180d[_0x6019('0x51')]!=='agent'){return _0x51180d;}});return _0x4617f8;}else{for(var _0x62e373=0x0;_0x62e373<_0x4eb425[_0x6019('0x32')];_0x62e373++){var _0x16ddcb=_0x4eb425[_0x62e373];if(_0x16ddcb['role']===_0x6019('0x4d')){var _0xe7ed64=_[_0x6019('0x3f')](_0x1cfab8,function(_0x32531f){return _0x32531f['resourceId']===_0x16ddcb['id'];});if(_0xe7ed64)_0x4617f8[_0x6019('0x60')](_0x16ddcb);}else{_0x4617f8[_0x6019('0x60')](_0x16ddcb);}}return _0x4617f8;}});}else{return _0x4eb425;}}else{var _0x104896=_[_0x6019('0x37')](_0x4eb425,function(_0x211f36){if(_0x211f36[_0x6019('0x51')]!==_0x6019('0x4d')){return _0x211f36;}});return _0x104896;}});}else{return _0x4eb425;}}})['then'](function(_0x123c5a){var _0x11918f=[];if(_0x123c5a){_0x437715=_0x123c5a;for(var _0x34a851=0x0;_0x34a851<_0x123c5a[_0x6019('0x32')];_0x34a851+=0x1){_0x437715[_0x34a851][_0x6019('0x45')]=[];_0x11918f[_0x6019('0x60')](db[_0x6019('0x27')][_0x6019('0x3f')]({'where':{'FromId':[_0x580929['user']['id'],_0x123c5a[_0x34a851]['id']],'ToId':[_0x580929[_0x6019('0x4f')]['id'],_0x123c5a[_0x34a851]['id']],'ChatGroupId':null},'attributes':['id',_0x6019('0x46'),_0x6019('0x61'),_0x6019('0x62'),_0x6019('0x63'),'body'],'order':qs[_0x6019('0x34')](_0x6019('0x64')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6019('0x20')](wrapUser(_0x123c5a[_0x34a851])));}return BPromise[_0x6019('0x65')](_0x11918f);}return[];})[_0x6019('0x20')](function(_0x3cc741){return{'rows':_0x3cc741,'count':_0x3cc741[_0x6019('0x32')]};})['then'](respondWithResult(_0x5ee2ae,null))['catch'](handleError(_0x5ee2ae,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index edea5b8..79cf113 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 _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 +var _0x840a=['../../mysqldb','ChatInternalMessage','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x46a60f,_0x1bec56){var _0x216028=function(_0x336f76){while(--_0x336f76){_0x46a60f['push'](_0x46a60f['shift']());}};_0x216028(++_0x1bec56);}(_0x840a,0x77));var _0xa840=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x840a[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xa840('0x0'));var ChatInternalMessage=require(_0xa840('0x1'))['db'][_0xa840('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa840('0x3'),'afterUpdate':'update','afterDestroy':_0xa840('0x4')};function emitEvent(_0x3561b6){return function(_0x4ed806,_0x702a4b,_0x27cba5){ChatInternalMessageEvents[_0xa840('0x5')](_0x3561b6+':'+_0x4ed806['id'],_0x4ed806);ChatInternalMessageEvents[_0xa840('0x5')](_0x3561b6,_0x4ed806);_0x27cba5(null);};}for(var e in events){if(events[_0xa840('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xa840('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index a5ae1a4..37523a3 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 _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 +var _0x9b65=['rimraf','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path'];(function(_0x5bcafb,_0x37dc03){var _0xa29d82=function(_0x24477a){while(--_0x24477a){_0x5bcafb['push'](_0x5bcafb['shift']());}};_0xa29d82(++_0x37dc03);}(_0x9b65,0x19a));var _0x59b6=function(_0x1dfd46,_0x52efef){_0x1dfd46=_0x1dfd46-0x0;var _0x1702da=_0x9b65[_0x1dfd46];return _0x1702da;};'use strict';var _=require('lodash');var util=require(_0x59b6('0x0'));var logger=require('../../config/logger')(_0x59b6('0x1'));var moment=require(_0x59b6('0x2'));var BPromise=require(_0x59b6('0x3'));var rp=require(_0x59b6('0x4'));var fs=require('fs');var path=require(_0x59b6('0x5'));var rimraf=require(_0x59b6('0x6'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x59b6('0x7')]=function(_0x22c82c,_0x45ea56){return _0x22c82c[_0x59b6('0x8')](_0x59b6('0x9'),attributes,{'tableName':_0x59b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x59b6('0xb'),'collate':_0x59b6('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 281e93d..e0a9b9c 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 _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 +var _0xed95=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x1b3b4a,_0x27562f){var _0x5c82e7=function(_0x2fa764){while(--_0x2fa764){_0x1b3b4a['push'](_0x1b3b4a['shift']());}};_0x5c82e7(++_0x27562f);}(_0xed95,0x1d0));var _0x5ed9=function(_0x9222a6,_0x4b32e7){_0x9222a6=_0x9222a6-0x0;var _0x1233f1=_0xed95[_0x9222a6];return _0x1233f1;};'use strict';var _=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var moment=require(_0x5ed9('0x2'));var BPromise=require(_0x5ed9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ed9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ed9('0x5'));var logger=require('../../config/logger')(_0x5ed9('0x6'));var config=require(_0x5ed9('0x7'));var jayson=require(_0x5ed9('0x8'));var client=jayson['client'][_0x5ed9('0x9')]({'port':0x232a});config[_0x5ed9('0xa')]=_['defaults'](config[_0x5ed9('0xa')],{'host':_0x5ed9('0xb'),'port':0x18eb});var socket=require(_0x5ed9('0xc'))(new Redis(config[_0x5ed9('0xa')]));require(_0x5ed9('0xd'))[_0x5ed9('0xe')](socket);function respondWithRpcPromise(_0x53907c,_0x2f858a,_0xfe757d){return new BPromise(function(_0x49473c,_0x269522){return client[_0x5ed9('0xf')](_0x53907c,_0xfe757d)[_0x5ed9('0x10')](function(_0x4a929a){logger['info'](_0x5ed9('0x11'),_0x2f858a,_0x5ed9('0x12'));logger['debug'](_0x5ed9('0x13'),_0x2f858a,'request\x20sent',JSON['stringify'](_0x4a929a));if(_0x4a929a['error']){if(_0x4a929a[_0x5ed9('0x14')][_0x5ed9('0x15')]===0x1f4){logger[_0x5ed9('0x14')](_0x5ed9('0x11'),_0x2f858a,_0x4a929a[_0x5ed9('0x14')]['message']);return _0x269522(_0x4a929a[_0x5ed9('0x14')][_0x5ed9('0x16')]);}logger['error'](_0x5ed9('0x11'),_0x2f858a,_0x4a929a[_0x5ed9('0x14')][_0x5ed9('0x16')]);return _0x49473c(_0x4a929a[_0x5ed9('0x14')][_0x5ed9('0x16')]);}else{logger[_0x5ed9('0x17')](_0x5ed9('0x11'),_0x2f858a,'request\x20sent');_0x49473c(_0x4a929a[_0x5ed9('0x18')][_0x5ed9('0x16')]);}})[_0x5ed9('0x19')](function(_0x46a55b){logger[_0x5ed9('0x14')](_0x5ed9('0x11'),_0x2f858a,_0x46a55b);_0x269522(_0x46a55b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b3ff617..43a6af1 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 _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 +var _0xc61a=['save','remove','update','emit','removeListener','register','length','./chatInternalMessage.events'];(function(_0x3b9705,_0x4a421e){var _0x239319=function(_0x32ebe1){while(--_0x32ebe1){_0x3b9705['push'](_0x3b9705['shift']());}};_0x239319(++_0x4a421e);}(_0xc61a,0x15f));var _0xac61=function(_0x16d6b4,_0x50360d){_0x16d6b4=_0x16d6b4-0x0;var _0x11f272=_0xc61a[_0x16d6b4];return _0x11f272;};'use strict';var ChatInternalMessageEvents=require(_0xac61('0x0'));var events=[_0xac61('0x1'),_0xac61('0x2'),_0xac61('0x3')];function createListener(_0x48f7a6,_0x38fd8f){return function(_0x2bb724){_0x38fd8f[_0xac61('0x4')](_0x48f7a6,_0x2bb724);};}function removeListener(_0x2c3de8,_0x44b23a){return function(){ChatInternalMessageEvents[_0xac61('0x5')](_0x2c3de8,_0x44b23a);};}exports[_0xac61('0x6')]=function(_0xc18d16){for(var _0x152717=0x0,_0x44cba3=events[_0xac61('0x7')];_0x152717<_0x44cba3;_0x152717++){var _0xbe935f=events[_0x152717];var _0x1c0d76=createListener('chatInternalMessage:'+_0xbe935f,_0xc18d16);ChatInternalMessageEvents['on'](_0xbe935f,_0x1c0d76);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index b2c184d..a161f6a 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 _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 +var _0x3fa7=['update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','create','put'];(function(_0x5d3eaa,_0x4420df){var _0x283dd1=function(_0x133e69){while(--_0x133e69){_0x5d3eaa['push'](_0x5d3eaa['shift']());}};_0x283dd1(++_0x4420df);}(_0x3fa7,0x1b8));var _0x73fa=function(_0x20a35e,_0x1e4cc9){_0x20a35e=_0x20a35e-0x0;var _0x5a0cfd=_0x3fa7[_0x20a35e];return _0x5a0cfd;};'use strict';var multer=require('multer');var util=require(_0x73fa('0x0'));var path=require(_0x73fa('0x1'));var timeout=require(_0x73fa('0x2'));var express=require('express');var router=express[_0x73fa('0x3')]();var fs_extra=require(_0x73fa('0x4'));var auth=require(_0x73fa('0x5'));var interaction=require(_0x73fa('0x6'));var config=require(_0x73fa('0x7'));var controller=require(_0x73fa('0x8'));router[_0x73fa('0x9')]('/',auth[_0x73fa('0xa')](),controller[_0x73fa('0xb')]);router[_0x73fa('0x9')](_0x73fa('0xc'),auth[_0x73fa('0xa')](),controller[_0x73fa('0xd')]);router[_0x73fa('0x9')](_0x73fa('0xe'),auth[_0x73fa('0xa')](),controller[_0x73fa('0xf')]);router['get'](_0x73fa('0x10'),auth[_0x73fa('0xa')](),controller[_0x73fa('0x11')]);router['post']('/',auth[_0x73fa('0xa')](),controller[_0x73fa('0x12')]);router[_0x73fa('0x13')](_0x73fa('0x10'),controller[_0x73fa('0x14')]);router['delete'](_0x73fa('0x10'),auth[_0x73fa('0xa')](),controller[_0x73fa('0x15')]);module[_0x73fa('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index fdee405..d9ad3cc 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 _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 +var _0xd8b0=['exports','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x0d8b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0d8b('0x3')]('in',_0x0d8b('0x4')),'defaultValue':_0x0d8b('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0d8b('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6efde0c..e5934be 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 _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 +var _0x1f93=['destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','model','fields','find','create','body','update','describe','chat-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x3657d2,_0x354f60){var _0x3eef68=function(_0x3a4633){while(--_0x3a4633){_0x3657d2['push'](_0x3657d2['shift']());}};_0x3eef68(++_0x354f60);}(_0x1f93,0xd8));var _0x31f9=function(_0x1f3f78,_0x5cab65){_0x1f3f78=_0x1f3f78-0x0;var _0x4eca9a=_0x1f93[_0x1f3f78];return _0x4eca9a;};'use strict';var emlformat=require(_0x31f9('0x0'));var rimraf=require(_0x31f9('0x1'));var zipdir=require(_0x31f9('0x2'));var jsonpatch=require(_0x31f9('0x3'));var rp=require('request-promise');var moment=require(_0x31f9('0x4'));var BPromise=require(_0x31f9('0x5'));var Mustache=require(_0x31f9('0x6'));var util=require(_0x31f9('0x7'));var path=require('path');var sox=require(_0x31f9('0x8'));var csv=require('to-csv');var ejs=require(_0x31f9('0x9'));var fs=require('fs');var fs_extra=require(_0x31f9('0xa'));var _=require('lodash');var squel=require(_0x31f9('0xb'));var crypto=require(_0x31f9('0xc'));var jsforce=require(_0x31f9('0xd'));var deskjs=require(_0x31f9('0xe'));var toCsv=require(_0x31f9('0xf'));var querystring=require('querystring');var Papa=require(_0x31f9('0x10'));var Redis=require(_0x31f9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x31f9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31f9('0x13'));var logger=require(_0x31f9('0x14'))(_0x31f9('0x15'));var utils=require(_0x31f9('0x16'));var config=require(_0x31f9('0x17'));var licenseUtil=require(_0x31f9('0x18'));var db=require(_0x31f9('0x19'))['db'];config[_0x31f9('0x1a')]=_[_0x31f9('0x1b')](config[_0x31f9('0x1a')],{'host':_0x31f9('0x1c'),'port':0x18eb});var socket=require(_0x31f9('0x1d'))(new Redis(config[_0x31f9('0x1a')]));require(_0x31f9('0x1e'))[_0x31f9('0x1f')](socket);var jayson=require(_0x31f9('0x20'));var client=jayson[_0x31f9('0x21')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14a6da,_0x65c02f,_0x358912,_0x163a33){return new BPromise(function(_0x42f592,_0xa50f0a){var _0x306dc0=_0x163a33||client;return _0x306dc0[_0x31f9('0x22')](_0x14a6da,_0x358912)[_0x31f9('0x23')](function(_0x3490fb){logger[_0x31f9('0x24')]('ChatMessage,\x20%s,\x20%s',_0x65c02f,_0x31f9('0x25'));logger[_0x31f9('0x26')](_0x31f9('0x27'),_0x65c02f,_0x31f9('0x25'),JSON[_0x31f9('0x28')](_0x3490fb));if(_0x3490fb[_0x31f9('0x29')]){if(_0x3490fb[_0x31f9('0x29')][_0x31f9('0x2a')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x65c02f,_0x3490fb[_0x31f9('0x29')][_0x31f9('0x2b')]);return _0xa50f0a(_0x3490fb['error'][_0x31f9('0x2b')]);}logger[_0x31f9('0x29')](_0x31f9('0x2c'),_0x65c02f,_0x3490fb[_0x31f9('0x29')][_0x31f9('0x2b')]);return _0x42f592(_0x3490fb[_0x31f9('0x29')][_0x31f9('0x2b')]);}else{logger[_0x31f9('0x24')](_0x31f9('0x2c'),_0x65c02f,'request\x20sent');_0x42f592(_0x3490fb[_0x31f9('0x2d')][_0x31f9('0x2b')]);}})[_0x31f9('0x2e')](function(_0x3a1e83){logger[_0x31f9('0x29')]('ChatMessage,\x20%s,\x20%s',_0x65c02f,_0x3a1e83);_0xa50f0a(_0x3a1e83);});});}function respondWithStatusCode(_0x25c382,_0x29448e){_0x29448e=_0x29448e||0xcc;return function(_0x143531){if(_0x143531){return _0x25c382[_0x31f9('0x2f')](_0x29448e);}return _0x25c382[_0x31f9('0x30')](_0x29448e)['end']();};}function respondWithResult(_0x2cec26,_0x18fde1){_0x18fde1=_0x18fde1||0xc8;return function(_0x37813a){if(_0x37813a){return _0x2cec26[_0x31f9('0x30')](_0x18fde1)[_0x31f9('0x31')](_0x37813a);}};}function respondWithFilteredResult(_0x2b3735,_0x309557){return function(_0x56d239){if(_0x56d239){var _0x24523c=typeof _0x309557[_0x31f9('0x32')]===_0x31f9('0x33')&&typeof _0x309557[_0x31f9('0x34')]===_0x31f9('0x33');var _0x235e0b=_0x56d239['count'];var _0x7eb962=_0x24523c?0x0:_0x309557['offset'];var _0x4e8755=_0x24523c?_0x56d239[_0x31f9('0x35')]:_0x309557[_0x31f9('0x32')]+_0x309557[_0x31f9('0x34')];var _0x448e0a;if(_0x4e8755>=_0x235e0b){_0x4e8755=_0x235e0b;_0x448e0a=0xc8;}else{_0x448e0a=0xce;}_0x2b3735[_0x31f9('0x30')](_0x448e0a);return _0x2b3735[_0x31f9('0x36')](_0x31f9('0x37'),_0x7eb962+'-'+_0x4e8755+'/'+_0x235e0b)[_0x31f9('0x31')](_0x56d239);}return null;};}function patchUpdates(_0x1e68c0){return function(_0x2eecf7){try{jsonpatch[_0x31f9('0x38')](_0x2eecf7,_0x1e68c0,!![]);}catch(_0x527f01){return BPromise[_0x31f9('0x39')](_0x527f01);}return _0x2eecf7['save']();};}function saveUpdates(_0x53cf0e,_0x4f0fee){return function(_0x29c576){if(_0x29c576){return _0x29c576['update'](_0x53cf0e)['then'](function(_0x381688){return _0x381688;});}return null;};}function removeEntity(_0x4e50d5,_0x1007b3){return function(_0x279cf4){if(_0x279cf4){return _0x279cf4[_0x31f9('0x3a')]()[_0x31f9('0x23')](function(){_0x4e50d5[_0x31f9('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5743b8,_0x260117){return function(_0x211769){if(!_0x211769){_0x5743b8['sendStatus'](0x194);}return _0x211769;};}function handleError(_0xe7add1,_0x5cecce){_0x5cecce=_0x5cecce||0x1f4;return function(_0x518923){logger[_0x31f9('0x29')](_0x518923[_0x31f9('0x3b')]);if(_0x518923[_0x31f9('0x3c')]){delete _0x518923[_0x31f9('0x3c')];}_0xe7add1['status'](_0x5cecce)['send'](_0x518923);};}exports[_0x31f9('0x3d')]=function(_0x21554e,_0x5202cc){var _0x44aa6f={},_0x421f56={},_0x157586={'count':0x0,'rows':[]};var _0x4af48b=_[_0x31f9('0x3e')](db[_0x31f9('0x3f')][_0x31f9('0x40')],function(_0x905314){return{'name':_0x905314[_0x31f9('0x41')],'type':_0x905314[_0x31f9('0x42')][_0x31f9('0x43')]};});_0x421f56['model']=_[_0x31f9('0x3e')](_0x4af48b,_0x31f9('0x3c'));_0x421f56[_0x31f9('0x44')]=_[_0x31f9('0x45')](_0x21554e[_0x31f9('0x44')]);_0x421f56[_0x31f9('0x46')]=_[_0x31f9('0x47')](_0x421f56['model'],_0x421f56[_0x31f9('0x44')]);_0x44aa6f['attributes']=_['intersection'](_0x421f56['model'],qs['fields'](_0x21554e[_0x31f9('0x44')]['fields']));_0x44aa6f[_0x31f9('0x48')]=_0x44aa6f[_0x31f9('0x48')][_0x31f9('0x49')]?_0x44aa6f[_0x31f9('0x48')]:_0x421f56['model'];if(!_0x21554e['query'][_0x31f9('0x4a')](_0x31f9('0x4b'))){_0x44aa6f['limit']=qs['limit'](_0x21554e[_0x31f9('0x44')][_0x31f9('0x34')]);_0x44aa6f['offset']=qs[_0x31f9('0x32')](_0x21554e[_0x31f9('0x44')]['offset']);}_0x44aa6f[_0x31f9('0x4c')]=qs[_0x31f9('0x4d')](_0x21554e[_0x31f9('0x44')][_0x31f9('0x4d')]);_0x44aa6f[_0x31f9('0x4e')]=qs[_0x31f9('0x46')](_[_0x31f9('0x4f')](_0x21554e[_0x31f9('0x44')],_0x421f56[_0x31f9('0x46')]),_0x4af48b);if(_0x21554e[_0x31f9('0x44')][_0x31f9('0x50')]){_0x44aa6f[_0x31f9('0x4e')]=_[_0x31f9('0x51')](_0x44aa6f[_0x31f9('0x4e')],{'$or':_[_0x31f9('0x3e')](_0x4af48b,function(_0x5bfaa5){if(_0x5bfaa5[_0x31f9('0x42')]!==_0x31f9('0x52')){var _0x1f4a03={};_0x1f4a03[_0x5bfaa5['name']]={'$like':'%'+_0x21554e[_0x31f9('0x44')][_0x31f9('0x50')]+'%'};return _0x1f4a03;}})});}_0x44aa6f=_[_0x31f9('0x51')]({},_0x44aa6f,_0x21554e[_0x31f9('0x53')]);var _0x561cb0={'where':_0x44aa6f['where']};return db[_0x31f9('0x3f')][_0x31f9('0x35')](_0x561cb0)[_0x31f9('0x23')](function(_0x5a1eb9){_0x157586[_0x31f9('0x35')]=_0x5a1eb9;if(_0x21554e[_0x31f9('0x44')][_0x31f9('0x54')]){_0x44aa6f[_0x31f9('0x55')]=[{'all':!![]}];}return db[_0x31f9('0x3f')][_0x31f9('0x56')](_0x44aa6f);})[_0x31f9('0x23')](function(_0x150ff0){_0x157586[_0x31f9('0x57')]=_0x150ff0;return _0x157586;})[_0x31f9('0x23')](respondWithFilteredResult(_0x5202cc,_0x44aa6f))[_0x31f9('0x2e')](handleError(_0x5202cc,null));};exports['show']=function(_0x531565,_0x569d2f){var _0x39c48a={'raw':!![],'where':{'id':_0x531565[_0x31f9('0x58')]['id']}},_0x21bd15={};_0x21bd15[_0x31f9('0x59')]=_[_0x31f9('0x45')](db[_0x31f9('0x3f')][_0x31f9('0x40')]);_0x21bd15[_0x31f9('0x44')]=_['keys'](_0x531565[_0x31f9('0x44')]);_0x21bd15[_0x31f9('0x46')]=_[_0x31f9('0x47')](_0x21bd15[_0x31f9('0x59')],_0x21bd15[_0x31f9('0x44')]);_0x39c48a[_0x31f9('0x48')]=_[_0x31f9('0x47')](_0x21bd15[_0x31f9('0x59')],qs[_0x31f9('0x5a')](_0x531565['query']['fields']));_0x39c48a[_0x31f9('0x48')]=_0x39c48a[_0x31f9('0x48')][_0x31f9('0x49')]?_0x39c48a[_0x31f9('0x48')]:_0x21bd15[_0x31f9('0x59')];if(_0x531565['query'][_0x31f9('0x54')]){_0x39c48a[_0x31f9('0x55')]=[{'all':!![]}];}_0x39c48a=_['merge']({},_0x39c48a,_0x531565[_0x31f9('0x53')]);return db['ChatMessage'][_0x31f9('0x5b')](_0x39c48a)[_0x31f9('0x23')](handleEntityNotFound(_0x569d2f,null))[_0x31f9('0x23')](respondWithResult(_0x569d2f,null))[_0x31f9('0x2e')](handleError(_0x569d2f,null));};exports[_0x31f9('0x5c')]=function(_0x2720ae,_0x24a5a1){return db['ChatMessage'][_0x31f9('0x5c')](_0x2720ae[_0x31f9('0x5d')],{})[_0x31f9('0x23')](respondWithResult(_0x24a5a1,0xc9))[_0x31f9('0x2e')](handleError(_0x24a5a1,null));};exports[_0x31f9('0x5e')]=function(_0x44d61b,_0x1ae87f){if(_0x44d61b[_0x31f9('0x5d')]['id']){delete _0x44d61b[_0x31f9('0x5d')]['id'];}return db['ChatMessage'][_0x31f9('0x5b')]({'where':{'id':_0x44d61b[_0x31f9('0x58')]['id']}})[_0x31f9('0x23')](handleEntityNotFound(_0x1ae87f,null))[_0x31f9('0x23')](saveUpdates(_0x44d61b[_0x31f9('0x5d')],null))[_0x31f9('0x23')](respondWithResult(_0x1ae87f,null))[_0x31f9('0x2e')](handleError(_0x1ae87f,null));};exports[_0x31f9('0x3a')]=function(_0x408388,_0x4cdcf4){return db[_0x31f9('0x3f')][_0x31f9('0x5b')]({'where':{'id':_0x408388[_0x31f9('0x58')]['id']}})[_0x31f9('0x23')](handleEntityNotFound(_0x4cdcf4,null))[_0x31f9('0x23')](removeEntity(_0x4cdcf4,null))['catch'](handleError(_0x4cdcf4,null));};exports[_0x31f9('0x5f')]=function(_0x59c1a2,_0x38b5bc){return db['ChatMessage'][_0x31f9('0x5f')]()['then'](respondWithResult(_0x38b5bc,null))[_0x31f9('0x2e')](handleError(_0x38b5bc,null));};var interaction_log=require(_0x31f9('0x14'))(_0x31f9('0x60'));exports[_0x31f9('0x61')]=function(_0x28abf7,_0x5a9c11,_0x4956ca){var _0x147929={'agent':{},'channel':'chat'};if(_0x28abf7[_0x31f9('0x5d')]['id']){delete _0x28abf7[_0x31f9('0x5d')]['id'];}_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x62')]=!![];_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x63')]=moment()[_0x31f9('0x64')](_0x31f9('0x65'));_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x66')]=_0x28abf7['body'][_0x31f9('0x66')]||_0x28abf7['user']['id'];_0x147929[_0x31f9('0x67')]['id']=_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x66')];return db['ChatMessage'][_0x31f9('0x5b')]({'where':{'id':_0x28abf7[_0x31f9('0x58')]['id'],'UserId':null}})[_0x31f9('0x23')](handleEntityNotFound(_0x5a9c11,null))['then'](saveUpdates(_0x28abf7[_0x31f9('0x5d')],null))[_0x31f9('0x23')](function(_0x123086){if(_0x123086){_0x147929[_0x31f9('0x2b')]=_0x123086[_0x31f9('0x68')]({'plain':!![]});return db[_0x31f9('0x69')]['find']({'where':{'id':_0x123086[_0x31f9('0x6a')]}});}return null;})[_0x31f9('0x23')](handleEntityNotFound(_0x5a9c11,null))[_0x31f9('0x23')](function(_0x43fefb){if(_0x43fefb){return _0x43fefb[_0x31f9('0x5e')]({'UserId':_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x66')],'read1stAt':_['isNil'](_0x43fefb[_0x31f9('0x6b')])?moment()[_0x31f9('0x64')](_0x31f9('0x65')):undefined});}return null;})[_0x31f9('0x23')](function(_0x5b78d7){if(_0x5b78d7){_0x147929[_0x31f9('0x6c')]=_0x5b78d7['get']({'plain':!![]});interaction_log[_0x31f9('0x24')](_0x31f9('0x6d'),_0x28abf7[_0x31f9('0x6e')]['id'],_0x28abf7[_0x31f9('0x6e')][_0x31f9('0x3c')],_0x28abf7[_0x31f9('0x6e')][_0x31f9('0x6f')],_0x147929['interaction']['id'],_0x28abf7[_0x31f9('0x5d')]?JSON[_0x31f9('0x28')](_0x28abf7[_0x31f9('0x5d')]):_0x31f9('0x70'));return respondWithRpcPromise(_0x31f9('0x71'),_0x31f9('0x72'),_0x147929);}return null;})['then'](function(_0x3bc855){var _0x45c0b2=_0x31f9('0x73')+_0x3bc855[_0x31f9('0x2b')][_0x31f9('0x74')];return db['sequelize'][_0x31f9('0x44')](_0x45c0b2,{'type':db[_0x31f9('0x75')]['QueryTypes'][_0x31f9('0x76')],'raw':!![]})[_0x31f9('0x23')](function(_0x143a1c){return _0x143a1c;});})[_0x31f9('0x23')](function(_0x1057ee){if(_0x1057ee){_0x147929[_0x31f9('0x2b')][_0x31f9('0x77')]=_0x1057ee[0x0];if(!_0x28abf7[_0x31f9('0x5d')]['UserId'])return;return db[_0x31f9('0x78')][_0x31f9('0x5b')]({'where':{'id':_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x66')],'role':'agent'},'attributes':['id',_0x31f9('0x3c'),_0x31f9('0x79'),_0x31f9('0x7a'),_0x31f9('0x7b')],'raw':!![]});}return null;})['then'](function(_0x5586bd){if(!_0x5586bd)return null;_0x147929[_0x31f9('0x2b')][_0x31f9('0x67')]=_0x5586bd;return _0x147929;})[_0x31f9('0x23')](function(_0x433b06){if(_0x433b06){if(_0x28abf7[_0x31f9('0x5d')]['manual']){_0x147929[_0x31f9('0x2b')][_0x31f9('0x7c')]=util[_0x31f9('0x64')](_0x31f9('0x7d'),_0x28abf7[_0x31f9('0x6e')][_0x31f9('0x3c')]);_0x147929[_0x31f9('0x2b')][_0x31f9('0x7e')]=_0x147929['channel'];_0x147929[_0x31f9('0x2b')][_0x31f9('0x7f')]=_0x147929[_0x31f9('0x7e')];_0x147929[_0x31f9('0x2b')][_0x31f9('0x80')]='accept';return respondWithRpcPromise(_0x31f9('0x81'),_0x31f9('0x81'),{'event':'acceptmessage','message':_[_0x31f9('0x51')](_0x147929[_0x31f9('0x2b')],JSON[_0x31f9('0x82')](_0x147929['interaction'][_0x31f9('0x83')]))},client9002)[_0x31f9('0x23')](function(){return _0x147929;});}return _0x147929;}return null;})[_0x31f9('0x23')](respondWithResult(_0x5a9c11,null))[_0x31f9('0x2e')](handleError(_0x5a9c11,null));};var interaction_log=require(_0x31f9('0x14'))('chat-interactions');exports['reject']=function(_0x5de05c,_0x7aae9,_0x46a1c4){var _0x5d46db={'agent':{},'channel':_0x31f9('0x84')};if(_0x5de05c[_0x31f9('0x5d')]['id']){delete _0x5de05c[_0x31f9('0x5d')]['id'];}_0x5de05c[_0x31f9('0x5d')][_0x31f9('0x66')]=_0x5de05c[_0x31f9('0x5d')]['UserId']||_0x5de05c[_0x31f9('0x6e')]['id'];_0x5d46db['agent']['id']=_0x5de05c['body'][_0x31f9('0x66')];return db[_0x31f9('0x3f')][_0x31f9('0x5b')]({'where':{'id':_0x5de05c[_0x31f9('0x58')]['id'],'UserId':null}})[_0x31f9('0x23')](handleEntityNotFound(_0x7aae9,null))['then'](function(_0xffbc3d){if(_0xffbc3d){_0x5d46db[_0x31f9('0x2b')]=_0xffbc3d[_0x31f9('0x68')]({'plain':!![]});return db[_0x31f9('0x69')][_0x31f9('0x5b')]({'where':{'id':_0xffbc3d[_0x31f9('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x7aae9,null))['then'](function(_0x40e19c){if(_0x40e19c){_0x5d46db[_0x31f9('0x6c')]=_0x40e19c['get']({'plain':!![]});interaction_log[_0x31f9('0x24')](_0x31f9('0x85'),_0x5de05c['user']['id'],_0x5de05c['user'][_0x31f9('0x3c')],_0x5de05c[_0x31f9('0x6e')]['role'],_0x5d46db[_0x31f9('0x6c')]['id'],_0x5de05c[_0x31f9('0x5d')]?JSON[_0x31f9('0x28')](_0x5de05c[_0x31f9('0x5d')]):_0x31f9('0x70'));return respondWithRpcPromise(_0x31f9('0x86'),_0x31f9('0x87'),_0x5d46db);}return null;})[_0x31f9('0x23')](function(_0x351ff2){var _0x682558=_0x31f9('0x73')+_0x351ff2[_0x31f9('0x2b')]['ContactId'];return db['sequelize'][_0x31f9('0x44')](_0x682558,{'type':db[_0x31f9('0x75')]['QueryTypes']['SELECT'],'raw':!![]})[_0x31f9('0x23')](function(_0x24f887){return _0x24f887;});})[_0x31f9('0x23')](function(_0x2d328e){if(_0x2d328e){_0x5d46db[_0x31f9('0x2b')][_0x31f9('0x77')]=_0x2d328e[0x0];if(!_0x5de05c[_0x31f9('0x5d')]['UserId'])return;return db[_0x31f9('0x78')][_0x31f9('0x5b')]({'where':{'id':_0x5de05c[_0x31f9('0x5d')][_0x31f9('0x66')],'role':'agent'},'attributes':['id',_0x31f9('0x3c'),_0x31f9('0x79'),_0x31f9('0x7a'),_0x31f9('0x7b')],'raw':!![]});}return null;})[_0x31f9('0x23')](function(_0x19edd4){if(!_0x19edd4)return null;_0x5d46db[_0x31f9('0x2b')][_0x31f9('0x67')]=_0x19edd4;return _0x5d46db;})['then'](function(_0x3ec04b){if(_0x3ec04b){_0x3ec04b[_0x31f9('0x2b')][_0x31f9('0x7c')]=util[_0x31f9('0x64')](_0x31f9('0x7d'),_0x5de05c[_0x31f9('0x6e')][_0x31f9('0x3c')]);_0x3ec04b[_0x31f9('0x2b')]['channel']=_0x5d46db[_0x31f9('0x7e')];_0x3ec04b[_0x31f9('0x2b')]['motionChannel']=_0x5d46db['channel'];_0x3ec04b[_0x31f9('0x2b')][_0x31f9('0x80')]=_0x31f9('0x39');respondWithRpcPromise('EventManager',_0x31f9('0x81'),{'event':_0x31f9('0x88'),'message':_[_0x31f9('0x51')](_0x5d46db[_0x31f9('0x2b')],JSON['parse'](_0x5d46db[_0x31f9('0x6c')]['formData']))},client9002);return _0x5d46db;}return null;})[_0x31f9('0x23')](respondWithResult(_0x7aae9,null))[_0x31f9('0x2e')](handleError(_0x7aae9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index ad887fc..bf98a55 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 _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 +var _0xcc6f=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x4922db,_0x21c496){var _0x294b2c=function(_0x2efc91){while(--_0x2efc91){_0x4922db['push'](_0x4922db['shift']());}};_0x294b2c(++_0x21c496);}(_0xcc6f,0xb5));var _0xfcc6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcc6f[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xfcc6('0x0'));var ChatMessage=require(_0xfcc6('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfcc6('0x2'),'afterUpdate':_0xfcc6('0x3'),'afterDestroy':_0xfcc6('0x4')};function emitEvent(_0x9bfabb){return function(_0x444a6b,_0x13b0b6,_0xa051ac){ChatMessageEvents['emit'](_0x9bfabb+':'+_0x444a6b['id'],_0x444a6b);ChatMessageEvents[_0xfcc6('0x5')](_0x9bfabb,_0x444a6b);_0xa051ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xfcc6('0x6')](e,emitEvent(event));}}module[_0xfcc6('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index ecea231..85ba3a1 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 _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 +var _0xc913=['./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x7c0070,_0x4ecf28){var _0x46a772=function(_0x44083b){while(--_0x44083b){_0x7c0070['push'](_0x7c0070['shift']());}};_0x46a772(++_0x4ecf28);}(_0xc913,0xd9));var _0x3c91=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0xc913[_0x5a99db];return _0x3aad62;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c91('0x0'))(_0x3c91('0x1'));var moment=require(_0x3c91('0x2'));var BPromise=require(_0x3c91('0x3'));var rp=require(_0x3c91('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c91('0x5'));var config=require(_0x3c91('0x6'));var attributes=require(_0x3c91('0x7'));module[_0x3c91('0x8')]=function(_0x340d56,_0x9b69d){return _0x340d56['define'](_0x3c91('0x9'),attributes,{'tableName':_0x3c91('0xa'),'paranoid':![],'indexes':[{'name':_0x3c91('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31756f,_0x2df461,_0x459f45){var _0x4c769d=_0x340d56[_0x3c91('0xc')];var _0x4ebcee=_0x31756f[_0x3c91('0xd')]({'plain':!![]});if(_0x4ebcee[_0x3c91('0xe')][_0x3c91('0xf')]()==='in'||_0x4ebcee[_0x3c91('0xe')]['toLowerCase']()===_0x3c91('0x10')&&!_0x4ebcee[_0x3c91('0x11')]&&!_[_0x3c91('0x12')](_0x4ebcee['UserId'])){_0x4c769d[_0x3c91('0x13')][_0x3c91('0x14')]({'where':{'id':_0x4ebcee[_0x3c91('0x15')]}})[_0x3c91('0x16')](function(_0x168267){if(_0x168267){_0x168267[_0x3c91('0x17')]({'lastMsgAt':_0x4ebcee[_0x3c91('0x18')],'lastMsgDirection':_0x4ebcee[_0x3c91('0xe')][_0x3c91('0xf')]()});}})['catch'](function(_0x23e8b8){console[_0x3c91('0x19')](_0x23e8b8);});}_0x459f45();}},'charset':_0x3c91('0x1a'),'collate':_0x3c91('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5d074eb..060fc34 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 _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 +var _0x3475=['register','request','then','info','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','ChatMessage','body','options','raw','CreateChatMessage','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket'];(function(_0x113c74,_0xd2f035){var _0x1909bb=function(_0x4c3212){while(--_0x4c3212){_0x113c74['push'](_0x113c74['shift']());}};_0x1909bb(++_0xd2f035);}(_0x3475,0xbc));var _0x5347=function(_0x33ccfb,_0x5503c7){_0x33ccfb=_0x33ccfb-0x0;var _0x5e4f46=_0x3475[_0x33ccfb];return _0x5e4f46;};'use strict';var _=require(_0x5347('0x0'));var util=require(_0x5347('0x1'));var moment=require(_0x5347('0x2'));var BPromise=require(_0x5347('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5347('0x4'));var db=require(_0x5347('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5347('0x6'))(_0x5347('0x7'));var config=require('../../config/environment');var jayson=require(_0x5347('0x8'));var client=jayson[_0x5347('0x9')][_0x5347('0xa')]({'port':0x232a});config[_0x5347('0xb')]=_[_0x5347('0xc')](config['redis'],{'host':_0x5347('0xd'),'port':0x18eb});var socket=require(_0x5347('0xe'))(new Redis(config[_0x5347('0xb')]));require(_0x5347('0xf'))[_0x5347('0x10')](socket);function respondWithRpcPromise(_0x5ce222,_0x4db134,_0x403a8c){return new BPromise(function(_0x18b5e2,_0x343354){return client[_0x5347('0x11')](_0x5ce222,_0x403a8c)[_0x5347('0x12')](function(_0x4f9626){logger[_0x5347('0x13')]('ChatMessage,\x20%s,\x20%s',_0x4db134,_0x5347('0x14'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4db134,_0x5347('0x14'),JSON[_0x5347('0x15')](_0x4f9626));if(_0x4f9626['error']){if(_0x4f9626[_0x5347('0x16')][_0x5347('0x17')]===0x1f4){logger[_0x5347('0x16')](_0x5347('0x18'),_0x4db134,_0x4f9626[_0x5347('0x16')][_0x5347('0x19')]);return _0x343354(_0x4f9626[_0x5347('0x16')][_0x5347('0x19')]);}logger[_0x5347('0x16')](_0x5347('0x18'),_0x4db134,_0x4f9626[_0x5347('0x16')][_0x5347('0x19')]);return _0x18b5e2(_0x4f9626[_0x5347('0x16')][_0x5347('0x19')]);}else{logger[_0x5347('0x13')](_0x5347('0x18'),_0x4db134,_0x5347('0x14'));_0x18b5e2(_0x4f9626[_0x5347('0x1a')][_0x5347('0x19')]);}})['catch'](function(_0x1238fa){logger[_0x5347('0x16')]('ChatMessage,\x20%s,\x20%s',_0x4db134,_0x1238fa);_0x343354(_0x1238fa);});});}exports['CreateChatMessage']=function(_0x187b3a){var _0x406e75=this;return new Promise(function(_0xe62d2a,_0x19fe45){return db[_0x5347('0x1b')]['create'](_0x187b3a[_0x5347('0x1c')],{'raw':_0x187b3a[_0x5347('0x1d')]?_0x187b3a['options'][_0x5347('0x1e')]===undefined?!![]:![]:!![]})[_0x5347('0x12')](function(_0x1199d2){logger[_0x5347('0x13')](_0x5347('0x1f'),_0x187b3a);logger[_0x5347('0x20')](_0x5347('0x1f'),_0x187b3a,JSON[_0x5347('0x15')](_0x1199d2));_0xe62d2a(_0x1199d2);})[_0x5347('0x21')](function(_0x20db23){logger[_0x5347('0x16')](_0x5347('0x1f'),_0x20db23[_0x5347('0x19')],_0x187b3a);_0x19fe45(_0x406e75[_0x5347('0x16')](0x1f4,_0x20db23[_0x5347('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 716ab02..fa1ab85 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 _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 +var _0x9fc5=['save','remove','emit','removeListener','register','length','chatMessage:'];(function(_0x147d4c,_0xc24f70){var _0x1811fc=function(_0x15c2ee){while(--_0x15c2ee){_0x147d4c['push'](_0x147d4c['shift']());}};_0x1811fc(++_0xc24f70);}(_0x9fc5,0xb6));var _0x59fc=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x9fc5[_0x2405bc];return _0x5272d4;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x59fc('0x0'),_0x59fc('0x1'),'update'];function createListener(_0x4647c5,_0x24cd55){return function(_0x46c819){_0x24cd55[_0x59fc('0x2')](_0x4647c5,_0x46c819);};}function removeListener(_0x44979c,_0x1b0778){return function(){ChatMessageEvents[_0x59fc('0x3')](_0x44979c,_0x1b0778);};}exports[_0x59fc('0x4')]=function(_0x4cb94d){for(var _0x3bde0b=0x0,_0x13897f=events[_0x59fc('0x5')];_0x3bde0b<_0x13897f;_0x3bde0b++){var _0x55fa6d=events[_0x3bde0b];var _0xdd2bb9=createListener(_0x59fc('0x6')+_0x55fa6d,_0x4cb94d);ChatMessageEvents['on'](_0x55fa6d,_0xdd2bb9);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 75afea2..67d1ae2 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 _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 +var _0xb582=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','chat','chatmessage:create','create','put','update','reject','destroy','exports','path','connect-timeout','express'];(function(_0x1f0ebc,_0x519687){var _0x17ada6=function(_0x207a39){while(--_0x207a39){_0x1f0ebc['push'](_0x1f0ebc['shift']());}};_0x17ada6(++_0x519687);}(_0xb582,0x1dd));var _0x2b58=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb582[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2b58('0x0'));var timeout=require(_0x2b58('0x1'));var express=require(_0x2b58('0x2'));var router=express[_0x2b58('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b58('0x4'));var interaction=require(_0x2b58('0x5'));var config=require(_0x2b58('0x6'));var controller=require(_0x2b58('0x7'));router[_0x2b58('0x8')]('/',auth[_0x2b58('0x9')](),controller[_0x2b58('0xa')]);router[_0x2b58('0x8')](_0x2b58('0xb'),auth[_0x2b58('0x9')](),controller[_0x2b58('0xc')]);router[_0x2b58('0x8')](_0x2b58('0xd'),auth[_0x2b58('0x9')](),controller[_0x2b58('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x2b58('0xf')](_0x2b58('0x10'),_0x2b58('0x11')),controller[_0x2b58('0x12')]);router[_0x2b58('0x13')]('/:id',controller[_0x2b58('0x14')]);router[_0x2b58('0x13')]('/:id/accept',auth[_0x2b58('0x9')](),controller['accept']);router[_0x2b58('0x13')]('/:id/reject',auth[_0x2b58('0x9')](),controller[_0x2b58('0x15')]);router['delete'](_0x2b58('0xd'),auth[_0x2b58('0x9')](),controller[_0x2b58('0x16')]);module[_0x2b58('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index dd2cca2..43561e0 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 _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 +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x39664c,_0x47c3c6){var _0x220cb8=function(_0x130d40){while(--_0x130d40){_0x39664c['push'](_0x39664c['shift']());}};_0x220cb8(++_0x47c3c6);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e18a,_0x2d220a){_0x4e18a=_0x4e18a-0x0;var _0x56cc08=_0xb10b[_0x4e18a];return _0x56cc08;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 23e59d3..c8ece0b 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(_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 +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x7a54,0x106));var _0x47a5=function(_0x5d9f6a,_0x25b34c){_0x5d9f6a=_0x5d9f6a-0x0;var _0x18b0ba=_0x7a54[_0x5d9f6a];return _0x18b0ba;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 5229a6f..2717ac7 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 _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 +var _0x11e5=['emit','hasOwnProperty','hook','events','ChatOfflineMessage','setMaxListeners','update','remove'];(function(_0x4ba86d,_0x3a6310){var _0x5521b6=function(_0x35a646){while(--_0x35a646){_0x4ba86d['push'](_0x4ba86d['shift']());}};_0x5521b6(++_0x3a6310);}(_0x11e5,0x8b));var _0x511e=function(_0x22b0cb,_0x5a764a){_0x22b0cb=_0x22b0cb-0x0;var _0x444178=_0x11e5[_0x22b0cb];return _0x444178;};'use strict';var EventEmitter=require(_0x511e('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x511e('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x511e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x511e('0x3'),'afterDestroy':_0x511e('0x4')};function emitEvent(_0x101e06){return function(_0x5cab33,_0x249e4d,_0x4fbd4f){ChatOfflineMessageEvents['emit'](_0x101e06+':'+_0x5cab33['id'],_0x5cab33);ChatOfflineMessageEvents[_0x511e('0x5')](_0x101e06,_0x5cab33);_0x4fbd4f(null);};}for(var e in events){if(events[_0x511e('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x511e('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 48aa39a..c35f78d 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 _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 +var _0x6433=['ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define'];(function(_0x5c7b86,_0x361fde){var _0x189239=function(_0x36887c){while(--_0x36887c){_0x5c7b86['push'](_0x5c7b86['shift']());}};_0x189239(++_0x361fde);}(_0x6433,0xa5));var _0x3643=function(_0x178808,_0x3563f0){_0x178808=_0x178808-0x0;var _0x413b3f=_0x6433[_0x178808];return _0x413b3f;};'use strict';var attributes=require(_0x3643('0x0'));module[_0x3643('0x1')]=function(_0x585ea3){return _0x585ea3[_0x3643('0x2')](_0x3643('0x3'),attributes,{'tableName':_0x3643('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3643('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8ce78ae..fc401f5 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 _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 +var _0x0f09=['code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f09,0x1a5));var _0x90f0=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x0f09[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0x90f0('0x0'));var moment=require(_0x90f0('0x1'));var BPromise=require(_0x90f0('0x2'));var rs=require(_0x90f0('0x3'));var fs=require('fs');var Redis=require(_0x90f0('0x4'));var db=require(_0x90f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x90f0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x90f0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4741a3,_0x17e4ba,_0x2d3559){return new BPromise(function(_0x51edf1,_0x2fa7fc){return client[_0x90f0('0x8')](_0x4741a3,_0x2d3559)[_0x90f0('0x9')](function(_0x39f16e){logger[_0x90f0('0xa')](_0x90f0('0xb'),_0x17e4ba,_0x90f0('0xc'));logger[_0x90f0('0xd')](_0x90f0('0xe'),_0x17e4ba,_0x90f0('0xc'),JSON['stringify'](_0x39f16e));if(_0x39f16e[_0x90f0('0xf')]){if(_0x39f16e[_0x90f0('0xf')][_0x90f0('0x10')]===0x1f4){logger[_0x90f0('0xf')](_0x90f0('0xb'),_0x17e4ba,_0x39f16e[_0x90f0('0xf')]['message']);return _0x2fa7fc(_0x39f16e[_0x90f0('0xf')][_0x90f0('0x11')]);}logger[_0x90f0('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x17e4ba,_0x39f16e[_0x90f0('0xf')]['message']);return _0x51edf1(_0x39f16e['error']['message']);}else{logger[_0x90f0('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x17e4ba,_0x90f0('0xc'));_0x51edf1(_0x39f16e['result'][_0x90f0('0x11')]);}})[_0x90f0('0x12')](function(_0x4f75d5){logger['error'](_0x90f0('0xb'),_0x17e4ba,_0x4f75d5);_0x2fa7fc(_0x4f75d5);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index b27fd0f..9986b3e 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 _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 +var _0xa792=['util','connect-timeout','express','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','put','/:id','update','delete','exports','multer'];(function(_0x4ebe52,_0x42faf2){var _0x4c0e8c=function(_0x47cdf1){while(--_0x47cdf1){_0x4ebe52['push'](_0x4ebe52['shift']());}};_0x4c0e8c(++_0x42faf2);}(_0xa792,0x98));var _0x2a79=function(_0x5911db,_0x5e9a5f){_0x5911db=_0x5911db-0x0;var _0x4f14ae=_0xa792[_0x5911db];return _0x4f14ae;};'use strict';var multer=require(_0x2a79('0x0'));var util=require(_0x2a79('0x1'));var path=require('path');var timeout=require(_0x2a79('0x2'));var express=require(_0x2a79('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2a79('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2a79('0x5'));var controller=require(_0x2a79('0x6'));router['get']('/',auth[_0x2a79('0x7')](),controller[_0x2a79('0x8')]);router[_0x2a79('0x9')](_0x2a79('0xa'),auth['isAuthenticated'](),controller[_0x2a79('0xb')]);router[_0x2a79('0x9')]('/:id',auth[_0x2a79('0x7')](),controller['show']);router['post']('/',auth[_0x2a79('0x7')](),controller['create']);router[_0x2a79('0xc')](_0x2a79('0xd'),auth[_0x2a79('0x7')](),controller[_0x2a79('0xe')]);router[_0x2a79('0xf')](_0x2a79('0xd'),auth[_0x2a79('0x7')](),controller['destroy']);module[_0x2a79('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 92da297..c4b5678 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 _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 +var _0x70ab=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x70ab,0x1e1));var _0xb70a=function(_0x4b5a9f,_0x3bbdf0){_0x4b5a9f=_0x4b5a9f-0x0;var _0x53163a=_0x70ab[_0x4b5a9f];return _0x53163a;};'use strict';var Sequelize=require(_0xb70a('0x0'));module[_0xb70a('0x1')]={'name':{'type':Sequelize[_0xb70a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb70a('0x3')](_0xb70a('0x4'),_0xb70a('0x5')),'defaultValue':_0xb70a('0x4')},'selector':{'type':Sequelize[_0xb70a('0x2')]},'timeout':{'type':Sequelize[_0xb70a('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 6695937..9360dc5 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 _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 +var _0x8917=['../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','destroy','then','sendStatus','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x2e9bd9,_0x1c98df){var _0x1bddf6=function(_0x209089){while(--_0x209089){_0x2e9bd9['push'](_0x2e9bd9['shift']());}};_0x1bddf6(++_0x1c98df);}(_0x8917,0x1d7));var _0x7891=function(_0x4d5cf9,_0x44c875){_0x4d5cf9=_0x4d5cf9-0x0;var _0x348451=_0x8917[_0x4d5cf9];return _0x348451;};'use strict';var emlformat=require(_0x7891('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7891('0x1'));var jsonpatch=require(_0x7891('0x2'));var rp=require(_0x7891('0x3'));var moment=require(_0x7891('0x4'));var BPromise=require(_0x7891('0x5'));var Mustache=require(_0x7891('0x6'));var util=require(_0x7891('0x7'));var path=require(_0x7891('0x8'));var sox=require(_0x7891('0x9'));var csv=require('to-csv');var ejs=require(_0x7891('0xa'));var fs=require('fs');var fs_extra=require(_0x7891('0xb'));var _=require(_0x7891('0xc'));var squel=require(_0x7891('0xd'));var crypto=require(_0x7891('0xe'));var jsforce=require(_0x7891('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7891('0x10'));var querystring=require('querystring');var Papa=require(_0x7891('0x11'));var Redis=require(_0x7891('0x12'));var authService=require(_0x7891('0x13'));var qs=require(_0x7891('0x14'));var as=require(_0x7891('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7891('0x16'))(_0x7891('0x17'));var utils=require(_0x7891('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7891('0x19'));var db=require(_0x7891('0x1a'))['db'];function respondWithStatusCode(_0x1a1dbc,_0x31692f){_0x31692f=_0x31692f||0xcc;return function(_0x1b481e){if(_0x1b481e){return _0x1a1dbc['sendStatus'](_0x31692f);}return _0x1a1dbc[_0x7891('0x1b')](_0x31692f)[_0x7891('0x1c')]();};}function respondWithResult(_0x2517f1,_0xc56bc0){_0xc56bc0=_0xc56bc0||0xc8;return function(_0x71e75c){if(_0x71e75c){return _0x2517f1[_0x7891('0x1b')](_0xc56bc0)['json'](_0x71e75c);}};}function respondWithFilteredResult(_0x1fa45b,_0x21a74f){return function(_0x5bfe12){if(_0x5bfe12){var _0x23286b=typeof _0x21a74f[_0x7891('0x1d')]==='undefined'&&typeof _0x21a74f[_0x7891('0x1e')]===_0x7891('0x1f');var _0x250f65=_0x5bfe12[_0x7891('0x20')];var _0x9ff8c2=_0x23286b?0x0:_0x21a74f[_0x7891('0x1d')];var _0x457f50=_0x23286b?_0x5bfe12[_0x7891('0x20')]:_0x21a74f[_0x7891('0x1d')]+_0x21a74f[_0x7891('0x1e')];var _0x20da1e;if(_0x457f50>=_0x250f65){_0x457f50=_0x250f65;_0x20da1e=0xc8;}else{_0x20da1e=0xce;}_0x1fa45b['status'](_0x20da1e);return _0x1fa45b['set'](_0x7891('0x21'),_0x9ff8c2+'-'+_0x457f50+'/'+_0x250f65)[_0x7891('0x22')](_0x5bfe12);}return null;};}function patchUpdates(_0x30b2ae){return function(_0x4c76fe){try{jsonpatch['apply'](_0x4c76fe,_0x30b2ae,!![]);}catch(_0x19a628){return BPromise[_0x7891('0x23')](_0x19a628);}return _0x4c76fe[_0x7891('0x24')]();};}function saveUpdates(_0x36f66a,_0x155a97){return function(_0xf09f20){if(_0xf09f20){return _0xf09f20[_0x7891('0x25')](_0x36f66a)['then'](function(_0x28a917){return _0x28a917;});}return null;};}function removeEntity(_0xab091c,_0x27f2e0){return function(_0x2de356){if(_0x2de356){return _0x2de356[_0x7891('0x26')]()[_0x7891('0x27')](function(){_0xab091c[_0x7891('0x1b')](0xcc)[_0x7891('0x1c')]();});}};}function handleEntityNotFound(_0x24372f,_0x2acda5){return function(_0x55108b){if(!_0x55108b){_0x24372f[_0x7891('0x28')](0x194);}return _0x55108b;};}function handleError(_0x369740,_0x397d03){_0x397d03=_0x397d03||0x1f4;return function(_0x12ed70){logger['error'](_0x12ed70[_0x7891('0x29')]);if(_0x12ed70['name']){delete _0x12ed70[_0x7891('0x2a')];}_0x369740[_0x7891('0x1b')](_0x397d03)[_0x7891('0x2b')](_0x12ed70);};}exports['show']=function(_0x4009f8,_0x1a6bef){var _0x44442f={'raw':!![],'where':{'id':_0x4009f8[_0x7891('0x2c')]['id']}},_0x263f13={};_0x263f13[_0x7891('0x2d')]=_[_0x7891('0x2e')](db['ChatProactiveAction'][_0x7891('0x2f')]);_0x263f13['query']=_[_0x7891('0x2e')](_0x4009f8[_0x7891('0x30')]);_0x263f13[_0x7891('0x31')]=_[_0x7891('0x32')](_0x263f13[_0x7891('0x2d')],_0x263f13[_0x7891('0x30')]);_0x44442f[_0x7891('0x33')]=_['intersection'](_0x263f13[_0x7891('0x2d')],qs[_0x7891('0x34')](_0x4009f8[_0x7891('0x30')][_0x7891('0x34')]));_0x44442f[_0x7891('0x33')]=_0x44442f[_0x7891('0x33')][_0x7891('0x35')]?_0x44442f['attributes']:_0x263f13['model'];if(_0x4009f8['query']['includeAll']){_0x44442f[_0x7891('0x36')]=[{'all':!![]}];}_0x44442f=_[_0x7891('0x37')]({},_0x44442f,_0x4009f8[_0x7891('0x38')]);return db[_0x7891('0x39')][_0x7891('0x3a')](_0x44442f)[_0x7891('0x27')](handleEntityNotFound(_0x1a6bef,null))['then'](respondWithResult(_0x1a6bef,null))[_0x7891('0x3b')](handleError(_0x1a6bef,null));};exports[_0x7891('0x3c')]=function(_0x19e258,_0x2c1c67){return db[_0x7891('0x39')][_0x7891('0x3c')](_0x19e258[_0x7891('0x3d')],{})['then'](respondWithResult(_0x2c1c67,0xc9))[_0x7891('0x3b')](handleError(_0x2c1c67,null));};exports['update']=function(_0x16ca6d,_0x5ba995){if(_0x16ca6d[_0x7891('0x3d')]['id']){delete _0x16ca6d[_0x7891('0x3d')]['id'];}return db[_0x7891('0x39')][_0x7891('0x3a')]({'where':{'id':_0x16ca6d[_0x7891('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5ba995,null))[_0x7891('0x27')](saveUpdates(_0x16ca6d[_0x7891('0x3d')],null))[_0x7891('0x27')](respondWithResult(_0x5ba995,null))[_0x7891('0x3b')](handleError(_0x5ba995,null));};exports[_0x7891('0x26')]=function(_0x516d5c,_0x4e63ee){return db['ChatProactiveAction'][_0x7891('0x3a')]({'where':{'id':_0x516d5c[_0x7891('0x2c')]['id']}})[_0x7891('0x27')](handleEntityNotFound(_0x4e63ee,null))[_0x7891('0x27')](removeEntity(_0x4e63ee,null))[_0x7891('0x3b')](handleError(_0x4e63ee,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 96e4872..72fdd05 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 _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 +var _0x9ff3=['exports','define','chat_proactive_actions','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0x9ff3,0x159));var _0x39ff=function(_0x451680,_0x9187d8){_0x451680=_0x451680-0x0;var _0x1ba454=_0x9ff3[_0x451680];return _0x1ba454;};'use strict';var _=require('lodash');var util=require(_0x39ff('0x0'));var logger=require(_0x39ff('0x1'))('api');var moment=require('moment');var BPromise=require(_0x39ff('0x2'));var rp=require(_0x39ff('0x3'));var fs=require('fs');var path=require(_0x39ff('0x4'));var rimraf=require(_0x39ff('0x5'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x39ff('0x6')]=function(_0x1c3d09,_0x48c1fa){return _0x1c3d09[_0x39ff('0x7')]('ChatProactiveAction',attributes,{'tableName':_0x39ff('0x8'),'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 e24a011..cbacfc8 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 _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 +var _0x5e36=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x5e36,0x97));var _0x65e3=function(_0x32b5d2,_0x6c38e6){_0x32b5d2=_0x32b5d2-0x0;var _0x43e2ec=_0x5e36[_0x32b5d2];return _0x43e2ec;};'use strict';var _=require(_0x65e3('0x0'));var util=require(_0x65e3('0x1'));var moment=require(_0x65e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x65e3('0x3'));var fs=require('fs');var Redis=require(_0x65e3('0x4'));var db=require(_0x65e3('0x5'))['db'];var utils=require(_0x65e3('0x6'));var logger=require(_0x65e3('0x7'))(_0x65e3('0x8'));var config=require(_0x65e3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x65e3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e7385,_0x4a7bf3,_0x2d64f9){return new BPromise(function(_0x1ea9ac,_0x391f0d){return client[_0x65e3('0xb')](_0x3e7385,_0x2d64f9)[_0x65e3('0xc')](function(_0x1c3ba1){logger[_0x65e3('0xd')](_0x65e3('0xe'),_0x4a7bf3,_0x65e3('0xf'));logger[_0x65e3('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4a7bf3,_0x65e3('0xf'),JSON[_0x65e3('0x11')](_0x1c3ba1));if(_0x1c3ba1[_0x65e3('0x12')]){if(_0x1c3ba1[_0x65e3('0x12')][_0x65e3('0x13')]===0x1f4){logger['error'](_0x65e3('0xe'),_0x4a7bf3,_0x1c3ba1[_0x65e3('0x12')]['message']);return _0x391f0d(_0x1c3ba1[_0x65e3('0x12')][_0x65e3('0x14')]);}logger[_0x65e3('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x4a7bf3,_0x1c3ba1['error'][_0x65e3('0x14')]);return _0x1ea9ac(_0x1c3ba1[_0x65e3('0x12')][_0x65e3('0x14')]);}else{logger[_0x65e3('0xd')](_0x65e3('0xe'),_0x4a7bf3,'request\x20sent');_0x1ea9ac(_0x1c3ba1['result'][_0x65e3('0x14')]);}})[_0x65e3('0x15')](function(_0x3165b2){logger[_0x65e3('0x12')](_0x65e3('0xe'),_0x4a7bf3,_0x3165b2);_0x391f0d(_0x3165b2);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 6e3a893..30be541 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 _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 +var _0xf2ca=['show','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x3eb6d1,_0x25131d){var _0x68df02=function(_0x20e40a){while(--_0x20e40a){_0x3eb6d1['push'](_0x3eb6d1['shift']());}};_0x68df02(++_0x25131d);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x565faf,_0x5f3718){_0x565faf=_0x565faf-0x0;var _0x42292f=_0xf2ca[_0x565faf];return _0x42292f;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./chatProactiveAction.controller');router[_0xaf2c('0x9')](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xc')]);router['post']('/',auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xd')]);router['put'](_0xaf2c('0xa'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['delete'](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xf')]);module[_0xaf2c('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index d4ed627..9b17191 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 _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 +var _0x8a44=['roundrobin','sequelize','STRING','name','rrmemory','beepall'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x8a44,0x18d));var _0x48a4=function(_0x3f7815,_0x362d63){_0x3f7815=_0x3f7815-0x0;var _0x31ab67=_0x8a44[_0x3f7815];return _0x31ab67;};'use strict';var Sequelize=require(_0x48a4('0x0'));module['exports']={'name':{'type':Sequelize[_0x48a4('0x1')],'unique':_0x48a4('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x48a4('0x3'),_0x48a4('0x4'),_0x48a4('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 32e578c..4129ce6 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 _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 +var _0x76eb=['select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','union','value','removeAgents','addAgents','omit','isArray','userChatQueue:remove','getAgents','util','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','get','ChatQueues','UserProfileResource','end','error','stack','name','send','index','map','ChatQueue','type','key','getOptions','where','include','findAll','rows','show','model','keys','rawAttributes','filters','query','attributes','fields','length','includeAll','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserChatQueue','intersection','hasOwnProperty','nolimit','order','sort','pick','filter','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','SIP','getTeams','Team','options','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams'];(function(_0x31c183,_0x3aa6eb){var _0x48e56c=function(_0x1d01fa){while(--_0x1d01fa){_0x31c183['push'](_0x31c183['shift']());}};_0x48e56c(++_0x3aa6eb);}(_0x76eb,0x176));var _0xb76e=function(_0x35ebae,_0x4f86c4){_0x35ebae=_0x35ebae-0x0;var _0x1924cf=_0x76eb[_0x35ebae];return _0x1924cf;};'use strict';var BPromise=require('bluebird');var util=require(_0xb76e('0x0'));var _=require(_0xb76e('0x1'));var squel=require('squel');var Redis=require(_0xb76e('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xb76e('0x3'))(_0xb76e('0x4'));var config=require(_0xb76e('0x5'));var db=require(_0xb76e('0x6'))['db'];config['redis']=_[_0xb76e('0x7')](config[_0xb76e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb76e('0x9'))(new Redis(config[_0xb76e('0x8')]));require('./chatQueue.socket')[_0xb76e('0xa')](socket);function respondWithStatusCode(_0x59e14a,_0x530ea5){_0x530ea5=_0x530ea5||0xcc;return function(_0x55dc2a){if(_0x55dc2a){return _0x59e14a[_0xb76e('0xb')](_0x530ea5);}return _0x59e14a['status'](_0x530ea5)['end']();};}function respondWithResult(_0x5078f5,_0x35f6b0){_0x35f6b0=_0x35f6b0||0xc8;return function(_0x5ca6da){if(_0x5ca6da){return _0x5078f5[_0xb76e('0xc')](_0x35f6b0)[_0xb76e('0xd')](_0x5ca6da);}};}function respondWithFilteredResult(_0x5bb31e,_0x8b0b1e){return function(_0x2e656f){if(_0x2e656f){var _0x47ecf9=typeof _0x8b0b1e[_0xb76e('0xe')]==='undefined'&&typeof _0x8b0b1e[_0xb76e('0xf')]===_0xb76e('0x10');var _0x2dcb7f=_0x2e656f[_0xb76e('0x11')];var _0x509272=_0x47ecf9?0x0:_0x8b0b1e[_0xb76e('0xe')];var _0x325d8c=_0x47ecf9?_0x2e656f['count']:_0x8b0b1e['offset']+_0x8b0b1e['limit'];var _0xbc6184;if(_0x325d8c>=_0x2dcb7f){_0x325d8c=_0x2dcb7f;_0xbc6184=0xc8;}else{_0xbc6184=0xce;}_0x5bb31e[_0xb76e('0xc')](_0xbc6184);return _0x5bb31e[_0xb76e('0x12')](_0xb76e('0x13'),_0x509272+'-'+_0x325d8c+'/'+_0x2dcb7f)[_0xb76e('0xd')](_0x2e656f);}return null;};}function saveUpdates(_0x44c3cb){return function(_0x3d131b){if(_0x3d131b){return _0x3d131b['update'](_0x44c3cb)[_0xb76e('0x14')](function(_0x4e56a4){return _0x4e56a4;});}return null;};}function removeEntity(_0x5ba985){return function(_0x30896f){if(_0x30896f){return _0x30896f[_0xb76e('0x15')]()[_0xb76e('0x14')](function(){var _0x22e5a0=_0x30896f[_0xb76e('0x16')]({'plain':!![]});var _0x1a2c3c=_0xb76e('0x17');return db[_0xb76e('0x18')][_0xb76e('0x15')]({'where':{'type':_0x1a2c3c,'resourceId':_0x22e5a0['id']}})[_0xb76e('0x14')](function(){return _0x30896f;});})[_0xb76e('0x14')](function(){_0x5ba985['status'](0xcc)[_0xb76e('0x19')]();});}};}function handleEntityNotFound(_0x5d7207){return function(_0x1ddf97){if(!_0x1ddf97){_0x5d7207[_0xb76e('0xb')](0x194);}return _0x1ddf97;};}function handleError(_0x89f626,_0x429441){_0x429441=_0x429441||0x1f4;return function(_0x361712){logger[_0xb76e('0x1a')](_0x361712[_0xb76e('0x1b')]);if(_0x361712[_0xb76e('0x1c')]){delete _0x361712['name'];}_0x89f626[_0xb76e('0xc')](_0x429441)[_0xb76e('0x1d')](_0x361712);};}exports[_0xb76e('0x1e')]=function(_0x58ff59,_0x33344){var _0x1419c8={};var _0x265e4e={'count':0x0,'rows':[]};var _0x50e21e=_[_0xb76e('0x1f')](db[_0xb76e('0x20')]['rawAttributes'],function(_0x7ba9ba){return{'name':_0x7ba9ba['fieldName'],'type':_0x7ba9ba[_0xb76e('0x21')][_0xb76e('0x22')]};});_0x1419c8=qs[_0xb76e('0x23')](_0x50e21e,_0x58ff59);var _0x13c832={'where':_0x1419c8[_0xb76e('0x24')]};return db[_0xb76e('0x20')][_0xb76e('0x11')](_0x13c832)[_0xb76e('0x14')](function(_0x11cc48){_0x265e4e['count']=_0x11cc48;_0x1419c8[_0xb76e('0x25')]=qs[_0xb76e('0x25')](_0x58ff59['query']);return db[_0xb76e('0x20')][_0xb76e('0x26')](_0x1419c8);})[_0xb76e('0x14')](function(_0x33719b){_0x265e4e[_0xb76e('0x27')]=_0x33719b;return _0x265e4e;})['then'](respondWithFilteredResult(_0x33344,_0x1419c8))['catch'](handleError(_0x33344,null));};exports[_0xb76e('0x28')]=function(_0x31cbb0,_0x493680){var _0x18a642={'raw':!![],'where':{'id':_0x31cbb0['params']['id']}},_0x1d063a={};_0x1d063a[_0xb76e('0x29')]=_[_0xb76e('0x2a')](db[_0xb76e('0x20')][_0xb76e('0x2b')]);_0x1d063a['query']=_[_0xb76e('0x2a')](_0x31cbb0['query']);_0x1d063a[_0xb76e('0x2c')]=_['intersection'](_0x1d063a[_0xb76e('0x29')],_0x1d063a[_0xb76e('0x2d')]);_0x18a642[_0xb76e('0x2e')]=_['intersection'](_0x1d063a[_0xb76e('0x29')],qs['fields'](_0x31cbb0[_0xb76e('0x2d')][_0xb76e('0x2f')]));_0x18a642[_0xb76e('0x2e')]=_0x18a642['attributes'][_0xb76e('0x30')]?_0x18a642[_0xb76e('0x2e')]:_0x1d063a[_0xb76e('0x29')];if(_0x31cbb0[_0xb76e('0x2d')][_0xb76e('0x31')]){_0x18a642[_0xb76e('0x25')]=[{'all':!![]}];}_0x18a642=_[_0xb76e('0x32')]({},_0x18a642,_0x31cbb0['options']);return db[_0xb76e('0x20')][_0xb76e('0x33')](_0x18a642)[_0xb76e('0x14')](handleEntityNotFound(_0x493680,null))[_0xb76e('0x14')](respondWithResult(_0x493680,null))[_0xb76e('0x34')](handleError(_0x493680,null));};exports[_0xb76e('0x35')]=function(_0x162568,_0x183a51){return db['ChatQueue'][_0xb76e('0x35')](_0x162568[_0xb76e('0x36')],{})[_0xb76e('0x14')](function(_0x49c01a){var _0x2a52d0=_0x162568['user'][_0xb76e('0x16')]({'plain':!![]});if(!_0x2a52d0)throw new Error(_0xb76e('0x37'));if(_0x2a52d0[_0xb76e('0x38')]===_0xb76e('0x39')){var _0x23d9d1=_0x49c01a['get']({'plain':!![]});var _0x4a08d8=_0xb76e('0x17');return db['UserProfileSection'][_0xb76e('0x33')]({'where':{'name':_0x4a08d8,'userProfileId':_0x2a52d0[_0xb76e('0x3a')]},'raw':!![]})['then'](function(_0x235e25){if(_0x235e25&&_0x235e25[_0xb76e('0x3b')]===0x0){return db['UserProfileResource']['create']({'name':_0x23d9d1[_0xb76e('0x1c')],'resourceId':_0x23d9d1['id'],'type':_0x235e25['name'],'sectionId':_0x235e25['id']},{})[_0xb76e('0x14')](function(){return _0x49c01a;});}else{return _0x49c01a;}})[_0xb76e('0x34')](function(_0xeb3b63){logger[_0xb76e('0x1a')](_0xb76e('0x3c'),_0xeb3b63);throw _0xeb3b63;});}return _0x49c01a;})[_0xb76e('0x14')](respondWithResult(_0x183a51,0xc9))[_0xb76e('0x34')](handleError(_0x183a51,null));};exports[_0xb76e('0x3d')]=function(_0xc39912,_0xc97790){if(_0xc39912[_0xb76e('0x36')]['id']){delete _0xc39912[_0xb76e('0x36')]['id'];}return db[_0xb76e('0x20')][_0xb76e('0x33')]({'where':{'id':_0xc39912[_0xb76e('0x3e')]['id']}})['then'](handleEntityNotFound(_0xc97790,null))[_0xb76e('0x14')](saveUpdates(_0xc39912['body'],null))['then'](respondWithResult(_0xc97790,null))['catch'](handleError(_0xc97790,null));};exports[_0xb76e('0x15')]=function(_0x295101,_0x5b8936){return db['ChatQueue']['find']({'where':{'id':_0x295101['params']['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0x5b8936,null))[_0xb76e('0x14')](removeEntity(_0x5b8936,null))[_0xb76e('0x34')](handleError(_0x5b8936,null));};exports[_0xb76e('0x3f')]=function(_0x35a90f,_0x435c00){return db[_0xb76e('0x20')][_0xb76e('0x3f')]()[_0xb76e('0x14')](respondWithResult(_0x435c00,null))[_0xb76e('0x34')](handleError(_0x435c00,null));};exports[_0xb76e('0x40')]=function(_0xb70b4b,_0x386883){var _0x1f3db6={'raw':!![],'where':{}},_0xae27cc={},_0x3c517f;return db[_0xb76e('0x20')][_0xb76e('0x41')]({'where':{'id':_0xb70b4b[_0xb76e('0x3e')]['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0x386883,null))[_0xb76e('0x14')](function(_0x1a2d0d){if(_0x1a2d0d){_0x3c517f=_0x1a2d0d[_0xb76e('0x16')]({'plain':!![]});_0xae27cc[_0xb76e('0x29')]=_[_0xb76e('0x2a')](db[_0xb76e('0x42')][_0xb76e('0x2b')]);_0xae27cc[_0xb76e('0x2d')]=_[_0xb76e('0x2a')](_0xb70b4b[_0xb76e('0x2d')]);_0xae27cc[_0xb76e('0x2c')]=_[_0xb76e('0x43')](_0xae27cc[_0xb76e('0x29')],_0xae27cc[_0xb76e('0x2d')]);_0x1f3db6[_0xb76e('0x2e')]=_[_0xb76e('0x43')](_0xae27cc['model'],qs['fields'](_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0x2f')]));_0x1f3db6[_0xb76e('0x2e')]=_0x1f3db6[_0xb76e('0x2e')][_0xb76e('0x30')]?_0x1f3db6[_0xb76e('0x2e')]:_0xae27cc[_0xb76e('0x29')];if(!_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0x44')](_0xb76e('0x45'))){_0x1f3db6[_0xb76e('0xf')]=qs['limit'](_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0xf')]);_0x1f3db6[_0xb76e('0xe')]=qs[_0xb76e('0xe')](_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0xe')]);}_0x1f3db6[_0xb76e('0x46')]=qs[_0xb76e('0x47')](_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0x47')]);_0x1f3db6['where']=qs[_0xb76e('0x2c')](_[_0xb76e('0x48')](_0xb70b4b[_0xb76e('0x2d')],_0xae27cc[_0xb76e('0x2c')]));_0x1f3db6[_0xb76e('0x24')]['ChatQueueId']=_0x1a2d0d['id'];if(_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0x49')]){_0x1f3db6[_0xb76e('0x24')]=_[_0xb76e('0x32')](_0x1f3db6['where'],{'$or':_[_0xb76e('0x1f')](_0x1f3db6['attributes'],function(_0x4d6cb4){var _0x1829a5={};_0x1829a5[_0x4d6cb4]={'$like':'%'+_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0x49')]+'%'};return _0x1829a5;})});}_0x1f3db6=_[_0xb76e('0x32')]({},_0x1f3db6,_0xb70b4b['options']);return db[_0xb76e('0x42')]['findAll'](_0x1f3db6);}})[_0xb76e('0x14')](function(_0x5bd484){if(_0x5bd484){return db[_0xb76e('0x4a')][_0xb76e('0x4b')]({'where':{'id':_[_0xb76e('0x1f')](_0x5bd484,'UserId'),'role':_0xb76e('0x4c')},'attributes':['id','name',_0xb76e('0x4d'),_0xb76e('0x4e'),_0xb76e('0x4f')]});}})[_0xb76e('0x14')](function(_0x3bc75b){if(_0x3bc75b){return{'count':_0x3bc75b['count'],'rows':_[_0xb76e('0x1f')](_0x3bc75b[_0xb76e('0x27')],function(_0x2dcc91){return{'membername':_0x2dcc91['name'],'UserId':_0x2dcc91['id'],'queue_name':_0x3c517f['name'],'ChatQueueId':_0x3c517f['id'],'interface':util['format']('%s/%s',_0xb76e('0x50'),_0x2dcc91[_0xb76e('0x1c')]),'penalty':0x0,'paused':_0x2dcc91[_0xb76e('0x4d')],'createdAt':_0x2dcc91[_0xb76e('0x4f')],'updatedAt':_0x2dcc91[_0xb76e('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb76e('0x14')](respondWithFilteredResult(_0x386883,_0x1f3db6))[_0xb76e('0x34')](handleError(_0x386883,null));};exports[_0xb76e('0x51')]=function(_0x10c198,_0xa849d6){var _0x1e12f5={};var _0x36f5f3={};var _0x11bead;var _0x35feeb;return db[_0xb76e('0x20')][_0xb76e('0x41')]({'where':{'id':_0x10c198[_0xb76e('0x3e')]['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0xa849d6,null))['then'](function(_0x1cf5e7){if(_0x1cf5e7){_0x11bead=_0x1cf5e7;_0x36f5f3[_0xb76e('0x29')]=_[_0xb76e('0x2a')](db[_0xb76e('0x52')]['rawAttributes']);_0x36f5f3['query']=_[_0xb76e('0x2a')](_0x10c198[_0xb76e('0x2d')]);_0x36f5f3['filters']=_[_0xb76e('0x43')](_0x36f5f3[_0xb76e('0x29')],_0x36f5f3['query']);_0x1e12f5['attributes']=_[_0xb76e('0x43')](_0x36f5f3[_0xb76e('0x29')],qs['fields'](_0x10c198[_0xb76e('0x2d')]['fields']));_0x1e12f5['attributes']=_0x1e12f5[_0xb76e('0x2e')][_0xb76e('0x30')]?_0x1e12f5[_0xb76e('0x2e')]:_0x36f5f3[_0xb76e('0x29')];_0x1e12f5[_0xb76e('0x46')]=qs[_0xb76e('0x47')](_0x10c198[_0xb76e('0x2d')][_0xb76e('0x47')]);_0x1e12f5[_0xb76e('0x24')]=qs[_0xb76e('0x2c')](_[_0xb76e('0x48')](_0x10c198['query'],_0x36f5f3[_0xb76e('0x2c')]));if(_0x10c198[_0xb76e('0x2d')][_0xb76e('0x49')]){_0x1e12f5['where']=_['merge'](_0x1e12f5['where'],{'$or':_[_0xb76e('0x1f')](_0x1e12f5[_0xb76e('0x2e')],function(_0x834b6c){var _0x25bc1e={};_0x25bc1e[_0x834b6c]={'$like':'%'+_0x10c198['query']['filter']+'%'};return _0x25bc1e;})});}_0x1e12f5=_[_0xb76e('0x32')]({},_0x1e12f5,_0x10c198[_0xb76e('0x53')]);return _0x11bead[_0xb76e('0x51')](_0x1e12f5);}})['then'](function(_0x42bc8f){if(_0x42bc8f){_0x35feeb=_0x42bc8f['length'];if(!_0x10c198[_0xb76e('0x2d')]['hasOwnProperty'](_0xb76e('0x45'))){_0x1e12f5[_0xb76e('0xf')]=qs[_0xb76e('0xf')](_0x10c198[_0xb76e('0x2d')][_0xb76e('0xf')]);_0x1e12f5[_0xb76e('0xe')]=qs[_0xb76e('0xe')](_0x10c198[_0xb76e('0x2d')][_0xb76e('0xe')]);}return _0x11bead['getTeams'](_0x1e12f5);}})[_0xb76e('0x14')](function(_0x5ab5f0){if(_0x5ab5f0){return _0x5ab5f0?{'count':_0x35feeb,'rows':_0x5ab5f0}:null;}})[_0xb76e('0x14')](respondWithResult(_0xa849d6,null))[_0xb76e('0x34')](handleError(_0xa849d6,null));};exports[_0xb76e('0x54')]=function(_0x46c0d1,_0x31307d){var _0x389f42=_0x46c0d1[_0xb76e('0x36')][_0xb76e('0x55')];return db[_0xb76e('0x52')][_0xb76e('0x26')]({'where':{'id':_0x389f42},'attributes':['id'],'include':[{'model':db[_0xb76e('0x4a')],'as':_0xb76e('0x56'),'attributes':['id',_0xb76e('0x1c'),_0xb76e('0x57'),_0xb76e('0x58'),_0xb76e('0x59')],'raw':!![]}]})[_0xb76e('0x14')](function(_0xed0b45){if(_0xed0b45){var _0x357851=_[_0xb76e('0x5a')](_0xed0b45,function(_0x414682){var _0x5480af=_0x414682[_0xb76e('0x16')]({'plain':!![]});return _0x5480af['Agents'];});return db[_0xb76e('0x20')][_0xb76e('0x33')]({'where':{'id':_0x46c0d1[_0xb76e('0x3e')]['id']}})[_0xb76e('0x14')](function(_0x202b7a){return db[_0xb76e('0x5b')][_0xb76e('0x5c')](function(_0x35f0e1){return _0x202b7a[_0xb76e('0x54')](_0x389f42,{'transaction':_0x35f0e1})[_0xb76e('0x14')](function(){return BPromise['each'](_0x357851,function(_0xb305d2){return db[_0xb76e('0x42')][_0xb76e('0x5d')]({'where':{'UserId':_0xb305d2['id'],'ChatQueueId':_0x46c0d1[_0xb76e('0x3e')]['id']},'transaction':_0x35f0e1});});})[_0xb76e('0x14')](function(){_0x357851[_0xb76e('0x5e')](function(_0x110ce1){socket[_0xb76e('0x5f')](_0xb76e('0x60'),{'UserId':_0x110ce1['id'],'ChatQueueId':_0x202b7a['id']});});});});});}})[_0xb76e('0x14')](respondWithStatusCode(_0x31307d,null))[_0xb76e('0x34')](handleError(_0x31307d,null));};exports[_0xb76e('0x61')]=function(_0x33589c,_0x3be4d6){return db[_0xb76e('0x52')][_0xb76e('0x26')]({'where':{'id':_0x33589c['query'][_0xb76e('0x55')]},'attributes':['id'],'include':[{'model':db[_0xb76e('0x4a')],'as':_0xb76e('0x56'),'attributes':['id'],'raw':!![]}]})[_0xb76e('0x14')](handleEntityNotFound(_0x3be4d6,null))[_0xb76e('0x14')](function(_0x4cefa9){var _0x23a3ce=_[_0xb76e('0x1f')](_0x4cefa9,'id');var _0x1e018f=[];var _0x51aa44=[];var _0x1d40f8=squel[_0xb76e('0x62')]();_0x1d40f8[_0xb76e('0x63')](_0xb76e('0x64'))['from'](_0xb76e('0x65'),'tq')[_0xb76e('0x66')](_0xb76e('0x67'),'ut',_0xb76e('0x68'))['where'](_0xb76e('0x69'),_0x33589c[_0xb76e('0x3e')]['id']);for(var _0x4a6e44=0x0;_0x4a6e44<_0x4cefa9['length'];_0x4a6e44+=0x1){let _0x3d5492=_0x4cefa9[_0x4a6e44];for(var _0x3d5143=0x0;_0x3d5143<_0x3d5492['Agents'][_0xb76e('0x30')];_0x3d5143+=0x1){let _0x2b672c=_0x3d5492[_0xb76e('0x56')][_0x3d5143];var _0x4adde5=_0x1d40f8['clone']();_0x4adde5[_0xb76e('0x24')](_0xb76e('0x6a'),_0x2b672c['id']);_0x51aa44[_0xb76e('0x6b')](db[_0xb76e('0x5b')][_0xb76e('0x2d')](_0x4adde5[_0xb76e('0x6c')](),{'type':db[_0xb76e('0x5b')][_0xb76e('0x6d')]['SELECT']})[_0xb76e('0x14')](function(_0x2b3d17){if(_0x2b3d17[_0xb76e('0x30')]===0x1){return _0x2b672c['id'];}else{var _0xefd865=_['every'](_[_0xb76e('0x1f')](_0x2b3d17,'TeamId'),function(_0xf977b8){return _['includes'](_0x23a3ce,_0xf977b8);});if(_0xefd865){return _0x2b672c['id'];}}}));}}return BPromise['all'](_0x51aa44)[_0xb76e('0x14')](function(_0x4a8ba3){_0x1e018f=_(_0x1e018f)[_0xb76e('0x6e')](_0x4a8ba3)['compact']()[_0xb76e('0x6f')]();return db['ChatQueue'][_0xb76e('0x33')]({'where':{'id':_0x33589c[_0xb76e('0x3e')]['id']}})[_0xb76e('0x14')](function(_0x163b60){return db['sequelize'][_0xb76e('0x5c')](function(_0x25c28e){return _0x163b60[_0xb76e('0x61')](_0x33589c[_0xb76e('0x2d')][_0xb76e('0x55')],{'transaction':_0x25c28e})[_0xb76e('0x14')](function(){if(!_['isEmpty'](_0x1e018f)){return _0x163b60[_0xb76e('0x70')](_0x1e018f,{'transaction':_0x25c28e});}})[_0xb76e('0x14')](function(){_0x1e018f['forEach'](function(_0x1b0e38){socket['emit']('userChatQueue:remove',{'UserId':_0x1b0e38,'ChatQueueId':_0x163b60['id']});});});});});});})[_0xb76e('0x14')](respondWithStatusCode(_0x3be4d6,null))[_0xb76e('0x34')](handleError(_0x3be4d6,null));};exports['addAgents']=function(_0xd57cb3,_0x44410f){return db['ChatQueue']['find']({'where':{'id':_0xd57cb3[_0xb76e('0x3e')]['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0x44410f,null))['then'](function(_0x3abbb1){if(_0x3abbb1){return _0x3abbb1[_0xb76e('0x71')](_0xd57cb3['body'][_0xb76e('0x55')],_[_0xb76e('0x72')](_0xd57cb3['body'],[_0xb76e('0x55'),'id'])||{})['spread'](function(_0x23b708){for(var _0x433464=0x0;_0x433464<_0xd57cb3[_0xb76e('0x36')][_0xb76e('0x55')][_0xb76e('0x30')];_0x433464+=0x1){socket[_0xb76e('0x5f')](_0xb76e('0x60'),{'UserId':Number(_0xd57cb3[_0xb76e('0x36')][_0xb76e('0x55')][_0x433464]),'ChatQueueId':Number(_0xd57cb3[_0xb76e('0x3e')]['id'])});}return _0x23b708;});}})[_0xb76e('0x14')](respondWithResult(_0x44410f,null))[_0xb76e('0x34')](handleError(_0x44410f,null));};exports[_0xb76e('0x70')]=function(_0x51b78b,_0x12b11e){return db[_0xb76e('0x20')][_0xb76e('0x33')]({'where':{'id':_0x51b78b['params']['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0x12b11e,null))[_0xb76e('0x14')](function(_0x3b1959){if(_0x3b1959){return _0x3b1959[_0xb76e('0x70')](_0x51b78b[_0xb76e('0x2d')][_0xb76e('0x55')])[_0xb76e('0x14')](function(){if(_[_0xb76e('0x73')](_0x51b78b[_0xb76e('0x2d')]['ids'])){for(var _0x4f9ce5=0x0;_0x4f9ce5<_0x51b78b[_0xb76e('0x2d')][_0xb76e('0x55')][_0xb76e('0x30')];_0x4f9ce5+=0x1){socket[_0xb76e('0x5f')](_0xb76e('0x74'),{'UserId':Number(_0x51b78b[_0xb76e('0x2d')][_0xb76e('0x55')][_0x4f9ce5]),'ChatQueueId':Number(_0x51b78b['params']['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x51b78b[_0xb76e('0x2d')][_0xb76e('0x55')]),'ChatQueueId':Number(_0x51b78b[_0xb76e('0x3e')]['id'])});}});}})[_0xb76e('0x14')](respondWithStatusCode(_0x12b11e,null))[_0xb76e('0x34')](handleError(_0x12b11e,null));};exports[_0xb76e('0x75')]=function(_0x1aecfc,_0x58edba){var _0xbcdc57={};var _0x1511c3={};var _0x21f9c5;var _0x114f14;return db[_0xb76e('0x20')]['findOne']({'where':{'id':_0x1aecfc['params']['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0x58edba,null))[_0xb76e('0x14')](function(_0x282f70){if(_0x282f70){_0x21f9c5=_0x282f70;_0x1511c3[_0xb76e('0x29')]=_[_0xb76e('0x2a')](db['User'][_0xb76e('0x2b')]);_0x1511c3[_0xb76e('0x2d')]=_[_0xb76e('0x2a')](_0x1aecfc[_0xb76e('0x2d')]);_0x1511c3[_0xb76e('0x2c')]=_[_0xb76e('0x43')](_0x1511c3[_0xb76e('0x29')],_0x1511c3[_0xb76e('0x2d')]);_0xbcdc57['attributes']=_[_0xb76e('0x43')](_0x1511c3[_0xb76e('0x29')],qs[_0xb76e('0x2f')](_0x1aecfc[_0xb76e('0x2d')][_0xb76e('0x2f')]));_0xbcdc57[_0xb76e('0x2e')]=_0xbcdc57[_0xb76e('0x2e')][_0xb76e('0x30')]?_0xbcdc57[_0xb76e('0x2e')]:_0x1511c3[_0xb76e('0x29')];_0xbcdc57[_0xb76e('0x46')]=qs[_0xb76e('0x47')](_0x1aecfc[_0xb76e('0x2d')][_0xb76e('0x47')]);_0xbcdc57[_0xb76e('0x24')]=qs[_0xb76e('0x2c')](_['pick'](_0x1aecfc['query'],_0x1511c3[_0xb76e('0x2c')]));if(_0x1aecfc[_0xb76e('0x2d')]['filter']){_0xbcdc57[_0xb76e('0x24')]=_[_0xb76e('0x32')](_0xbcdc57[_0xb76e('0x24')],{'$or':_['map'](_0xbcdc57['attributes'],function(_0x49b232){var _0x2ddbf6={};_0x2ddbf6[_0x49b232]={'$like':'%'+_0x1aecfc[_0xb76e('0x2d')][_0xb76e('0x49')]+'%'};return _0x2ddbf6;})});}_0xbcdc57=_[_0xb76e('0x32')]({},_0xbcdc57,_0x1aecfc[_0xb76e('0x53')]);return _0x21f9c5['getAgents'](_0xbcdc57);}})[_0xb76e('0x14')](function(_0x26d387){if(_0x26d387){_0x114f14=_0x26d387[_0xb76e('0x30')];if(!_0x1aecfc[_0xb76e('0x2d')][_0xb76e('0x44')]('nolimit')){_0xbcdc57[_0xb76e('0xf')]=qs[_0xb76e('0xf')](_0x1aecfc['query']['limit']);_0xbcdc57[_0xb76e('0xe')]=qs[_0xb76e('0xe')](_0x1aecfc[_0xb76e('0x2d')][_0xb76e('0xe')]);}return _0x21f9c5[_0xb76e('0x75')](_0xbcdc57);}})['then'](function(_0x36a269){if(_0x36a269){return _0x36a269?{'count':_0x114f14,'rows':_0x36a269}:null;}})[_0xb76e('0x14')](respondWithResult(_0x58edba,null))[_0xb76e('0x34')](handleError(_0x58edba,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f9cdd8b..058e566 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 _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 +var _0x9406=['hasOwnProperty','hook','exports','ChatQueue','setMaxListeners','update','remove','emit'];(function(_0x13f9ae,_0xb03598){var _0x14d535=function(_0x39d44f){while(--_0x39d44f){_0x13f9ae['push'](_0x13f9ae['shift']());}};_0x14d535(++_0xb03598);}(_0x9406,0x14b));var _0x6940=function(_0x543881,_0x57a681){_0x543881=_0x543881-0x0;var _0x12311b=_0x9406[_0x543881];return _0x12311b;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x6940('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6940('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6940('0x2'),'afterDestroy':_0x6940('0x3')};function emitEvent(_0x5b8be7){return function(_0x5ce139,_0x3bc0ba,_0x421f62){ChatQueueEvents[_0x6940('0x4')](_0x5b8be7+':'+_0x5ce139['id'],_0x5ce139);ChatQueueEvents[_0x6940('0x4')](_0x5b8be7,_0x5ce139);_0x421f62(null);};}for(var e in events){if(events[_0x6940('0x5')](e)){var event=events[e];ChatQueue[_0x6940('0x6')](e,emitEvent(event));}}module[_0x6940('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 ee9b852..fbf978c 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 _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 +var _0xa39e=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment'];(function(_0x13c52d,_0x232bc0){var _0x5177b3=function(_0xdf3dac){while(--_0xdf3dac){_0x13c52d['push'](_0x13c52d['shift']());}};_0x5177b3(++_0x232bc0);}(_0xa39e,0xa5));var _0xea39=function(_0x1061de,_0x38998a){_0x1061de=_0x1061de-0x0;var _0x3b543f=_0xa39e[_0x1061de];return _0x3b543f;};'use strict';var _=require(_0xea39('0x0'));var util=require('util');var logger=require(_0xea39('0x1'))(_0xea39('0x2'));var moment=require(_0xea39('0x3'));var BPromise=require('bluebird');var rp=require(_0xea39('0x4'));var fs=require('fs');var path=require(_0xea39('0x5'));var rimraf=require(_0xea39('0x6'));var config=require(_0xea39('0x7'));var attributes=require(_0xea39('0x8'));module[_0xea39('0x9')]=function(_0x39ef56,_0x1e735d){return _0x39ef56[_0xea39('0xa')](_0xea39('0xb'),attributes,{'tableName':_0xea39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 19b5d8e..1e17bdd 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 _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 +var _0xd4a2=['defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowChatQueue','find','catch','lodash','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dc587,_0x2ebc6c){var _0x29f93a=function(_0x5ab3d4){while(--_0x5ab3d4){_0x3dc587['push'](_0x3dc587['shift']());}};_0x29f93a(++_0x2ebc6c);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2a4fa7,_0x83dd47){_0x2a4fa7=_0x2a4fa7-0x0;var _0x2a66d2=_0xd4a2[_0x2a4fa7];return _0x2a66d2;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4a('0x3'));var logger=require('../../config/logger')(_0x2d4a('0x4'));var config=require(_0x2d4a('0x5'));var jayson=require(_0x2d4a('0x6'));var client=jayson[_0x2d4a('0x7')][_0x2d4a('0x8')]({'port':0x232a});config['redis']=_[_0x2d4a('0x9')](config[_0x2d4a('0xa')],{'host':_0x2d4a('0xb'),'port':0x18eb});var socket=require(_0x2d4a('0xc'))(new Redis(config[_0x2d4a('0xa')]));require(_0x2d4a('0xd'))[_0x2d4a('0xe')](socket);function respondWithRpcPromise(_0x113839,_0x33b786,_0x4738dc){return new BPromise(function(_0x3abbbd,_0xce6af6){return client['request'](_0x113839,_0x4738dc)['then'](function(_0x4002de){logger['info'](_0x2d4a('0xf'),_0x33b786,_0x2d4a('0x10'));logger[_0x2d4a('0x11')](_0x2d4a('0x12'),_0x33b786,_0x2d4a('0x10'),JSON[_0x2d4a('0x13')](_0x4002de));if(_0x4002de[_0x2d4a('0x14')]){if(_0x4002de[_0x2d4a('0x14')]['code']===0x1f4){logger['error'](_0x2d4a('0xf'),_0x33b786,_0x4002de['error'][_0x2d4a('0x15')]);return _0xce6af6(_0x4002de[_0x2d4a('0x14')][_0x2d4a('0x15')]);}logger[_0x2d4a('0x14')]('ChatQueue,\x20%s,\x20%s',_0x33b786,_0x4002de[_0x2d4a('0x14')]['message']);return _0x3abbbd(_0x4002de[_0x2d4a('0x14')]['message']);}else{logger[_0x2d4a('0x16')](_0x2d4a('0xf'),_0x33b786,_0x2d4a('0x10'));_0x3abbbd(_0x4002de[_0x2d4a('0x17')]['message']);}})['catch'](function(_0x5ac74b){logger[_0x2d4a('0x14')](_0x2d4a('0xf'),_0x33b786,_0x5ac74b);_0xce6af6(_0x5ac74b);});});}exports[_0x2d4a('0x18')]=function(_0x419df5){var _0x46c331=this;return new Promise(function(_0x2e4069,_0x56445a){return db['ChatQueue'][_0x2d4a('0x19')]({'raw':_0x419df5[_0x2d4a('0x1a')]?_0x419df5[_0x2d4a('0x1a')][_0x2d4a('0x1b')]===undefined?!![]:![]:!![],'where':_0x419df5[_0x2d4a('0x1a')]?_0x419df5[_0x2d4a('0x1a')][_0x2d4a('0x1c')]||null:null,'attributes':_0x419df5[_0x2d4a('0x1a')]?_0x419df5['options'][_0x2d4a('0x1d')]||null:null,'limit':_0x419df5[_0x2d4a('0x1a')]?_0x419df5[_0x2d4a('0x1a')][_0x2d4a('0x1e')]||null:null,'include':_0x419df5[_0x2d4a('0x1a')]?_0x419df5[_0x2d4a('0x1a')][_0x2d4a('0x1f')]?_[_0x2d4a('0x20')](_0x419df5['options']['include'],function(_0x5cc7d8){return{'model':db[_0x5cc7d8[_0x2d4a('0x21')]],'as':_0x5cc7d8['as'],'attributes':_0x5cc7d8['attributes'],'include':_0x5cc7d8[_0x2d4a('0x1f')]?_[_0x2d4a('0x20')](_0x5cc7d8[_0x2d4a('0x1f')],function(_0x1d2fa6){return{'model':db[_0x1d2fa6[_0x2d4a('0x21')]],'as':_0x1d2fa6['as'],'attributes':_0x1d2fa6[_0x2d4a('0x1d')],'include':_0x1d2fa6[_0x2d4a('0x1f')]?_[_0x2d4a('0x20')](_0x1d2fa6['include'],function(_0x436f53){return{'model':db[_0x436f53['model']],'as':_0x436f53['as'],'attributes':_0x436f53[_0x2d4a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2d4a('0x22')](function(_0xc497ce){logger[_0x2d4a('0x16')](_0x2d4a('0x18'),_0x419df5);logger[_0x2d4a('0x11')](_0x2d4a('0x18'),_0x419df5,JSON[_0x2d4a('0x13')](_0xc497ce));_0x2e4069(_0xc497ce);})['catch'](function(_0x45a4fa){logger[_0x2d4a('0x14')](_0x2d4a('0x18'),_0x45a4fa[_0x2d4a('0x15')],_0x419df5);_0x56445a(_0x46c331[_0x2d4a('0x14')](0x1f4,_0x45a4fa['message']));});});};exports[_0x2d4a('0x23')]=function(_0x31d8ae){var _0x27015d=this;return new Promise(function(_0x24bcc2,_0x2bb93d){return db['ChatQueue'][_0x2d4a('0x24')]({'raw':_0x31d8ae[_0x2d4a('0x1a')]?_0x31d8ae[_0x2d4a('0x1a')][_0x2d4a('0x1b')]===undefined?!![]:![]:!![],'where':_0x31d8ae[_0x2d4a('0x1a')]?_0x31d8ae[_0x2d4a('0x1a')]['where']||null:null,'attributes':_0x31d8ae[_0x2d4a('0x1a')]?_0x31d8ae[_0x2d4a('0x1a')][_0x2d4a('0x1d')]||null:null,'include':_0x31d8ae[_0x2d4a('0x1a')]?_0x31d8ae[_0x2d4a('0x1a')]['include']?_[_0x2d4a('0x20')](_0x31d8ae[_0x2d4a('0x1a')]['include'],function(_0x2b3093){return{'model':db[_0x2b3093[_0x2d4a('0x21')]],'as':_0x2b3093['as'],'attributes':_0x2b3093[_0x2d4a('0x1d')],'include':_0x2b3093[_0x2d4a('0x1f')]?_[_0x2d4a('0x20')](_0x2b3093[_0x2d4a('0x1f')],function(_0x487d2e){return{'model':db[_0x487d2e[_0x2d4a('0x21')]],'as':_0x487d2e['as'],'attributes':_0x487d2e[_0x2d4a('0x1d')],'include':_0x487d2e[_0x2d4a('0x1f')]?_[_0x2d4a('0x20')](_0x487d2e[_0x2d4a('0x1f')],function(_0x145f21){return{'model':db[_0x145f21['model']],'as':_0x145f21['as'],'attributes':_0x145f21['attributes']};}):[]};}):[]};}):[]:[]})[_0x2d4a('0x22')](function(_0x4b833b){logger[_0x2d4a('0x16')](_0x2d4a('0x23'),_0x31d8ae);logger['debug'](_0x2d4a('0x23'),_0x31d8ae,JSON[_0x2d4a('0x13')](_0x4b833b));_0x24bcc2(_0x4b833b);})[_0x2d4a('0x25')](function(_0x1035b9){logger[_0x2d4a('0x14')](_0x2d4a('0x23'),_0x1035b9[_0x2d4a('0x15')],_0x31d8ae);_0x2bb93d(_0x27015d[_0x2d4a('0x14')](0x1f4,_0x1035b9[_0x2d4a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index bf9e033..322feba 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 _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 +var _0x0bde=['save','update','emit','removeListener','register','length','chatQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xe0bd('0x0'),'remove',_0xe0bd('0x1')];function createListener(_0x3dc984,_0x1d8922){return function(_0x1e198a){_0x1d8922[_0xe0bd('0x2')](_0x3dc984,_0x1e198a);};}function removeListener(_0x5541b9,_0x34df88){return function(){ChatQueueEvents[_0xe0bd('0x3')](_0x5541b9,_0x34df88);};}exports[_0xe0bd('0x4')]=function(_0x3b712a){for(var _0x22bfd1=0x0,_0x26393f=events[_0xe0bd('0x5')];_0x22bfd1<_0x26393f;_0x22bfd1++){var _0x491dc7=events[_0x22bfd1];var _0x40b36a=createListener(_0xe0bd('0x6')+_0x491dc7,_0x3b712a);ChatQueueEvents['on'](_0x491dc7,_0x40b36a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index cf0b422..9cd180c 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_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 +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(_0x5373dc,_0x1c10d9){var _0x102fde=function(_0x2eecf5){while(--_0x2eecf5){_0x5373dc['push'](_0x5373dc['shift']());}};_0x102fde(++_0x1c10d9);}(_0x008c,0x188));var _0xc008=function(_0x419b6a,_0x265b43){_0x419b6a=_0x419b6a-0x0;var _0x229232=_0x008c[_0x419b6a];return _0x229232;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 2a564bf..39ae136 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 _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 +var _0x5b84=['sequelize','exports','STRING','DATE'];(function(_0x47a2a0,_0x3a8742){var _0x4d279d=function(_0x6e5f3a){while(--_0x6e5f3a){_0x47a2a0['push'](_0x47a2a0['shift']());}};_0x4d279d(++_0x3a8742);}(_0x5b84,0x1ac));var _0x45b8=function(_0x507b3f,_0xd4249c){_0x507b3f=_0x507b3f-0x0;var _0x428730=_0x5b84[_0x507b3f];return _0x428730;};'use strict';var moment=require('moment');var Sequelize=require(_0x45b8('0x0'));module[_0x45b8('0x1')]={'uniqueid':{'type':Sequelize[_0x45b8('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x45b8('0x3')]},'leaveAt':{'type':Sequelize[_0x45b8('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x45b8('0x3')]},'reason':{'type':Sequelize[_0x45b8('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index a5c3732..27b7cb8 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 _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 +var _0x7f94=['ChatQueueReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','filter','merge','options','include','findAll','rows','catch','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x5217ee,_0xd2c4d3){var _0x1e5cd=function(_0x49665e){while(--_0x49665e){_0x5217ee['push'](_0x5217ee['shift']());}};_0x1e5cd(++_0xd2c4d3);}(_0x7f94,0x65));var _0x47f9=function(_0x5e9a54,_0x39a4e1){_0x5e9a54=_0x5e9a54-0x0;var _0x581d64=_0x7f94[_0x5e9a54];return _0x581d64;};'use strict';var emlformat=require(_0x47f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x47f9('0x1'));var jsonpatch=require(_0x47f9('0x2'));var rp=require(_0x47f9('0x3'));var moment=require(_0x47f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47f9('0x5'));var util=require(_0x47f9('0x6'));var path=require(_0x47f9('0x7'));var sox=require(_0x47f9('0x8'));var csv=require(_0x47f9('0x9'));var ejs=require(_0x47f9('0xa'));var fs=require('fs');var fs_extra=require(_0x47f9('0xb'));var _=require('lodash');var squel=require(_0x47f9('0xc'));var crypto=require(_0x47f9('0xd'));var jsforce=require(_0x47f9('0xe'));var deskjs=require(_0x47f9('0xf'));var toCsv=require(_0x47f9('0x9'));var querystring=require(_0x47f9('0x10'));var Papa=require(_0x47f9('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x47f9('0x12'));var logger=require(_0x47f9('0x13'))(_0x47f9('0x14'));var utils=require(_0x47f9('0x15'));var config=require(_0x47f9('0x16'));var licenseUtil=require(_0x47f9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a8bac,_0x1002f7){_0x1002f7=_0x1002f7||0xcc;return function(_0x49c33c){if(_0x49c33c){return _0x5a8bac['sendStatus'](_0x1002f7);}return _0x5a8bac['status'](_0x1002f7)[_0x47f9('0x18')]();};}function respondWithResult(_0x43e4db,_0x4d44dd){_0x4d44dd=_0x4d44dd||0xc8;return function(_0x166860){if(_0x166860){return _0x43e4db[_0x47f9('0x19')](_0x4d44dd)[_0x47f9('0x1a')](_0x166860);}};}function respondWithFilteredResult(_0x2a6444,_0x48cc81){return function(_0x3320d1){if(_0x3320d1){var _0x3703e1=typeof _0x48cc81[_0x47f9('0x1b')]===_0x47f9('0x1c')&&typeof _0x48cc81[_0x47f9('0x1d')]==='undefined';var _0x56775f=_0x3320d1['count'];var _0xd80474=_0x3703e1?0x0:_0x48cc81[_0x47f9('0x1b')];var _0x32bb57=_0x3703e1?_0x3320d1[_0x47f9('0x1e')]:_0x48cc81[_0x47f9('0x1b')]+_0x48cc81[_0x47f9('0x1d')];var _0x29700e;if(_0x32bb57>=_0x56775f){_0x32bb57=_0x56775f;_0x29700e=0xc8;}else{_0x29700e=0xce;}_0x2a6444[_0x47f9('0x19')](_0x29700e);return _0x2a6444[_0x47f9('0x1f')](_0x47f9('0x20'),_0xd80474+'-'+_0x32bb57+'/'+_0x56775f)[_0x47f9('0x1a')](_0x3320d1);}return null;};}function patchUpdates(_0x328d14){return function(_0x397dd5){try{jsonpatch['apply'](_0x397dd5,_0x328d14,!![]);}catch(_0x4d35bf){return BPromise[_0x47f9('0x21')](_0x4d35bf);}return _0x397dd5['save']();};}function saveUpdates(_0x2e2b69,_0x29b7f8){return function(_0x2ecf99){if(_0x2ecf99){return _0x2ecf99[_0x47f9('0x22')](_0x2e2b69)[_0x47f9('0x23')](function(_0x11ef91){return _0x11ef91;});}return null;};}function removeEntity(_0x6a49d,_0x3c4778){return function(_0x4fd2b1){if(_0x4fd2b1){return _0x4fd2b1[_0x47f9('0x24')]()[_0x47f9('0x23')](function(){_0x6a49d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26bd84,_0x4c16e0){return function(_0x76077d){if(!_0x76077d){_0x26bd84['sendStatus'](0x194);}return _0x76077d;};}function handleError(_0x26174a,_0x1a8c4b){_0x1a8c4b=_0x1a8c4b||0x1f4;return function(_0x5dbdda){logger[_0x47f9('0x25')](_0x5dbdda[_0x47f9('0x26')]);if(_0x5dbdda[_0x47f9('0x27')]){delete _0x5dbdda[_0x47f9('0x27')];}_0x26174a[_0x47f9('0x19')](_0x1a8c4b)[_0x47f9('0x28')](_0x5dbdda);};}exports[_0x47f9('0x29')]=function(_0x52927a,_0x53e951){var _0x4c37d2={},_0x481ccb={},_0x1a5b58={'count':0x0,'rows':[]};var _0x5818a6=_[_0x47f9('0x2a')](db[_0x47f9('0x2b')][_0x47f9('0x2c')],function(_0xaf0fea){return{'name':_0xaf0fea[_0x47f9('0x2d')],'type':_0xaf0fea[_0x47f9('0x2e')]['key']};});_0x481ccb['model']=_[_0x47f9('0x2a')](_0x5818a6,_0x47f9('0x27'));_0x481ccb['query']=_[_0x47f9('0x2f')](_0x52927a[_0x47f9('0x30')]);_0x481ccb[_0x47f9('0x31')]=_[_0x47f9('0x32')](_0x481ccb[_0x47f9('0x33')],_0x481ccb[_0x47f9('0x30')]);_0x4c37d2[_0x47f9('0x34')]=_[_0x47f9('0x32')](_0x481ccb[_0x47f9('0x33')],qs[_0x47f9('0x35')](_0x52927a[_0x47f9('0x30')][_0x47f9('0x35')]));_0x4c37d2[_0x47f9('0x34')]=_0x4c37d2['attributes'][_0x47f9('0x36')]?_0x4c37d2[_0x47f9('0x34')]:_0x481ccb['model'];if(!_0x52927a[_0x47f9('0x30')][_0x47f9('0x37')]('nolimit')){_0x4c37d2[_0x47f9('0x1d')]=qs['limit'](_0x52927a[_0x47f9('0x30')][_0x47f9('0x1d')]);_0x4c37d2[_0x47f9('0x1b')]=qs['offset'](_0x52927a[_0x47f9('0x30')][_0x47f9('0x1b')]);}_0x4c37d2[_0x47f9('0x38')]=qs[_0x47f9('0x39')](_0x52927a[_0x47f9('0x30')]['sort']);_0x4c37d2['where']=qs['filters'](_[_0x47f9('0x3a')](_0x52927a[_0x47f9('0x30')],_0x481ccb[_0x47f9('0x31')]),_0x5818a6);if(_0x52927a['query']['filter']){_0x4c37d2[_0x47f9('0x3b')]=_['merge'](_0x4c37d2[_0x47f9('0x3b')],{'$or':_['map'](_0x5818a6,function(_0x563492){if(_0x563492[_0x47f9('0x2e')]!=='VIRTUAL'){var _0xfe4480={};_0xfe4480[_0x563492[_0x47f9('0x27')]]={'$like':'%'+_0x52927a[_0x47f9('0x30')][_0x47f9('0x3c')]+'%'};return _0xfe4480;}})});}_0x4c37d2=_[_0x47f9('0x3d')]({},_0x4c37d2,_0x52927a[_0x47f9('0x3e')]);var _0x27ca33={'where':_0x4c37d2['where']};return db['ChatQueueReport'][_0x47f9('0x1e')](_0x27ca33)[_0x47f9('0x23')](function(_0x118db1){_0x1a5b58[_0x47f9('0x1e')]=_0x118db1;if(_0x52927a[_0x47f9('0x30')]['includeAll']){_0x4c37d2[_0x47f9('0x3f')]=[{'all':!![]}];}return db[_0x47f9('0x2b')][_0x47f9('0x40')](_0x4c37d2);})[_0x47f9('0x23')](function(_0x3128bc){_0x1a5b58[_0x47f9('0x41')]=_0x3128bc;return _0x1a5b58;})[_0x47f9('0x23')](respondWithFilteredResult(_0x53e951,_0x4c37d2))[_0x47f9('0x42')](handleError(_0x53e951,null));};exports['show']=function(_0x311975,_0xc61254){var _0x55443d={'raw':!![],'where':{'id':_0x311975['params']['id']}},_0x587a7f={};_0x587a7f[_0x47f9('0x33')]=_[_0x47f9('0x2f')](db[_0x47f9('0x2b')][_0x47f9('0x2c')]);_0x587a7f[_0x47f9('0x30')]=_[_0x47f9('0x2f')](_0x311975[_0x47f9('0x30')]);_0x587a7f[_0x47f9('0x31')]=_[_0x47f9('0x32')](_0x587a7f[_0x47f9('0x33')],_0x587a7f['query']);_0x55443d['attributes']=_['intersection'](_0x587a7f[_0x47f9('0x33')],qs['fields'](_0x311975[_0x47f9('0x30')][_0x47f9('0x35')]));_0x55443d['attributes']=_0x55443d[_0x47f9('0x34')][_0x47f9('0x36')]?_0x55443d['attributes']:_0x587a7f[_0x47f9('0x33')];if(_0x311975[_0x47f9('0x30')]['includeAll']){_0x55443d[_0x47f9('0x3f')]=[{'all':!![]}];}_0x55443d=_[_0x47f9('0x3d')]({},_0x55443d,_0x311975[_0x47f9('0x3e')]);return db[_0x47f9('0x2b')][_0x47f9('0x43')](_0x55443d)[_0x47f9('0x23')](handleEntityNotFound(_0xc61254,null))[_0x47f9('0x23')](respondWithResult(_0xc61254,null))[_0x47f9('0x42')](handleError(_0xc61254,null));};exports[_0x47f9('0x44')]=function(_0x411695,_0x38d61d){return db[_0x47f9('0x2b')][_0x47f9('0x44')](_0x411695[_0x47f9('0x45')],{})[_0x47f9('0x23')](respondWithResult(_0x38d61d,0xc9))['catch'](handleError(_0x38d61d,null));};exports[_0x47f9('0x22')]=function(_0x1c6e21,_0x58fc09){if(_0x1c6e21[_0x47f9('0x45')]['id']){delete _0x1c6e21[_0x47f9('0x45')]['id'];}return db[_0x47f9('0x2b')]['find']({'where':{'id':_0x1c6e21['params']['id']}})[_0x47f9('0x23')](handleEntityNotFound(_0x58fc09,null))['then'](saveUpdates(_0x1c6e21[_0x47f9('0x45')],null))['then'](respondWithResult(_0x58fc09,null))['catch'](handleError(_0x58fc09,null));};exports[_0x47f9('0x24')]=function(_0x2bd2c7,_0x1b1029){return db[_0x47f9('0x2b')]['find']({'where':{'id':_0x2bd2c7[_0x47f9('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b1029,null))['then'](removeEntity(_0x1b1029,null))[_0x47f9('0x42')](handleError(_0x1b1029,null));};exports[_0x47f9('0x47')]=function(_0x43eb5b,_0x3d796c){return db[_0x47f9('0x2b')][_0x47f9('0x47')]()['then'](respondWithResult(_0x3d796c,null))[_0x47f9('0x42')](handleError(_0x3d796c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f9f8b60..b6e5ceb 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 _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 +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x116102,_0x2abcbb){var _0x213f03=function(_0x243030){while(--_0x243030){_0x116102['push'](_0x116102['shift']());}};_0x213f03(++_0x2abcbb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 088848b..110d95b 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 _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 +var _0x4a37=['limit','UpdateChatQueueReport','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','update'];(function(_0x27a630,_0x3ba6c7){var _0x26a5fb=function(_0x369314){while(--_0x369314){_0x27a630['push'](_0x27a630['shift']());}};_0x26a5fb(++_0x3ba6c7);}(_0x4a37,0x12e));var _0x74a3=function(_0x1d7586,_0x3d5b25){_0x1d7586=_0x1d7586-0x0;var _0x5975db=_0x4a37[_0x1d7586];return _0x5975db;};'use strict';var _=require(_0x74a3('0x0'));var util=require('util');var moment=require(_0x74a3('0x1'));var BPromise=require(_0x74a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74a3('0x3'))['db'];var utils=require(_0x74a3('0x4'));var logger=require(_0x74a3('0x5'))('rpc');var config=require(_0x74a3('0x6'));var jayson=require(_0x74a3('0x7'));var client=jayson[_0x74a3('0x8')][_0x74a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x437908,_0x5bdf8c,_0x15d3a1){return new BPromise(function(_0x5ceec8,_0x1acffd){return client[_0x74a3('0xa')](_0x437908,_0x15d3a1)[_0x74a3('0xb')](function(_0x7ade76){logger[_0x74a3('0xc')](_0x74a3('0xd'),_0x5bdf8c,_0x74a3('0xe'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5bdf8c,'request\x20sent',JSON[_0x74a3('0xf')](_0x7ade76));if(_0x7ade76[_0x74a3('0x10')]){if(_0x7ade76[_0x74a3('0x10')]['code']===0x1f4){logger['error'](_0x74a3('0xd'),_0x5bdf8c,_0x7ade76['error'][_0x74a3('0x11')]);return _0x1acffd(_0x7ade76[_0x74a3('0x10')][_0x74a3('0x11')]);}logger[_0x74a3('0x10')](_0x74a3('0xd'),_0x5bdf8c,_0x7ade76[_0x74a3('0x10')][_0x74a3('0x11')]);return _0x5ceec8(_0x7ade76[_0x74a3('0x10')][_0x74a3('0x11')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5bdf8c,_0x74a3('0xe'));_0x5ceec8(_0x7ade76[_0x74a3('0x12')]['message']);}})[_0x74a3('0x13')](function(_0x137ad7){logger[_0x74a3('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x5bdf8c,_0x137ad7);_0x1acffd(_0x137ad7);});});}exports[_0x74a3('0x14')]=function(_0x3210ae){var _0x14de06=this;return new Promise(function(_0x844d64,_0x14f25e){return db[_0x74a3('0x15')][_0x74a3('0x16')](_0x3210ae[_0x74a3('0x17')],{'raw':_0x3210ae[_0x74a3('0x18')]?_0x3210ae[_0x74a3('0x18')][_0x74a3('0x19')]===undefined?!![]:![]:!![]})[_0x74a3('0xb')](function(_0x4a80c3){logger['info'](_0x74a3('0x14'),_0x3210ae);logger[_0x74a3('0x1a')]('CreateChatQueueReport',_0x3210ae,JSON['stringify'](_0x4a80c3));_0x844d64(_0x4a80c3);})[_0x74a3('0x13')](function(_0x3f7914){logger['error'](_0x74a3('0x14'),_0x3f7914[_0x74a3('0x11')],_0x3210ae);_0x14f25e(_0x14de06[_0x74a3('0x10')](0x1f4,_0x3f7914[_0x74a3('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0x454dc9){var _0x1d07c5=this;return new Promise(function(_0x53be10,_0x2fced6){return db['ChatQueueReport'][_0x74a3('0x1b')](_0x454dc9[_0x74a3('0x17')],{'raw':_0x454dc9[_0x74a3('0x18')]?_0x454dc9[_0x74a3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x454dc9['options']?_0x454dc9[_0x74a3('0x18')]['where']||null:null,'attributes':_0x454dc9[_0x74a3('0x18')]?_0x454dc9[_0x74a3('0x18')]['attributes']||null:null,'limit':_0x454dc9['options']?_0x454dc9[_0x74a3('0x18')][_0x74a3('0x1c')]||null:null})[_0x74a3('0xb')](function(_0xca25ff){logger['info'](_0x74a3('0x1d'),_0x454dc9);logger[_0x74a3('0x1a')](_0x74a3('0x1d'),_0x454dc9,JSON[_0x74a3('0xf')](_0xca25ff));_0x53be10(_0xca25ff);})['catch'](function(_0x4fd09a){logger[_0x74a3('0x10')](_0x74a3('0x1d'),_0x4fd09a[_0x74a3('0x11')],_0x454dc9);_0x2fced6(_0x1d07c5[_0x74a3('0x10')](0x1f4,_0x4fd09a[_0x74a3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 3da097c..cab5a2c 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 _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 +var _0x7e19=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x431eb9,_0x458e58){var _0x33e92d=function(_0x4ba8f7){while(--_0x4ba8f7){_0x431eb9['push'](_0x431eb9['shift']());}};_0x33e92d(++_0x458e58);}(_0x7e19,0x16c));var _0x97e1=function(_0x4e4a3f,_0x42009f){_0x4e4a3f=_0x4e4a3f-0x0;var _0x3b2b12=_0x7e19[_0x4e4a3f];return _0x3b2b12;};'use strict';var multer=require(_0x97e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x97e1('0x1'));var express=require(_0x97e1('0x2'));var router=express[_0x97e1('0x3')]();var fs_extra=require(_0x97e1('0x4'));var auth=require(_0x97e1('0x5'));var interaction=require(_0x97e1('0x6'));var config=require(_0x97e1('0x7'));var controller=require('./chatQueueReport.controller');router[_0x97e1('0x8')]('/',auth[_0x97e1('0x9')](),controller[_0x97e1('0xa')]);router[_0x97e1('0x8')](_0x97e1('0xb'),auth['isAuthenticated'](),controller[_0x97e1('0xc')]);router[_0x97e1('0x8')](_0x97e1('0xd'),auth['isAuthenticated'](),controller[_0x97e1('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x97e1('0xf')]);router['put'](_0x97e1('0xd'),auth[_0x97e1('0x9')](),controller['update']);router[_0x97e1('0x10')]('/:id',auth[_0x97e1('0x9')](),controller[_0x97e1('0x11')]);module[_0x97e1('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 4d53c62..30edc6c 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 _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 +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x28112b,_0xcbf761){_0x28112b=_0x28112b-0x0;var _0x4bb2c5=_0xb43b[_0x28112b];return _0x4bb2c5;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 83de297..4946c60 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 _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 +var _0x15ff=['ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatTransferReport','findAll','rows','catch','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x4209e1,_0x571956){var _0x6241a8=function(_0x48512f){while(--_0x48512f){_0x4209e1['push'](_0x4209e1['shift']());}};_0x6241a8(++_0x571956);}(_0x15ff,0xcd));var _0xf15f=function(_0x4d0d85,_0x3250d3){_0x4d0d85=_0x4d0d85-0x0;var _0x290a74=_0x15ff[_0x4d0d85];return _0x290a74;};'use strict';var emlformat=require(_0xf15f('0x0'));var rimraf=require(_0xf15f('0x1'));var zipdir=require(_0xf15f('0x2'));var jsonpatch=require(_0xf15f('0x3'));var rp=require(_0xf15f('0x4'));var moment=require(_0xf15f('0x5'));var BPromise=require(_0xf15f('0x6'));var Mustache=require(_0xf15f('0x7'));var util=require(_0xf15f('0x8'));var path=require(_0xf15f('0x9'));var sox=require('sox');var csv=require(_0xf15f('0xa'));var ejs=require(_0xf15f('0xb'));var fs=require('fs');var fs_extra=require(_0xf15f('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf15f('0xd'));var jsforce=require(_0xf15f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf15f('0xa'));var querystring=require(_0xf15f('0xf'));var Papa=require('papaparse');var Redis=require(_0xf15f('0x10'));var authService=require(_0xf15f('0x11'));var qs=require(_0xf15f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15f('0x13'));var logger=require('../../config/logger')(_0xf15f('0x14'));var utils=require(_0xf15f('0x15'));var config=require(_0xf15f('0x16'));var licenseUtil=require(_0xf15f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b4745,_0x400932){_0x400932=_0x400932||0xcc;return function(_0x3e323f){if(_0x3e323f){return _0x3b4745['sendStatus'](_0x400932);}return _0x3b4745[_0xf15f('0x18')](_0x400932)[_0xf15f('0x19')]();};}function respondWithResult(_0x546274,_0x4c3148){_0x4c3148=_0x4c3148||0xc8;return function(_0x4b7326){if(_0x4b7326){return _0x546274[_0xf15f('0x18')](_0x4c3148)[_0xf15f('0x1a')](_0x4b7326);}};}function respondWithFilteredResult(_0x452c1b,_0x447336){return function(_0x5f3ece){if(_0x5f3ece){var _0x41efd3=typeof _0x447336[_0xf15f('0x1b')]==='undefined'&&typeof _0x447336[_0xf15f('0x1c')]==='undefined';var _0x5ea5a8=_0x5f3ece[_0xf15f('0x1d')];var _0x83403d=_0x41efd3?0x0:_0x447336['offset'];var _0x9c0ef9=_0x41efd3?_0x5f3ece[_0xf15f('0x1d')]:_0x447336[_0xf15f('0x1b')]+_0x447336[_0xf15f('0x1c')];var _0x5b0959;if(_0x9c0ef9>=_0x5ea5a8){_0x9c0ef9=_0x5ea5a8;_0x5b0959=0xc8;}else{_0x5b0959=0xce;}_0x452c1b[_0xf15f('0x18')](_0x5b0959);return _0x452c1b[_0xf15f('0x1e')](_0xf15f('0x1f'),_0x83403d+'-'+_0x9c0ef9+'/'+_0x5ea5a8)[_0xf15f('0x1a')](_0x5f3ece);}return null;};}function patchUpdates(_0x12f7db){return function(_0x562657){try{jsonpatch['apply'](_0x562657,_0x12f7db,!![]);}catch(_0x4a187a){return BPromise['reject'](_0x4a187a);}return _0x562657[_0xf15f('0x20')]();};}function saveUpdates(_0x51ea19,_0x3f3585){return function(_0x2cb01b){if(_0x2cb01b){return _0x2cb01b[_0xf15f('0x21')](_0x51ea19)[_0xf15f('0x22')](function(_0x3ca2bf){return _0x3ca2bf;});}return null;};}function removeEntity(_0x150b6d,_0x507de2){return function(_0x53b9d9){if(_0x53b9d9){return _0x53b9d9[_0xf15f('0x23')]()[_0xf15f('0x22')](function(){_0x150b6d['status'](0xcc)[_0xf15f('0x19')]();});}};}function handleEntityNotFound(_0x448ffe,_0x3029c1){return function(_0x38ecec){if(!_0x38ecec){_0x448ffe['sendStatus'](0x194);}return _0x38ecec;};}function handleError(_0x582d63,_0x1f6f28){_0x1f6f28=_0x1f6f28||0x1f4;return function(_0x33dbf5){logger[_0xf15f('0x24')](_0x33dbf5['stack']);if(_0x33dbf5['name']){delete _0x33dbf5[_0xf15f('0x25')];}_0x582d63[_0xf15f('0x18')](_0x1f6f28)[_0xf15f('0x26')](_0x33dbf5);};}exports['index']=function(_0x2f0833,_0x4aa3cb){var _0x23adc9={},_0x5c9d36={},_0x15a171={'count':0x0,'rows':[]};var _0x3a7afa=_[_0xf15f('0x27')](db['ChatTransferReport'][_0xf15f('0x28')],function(_0x49bcb4){return{'name':_0x49bcb4[_0xf15f('0x29')],'type':_0x49bcb4[_0xf15f('0x2a')][_0xf15f('0x2b')]};});_0x5c9d36['model']=_[_0xf15f('0x27')](_0x3a7afa,_0xf15f('0x25'));_0x5c9d36['query']=_['keys'](_0x2f0833[_0xf15f('0x2c')]);_0x5c9d36[_0xf15f('0x2d')]=_[_0xf15f('0x2e')](_0x5c9d36[_0xf15f('0x2f')],_0x5c9d36[_0xf15f('0x2c')]);_0x23adc9[_0xf15f('0x30')]=_[_0xf15f('0x2e')](_0x5c9d36[_0xf15f('0x2f')],qs['fields'](_0x2f0833[_0xf15f('0x2c')][_0xf15f('0x31')]));_0x23adc9[_0xf15f('0x30')]=_0x23adc9[_0xf15f('0x30')][_0xf15f('0x32')]?_0x23adc9[_0xf15f('0x30')]:_0x5c9d36[_0xf15f('0x2f')];if(!_0x2f0833[_0xf15f('0x2c')][_0xf15f('0x33')](_0xf15f('0x34'))){_0x23adc9[_0xf15f('0x1c')]=qs[_0xf15f('0x1c')](_0x2f0833[_0xf15f('0x2c')][_0xf15f('0x1c')]);_0x23adc9[_0xf15f('0x1b')]=qs['offset'](_0x2f0833['query'][_0xf15f('0x1b')]);}_0x23adc9[_0xf15f('0x35')]=qs[_0xf15f('0x36')](_0x2f0833[_0xf15f('0x2c')][_0xf15f('0x36')]);_0x23adc9[_0xf15f('0x37')]=qs['filters'](_[_0xf15f('0x38')](_0x2f0833[_0xf15f('0x2c')],_0x5c9d36[_0xf15f('0x2d')]),_0x3a7afa);if(_0x2f0833[_0xf15f('0x2c')]['filter']){_0x23adc9[_0xf15f('0x37')]=_[_0xf15f('0x39')](_0x23adc9[_0xf15f('0x37')],{'$or':_[_0xf15f('0x27')](_0x3a7afa,function(_0x53e4a8){if(_0x53e4a8['type']!==_0xf15f('0x3a')){var _0x17c7c6={};_0x17c7c6[_0x53e4a8['name']]={'$like':'%'+_0x2f0833[_0xf15f('0x2c')][_0xf15f('0x3b')]+'%'};return _0x17c7c6;}})});}_0x23adc9=_[_0xf15f('0x39')]({},_0x23adc9,_0x2f0833[_0xf15f('0x3c')]);var _0xcf862f={'where':_0x23adc9[_0xf15f('0x37')]};return db['ChatTransferReport'][_0xf15f('0x1d')](_0xcf862f)['then'](function(_0x55debf){_0x15a171['count']=_0x55debf;if(_0x2f0833['query']['includeAll']){_0x23adc9['include']=[{'all':!![]}];}return db[_0xf15f('0x3d')][_0xf15f('0x3e')](_0x23adc9);})[_0xf15f('0x22')](function(_0x2ac88f){_0x15a171[_0xf15f('0x3f')]=_0x2ac88f;return _0x15a171;})[_0xf15f('0x22')](respondWithFilteredResult(_0x4aa3cb,_0x23adc9))[_0xf15f('0x40')](handleError(_0x4aa3cb,null));};exports['show']=function(_0xf9de9c,_0x388f9d){var _0x10cf27={'raw':!![],'where':{'id':_0xf9de9c[_0xf15f('0x41')]['id']}},_0xa0317a={};_0xa0317a['model']=_[_0xf15f('0x42')](db[_0xf15f('0x3d')][_0xf15f('0x28')]);_0xa0317a[_0xf15f('0x2c')]=_[_0xf15f('0x42')](_0xf9de9c[_0xf15f('0x2c')]);_0xa0317a['filters']=_[_0xf15f('0x2e')](_0xa0317a['model'],_0xa0317a[_0xf15f('0x2c')]);_0x10cf27[_0xf15f('0x30')]=_['intersection'](_0xa0317a['model'],qs[_0xf15f('0x31')](_0xf9de9c[_0xf15f('0x2c')][_0xf15f('0x31')]));_0x10cf27[_0xf15f('0x30')]=_0x10cf27[_0xf15f('0x30')][_0xf15f('0x32')]?_0x10cf27[_0xf15f('0x30')]:_0xa0317a['model'];if(_0xf9de9c['query'][_0xf15f('0x43')]){_0x10cf27['include']=[{'all':!![]}];}_0x10cf27=_[_0xf15f('0x39')]({},_0x10cf27,_0xf9de9c[_0xf15f('0x3c')]);return db[_0xf15f('0x3d')][_0xf15f('0x44')](_0x10cf27)[_0xf15f('0x22')](handleEntityNotFound(_0x388f9d,null))[_0xf15f('0x22')](respondWithResult(_0x388f9d,null))[_0xf15f('0x40')](handleError(_0x388f9d,null));};exports['create']=function(_0x33265c,_0x457675){return db[_0xf15f('0x3d')][_0xf15f('0x45')](_0x33265c[_0xf15f('0x46')],{})['then'](respondWithResult(_0x457675,0xc9))[_0xf15f('0x40')](handleError(_0x457675,null));};exports['update']=function(_0x24c56f,_0x42626b){if(_0x24c56f['body']['id']){delete _0x24c56f[_0xf15f('0x46')]['id'];}return db['ChatTransferReport'][_0xf15f('0x44')]({'where':{'id':_0x24c56f[_0xf15f('0x41')]['id']}})[_0xf15f('0x22')](handleEntityNotFound(_0x42626b,null))['then'](saveUpdates(_0x24c56f['body'],null))['then'](respondWithResult(_0x42626b,null))[_0xf15f('0x40')](handleError(_0x42626b,null));};exports['destroy']=function(_0x4031bd,_0x9b0da3){return db[_0xf15f('0x3d')]['find']({'where':{'id':_0x4031bd['params']['id']}})[_0xf15f('0x22')](handleEntityNotFound(_0x9b0da3,null))[_0xf15f('0x22')](removeEntity(_0x9b0da3,null))['catch'](handleError(_0x9b0da3,null));};exports[_0xf15f('0x47')]=function(_0x3e7e33,_0x3f40c2){return db[_0xf15f('0x3d')][_0xf15f('0x47')]()[_0xf15f('0x22')](respondWithResult(_0x3f40c2,null))[_0xf15f('0x40')](handleError(_0x3f40c2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index c5bb830..e13e15b 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 _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 +var _0xbe0d=['rimraf','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbe0d,0x11a));var _0xdbe0=function(_0x2477b1,_0x3aedce){_0x2477b1=_0x2477b1-0x0;var _0x349bf7=_0xbe0d[_0x2477b1];return _0x349bf7;};'use strict';var _=require(_0xdbe0('0x0'));var util=require(_0xdbe0('0x1'));var logger=require(_0xdbe0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdbe0('0x3'));var rp=require(_0xdbe0('0x4'));var fs=require('fs');var path=require(_0xdbe0('0x5'));var rimraf=require(_0xdbe0('0x6'));var config=require('../../config/environment');var attributes=require(_0xdbe0('0x7'));module[_0xdbe0('0x8')]=function(_0x4a5479,_0x5878c2){return _0x4a5479[_0xdbe0('0x9')]('ChatTransferReport',attributes,{'tableName':_0xdbe0('0xa'),'paranoid':![],'indexes':[{'name':_0xdbe0('0xb'),'fields':[_0xdbe0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 744fd44..7cb7c13 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 _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 +var _0x9967=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','result','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x9967,0x86));var _0x7996=function(_0x31b9ca,_0x48585d){_0x31b9ca=_0x31b9ca-0x0;var _0x26ad47=_0x9967[_0x31b9ca];return _0x26ad47;};'use strict';var _=require(_0x7996('0x0'));var util=require('util');var moment=require(_0x7996('0x1'));var BPromise=require(_0x7996('0x2'));var rs=require(_0x7996('0x3'));var fs=require('fs');var Redis=require(_0x7996('0x4'));var db=require(_0x7996('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7996('0x6'));var client=jayson[_0x7996('0x7')][_0x7996('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9503a3,_0x3025da,_0x4d999d){return new BPromise(function(_0x581d4a,_0x887389){return client[_0x7996('0x9')](_0x9503a3,_0x4d999d)[_0x7996('0xa')](function(_0x59c3f6){logger[_0x7996('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x3025da,_0x7996('0xc'));logger['debug'](_0x7996('0xd'),_0x3025da,_0x7996('0xc'),JSON[_0x7996('0xe')](_0x59c3f6));if(_0x59c3f6[_0x7996('0xf')]){if(_0x59c3f6[_0x7996('0xf')][_0x7996('0x10')]===0x1f4){logger[_0x7996('0xf')](_0x7996('0x11'),_0x3025da,_0x59c3f6[_0x7996('0xf')]['message']);return _0x887389(_0x59c3f6[_0x7996('0xf')]['message']);}logger['error'](_0x7996('0x11'),_0x3025da,_0x59c3f6['error']['message']);return _0x581d4a(_0x59c3f6['error']['message']);}else{logger[_0x7996('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x3025da,_0x7996('0xc'));_0x581d4a(_0x59c3f6[_0x7996('0x12')][_0x7996('0x13')]);}})[_0x7996('0x14')](function(_0x4dadad){logger['error'](_0x7996('0x11'),_0x3025da,_0x4dadad);_0x887389(_0x4dadad);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index d99a3bf..06ee983 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 _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 +var _0x4bdc=['index','/describe','describe','show','create','put','/:id','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated'];(function(_0x51e18a,_0x1f1dcc){var _0x375376=function(_0x43002c){while(--_0x43002c){_0x51e18a['push'](_0x51e18a['shift']());}};_0x375376(++_0x1f1dcc);}(_0x4bdc,0x1d7));var _0xc4bd=function(_0x13f9c0,_0x287bd4){_0x13f9c0=_0x13f9c0-0x0;var _0x100b86=_0x4bdc[_0x13f9c0];return _0x100b86;};'use strict';var multer=require('multer');var util=require(_0xc4bd('0x0'));var path=require(_0xc4bd('0x1'));var timeout=require(_0xc4bd('0x2'));var express=require(_0xc4bd('0x3'));var router=express[_0xc4bd('0x4')]();var fs_extra=require(_0xc4bd('0x5'));var auth=require(_0xc4bd('0x6'));var interaction=require(_0xc4bd('0x7'));var config=require(_0xc4bd('0x8'));var controller=require(_0xc4bd('0x9'));router[_0xc4bd('0xa')]('/',auth[_0xc4bd('0xb')](),controller[_0xc4bd('0xc')]);router[_0xc4bd('0xa')](_0xc4bd('0xd'),auth[_0xc4bd('0xb')](),controller[_0xc4bd('0xe')]);router[_0xc4bd('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc4bd('0xf')]);router['post']('/',auth[_0xc4bd('0xb')](),controller[_0xc4bd('0x10')]);router[_0xc4bd('0x11')](_0xc4bd('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xc4bd('0x13')](_0xc4bd('0x12'),auth[_0xc4bd('0xb')](),controller['destroy']);module[_0xc4bd('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 427c3f3..018f542 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 _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 +var _0xd008=['parse','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Feedback','star','input','name','getDataValue','onlineForm'];(function(_0x296da0,_0x4d4ea8){var _0x816ff3=function(_0x52d1ff){while(--_0x52d1ff){_0x296da0['push'](_0x296da0['shift']());}};_0x816ff3(++_0x4d4ea8);}(_0xd008,0xa8));var _0x8d00=function(_0x1a4549,_0xd9e730){_0x1a4549=_0x1a4549-0x0;var _0xca9a7f=_0xd008[_0x1a4549];return _0xca9a7f;};'use strict';var Sequelize=require(_0x8d00('0x0'));var rs=require(_0x8d00('0x1'));module[_0x8d00('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8d00('0x3')]},'mapKey':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x4')},'mapKeyOffline':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x5')},'customerAlias':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'defaultValue':_0x8d00('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'defaultValue':_0x8d00('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'defaultValue':_0x8d00('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'defaultValue':_0x8d00('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8d00('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8d00('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8d00('0x9')](_0x8d00('0xa'),_0x8d00('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0xc')},'download_transcript':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8d00('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8d00('0xf')]},'closingQuestion':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x12')},'placeholderMessage':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x13')},'closingMessage':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x15')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x16')},'ratingType':{'type':Sequelize[_0x8d00('0x9')](_0x8d00('0x17'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x8d00('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8d00('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8d00('0x18'),'variable':null,'config':{'placeholder':_0x8d00('0x19'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x8d00('0x18'),'props':{'title':_0x8d00('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8d00('0x4'),'type':_0x8d00('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8d00('0x1a')](_0x8d00('0x1b'))?JSON[_0x8d00('0x1c')](this[_0x8d00('0x1a')](_0x8d00('0x1b'))):{};},'set':function(_0x41d2a7){return this['setDataValue']('onlineForm',JSON[_0x8d00('0x1d')](_0x41d2a7));}},'offlineForm':{'type':Sequelize[_0x8d00('0xf')],'defaultValue':function(){return JSON[_0x8d00('0x1d')]({'items':[{'type':_0x8d00('0x18'),'props':{'title':_0x8d00('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8d00('0x4'),'type':_0x8d00('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x8d00('0x1e')},'props':{'title':_0x8d00('0x1e'),'helpText':_0x8d00('0x1f')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x8d00('0x20'))?JSON[_0x8d00('0x1c')](this[_0x8d00('0x1a')](_0x8d00('0x20'))):{};},'set':function(_0x7b27cb){return this['setDataValue'](_0x8d00('0x20'),JSON[_0x8d00('0x1d')](_0x7b27cb));}},'token':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':function(){return rs[_0x8d00('0x21')]();}},'autoclose':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8d00('0x3')]},'forwardOffline':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8d00('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x22')},'enableUnmanagedNote':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x23')},'skipUnmanaged':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x15')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8d00('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8d00('0xf')],'defaultValue':function(){return _0x8d00('0x24');}},'notificationSound':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x25')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8d00('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x26')},'verticalAlignment':{'type':Sequelize[_0x8d00('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x27')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x28')},'defaultTitle':{'type':Sequelize[_0x8d00('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'defaultValue':_0x8d00('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8d00('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x8d00('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8d00('0x8')],'comment':_0x8d00('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![],'comment':_0x8d00('0x2b'),'set':function(_0x3e31f5){if(!_0x3e31f5)this[_0x8d00('0x2c')](_0x8d00('0x2d'),null);this[_0x8d00('0x2c')](_0x8d00('0x2e'),_0x3e31f5);}},'vidaooEscalation':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8d00('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8d00('0x2f')},'vidaooNote':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':function(){return _0x8d00('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x8d00('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8d00('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 7b96b83..6362e8e 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 _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 +var _0x5d26=['includes','mapKey','CmList','List','updatedAt','DESC','Applications','Interval','list','orderBy','priority','asc','account','defaults','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','lastName','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','waitForTheAssignedAgent','queueId','ChatQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','CloudProvider','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','email','Smtp','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','User','Owner','fullname','internal','Tag','color','tag','virtual','increment','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','getApplications','addProactiveActions','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','ejs','fs-extra','querystring','html-to-text','ioredis','url','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIOutOfIntervalError','handleError','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','UserProfileResource','stack','name','send','Command','getSnippet','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','timezone','No\x20timezone','catch','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','map','Intervals','some','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','vendor','type','Pause','mandatoryDispositionPause','rawAttributes','fieldName','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','ChatWebsite','findAll','rows','show','params','intersection','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','find','autoAssociation','update','addDisposition','Disposition','getDispositions','findOne','removeDispositions','ids','ChatWebsiteId','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','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','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5d26,0x85));var _0x65d2=function(_0x15d1eb,_0x59bba1){_0x15d1eb=_0x15d1eb-0x0;var _0xfc710d=_0x5d26[_0x15d1eb];return _0xfc710d;};'use strict';var Mustache=require('mustache');var util=require(_0x65d2('0x0'));var path=require('path');var ejs=require(_0x65d2('0x1'));var fs=require('fs');var fs_extra=require(_0x65d2('0x2'));var _=require('lodash');var querystring=require(_0x65d2('0x3'));var htmlToText=require(_0x65d2('0x4'));var Redis=require(_0x65d2('0x5'));var jayson=require('jayson/promise');var url=require(_0x65d2('0x6'));var qs=require(_0x65d2('0x7'));var logger=require('../../config/logger')(_0x65d2('0x8'));var config=require(_0x65d2('0x9'));var APIOutOfIntervalError=require(_0x65d2('0xa'))[_0x65d2('0xb')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require(_0x65d2('0xa'))[_0x65d2('0xc')];var db=require(_0x65d2('0xd'))['db'];config[_0x65d2('0xe')]=_['defaults'](config[_0x65d2('0xe')],{'host':_0x65d2('0xf'),'port':0x18eb});var socket=require(_0x65d2('0x10'))(new Redis(config[_0x65d2('0xe')]));require('./chatWebsite.socket')['register'](socket);var client=jayson[_0x65d2('0x11')][_0x65d2('0x12')]({'port':0x232c});var client9002=jayson[_0x65d2('0x11')][_0x65d2('0x12')]({'port':0x232a});var client9003=jayson[_0x65d2('0x11')][_0x65d2('0x12')]({'port':0x232b});var client9001=jayson[_0x65d2('0x11')][_0x65d2('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x2fd7bb,_0x300ce6,_0x438101,_0xce7da3){return new Promise(function(_0x3bdebc,_0x4b63d6){var _0x40f45b=_0xce7da3||client;return _0x40f45b[_0x65d2('0x13')](_0x2fd7bb,_0x438101)[_0x65d2('0x14')](function(_0x33ab32){logger[_0x65d2('0x15')](_0x65d2('0x16'),_0x300ce6,'request\x20sent');logger[_0x65d2('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x300ce6,_0x65d2('0x18'),JSON[_0x65d2('0x19')](_0x33ab32));if(_0x33ab32[_0x65d2('0x1a')]){if(_0x33ab32['error']['code']===0x1f4){logger['error'](_0x65d2('0x16'),_0x300ce6,_0x33ab32[_0x65d2('0x1a')]['message']);return _0x4b63d6(_0x33ab32['error'][_0x65d2('0x1b')]);}logger[_0x65d2('0x1a')](_0x65d2('0x16'),_0x300ce6,_0x33ab32['error'][_0x65d2('0x1b')]);return _0x3bdebc(_0x33ab32['error']['message']);}else{logger[_0x65d2('0x15')](_0x65d2('0x16'),_0x300ce6,_0x65d2('0x18'));_0x3bdebc(_0x33ab32[_0x65d2('0x1c')][_0x65d2('0x1b')]);}})['catch'](function(_0x400cd6){logger[_0x65d2('0x1a')](_0x65d2('0x16'),_0x300ce6,_0x400cd6);_0x4b63d6(_0x400cd6);});});}function respondWithStatusCode(_0x59da24,_0x201b1f){_0x201b1f=_0x201b1f||0xcc;return function(_0x1db9d8){if(_0x1db9d8){return _0x59da24[_0x65d2('0x1d')](_0x201b1f);}return _0x59da24[_0x65d2('0x1e')](_0x201b1f)[_0x65d2('0x1f')]();};}function respondWithResult(_0x4c59b9,_0x3d6685){_0x3d6685=_0x3d6685||0xc8;return function(_0x4a3fb2){if(_0x4a3fb2){return _0x4c59b9[_0x65d2('0x1e')](_0x3d6685)[_0x65d2('0x20')](_0x4a3fb2);}};}function respondWithFilteredResult(_0x2fcadf,_0x2393c0){return function(_0x1d9918){if(_0x1d9918){var _0x191d6e=typeof _0x2393c0[_0x65d2('0x21')]===_0x65d2('0x22')&&typeof _0x2393c0[_0x65d2('0x23')]==='undefined';var _0x78e448=_0x1d9918[_0x65d2('0x24')];var _0x19f46e=_0x191d6e?0x0:_0x2393c0[_0x65d2('0x21')];var _0x34b5cd=_0x191d6e?_0x1d9918[_0x65d2('0x24')]:_0x2393c0['offset']+_0x2393c0[_0x65d2('0x23')];var _0x5265f9;if(_0x34b5cd>=_0x78e448){_0x34b5cd=_0x78e448;_0x5265f9=0xc8;}else{_0x5265f9=0xce;}_0x2fcadf['status'](_0x5265f9);return _0x2fcadf[_0x65d2('0x25')](_0x65d2('0x26'),_0x19f46e+'-'+_0x34b5cd+'/'+_0x78e448)[_0x65d2('0x20')](_0x1d9918);}return null;};}function saveUpdates(_0x45beb0){return function(_0x1c1ec9){if(_0x1c1ec9){return _0x1c1ec9['update'](_0x45beb0)[_0x65d2('0x14')](function(_0x344fe8){return _0x344fe8;});}return null;};}function removeEntity(_0x58b464){return function(_0x1c1877){if(_0x1c1877){return _0x1c1877[_0x65d2('0x27')]()['then'](function(){var _0x51d45d=_0x1c1877['get']({'plain':!![]});var _0xc67ec9='ChatWebsites';return db[_0x65d2('0x28')][_0x65d2('0x27')]({'where':{'type':_0xc67ec9,'resourceId':_0x51d45d['id']}})['then'](function(){return _0x1c1877;});})[_0x65d2('0x14')](function(){_0x58b464[_0x65d2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a27a7){return function(_0x47a929){if(!_0x47a929){_0x5a27a7[_0x65d2('0x1d')](0x194);}return _0x47a929;};}function handleError(_0x1828a0,_0x26a2b3){_0x26a2b3=_0x26a2b3||0x1f4;return function(_0x3cbba6){logger[_0x65d2('0x1a')](_0x3cbba6[_0x65d2('0x29')]);if(_0x3cbba6[_0x65d2('0x2a')]){delete _0x3cbba6[_0x65d2('0x2a')];}_0x1828a0[_0x65d2('0x1e')](_0x26a2b3)[_0x65d2('0x2b')](_0x3cbba6);};}function iftimePromise(_0x18244b,_0x3247f6){return respondWithRpcPromise(_0x65d2('0x2c'),_0x65d2('0x2d'),{'command':_0x3247f6['timezone']?util[_0x65d2('0x2e')](_0x65d2('0x2f'),_0x18244b[_0x65d2('0x30')],_0x3247f6['timezone']):util[_0x65d2('0x2e')](_0x65d2('0x31'),_0x18244b[_0x65d2('0x30')])},client9002)[_0x65d2('0x14')](function(_0x3b5a22){var _0x2842ce=_0x3b5a22&&_0x3b5a22[_0x65d2('0x32')](_0x65d2('0x33'))>=0x0?!![]:![];logger[_0x65d2('0x15')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3247f6['id'],_0x18244b['id'],_0x18244b[_0x65d2('0x30')],_0x2842ce?'ONLINE':'OFFLINE',_0x3247f6[_0x65d2('0x34')]?_0x3247f6[_0x65d2('0x34')]:_0x65d2('0x35'));return _0x2842ce;})[_0x65d2('0x36')](function(_0x148c66){logger[_0x65d2('0x1a')](_0x65d2('0x37'),_0x3247f6['id'],_0x18244b['id'],_0x18244b['interval'],util[_0x65d2('0x38')](_0x148c66,{'showHidden':![],'depth':null}),_0x3247f6[_0x65d2('0x34')]?_0x3247f6[_0x65d2('0x34')]:_0x65d2('0x35'));return![];});}function checkWebsiteIntervals(_0x40d572){var _0x31cd22=_[_0x65d2('0x39')](_0x40d572['Interval'][_0x65d2('0x3a')],function(_0x51948c){var _0x6e6ea2=_0x51948c['get']({'plain':!![]});return iftimePromise(_0x6e6ea2,_0x40d572);});return Promise['all'](_0x31cd22)['then'](function(_0x431a1f){return _[_0x65d2('0x3b')](_0x431a1f);});}function createInteractionObject(_0x4a4c27,_0x21ea8a,_0x5c05d5,_0x3c768c){var _0x17b330=require('user-agent-parser');var _0x1225af=new _0x17b330();var _0x269333=_0x1225af['setUA'](_0x5c05d5[_0x65d2('0x3c')])[_0x65d2('0x3d')]();var _0x21b6d1=_0x21ea8a[_0x65d2('0x3e')];if(_0x5c05d5[_0x65d2('0x3f')]){_0x21b6d1=_0x5c05d5[_0x65d2('0x3f')];}else if(_0x5c05d5[_0x65d2('0x40')]){_0x21b6d1=_[_0x65d2('0x41')](_0x5c05d5[_0x65d2('0x40')][_0x65d2('0x42')](','));}return{'ContactId':_0x3c768c['id'],'ChatWebsiteId':_0x4a4c27,'from':(_0x3c768c[_0x65d2('0x43')]||'')+'\x20'+(_0x3c768c['lastName']||''),'customerIp':_0x21b6d1,'customerPort':_0x5c05d5[_0x65d2('0x44')]?_0x5c05d5[_0x65d2('0x44')]:null,'referer':_0x21ea8a[_0x65d2('0x45')],'browserName':_0x269333[_0x65d2('0x46')][_0x65d2('0x2a')]&&_0x269333[_0x65d2('0x46')][_0x65d2('0x47')]?util[_0x65d2('0x2e')](_0x65d2('0x48'),_0x269333[_0x65d2('0x46')]['name'],_0x269333[_0x65d2('0x46')]['version']):_0x65d2('0x49'),'browserVersion':_0x269333[_0x65d2('0x46')][_0x65d2('0x47')]||_0x65d2('0x49'),'osName':util[_0x65d2('0x2e')](_0x65d2('0x48'),_0x269333['os'][_0x65d2('0x2a')],_0x269333['os']['version']),'osVersion':_0x269333['os'][_0x65d2('0x47')],'deviceModel':_0x269333[_0x65d2('0x4a')][_0x65d2('0x4b')]&&_0x269333[_0x65d2('0x4a')][_0x65d2('0x4c')]?util['format']('%s\x20%s\x20%s',_0x269333[_0x65d2('0x4a')][_0x65d2('0x4b')],_0x269333['device'][_0x65d2('0x4c')],_0x269333['device']['type']):null,'deviceVendor':_0x269333['device'][_0x65d2('0x4c')],'deviceType':_0x269333['device'][_0x65d2('0x4d')],'formData':JSON['stringify'](_0x21ea8a)};}exports['index']=function(_0x45db0f,_0x30df0c){var _0x4c0ff6={'include':[{'model':db[_0x65d2('0x4e')],'as':_0x65d2('0x4f')}]},_0x57de17={},_0x41334e={'count':0x0,'rows':[]};var _0x2e3cd9=_[_0x65d2('0x39')](db['ChatWebsite'][_0x65d2('0x50')],function(_0x1a15b1){return{'name':_0x1a15b1[_0x65d2('0x51')],'type':_0x1a15b1[_0x65d2('0x4d')]['key']};});_0x57de17[_0x65d2('0x4b')]=_[_0x65d2('0x39')](_0x2e3cd9,_0x65d2('0x2a'));_0x57de17[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x45db0f[_0x65d2('0x52')]);_0x57de17[_0x65d2('0x54')]=_['intersection'](_0x57de17[_0x65d2('0x4b')],_0x57de17[_0x65d2('0x52')]);_0x4c0ff6[_0x65d2('0x55')]=_['intersection'](_0x57de17[_0x65d2('0x4b')],qs['fields'](_0x45db0f[_0x65d2('0x52')][_0x65d2('0x56')]));_0x4c0ff6[_0x65d2('0x55')]=_0x4c0ff6[_0x65d2('0x55')][_0x65d2('0x57')]?_0x4c0ff6['attributes']:_0x57de17[_0x65d2('0x4b')];if(!_0x45db0f['query'][_0x65d2('0x58')](_0x65d2('0x59'))){_0x4c0ff6[_0x65d2('0x23')]=qs[_0x65d2('0x23')](_0x45db0f[_0x65d2('0x52')][_0x65d2('0x23')]);_0x4c0ff6[_0x65d2('0x21')]=qs['offset'](_0x45db0f[_0x65d2('0x52')][_0x65d2('0x21')]);}_0x4c0ff6[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x45db0f[_0x65d2('0x52')]['sort']);_0x4c0ff6['where']=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x45db0f[_0x65d2('0x52')],_0x57de17[_0x65d2('0x54')]),_0x2e3cd9);if(_0x45db0f['query'][_0x65d2('0x5d')]){_0x4c0ff6['where']=_[_0x65d2('0x5e')](_0x4c0ff6[_0x65d2('0x5f')],{'$or':_[_0x65d2('0x39')](_0x2e3cd9,function(_0x4526a8){if(_0x4526a8[_0x65d2('0x4d')]!==_0x65d2('0x60')){var _0x2cbc75={};_0x2cbc75[_0x4526a8[_0x65d2('0x2a')]]={'$like':'%'+_0x45db0f[_0x65d2('0x52')][_0x65d2('0x5d')]+'%'};return _0x2cbc75;}})});}_0x4c0ff6=_[_0x65d2('0x5e')]({},_0x4c0ff6,_0x45db0f[_0x65d2('0x61')]);var _0x44cf04={'where':_0x4c0ff6[_0x65d2('0x5f')]};return db[_0x65d2('0x62')][_0x65d2('0x24')](_0x44cf04)[_0x65d2('0x14')](function(_0x2132f4){_0x41334e[_0x65d2('0x24')]=_0x2132f4;if(_0x45db0f[_0x65d2('0x52')]['includeAll']){_0x4c0ff6['include']=[{'all':!![]}];}return db[_0x65d2('0x62')][_0x65d2('0x63')](_0x4c0ff6);})[_0x65d2('0x14')](function(_0x27b473){_0x41334e[_0x65d2('0x64')]=_0x27b473;return _0x41334e;})['then'](respondWithFilteredResult(_0x30df0c,_0x4c0ff6))[_0x65d2('0x36')](handleError(_0x30df0c,null));};exports[_0x65d2('0x65')]=function(_0x56c5d7,_0x4e8684){var _0x4a92aa={'raw':![],'where':{'id':_0x56c5d7[_0x65d2('0x66')]['id']},'include':[{'model':db[_0x65d2('0x4e')],'as':_0x65d2('0x4f')}]},_0x5bcca8={};_0x5bcca8['model']=_['keys'](db['ChatWebsite'][_0x65d2('0x50')]);_0x5bcca8[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x56c5d7['query']);_0x5bcca8[_0x65d2('0x54')]=_[_0x65d2('0x67')](_0x5bcca8[_0x65d2('0x4b')],_0x5bcca8[_0x65d2('0x52')]);_0x4a92aa[_0x65d2('0x55')]=_['intersection'](_0x5bcca8[_0x65d2('0x4b')],qs[_0x65d2('0x56')](_0x56c5d7[_0x65d2('0x52')][_0x65d2('0x56')]));_0x4a92aa['attributes']=_0x4a92aa[_0x65d2('0x55')][_0x65d2('0x57')]?_0x4a92aa[_0x65d2('0x55')]:_0x5bcca8['model'];if(_0x56c5d7['query'][_0x65d2('0x68')]){_0x4a92aa[_0x65d2('0x69')]=[{'all':!![]}];}_0x4a92aa=_[_0x65d2('0x5e')]({},_0x4a92aa,_0x56c5d7[_0x65d2('0x61')]);return db['ChatWebsite']['find'](_0x4a92aa)['then'](handleEntityNotFound(_0x4e8684,null))[_0x65d2('0x14')](respondWithResult(_0x4e8684,null))['catch'](handleError(_0x4e8684,null));};exports[_0x65d2('0x6a')]=function(_0x58dbbf,_0x2a96c4){return db['ChatWebsite'][_0x65d2('0x6a')](_0x58dbbf[_0x65d2('0x6b')],{})[_0x65d2('0x14')](function(_0x2fe77d){var _0x3b4891=_0x58dbbf[_0x65d2('0x6c')][_0x65d2('0x6d')]({'plain':!![]});if(!_0x3b4891)throw new Error(_0x65d2('0x6e'));if(_0x3b4891[_0x65d2('0x6f')]===_0x65d2('0x6c')){var _0xb9544e=_0x2fe77d[_0x65d2('0x6d')]({'plain':!![]});var _0x168f01=_0x65d2('0x70');return db[_0x65d2('0x71')][_0x65d2('0x72')]({'where':{'name':_0x168f01,'userProfileId':_0x3b4891['userProfileId']},'raw':!![]})[_0x65d2('0x14')](function(_0x86213){if(_0x86213&&_0x86213[_0x65d2('0x73')]===0x0){return db['UserProfileResource'][_0x65d2('0x6a')]({'name':_0xb9544e[_0x65d2('0x2a')],'resourceId':_0xb9544e['id'],'type':_0x86213['name'],'sectionId':_0x86213['id']},{})['then'](function(){return _0x2fe77d;});}else{return _0x2fe77d;}})[_0x65d2('0x36')](function(_0xdfc288){logger[_0x65d2('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdfc288);throw _0xdfc288;});}return _0x2fe77d;})[_0x65d2('0x14')](respondWithResult(_0x2a96c4,0xc9))['catch'](handleError(_0x2a96c4,null));};exports[_0x65d2('0x74')]=function(_0x33ebfd,_0x57a510){if(_0x33ebfd[_0x65d2('0x6b')]['id']){delete _0x33ebfd[_0x65d2('0x6b')]['id'];}return db[_0x65d2('0x62')]['find']({'where':{'id':_0x33ebfd[_0x65d2('0x66')]['id']},'include':[{'model':db[_0x65d2('0x4e')],'as':_0x65d2('0x4f')}]})['then'](handleEntityNotFound(_0x57a510,null))['then'](saveUpdates(_0x33ebfd[_0x65d2('0x6b')],null))[_0x65d2('0x14')](respondWithResult(_0x57a510,null))[_0x65d2('0x36')](handleError(_0x57a510,null));};exports[_0x65d2('0x27')]=function(_0x52f54d,_0x5e7372){return db['ChatWebsite'][_0x65d2('0x72')]({'where':{'id':_0x52f54d[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x5e7372,null))['then'](removeEntity(_0x5e7372,null))[_0x65d2('0x36')](handleError(_0x5e7372,null));};exports['describe']=function(_0x7ef538,_0x5de165){return db[_0x65d2('0x62')]['describe']()[_0x65d2('0x14')](respondWithResult(_0x5de165,null))[_0x65d2('0x36')](handleError(_0x5de165,null));};exports[_0x65d2('0x75')]=function(_0x4964de,_0x3107f8){if(_0x4964de[_0x65d2('0x6b')]['id']){delete _0x4964de[_0x65d2('0x6b')]['id'];}return db['ChatWebsite'][_0x65d2('0x72')]({'where':{'id':_0x4964de[_0x65d2('0x66')]['id']}})['then'](handleEntityNotFound(_0x3107f8,null))[_0x65d2('0x14')](function(_0x6738c8){if(_0x6738c8){_0x4964de[_0x65d2('0x6b')]['ChatWebsiteId']=_0x6738c8['id'];return db[_0x65d2('0x76')]['create'](_0x4964de[_0x65d2('0x6b')]);}})[_0x65d2('0x14')](respondWithResult(_0x3107f8,null))[_0x65d2('0x36')](handleError(_0x3107f8,null));};exports[_0x65d2('0x77')]=function(_0x2c9dd0,_0x42b53e){var _0x520acc={'raw':![],'where':{}};var _0x520b19={};var _0x3add5d={'count':0x0,'rows':[]};return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x2c9dd0['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x42b53e,null))[_0x65d2('0x14')](function(_0xc71220){if(_0xc71220){_0x520b19[_0x65d2('0x4b')]=_['keys'](db[_0x65d2('0x76')][_0x65d2('0x50')]);_0x520b19[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x2c9dd0[_0x65d2('0x52')]);_0x520b19[_0x65d2('0x54')]=_[_0x65d2('0x67')](_0x520b19[_0x65d2('0x4b')],_0x520b19[_0x65d2('0x52')]);_0x520acc[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0x520b19[_0x65d2('0x4b')],qs['fields'](_0x2c9dd0[_0x65d2('0x52')][_0x65d2('0x56')]));_0x520acc[_0x65d2('0x55')]=_0x520acc['attributes']['length']?_0x520acc[_0x65d2('0x55')]:_0x520b19[_0x65d2('0x4b')];if(!_0x2c9dd0[_0x65d2('0x52')][_0x65d2('0x58')]('nolimit')){_0x520acc[_0x65d2('0x23')]=qs[_0x65d2('0x23')](_0x2c9dd0[_0x65d2('0x52')][_0x65d2('0x23')]);_0x520acc[_0x65d2('0x21')]=qs[_0x65d2('0x21')](_0x2c9dd0[_0x65d2('0x52')]['offset']);}_0x520acc[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x2c9dd0[_0x65d2('0x52')][_0x65d2('0x5b')]);_0x520acc[_0x65d2('0x5f')]=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x2c9dd0[_0x65d2('0x52')],_0x520b19[_0x65d2('0x54')]));_0x520acc[_0x65d2('0x5f')]['ChatWebsiteId']=_0xc71220['id'];if(_0x2c9dd0['query'][_0x65d2('0x5d')]){_0x520acc[_0x65d2('0x5f')]=_[_0x65d2('0x5e')](_0x520acc['where'],{'$or':_[_0x65d2('0x39')](_0x520acc[_0x65d2('0x55')],function(_0x410964){var _0x18cb26={};_0x18cb26[_0x410964]={'$like':'%'+_0x2c9dd0['query'][_0x65d2('0x5d')]+'%'};return _0x18cb26;})});}_0x520acc=_[_0x65d2('0x5e')]({},_0x520acc,_0x2c9dd0[_0x65d2('0x61')]);return db[_0x65d2('0x76')][_0x65d2('0x24')]({'where':_0x520acc['where']})[_0x65d2('0x14')](function(_0x2d32d6){_0x3add5d['count']=_0x2d32d6;if(_0x2c9dd0[_0x65d2('0x52')]['includeAll']){_0x520acc['include']=[{'all':!![]}];}return db[_0x65d2('0x76')][_0x65d2('0x63')](_0x520acc);})[_0x65d2('0x14')](function(_0x305181){_0x3add5d[_0x65d2('0x64')]=_0x305181;return _0x3add5d;});}})[_0x65d2('0x14')](respondWithFilteredResult(_0x42b53e,_0x520acc))['catch'](handleError(_0x42b53e,null));};exports[_0x65d2('0x79')]=function(_0x231bb1,_0x3a7330){return db['ChatWebsite'][_0x65d2('0x72')]({'where':{'id':_0x231bb1['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x3a7330,null))['then'](function(_0x2285a0){if(_0x2285a0){return _0x2285a0['removeDispositions'](_0x231bb1[_0x65d2('0x52')][_0x65d2('0x7a')]);}})[_0x65d2('0x14')](respondWithStatusCode(_0x3a7330,null))[_0x65d2('0x36')](handleError(_0x3a7330,null));};exports['addAnswer']=function(_0xbe7f2a,_0x55bff2){if(_0xbe7f2a[_0x65d2('0x6b')]['id']){delete _0xbe7f2a['body']['id'];}return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0xbe7f2a[_0x65d2('0x66')]['id']}})['then'](handleEntityNotFound(_0x55bff2,null))[_0x65d2('0x14')](function(_0x1f9c81){if(_0x1f9c81){_0xbe7f2a[_0x65d2('0x6b')][_0x65d2('0x7b')]=_0x1f9c81['id'];return db[_0x65d2('0x7c')]['create'](_0xbe7f2a[_0x65d2('0x6b')]);}})[_0x65d2('0x14')](respondWithResult(_0x55bff2,null))[_0x65d2('0x36')](handleError(_0x55bff2,null));};exports['getAnswers']=function(_0x5b14b2,_0x5c0553){var _0x3b576e={'raw':![],'where':{}};var _0x334064={};var _0x477e82={'count':0x0,'rows':[]};return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x5b14b2[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x5c0553,null))[_0x65d2('0x14')](function(_0x4aa41f){if(_0x4aa41f){_0x334064['model']=_[_0x65d2('0x53')](db[_0x65d2('0x7c')][_0x65d2('0x50')]);_0x334064[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x5b14b2['query']);_0x334064['filters']=_['intersection'](_0x334064[_0x65d2('0x4b')],_0x334064[_0x65d2('0x52')]);_0x3b576e[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0x334064[_0x65d2('0x4b')],qs[_0x65d2('0x56')](_0x5b14b2[_0x65d2('0x52')]['fields']));_0x3b576e[_0x65d2('0x55')]=_0x3b576e[_0x65d2('0x55')][_0x65d2('0x57')]?_0x3b576e['attributes']:_0x334064[_0x65d2('0x4b')];if(!_0x5b14b2[_0x65d2('0x52')][_0x65d2('0x58')]('nolimit')){_0x3b576e[_0x65d2('0x23')]=qs['limit'](_0x5b14b2[_0x65d2('0x52')][_0x65d2('0x23')]);_0x3b576e[_0x65d2('0x21')]=qs[_0x65d2('0x21')](_0x5b14b2[_0x65d2('0x52')][_0x65d2('0x21')]);}_0x3b576e[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x5b14b2[_0x65d2('0x52')]['sort']);_0x3b576e[_0x65d2('0x5f')]=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x5b14b2['query'],_0x334064[_0x65d2('0x54')]));_0x3b576e['where'][_0x65d2('0x7b')]=_0x4aa41f['id'];if(_0x5b14b2[_0x65d2('0x52')]['filter']){_0x3b576e[_0x65d2('0x5f')]=_['merge'](_0x3b576e[_0x65d2('0x5f')],{'$or':_[_0x65d2('0x39')](_0x3b576e['attributes'],function(_0x11162c){var _0x1c08ac={};_0x1c08ac[_0x11162c]={'$like':'%'+_0x5b14b2[_0x65d2('0x52')][_0x65d2('0x5d')]+'%'};return _0x1c08ac;})});}_0x3b576e=_[_0x65d2('0x5e')]({},_0x3b576e,_0x5b14b2['options']);return db[_0x65d2('0x7c')][_0x65d2('0x24')]({'where':_0x3b576e[_0x65d2('0x5f')]})[_0x65d2('0x14')](function(_0xf146d6){_0x477e82[_0x65d2('0x24')]=_0xf146d6;if(_0x5b14b2[_0x65d2('0x52')][_0x65d2('0x68')]){_0x3b576e['include']=[{'all':!![]}];}return db[_0x65d2('0x7c')][_0x65d2('0x63')](_0x3b576e);})['then'](function(_0x355feb){_0x477e82['rows']=_0x355feb;return _0x477e82;});}})[_0x65d2('0x14')](respondWithFilteredResult(_0x5c0553,_0x3b576e))[_0x65d2('0x36')](handleError(_0x5c0553,null));};exports[_0x65d2('0x7d')]=function(_0x5b3dc1,_0x7d4178){return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x5b3dc1[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x7d4178,null))[_0x65d2('0x14')](function(_0x3c3e77){if(_0x3c3e77){return _0x3c3e77[_0x65d2('0x7d')](_0x5b3dc1['query'][_0x65d2('0x7a')]);}})[_0x65d2('0x14')](respondWithStatusCode(_0x7d4178,null))['catch'](handleError(_0x7d4178,null));};exports[_0x65d2('0x7e')]=function(_0x4cdb34,_0x446ee3){_0x4cdb34['body'][_0x65d2('0x7f')]=_0x4cdb34[_0x65d2('0x80')][_0x65d2('0x81')];return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x4cdb34['params']['id']}})['then'](handleEntityNotFound(_0x446ee3,null))[_0x65d2('0x14')](saveUpdates(_0x4cdb34['body'],null))[_0x65d2('0x14')](respondWithResult(_0x446ee3,null))['catch'](handleError(_0x446ee3,null));};exports[_0x65d2('0x82')]=function(_0x47fddf,_0x550baa){_0x47fddf['body'][_0x65d2('0x83')]=_0x47fddf[_0x65d2('0x80')]['filename'];return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x47fddf[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x550baa,null))[_0x65d2('0x14')](saveUpdates(_0x47fddf[_0x65d2('0x6b')],null))[_0x65d2('0x14')](respondWithResult(_0x550baa,null))[_0x65d2('0x36')](handleError(_0x550baa,null));};exports[_0x65d2('0x84')]=function(_0x4b4f5e,_0x50b7d4){_0x4b4f5e['body'][_0x65d2('0x85')]=_0x4b4f5e[_0x65d2('0x80')][_0x65d2('0x81')];return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x4b4f5e[_0x65d2('0x66')]['id']}})['then'](handleEntityNotFound(_0x50b7d4,null))[_0x65d2('0x14')](saveUpdates(_0x4b4f5e[_0x65d2('0x6b')],null))['then'](respondWithResult(_0x50b7d4,null))['catch'](handleError(_0x50b7d4,null));};exports[_0x65d2('0x86')]=function(_0x462a37,_0xa38168){_0x462a37[_0x65d2('0x6b')][_0x65d2('0x87')]=_0x462a37[_0x65d2('0x80')][_0x65d2('0x81')];return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x462a37[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0xa38168,null))[_0x65d2('0x14')](saveUpdates(_0x462a37[_0x65d2('0x6b')],null))[_0x65d2('0x14')](respondWithResult(_0xa38168,null))['catch'](handleError(_0xa38168,null));};exports[_0x65d2('0x88')]=function(_0xd73b22,_0x54495e){var _0x2d6f15=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x8b'));var _0x4be9ee={'where':{'id':_0xd73b22[_0x65d2('0x66')]['id']},'attributes':['id',_0x65d2('0x7f')],'raw':!![]};var _0x1473ad=![];return require('../../config/license/util')[_0x65d2('0x8c')]()[_0x65d2('0x14')](function(_0x592f28){if(_0x592f28){_0x1473ad=_0x592f28[_0x65d2('0x8d')];}})[_0x65d2('0x14')](function(){return db[_0x65d2('0x62')][_0x65d2('0x72')](_0x4be9ee);})[_0x65d2('0x14')](handleEntityNotFound(_0x54495e,null))[_0x65d2('0x14')](function(_0x565b4b){if(_0x565b4b){if(!_[_0x65d2('0x8e')](_0x565b4b[_0x65d2('0x7f')])){if(fs[_0x65d2('0x8f')](path['join'](config[_0x65d2('0x8a')],_0x65d2('0x90'),_0x565b4b[_0x65d2('0x7f')]))&&_0x1473ad){_0x2d6f15=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x90'),_0x565b4b['sitepic']);}}return _0x54495e[_0x65d2('0x91')](_0x2d6f15);}})[_0x65d2('0x36')](handleError(_0x54495e,null));};exports[_0x65d2('0x92')]=function(_0x7423b9,_0x54240b){var _0x5e732a=path[_0x65d2('0x89')](config['root'],_0x65d2('0x93'));var _0x24edff={'where':{'id':_0x7423b9[_0x65d2('0x66')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x24edff)[_0x65d2('0x14')](handleEntityNotFound(_0x54240b,null))[_0x65d2('0x14')](function(_0x410c92){if(_0x410c92){if(!_[_0x65d2('0x8e')](_0x410c92[_0x65d2('0x83')])){if(fs[_0x65d2('0x8f')](path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x94'),_0x410c92[_0x65d2('0x83')]))){_0x5e732a=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x94'),_0x410c92['agentAvatar']);}}return _0x54240b[_0x65d2('0x91')](_0x5e732a);}})[_0x65d2('0x36')](handleError(_0x54240b,null));};exports[_0x65d2('0x95')]=function(_0x1b846b,_0x194db3){var _0x58d46c=path['join'](config[_0x65d2('0x8a')],_0x65d2('0x96'));var _0x1e9288={'where':{'id':_0x1b846b[_0x65d2('0x66')]['id']},'attributes':['id',_0x65d2('0x85'),_0x65d2('0x97')],'raw':!![]};return db[_0x65d2('0x62')][_0x65d2('0x72')](_0x1e9288)[_0x65d2('0x14')](handleEntityNotFound(_0x194db3,null))[_0x65d2('0x14')](function(_0x589b14){if(_0x589b14){if(!_[_0x65d2('0x8e')](_0x589b14[_0x65d2('0x85')])){if(fs[_0x65d2('0x8f')](path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x94'),_0x589b14[_0x65d2('0x85')]))&&_0x589b14[_0x65d2('0x97')]){_0x58d46c=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x94'),_0x589b14[_0x65d2('0x85')]);}}return _0x194db3[_0x65d2('0x91')](_0x58d46c);}})[_0x65d2('0x36')](handleError(_0x194db3,null));};exports[_0x65d2('0x98')]=function(_0x40402f,_0x12052e){var _0x2e93fb=path['join'](config[_0x65d2('0x8a')],_0x65d2('0x99'));var _0x261e1d={'where':{'id':_0x40402f['params']['id']},'attributes':['id',_0x65d2('0x87')],'raw':!![]};return db[_0x65d2('0x62')]['find'](_0x261e1d)[_0x65d2('0x14')](handleEntityNotFound(_0x12052e,null))[_0x65d2('0x14')](function(_0x15d89d){if(_0x15d89d){if(!_['isNil'](_0x15d89d[_0x65d2('0x87')])){if(fs[_0x65d2('0x8f')](path[_0x65d2('0x89')](config[_0x65d2('0x8a')],'server/files/images/avatars/',_0x15d89d[_0x65d2('0x87')]))){_0x2e93fb=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x94'),_0x15d89d[_0x65d2('0x87')]);}}return _0x12052e['download'](_0x2e93fb);}})[_0x65d2('0x36')](handleError(_0x12052e,null));};exports[_0x65d2('0x9a')]=function(_0x3c5b5e,_0x32cd6a){var _0x400298={'body':_0x3c5b5e['body'],'channel':_0x65d2('0x9b')};var _0x892ea6=[];var _0x57da55=[];var _0x518174={};var _0x2d7aa3=![];return db[_0x65d2('0x9c')][_0x65d2('0x9d')]()[_0x65d2('0x14')](function(_0x514faa){if(!_0x514faa){throw new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))](_0x65d2('0xa0'));}_0x892ea6=_['difference'](_[_0x65d2('0x53')](_0x514faa),[_0x65d2('0xa1'),'updatedAt']);_0x57da55=_[_0x65d2('0xa2')](_[_0x65d2('0x53')](_0x514faa),[_0x65d2('0xa1'),'updatedAt',_0x65d2('0xa3'),_0x65d2('0xa4')]);if(_0x3c5b5e['body']['id']){delete _0x3c5b5e[_0x65d2('0x6b')]['id'];}if(_[_0x65d2('0x8e')](_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xa5')])){throw new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))]('from\x20is\x20mandatory');}if(_[_0x65d2('0x8e')](_0x3c5b5e['body']['body'])||_0x3c5b5e['body'][_0x65d2('0x6b')]===''){throw new db['Sequelize'][(_0x65d2('0x9f'))](_0x65d2('0xa6'));}if(_[_0x65d2('0x8e')](_0x3c5b5e[_0x65d2('0x6b')]['mapKey'])){throw new db['Sequelize'][(_0x65d2('0x9f'))](_0x65d2('0xa7')+_0x57da55);}if(!_[_0x65d2('0xa8')](_0x57da55,_0x3c5b5e['body'][_0x65d2('0xa9')])){throw new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x57da55);}_0x518174[_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xa9')]]=_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xa5')];})[_0x65d2('0x14')](function(){return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x3c5b5e['params']['id']},'include':[{'model':db[_0x65d2('0xaa')],'as':_0x65d2('0xab'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x518174,'limit':0x1,'order':[[_0x65d2('0xac'),_0x65d2('0xad')]]}]},{'model':db['ChatApplication'],'as':_0x65d2('0xae')},{'model':db['Interval'],'as':_0x65d2('0xaf'),'include':[{'model':db[_0x65d2('0xaf')],'as':_0x65d2('0x3a'),'attributes':['id',_0x65d2('0x30')],'raw':!![]}]}]});})[_0x65d2('0x14')](function(_0x35721a){if(!_0x35721a)throw new APINotFoundError(util['format']('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x3c5b5e[_0x65d2('0x66')]['id']));if(!_0x35721a[_0x65d2('0xaf')]||!_0x35721a[_0x65d2('0xaf')]['Intervals'])return[_0x35721a,!![]];return[_0x35721a,checkWebsiteIntervals(_0x35721a)];})['spread'](function(_0x59bc3c,_0x22c581){if(!_0x22c581)throw new APIOutOfIntervalError();if(!_0x59bc3c[_0x65d2('0xab')])return;_0x400298['account']=_0x59bc3c;_0x400298[_0x65d2('0xb0')]=_0x59bc3c[_0x65d2('0xab')];_0x400298['applications']=_[_0x65d2('0xb1')](_0x59bc3c['Applications'],[_0x65d2('0xb2')],[_0x65d2('0xb3')]);if(_0x400298[_0x65d2('0xb4')][_0x65d2('0xae')]){delete _0x400298['account']['Applications'];}if(_0x400298[_0x65d2('0xb4')][_0x65d2('0xab')]&&_0x400298[_0x65d2('0xb4')]['List']['Contacts']['length']){return _0x400298[_0x65d2('0xb4')][_0x65d2('0xab')]['Contacts'][0x0];}var _0x522567=_[_0x65d2('0xb5')](_0x3c5b5e[_0x65d2('0x6b')],{'firstName':_0x3c5b5e[_0x65d2('0x6b')]['from'],'ListId':_0x59bc3c[_0x65d2('0xa4')]});_0x522567[_0x3c5b5e[_0x65d2('0x6b')]['mapKey']]=_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xa5')];return db['CmContact'][_0x65d2('0x6a')](_0x522567,{'fields':_0x892ea6,'raw':!![]});})['then'](function(_0x409e8a){_0x400298['contact']=_0x409e8a;var _0x461a4d=createInteractionObject(_0x3c5b5e[_0x65d2('0x66')]['id'],_0x3c5b5e['body'],_0x3c5b5e[_0x65d2('0xb6')],_0x409e8a);var _0x3acf8d={'ChatWebsiteId':_0x3c5b5e[_0x65d2('0x66')]['id'],'closed':![]};if(_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xb7')]){_0x3acf8d[_0x65d2('0xb7')]=_0x3c5b5e['body'][_0x65d2('0xb7')];return db[_0x65d2('0xb8')][_0x65d2('0x72')]({'where':_0x3acf8d})[_0x65d2('0x14')](function(_0x23b585){if(_0x23b585){_0x2d7aa3=!![];return _0x23b585;}_0x461a4d[_0x65d2('0xb7')]=_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xb7')];_0x461a4d[_0x65d2('0xb9')]=_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xb9')];return db[_0x65d2('0xb8')][_0x65d2('0x6a')](_0x461a4d);});}_0x3acf8d[_0x65d2('0xba')]=_0x409e8a['id'];if(_0x3c5b5e[_0x65d2('0x6b')]['interaction']&&_0x3c5b5e[_0x65d2('0x6b')]['interaction']['id']){_0x3acf8d['id']=_0x3c5b5e['body'][_0x65d2('0xbb')]['id'];return db[_0x65d2('0xb8')][_0x65d2('0x72')]({'where':_0x3acf8d})[_0x65d2('0x14')](function(_0x4993aa){if(_0x4993aa){_0x2d7aa3=!![];return _0x4993aa;}return db['ChatInteraction'][_0x65d2('0x6a')](_0x461a4d);});}return db[_0x65d2('0xb8')]['create'](_0x461a4d);})[_0x65d2('0x14')](function(_0xb0c75d){if(!_0x2d7aa3)return _0xb0c75d;var _0x2a4254={'from':(_0x400298['contact'][_0x65d2('0x43')]||'')+'\x20'+(_0x400298[_0x65d2('0xbc')][_0x65d2('0xbd')]||'')};if(_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xb7')]&&_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xbe')]&&_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xb7')]!=_0x3c5b5e[_0x65d2('0x6b')]['messageId']){_0x2a4254['threadId']=_0x3c5b5e['body']['messageId'];}return _0xb0c75d['update'](_0x2a4254);})[_0x65d2('0x14')](function(_0x132975){_0x400298[_0x65d2('0xbb')]=_0x132975[_0x65d2('0x6d')]({'plain':!![]});_0x400298[_0x65d2('0xbb')][_0x65d2('0xbf')]=!_0x2d7aa3;if(_0x400298[_0x65d2('0xbb')]['created']){if(_0x400298['account']['autoclose']){_0x400298['applications']['push']({'id':0x0,'priority':_0x400298['applications'][_0x65d2('0x57')]+0x1,'app':_0x65d2('0xc0'),'appdata':_0x65d2('0xc1'),'interval':_0x65d2('0xc2')});}}return db[_0x65d2('0xc3')][_0x65d2('0x6a')]({'body':_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0x6b')],'ChatWebsiteId':_0x3c5b5e['params']['id'],'ChatInteractionId':_0x132975['id'],'direction':'in','ContactId':_0x400298[_0x65d2('0xbc')]['id'],'AttachmentId':_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xc4')]});})[_0x65d2('0x14')](function(_0x4abd50){_0x400298[_0x65d2('0x1b')]=_0x4abd50;if(!_0x400298[_0x65d2('0xbb')][_0x65d2('0xc5')]){return;}return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x400298['interaction']['UserId']}});})[_0x65d2('0x14')](function(_0x549a2a){if(_0x549a2a){_0x400298['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x549a2a[_0x65d2('0x2a')]+','+(_0x400298['account'][_0x65d2('0xc6')]||0xa),'interval':_0x65d2('0xc2')});_0x400298['forcedOwnership']=!![];}if(!_0x400298[_0x65d2('0xbb')][_0x65d2('0xc7')]){return;}return db[_0x65d2('0xc8')][_0x65d2('0x72')]({'attributes':['id',_0x65d2('0x2a')],'where':{'id':_0x400298[_0x65d2('0xbb')][_0x65d2('0xc7')]}});})[_0x65d2('0x14')](function(_0x3f6ad7){if(_0x3f6ad7){_0x400298['applications'][_0x65d2('0xc9')]({'id':0x0,'priority':0x1,'app':_0x65d2('0xca'),'appdata':_0x3f6ad7['name']+','+(_0x400298[_0x65d2('0xb4')][_0x65d2('0xcb')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x65d2('0xcc'),_0x65d2('0xcd'),_0x400298);})[_0x65d2('0x14')](function(_0x33b64e){respondWithRpcPromise(_0x65d2('0xce'),_0x65d2('0xce'),{'event':'notify','message':_0x33b64e},client9002);return _0x33b64e;})['then'](respondWithResult(_0x32cd6a,null))[_0x65d2('0x36')](APIHandleError(_0x32cd6a));};exports[_0x65d2('0xcf')]=function(_0x33347e,_0x2bb54d){var _0x51a3a2,_0x478eba,_0x1a49db;var _0x431904=[];var _0x54200c={};var _0x582aba=_0x33347e[_0x65d2('0xd0')]||[];var _0x832f63=[];var _0x18a87e;return db[_0x65d2('0x9c')]['describe']()['then'](function(_0xf329d1){if(!_0xf329d1){throw new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))]('no\x20available\x20attributes');}_0x431904=_['difference'](_['keys'](_0xf329d1),[_0x65d2('0xa1'),_0x65d2('0xac'),_0x65d2('0xa3'),_0x65d2('0xa4')]);if(_0x33347e[_0x65d2('0x6b')]['id']){delete _0x33347e['body']['id'];}if(_[_0x65d2('0x8e')](_0x33347e[_0x65d2('0x6b')][_0x65d2('0xa5')])){throw _0x2bb54d[_0x65d2('0x1e')](0x1f4)[_0x65d2('0x2b')](new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))]('from\x20is\x20mandatory'));}if(_[_0x65d2('0x8e')](_0x33347e[_0x65d2('0x6b')][_0x65d2('0x6b')])||_0x33347e[_0x65d2('0x6b')][_0x65d2('0x6b')]===''){throw _0x2bb54d[_0x65d2('0x1e')](0x1f4)[_0x65d2('0x2b')](new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))](_0x65d2('0xa6')));}if(_[_0x65d2('0x8e')](_0x33347e[_0x65d2('0x6b')][_0x65d2('0xd1')])){throw _0x2bb54d[_0x65d2('0x1e')](0x1f4)[_0x65d2('0x2b')](new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))](_0x65d2('0xd2')+_0x431904));}if(!_[_0x65d2('0xa8')](_0x431904,_0x33347e[_0x65d2('0x6b')][_0x65d2('0xd1')])){throw _0x2bb54d[_0x65d2('0x1e')](0x1f4)[_0x65d2('0x2b')](new db['Sequelize'][(_0x65d2('0x9f'))](_0x65d2('0xd3')+_0x431904));}_0x54200c[_0x33347e[_0x65d2('0x6b')]['mapKeyOffline']]=_0x33347e[_0x65d2('0x6b')][_0x65d2('0xa5')];})[_0x65d2('0x14')](function(){return db['ChatWebsite'][_0x65d2('0x72')]({'where':{'id':_0x33347e[_0x65d2('0x66')]['id']},'include':[{'model':db[_0x65d2('0xaa')],'as':'List'},{'model':db[_0x65d2('0xd4')],'as':_0x65d2('0xd4')}]});})[_0x65d2('0x14')](handleEntityNotFound(_0x2bb54d,null))['then'](function(_0x2a755f){if(_0x2a755f&&_0x2a755f['List']){_0x478eba=_0x2a755f;var _0x58e5ac=_[_0x65d2('0xb5')](_0x33347e[_0x65d2('0x6b')],{'firstName':_0x33347e['body'][_0x65d2('0xa5')],'phone':_0x33347e[_0x65d2('0x6b')][_0x65d2('0xa5')],'ListId':_0x2a755f[_0x65d2('0xa4')]});_0x58e5ac[_0x33347e[_0x65d2('0x6b')]['mapKeyOffline']]=_0x33347e[_0x65d2('0x6b')][_0x65d2('0xa5')];return db['CmContact']['findOrCreate']({'where':_0x54200c,'defaults':_0x58e5ac});}})[_0x65d2('0xd5')](function(_0x5a1858){if(_0x5a1858){_0x1a49db=_0x5a1858;var _0x17859b=fs['readFileSync'](path['join'](config[_0x65d2('0x8a')],'server/files/templates/chatOfflineMessage.ejs'),_0x65d2('0xd6'));var _0x566136=ejs[_0x65d2('0xd7')](_0x17859b,{'body':_[_0x65d2('0xd8')](_0x33347e[_0x65d2('0x6b')]['body']),'bodyTitle':_0x478eba[_0x65d2('0xd9')]});return db[_0x65d2('0xda')][_0x65d2('0x6a')]({'body':_0x566136,'plainBody':htmlToText[_0x65d2('0xdb')](_0x566136),'ContactId':_0x5a1858['id'],'ChatWebsiteId':_0x478eba['id']});}})[_0x65d2('0x14')](function(_0x85b208){_0x18a87e=_0x85b208;if(_0x582aba[_0x65d2('0x57')]){var _0x4aa86a=_0x582aba[_0x65d2('0x39')](function(_0x32724b){return{'name':_0x32724b[_0x65d2('0xdc')],'basename':_0x32724b[_0x65d2('0x81')],'type':_0x32724b[_0x65d2('0xdd')],'ChatOfflineMessageId':_0x85b208['id']};});_0x832f63=_0x4aa86a[_0x65d2('0x39')](_0x3397c0=>{var _0x59c527={'filename':_0x3397c0['name'],'path':path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0xde'),_0x65d2('0xd0'),_0x65d2('0xdf'),_0x65d2('0xe0'),_0x3397c0[_0x65d2('0xe1')])};return _0x59c527;});if(!_0x478eba[_0x65d2('0xe2')]){return db['sequelize'][_0x65d2('0xe3')](function(_0x1e1933){return db[_0x65d2('0xe4')][_0x65d2('0xe5')](_0x4aa86a,{'transaction':_0x1e1933});});}}})[_0x65d2('0x14')](function(){if(_0x18a87e){_0x51a3a2=_0x18a87e;return db['MailAccount'][_0x65d2('0x78')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x65d2('0xe6')],'as':_0x65d2('0xe6'),'raw':!![]}]}]});}})[_0x65d2('0x14')](function(_0x346dc3){if(_0x346dc3&&_0x346dc3['Smtp']&&_0x478eba['forwardOffline']&&_0x478eba[_0x65d2('0xe7')]){var _0x48fed6=_0x346dc3['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x65d2('0xe8'),{'account':_0x48fed6,'message':{'from':util[_0x65d2('0x2e')](_0x65d2('0xe9'),_0x346dc3[_0x65d2('0x2a')],_0x346dc3[_0x65d2('0xea')]||_0x346dc3[_0x65d2('0xeb')][_0x65d2('0x6c')]),'to':_0x478eba[_0x65d2('0xe7')],'subject':_0x478eba[_0x65d2('0xec')],'html':_0x51a3a2[_0x65d2('0x6b')],'attachments':_0x832f63}},client9003)[_0x65d2('0x14')](function(){return _0x51a3a2;})[_0x65d2('0x36')](function(_0x3ffd4d){logger[_0x65d2('0x1a')](_0x3ffd4d);});}})[_0x65d2('0x14')](function(){if(_0x478eba&&_0x478eba[_0x65d2('0xe2')]&&_0x478eba[_0x65d2('0xed')]){var _0x3db7a1=[];if(_0x582aba[_0x65d2('0x57')]){_0x3db7a1=_0x582aba['map'](function(_0x2e626f){return{'name':_0x2e626f[_0x65d2('0xdc')],'basename':_0x2e626f[_0x65d2('0x81')],'type':_0x2e626f[_0x65d2('0xdd')],'ChatOfflineMessageId':_0x18a87e['id']};});}var _0x3bec36;if(!_[_0x65d2('0x8e')](_0x478eba[_0x65d2('0xee')])){var _0x4c722a=_[_0x65d2('0x39')](_0x33347e[_0x65d2('0x6b')],function(_0x1d7e79){return _0x1d7e79;});var _0x224ad8=_[_0x65d2('0xef')](_0x4c722a)[0x0];var _0x1c9e72=_[_0x65d2('0xf0')](_0x224ad8,function(_0x2ead1e){return _0x2ead1e;});_0x3bec36=_0x1c9e72[0x1][_0x478eba[_0x65d2('0xee')]];}var _0x5e5b22={'from':_0x1a49db[_0x65d2('0xea')],'firstName':_0x1a49db['firstName'],'lastName':_0x1a49db[_0x65d2('0xbd')],'mapKey':_0x65d2('0xea'),'message':{'from':_0x1a49db[_0x65d2('0xea')],'to':_0x478eba[_0x65d2('0xd4')][_0x65d2('0xea')],'cc':'','subject':_['isNil'](_0x3bec36)?_0x478eba['offlineMessageSubject']:_0x3bec36,'messageId':'','sentAt':new Date(),'attach':_0x3db7a1[_0x65d2('0x57')],'attachments':_0x3db7a1,'originChannel':_0x65d2('0xf1'),'ChatWebsiteId':_0x478eba['id'],'ChatOfflineMessageId':_0x51a3a2['id'],'originTo':_0x478eba[_0x65d2('0xd4')]['email']},'body':_0x51a3a2[_0x65d2('0x6b')]};var _0x26d613={'account':{'id':_0x478eba['MailAccountId']},'body':_0x5e5b22,'log':_0x65d2('0xf2')};return respondWithRpcPromise(_0x65d2('0xf2'),_0x65d2('0xf3'),_0x26d613,client9001)[_0x65d2('0x14')](function(){return _0x51a3a2;})[_0x65d2('0x36')](function(_0x5d7387){logger[_0x65d2('0x1a')](_0x5d7387);});}return;})[_0x65d2('0x14')](function(){if(_0x51a3a2){return _0x51a3a2;}})[_0x65d2('0x14')](respondWithResult(_0x2bb54d,null))['catch'](function(){for(var _0x2c2828 of _0x582aba){var _0x35fbe0=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0xde'),_0x65d2('0xd0'),_0x65d2('0xdf'),_0x65d2('0xe0'),_0x2c2828['filename']);fs_extra['remove'](_0x35fbe0)['catch'](function(_0x2f96b3){logger['error'](_0x65d2('0xf4'),_0x35fbe0,_0x2f96b3);});}});};exports[_0x65d2('0xf5')]=function(_0x2820e8,_0x472fad){return db[_0x65d2('0xb8')][_0x65d2('0x72')]({'where':{'id':_0x2820e8[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x472fad,null))[_0x65d2('0x14')](function(_0x431288){if(_0x431288){return _0x431288[_0x65d2('0xf5')](_0x2820e8[_0x65d2('0x6b')][_0x65d2('0x7a')],_[_0x65d2('0xf6')](_0x2820e8[_0x65d2('0x6b')],[_0x65d2('0x7a'),'id'])||{});}})[_0x65d2('0x14')](respondWithResult(_0x472fad,null))[_0x65d2('0x36')](handleError(_0x472fad,null));};exports['getInteractions']=function(_0x28188c,_0x8f82bf){var _0x5153dc={'raw':![],'where':{}};var _0x143083={};var _0x5936c4={'count':0x0,'rows':[]};return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x28188c[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x8f82bf,null))[_0x65d2('0x14')](function(_0x4a9496){if(_0x4a9496){_0x143083[_0x65d2('0x4b')]=_['keys'](db[_0x65d2('0xb8')][_0x65d2('0x50')]);_0x143083[_0x65d2('0x52')]=_['keys'](_0x28188c[_0x65d2('0x52')]);_0x143083[_0x65d2('0x54')]=_['intersection'](_0x143083[_0x65d2('0x4b')],_0x143083[_0x65d2('0x52')]);_0x5153dc[_0x65d2('0x55')]=_['intersection'](_0x143083['model'],qs[_0x65d2('0x56')](_0x28188c['query'][_0x65d2('0x56')]));_0x5153dc[_0x65d2('0x55')]=_0x5153dc[_0x65d2('0x55')][_0x65d2('0x57')]?_0x5153dc['attributes']:_0x143083['model'];if(!_0x28188c[_0x65d2('0x52')][_0x65d2('0x58')]('nolimit')){_0x5153dc[_0x65d2('0x23')]=qs[_0x65d2('0x23')](_0x28188c['query'][_0x65d2('0x23')]);_0x5153dc[_0x65d2('0x21')]=qs[_0x65d2('0x21')](_0x28188c[_0x65d2('0x52')][_0x65d2('0x21')]);}_0x5153dc[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x28188c[_0x65d2('0x52')][_0x65d2('0x5b')]);_0x5153dc['where']=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x28188c[_0x65d2('0x52')],_0x143083[_0x65d2('0x54')]));_0x5153dc[_0x65d2('0x5f')][_0x65d2('0x7b')]=_0x4a9496['id'];if(_0x28188c[_0x65d2('0x52')][_0x65d2('0x5d')]){_0x5153dc[_0x65d2('0x5f')]=_[_0x65d2('0x5e')](_0x5153dc[_0x65d2('0x5f')],{'$or':_[_0x65d2('0x39')](_0x5153dc[_0x65d2('0x55')],function(_0x1cb101){var _0x52f530={};_0x52f530[_0x1cb101]={'$like':'%'+_0x28188c[_0x65d2('0x52')]['filter']+'%'};return _0x52f530;})});}_0x5153dc=_[_0x65d2('0x5e')]({},_0x5153dc,_0x28188c['options']);return db[_0x65d2('0xb8')][_0x65d2('0x24')]({'where':_0x5153dc[_0x65d2('0x5f')]})[_0x65d2('0x14')](function(_0x14b1f2){_0x5936c4[_0x65d2('0x24')]=_0x14b1f2;if(_0x28188c[_0x65d2('0x52')][_0x65d2('0x68')]){_0x5153dc[_0x65d2('0x69')]=[{'model':db[_0x65d2('0x9c')],'as':_0x65d2('0xf7'),'required':![]},{'model':db[_0x65d2('0xf8')],'as':_0x65d2('0xf9'),'attributes':['name',_0x65d2('0xfa'),_0x65d2('0xfb')],'required':![]},{'model':db[_0x65d2('0xfc')],'as':'Tags','attributes':['id',_0x65d2('0x2a'),_0x65d2('0xfd')],'where':_0x28188c[_0x65d2('0x52')][_0x65d2('0xfe')]?{'id':_0x28188c[_0x65d2('0x52')]['tag']}:undefined,'required':_0x28188c[_0x65d2('0x52')][_0x65d2('0xfe')]?!![]:![]}];}return db['ChatInteraction'][_0x65d2('0x63')](_0x5153dc);})[_0x65d2('0x14')](function(_0x4abee4){_0x5936c4[_0x65d2('0x64')]=_0x4abee4;return _0x5936c4;});}})[_0x65d2('0x14')](respondWithFilteredResult(_0x8f82bf,_0x5153dc))[_0x65d2('0x36')](handleError(_0x8f82bf,null));};exports[_0x65d2('0x2d')]=function(_0x2b7033,_0x21ae48){var _0x36d7cd=0x0;var _0x2cd96d=0x0;var _0x3bc1c7=![];var _0x1d324f;var _0x31bc70;return db[_0x65d2('0x62')]['find']({'where':{'id':_0x2b7033[_0x65d2('0x66')]['id']},'include':[{'model':db[_0x65d2('0xaf')],'as':'Interval','include':[{'model':db[_0x65d2('0xaf')],'as':'Intervals','attributes':['id','interval']}]}]})[_0x65d2('0x14')](handleEntityNotFound(_0x21ae48,null))[_0x65d2('0x14')](function(_0x48f4a8){if(_0x48f4a8){_0x1d324f=_0x48f4a8;return _0x48f4a8['getProactiveActions']({'raw':!![]});}})[_0x65d2('0x14')](function(_0x285d08){if(_0x1d324f){if(_0x285d08){_0x31bc70=_0x285d08;}}return require('../../config/license/util')[_0x65d2('0x8c')]();})[_0x65d2('0x14')](function(_0x4907d9){if(_0x4907d9){_0x2cd96d=_0x4907d9[_0x65d2('0xff')];_0x3bc1c7=_0x4907d9[_0x65d2('0x8d')];}})[_0x65d2('0x14')](function(){return db[_0x65d2('0xb8')][_0x65d2('0x24')]({'where':{'closed':![]}});})[_0x65d2('0x14')](function(_0x1064c1){_0x36d7cd=_0x1064c1;if(_0x2cd96d&&_0x1064c1>_0x2cd96d){return db['License']['findOne']({'where':{'id':0x1}})[_0x65d2('0x14')](function(_0x51dfdf){if(_0x51dfdf){_0x51dfdf[_0x65d2('0x100')](_0x65d2('0x101'));}});}})[_0x65d2('0x14')](function(){if(!_0x1d324f[_0x65d2('0xaf')]||!_0x1d324f[_0x65d2('0xaf')][_0x65d2('0x3a')])return!![];return checkWebsiteIntervals(_0x1d324f);})[_0x65d2('0x14')](function(_0xe0b7d3){var _0x1927f0=fs[_0x65d2('0x102')](path[_0x65d2('0x89')](config['root'],_0x65d2('0x103')),_0x65d2('0xd6'));var _0x4518ad=new url[(_0x65d2('0x104'))](_0x1d324f[_0x65d2('0x105')])[_0x65d2('0x106')];var _0x4de7bd=_0x65d2('0x107');var _0x76d8d2=![];var _0x44b538={'chatVersion':_0x4de7bd,'chatWebsiteAddressOrigin':_0x4518ad,'remote':_0x1d324f[_0x65d2('0x108')],'query':querystring['stringify'](_[_0x65d2('0x5e')](_0x1d324f[_0x65d2('0x6d')]({'plain':!![]}),{'customerIp':_0x2b7033[_0x65d2('0xb6')][_0x65d2('0x40')]||_0x2b7033['headers'][_0x65d2('0x109')]||_0x2b7033[_0x65d2('0x10a')][_0x65d2('0x10b')]||_0x2b7033['ip'],'referer':_0x2b7033[_0x65d2('0xb6')][_0x65d2('0x45')],'openedInteractions':_0x36d7cd,'maxInteractions':_0x2cd96d,'virtual':_0x3bc1c7[_0x65d2('0xff')],'online':_0xe0b7d3,'custom':_0x3bc1c7}))['replace'](/'/g,'\x5c\x27')};_0x21ae48[_0x65d2('0x2b')](ejs[_0x65d2('0xd7')](Mustache[_0x65d2('0xd7')](_0x1927f0,_0x44b538),{'proactiveActions':_0x31bc70,'alignment':_0x1d324f[_0x65d2('0x10c')],'verticalAlignment':_0x1d324f[_0x65d2('0x10d')],'div_color':_0x1d324f[_0x65d2('0xfd')],'labelText':_0x1d324f[_0x65d2('0x10e')],'text_color':_0x1d324f['textColor'],'text_button_color':_0x1d324f[_0x65d2('0x10f')],'button_color':_0x1d324f['color_button'],'background_color':_0x1d324f[_0x65d2('0x110')],'hideWhenOffline':_0x1d324f[_0x65d2('0x111')],'intervalId':_0x1d324f[_0x65d2('0x112')],'isDevelopment':_0x76d8d2,'chatVersion':_0x4de7bd}));})['catch'](handleError(_0x21ae48,null));};exports[_0x65d2('0x113')]=function(_0x419ba9,_0x3a1e1a){var _0x42d45e=_0x419ba9[_0x65d2('0x66')]['id'];var _0x16f4c1=_0x419ba9[_0x65d2('0x6b')];var _0x5dd7ae=0xc8;var _0x287ad6=null;return db[_0x65d2('0x114')][_0x65d2('0xe3')]({'isolationLevel':db[_0x65d2('0x114')][_0x65d2('0x115')][_0x65d2('0x116')][_0x65d2('0x117')]},function(_0x19ab22){return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x42d45e},'transaction':_0x19ab22})[_0x65d2('0x14')](function(_0x5d9cf4){if(_0x5d9cf4){return db[_0x65d2('0x118')][_0x65d2('0x27')]({'where':{'ChatWebsiteId':_0x42d45e},'transaction':_0x19ab22})['then'](function(){var _0x47002d=_[_0x65d2('0x39')](_0x16f4c1,function(_0x1dd28b){_0x1dd28b[_0x65d2('0x7b')]=_0x42d45e;return _0x1dd28b;});return db[_0x65d2('0x118')]['bulkCreate'](_0x47002d,{'transaction':_0x19ab22});});}else{_0x5dd7ae=0x194;_0x287ad6=[];}});})['then'](function(){if(_0x5dd7ae!==0x194){return db['ChatApplication'][_0x65d2('0x119')]({'where':{'ChatWebsiteId':_0x42d45e},'order':_0x65d2('0xb2')})['then'](function(_0x15d23b){_0x287ad6=_0x15d23b;});}})[_0x65d2('0x36')](function(_0x16a4d8){_0x5dd7ae=0x1f4;logger[_0x65d2('0x1a')](_0x16a4d8[_0x65d2('0x29')]);if(_0x16a4d8['name']){delete _0x16a4d8[_0x65d2('0x2a')];}_0x287ad6=_0x16a4d8;})['finally'](function(){if(_0x287ad6===null){_0x3a1e1a[_0x65d2('0x1d')](_0x5dd7ae);}else{if(_0x5dd7ae===0x1f4){_0x3a1e1a[_0x65d2('0x1e')](_0x5dd7ae)['send'](_0x287ad6);}else{_0x3a1e1a[_0x65d2('0x1e')](_0x5dd7ae)['json'](_0x287ad6);}}});};exports[_0x65d2('0x11a')]=function(_0x46957e,_0x5115c2){var _0x3b319d={};var _0xea9978={};var _0xd4d1fa;var _0x1d643f;return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x46957e['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x5115c2,null))[_0x65d2('0x14')](function(_0x9d9e99){if(_0x9d9e99){_0xd4d1fa=_0x9d9e99;_0xea9978['model']=_[_0x65d2('0x53')](db['ChatApplication'][_0x65d2('0x50')]);_0xea9978[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x46957e[_0x65d2('0x52')]);_0xea9978['filters']=_[_0x65d2('0x67')](_0xea9978['model'],_0xea9978[_0x65d2('0x52')]);_0x3b319d[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0xea9978[_0x65d2('0x4b')],qs[_0x65d2('0x56')](_0x46957e[_0x65d2('0x52')][_0x65d2('0x56')]));_0x3b319d[_0x65d2('0x55')]=_0x3b319d[_0x65d2('0x55')][_0x65d2('0x57')]?_0x3b319d['attributes']:_0xea9978[_0x65d2('0x4b')];_0x3b319d[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x46957e[_0x65d2('0x52')][_0x65d2('0x5b')]);_0x3b319d[_0x65d2('0x5f')]=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x46957e[_0x65d2('0x52')],_0xea9978[_0x65d2('0x54')]));if(_0x46957e[_0x65d2('0x52')][_0x65d2('0x5d')]){_0x3b319d[_0x65d2('0x5f')]=_[_0x65d2('0x5e')](_0x3b319d[_0x65d2('0x5f')],{'$or':_['map'](_0x3b319d[_0x65d2('0x55')],function(_0x5b2e5c){var _0x1a213a={};_0x1a213a[_0x5b2e5c]={'$like':'%'+_0x46957e[_0x65d2('0x52')]['filter']+'%'};return _0x1a213a;})});}_0x3b319d=_['merge']({},_0x3b319d,_0x46957e['options']);return _0xd4d1fa[_0x65d2('0x11a')](_0x3b319d);}})[_0x65d2('0x14')](function(_0x1eb426){if(_0x1eb426){_0x1d643f=_0x1eb426[_0x65d2('0x57')];if(!_0x46957e[_0x65d2('0x52')]['hasOwnProperty']('nolimit')){_0x3b319d[_0x65d2('0x23')]=qs[_0x65d2('0x23')](_0x46957e['query']['limit']);_0x3b319d[_0x65d2('0x21')]=qs['offset'](_0x46957e[_0x65d2('0x52')][_0x65d2('0x21')]);}return _0xd4d1fa[_0x65d2('0x11a')](_0x3b319d);}})['then'](function(_0x466bda){if(_0x466bda){return _0x466bda?{'count':_0x1d643f,'rows':_0x466bda}:null;}})[_0x65d2('0x14')](respondWithResult(_0x5115c2,null))['catch'](handleError(_0x5115c2,null));};exports['addProactiveActions']=function(_0x36ef1f,_0x525fe8){return db['chatProactiveAction'][_0x65d2('0x72')]({'where':{'id':_0x36ef1f[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x525fe8,null))[_0x65d2('0x14')](function(_0x5d6cda){if(_0x5d6cda){return _0x5d6cda[_0x65d2('0x11b')](_0x36ef1f['body'][_0x65d2('0x7a')],_['omit'](_0x36ef1f['body'],[_0x65d2('0x7a'),'id'])||{});}})[_0x65d2('0x14')](respondWithResult(_0x525fe8,null))[_0x65d2('0x36')](handleError(_0x525fe8,null));};exports[_0x65d2('0x11c')]=function(_0x1b1d9e,_0x9dc08d){var _0x548515={};var _0x4c0e05={};var _0xc82592;var _0x4adfee;return db[_0x65d2('0x62')]['findOne']({'where':{'id':_0x1b1d9e['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x9dc08d,null))[_0x65d2('0x14')](function(_0x5207bb){if(_0x5207bb){_0xc82592=_0x5207bb;_0x4c0e05[_0x65d2('0x4b')]=_['keys'](db['ChatProactiveAction'][_0x65d2('0x50')]);_0x4c0e05[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x1b1d9e[_0x65d2('0x52')]);_0x4c0e05[_0x65d2('0x54')]=_[_0x65d2('0x67')](_0x4c0e05['model'],_0x4c0e05[_0x65d2('0x52')]);_0x548515[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0x4c0e05[_0x65d2('0x4b')],qs['fields'](_0x1b1d9e[_0x65d2('0x52')][_0x65d2('0x56')]));_0x548515[_0x65d2('0x55')]=_0x548515[_0x65d2('0x55')][_0x65d2('0x57')]?_0x548515[_0x65d2('0x55')]:_0x4c0e05[_0x65d2('0x4b')];_0x548515[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x1b1d9e['query'][_0x65d2('0x5b')]);_0x548515[_0x65d2('0x5f')]=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x1b1d9e['query'],_0x4c0e05['filters']));if(_0x1b1d9e[_0x65d2('0x52')][_0x65d2('0x5d')]){_0x548515[_0x65d2('0x5f')]=_[_0x65d2('0x5e')](_0x548515[_0x65d2('0x5f')],{'$or':_['map'](_0x548515['attributes'],function(_0x4c6850){var _0x52473a={};_0x52473a[_0x4c6850]={'$like':'%'+_0x1b1d9e['query'][_0x65d2('0x5d')]+'%'};return _0x52473a;})});}_0x548515=_[_0x65d2('0x5e')]({},_0x548515,_0x1b1d9e[_0x65d2('0x61')]);return _0xc82592[_0x65d2('0x11c')](_0x548515);}})[_0x65d2('0x14')](function(_0x406943){if(_0x406943){_0x4adfee=_0x406943[_0x65d2('0x57')];if(!_0x1b1d9e[_0x65d2('0x52')][_0x65d2('0x58')]('nolimit')){_0x548515[_0x65d2('0x23')]=qs[_0x65d2('0x23')](_0x1b1d9e[_0x65d2('0x52')][_0x65d2('0x23')]);_0x548515[_0x65d2('0x21')]=qs[_0x65d2('0x21')](_0x1b1d9e[_0x65d2('0x52')][_0x65d2('0x21')]);}return _0xc82592['getProactiveActions'](_0x548515);}})[_0x65d2('0x14')](function(_0x2c8818){if(_0x2c8818){return _0x2c8818?{'count':_0x4adfee,'rows':_0x2c8818}:null;}})[_0x65d2('0x14')](respondWithResult(_0x9dc08d,null))[_0x65d2('0x36')](handleError(_0x9dc08d,null));};exports[_0x65d2('0x11d')]=function(_0x325b9e,_0x3e0c3a){var _0x18a11c=_0x325b9e[_0x65d2('0x52')][_0x65d2('0x11e')]===_0x65d2('0x11f')?_0x65d2('0x120'):_0x65d2('0x121');return db[_0x65d2('0x62')]['find']({'attributes':['id',_0x18a11c],'where':{'id':_0x325b9e['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x3e0c3a,null))[_0x65d2('0x14')](function(_0x5d46af){if(_0x5d46af){var _0x897887=_0x5d46af[_0x18a11c];var _0x897d5=_0x897887&&_0x897887[_0x65d2('0x122')]?_0x897887[_0x65d2('0x122')]:[];_0x3e0c3a[_0x65d2('0x2b')]({'fromKey':_[_0x65d2('0x8e')](_0x897887['fromKey'])?undefined:_0x897887[_0x65d2('0x123')],'count':_0x897d5['length'],'rows':_0x897d5});}})[_0x65d2('0x36')](handleError(_0x3e0c3a,null));};exports[_0x65d2('0x124')]=function(_0x51fee2,_0x5794e4){var _0x11fc86={'raw':![],'where':{}};var _0x35cb27={};var _0x1fbd02={'count':0x0,'rows':[]};return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x51fee2[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x5794e4,null))[_0x65d2('0x14')](function(_0xfaba88){if(_0xfaba88){_0x35cb27[_0x65d2('0x4b')]=_[_0x65d2('0x53')](db[_0x65d2('0xda')][_0x65d2('0x50')]);_0x35cb27[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x51fee2[_0x65d2('0x52')]);_0x35cb27[_0x65d2('0x54')]=_[_0x65d2('0x67')](_0x35cb27[_0x65d2('0x4b')],_0x35cb27[_0x65d2('0x52')]);_0x11fc86[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0x35cb27[_0x65d2('0x4b')],qs[_0x65d2('0x56')](_0x51fee2[_0x65d2('0x52')][_0x65d2('0x56')]));_0x11fc86[_0x65d2('0x55')]=_0x11fc86['attributes'][_0x65d2('0x57')]?_0x11fc86[_0x65d2('0x55')]:_0x35cb27[_0x65d2('0x4b')];if(!_0x51fee2[_0x65d2('0x52')][_0x65d2('0x58')](_0x65d2('0x59'))){_0x11fc86[_0x65d2('0x23')]=qs['limit'](_0x51fee2[_0x65d2('0x52')][_0x65d2('0x23')]);_0x11fc86[_0x65d2('0x21')]=qs[_0x65d2('0x21')](_0x51fee2[_0x65d2('0x52')][_0x65d2('0x21')]);}_0x11fc86[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x51fee2[_0x65d2('0x52')][_0x65d2('0x5b')]);_0x11fc86['where']=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x51fee2[_0x65d2('0x52')],_0x35cb27[_0x65d2('0x54')]));_0x11fc86[_0x65d2('0x5f')]['ChatWebsiteId']=_0xfaba88['id'];if(_0x51fee2[_0x65d2('0x52')][_0x65d2('0x5d')]){_0x11fc86[_0x65d2('0x5f')]=_[_0x65d2('0x5e')](_0x11fc86[_0x65d2('0x5f')],{'$or':_[_0x65d2('0x39')](_0x11fc86[_0x65d2('0x55')],function(_0x34e879){var _0x55a6fb={};_0x55a6fb[_0x34e879]={'$like':'%'+_0x51fee2[_0x65d2('0x52')][_0x65d2('0x5d')]+'%'};return _0x55a6fb;})});}_0x11fc86=_[_0x65d2('0x5e')]({},_0x11fc86,_0x51fee2[_0x65d2('0x61')]);return db[_0x65d2('0xda')][_0x65d2('0x24')]({'where':_0x11fc86[_0x65d2('0x5f')]})[_0x65d2('0x14')](function(_0x16d657){_0x1fbd02['count']=_0x16d657;if(_0x51fee2[_0x65d2('0x52')][_0x65d2('0x68')]){_0x11fc86[_0x65d2('0x69')]=[{'all':!![]}];}else{_0x11fc86[_0x65d2('0x69')]=[{'model':db[_0x65d2('0x9c')],'as':_0x65d2('0xf7'),'required':![]},{'model':db[_0x65d2('0xe4')],'as':_0x65d2('0x125'),'required':![]}];}return db[_0x65d2('0xda')][_0x65d2('0x63')](_0x11fc86);})[_0x65d2('0x14')](function(_0xff0fe4){_0x1fbd02['rows']=_0xff0fe4;return _0x1fbd02;});}})['then'](respondWithFilteredResult(_0x5794e4,_0x11fc86))['catch'](handleError(_0x5794e4,null));};exports[_0x65d2('0x126')]=function(_0x4138cb,_0x2d2f85){return db['ChatWebsite'][_0x65d2('0x72')]({'where':{'id':_0x4138cb['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x2d2f85,null))[_0x65d2('0x14')](function(_0x2cb663){if(_0x2cb663){return _0x2cb663['addAgents'](_0x4138cb[_0x65d2('0x6b')][_0x65d2('0x7a')],_['omit'](_0x4138cb[_0x65d2('0x6b')],[_0x65d2('0x7a'),'id'])||{})['spread'](function(_0x2bde38){for(var _0x5235f5=0x0;_0x5235f5<_0x4138cb[_0x65d2('0x6b')][_0x65d2('0x7a')][_0x65d2('0x57')];_0x5235f5+=0x1){socket[_0x65d2('0x127')](_0x65d2('0x128'),{'UserId':Number(_0x4138cb['body'][_0x65d2('0x7a')][_0x5235f5]),'ChatWebsiteId':Number(_0x4138cb[_0x65d2('0x66')]['id'])});}return _0x2bde38;});}})[_0x65d2('0x14')](respondWithResult(_0x2d2f85,null))[_0x65d2('0x36')](handleError(_0x2d2f85,null));};exports[_0x65d2('0x129')]=function(_0x1a20a4,_0x14ee33){return db[_0x65d2('0x62')]['find']({'where':{'id':_0x1a20a4[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x14ee33,null))['then'](function(_0x4b9467){if(_0x4b9467){return _0x4b9467['removeAgents'](_0x1a20a4[_0x65d2('0x52')][_0x65d2('0x7a')])['then'](function(){if(_[_0x65d2('0x12a')](_0x1a20a4[_0x65d2('0x52')][_0x65d2('0x7a')])){for(var _0x7ad92e=0x0;_0x7ad92e<_0x1a20a4[_0x65d2('0x52')]['ids']['length'];_0x7ad92e+=0x1){socket[_0x65d2('0x127')](_0x65d2('0x12b'),{'UserId':Number(_0x1a20a4['query'][_0x65d2('0x7a')][_0x7ad92e]),'ChatWebsiteId':Number(_0x1a20a4[_0x65d2('0x66')]['id'])});}}else{socket['emit'](_0x65d2('0x12b'),{'UserId':Number(_0x1a20a4[_0x65d2('0x52')]['ids']),'ChatWebsiteId':Number(_0x1a20a4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x14ee33,null))[_0x65d2('0x36')](handleError(_0x14ee33,null));};exports[_0x65d2('0x12c')]=function(_0x153381,_0x1f5ac1){var _0x587422={};var _0x497a1c={};var _0x24b5bd;var _0x32293b;return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x153381[_0x65d2('0x66')]['id']}})['then'](handleEntityNotFound(_0x1f5ac1,null))[_0x65d2('0x14')](function(_0x401fe1){if(_0x401fe1){_0x24b5bd=_0x401fe1;_0x497a1c[_0x65d2('0x4b')]=_['keys'](db[_0x65d2('0xf8')][_0x65d2('0x50')]);_0x497a1c[_0x65d2('0x52')]=_['keys'](_0x153381['query']);_0x497a1c[_0x65d2('0x54')]=_['intersection'](_0x497a1c[_0x65d2('0x4b')],_0x497a1c[_0x65d2('0x52')]);_0x587422[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0x497a1c[_0x65d2('0x4b')],qs[_0x65d2('0x56')](_0x153381[_0x65d2('0x52')][_0x65d2('0x56')]));_0x587422['attributes']=_0x587422[_0x65d2('0x55')][_0x65d2('0x57')]?_0x587422[_0x65d2('0x55')]:_0x497a1c[_0x65d2('0x4b')];_0x587422[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x153381['query'][_0x65d2('0x5b')]);_0x587422['where']=qs[_0x65d2('0x54')](_['pick'](_0x153381['query'],_0x497a1c[_0x65d2('0x54')]));if(_0x153381['query'][_0x65d2('0x5d')]){_0x587422['where']=_['merge'](_0x587422[_0x65d2('0x5f')],{'$or':_[_0x65d2('0x39')](_0x587422[_0x65d2('0x55')],function(_0x640c84){var _0x432d1e={};_0x432d1e[_0x640c84]={'$like':'%'+_0x153381[_0x65d2('0x52')][_0x65d2('0x5d')]+'%'};return _0x432d1e;})});}_0x587422=_[_0x65d2('0x5e')]({},_0x587422,_0x153381['options']);return _0x24b5bd[_0x65d2('0x12c')](_0x587422);}})[_0x65d2('0x14')](function(_0x2afdf2){if(_0x2afdf2){_0x32293b=_0x2afdf2['length'];if(!_0x153381['query'][_0x65d2('0x58')](_0x65d2('0x59'))){_0x587422['limit']=qs[_0x65d2('0x23')](_0x153381['query'][_0x65d2('0x23')]);_0x587422['offset']=qs[_0x65d2('0x21')](_0x153381[_0x65d2('0x52')][_0x65d2('0x21')]);}return _0x24b5bd[_0x65d2('0x12c')](_0x587422);}})['then'](function(_0x52b013){if(_0x52b013){return _0x52b013?{'count':_0x32293b,'rows':_0x52b013}:null;}})[_0x65d2('0x14')](respondWithResult(_0x1f5ac1,null))['catch'](handleError(_0x1f5ac1,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 3a5d46e..3dbe38f 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 _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 +var _0x9ade=['../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9ade,0x107));var _0xe9ad=function(_0xc6b2ff,_0x1558d7){_0xc6b2ff=_0xc6b2ff-0x0;var _0x47f7a4=_0x9ade[_0xc6b2ff];return _0x47f7a4;};'use strict';var EventEmitter=require(_0xe9ad('0x0'));var ChatWebsite=require(_0xe9ad('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe9ad('0x2'),'afterUpdate':'update','afterDestroy':_0xe9ad('0x3')};function emitEvent(_0x38d722){return function(_0x4d4ee0,_0x52984f,_0x36e151){ChatWebsiteEvents[_0xe9ad('0x4')](_0x38d722+':'+_0x4d4ee0['id'],_0x4d4ee0);ChatWebsiteEvents[_0xe9ad('0x4')](_0x38d722,_0x4d4ee0);_0x36e151(null);};}for(var e in events){if(events[_0xe9ad('0x5')](e)){var event=events[e];ChatWebsite[_0xe9ad('0x6')](e,emitEvent(event));}}module[_0xe9ad('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 459f6c6..a5e4323 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 _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 +var _0x84dd=['../../config/environment','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x3fa813,_0x295ac7){var _0x3cbab1=function(_0x5b2451){while(--_0x5b2451){_0x3fa813['push'](_0x3fa813['shift']());}};_0x3cbab1(++_0x295ac7);}(_0x84dd,0xa2));var _0xd84d=function(_0x33de9c,_0x30aed9){_0x33de9c=_0x33de9c-0x0;var _0x189342=_0x84dd[_0x33de9c];return _0x189342;};'use strict';var _=require(_0xd84d('0x0'));var util=require(_0xd84d('0x1'));var logger=require(_0xd84d('0x2'))(_0xd84d('0x3'));var moment=require(_0xd84d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd84d('0x5'));var config=require(_0xd84d('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x11999a,_0x570213){return _0x11999a['define']('ChatWebsite',attributes,{'tableName':'chat_websites','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 0363cc2..f9191e5 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 _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 +var _0x44b3=['client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatWebsite,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x434a7a,_0xd166b){var _0x49addb=function(_0x39d79d){while(--_0x39d79d){_0x434a7a['push'](_0x434a7a['shift']());}};_0x49addb(++_0xd166b);}(_0x44b3,0xc1));var _0x344b=function(_0x214855,_0x114ac2){_0x214855=_0x214855-0x0;var _0xfbb29=_0x44b3[_0x214855];return _0xfbb29;};'use strict';var _=require(_0x344b('0x0'));var util=require(_0x344b('0x1'));var moment=require('moment');var BPromise=require(_0x344b('0x2'));var rs=require(_0x344b('0x3'));var fs=require('fs');var Redis=require(_0x344b('0x4'));var db=require(_0x344b('0x5'))['db'];var utils=require(_0x344b('0x6'));var logger=require(_0x344b('0x7'))(_0x344b('0x8'));var config=require(_0x344b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x344b('0xa')]['http']({'port':0x232a});config[_0x344b('0xb')]=_[_0x344b('0xc')](config[_0x344b('0xb')],{'host':_0x344b('0xd'),'port':0x18eb});var socket=require(_0x344b('0xe'))(new Redis(config['redis']));require(_0x344b('0xf'))[_0x344b('0x10')](socket);function respondWithRpcPromise(_0x3317c2,_0x1c881e,_0x2a6010){return new BPromise(function(_0x412051,_0x326d10){return client[_0x344b('0x11')](_0x3317c2,_0x2a6010)[_0x344b('0x12')](function(_0x87f652){logger[_0x344b('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x1c881e,_0x344b('0x14'));logger[_0x344b('0x15')](_0x344b('0x16'),_0x1c881e,_0x344b('0x14'),JSON[_0x344b('0x17')](_0x87f652));if(_0x87f652[_0x344b('0x18')]){if(_0x87f652[_0x344b('0x18')]['code']===0x1f4){logger[_0x344b('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x1c881e,_0x87f652[_0x344b('0x18')][_0x344b('0x19')]);return _0x326d10(_0x87f652[_0x344b('0x18')][_0x344b('0x19')]);}logger[_0x344b('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x1c881e,_0x87f652[_0x344b('0x18')][_0x344b('0x19')]);return _0x412051(_0x87f652[_0x344b('0x18')][_0x344b('0x19')]);}else{logger['info'](_0x344b('0x1a'),_0x1c881e,'request\x20sent');_0x412051(_0x87f652[_0x344b('0x1b')][_0x344b('0x19')]);}})[_0x344b('0x1c')](function(_0x208b20){logger['error'](_0x344b('0x1a'),_0x1c881e,_0x208b20);_0x326d10(_0x208b20);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 07aff59..f81d050 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 _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 +var _0x5cec=['length','chatWebsite:','./chatWebsite.events','save','update','emit','removeListener'];(function(_0x20efe6,_0x2d6285){var _0x2680c2=function(_0x1c969b){while(--_0x1c969b){_0x20efe6['push'](_0x20efe6['shift']());}};_0x2680c2(++_0x2d6285);}(_0x5cec,0x1e5));var _0xc5ce=function(_0x18beb4,_0x2c9a9c){_0x18beb4=_0x18beb4-0x0;var _0x170b3e=_0x5cec[_0x18beb4];return _0x170b3e;};'use strict';var ChatWebsiteEvents=require(_0xc5ce('0x0'));var events=[_0xc5ce('0x1'),'remove',_0xc5ce('0x2')];function createListener(_0x299537,_0x5d1b97){return function(_0x23be66){_0x5d1b97[_0xc5ce('0x3')](_0x299537,_0x23be66);};}function removeListener(_0x4311d7,_0x41b539){return function(){ChatWebsiteEvents[_0xc5ce('0x4')](_0x4311d7,_0x41b539);};}exports['register']=function(_0x35fa6e){for(var _0x54365a=0x0,_0xdcea44=events[_0xc5ce('0x5')];_0x54365a<_0xdcea44;_0x54365a++){var _0x371ad3=events[_0x54365a];var _0x2babf1=createListener(_0xc5ce('0x6')+_0x371ad3,_0x35fa6e);ChatWebsiteEvents['on'](_0x371ad3,_0x2babf1);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 66786fe..53aab55 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 _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 +var _0xdac6=['/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','addDisposition','post','/:id/canned_answers','addAnswer','join','root','server/files/images/logos/','%s-%s','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','format','now','/:id/avatar','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','any','offline','addInteraction','addApplications','addProactiveActions'];(function(_0x5c8376,_0x1d3be6){var _0x41a258=function(_0x410bc4){while(--_0x410bc4){_0x5c8376['push'](_0x5c8376['shift']());}};_0x41a258(++_0x1d3be6);}(_0xdac6,0x175));var _0x6dac=function(_0x4c2892,_0xf4b250){_0x4c2892=_0x4c2892-0x0;var _0x1695ef=_0xdac6[_0x4c2892];return _0x1695ef;};'use strict';var multer=require(_0x6dac('0x0'));var util=require('util');var path=require(_0x6dac('0x1'));var timeout=require(_0x6dac('0x2'));var express=require(_0x6dac('0x3'));var router=express[_0x6dac('0x4')]();var fs_extra=require(_0x6dac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6dac('0x6'));var config=require(_0x6dac('0x7'));var controller=require('./chatWebsite.controller');router[_0x6dac('0x8')]('/',auth[_0x6dac('0x9')](),controller['index']);router[_0x6dac('0x8')](_0x6dac('0xa'),auth[_0x6dac('0x9')](),controller[_0x6dac('0xb')]);router[_0x6dac('0x8')](_0x6dac('0xc'),auth[_0x6dac('0x9')](),controller[_0x6dac('0xd')]);router['get'](_0x6dac('0xe'),auth[_0x6dac('0x9')](),controller[_0x6dac('0xf')]);router[_0x6dac('0x8')]('/:id/canned_answers',auth[_0x6dac('0x9')](),controller['getAnswers']);router[_0x6dac('0x8')](_0x6dac('0x10'),controller[_0x6dac('0x11')]);router[_0x6dac('0x8')]('/:id/avatar',controller[_0x6dac('0x12')]);router['get'](_0x6dac('0x13'),controller[_0x6dac('0x14')]);router['get'](_0x6dac('0x15'),controller[_0x6dac('0x16')]);router[_0x6dac('0x8')](_0x6dac('0x17'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x18')]);router[_0x6dac('0x8')]('/:id/snippet',controller[_0x6dac('0x19')]);router[_0x6dac('0x8')](_0x6dac('0x1a'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x1b')]);router[_0x6dac('0x8')](_0x6dac('0x1c'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x1d')]);router['get'](_0x6dac('0x1e'),controller['getFields']);router[_0x6dac('0x8')](_0x6dac('0x1f'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x20')]);router[_0x6dac('0x8')]('/:id/users',auth[_0x6dac('0x9')](),controller[_0x6dac('0x21')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6dac('0xe'),auth['isAuthenticated'](),controller[_0x6dac('0x22')]);router[_0x6dac('0x23')](_0x6dac('0x24'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xbb215a,_0x63d6ec,_0x1f92fc){_0x1f92fc(null,path[_0x6dac('0x26')](config[_0x6dac('0x27')],_0x6dac('0x28')));},'filename':function(_0x42690b,_0x5be55e,_0x4163ea){_0x4163ea(null,util['format'](_0x6dac('0x29'),Date['now'](),_0x5be55e[_0x6dac('0x2a')]));}})});router[_0x6dac('0x23')](_0x6dac('0x10'),upload[_0x6dac('0x2b')](_0x6dac('0x2c')),controller[_0x6dac('0x2d')]);var upload=multer({'storage':multer[_0x6dac('0x2e')]({'destination':function(_0x23cc17,_0x65d54c,_0x8216f9){_0x8216f9(null,path[_0x6dac('0x26')](config[_0x6dac('0x27')],_0x6dac('0x2f')));},'filename':function(_0x4900d7,_0x584af5,_0x2c8dc3){_0x2c8dc3(null,util[_0x6dac('0x30')](_0x6dac('0x29'),Date[_0x6dac('0x31')](),_0x584af5['originalname']));}})});router[_0x6dac('0x23')](_0x6dac('0x32'),upload[_0x6dac('0x2b')](_0x6dac('0x2c')),controller[_0x6dac('0x33')]);var upload=multer({'storage':multer[_0x6dac('0x2e')]({'destination':function(_0x5f2b15,_0x51637f,_0x3826fe){_0x3826fe(null,path[_0x6dac('0x26')](config[_0x6dac('0x27')],_0x6dac('0x2f')));},'filename':function(_0x46da7c,_0x2d6203,_0x1feee1){_0x1feee1(null,util[_0x6dac('0x30')](_0x6dac('0x29'),Date['now'](),_0x2d6203[_0x6dac('0x2a')]));}})});router['post'](_0x6dac('0x13'),upload[_0x6dac('0x2b')]('file'),controller[_0x6dac('0x34')]);var upload=multer({'storage':multer[_0x6dac('0x2e')]({'destination':function(_0x37a398,_0x5e7e88,_0xa0bc77){_0xa0bc77(null,path['join'](config[_0x6dac('0x27')],_0x6dac('0x2f')));},'filename':function(_0x5356c6,_0x1df81a,_0x4f0db6){_0x4f0db6(null,util[_0x6dac('0x30')](_0x6dac('0x29'),Date[_0x6dac('0x31')](),_0x1df81a[_0x6dac('0x2a')]));}})});router['post'](_0x6dac('0x15'),upload[_0x6dac('0x2b')](_0x6dac('0x2c')),controller[_0x6dac('0x35')]);router[_0x6dac('0x23')](_0x6dac('0x36'),controller[_0x6dac('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x6dac('0x2e')]({'destination':function(_0x16743d,_0x24f941,_0x650f4){const _0x2e8b07=path[_0x6dac('0x26')](config[_0x6dac('0x27')],_0x6dac('0x38'),_0x6dac('0x39'),_0x6dac('0x3a'));fs_extra['ensureDir'](_0x2e8b07,function(){_0x650f4(null,_0x2e8b07);});},'filename':function(_0x57b281,_0x100ffe,_0x487a6d){const _0x21c171=_0x100ffe[_0x6dac('0x2a')][_0x6dac('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x167ab6=path['extname'](_0x21c171);const _0x18ec6e=Date['now']()+'-'+_0x21c171[_0x6dac('0x3b')](_0x167ab6,'')+_0x167ab6;_0x487a6d(null,_0x18ec6e);}})});router[_0x6dac('0x23')]('/:id/offline',offlineUploadMulter[_0x6dac('0x3c')](),controller[_0x6dac('0x3d')]);router[_0x6dac('0x23')](_0x6dac('0x17'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x3e')]);router[_0x6dac('0x23')](_0x6dac('0x1a'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x3f')]);router[_0x6dac('0x23')](_0x6dac('0x1c'),auth['isAuthenticated'](),controller[_0x6dac('0x40')]);router[_0x6dac('0x23')](_0x6dac('0x41'),auth[_0x6dac('0x9')](),controller['addAgents']);router[_0x6dac('0x42')](_0x6dac('0xc'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x43')]);router[_0x6dac('0x44')](_0x6dac('0xc'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x45')]);router[_0x6dac('0x44')](_0x6dac('0xe'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x46')]);router[_0x6dac('0x44')](_0x6dac('0x24'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x47')]);router[_0x6dac('0x44')](_0x6dac('0x41'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x48')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 16c357d..c0c9f39 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 _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 +var _0xcf0b=['get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0xcf0b,0xe3));var _0xbcf0=function(_0x4dd072,_0x515c74){_0x4dd072=_0x4dd072-0x0;var _0x45ee58=_0xcf0b[_0x4dd072];return _0x45ee58;};var beaverLogger=require(_0xbcf0('0x0'));var express=require(_0xbcf0('0x1'));var auth=require(_0xbcf0('0x2'));var config=require(_0xbcf0('0x3'));var router=express[_0xbcf0('0x4')]();var isProduction=config[_0xbcf0('0x5')]===_0xbcf0('0x6')||![];function clientSideLogs(_0x365555,_0x39a878,_0x28d8ab){var _0x5b127c=_0x365555['app'][_0xbcf0('0x7')](_0xbcf0('0x8'));if(!_0x5b127c){throw new Error(_0xbcf0('0x9'));}return beaverLogger[_0xbcf0('0xa')]({'uri':_0xbcf0('0xb'),'logger':_0x5b127c,'enableCors':!isProduction})(_0x365555,_0x39a878,_0x28d8ab);}router['use'](auth[_0xbcf0('0xc')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index d3d7719..4605107 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 _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 +var _0xa88c=['STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','exports'];(function(_0x9da8b9,_0x445b60){var _0x207521=function(_0x4e0527){while(--_0x4e0527){_0x9da8b9['push'](_0x9da8b9['shift']());}};_0x207521(++_0x445b60);}(_0xa88c,0x185));var _0xca88=function(_0x544f09,_0x1624a3){_0x544f09=_0x544f09-0x0;var _0x542110=_0xa88c[_0x544f09];return _0x542110;};'use strict';var Sequelize=require('sequelize');module[_0xca88('0x0')]={'name':{'type':Sequelize[_0xca88('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xca88('0x2')](_0xca88('0x3'),_0xca88('0x4'),_0xca88('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xca88('0x6'),_0xca88('0x7'))},'data1':{'type':Sequelize[_0xca88('0x1')],'comment':_0xca88('0x8')},'data2':{'type':Sequelize[_0xca88('0x1')],'comment':_0xca88('0x9')},'data3':{'type':Sequelize[_0xca88('0x1')],'comment':_0xca88('0xa')},'data4':{'type':Sequelize[_0xca88('0x1')],'comment':_0xca88('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0xca88('0xc')},'data6':{'type':Sequelize[_0xca88('0xd')],'comment':_0xca88('0xe')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 331036d..65a6103 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 _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 +var _0xe291=['Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','MicrosoftAzure','params','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','error','stack','name','send','padEnd','CloudProvider','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','decryptString','data3','catch','show','find','service','create','body'];(function(_0x278d73,_0xb20d63){var _0x31ca5c=function(_0x3355d5){while(--_0x3355d5){_0x278d73['push'](_0x278d73['shift']());}};_0x31ca5c(++_0xb20d63);}(_0xe291,0x12f));var _0x1e29=function(_0x3cb339,_0xaa2c29){_0x3cb339=_0x3cb339-0x0;var _0x302367=_0xe291[_0x3cb339];return _0x302367;};'use strict';var _=require('lodash');var Redis=require(_0x1e29('0x0'));var qs=require(_0x1e29('0x1'));var encryptor=require(_0x1e29('0x2'));var config=require(_0x1e29('0x3'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x1e29('0x4'));config[_0x1e29('0x5')]=_[_0x1e29('0x6')](config[_0x1e29('0x5')],{'host':_0x1e29('0x7'),'port':0x18eb});var socket=require(_0x1e29('0x8'))(new Redis(config[_0x1e29('0x5')]));var redis=new Redis(config[_0x1e29('0x5')]);function respondWithStatusCode(_0x389e9c,_0x132bf2){_0x132bf2=_0x132bf2||0xcc;return function(_0x3080b8){if(_0x3080b8){return _0x389e9c[_0x1e29('0x9')](_0x132bf2);}return _0x389e9c[_0x1e29('0xa')](_0x132bf2)[_0x1e29('0xb')]();};}function respondWithResult(_0x3e1d56,_0x38d77d){_0x38d77d=_0x38d77d||0xc8;return function(_0x3579d5){if(_0x3579d5){return _0x3e1d56[_0x1e29('0xa')](_0x38d77d)['json'](_0x3579d5);}};}function respondWithFilteredResult(_0x30bf66,_0x1b0c23){return function(_0x50b20a){if(_0x50b20a){var _0x47bd3f=typeof _0x1b0c23[_0x1e29('0xc')]===_0x1e29('0xd')&&typeof _0x1b0c23[_0x1e29('0xe')]==='undefined';var _0x5605a7=_0x50b20a[_0x1e29('0xf')];var _0x2ecc94=_0x47bd3f?0x0:_0x1b0c23[_0x1e29('0xc')];var _0x165bcf=_0x47bd3f?_0x50b20a[_0x1e29('0xf')]:_0x1b0c23[_0x1e29('0xc')]+_0x1b0c23[_0x1e29('0xe')];var _0x23b147;if(_0x165bcf>=_0x5605a7){_0x165bcf=_0x5605a7;_0x23b147=0xc8;}else{_0x23b147=0xce;}_0x30bf66['status'](_0x23b147);return _0x30bf66[_0x1e29('0x10')](_0x1e29('0x11'),_0x2ecc94+'-'+_0x165bcf+'/'+_0x5605a7)[_0x1e29('0x12')](_0x50b20a);}return null;};}function saveUpdates(_0x189e5c){return function(_0x381127){if(_0x381127){return _0x381127[_0x1e29('0x13')](_0x189e5c)[_0x1e29('0x14')](function(_0xb768d1){return _0xb768d1;});}return null;};}function removeEntity(_0x234f40){return function(_0x3bb992){if(_0x3bb992){return _0x3bb992['destroy']()[_0x1e29('0x14')](function(){_0x234f40[_0x1e29('0xa')](0xcc)[_0x1e29('0xb')]();});}};}function handleEntityNotFound(_0x246784){return function(_0x2547fe){if(!_0x2547fe){_0x246784['sendStatus'](0x194);}return _0x2547fe;};}function handleError(_0x332712,_0x2e3745){_0x2e3745=_0x2e3745||0x1f4;return function(_0x14b8ca){logger[_0x1e29('0x15')](_0x14b8ca[_0x1e29('0x16')]);if(_0x14b8ca[_0x1e29('0x17')]){delete _0x14b8ca[_0x1e29('0x17')];}_0x332712[_0x1e29('0xa')](_0x2e3745)[_0x1e29('0x18')](_0x14b8ca);};}function maskClientSecret(_0x531c0f){return _[_0x1e29('0x19')](_0x531c0f['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x95d8ee,_0x525ba1){var _0x324d0f={},_0x301dc6={},_0x27db2a={'count':0x0,'rows':[]};var _0xdc4427=_['map'](db[_0x1e29('0x1a')][_0x1e29('0x1b')],function(_0x216512){return{'name':_0x216512[_0x1e29('0x1c')],'type':_0x216512['type'][_0x1e29('0x1d')]};});_0x301dc6[_0x1e29('0x1e')]=_[_0x1e29('0x1f')](_0xdc4427,_0x1e29('0x17'));_0x301dc6[_0x1e29('0x20')]=_[_0x1e29('0x21')](_0x95d8ee[_0x1e29('0x20')]);_0x301dc6[_0x1e29('0x22')]=_[_0x1e29('0x23')](_0x301dc6[_0x1e29('0x1e')],_0x301dc6[_0x1e29('0x20')]);_0x324d0f['attributes']=_['intersection'](_0x301dc6[_0x1e29('0x1e')],qs[_0x1e29('0x24')](_0x95d8ee[_0x1e29('0x20')][_0x1e29('0x24')]));_0x324d0f['attributes']=_0x324d0f[_0x1e29('0x25')][_0x1e29('0x26')]?_0x324d0f[_0x1e29('0x25')]:_0x301dc6[_0x1e29('0x1e')];if(!_0x95d8ee['query'][_0x1e29('0x27')]('nolimit')){_0x324d0f[_0x1e29('0xe')]=qs['limit'](_0x95d8ee['query']['limit']);_0x324d0f[_0x1e29('0xc')]=qs['offset'](_0x95d8ee['query']['offset']);}_0x324d0f[_0x1e29('0x28')]=qs[_0x1e29('0x29')](_0x95d8ee[_0x1e29('0x20')][_0x1e29('0x29')]);_0x324d0f[_0x1e29('0x2a')]=qs['filters'](_[_0x1e29('0x2b')](_0x95d8ee[_0x1e29('0x20')],_0x301dc6[_0x1e29('0x22')]),_0xdc4427);if(_0x95d8ee[_0x1e29('0x20')][_0x1e29('0x2c')]){_0x324d0f[_0x1e29('0x2a')]=_['merge'](_0x324d0f[_0x1e29('0x2a')],{'$or':_[_0x1e29('0x1f')](_0xdc4427,function(_0x13ee00){if(_0x13ee00[_0x1e29('0x2d')]!==_0x1e29('0x2e')){var _0x5eeef9={};_0x5eeef9[_0x13ee00[_0x1e29('0x17')]]={'$like':'%'+_0x95d8ee[_0x1e29('0x20')][_0x1e29('0x2c')]+'%'};return _0x5eeef9;}})});}_0x324d0f=_[_0x1e29('0x2f')]({},_0x324d0f,_0x95d8ee[_0x1e29('0x30')]);var _0x2b8e56={'where':_0x324d0f['where']};return db[_0x1e29('0x1a')]['count'](_0x2b8e56)['then'](function(_0x15c166){_0x27db2a[_0x1e29('0xf')]=_0x15c166;if(_0x95d8ee[_0x1e29('0x20')][_0x1e29('0x31')]){_0x324d0f[_0x1e29('0x32')]=[{'all':!![]}];}return db[_0x1e29('0x1a')][_0x1e29('0x33')](_0x324d0f);})['then'](function(_0x2e074c){_0x27db2a[_0x1e29('0x34')]=_['map'](_0x2e074c,function(_0x30b01c){if(_0x30b01c['service']==='MicrosoftAzure'){var _0x5a51ab=encryptor[_0x1e29('0x35')](_0x30b01c[_0x1e29('0x36')]);_0x30b01c[_0x1e29('0x36')]=maskClientSecret(_0x5a51ab);}return _0x30b01c;});return _0x27db2a;})['then'](respondWithFilteredResult(_0x525ba1,_0x324d0f))[_0x1e29('0x37')](handleError(_0x525ba1,null));};exports[_0x1e29('0x38')]=function(_0x4c4ee5,_0x22f380){var _0x2e386a={'raw':!![],'where':{'id':_0x4c4ee5['params']['id']}},_0x175a63={};_0x175a63[_0x1e29('0x1e')]=_[_0x1e29('0x21')](db['CloudProvider'][_0x1e29('0x1b')]);_0x175a63[_0x1e29('0x20')]=_[_0x1e29('0x21')](_0x4c4ee5[_0x1e29('0x20')]);_0x175a63[_0x1e29('0x22')]=_[_0x1e29('0x23')](_0x175a63[_0x1e29('0x1e')],_0x175a63[_0x1e29('0x20')]);_0x2e386a[_0x1e29('0x25')]=_[_0x1e29('0x23')](_0x175a63[_0x1e29('0x1e')],qs[_0x1e29('0x24')](_0x4c4ee5[_0x1e29('0x20')][_0x1e29('0x24')]));_0x2e386a[_0x1e29('0x25')]=_0x2e386a['attributes'][_0x1e29('0x26')]?_0x2e386a[_0x1e29('0x25')]:_0x175a63['model'];if(_0x4c4ee5['query'][_0x1e29('0x31')]){_0x2e386a[_0x1e29('0x32')]=[{'all':!![]}];}_0x2e386a=_[_0x1e29('0x2f')]({},_0x2e386a,_0x4c4ee5[_0x1e29('0x30')]);return db['CloudProvider'][_0x1e29('0x39')](_0x2e386a)['then'](handleEntityNotFound(_0x22f380,null))['then'](function(_0x440d5d){if(_0x440d5d[_0x1e29('0x3a')]==='MicrosoftAzure'){var _0x4ceb0c=encryptor[_0x1e29('0x35')](_0x440d5d['data3']);_0x440d5d[_0x1e29('0x36')]=maskClientSecret(_0x4ceb0c);}return _0x440d5d;})[_0x1e29('0x14')](respondWithResult(_0x22f380,null))[_0x1e29('0x37')](handleError(_0x22f380,null));};exports[_0x1e29('0x3b')]=function(_0x51d957,_0x117f93){if(!_0x51d957[_0x1e29('0x3c')][_0x1e29('0x17')])throw new Error(_0x1e29('0x3d'));if(!_0x51d957[_0x1e29('0x3c')][_0x1e29('0x3a')])throw new Error(_0x1e29('0x3e'));var _0x9fa867=db[_0x1e29('0x1a')][_0x1e29('0x1b')][_0x1e29('0x3a')]['values'];if(!_0x9fa867['includes'](_0x51d957[_0x1e29('0x3c')][_0x1e29('0x3a')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x9fa867['join'](',\x20'));if(_0x51d957[_0x1e29('0x3c')][_0x1e29('0x3a')]===_0x1e29('0x3f')&&_0x51d957[_0x1e29('0x3c')][_0x1e29('0x36')]){_0x51d957[_0x1e29('0x3c')][_0x1e29('0x36')]=encryptor['encryptString'](_0x51d957[_0x1e29('0x3c')][_0x1e29('0x36')]);}return db['CloudProvider']['create'](_0x51d957[_0x1e29('0x3c')],{})[_0x1e29('0x14')](respondWithResult(_0x117f93,0xc9))[_0x1e29('0x37')](handleError(_0x117f93,null));};exports[_0x1e29('0x13')]=function(_0x5dba85,_0x1cff9a){if(_0x5dba85[_0x1e29('0x3c')]['id']){delete _0x5dba85[_0x1e29('0x3c')]['id'];}return db[_0x1e29('0x1a')][_0x1e29('0x39')]({'where':{'id':_0x5dba85[_0x1e29('0x40')]['id']}})[_0x1e29('0x14')](handleEntityNotFound(_0x1cff9a,null))['then'](function(_0x3e264e){if(_0x3e264e[_0x1e29('0x3a')]===_0x1e29('0x3f')&&_0x5dba85[_0x1e29('0x3c')][_0x1e29('0x36')]){_0x5dba85['body'][_0x1e29('0x36')]=encryptor[_0x1e29('0x41')](_0x5dba85[_0x1e29('0x3c')][_0x1e29('0x36')]);}return _0x3e264e;})[_0x1e29('0x14')](saveUpdates(_0x5dba85[_0x1e29('0x3c')],null))[_0x1e29('0x14')](respondWithResult(_0x1cff9a,null))[_0x1e29('0x37')](handleError(_0x1cff9a,null));};exports['destroy']=function(_0x18c6a3,_0xba5c2f){return db['CloudProvider'][_0x1e29('0x39')]({'where':{'id':_0x18c6a3[_0x1e29('0x40')]['id']}})[_0x1e29('0x14')](handleEntityNotFound(_0xba5c2f,null))[_0x1e29('0x14')](removeEntity(_0xba5c2f,null))['catch'](handleError(_0xba5c2f,null));};exports[_0x1e29('0x42')]=function(_0x5a2fa6,_0x13c407){return db['CloudProvider']['findOne']({'where':{'id':_0x5a2fa6[_0x1e29('0x40')]['id']},'raw':!![]})[_0x1e29('0x14')](function(_0x4550fc){if(!_0x4550fc)return _0x13c407['sendStatus'](0x194);return{'url':oauth[_0x1e29('0x43')](_0x4550fc,_0x5a2fa6[_0x1e29('0x44')]['id'])};})[_0x1e29('0x14')](respondWithResult(_0x13c407,null))['catch'](handleError(_0x13c407,null));};exports[_0x1e29('0x45')]=function(_0x22b13c,_0x3d78ad){var _0x2cb0ed=_0x22b13c[_0x1e29('0x3c')];var _0x172fdf;var _0xe7f688;if(_0x2cb0ed['error'])throw _0x2cb0ed;redis[_0x1e29('0x46')](_0x2cb0ed[_0x1e29('0x47')])['then'](function(_0x265277){if(!_0x265277)throw new Error(_0x1e29('0x48'));_0x172fdf=JSON[_0x1e29('0x49')](_0x265277);var _0x210b2f=Buffer[_0x1e29('0x4a')](_0x2cb0ed['state'],_0x1e29('0x4b'))[_0x1e29('0x4c')](_0x1e29('0x4d'));_0xe7f688=JSON[_0x1e29('0x49')](_0x210b2f);if(!oauth['isValidIdToken'](_0x2cb0ed['id_token'],_0x172fdf['oauth2Claims']))throw new Error(_0x1e29('0x4e'));redis[_0x1e29('0x4f')](_0x2cb0ed[_0x1e29('0x47')]);return oauth[_0x1e29('0x50')](_0x2cb0ed[_0x1e29('0x51')],_0x172fdf);})[_0x1e29('0x14')](function(_0x1be120){_0x172fdf[_0x1e29('0x52')]=_0x1be120[_0x1e29('0x53')];_0x172fdf['data6']=_0x1be120['refresh_token'];return db[_0x1e29('0x1a')]['update']({'data5':_0x172fdf['data5'],'data6':_0x172fdf[_0x1e29('0x54')]},{'where':{'id':_0x172fdf['id']}});})[_0x1e29('0x14')](function(){oauth[_0x1e29('0x55')](_0x172fdf);socket[_0x1e29('0x56')](_0x1e29('0x57'),{'id':_0xe7f688['id']});return;})[_0x1e29('0x14')](respondWithStatusCode(_0x3d78ad,null))[_0x1e29('0x37')](function(_0x17ca5b){if(_0xe7f688){socket[_0x1e29('0x56')]('microsoftAuthorization:error',{'id':_0xe7f688['id']});}if(!_0x172fdf){logger['error'](_0x1e29('0x58'),_0x17ca5b);return _0x3d78ad[_0x1e29('0xa')](0x1f4)['send'](_0x17ca5b[_0x1e29('0x59')]);}logger[_0x1e29('0x15')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x172fdf['id'],JSON[_0x1e29('0x5a')](_0x17ca5b));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 8a1de72..82c8ece 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 _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 +var _0x9cac=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x11af81,_0x3d1a99){var _0x367dc6=function(_0x34370a){while(--_0x34370a){_0x11af81['push'](_0x11af81['shift']());}};_0x367dc6(++_0x3d1a99);}(_0x9cac,0x18c));var _0xc9ca=function(_0x487003,_0x57d4b9){_0x487003=_0x487003-0x0;var _0x2503c7=_0x9cac[_0x487003];return _0x2503c7;};'use strict';var _=require(_0xc9ca('0x0'));var util=require(_0xc9ca('0x1'));var logger=require('../../config/logger')(_0xc9ca('0x2'));var moment=require('moment');var BPromise=require(_0xc9ca('0x3'));var rp=require(_0xc9ca('0x4'));var fs=require('fs');var path=require(_0xc9ca('0x5'));var rimraf=require(_0xc9ca('0x6'));var config=require(_0xc9ca('0x7'));var attributes=require(_0xc9ca('0x8'));module[_0xc9ca('0x9')]=function(_0x5911ff,_0x4abb34){return _0x5911ff[_0xc9ca('0xa')](_0xc9ca('0xb'),attributes,{'tableName':_0xc9ca('0xc'),'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 c5c8acd..7c8311c 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 _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 +var _0x4cdd=['isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','{TENANT_ID}','access_token','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','type','Dynamics365','/.default','join','data7','replace','data2','code','from','stringify','toString','base64','client_id','data1','response_type','data4','response_mode','form_post','scope','state','nonce','prompt','map','value','oauth2Claims','decode','payload','iss','issuer'];(function(_0x4e8cf3,_0x59b5f9){var _0x2c1fa1=function(_0x1f0d95){while(--_0x1f0d95){_0x4e8cf3['push'](_0x4e8cf3['shift']());}};_0x2c1fa1(++_0x59b5f9);}(_0x4cdd,0x1dc));var _0xd4cd=function(_0x2462ba,_0x5f0261){_0x2462ba=_0x2462ba-0x0;var _0xefe16a=_0x4cdd[_0x2462ba];return _0xefe16a;};'use strict';var _=require('lodash');var crypto=require(_0xd4cd('0x0'));var jwt=require(_0xd4cd('0x1'));var moment=require(_0xd4cd('0x2'));var Redis=require(_0xd4cd('0x3'));var rp=require('request-promise');var util=require(_0xd4cd('0x4'));var encryptor=require(_0xd4cd('0x5'));var config=require(_0xd4cd('0x6'));var logger=require('../../config/logger')(_0xd4cd('0x7'));var schedule=require(_0xd4cd('0x8'));var db=require(_0xd4cd('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd4cd('0xa'),'port':0x18eb});var redis=new Redis(config[_0xd4cd('0xb')]);var MICROSOFT_AUTH_URL=_0xd4cd('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xd4cd('0xd'),_0xd4cd('0xe'),_0xd4cd('0xf'),'offline_access',_0xd4cd('0x10'),_0xd4cd('0x11'),_0xd4cd('0x12')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xd4cd('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x52aeeb){var _0x20370a=_['map'](AZURE_AUTH_SCOPES[_0x52aeeb[_0xd4cd('0x14')]]);if(_0x52aeeb['type']===_0xd4cd('0x15'))_0x20370a['push'](_0x52aeeb['data7']+_0xd4cd('0x16'));return _0x20370a[_0xd4cd('0x17')]('\x20');}function getAccessTokenScope(_0x4555ac){if(_0x4555ac[_0xd4cd('0x14')]==='Outlook365')return _0xd4cd('0x10');if(_0x4555ac['type']==='Dynamics365')return _0x4555ac[_0xd4cd('0x18')]+_0xd4cd('0x16');}function generateMicrosoftAuthorizationUrl(_0x200385,_0x59cd37){var _0xd5c49c=MICROSOFT_AUTH_URL[_0xd4cd('0x19')]('{TENANT_ID}',_0x200385[_0xd4cd('0x1a')]);var _0x541a7b=[_0xd4cd('0x1b'),'id_token'];var _0x42ac09=Buffer[_0xd4cd('0x1c')](JSON[_0xd4cd('0x1d')]({'id':_0x59cd37}))[_0xd4cd('0x1e')](_0xd4cd('0x1f'));var _0x110514=crypto['randomBytes'](0x10)[_0xd4cd('0x1e')]('hex');var _0x6c03b8=getAuthorizationScopes(_0x200385);var _0x538f65=[{'key':_0xd4cd('0x20'),'value':_0x200385[_0xd4cd('0x21')]},{'key':_0xd4cd('0x22'),'value':encodeURIComponent(_0x541a7b[_0xd4cd('0x17')]('\x20'))},{'key':'redirect_uri','value':_0x200385[_0xd4cd('0x23')]},{'key':_0xd4cd('0x24'),'value':_0xd4cd('0x25')},{'key':_0xd4cd('0x26'),'value':encodeURIComponent(_0x6c03b8)},{'key':_0xd4cd('0x27'),'value':_0x42ac09},{'key':_0xd4cd('0x28'),'value':_0x110514},{'key':_0xd4cd('0x29'),'value':'login'}];var _0xe0029c=_0xd5c49c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xd4cd('0x2a')](_0x538f65,function(_0x43f548){return _0x43f548['key']+'='+_0x43f548[_0xd4cd('0x2b')];})[_0xd4cd('0x17')]('&');_0x200385[_0xd4cd('0x2c')]={'issuer':_0xd5c49c[_0xd4cd('0x19')]('oauth2/',''),'audience':_0x200385['data1'],'state':_0x42ac09,'nonce':_0x110514};redis['set'](_0x42ac09,JSON[_0xd4cd('0x1d')](_0x200385));return _0xe0029c;}function isValidIdToken(_0x3b4757,_0x40c033){try{var _0x11f3ae=jwt[_0xd4cd('0x2d')](_0x3b4757,{'complete':!![]});var _0x4c138c=_0x11f3ae[_0xd4cd('0x2e')];if(_0x4c138c[_0xd4cd('0x2f')]!==_0x40c033[_0xd4cd('0x30')])return![];if(_0x4c138c['aud']!==_0x40c033['audience'])return![];if(_0x4c138c[_0xd4cd('0x28')]!==_0x40c033[_0xd4cd('0x28')])return![];if(moment()[_0xd4cd('0x31')](moment[_0xd4cd('0x32')](_0x4c138c[_0xd4cd('0x33')])))return![];return!![];}catch(_0x257ac0){throw _0x257ac0;}}function refreshOauth2MicrosoftAccessToken(_0xab2ec9){return Promise[_0xd4cd('0x34')]()[_0xd4cd('0x35')](function(){if(_0xab2ec9[_0xd4cd('0x36')])return _0xab2ec9;return db[_0xd4cd('0x37')][_0xd4cd('0x38')]({'where':{'id':_0xab2ec9['id']},'raw':!![]});})[_0xd4cd('0x35')](function(_0x56a237){var _0x1fdce8={'grant_type':_0xd4cd('0x39'),'refresh_token':_0x56a237[_0xd4cd('0x3a')],'scope':getAccessTokenScope(_0x56a237),'redirect_uri':_0x56a237[_0xd4cd('0x23')],'client_id':_0x56a237['data1'],'client_secret':encryptor[_0xd4cd('0x3b')](_0x56a237[_0xd4cd('0x36')])};var _0x4b8cfb={'method':_0xd4cd('0x3c'),'uri':MICROSOFT_AUTH_URL[_0xd4cd('0x19')](_0xd4cd('0x3d'),_0x56a237['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1fdce8,'json':!![]};return rp(_0x4b8cfb);})[_0xd4cd('0x35')](function(_0x491d45){_0xab2ec9['data5']=_0x491d45[_0xd4cd('0x3e')];_0xab2ec9['data6']=_0x491d45[_0xd4cd('0x39')];return db[_0xd4cd('0x37')][_0xd4cd('0x3f')]({'data5':_0xab2ec9[_0xd4cd('0x40')],'data6':_0xab2ec9[_0xd4cd('0x3a')]},{'where':{'id':_0xab2ec9['id']}});})['then'](function(){return _0xab2ec9;})[_0xd4cd('0x41')](function(_0x4a98c2){logger[_0xd4cd('0x42')](_0xd4cd('0x43'),_0xab2ec9['id'],_0x4a98c2);});}function getOauth2MicrosoftAccessToken(_0x2f88a5,_0x4a27e4){var _0x45cc49={'grant_type':_0xd4cd('0x44'),'code':_0x2f88a5,'scope':getAccessTokenScope(_0x4a27e4),'redirect_uri':_0x4a27e4[_0xd4cd('0x23')],'client_id':_0x4a27e4[_0xd4cd('0x21')],'client_secret':encryptor['decryptString'](_0x4a27e4['data3'])};var _0x1739b3={'method':_0xd4cd('0x3c'),'uri':MICROSOFT_AUTH_URL[_0xd4cd('0x19')]('{TENANT_ID}',_0x4a27e4['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x45cc49,'json':!![]};return rp(_0x1739b3);}function startRefreshInterval(_0x59667f){var _0x4a120e=schedule[_0xd4cd('0x45')];if(_0x4a120e[_0x59667f['id']])clearInterval(_0x4a120e[_0x59667f['id']]);_0x4a120e[_0x59667f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xd4cd('0x46')](this,{'id':_0x59667f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4a120e;}function startAllRefreshIntervals(){return db[_0xd4cd('0x37')][_0xd4cd('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x3ab22c){var _0x58104b=_0x3ab22c[_0xd4cd('0x2a')](function(_0x2667b4){return refreshOauth2MicrosoftAccessToken(_0x2667b4)[_0xd4cd('0x35')](function(_0x2c42df){startRefreshInterval(_0x2c42df);});});return Promise[_0xd4cd('0x48')](_0x58104b);})[_0xd4cd('0x41')](function(_0xdc926){var _0x21cdfb=_0xdc926?util['inspect'](_0xdc926,{'showHidden':![],'depth':null}):'';logger['error'](_0xd4cd('0x49'),_0x21cdfb);});}module[_0xd4cd('0x4a')]={'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 bfa5e6b..fd58744 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 _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 +var _0x5360=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result'];(function(_0x377434,_0x49e358){var _0x2282bd=function(_0xa92e0b){while(--_0xa92e0b){_0x377434['push'](_0x377434['shift']());}};_0x2282bd(++_0x49e358);}(_0x5360,0x157));var _0x0536=function(_0x5b8731,_0x4b677a){_0x5b8731=_0x5b8731-0x0;var _0x34382e=_0x5360[_0x5b8731];return _0x34382e;};'use strict';var _=require(_0x0536('0x0'));var util=require(_0x0536('0x1'));var moment=require(_0x0536('0x2'));var BPromise=require(_0x0536('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0536('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0536('0x5'))(_0x0536('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19c89e,_0x1122a2,_0x27cac6){return new BPromise(function(_0x4974ad,_0x180b94){return client[_0x0536('0x8')](_0x19c89e,_0x27cac6)[_0x0536('0x9')](function(_0x5b78e2){logger[_0x0536('0xa')]('CloudProvider,\x20%s,\x20%s',_0x1122a2,'request\x20sent');logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1122a2,_0x0536('0xb'),JSON[_0x0536('0xc')](_0x5b78e2));if(_0x5b78e2[_0x0536('0xd')]){if(_0x5b78e2[_0x0536('0xd')][_0x0536('0xe')]===0x1f4){logger[_0x0536('0xd')](_0x0536('0xf'),_0x1122a2,_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);return _0x180b94(_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);}logger[_0x0536('0xd')](_0x0536('0xf'),_0x1122a2,_0x5b78e2['error'][_0x0536('0x10')]);return _0x4974ad(_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);}else{logger[_0x0536('0xa')](_0x0536('0xf'),_0x1122a2,'request\x20sent');_0x4974ad(_0x5b78e2[_0x0536('0x11')][_0x0536('0x10')]);}})[_0x0536('0x12')](function(_0x1ff4f9){logger['error']('CloudProvider,\x20%s,\x20%s',_0x1122a2,_0x1ff4f9);_0x180b94(_0x1ff4f9);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a01df5f..a279b36 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 _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 +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x1261,0x144));var _0x1126=function(_0x5b086e,_0x5eb6c0){_0x5b086e=_0x5b086e-0x0;var _0x3e2c2c=_0x1261[_0x5b086e];return _0x3e2c2c;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8c20c41..8bd2a6e 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 _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 +var _0xd5cd=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd5cd,0x7e));var _0xdd5c=function(_0xaec54f,_0x2a794d){_0xaec54f=_0xaec54f-0x0;var _0x4c4cb1=_0xd5cd[_0xaec54f];return _0x4c4cb1;};'use strict';var Sequelize=require(_0xdd5c('0x0'));module[_0xdd5c('0x1')]={'name':{'type':Sequelize[_0xdd5c('0x2')],'unique':_0xdd5c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xdd5c('0x2')]},'companyId':{'type':Sequelize[_0xdd5c('0x2')]},'website':{'type':Sequelize[_0xdd5c('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xdd5c('0x2')]},'type':{'type':Sequelize[_0xdd5c('0x2')]},'street':{'type':Sequelize[_0xdd5c('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xdd5c('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdd5c('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xdd5c('0x2')]},'sStreet':{'type':Sequelize[_0xdd5c('0x2')]},'sPostalCode':{'type':Sequelize[_0xdd5c('0x2')]},'sCity':{'type':Sequelize[_0xdd5c('0x2')]},'sCountry':{'type':Sequelize[_0xdd5c('0x2')]},'description':{'type':Sequelize[_0xdd5c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 8ee113b..f17fbc2 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 _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 +var _0xa423=['rawAttributes','intersection','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addContacts','CmContact','omit','getContacts','findOne','sort','filters','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','map','merge','options','includeAll','include','rows','catch','show'];(function(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_0xa423,0x68));var _0x3a42=function(_0x10f5ea,_0xeb348a){_0x10f5ea=_0x10f5ea-0x0;var _0x5c4f0f=_0xa423[_0x10f5ea];return _0x5c4f0f;};'use strict';var emlformat=require(_0x3a42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a42('0x1'));var jsonpatch=require(_0x3a42('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3a42('0x3'));var Mustache=require(_0x3a42('0x4'));var util=require(_0x3a42('0x5'));var path=require(_0x3a42('0x6'));var sox=require(_0x3a42('0x7'));var csv=require(_0x3a42('0x8'));var ejs=require(_0x3a42('0x9'));var fs=require('fs');var fs_extra=require(_0x3a42('0xa'));var _=require(_0x3a42('0xb'));var squel=require(_0x3a42('0xc'));var crypto=require(_0x3a42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3a42('0xe'));var toCsv=require(_0x3a42('0x8'));var querystring=require(_0x3a42('0xf'));var Papa=require(_0x3a42('0x10'));var Redis=require('ioredis');var authService=require(_0x3a42('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3a42('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a42('0x13'))(_0x3a42('0x14'));var utils=require(_0x3a42('0x15'));var config=require(_0x3a42('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a42('0x17'))['db'];function respondWithStatusCode(_0x201be3,_0x44ce86){_0x44ce86=_0x44ce86||0xcc;return function(_0x95b304){if(_0x95b304){return _0x201be3[_0x3a42('0x18')](_0x44ce86);}return _0x201be3[_0x3a42('0x19')](_0x44ce86)[_0x3a42('0x1a')]();};}function respondWithResult(_0x160dd6,_0x4c6734){_0x4c6734=_0x4c6734||0xc8;return function(_0x1e16c1){if(_0x1e16c1){return _0x160dd6[_0x3a42('0x19')](_0x4c6734)[_0x3a42('0x1b')](_0x1e16c1);}};}function respondWithFilteredResult(_0x1e9083,_0x5b5360){return function(_0x4c07d6){if(_0x4c07d6){var _0x3de11e=typeof _0x5b5360[_0x3a42('0x1c')]===_0x3a42('0x1d')&&typeof _0x5b5360[_0x3a42('0x1e')]==='undefined';var _0x1aa2c9=_0x4c07d6['count'];var _0x1b8b58=_0x3de11e?0x0:_0x5b5360['offset'];var _0x307ece=_0x3de11e?_0x4c07d6[_0x3a42('0x1f')]:_0x5b5360['offset']+_0x5b5360['limit'];var _0x195947;if(_0x307ece>=_0x1aa2c9){_0x307ece=_0x1aa2c9;_0x195947=0xc8;}else{_0x195947=0xce;}_0x1e9083[_0x3a42('0x19')](_0x195947);return _0x1e9083[_0x3a42('0x20')]('Content-Range',_0x1b8b58+'-'+_0x307ece+'/'+_0x1aa2c9)[_0x3a42('0x1b')](_0x4c07d6);}return null;};}function patchUpdates(_0x46f346){return function(_0x2d2503){try{jsonpatch[_0x3a42('0x21')](_0x2d2503,_0x46f346,!![]);}catch(_0x5ba57c){return BPromise['reject'](_0x5ba57c);}return _0x2d2503[_0x3a42('0x22')]();};}function saveUpdates(_0x289dac,_0x4821f9){return function(_0x529994){if(_0x529994){return _0x529994['update'](_0x289dac)[_0x3a42('0x23')](function(_0x5ca5c){return _0x5ca5c;});}return null;};}function removeEntity(_0x52c626,_0x3df28e){return function(_0x320761){if(_0x320761){return _0x320761[_0x3a42('0x24')]()[_0x3a42('0x23')](function(){var _0x317461=_0x320761[_0x3a42('0x25')]({'plain':!![]});var _0x147f3d=_0x3a42('0x26');return db[_0x3a42('0x27')][_0x3a42('0x24')]({'where':{'type':_0x147f3d,'resourceId':_0x317461['id']}})[_0x3a42('0x23')](function(){return _0x320761;});})[_0x3a42('0x23')](function(){_0x52c626[_0x3a42('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14ea60,_0x2c8255){return function(_0x2c3e6b){if(!_0x2c3e6b){_0x14ea60[_0x3a42('0x18')](0x194);}return _0x2c3e6b;};}function handleError(_0x4d785c,_0x159a04){_0x159a04=_0x159a04||0x1f4;return function(_0x49caac){logger[_0x3a42('0x28')](_0x49caac[_0x3a42('0x29')]);if(_0x49caac[_0x3a42('0x2a')]){delete _0x49caac[_0x3a42('0x2a')];}_0x4d785c[_0x3a42('0x19')](_0x159a04)[_0x3a42('0x2b')](_0x49caac);};}exports[_0x3a42('0x2c')]=function(_0x2a5fbd,_0x32016f){var _0x4c5ac5={},_0xc0023c={},_0x2add60={'count':0x0,'rows':[]};return db[_0x3a42('0x2d')][_0x3a42('0x2e')]()[_0x3a42('0x23')](function(_0x5e1777){_0xc0023c[_0x3a42('0x2f')]=_[_0x3a42('0x30')](_0x5e1777);_0xc0023c[_0x3a42('0x31')]=_[_0x3a42('0x30')](_0x2a5fbd['query']);_0xc0023c['filters']=_['intersection'](_0xc0023c[_0x3a42('0x2f')],_0xc0023c['query']);_0x4c5ac5[_0x3a42('0x32')]=_['intersection'](_0xc0023c[_0x3a42('0x2f')],qs[_0x3a42('0x33')](_0x2a5fbd[_0x3a42('0x31')]['fields']));_0x4c5ac5['attributes']=_0x4c5ac5[_0x3a42('0x32')][_0x3a42('0x34')]?_0x4c5ac5['attributes']:_0xc0023c[_0x3a42('0x2f')];if(!_0x2a5fbd['query'][_0x3a42('0x35')](_0x3a42('0x36'))){_0x4c5ac5['limit']=qs[_0x3a42('0x1e')](_0x2a5fbd[_0x3a42('0x31')]['limit']);_0x4c5ac5[_0x3a42('0x1c')]=qs[_0x3a42('0x1c')](_0x2a5fbd[_0x3a42('0x31')][_0x3a42('0x1c')]);}_0x4c5ac5['order']=qs['sort'](_0x2a5fbd[_0x3a42('0x31')]['sort']);_0x4c5ac5[_0x3a42('0x37')]=qs['filters'](_[_0x3a42('0x38')](_0x2a5fbd[_0x3a42('0x31')],_0xc0023c['filters']),_0x5e1777);if(_0x2a5fbd[_0x3a42('0x31')][_0x3a42('0x39')]){_0x4c5ac5['where']=_['merge'](_0x4c5ac5[_0x3a42('0x37')],{'$or':_[_0x3a42('0x3a')](_0x4c5ac5[_0x3a42('0x32')],function(_0x4cd4d8){var _0x4d2a66={};_0x4d2a66[_0x4cd4d8]={'$like':'%'+_0x2a5fbd[_0x3a42('0x31')][_0x3a42('0x39')]+'%'};return _0x4d2a66;})});}_0x4c5ac5=_[_0x3a42('0x3b')]({},_0x4c5ac5,_0x2a5fbd[_0x3a42('0x3c')]);var _0x5459d0={'where':_0x4c5ac5[_0x3a42('0x37')]};return db['CmCompany'][_0x3a42('0x1f')](_0x5459d0)[_0x3a42('0x23')](function(_0x22736e){_0x2add60[_0x3a42('0x1f')]=_0x22736e;if(_0x2a5fbd[_0x3a42('0x31')][_0x3a42('0x3d')]){_0x4c5ac5[_0x3a42('0x3e')]=[{'all':!![]}];}return db[_0x3a42('0x2d')]['findAll'](_0x4c5ac5);})[_0x3a42('0x23')](function(_0xe16dc7){_0x2add60[_0x3a42('0x3f')]=_0xe16dc7;return _0x2add60;})[_0x3a42('0x23')](respondWithFilteredResult(_0x32016f,_0x4c5ac5))[_0x3a42('0x40')](handleError(_0x32016f,null));})[_0x3a42('0x40')](handleError(_0x32016f,null));};exports[_0x3a42('0x41')]=function(_0x4207a0,_0x40f0d9){var _0x38dd63={'raw':![],'where':{'id':_0x4207a0['params']['id']}},_0x4a3c5b={};_0x4a3c5b[_0x3a42('0x2f')]=_[_0x3a42('0x30')](db[_0x3a42('0x2d')][_0x3a42('0x42')]);_0x4a3c5b['query']=_[_0x3a42('0x30')](_0x4207a0[_0x3a42('0x31')]);_0x4a3c5b['filters']=_[_0x3a42('0x43')](_0x4a3c5b[_0x3a42('0x2f')],_0x4a3c5b[_0x3a42('0x31')]);_0x38dd63[_0x3a42('0x32')]=_[_0x3a42('0x43')](_0x4a3c5b[_0x3a42('0x2f')],qs[_0x3a42('0x33')](_0x4207a0[_0x3a42('0x31')][_0x3a42('0x33')]));_0x38dd63[_0x3a42('0x32')]=_0x38dd63['attributes'][_0x3a42('0x34')]?_0x38dd63[_0x3a42('0x32')]:_0x4a3c5b[_0x3a42('0x2f')];if(_0x4207a0[_0x3a42('0x31')][_0x3a42('0x3d')]){_0x38dd63[_0x3a42('0x3e')]=[{'all':!![]}];}_0x38dd63=_['merge']({},_0x38dd63,_0x4207a0[_0x3a42('0x3c')]);return db[_0x3a42('0x2d')]['find'](_0x38dd63)[_0x3a42('0x23')](handleEntityNotFound(_0x40f0d9,null))[_0x3a42('0x23')](respondWithResult(_0x40f0d9,null))[_0x3a42('0x40')](handleError(_0x40f0d9,null));};exports['create']=function(_0x324db2,_0x179cf4){return db[_0x3a42('0x2d')][_0x3a42('0x44')](_0x324db2[_0x3a42('0x45')],{})[_0x3a42('0x23')](function(_0x1000f9){var _0x353c6c=_0x324db2[_0x3a42('0x46')][_0x3a42('0x25')]({'plain':!![]});if(!_0x353c6c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x353c6c['role']==='user'){var _0x53cf0d=_0x1000f9['get']({'plain':!![]});var _0x3a5687=_0x3a42('0x26');return db[_0x3a42('0x47')][_0x3a42('0x48')]({'where':{'name':_0x3a5687,'userProfileId':_0x353c6c[_0x3a42('0x49')]},'raw':!![]})[_0x3a42('0x23')](function(_0x4f8a7d){if(_0x4f8a7d&&_0x4f8a7d[_0x3a42('0x4a')]===0x0){return db[_0x3a42('0x27')][_0x3a42('0x44')]({'name':_0x53cf0d['name'],'resourceId':_0x53cf0d['id'],'type':_0x4f8a7d[_0x3a42('0x2a')],'sectionId':_0x4f8a7d['id']},{})['then'](function(){return _0x1000f9;});}else{return _0x1000f9;}})[_0x3a42('0x40')](function(_0x8f3c69){logger['error'](_0x3a42('0x4b'),_0x8f3c69);throw _0x8f3c69;});}return _0x1000f9;})[_0x3a42('0x23')](respondWithResult(_0x179cf4,0xc9))[_0x3a42('0x40')](handleError(_0x179cf4,null));};exports[_0x3a42('0x4c')]=function(_0x3030f5,_0x2e217e){if(_0x3030f5[_0x3a42('0x45')]['id']){delete _0x3030f5[_0x3a42('0x45')]['id'];}return db['CmCompany'][_0x3a42('0x48')]({'where':{'id':_0x3030f5[_0x3a42('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2e217e,null))['then'](saveUpdates(_0x3030f5['body'],null))[_0x3a42('0x23')](respondWithResult(_0x2e217e,null))[_0x3a42('0x40')](handleError(_0x2e217e,null));};exports[_0x3a42('0x24')]=function(_0x418212,_0x392e77){return db[_0x3a42('0x2d')]['find']({'where':{'id':_0x418212[_0x3a42('0x4d')]['id']}})[_0x3a42('0x23')](handleEntityNotFound(_0x392e77,null))[_0x3a42('0x23')](removeEntity(_0x392e77,null))['catch'](handleError(_0x392e77,null));};exports['describe']=function(_0x3af76b,_0x25b799){return db[_0x3a42('0x2d')][_0x3a42('0x2e')]()[_0x3a42('0x23')](respondWithResult(_0x25b799,null))['catch'](handleError(_0x25b799,null));};exports[_0x3a42('0x4e')]=function(_0x17a63f,_0x2f8b2e,_0x452483){return db[_0x3a42('0x4f')]['find']({'where':{'id':_0x17a63f['params']['id']}})[_0x3a42('0x23')](handleEntityNotFound(_0x2f8b2e,null))[_0x3a42('0x23')](function(_0x39a333){if(_0x39a333){return _0x39a333[_0x3a42('0x4e')](_0x17a63f[_0x3a42('0x45')]['ids'],_[_0x3a42('0x50')](_0x17a63f['body'],['ids','id'])||{});}})[_0x3a42('0x23')](respondWithResult(_0x2f8b2e,null))['catch'](handleError(_0x2f8b2e,null));};exports[_0x3a42('0x51')]=function(_0x5e2383,_0x499f81,_0x13e360){var _0xc91101={};var _0x440b6b={};var _0x41ee80;var _0x12645f;return db[_0x3a42('0x2d')][_0x3a42('0x52')]({'where':{'id':_0x5e2383['params']['id']}})[_0x3a42('0x23')](handleEntityNotFound(_0x499f81,null))[_0x3a42('0x23')](function(_0x166d18){if(_0x166d18){_0x41ee80=_0x166d18;_0x440b6b[_0x3a42('0x2f')]=_[_0x3a42('0x30')](db[_0x3a42('0x4f')][_0x3a42('0x42')]);_0x440b6b[_0x3a42('0x31')]=_['keys'](_0x5e2383[_0x3a42('0x31')]);_0x440b6b['filters']=_[_0x3a42('0x43')](_0x440b6b[_0x3a42('0x2f')],_0x440b6b['query']);_0xc91101['attributes']=_[_0x3a42('0x43')](_0x440b6b[_0x3a42('0x2f')],qs[_0x3a42('0x33')](_0x5e2383[_0x3a42('0x31')][_0x3a42('0x33')]));_0xc91101[_0x3a42('0x32')]=_0xc91101[_0x3a42('0x32')]['length']?_0xc91101[_0x3a42('0x32')]:_0x440b6b['model'];_0xc91101['order']=qs[_0x3a42('0x53')](_0x5e2383[_0x3a42('0x31')][_0x3a42('0x53')]);_0xc91101[_0x3a42('0x37')]=qs[_0x3a42('0x54')](_[_0x3a42('0x38')](_0x5e2383['query'],_0x440b6b[_0x3a42('0x54')]));if(_0x5e2383[_0x3a42('0x31')]['filter']){_0xc91101[_0x3a42('0x37')]=_[_0x3a42('0x3b')](_0xc91101[_0x3a42('0x37')],{'$or':_[_0x3a42('0x3a')](_0xc91101['attributes'],function(_0xb3afde){var _0x2518cf={};_0x2518cf[_0xb3afde]={'$like':'%'+_0x5e2383[_0x3a42('0x31')]['filter']+'%'};return _0x2518cf;})});}_0xc91101=_[_0x3a42('0x3b')]({},_0xc91101,_0x5e2383[_0x3a42('0x3c')]);return _0x41ee80[_0x3a42('0x51')](_0xc91101);}})[_0x3a42('0x23')](function(_0x1274d1){if(_0x1274d1){_0x12645f=_0x1274d1[_0x3a42('0x34')];if(!_0x5e2383[_0x3a42('0x31')][_0x3a42('0x35')]('nolimit')){_0xc91101[_0x3a42('0x1e')]=qs[_0x3a42('0x1e')](_0x5e2383[_0x3a42('0x31')]['limit']);_0xc91101[_0x3a42('0x1c')]=qs[_0x3a42('0x1c')](_0x5e2383[_0x3a42('0x31')][_0x3a42('0x1c')]);}return _0x41ee80[_0x3a42('0x51')](_0xc91101);}})[_0x3a42('0x23')](function(_0x2a5e41){if(_0x2a5e41){return _0x2a5e41?{'count':_0x12645f,'rows':_0x2a5e41}:null;}})[_0x3a42('0x23')](respondWithResult(_0x499f81,null))[_0x3a42('0x40')](handleError(_0x499f81,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index f028ba8..0ccf006 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 _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 +var _0x7085=['exports','define','CmCompany','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e7f48,_0x4435f7){var _0x2a57e2=function(_0x1c9c0a){while(--_0x1c9c0a){_0x2e7f48['push'](_0x2e7f48['shift']());}};_0x2a57e2(++_0x4435f7);}(_0x7085,0x71));var _0x5708=function(_0x736a72,_0x574f49){_0x736a72=_0x736a72-0x0;var _0x3741ad=_0x7085[_0x736a72];return _0x3741ad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5708('0x0'))('api');var moment=require(_0x5708('0x1'));var BPromise=require(_0x5708('0x2'));var rp=require(_0x5708('0x3'));var fs=require('fs');var path=require(_0x5708('0x4'));var rimraf=require(_0x5708('0x5'));var config=require(_0x5708('0x6'));var attributes=require('./cmCompany.attributes');module[_0x5708('0x7')]=function(_0x508831,_0x52175b){return _0x508831[_0x5708('0x8')](_0x5708('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index cbed507..1fd7108 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 _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 +var _0x2be3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20e641,_0x3e23fb){var _0x2b9ab9=function(_0x5ebdd9){while(--_0x5ebdd9){_0x20e641['push'](_0x20e641['shift']());}};_0x2b9ab9(++_0x3e23fb);}(_0x2be3,0x1dd));var _0x32be=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2be3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x32be('0x0'));var util=require(_0x32be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x32be('0x2'));var fs=require('fs');var Redis=require(_0x32be('0x3'));var db=require(_0x32be('0x4'))['db'];var utils=require(_0x32be('0x5'));var logger=require(_0x32be('0x6'))(_0x32be('0x7'));var config=require(_0x32be('0x8'));var jayson=require(_0x32be('0x9'));var client=jayson[_0x32be('0xa')][_0x32be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x321cb1,_0x2306fc,_0x46f1e0){return new BPromise(function(_0x59bd69,_0x4dfd8e){return client[_0x32be('0xc')](_0x321cb1,_0x46f1e0)[_0x32be('0xd')](function(_0x2ace65){logger[_0x32be('0xe')](_0x32be('0xf'),_0x2306fc,_0x32be('0x10'));logger[_0x32be('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x2306fc,_0x32be('0x10'),JSON[_0x32be('0x12')](_0x2ace65));if(_0x2ace65['error']){if(_0x2ace65[_0x32be('0x13')]['code']===0x1f4){logger[_0x32be('0x13')](_0x32be('0xf'),_0x2306fc,_0x2ace65[_0x32be('0x13')][_0x32be('0x14')]);return _0x4dfd8e(_0x2ace65[_0x32be('0x13')][_0x32be('0x14')]);}logger[_0x32be('0x13')](_0x32be('0xf'),_0x2306fc,_0x2ace65[_0x32be('0x13')][_0x32be('0x14')]);return _0x59bd69(_0x2ace65[_0x32be('0x13')][_0x32be('0x14')]);}else{logger[_0x32be('0xe')](_0x32be('0xf'),_0x2306fc,'request\x20sent');_0x59bd69(_0x2ace65[_0x32be('0x15')][_0x32be('0x14')]);}})[_0x32be('0x16')](function(_0x3885fa){logger[_0x32be('0x13')](_0x32be('0xf'),_0x2306fc,_0x3885fa);_0x4dfd8e(_0x3885fa);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5cc5451..0fac2d8 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 _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 +var _0xcbb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','describe','/:id','/:id/contacts','getContacts','create','post','addContacts','put','update','delete','destroy','multer','path'];(function(_0x1116cd,_0x41a0b7){var _0x52974a=function(_0x3c4e70){while(--_0x3c4e70){_0x1116cd['push'](_0x1116cd['shift']());}};_0x52974a(++_0x41a0b7);}(_0xcbb8,0x139));var _0x8cbb=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xcbb8[_0x24259d];return _0x5a701;};'use strict';var multer=require(_0x8cbb('0x0'));var util=require('util');var path=require(_0x8cbb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8cbb('0x2'));var auth=require(_0x8cbb('0x3'));var interaction=require(_0x8cbb('0x4'));var config=require(_0x8cbb('0x5'));var controller=require(_0x8cbb('0x6'));router['get']('/',auth[_0x8cbb('0x7')](),controller[_0x8cbb('0x8')]);router[_0x8cbb('0x9')]('/describe',auth[_0x8cbb('0x7')](),controller[_0x8cbb('0xa')]);router[_0x8cbb('0x9')](_0x8cbb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8cbb('0x9')](_0x8cbb('0xc'),auth[_0x8cbb('0x7')](),controller[_0x8cbb('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8cbb('0xe')]);router[_0x8cbb('0xf')](_0x8cbb('0xc'),auth[_0x8cbb('0x7')](),controller[_0x8cbb('0x10')]);router[_0x8cbb('0x11')](_0x8cbb('0xb'),auth[_0x8cbb('0x7')](),controller[_0x8cbb('0x12')]);router[_0x8cbb('0x13')](_0x8cbb('0xb'),auth['isAuthenticated'](),controller[_0x8cbb('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c87209f..dad1846 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 _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 +var _0x03da=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x1b7ea6,_0x195a62){var _0x4fcea6=function(_0x29ace1){while(--_0x29ace1){_0x1b7ea6['push'](_0x1b7ea6['shift']());}};_0x4fcea6(++_0x195a62);}(_0x03da,0x15e));var _0xa03d=function(_0x53c1a1,_0x1f401c){_0x53c1a1=_0x53c1a1-0x0;var _0x4f2ddf=_0x03da[_0x53c1a1];return _0x4f2ddf;};'use strict';var _=require(_0xa03d('0x0'));var Sequelize=require(_0xa03d('0x1'));module[_0xa03d('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa03d('0x3')]},'postalCode':{'type':Sequelize[_0xa03d('0x3')]},'city':{'type':Sequelize[_0xa03d('0x3')]},'country':{'type':Sequelize[_0xa03d('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa03d('0x3')]},'description':{'type':Sequelize[_0xa03d('0x4')]},'phone':{'type':Sequelize[_0xa03d('0x3')]},'mobile':{'type':Sequelize[_0xa03d('0x3')]},'fax':{'type':Sequelize[_0xa03d('0x3')]},'email':{'type':Sequelize[_0xa03d('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xa03d('0x3')]},'skype':{'type':Sequelize[_0xa03d('0x3')]},'teams':{'type':Sequelize[_0xa03d('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xa03d('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xa03d('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa03d('0x5')](0x2)[_0xa03d('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa03d('0x7')],'defaultValue':Sequelize[_0xa03d('0x8')]},'dialTimezone':{'type':Sequelize[_0xa03d('0x3')]},'utcOffset':{'type':Sequelize[_0xa03d('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 09b4978..f6d84b4 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 _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 +var _0xc750=['omit','map','isEmpty','table','cm_contacts','setFields','toParam','text','phone','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','getTags','setTags','ids','setAdditionalPhones','all','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','CmHopperId','ItemType.OrderBy','bulkCreate','getAdditionalPhones','`ItemType`.OrderBy','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','options','includeAll','include','rows','getHopperHistories','getHopperFinals','nolimit','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','parse','import','agent','No\x20ListId\x20specified','binding','firstName','stringify','start\x20child\x20process\x20correctly!','pid','error\x20child\x20process','importUpdates','User','message','exit','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userThirdDisposition','UserId','fullname','DESC','Account','closed','closedAt','disposition','thirdDisposition','key','Owner','customerIp','customerPort','osName','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','startCase','Interaction','flatten','sortBy','slice','moment','bluebird','util','path','lodash','squel','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','update','then','destroy','end','sendStatus','stack','name','send','index','describe','getOptions','findAll','query','user','catch','params','keys','startsWith','cf_','columnName','CmCustomField','length','displayName','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','CmContact','from','get','mergeWith','isArray','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','join','isNil','dialTimezone','utcOffset','additionalPhones','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','find','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','format','cf_%d','timezones'];(function(_0x27973f,_0x3dc301){var _0x406fbe=function(_0x53a81f){while(--_0x53a81f){_0x27973f['push'](_0x27973f['shift']());}};_0x406fbe(++_0x3dc301);}(_0xc750,0x187));var _0x0c75=function(_0x4a6312,_0x5f2f95){_0x4a6312=_0x4a6312-0x0;var _0x5d8929=_0xc750[_0x4a6312];return _0x5d8929;};'use strict';var moment=require(_0x0c75('0x0'));var BPromise=require(_0x0c75('0x1'));var util=require(_0x0c75('0x2'));var path=require(_0x0c75('0x3'));var fs=require('fs');var _=require(_0x0c75('0x4'));var squel=require(_0x0c75('0x5'));var Papa=require('papaparse');var Redis=require(_0x0c75('0x6'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0x0c75('0x7'))('api');var config=require(_0x0c75('0x8'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0x0c75('0x9')]=_[_0x0c75('0xa')](config[_0x0c75('0x9')],{'host':_0x0c75('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c75('0x9')]));require(_0x0c75('0xc'))[_0x0c75('0xd')](socket);function respondWithResult(_0xe04b01,_0x19ab26){_0x19ab26=_0x19ab26||0xc8;return function(_0x5397f3){if(_0x5397f3){return _0xe04b01[_0x0c75('0xe')](_0x19ab26)[_0x0c75('0xf')](_0x5397f3);}};}function respondWithFilteredResult(_0x5d42be,_0xe16dbf){return function(_0x52718c){if(_0x52718c){var _0x9626dc=typeof _0xe16dbf[_0x0c75('0x10')]===_0x0c75('0x11')&&typeof _0xe16dbf[_0x0c75('0x12')]==='undefined';var _0x460896=_0x52718c[_0x0c75('0x13')];var _0x22a893=_0x9626dc?0x0:_0xe16dbf[_0x0c75('0x10')];var _0x1c1011=_0x9626dc?_0x52718c['count']:_0xe16dbf[_0x0c75('0x10')]+_0xe16dbf[_0x0c75('0x12')];var _0x2024ff;if(_0x1c1011>=_0x460896){_0x1c1011=_0x460896;_0x2024ff=0xc8;}else{_0x2024ff=0xce;}_0x5d42be[_0x0c75('0xe')](_0x2024ff);return _0x5d42be[_0x0c75('0x14')]('Content-Range',_0x22a893+'-'+_0x1c1011+'/'+_0x460896)[_0x0c75('0xf')](_0x52718c);}return null;};}function saveUpdates(_0x478968){return function(_0x510d5f){if(_0x510d5f){return _0x510d5f[_0x0c75('0x15')](_0x478968)[_0x0c75('0x16')](function(_0x544834){return _0x544834;});}return null;};}function removeEntity(_0x5e893f){return function(_0x26829b){if(_0x26829b){return _0x26829b[_0x0c75('0x17')]()['then'](function(){_0x5e893f[_0x0c75('0xe')](0xcc)[_0x0c75('0x18')]();});}};}function handleEntityNotFound(_0x36aa99){return function(_0x5316ae){if(!_0x5316ae){_0x36aa99[_0x0c75('0x19')](0x194);}return _0x5316ae;};}function handleError(_0xaba5dd,_0xd6dc03){_0xd6dc03=_0xd6dc03||0x1f4;return function(_0x47f009){logger['error'](_0x47f009[_0x0c75('0x1a')]);if(_0x47f009['name']){delete _0x47f009[_0x0c75('0x1b')];}_0xaba5dd[_0x0c75('0xe')](_0xd6dc03)[_0x0c75('0x1c')](_0x47f009);};}exports[_0x0c75('0x1d')]=function(_0x2a8907,_0x46bfad){var _0x151523={};return contacts[_0x0c75('0x1e')]()[_0x0c75('0x16')](function(_0x2a4938){_0x151523=qs[_0x0c75('0x1f')](_0x2a4938,_0x2a8907);return contacts[_0x0c75('0x20')](_0x2a8907[_0x0c75('0x21')],_0x2a8907[_0x0c75('0x22')],_0x151523,_0x2a4938);})['then'](respondWithFilteredResult(_0x46bfad,_0x151523))[_0x0c75('0x23')](handleError(_0x46bfad,null));};exports[_0x0c75('0x17')]=function(_0x2b2fb1,_0x2b8660){return db['CmContact']['find']({'where':{'id':_0x2b2fb1[_0x0c75('0x24')]['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0x2b8660,null))['then'](removeEntity(_0x2b8660,null))['catch'](handleError(_0x2b8660,null));};exports[_0x0c75('0x1e')]=function(_0x4097ed,_0x47deb5){return db['CmContact'][_0x0c75('0x1e')]()[_0x0c75('0x16')](function(_0x1d31d4){delete _0x1d31d4['tags'];for(var _0x362753=0x0;_0x3627530x0){return new Promise(function(_0x55008a){var _0x41be38=[];for(var _0x4c2326=0x0;_0x4c2326<_0x3d7e41['length'];_0x4c2326++){_0x41be38[_0x0c75('0x5f')](insertAdditionalPhones(_0x3d7e41[_0x4c2326][_0x0c75('0x63')],_0x3d7e41[_0x4c2326][_0x0c75('0x5a')]));}Promise['all'](_0x41be38)['then'](function(){_0x55008a(0x1);});})[_0x0c75('0x16')](function(){return{'success':_0x22dcfd,'failure':_0xf7cf97,'duplicates':_0x47b5d2};});}else{return{'success':_0x22dcfd,'failure':_0xf7cf97,'duplicates':_0x47b5d2};}}})['then'](respondWithResult(_0xe006c3,0xc9))[_0x0c75('0x23')](handleError(_0xe006c3,null));};exports['show']=function(_0xc64b58,_0x3ceb33){var _0x374d9a;return db[_0x0c75('0x36')][_0x0c75('0x1e')]()[_0x0c75('0x16')](function(_0x4a8ffd){return db[_0x0c75('0x36')][_0x0c75('0x64')]({'where':{'id':_0xc64b58[_0x0c75('0x24')]['id']},'include':[{'model':db[_0x0c75('0x65')],'as':_0x0c75('0x66'),'attributes':['id',_0x0c75('0x1b'),_0x0c75('0x67')],'required':_0xc64b58[_0x0c75('0x21')][_0x0c75('0x68')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0c75('0x69'),'where':{'CmContactId':_0xc64b58['params']['id']},'required':![],'include':[{'model':db[_0x0c75('0x6a')],'as':_0x0c75('0x6b')}]}],'order':[db[_0x0c75('0x6c')][_0x0c75('0x6d')](_0x0c75('0x6e'))],'attributes':_[_0x0c75('0x25')](_0x4a8ffd)});})[_0x0c75('0x16')](function(_0x4131cb){if(!_[_0x0c75('0x57')](_0x4131cb)){_0x374d9a=_0x4131cb[_0x0c75('0x38')]({'plain':!![]});var _0x237f0d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4131cb&&_0x4131cb[_0x0c75('0x60')]){if(_0x4131cb[_0x0c75('0x60')]){_0x237f0d[_0x0c75('0x5d')][_0x0c75('0x6f')][_0x0c75('0x5f')]({'ListId':{'$ne':_0x4131cb[_0x0c75('0x60')]}});}}return db[_0x0c75('0x29')]['findAll'](_0x237f0d);}})[_0x0c75('0x16')](function(_0x788afc){if(!_[_0x0c75('0x57')](_0x788afc)){return _['omit'](_0x374d9a,_['map'](_0x788afc,function(_0x427cf1){return util[_0x0c75('0x70')](_0x0c75('0x71'),_0x427cf1['id']);}));}})[_0x0c75('0x16')](handleEntityNotFound(_0x3ceb33,null))[_0x0c75('0x16')](respondWithResult(_0x3ceb33,null))[_0x0c75('0x23')](handleError(_0x3ceb33,null));};exports['update']=function(_0x588ca8,_0xd11e53){var _0x59679b;if(_0x588ca8[_0x0c75('0x35')]['id']){delete _0x588ca8[_0x0c75('0x35')]['id'];}if(!_[_0x0c75('0x57')](_0x588ca8[_0x0c75('0x35')]['dialTimezone'])){var _0x1e71f8=_0x588ca8['body'][_0x0c75('0x58')];if(!_['isNil'](shared[_0x0c75('0x72')][_0x1e71f8]))_0x588ca8['body'][_0x0c75('0x59')]=shared[_0x0c75('0x72')][_0x1e71f8][_0x0c75('0x59')];}return db[_0x0c75('0x36')][_0x0c75('0x64')]({'where':{'id':_0x588ca8['params']['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0xd11e53,null))[_0x0c75('0x16')](saveUpdates(_0x588ca8['body'],null))[_0x0c75('0x16')](function(_0x7059da){_0x59679b=_0x7059da;var _0x2b5f4a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x7059da&&_0x7059da[_0x0c75('0x60')]){if(_0x7059da[_0x0c75('0x60')]){_0x2b5f4a[_0x0c75('0x5d')][_0x0c75('0x6f')][_0x0c75('0x5f')]({'ListId':{'$ne':_0x7059da[_0x0c75('0x60')]}});}}return db[_0x0c75('0x29')][_0x0c75('0x20')](_0x2b5f4a);})[_0x0c75('0x16')](function(_0x111897){if(_0x111897){return _[_0x0c75('0x73')](_['pickBy'](_0x588ca8[_0x0c75('0x35')],function(_0x1d1e62,_0x1e8b12){return _[_0x0c75('0x26')](_0x1e8b12,'cf_');}),_[_0x0c75('0x74')](_0x111897,function(_0x851060){return util[_0x0c75('0x70')](_0x0c75('0x71'),_0x851060['id']);}));}})[_0x0c75('0x16')](function(_0x495e5d){if(_0x495e5d&&!_[_0x0c75('0x75')](_0x495e5d)){var _0x5c7465=squel[_0x0c75('0x15')]()[_0x0c75('0x76')](_0x0c75('0x77'))[_0x0c75('0x78')](_0x495e5d)[_0x0c75('0x5d')]('id\x20=\x20?',_0x588ca8[_0x0c75('0x24')]['id'])[_0x0c75('0x79')]();return db[_0x0c75('0x6c')]['query'](_0x5c7465[_0x0c75('0x7a')],{'replacements':_0x5c7465['values']});}})[_0x0c75('0x16')](function(){if(_0x588ca8[_0x0c75('0x35')][_0x0c75('0x7b')]&&_0x59679b){return db[_0x0c75('0x3d')][_0x0c75('0x15')]({'phone':_0x588ca8[_0x0c75('0x35')][_0x0c75('0x7b')],'OrderBy':0x0},{'where':{'ContactId':_0x59679b['id']}});}})[_0x0c75('0x16')](function(){return _0x59679b;})[_0x0c75('0x16')](respondWithResult(_0xd11e53,null))[_0x0c75('0x23')](handleError(_0xd11e53,null));};exports['getTags']=function(_0x4ad950,_0x56d989){var _0x49025e={};var _0x18f38d={};var _0x5d0df8;var _0x534eb3;return db[_0x0c75('0x36')][_0x0c75('0x7c')]({'where':{'id':_0x4ad950[_0x0c75('0x24')]['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0x56d989,null))['then'](function(_0x4a00c7){if(_0x4a00c7){_0x5d0df8=_0x4a00c7;_0x18f38d[_0x0c75('0x7d')]=_['keys'](db[_0x0c75('0x65')][_0x0c75('0x7e')]);_0x18f38d[_0x0c75('0x21')]=_[_0x0c75('0x25')](_0x4ad950['query']);_0x18f38d[_0x0c75('0x7f')]=_[_0x0c75('0x80')](_0x18f38d[_0x0c75('0x7d')],_0x18f38d[_0x0c75('0x21')]);_0x49025e[_0x0c75('0x81')]=_['intersection'](_0x18f38d['model'],qs[_0x0c75('0x82')](_0x4ad950[_0x0c75('0x21')][_0x0c75('0x82')]));_0x49025e[_0x0c75('0x81')]=_0x49025e[_0x0c75('0x81')]['length']?_0x49025e[_0x0c75('0x81')]:_0x18f38d[_0x0c75('0x7d')];_0x49025e[_0x0c75('0x83')]=qs[_0x0c75('0x84')](_0x4ad950[_0x0c75('0x21')][_0x0c75('0x84')]);_0x49025e[_0x0c75('0x5d')]=qs[_0x0c75('0x7f')](_[_0x0c75('0x85')](_0x4ad950[_0x0c75('0x21')],_0x18f38d['filters']));if(_0x4ad950[_0x0c75('0x21')][_0x0c75('0x86')]){_0x49025e[_0x0c75('0x5d')]=_[_0x0c75('0x34')](_0x49025e['where'],{'$or':_['map'](_0x49025e[_0x0c75('0x81')],function(_0x582f77){var _0xec2072={};_0xec2072[_0x582f77]={'$like':'%'+_0x4ad950[_0x0c75('0x21')][_0x0c75('0x86')]+'%'};return _0xec2072;})});}_0x49025e=_['merge']({},_0x49025e,_0x4ad950['options']);return _0x5d0df8['getTags'](_0x49025e);}})[_0x0c75('0x16')](function(_0x5ce419){if(_0x5ce419){_0x534eb3=_0x5ce419['length'];if(!_0x4ad950[_0x0c75('0x21')][_0x0c75('0x33')]('nolimit')){_0x49025e['limit']=qs['limit'](_0x4ad950[_0x0c75('0x21')][_0x0c75('0x12')]);_0x49025e[_0x0c75('0x10')]=qs['offset'](_0x4ad950[_0x0c75('0x21')][_0x0c75('0x10')]);}return _0x5d0df8[_0x0c75('0x87')](_0x49025e);}})['then'](function(_0x28633d){if(_0x28633d){return _0x28633d?{'count':_0x534eb3,'rows':_0x28633d}:null;}})['then'](respondWithResult(_0x56d989,null))['catch'](handleError(_0x56d989,null));};exports[_0x0c75('0x88')]=function(_0x4b5304,_0x2ed87b){if(_0x4b5304[_0x0c75('0x35')]['id']){delete _0x4b5304[_0x0c75('0x35')]['id'];}return db[_0x0c75('0x36')]['findOne']({'where':{'id':_0x4b5304[_0x0c75('0x24')]['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0x2ed87b,null))[_0x0c75('0x16')](function(_0x5f06a9){if(_0x5f06a9){return _0x5f06a9['setTags'](_0x4b5304[_0x0c75('0x35')][_0x0c75('0x89')]||[]);}return null;})[_0x0c75('0x16')](respondWithResult(_0x2ed87b,null))[_0x0c75('0x23')](handleError(_0x2ed87b,null));};exports[_0x0c75('0x8a')]=function(_0x2641e2,_0x4f3101){var _0x3167a1=[];_0x3167a1['push'](addAdditionalPhones(_0x2641e2['body']));Promise[_0x0c75('0x8b')](_0x3167a1)[_0x0c75('0x16')](function(){_0x3167a1=[];_0x3167a1[_0x0c75('0x5f')](deleteCmHopperPhones(_0x2641e2[_0x0c75('0x35')]['id']));_0x3167a1[_0x0c75('0x5f')](addCmHopperPhones(_0x2641e2[_0x0c75('0x35')]['id']));Promise[_0x0c75('0x8b')](_0x3167a1)[_0x0c75('0x16')](function(){return[0x1];})[_0x0c75('0x16')](respondWithResult(_0x4f3101,null));});};function addAdditionalPhones(_0x4e04f7){var _0x3f221b;return new Promise(function(_0x36508b){return db[_0x0c75('0x48')][_0x0c75('0x17')]({'where':{'CmContactId':_0x4e04f7['id']}})['then'](function(){db[_0x0c75('0x6a')][_0x0c75('0x20')]({'raw':!![],'attributes':['id',_0x0c75('0x8c')]})[_0x0c75('0x16')](function(_0x5e9d06){var _0x39bdc5=[];for(var _0xb2f606=0x0;_0xb2f606<_0x4e04f7[_0x0c75('0x8d')][_0x0c75('0x2a')];_0xb2f606++){var _0x6947e7=_0x4e04f7[_0x0c75('0x8e')]?_[_0x0c75('0x57')](_0x4e04f7[_0x0c75('0x8e')][_0xb2f606])?'':_0x4e04f7['item_types'][_0xb2f606]:_0x4e04f7['items'][_0xb2f606]['ItemTypeId']?_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x8f')]:'';var _0x2b32e3=_[_0x0c75('0x57')](_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x90')])?'':_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x90')];var _0x463cc9=_0x6947e7+':'+_0x4e04f7['items'][_0xb2f606][_0x0c75('0x7b')]+'§'+_0x2b32e3;if(_['isNil'](_0x3f221b))_0x3f221b=_0x463cc9;else _0x3f221b+=';'+_0x463cc9;var _0x527861=null;var _0x422756=null;if(_0x4e04f7[_0x0c75('0x8e')]){if(!_['isNil'](_0x4e04f7[_0x0c75('0x8e')][_0xb2f606])){_0x422756=_[_0x0c75('0x64')](_0x5e9d06,function(_0x28d312){return _0x28d312['id']===_0x4e04f7['item_types'][_0xb2f606];});if(!_[_0x0c75('0x57')](_0x422756)){_0x527861=_0x422756['OrderBy'];}}}else{if(!_['isNil'](_0x4e04f7[_0x0c75('0x8d')][_0xb2f606])){_0x422756=_[_0x0c75('0x64')](_0x5e9d06,function(_0x21a0a7){return _0x21a0a7['id']===_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x8f')];});if(!_[_0x0c75('0x57')](_0x422756)){_0x527861=_0xb2f606;}}}if(_[_0x0c75('0x57')](_0x527861)){_0x527861=0x64;}_0x39bdc5['push'](addAdditionalPhone(_0x4e04f7['id'],_0x4e04f7[_0x0c75('0x8d')][_0xb2f606]['phone'],_0x4e04f7[_0x0c75('0x8e')]?_[_0x0c75('0x57')](_0x4e04f7[_0x0c75('0x8e')][_0xb2f606])?null:_0x4e04f7['item_types'][_0xb2f606]:_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x8f')]?_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x8f')]:null,_0x527861,_0x2b32e3));}Promise[_0x0c75('0x8b')](_0x39bdc5)[_0x0c75('0x16')](function(){db[_0x0c75('0x36')]['update']({'AdditionalPhones':_0x3f221b},{'where':{'id':_0x4e04f7['id']}})[_0x0c75('0x16')](function(){_0x36508b(0x1);});});});});});}function addAdditionalPhone(_0x2f9327,_0x3a2d32,_0x1b5f8a,_0xc8e20,_0x12a329){return db[_0x0c75('0x48')][_0x0c75('0x64')]({'where':{'CmContactId':_0x2f9327,'item':_0x3a2d32}})['then'](function(_0x351769){if(_0x351769)logger[_0x0c75('0x30')](_0x0c75('0x91'),_0x351769);else{db[_0x0c75('0x48')]['create']({'CmContactId':_0x2f9327,'item':_0x3a2d32,'ItemTypeId':_0x1b5f8a,'OrderBy':_0xc8e20,'ItemClass':_0x0c75('0x92'),'description':_0x12a329});}});}function deleteCmHopperPhones(_0x5ef7e6){return new Promise(function(_0x598cdc){return db[_0x0c75('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5ef7e6}})[_0x0c75('0x16')](function(_0x6377b9){db[_0x0c75('0x93')][_0x0c75('0x17')]({'where':{'CmHopperId':{'$in':_[_0x0c75('0x74')](_0x6377b9,'id')}}});})[_0x0c75('0x16')](function(){_0x598cdc(0x1);});});}function addCmHopperPhones(_0x24af4c){return new Promise(function(_0x20b1d6){return db[_0x0c75('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x24af4c}})[_0x0c75('0x16')](function(_0x377053){var _0x6c2e4c=[];_[_0x0c75('0x74')](_0x377053,function(_0x5f4798){_0x6c2e4c[_0x0c75('0x5f')](createCmHopperPhone(_0x24af4c,_0x5f4798['id']));});Promise[_0x0c75('0x8b')](_0x6c2e4c)[_0x0c75('0x16')](function(){_0x20b1d6(0x1);});});});}function createCmHopperPhone(_0x3551a8,_0x39f410){return new Promise(function(_0x34a71d){db[_0x0c75('0x48')][_0x0c75('0x20')]({'raw':!![],'attributes':[_0x0c75('0x94'),_0x0c75('0x8c')],'where':{'CmContactId':_0x3551a8,'ItemClass':'PHONE'},'include':[{'model':db[_0x0c75('0x6a')],'attributes':[_0x0c75('0x8c')],'as':_0x0c75('0x6b')}],'order':['OrderBy',db['sequelize'][_0x0c75('0x6d')]('`ItemType`.OrderBy')]})[_0x0c75('0x16')](function(_0x287088){var _0x1e7fc5=0x1;var _0x3496d0=_[_0x0c75('0x74')](_0x287088,function(_0x1f96fc){_0x1f96fc[_0x0c75('0x95')]=_0x39f410;_0x1f96fc[_0x0c75('0x7b')]=_0x1f96fc[_0x0c75('0x94')];_0x1f96fc[_0x0c75('0x8c')]=_0x1e7fc5;delete _0x1f96fc[_0x0c75('0x96')];_0x1e7fc5=_0x1e7fc5+0x1;return _0x1f96fc;});return db[_0x0c75('0x93')][_0x0c75('0x97')](_0x3496d0,{});})[_0x0c75('0x16')](function(){_0x34a71d(0x1);});});}function insertAdditionalPhones(_0x382d57,_0x4fe3ca){return new Promise(function(_0x21bce2){var _0x331a16=[];for(var _0x4b5acb=0x0;_0x4b5acb<_0x4fe3ca[_0x0c75('0x2a')];_0x4b5acb++){var _0x22bada=_0x4fe3ca[_0x4b5acb];_0x331a16[_0x0c75('0x5f')](parseContactItemType(_0x22bada));}Promise[_0x0c75('0x8b')](_0x331a16)[_0x0c75('0x16')](function(){var _0x57e7f3={'id':_0x382d57['id'],'items':_0x4fe3ca};return addAdditionalPhones(_0x57e7f3)[_0x0c75('0x16')](function(){return addCmHopperPhones(_0x382d57['id']);});})[_0x0c75('0x16')](function(){_0x21bce2(_0x382d57);});});}function parseContactItemType(_0x19a23a){return new Promise(function(_0x843332){if(_0x19a23a[_0x0c75('0x33')](_0x0c75('0x8f'))){_0x843332(_0x19a23a);}else{return db[_0x0c75('0x6a')][_0x0c75('0x64')]({'where':{'name':_0x19a23a['ItemType']}})[_0x0c75('0x16')](function(_0xe0a4d2){if(_['isNil'](_0xe0a4d2))_0x19a23a['ItemTypeId']=null;else _0x19a23a['ItemTypeId']=_0xe0a4d2['id'];_0x843332(_0x19a23a);});}});}exports[_0x0c75('0x98')]=function(_0x597467,_0x1719c9){return db['CmContactHasItem'][_0x0c75('0x20')]({'raw':!![],'where':{'CmContactId':_0x597467[_0x0c75('0x24')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x0c75('0x6a')],'as':_0x0c75('0x6b')}],'order':[['OrderBy'],[db['sequelize']['literal'](_0x0c75('0x99'))]]})[_0x0c75('0x16')](function(_0x109e99){return _0x109e99;})[_0x0c75('0x16')](respondWithResult(_0x1719c9,null))[_0x0c75('0x23')](handleError(_0x1719c9,null));};exports['duplicateAdditionalPhones']=function(_0x2a52a6,_0x2a05fc){return db[_0x0c75('0x48')][_0x0c75('0x20')]({'raw':!![],'where':{'CmContactId':_0x2a52a6[_0x0c75('0x35')]['fromContactId']}})[_0x0c75('0x16')](function(_0x2d79b4){var _0x16353e=_[_0x0c75('0x74')](_0x2d79b4,function(_0x34231d){_0x34231d[_0x0c75('0x9a')]=_0x2a52a6['body'][_0x0c75('0x9b')];return _0x34231d;});return db['CmContactHasItem'][_0x0c75('0x97')](_0x16353e,{});})[_0x0c75('0x16')](function(){return addCmHopperPhones(_0x2a52a6[_0x0c75('0x35')][_0x0c75('0x9b')]);})[_0x0c75('0x16')](function(){return['ok'];})[_0x0c75('0x16')](respondWithResult(_0x2a05fc,null))[_0x0c75('0x23')](handleError(_0x2a05fc,null));};exports[_0x0c75('0x9c')]=function(_0x2c0409,_0xf63a14){var _0x2cf2df=[];_0x2cf2df[_0x0c75('0x5f')](createCmHopperPhone(_0x2c0409[_0x0c75('0x35')]['id'],_0x2c0409['body']['hopperId']));Promise[_0x0c75('0x8b')](_0x2cf2df)['then'](function(){return[0x1];})[_0x0c75('0x16')](respondWithResult(_0xf63a14,null));};exports[_0x0c75('0x9d')]=function(_0x28084a,_0x57baa7){var _0x4d8319={'raw':![],'where':{}};var _0x186708={};var _0x245696={'count':0x0,'rows':[]};return db[_0x0c75('0x36')][_0x0c75('0x7c')]({'where':{'id':_0x28084a[_0x0c75('0x24')]['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0x57baa7,null))[_0x0c75('0x16')](function(_0x25066c){if(_0x25066c){_0x186708[_0x0c75('0x7d')]=_[_0x0c75('0x25')](db[_0x0c75('0x3d')]['rawAttributes']);_0x186708[_0x0c75('0x21')]=_[_0x0c75('0x25')](_0x28084a[_0x0c75('0x21')]);_0x186708[_0x0c75('0x7f')]=_['intersection'](_0x186708[_0x0c75('0x7d')],_0x186708[_0x0c75('0x21')]);_0x4d8319[_0x0c75('0x81')]=_['intersection'](_0x186708['model'],qs[_0x0c75('0x82')](_0x28084a[_0x0c75('0x21')][_0x0c75('0x82')]));_0x4d8319[_0x0c75('0x81')]=_0x4d8319['attributes'][_0x0c75('0x2a')]?_0x4d8319[_0x0c75('0x81')]:_0x186708[_0x0c75('0x7d')];if(!_0x28084a[_0x0c75('0x21')][_0x0c75('0x33')]('nolimit')){_0x4d8319[_0x0c75('0x12')]=qs[_0x0c75('0x12')](_0x28084a[_0x0c75('0x21')][_0x0c75('0x12')]);_0x4d8319['offset']=qs[_0x0c75('0x10')](_0x28084a[_0x0c75('0x21')][_0x0c75('0x10')]);}_0x4d8319['order']=qs[_0x0c75('0x84')](_0x28084a['query'][_0x0c75('0x84')]);_0x4d8319[_0x0c75('0x5d')]=qs[_0x0c75('0x7f')](_[_0x0c75('0x85')](_0x28084a[_0x0c75('0x21')],_0x186708['filters']));_0x4d8319[_0x0c75('0x5d')][_0x0c75('0x9e')]=_0x25066c['id'];if(_0x28084a[_0x0c75('0x21')][_0x0c75('0x86')]){_0x4d8319[_0x0c75('0x5d')]=_[_0x0c75('0x34')](_0x4d8319['where'],{'$or':_[_0x0c75('0x74')](_0x4d8319[_0x0c75('0x81')],function(_0x4a10b7){var _0x4e044f={};_0x4e044f[_0x4a10b7]={'$like':'%'+_0x28084a[_0x0c75('0x21')][_0x0c75('0x86')]+'%'};return _0x4e044f;})});}_0x4d8319=_[_0x0c75('0x34')]({},_0x4d8319,_0x28084a[_0x0c75('0x9f')]);return db[_0x0c75('0x3d')]['count']({'where':_0x4d8319[_0x0c75('0x5d')]})[_0x0c75('0x16')](function(_0x5159f1){_0x245696['count']=_0x5159f1;if(_0x28084a['query'][_0x0c75('0xa0')]){_0x4d8319[_0x0c75('0xa1')]=[{'all':!![]}];}return db['CmHopper'][_0x0c75('0x20')](_0x4d8319);})[_0x0c75('0x16')](function(_0x467e58){_0x245696[_0x0c75('0xa2')]=_0x467e58;return _0x245696;});}})['then'](respondWithFilteredResult(_0x57baa7,_0x4d8319))[_0x0c75('0x23')](handleError(_0x57baa7,null));};exports[_0x0c75('0xa3')]=function(_0x119b36,_0x203d13){var _0x1dde6b={'raw':!![],'where':{}};var _0x54bff5={};var _0x11f63c={'count':0x0,'rows':[]};return db[_0x0c75('0x36')][_0x0c75('0x7c')]({'where':{'id':_0x119b36['params']['id']}})['then'](handleEntityNotFound(_0x203d13,null))[_0x0c75('0x16')](function(_0x331375){if(_0x331375){_0x54bff5[_0x0c75('0x7d')]=_[_0x0c75('0x25')](db[_0x0c75('0x4a')][_0x0c75('0x7e')]);_0x54bff5[_0x0c75('0x21')]=_[_0x0c75('0x25')](_0x119b36['query']);_0x54bff5[_0x0c75('0x7f')]=_[_0x0c75('0x80')](_0x54bff5['model'],_0x54bff5[_0x0c75('0x21')]);_0x1dde6b['attributes']=_[_0x0c75('0x80')](_0x54bff5[_0x0c75('0x7d')],qs[_0x0c75('0x82')](_0x119b36[_0x0c75('0x21')]['fields']));_0x1dde6b[_0x0c75('0x81')]=_0x1dde6b[_0x0c75('0x81')]['length']?_0x1dde6b[_0x0c75('0x81')]:_0x54bff5['model'];if(!_0x119b36[_0x0c75('0x21')][_0x0c75('0x33')]('nolimit')){_0x1dde6b['limit']=qs[_0x0c75('0x12')](_0x119b36[_0x0c75('0x21')][_0x0c75('0x12')]);_0x1dde6b[_0x0c75('0x10')]=qs[_0x0c75('0x10')](_0x119b36[_0x0c75('0x21')][_0x0c75('0x10')]);}_0x1dde6b['order']=qs['sort'](_0x119b36[_0x0c75('0x21')][_0x0c75('0x84')]);_0x1dde6b[_0x0c75('0x5d')]=qs[_0x0c75('0x7f')](_['pick'](_0x119b36[_0x0c75('0x21')],_0x54bff5[_0x0c75('0x7f')]));_0x1dde6b[_0x0c75('0x5d')][_0x0c75('0x9e')]=_0x331375['id'];if(_0x119b36[_0x0c75('0x21')]['filter']){_0x1dde6b[_0x0c75('0x5d')]=_[_0x0c75('0x34')](_0x1dde6b[_0x0c75('0x5d')],{'$or':_[_0x0c75('0x74')](_0x1dde6b[_0x0c75('0x81')],function(_0x2d2a96){var _0xe4835d={};_0xe4835d[_0x2d2a96]={'$like':'%'+_0x119b36[_0x0c75('0x21')][_0x0c75('0x86')]+'%'};return _0xe4835d;})});}_0x1dde6b=_[_0x0c75('0x34')]({},_0x1dde6b,_0x119b36[_0x0c75('0x9f')]);return db[_0x0c75('0x4a')][_0x0c75('0x13')]({'where':_0x1dde6b[_0x0c75('0x5d')]})['then'](function(_0x23d44b){_0x11f63c[_0x0c75('0x13')]=_0x23d44b;if(_0x119b36[_0x0c75('0x21')][_0x0c75('0xa0')]){_0x1dde6b['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1dde6b);})[_0x0c75('0x16')](function(_0x5e637a){_0x11f63c[_0x0c75('0xa2')]=_0x5e637a;return _0x11f63c;});}})[_0x0c75('0x16')](respondWithFilteredResult(_0x203d13,_0x1dde6b))[_0x0c75('0x23')](handleError(_0x203d13,null));};exports[_0x0c75('0xa4')]=function(_0x5d106f,_0xcef3c){var _0xe67e67={'raw':!![],'where':{}};var _0x28c650={};var _0x458d54={'count':0x0,'rows':[]};return db[_0x0c75('0x36')][_0x0c75('0x7c')]({'where':{'id':_0x5d106f['params']['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0xcef3c,null))[_0x0c75('0x16')](function(_0xf0f8a){if(_0xf0f8a){_0x28c650[_0x0c75('0x7d')]=_[_0x0c75('0x25')](db[_0x0c75('0x49')]['rawAttributes']);_0x28c650['query']=_[_0x0c75('0x25')](_0x5d106f[_0x0c75('0x21')]);_0x28c650[_0x0c75('0x7f')]=_['intersection'](_0x28c650[_0x0c75('0x7d')],_0x28c650[_0x0c75('0x21')]);_0xe67e67['attributes']=_[_0x0c75('0x80')](_0x28c650['model'],qs[_0x0c75('0x82')](_0x5d106f['query'][_0x0c75('0x82')]));_0xe67e67[_0x0c75('0x81')]=_0xe67e67['attributes']['length']?_0xe67e67[_0x0c75('0x81')]:_0x28c650[_0x0c75('0x7d')];if(!_0x5d106f[_0x0c75('0x21')][_0x0c75('0x33')](_0x0c75('0xa5'))){_0xe67e67[_0x0c75('0x12')]=qs['limit'](_0x5d106f[_0x0c75('0x21')][_0x0c75('0x12')]);_0xe67e67[_0x0c75('0x10')]=qs['offset'](_0x5d106f[_0x0c75('0x21')][_0x0c75('0x10')]);}_0xe67e67[_0x0c75('0x83')]=qs[_0x0c75('0x84')](_0x5d106f[_0x0c75('0x21')]['sort']);_0xe67e67[_0x0c75('0x5d')]=qs[_0x0c75('0x7f')](_['pick'](_0x5d106f['query'],_0x28c650[_0x0c75('0x7f')]));_0xe67e67['where'][_0x0c75('0x9e')]=_0xf0f8a['id'];if(_0x5d106f[_0x0c75('0x21')][_0x0c75('0x86')]){_0xe67e67['where']=_[_0x0c75('0x34')](_0xe67e67[_0x0c75('0x5d')],{'$or':_['map'](_0xe67e67[_0x0c75('0x81')],function(_0x1a5cf0){var _0x264c56={};_0x264c56[_0x1a5cf0]={'$like':'%'+_0x5d106f[_0x0c75('0x21')][_0x0c75('0x86')]+'%'};return _0x264c56;})});}_0xe67e67=_[_0x0c75('0x34')]({},_0xe67e67,_0x5d106f[_0x0c75('0x9f')]);return db['CmHopperFinal']['count']({'where':_0xe67e67[_0x0c75('0x5d')]})[_0x0c75('0x16')](function(_0x44233c){_0x458d54[_0x0c75('0x13')]=_0x44233c;if(_0x5d106f[_0x0c75('0x21')][_0x0c75('0xa0')]){_0xe67e67[_0x0c75('0xa1')]=[{'all':!![]}];}return db[_0x0c75('0x49')]['findAll'](_0xe67e67);})[_0x0c75('0x16')](function(_0x5c217a){_0x458d54['rows']=_0x5c217a;return _0x458d54;});}})[_0x0c75('0x16')](respondWithFilteredResult(_0xcef3c,_0xe67e67))['catch'](handleError(_0xcef3c,null));};exports['getJscriptySessions']=function(_0x291af6,_0x5d898){var _0x19fd51={'raw':!![],'where':{}};var _0x578b9e={};var _0x19c3aa={'count':0x0,'rows':[]};return db['CmContact'][_0x0c75('0x7c')]({'where':{'id':_0x291af6[_0x0c75('0x24')]['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0x5d898,null))[_0x0c75('0x16')](function(_0xce37f6){if(_0xce37f6){_0x578b9e[_0x0c75('0x7d')]=_[_0x0c75('0x25')](db['JscriptySessionReport']['rawAttributes']);_0x578b9e[_0x0c75('0x21')]=_[_0x0c75('0x25')](_0x291af6[_0x0c75('0x21')]);_0x578b9e['filters']=_[_0x0c75('0x80')](_0x578b9e[_0x0c75('0x7d')],_0x578b9e[_0x0c75('0x21')]);_0x19fd51['attributes']=_[_0x0c75('0x80')](_0x578b9e[_0x0c75('0x7d')],qs[_0x0c75('0x82')](_0x291af6[_0x0c75('0x21')][_0x0c75('0x82')]));_0x19fd51[_0x0c75('0x81')]=_0x19fd51[_0x0c75('0x81')]['length']?_0x19fd51['attributes']:_0x578b9e[_0x0c75('0x7d')];if(!_0x291af6[_0x0c75('0x21')][_0x0c75('0x33')](_0x0c75('0xa5'))){_0x19fd51[_0x0c75('0x12')]=qs['limit'](_0x291af6['query'][_0x0c75('0x12')]);_0x19fd51[_0x0c75('0x10')]=qs[_0x0c75('0x10')](_0x291af6['query']['offset']);}_0x19fd51[_0x0c75('0x83')]=qs['sort'](_0x291af6['query'][_0x0c75('0x84')]);_0x19fd51[_0x0c75('0x5d')]=qs[_0x0c75('0x7f')](_['pick'](_0x291af6[_0x0c75('0x21')],_0x578b9e[_0x0c75('0x7f')]));_0x19fd51[_0x0c75('0x5d')][_0x0c75('0x9e')]=_0xce37f6['id'];if(_0x291af6[_0x0c75('0x21')][_0x0c75('0x86')]){_0x19fd51['where']=_[_0x0c75('0x34')](_0x19fd51['where'],{'$or':_[_0x0c75('0x74')](_0x19fd51['attributes'],function(_0x402190){var _0x37fd7d={};_0x37fd7d[_0x402190]={'$like':'%'+_0x291af6['query'][_0x0c75('0x86')]+'%'};return _0x37fd7d;})});}_0x19fd51=_[_0x0c75('0x34')]({},_0x19fd51,_0x291af6[_0x0c75('0x9f')]);return db['JscriptySessionReport'][_0x0c75('0x13')]({'where':_0x19fd51['where']})['then'](function(_0x1c1372){_0x19c3aa[_0x0c75('0x13')]=_0x1c1372;if(_0x291af6[_0x0c75('0x21')][_0x0c75('0xa0')]){_0x19fd51[_0x0c75('0xa1')]=[{'all':!![]}];}return db[_0x0c75('0x51')][_0x0c75('0x20')](_0x19fd51);})['then'](function(_0x5a26b8){_0x19c3aa[_0x0c75('0xa2')]=_0x5a26b8;return _0x19c3aa;});}})[_0x0c75('0x16')](respondWithFilteredResult(_0x5d898,_0x19fd51))[_0x0c75('0x23')](handleError(_0x5d898,null));};exports['uploadCsv']=function(_0x2d4026,_0x512dfe){try{if(!_0x2d4026[_0x0c75('0x35')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x2d4026[_0x0c75('0x35')][_0x0c75('0xa6')]){throw new Error(_0x0c75('0xa7'));}if(!_0x2d4026['body'][_0x0c75('0xa8')]){throw new Error(_0x0c75('0xa9'));}if(!_0x2d4026[_0x0c75('0x35')][_0x0c75('0xaa')]){throw new Error(_0x0c75('0xab'));}var _0x51f995=_0x2d4026[_0x0c75('0x35')][_0x0c75('0xa6')][_0x0c75('0xac')](',');var _0x754af=_0x2d4026[_0x0c75('0x35')][_0x0c75('0xa8')][_0x0c75('0xac')](',');if(!_0x51f995['length']||!_0x754af[_0x0c75('0x2a')]||_0x51f995[_0x0c75('0x2a')]!==_0x754af[_0x0c75('0x2a')]){throw new Error(_0x0c75('0xad'));}_0x2d4026[_0x0c75('0x35')][_0x0c75('0x82')]=_[_0x0c75('0xae')](_0x51f995,_0x754af);if(!_0x2d4026[_0x0c75('0x35')][_0x0c75('0x82')][_0x0c75('0x7b')]){throw new Error(_0x0c75('0xaf'));}if(!_0x2d4026[_0x0c75('0x35')]['fields']['firstName']){throw new Error(_0x0c75('0xb0'));}var _0x19b19a=path[_0x0c75('0x56')](config[_0x0c75('0xb1')],_0x0c75('0xb2'),_0x2d4026[_0x0c75('0xb3')][_0x0c75('0xb4')]);fs[_0x0c75('0xb5')](_0x19b19a,parseInt(_0x0c75('0xb6'),0x8));var _0x11f942=require(_0x0c75('0xb7'))[_0x0c75('0xb8')](path['join'](__dirname,_0x0c75('0xb9')),[_0x19b19a,_0x2d4026['body'][_0x0c75('0xa6')],_0x2d4026[_0x0c75('0x35')][_0x0c75('0xa8')],_0x2d4026[_0x0c75('0x35')][_0x0c75('0x60')],_0x2d4026['body'][_0x0c75('0xba')],_0x2d4026[_0x0c75('0x35')][_0x0c75('0x5c')],_0x2d4026[_0x0c75('0x35')][_0x0c75('0xaa')]]);return _0x512dfe['status'](0xc8)[_0x0c75('0xf')]({'message':_0x0c75('0xbb'),'pid':_0x11f942['pid']});}catch(_0x4d8462){return _0x512dfe[_0x0c75('0xe')](0x1f4)['send'](_0x4d8462);}};exports[_0x0c75('0xbc')]=function(_0x500dbf,_0x11d86d){var _0x2a5977=fs['createReadStream'](_0x500dbf['file'][_0x0c75('0x3')]);Papa[_0x0c75('0xbd')](_0x2a5977,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x475efb){return _0x11d86d['status'](0xc8)['json']({'file':_0x500dbf[_0x0c75('0xb3')],'fields':_0x475efb['meta'][_0x0c75('0x82')]});}});};exports[_0x0c75('0xbe')]=function(_0x49beed,_0x1035ae){return db['User'][_0x0c75('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0c75('0xbf')}})[_0x0c75('0x16')](function(_0xa2cb62){var _0x512fa5=![];if(!_0x49beed[_0x0c75('0x35')][_0x0c75('0x60')]){throw new Error(_0x0c75('0xc0'));}if(!_0x49beed[_0x0c75('0x35')][_0x0c75('0xc1')]['phone']){throw new Error(_0x0c75('0xaf'));}if(!_0x49beed[_0x0c75('0x35')][_0x0c75('0xc1')][_0x0c75('0xc2')]){throw new Error(_0x0c75('0xb0'));}if(!_0x49beed[_0x0c75('0x35')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3ab176=require('child_process')[_0x0c75('0xb8')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x49beed[_0x0c75('0x24')]['id'],JSON[_0x0c75('0xc3')](_0x49beed[_0x0c75('0x35')]),JSON[_0x0c75('0xc3')](_0xa2cb62)]);_0x3ab176['on']('message',function(){_0x512fa5=!![];return _0x1035ae[_0x0c75('0xe')](0xc8)[_0x0c75('0xf')]({'message':_0x0c75('0xc4'),'pid':_0x3ab176[_0x0c75('0xc5')]});});_0x3ab176['on']('exit',function(_0x4f7f0f){if(_0x4f7f0f&&!_0x512fa5){return _0x1035ae[_0x0c75('0xe')](0x1f4)['json']({'message':_0x0c75('0xc6'),'pid':_0x3ab176[_0x0c75('0xc5')]});}});})[_0x0c75('0x23')](handleError(_0x1035ae,null));};exports[_0x0c75('0xc7')]=function(_0x1e1f44,_0x235a8a){return db[_0x0c75('0xc8')][_0x0c75('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x0c75('0x16')](function(_0x1a9d9c){var _0x3cbdd8=![];if(!_0x1e1f44['body'][_0x0c75('0x60')]){throw new Error(_0x0c75('0xc0'));}if(!_0x1e1f44[_0x0c75('0x35')][_0x0c75('0xc1')][_0x0c75('0x7b')]){throw new Error(_0x0c75('0xaf'));}if(!_0x1e1f44['body'][_0x0c75('0xc1')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1e1f44[_0x0c75('0x35')][_0x0c75('0xaa')]){throw new Error(_0x0c75('0xab'));}var _0x130fba=require('child_process')[_0x0c75('0xb8')](path[_0x0c75('0x56')](__dirname,'../../components/import/cm/csvUpdates'),[_0x1e1f44[_0x0c75('0x24')]['id'],JSON[_0x0c75('0xc3')](_0x1e1f44[_0x0c75('0x35')]),JSON[_0x0c75('0xc3')](_0x1a9d9c)]);_0x130fba['on'](_0x0c75('0xc9'),function(){_0x3cbdd8=!![];return _0x235a8a['status'](0xc8)[_0x0c75('0xf')]({'message':_0x0c75('0xc4'),'pid':_0x130fba[_0x0c75('0xc5')]});});_0x130fba['on'](_0x0c75('0xca'),function(_0x152a78){if(_0x152a78&&!_0x3cbdd8){return _0x235a8a[_0x0c75('0xe')](0x1f4)[_0x0c75('0xf')]({'message':_0x0c75('0xc6'),'pid':_0x130fba[_0x0c75('0xc5')]});}});})[_0x0c75('0x23')](handleError(_0x235a8a,null));};exports['getJourney']=function(_0x887f4c,_0xe6c2e){var _0x22f62f=[_0x0c75('0xcb'),_0x0c75('0xcc'),_0x0c75('0xcd'),_0x0c75('0xce'),_0x0c75('0xcf'),_0x0c75('0xd0'),_0x0c75('0xd1')];var _0x25dbd1={'offset':0x0,'order':qs[_0x0c75('0x84')](_0x0c75('0xd2'))},_0x22ccad={'count':0x0,'rows':[]};Promise['resolve']()[_0x0c75('0x16')](function(){if(_0x887f4c[_0x0c75('0x21')][_0x0c75('0xd3')]){if(!_[_0x0c75('0xd4')](_0x22f62f,_0x887f4c['query']['channel']['toLowerCase']())){throw new Error(_0x0c75('0xd5'));}_0x22f62f=[_0x887f4c['query'][_0x0c75('0xd3')]['toLowerCase']()];}if(_0x887f4c[_0x0c75('0x21')][_0x0c75('0xd6')]){try{var _0x3f48f5=JSON[_0x0c75('0xbd')](_0x887f4c[_0x0c75('0x21')]['range']);if(!moment(_0x3f48f5[_0x0c75('0x37')])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x3f48f5['to'])[_0x0c75('0xd7')]()){throw new Error(_0x0c75('0xd8'));}}catch(_0x9da7c4){throw new Error(_0x0c75('0xd9'));}}if(!_0x887f4c[_0x0c75('0x21')]['hasOwnProperty']('nolimit')){_0x25dbd1['limit']=qs['limit'](_0x887f4c[_0x0c75('0x21')]['limit']||0xa);_0x25dbd1['offset']=qs[_0x0c75('0x10')](_0x887f4c[_0x0c75('0x21')][_0x0c75('0x10')]);}var _0x3ed1cc=_0x22f62f[_0x0c75('0x74')](function(_0x1abc1d){if(_0x1abc1d==='voice'){var _0xa1a4f3={'attributes':['id',_0x0c75('0xda'),_0x0c75('0x2e'),_0x0c75('0xdb'),_0x0c75('0xdc'),_0x0c75('0xdd'),_0x0c75('0xde'),'endtime',_0x0c75('0xdf'),_0x0c75('0xe0'),_0x0c75('0xe1'),_0x0c75('0xe2'),'userSecondDisposition',_0x0c75('0xe3'),_0x0c75('0xe4')],'where':{'ContactId':_0x887f4c['params']['id']},'include':[{'model':db[_0x0c75('0xc8')],'as':_0x0c75('0xc8'),'attributes':['id',_0x0c75('0x1b'),_0x0c75('0xe5'),'alias']}],'order':[[_0x0c75('0xe1'),_0x0c75('0xe6')]]};if(_0x887f4c['query']['range']){_0xa1a4f3[_0x0c75('0x5d')]['createdAt']={'$gte':_0x3f48f5[_0x0c75('0x37')],'$lte':_0x3f48f5['to']};}return db[_0x0c75('0x4c')]['findAndCountAll'](_0xa1a4f3)[_0x0c75('0x16')](function(_0x4b4933){_0x22ccad[_0x0c75('0x13')]+=_0x4b4933[_0x0c75('0x13')];return _[_0x0c75('0x74')](_0x4b4933['rows'],function(_0x55ba76){var _0x406f12=_0x55ba76[_0x0c75('0x38')]({'plain':!![]});_0x406f12[_0x0c75('0xd3')]=_0x1abc1d;if(_0x406f12['User']){_0x406f12[_0x0c75('0xc8')]={'id':_0x406f12[_0x0c75('0xc8')]['id'],'name':_0x406f12[_0x0c75('0xc8')][_0x0c75('0x1b')],'fullname':_0x406f12[_0x0c75('0xc8')][_0x0c75('0xe5')],'alias':_0x406f12[_0x0c75('0xc8')]['alias']};}return _0x406f12;});});}else{var _0x9f6630=_['startCase'](_0x1abc1d)+(_0x1abc1d===_0x0c75('0xcc')?'Website':_0x0c75('0xe7'));var _0x2968c1={'attributes':['id',_0x0c75('0xe8'),_0x0c75('0xe9'),'createdAt',_0x0c75('0xe0'),_0x0c75('0xea'),'secondDisposition',_0x0c75('0xeb'),_0x0c75('0xe4'),_0x9f6630+'Id'],'where':{'ContactId':_0x887f4c[_0x0c75('0x24')]['id']},'include':[{'model':db[_0x9f6630],'as':'Account','attributes':['id',_0x0c75('0x1b'),_0x0c75('0xec')]},{'model':db[_0x0c75('0xc8')],'as':_0x0c75('0xed'),'attributes':['id','name','fullname']},{'model':db['Tag'],'as':_0x0c75('0x66'),'attributes':['id',_0x0c75('0x1b'),'color'],'through':{'attributes':[]}}],'order':[[_0x0c75('0xe1'),_0x0c75('0xe6')]]};if(_0x887f4c[_0x0c75('0x21')][_0x0c75('0xd6')]){_0x2968c1['where'][_0x0c75('0xe1')]={'$gte':_0x3f48f5[_0x0c75('0x37')],'$lte':_0x3f48f5['to']};}switch(_0x1abc1d){case _0x0c75('0xcc'):_0x2968c1[_0x0c75('0x81')][_0x0c75('0x5f')]('browserName',_0x0c75('0xee'),_0x0c75('0xef'),'deviceModel',_0x0c75('0xf0'),'ratingMessage',_0x0c75('0xf1'),_0x0c75('0xf2'),_0x0c75('0xf3'));break;case _0x0c75('0xcb'):_0x2968c1[_0x0c75('0x81')][_0x0c75('0x5f')](_0x0c75('0xf4'),_0x0c75('0xf5'));break;case _0x0c75('0xce'):_0x2968c1['attributes']['push'](_0x0c75('0xf6'),_0x0c75('0xf7'));break;}return db[_[_0x0c75('0xf8')](_0x1abc1d)+_0x0c75('0xf9')]['findAndCountAll'](_0x2968c1)[_0x0c75('0x16')](function(_0x384c46){_0x22ccad[_0x0c75('0x13')]+=_0x384c46['count'];return _['map'](_0x384c46[_0x0c75('0xa2')],function(_0x700761){var _0x435bdd=_0x700761['get']({'plain':!![]});_0x435bdd[_0x0c75('0xd3')]=_0x1abc1d;if(_0x435bdd[_0x0c75('0xed')]){_0x435bdd['Owner']={'id':_0x435bdd[_0x0c75('0xed')]['id'],'name':_0x435bdd[_0x0c75('0xed')][_0x0c75('0x1b')],'fullname':_0x435bdd['Owner'][_0x0c75('0xe5')]};}return _0x435bdd;});});}});return Promise['all'](_0x3ed1cc);})[_0x0c75('0x16')](function(_0x4c2202){return _(_0x4c2202)[_0x0c75('0xfa')]()[_0x0c75('0xfb')]('createdAt')['reverse']()['value']();})['then'](function(_0x5bd6a6){_0x22ccad['rows']=_0x25dbd1[_0x0c75('0x12')]?_0x5bd6a6[_0x0c75('0xfc')](_0x25dbd1[_0x0c75('0x10')],_0x25dbd1['offset']+_0x25dbd1[_0x0c75('0x12')]):_0x5bd6a6;return _0x22ccad;})[_0x0c75('0x16')](respondWithFilteredResult(_0xe6c2e,_0x25dbd1))['catch'](handleError(_0xe6c2e,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 5c7da14..778cc1b 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 _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 +var _0x7ffe=['hook','exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xbb0d59,_0x227edf){var _0x40a72f=function(_0x27815c){while(--_0x27815c){_0xbb0d59['push'](_0xbb0d59['shift']());}};_0x40a72f(++_0x227edf);}(_0x7ffe,0xfc));var _0xe7ff=function(_0x5d78d6,_0x160934){_0x5d78d6=_0x5d78d6-0x0;var _0x3826b1=_0x7ffe[_0x5d78d6];return _0x3826b1;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xe7ff('0x0'))['db'][_0xe7ff('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xe7ff('0x2')](0x0);var events={'afterCreate':_0xe7ff('0x3'),'afterUpdate':_0xe7ff('0x4'),'afterDestroy':_0xe7ff('0x5')};function emitEvent(_0x258ca0){return function(_0x2b7906,_0x1b819d,_0x34bdb5){CmContactEvents[_0xe7ff('0x6')](_0x258ca0+':'+_0x2b7906['id'],_0x2b7906);CmContactEvents[_0xe7ff('0x6')](_0x258ca0,_0x2b7906);_0x34bdb5(null);};}for(var e in events){if(events[_0xe7ff('0x7')](e)){var event=events[e];CmContact[_0xe7ff('0x8')](e,emitEvent(event));}}module[_0xe7ff('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 77fc8b8..d519a11 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 _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 +var _0xdde0=['get','error','cmContact','inspect','scheduledat','format','isNil','dialTimezone','VoiceQueue','then','utcOffset','add','ret','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','YYYY-MM-DD\x20HH:mm:ss','catch','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','afterCreate','Campaign','timezones','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','CmList','Lists','dialCheckDuplicateType','always','onlyIfOpen','findAll','BlackLists','length','cmContact,\x20%s,\x20%s','message','models','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','email','FULLTEXT','utf8mb4_unicode_ci'];(function(_0x15dce0,_0x28ac01){var _0x20bc1a=function(_0x410c43){while(--_0x410c43){_0x15dce0['push'](_0x15dce0['shift']());}};_0x20bc1a(++_0x28ac01);}(_0xdde0,0x159));var _0x0dde=function(_0x13da67,_0x1baf8c){_0x13da67=_0x13da67-0x0;var _0x25cff7=_0xdde0[_0x13da67];return _0x25cff7;};'use strict';var _=require(_0x0dde('0x0'));var util=require(_0x0dde('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0dde('0x2'));var BPromise=require(_0x0dde('0x3'));var rp=require(_0x0dde('0x4'));var fs=require('fs');var path=require(_0x0dde('0x5'));var rimraf=require(_0x0dde('0x6'));var config=require(_0x0dde('0x7'));var shared=require(_0x0dde('0x8'));var attributes=require('./cmContact.attributes');module[_0x0dde('0x9')]=function(_0x4016cf,_0x13ecbc){return _0x4016cf[_0x0dde('0xa')](_0x0dde('0xb'),attributes,{'tableName':_0x0dde('0xc'),'paranoid':!![],'indexes':[{'name':_0x0dde('0xd'),'fields':['phone']},{'name':_0x0dde('0xe'),'fields':[_0x0dde('0xf'),_0x0dde('0x10'),_0x0dde('0xd'),'mobile','fax',_0x0dde('0x11')],'type':_0x0dde('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x0dde('0x13'),'hooks':{'afterCreate':function(_0x37737b,_0x4a1420,_0x4e02cb){var _0x8da5ff=_0x4016cf['models'];var _0x2261fc=_0x37737b[_0x0dde('0x14')]({'plain':!![]});function _0xfe7a17(){return function(_0x1f3a78){logger[_0x0dde('0x15')](_0x0dde('0x16'),'afterCreate',util[_0x0dde('0x17')](_0x1f3a78,{'showHidden':![],'depth':null}));};}function _0x3cfe82(_0x4fde93,_0x3e8714){var _0x151bee=_0x3e8714[_0x0dde('0x18')]?_0x3e8714[_0x0dde('0x18')]:moment()[_0x0dde('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0xfcf3eb,_0x14099d){if(_[_0x0dde('0x1a')](_0x3e8714[_0x0dde('0x1b')])){_0xfcf3eb({'ret':_0x151bee});}else{_0x8da5ff[_0x0dde('0x1c')]['findOne']({'where':{'id':_0x4fde93['id']}})[_0x0dde('0x1d')](function(_0x57e09a){if(!_[_0x0dde('0x1a')](_0x57e09a)){var _0x256281=_0x57e09a[_0x0dde('0x1b')];if(!_[_0x0dde('0x1a')](_0x256281)){var _0x3c3d9c=shared['timezones'];var _0x24699e=_0x3c3d9c[_0x256281];var _0x1c6127=_0x3c3d9c[_0x3e8714[_0x0dde('0x1b')]];if(!_[_0x0dde('0x1a')](_0x24699e)&&!_[_0x0dde('0x1a')](_0x1c6127)){var _0x1473aa=_0x24699e['utcOffset']-_0x1c6127[_0x0dde('0x1e')];_0x151bee=_0x3e8714['scheduledat']?_0x3e8714[_0x0dde('0x18')]:moment();var _0x229ae4=moment(_0x151bee)[_0x0dde('0x1f')](_0x1473aa,'minutes');_0xfcf3eb({'ret':_0x229ae4[_0x0dde('0x19')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0xfcf3eb({'ret':_0x151bee});}else _0xfcf3eb({'ret':_0x151bee});}else{_0xfcf3eb({'ret':_0x151bee});}});}});return 0xa;}var _0x4a39ab=function(_0x31ee65){return new BPromise(function(_0x57b3f6,_0x1a4c18){_0x3cfe82(_0x31ee65,_0x2261fc)[_0x0dde('0x1d')](function(_0x389a85){_0x2261fc[_0x0dde('0x18')]=_0x389a85[_0x0dde('0x20')];_0x8da5ff['CmHopper'][_0x0dde('0x21')]({'where':{'phone':_0x2261fc['phone'],'VoiceQueueId':_0x31ee65['id']}})['then'](function(_0x2de3c8){if(!_[_0x0dde('0x1a')](_0x2de3c8)){throw new Error(_0x0dde('0x22')+_0x2261fc[_0x0dde('0xd')]+_0x0dde('0x23')+_0x31ee65['id']);}return _0x8da5ff[_0x0dde('0x24')][_0x0dde('0x25')]({'phone':_0x2261fc['phone'],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'priority':_0x2261fc[_0x0dde('0x27')]?_0x2261fc['priority']:0x2,'scheduledat':_0x2261fc[_0x0dde('0x18')]?_0x2261fc[_0x0dde('0x18')]:moment()[_0x0dde('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc['callbackUniqueid']?moment()[_0x0dde('0x19')](_0x0dde('0x29')):undefined,'VoiceQueueId':_0x31ee65['id']});})[_0x0dde('0x2a')](function(_0x44df3d){_0x1a4c18(_0x44df3d);});});});};var _0x2cbf0b=function(_0x222db1){return new BPromise(function(_0x441b6b,_0x3ff9b3){_0x3cfe82(_0x222db1,_0x2261fc)['then'](function(_0x269aab){_0x2261fc[_0x0dde('0x18')]=_0x269aab['ret'];_0x8da5ff['CmHopper'][_0x0dde('0x21')]({'where':{'phone':_0x2261fc[_0x0dde('0xd')],'VoiceQueueId':_0x222db1['id']}})[_0x0dde('0x1d')](function(_0x18e72a){if(!_['isNil'](_0x18e72a)){throw new Error(_0x0dde('0x22')+_0x2261fc[_0x0dde('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x222db1['id']);}return _0x8da5ff['CmHopperFinal'][_0x0dde('0x21')]({'where':{'calleridnum':_0x2261fc['phone'],'VoiceQueueId':_0x222db1['id']}});})['then'](function(_0xa61f37){if(!_[_0x0dde('0x1a')](_0xa61f37)){throw new Error(_0x0dde('0x2b')+_0x2261fc[_0x0dde('0xd')]+_0x0dde('0x2c')+_0x222db1['id']);}return _0x8da5ff['CmHopper']['create']({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc['ListId'],'priority':_0x2261fc['priority']?_0x2261fc[_0x0dde('0x27')]:0x2,'scheduledat':_0x2261fc[_0x0dde('0x18')]?_0x2261fc[_0x0dde('0x18')]:moment()[_0x0dde('0x19')](_0x0dde('0x29')),'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc[_0x0dde('0x28')]?moment()[_0x0dde('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x222db1['id']});})['catch'](function(_0x5b7860){_0x3ff9b3(_0x5b7860);});});});};function _0x41a501(){return function(_0x235471){logger[_0x0dde('0x15')](_0x0dde('0x16'),_0x0dde('0x2d'),util['inspect'](_0x235471,{'showHidden':![],'depth':null}));};}function _0x4fb746(_0x107906,_0x1e0f84){var _0x5f0540=_0x1e0f84['scheduledat']?_0x1e0f84[_0x0dde('0x18')]:moment()['format'](_0x0dde('0x29'));return new BPromise(function(_0x3c3f9e,_0x5847c2){if(_[_0x0dde('0x1a')](_0x1e0f84[_0x0dde('0x1b')])){_0x3c3f9e({'ret':_0x5f0540});}else{_0x8da5ff[_0x0dde('0x2e')][_0x0dde('0x21')]({'where':{'id':_0x107906['id']}})[_0x0dde('0x1d')](function(_0x2f2860){if(!_[_0x0dde('0x1a')](_0x2f2860)){var _0x2843b2=_0x2f2860[_0x0dde('0x1b')];if(!_['isNil'](_0x2843b2)){var _0x3ed875=shared[_0x0dde('0x2f')];var _0x5f6ae5=_0x3ed875[_0x2843b2];var _0x232b2f=_0x3ed875[_0x1e0f84[_0x0dde('0x1b')]];if(!_[_0x0dde('0x1a')](_0x5f6ae5)&&!_['isNil'](_0x232b2f)){var _0x1a9241=_0x5f6ae5[_0x0dde('0x1e')]-_0x232b2f[_0x0dde('0x1e')];_0x5f0540=_0x1e0f84[_0x0dde('0x18')]?_0x1e0f84['scheduledat']:moment();var _0x5ea7f4=moment(_0x5f0540)['add'](_0x1a9241,_0x0dde('0x30'));_0x3c3f9e({'ret':_0x5ea7f4['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x3c3f9e({'ret':_0x5f0540});}else _0x3c3f9e({'ret':_0x5f0540});}else{_0x3c3f9e({'ret':_0x5f0540});}});}});return 0xa;}var _0x4db6e3=function(_0x242e28){return new BPromise(function(_0x22f12d,_0x3f37f7){_0x4fb746(_0x242e28,_0x2261fc)[_0x0dde('0x1d')](function(_0x51063a){_0x2261fc[_0x0dde('0x18')]=_0x51063a[_0x0dde('0x20')];_0x8da5ff[_0x0dde('0x24')][_0x0dde('0x21')]({'where':{'phone':_0x2261fc[_0x0dde('0xd')],'CampaignId':_0x242e28['id']}})['then'](function(_0x3674bc){if(!_[_0x0dde('0x1a')](_0x3674bc)){throw new Error(_0x0dde('0x22')+_0x2261fc[_0x0dde('0xd')]+_0x0dde('0x31')+_0x242e28['id']);}return _0x8da5ff[_0x0dde('0x24')][_0x0dde('0x25')]({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'priority':_0x2261fc['priority']?_0x2261fc['priority']:0x2,'scheduledat':_0x2261fc[_0x0dde('0x18')]?_0x2261fc['scheduledat']:moment()[_0x0dde('0x19')](_0x0dde('0x29')),'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc['callbackUniqueid']?moment()[_0x0dde('0x19')](_0x0dde('0x29')):undefined,'CampaignId':_0x242e28['id']});})[_0x0dde('0x2a')](function(_0x304187){_0x3f37f7(_0x304187);});});});};var _0x42b1fe=function(_0x1b44c4){return new BPromise(function(_0x4c5af3,_0x60ceef){_0x4fb746(_0x1b44c4,_0x2261fc)[_0x0dde('0x1d')](function(_0x1fdf52){_0x2261fc[_0x0dde('0x18')]=_0x1fdf52[_0x0dde('0x20')];_0x8da5ff[_0x0dde('0x24')]['findOne']({'where':{'phone':_0x2261fc['phone'],'CampaignId':_0x1b44c4['id']}})[_0x0dde('0x1d')](function(_0xa7aabe){if(!_[_0x0dde('0x1a')](_0xa7aabe)){throw new Error(_0x0dde('0x22')+_0x2261fc['phone']+_0x0dde('0x32')+_0x1b44c4['id']);}return _0x8da5ff['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x2261fc[_0x0dde('0xd')],'CampaignId':_0x1b44c4['id']}});})[_0x0dde('0x1d')](function(_0x3ce5ff){if(!_[_0x0dde('0x1a')](_0x3ce5ff)){throw new Error(_0x0dde('0x2b')+_0x2261fc[_0x0dde('0xd')]+_0x0dde('0x33')+_0x1b44c4['id']);}return _0x8da5ff[_0x0dde('0x24')][_0x0dde('0x25')]({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'priority':_0x2261fc[_0x0dde('0x27')]?_0x2261fc[_0x0dde('0x27')]:0x2,'scheduledat':_0x2261fc[_0x0dde('0x18')]?_0x2261fc[_0x0dde('0x18')]:moment()[_0x0dde('0x19')](_0x0dde('0x29')),'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc[_0x0dde('0x28')]?moment()[_0x0dde('0x19')](_0x0dde('0x29')):undefined,'CampaignId':_0x1b44c4['id']});})[_0x0dde('0x2a')](function(_0x5c00d0){_0x60ceef(_0x5c00d0);});});});};if(_0x2261fc['ListId']){_0x8da5ff['VoiceQueue']['findAll']({'where':{'type':_0x0dde('0x34')},'attributes':['id','dialCheckDuplicateType',_0x0dde('0x1b')],'include':[{'model':_0x8da5ff[_0x0dde('0x35')],'as':_0x0dde('0x36'),'where':{'id':_0x2261fc[_0x0dde('0x26')]}}]})[_0x0dde('0x1d')](function(_0x4d350f){if(_0x4d350f){var _0x471c46=[];for(var _0x17f702=0x0,_0xded916;_0x17f702<_0x4d350f['length'];_0x17f702+=0x1){_0xded916=_0x4d350f[_0x17f702][_0x0dde('0x14')]({'plain':!![]});switch(_0xded916[_0x0dde('0x37')]){case _0x0dde('0x38'):_0x2cbf0b(_0xded916)[_0x0dde('0x2a')](_0xfe7a17());break;case _0x0dde('0x39'):_0x4a39ab(_0xded916)[_0x0dde('0x2a')](_0xfe7a17());break;default:_0x4fb746(_0xded916,_0x2261fc)[_0x0dde('0x1d')](function(_0x2c4f77){_0x2261fc[_0x0dde('0x18')]=_0x2c4f77[_0x0dde('0x20')];_0x8da5ff[_0x0dde('0x24')][_0x0dde('0x25')]({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'scheduledat':_0x2261fc['scheduledat']?_0x2261fc[_0x0dde('0x18')]:moment()['format'](_0x0dde('0x29')),'priority':_0x2261fc['priority']?_0x2261fc['priority']:0x2,'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc['callbackUniqueid']?moment()[_0x0dde('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xded916['id']})[_0x0dde('0x2a')](_0xfe7a17());});}}}})[_0x0dde('0x1d')](function(){return _0x8da5ff[_0x0dde('0x1c')][_0x0dde('0x3a')]({'where':{'type':_0x0dde('0x34')},'attributes':['id'],'include':[{'model':_0x8da5ff['CmList'],'as':_0x0dde('0x3b'),'where':{'id':_0x2261fc[_0x0dde('0x26')]}}]})[_0x0dde('0x1d')](function(_0x56b10a){if(_0x56b10a){var _0x3951bb=[];for(var _0x512aa6=0x0,_0x496edf;_0x512aa6<_0x56b10a[_0x0dde('0x3c')];_0x512aa6+=0x1){_0x496edf=_0x56b10a[_0x512aa6][_0x0dde('0x14')]({'plain':!![]});_0x8da5ff['CmHopperBlack']['create']({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'VoiceQueueId':_0x496edf['id']})['catch'](function(_0x4f557b){logger[_0x0dde('0x15')](_0x0dde('0x3d'),_0x0dde('0x2d'),_0x4f557b[_0x0dde('0x3e')]);});}}});})[_0x0dde('0x1d')](function(){return _0x8da5ff[_0x0dde('0x2e')][_0x0dde('0x3a')]({'attributes':['id',_0x0dde('0x37'),'dialTimezone'],'include':[{'model':_0x8da5ff[_0x0dde('0x35')],'as':_0x0dde('0x36'),'where':{'id':_0x2261fc[_0x0dde('0x26')]}}]})['then'](function(_0xec4f23){if(_0xec4f23){var _0x14ca96=[];for(var _0x5997d2=0x0,_0x1037b4;_0x5997d2<_0xec4f23[_0x0dde('0x3c')];_0x5997d2+=0x1){_0x1037b4=_0xec4f23[_0x5997d2][_0x0dde('0x14')]({'plain':!![]});switch(_0x1037b4[_0x0dde('0x37')]){case _0x0dde('0x38'):_0x42b1fe(_0x1037b4)['catch'](_0x41a501());break;case _0x0dde('0x39'):_0x4db6e3(_0x1037b4)[_0x0dde('0x2a')](_0x41a501());break;default:_0x8da5ff[_0x0dde('0x24')][_0x0dde('0x25')]({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'scheduledat':_0x2261fc[_0x0dde('0x18')]?_0x2261fc[_0x0dde('0x18')]:moment()[_0x0dde('0x19')](_0x0dde('0x29')),'priority':_0x2261fc[_0x0dde('0x27')]?_0x2261fc[_0x0dde('0x27')]:0x2,'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc[_0x0dde('0x28')]?moment()[_0x0dde('0x19')](_0x0dde('0x29')):undefined,'CampaignId':_0x1037b4['id']})[_0x0dde('0x2a')](_0x41a501());}}}});})[_0x0dde('0x1d')](function(){return _0x8da5ff[_0x0dde('0x2e')]['findAll']({'attributes':['id'],'include':[{'model':_0x8da5ff[_0x0dde('0x35')],'as':'BlackLists','where':{'id':_0x2261fc[_0x0dde('0x26')]}}]})[_0x0dde('0x1d')](function(_0x3b8336){if(_0x3b8336){var _0x16a86b=[];for(var _0x5888ed=0x0,_0x15c45d;_0x5888ed<_0x3b8336[_0x0dde('0x3c')];_0x5888ed+=0x1){_0x15c45d=_0x3b8336[_0x5888ed][_0x0dde('0x14')]({'plain':!![]});_0x8da5ff['CmHopperBlack'][_0x0dde('0x25')]({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'CampaignId':_0x15c45d['id']})[_0x0dde('0x2a')](function(_0x5442c2){logger[_0x0dde('0x15')](_0x0dde('0x3d'),'afterCreate',_0x5442c2[_0x0dde('0x3e')]);});}}});})[_0x0dde('0x1d')](function(){_0x4e02cb();})[_0x0dde('0x2a')](function(_0xd1bae3){logger['error']('cmContact,\x20%s,\x20%s',_0x0dde('0x2d'),_0xd1bae3[_0x0dde('0x3e')]);_0x4e02cb(_0xd1bae3);});}else{_0x4e02cb(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x58e5b8,_0x197d64,_0x58617f){var _0x3eba8e=_0x4016cf[_0x0dde('0x3f')];var _0x557538=_0x58e5b8[_0x0dde('0x14')]({'plain':!![]});return _0x3eba8e[_0x0dde('0x24')][_0x0dde('0x3a')]({'raw':!![],'where':{'ListId':_0x557538[_0x0dde('0x26')],'ContactId':_0x557538['id']}})[_0x0dde('0x1d')](function(_0x57d1ea){if(!_['isEmpty'](_0x57d1ea)){var _0x144438=[];for(var _0x15d8dc=0x0;_0x15d8dc<_0x57d1ea[_0x0dde('0x3c')];_0x15d8dc+=0x1){var _0x416e65=_0x3eba8e[_0x0dde('0x24')][_0x0dde('0x40')]({'where':{'ListId':_0x57d1ea[_0x15d8dc][_0x0dde('0x26')],'ContactId':_0x57d1ea[_0x15d8dc][_0x0dde('0x41')],'VoiceQueueId':_0x57d1ea[_0x15d8dc][_0x0dde('0x42')],'CampaignId':_0x57d1ea[_0x15d8dc][_0x0dde('0x43')]}});_0x144438[_0x0dde('0x44')](_0x416e65);}return BPromise[_0x0dde('0x45')](_0x144438);}})['then'](function(_0x48b8e2){logger[_0x0dde('0x46')](_0x0dde('0x47'),util[_0x0dde('0x17')](_0x48b8e2,{'showHidden':![],'depth':null}));_0x58617f();})[_0x0dde('0x2a')](function(_0x593e35){logger[_0x0dde('0x15')](_0x0dde('0x48'),util[_0x0dde('0x17')](_0x593e35,{'showHidden':![],'depth':null}));_0x58617f(_0x593e35);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index f96986f..c0a440c 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(_0x7a01c5,_0x36f5f3){var _0x585949=function(_0x3fcd2){while(--_0x3fcd2){_0x7a01c5['push'](_0x7a01c5['shift']());}};_0x585949(++_0x36f5f3);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x54ca33,_0x810f58){var _0x5d6901=function(_0x17e9c6){while(--_0x17e9c6){_0x54ca33['push'](_0x54ca33['shift']());}};_0x5d6901(++_0x810f58);}(_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['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 a4138b7..16d968b 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 _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 +var _0x98d3=['exports','STRING','INTEGER','sequelize'];(function(_0x26a31e,_0x273d4b){var _0x28897a=function(_0x187a90){while(--_0x187a90){_0x26a31e['push'](_0x26a31e['shift']());}};_0x28897a(++_0x273d4b);}(_0x98d3,0x173));var _0x398d=function(_0x542653,_0x31ecd7){_0x542653=_0x542653-0x0;var _0x191254=_0x98d3[_0x542653];return _0x191254;};'use strict';var Sequelize=require(_0x398d('0x0'));module[_0x398d('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x398d('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x398d('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x398d('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x398d('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index a439263..660f1a9 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 _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 +var _0x5c17=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','get','CmContactHasItems','then','error','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x5c17,0x1f1));var _0x75c1=function(_0x149221,_0x4099ad){_0x149221=_0x149221-0x0;var _0xb08d4f=_0x5c17[_0x149221];return _0xb08d4f;};'use strict';var emlformat=require(_0x75c1('0x0'));var rimraf=require(_0x75c1('0x1'));var zipdir=require(_0x75c1('0x2'));var jsonpatch=require(_0x75c1('0x3'));var rp=require(_0x75c1('0x4'));var moment=require(_0x75c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x75c1('0x6'));var util=require(_0x75c1('0x7'));var path=require(_0x75c1('0x8'));var sox=require('sox');var csv=require(_0x75c1('0x9'));var ejs=require(_0x75c1('0xa'));var fs=require('fs');var fs_extra=require(_0x75c1('0xb'));var _=require(_0x75c1('0xc'));var squel=require(_0x75c1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x75c1('0xe'));var toCsv=require(_0x75c1('0x9'));var querystring=require(_0x75c1('0xf'));var Papa=require(_0x75c1('0x10'));var Redis=require(_0x75c1('0x11'));var authService=require(_0x75c1('0x12'));var qs=require(_0x75c1('0x13'));var as=require(_0x75c1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x75c1('0x15'));var utils=require(_0x75c1('0x16'));var config=require(_0x75c1('0x17'));var licenseUtil=require(_0x75c1('0x18'));var db=require(_0x75c1('0x19'))['db'];function respondWithStatusCode(_0x4cf93f,_0x3c3afd){_0x3c3afd=_0x3c3afd||0xcc;return function(_0xe6968c){if(_0xe6968c){return _0x4cf93f[_0x75c1('0x1a')](_0x3c3afd);}return _0x4cf93f[_0x75c1('0x1b')](_0x3c3afd)[_0x75c1('0x1c')]();};}function respondWithResult(_0x58e3b0,_0x507130){_0x507130=_0x507130||0xc8;return function(_0x26c0f8){if(_0x26c0f8){return _0x58e3b0[_0x75c1('0x1b')](_0x507130)[_0x75c1('0x1d')](_0x26c0f8);}};}function respondWithFilteredResult(_0x586721,_0x424d59){return function(_0x1f549b){if(_0x1f549b){var _0x4df9bc=typeof _0x424d59[_0x75c1('0x1e')]===_0x75c1('0x1f')&&typeof _0x424d59[_0x75c1('0x20')]===_0x75c1('0x1f');var _0x47d41f=_0x1f549b['count'];var _0x335872=_0x4df9bc?0x0:_0x424d59[_0x75c1('0x1e')];var _0x309365=_0x4df9bc?_0x1f549b['count']:_0x424d59[_0x75c1('0x1e')]+_0x424d59['limit'];var _0x556cbe;if(_0x309365>=_0x47d41f){_0x309365=_0x47d41f;_0x556cbe=0xc8;}else{_0x556cbe=0xce;}_0x586721[_0x75c1('0x1b')](_0x556cbe);return _0x586721[_0x75c1('0x21')](_0x75c1('0x22'),_0x335872+'-'+_0x309365+'/'+_0x47d41f)['json'](_0x1f549b);}return null;};}function patchUpdates(_0x4a8dae){return function(_0x2a1d3e){try{jsonpatch[_0x75c1('0x23')](_0x2a1d3e,_0x4a8dae,!![]);}catch(_0x50be40){return BPromise[_0x75c1('0x24')](_0x50be40);}return _0x2a1d3e[_0x75c1('0x25')]();};}function saveUpdates(_0x320e9c,_0xc529cc){return function(_0x2feb9b){if(_0x2feb9b){return _0x2feb9b[_0x75c1('0x26')](_0x320e9c)['then'](function(_0x3fe8cb){return _0x3fe8cb;});}return null;};}function removeEntity(_0x2991e3,_0x2ab24e){return function(_0x3e4529){if(_0x3e4529){return _0x3e4529[_0x75c1('0x27')]()['then'](function(){var _0x18e54a=_0x3e4529[_0x75c1('0x28')]({'plain':!![]});var _0x254e5d=_0x75c1('0x29');return db['UserProfileResource'][_0x75c1('0x27')]({'where':{'type':_0x254e5d,'resourceId':_0x18e54a['id']}})[_0x75c1('0x2a')](function(){return _0x3e4529;});})[_0x75c1('0x2a')](function(){_0x2991e3[_0x75c1('0x1b')](0xcc)[_0x75c1('0x1c')]();});}};}function handleEntityNotFound(_0x192eb2,_0x4adfce){return function(_0x27dfaa){if(!_0x27dfaa){_0x192eb2[_0x75c1('0x1a')](0x194);}return _0x27dfaa;};}function handleError(_0x58de94,_0x27a350){_0x27a350=_0x27a350||0x1f4;return function(_0x33d3ef){logger[_0x75c1('0x2b')](_0x33d3ef[_0x75c1('0x2c')]);if(_0x33d3ef[_0x75c1('0x2d')]){delete _0x33d3ef[_0x75c1('0x2d')];}_0x58de94[_0x75c1('0x1b')](_0x27a350)[_0x75c1('0x2e')](_0x33d3ef);};}exports['index']=function(_0x14c3df,_0x1e0d14){var _0x4520a0={},_0x1bea70={},_0x4f7f82={'count':0x0,'rows':[]};var _0x163ea1=_[_0x75c1('0x2f')](db[_0x75c1('0x30')][_0x75c1('0x31')],function(_0x4643b6){return{'name':_0x4643b6[_0x75c1('0x32')],'type':_0x4643b6[_0x75c1('0x33')]['key']};});_0x1bea70['model']=_[_0x75c1('0x2f')](_0x163ea1,_0x75c1('0x2d'));_0x1bea70[_0x75c1('0x34')]=_['keys'](_0x14c3df['query']);_0x1bea70[_0x75c1('0x35')]=_[_0x75c1('0x36')](_0x1bea70[_0x75c1('0x37')],_0x1bea70[_0x75c1('0x34')]);_0x4520a0['attributes']=_['intersection'](_0x1bea70[_0x75c1('0x37')],qs[_0x75c1('0x38')](_0x14c3df[_0x75c1('0x34')][_0x75c1('0x38')]));_0x4520a0['attributes']=_0x4520a0[_0x75c1('0x39')][_0x75c1('0x3a')]?_0x4520a0[_0x75c1('0x39')]:_0x1bea70[_0x75c1('0x37')];if(!_0x14c3df['query'][_0x75c1('0x3b')]('nolimit')){_0x4520a0['limit']=qs[_0x75c1('0x20')](_0x14c3df['query'][_0x75c1('0x20')]);_0x4520a0[_0x75c1('0x1e')]=qs['offset'](_0x14c3df[_0x75c1('0x34')][_0x75c1('0x1e')]);}_0x4520a0[_0x75c1('0x3c')]=qs['sort'](_0x14c3df[_0x75c1('0x34')][_0x75c1('0x3d')]);_0x4520a0[_0x75c1('0x3e')]=qs[_0x75c1('0x35')](_[_0x75c1('0x3f')](_0x14c3df[_0x75c1('0x34')],_0x1bea70[_0x75c1('0x35')]),_0x163ea1);if(_0x14c3df[_0x75c1('0x34')][_0x75c1('0x40')]){_0x4520a0[_0x75c1('0x3e')]=_[_0x75c1('0x41')](_0x4520a0[_0x75c1('0x3e')],{'$or':_[_0x75c1('0x2f')](_0x163ea1,function(_0x58eb95){if(_0x58eb95[_0x75c1('0x33')]!==_0x75c1('0x42')){var _0x4db579={};_0x4db579[_0x58eb95[_0x75c1('0x2d')]]={'$like':'%'+_0x14c3df[_0x75c1('0x34')]['filter']+'%'};return _0x4db579;}})});}_0x4520a0=_[_0x75c1('0x41')]({},_0x4520a0,_0x14c3df[_0x75c1('0x43')]);var _0x31096e={'where':_0x4520a0[_0x75c1('0x3e')]};return db[_0x75c1('0x30')][_0x75c1('0x44')](_0x31096e)[_0x75c1('0x2a')](function(_0x36573a){_0x4f7f82[_0x75c1('0x44')]=_0x36573a;if(_0x14c3df[_0x75c1('0x34')][_0x75c1('0x45')]){_0x4520a0['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x75c1('0x46')](_0x4520a0);})[_0x75c1('0x2a')](function(_0x23a706){_0x4f7f82[_0x75c1('0x47')]=_0x23a706;return _0x4f7f82;})[_0x75c1('0x2a')](respondWithFilteredResult(_0x1e0d14,_0x4520a0))[_0x75c1('0x48')](handleError(_0x1e0d14,null));};exports[_0x75c1('0x49')]=function(_0x3ffea0,_0x344ca9){var _0x315008={'raw':!![],'where':{'id':_0x3ffea0[_0x75c1('0x4a')]['id']}},_0x519e3a={};_0x519e3a['model']=_[_0x75c1('0x4b')](db['CmContactHasItem']['rawAttributes']);_0x519e3a['query']=_[_0x75c1('0x4b')](_0x3ffea0[_0x75c1('0x34')]);_0x519e3a[_0x75c1('0x35')]=_[_0x75c1('0x36')](_0x519e3a['model'],_0x519e3a[_0x75c1('0x34')]);_0x315008[_0x75c1('0x39')]=_['intersection'](_0x519e3a[_0x75c1('0x37')],qs[_0x75c1('0x38')](_0x3ffea0[_0x75c1('0x34')][_0x75c1('0x38')]));_0x315008[_0x75c1('0x39')]=_0x315008[_0x75c1('0x39')][_0x75c1('0x3a')]?_0x315008['attributes']:_0x519e3a[_0x75c1('0x37')];if(_0x3ffea0['query'][_0x75c1('0x45')]){_0x315008['include']=[{'all':!![]}];}_0x315008=_[_0x75c1('0x41')]({},_0x315008,_0x3ffea0[_0x75c1('0x43')]);return db[_0x75c1('0x30')][_0x75c1('0x4c')](_0x315008)[_0x75c1('0x2a')](handleEntityNotFound(_0x344ca9,null))[_0x75c1('0x2a')](respondWithResult(_0x344ca9,null))[_0x75c1('0x48')](handleError(_0x344ca9,null));};exports[_0x75c1('0x4d')]=function(_0x1d44da,_0x825466){return db['CmContactHasItem'][_0x75c1('0x4d')](_0x1d44da['body'],{})[_0x75c1('0x2a')](function(_0x25efe2){var _0x1f4505=_0x1d44da[_0x75c1('0x4e')][_0x75c1('0x28')]({'plain':!![]});if(!_0x1f4505)throw new Error(_0x75c1('0x4f'));if(_0x1f4505['role']===_0x75c1('0x4e')){var _0x2abcd6=_0x25efe2[_0x75c1('0x28')]({'plain':!![]});var _0x1aec1b=_0x75c1('0x29');return db[_0x75c1('0x50')][_0x75c1('0x4c')]({'where':{'name':_0x1aec1b,'userProfileId':_0x1f4505[_0x75c1('0x51')]},'raw':!![]})[_0x75c1('0x2a')](function(_0x20cda7){if(_0x20cda7&&_0x20cda7[_0x75c1('0x52')]===0x0){return db[_0x75c1('0x53')]['create']({'name':_0x2abcd6[_0x75c1('0x2d')],'resourceId':_0x2abcd6['id'],'type':_0x20cda7[_0x75c1('0x2d')],'sectionId':_0x20cda7['id']},{})['then'](function(){return _0x25efe2;});}else{return _0x25efe2;}})[_0x75c1('0x48')](function(_0x4757f1){logger[_0x75c1('0x2b')](_0x75c1('0x54'),_0x4757f1);throw _0x4757f1;});}return _0x25efe2;})[_0x75c1('0x2a')](respondWithResult(_0x825466,0xc9))[_0x75c1('0x48')](handleError(_0x825466,null));};exports[_0x75c1('0x26')]=function(_0x129d33,_0x3ab0ae){if(_0x129d33[_0x75c1('0x55')]['id']){delete _0x129d33['body']['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x129d33['params']['id']}})[_0x75c1('0x2a')](handleEntityNotFound(_0x3ab0ae,null))[_0x75c1('0x2a')](saveUpdates(_0x129d33[_0x75c1('0x55')],null))[_0x75c1('0x2a')](respondWithResult(_0x3ab0ae,null))['catch'](handleError(_0x3ab0ae,null));};exports[_0x75c1('0x27')]=function(_0x23b619,_0x5c80b3){return db[_0x75c1('0x30')][_0x75c1('0x4c')]({'where':{'id':_0x23b619['params']['id']}})[_0x75c1('0x2a')](handleEntityNotFound(_0x5c80b3,null))[_0x75c1('0x2a')](removeEntity(_0x5c80b3,null))[_0x75c1('0x48')](handleError(_0x5c80b3,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index e717834..b57bc25 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 _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 +var _0xe996=['path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c17d8,_0x51cc20){var _0x1841de=function(_0x128311){while(--_0x128311){_0x5c17d8['push'](_0x5c17d8['shift']());}};_0x1841de(++_0x51cc20);}(_0xe996,0x1e8));var _0x6e99=function(_0x3c8abc,_0xdb0295){_0x3c8abc=_0x3c8abc-0x0;var _0x420d0=_0xe996[_0x3c8abc];return _0x420d0;};'use strict';var _=require(_0x6e99('0x0'));var util=require('util');var logger=require(_0x6e99('0x1'))(_0x6e99('0x2'));var moment=require(_0x6e99('0x3'));var BPromise=require(_0x6e99('0x4'));var rp=require(_0x6e99('0x5'));var fs=require('fs');var path=require(_0x6e99('0x6'));var rimraf=require('rimraf');var config=require(_0x6e99('0x7'));var attributes=require(_0x6e99('0x8'));module[_0x6e99('0x9')]=function(_0x1c4e8c,_0x4b20c1){return _0x1c4e8c[_0x6e99('0xa')](_0x6e99('0xb'),attributes,{'tableName':_0x6e99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index c646cf2..0258290 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 _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 +var _0x0e44=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','CmContactHasItem,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x35bd9e,_0x3fc3c0){var _0x2a5eae=function(_0x5e635e){while(--_0x5e635e){_0x35bd9e['push'](_0x35bd9e['shift']());}};_0x2a5eae(++_0x3fc3c0);}(_0x0e44,0x8b));var _0x40e4=function(_0x10bc64,_0x56e086){_0x10bc64=_0x10bc64-0x0;var _0x4f8bea=_0x0e44[_0x10bc64];return _0x4f8bea;};'use strict';var _=require(_0x40e4('0x0'));var util=require('util');var moment=require(_0x40e4('0x1'));var BPromise=require(_0x40e4('0x2'));var rs=require(_0x40e4('0x3'));var fs=require('fs');var Redis=require(_0x40e4('0x4'));var db=require(_0x40e4('0x5'))['db'];var utils=require(_0x40e4('0x6'));var logger=require(_0x40e4('0x7'))(_0x40e4('0x8'));var config=require(_0x40e4('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b025f,_0x56e5fd,_0x3704c9){return new BPromise(function(_0x20e588,_0x180f78){return client[_0x40e4('0xa')](_0x1b025f,_0x3704c9)[_0x40e4('0xb')](function(_0x1d7f2d){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x56e5fd,_0x40e4('0xc'));logger['debug'](_0x40e4('0xd'),_0x56e5fd,'request\x20sent',JSON['stringify'](_0x1d7f2d));if(_0x1d7f2d[_0x40e4('0xe')]){if(_0x1d7f2d[_0x40e4('0xe')][_0x40e4('0xf')]===0x1f4){logger['error'](_0x40e4('0x10'),_0x56e5fd,_0x1d7f2d[_0x40e4('0xe')]['message']);return _0x180f78(_0x1d7f2d[_0x40e4('0xe')]['message']);}logger[_0x40e4('0xe')](_0x40e4('0x10'),_0x56e5fd,_0x1d7f2d['error'][_0x40e4('0x11')]);return _0x20e588(_0x1d7f2d['error'][_0x40e4('0x11')]);}else{logger[_0x40e4('0x12')](_0x40e4('0x10'),_0x56e5fd,'request\x20sent');_0x20e588(_0x1d7f2d[_0x40e4('0x13')][_0x40e4('0x11')]);}})['catch'](function(_0x321460){logger['error'](_0x40e4('0x10'),_0x56e5fd,_0x321460);_0x180f78(_0x321460);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index d1d3481..ee73d2b 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 _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 +var _0x9e17=['put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3a60ff,_0x3996fb){var _0x1f256d=function(_0xdc8362){while(--_0xdc8362){_0x3a60ff['push'](_0x3a60ff['shift']());}};_0x1f256d(++_0x3996fb);}(_0x9e17,0x6b));var _0x79e1=function(_0x25c044,_0xbd05f8){_0x25c044=_0x25c044-0x0;var _0x558ee5=_0x9e17[_0x25c044];return _0x558ee5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79e1('0x0'));var timeout=require('connect-timeout');var express=require(_0x79e1('0x1'));var router=express[_0x79e1('0x2')]();var fs_extra=require(_0x79e1('0x3'));var auth=require(_0x79e1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0x79e1('0x5')]('/',auth[_0x79e1('0x6')](),controller[_0x79e1('0x7')]);router[_0x79e1('0x5')](_0x79e1('0x8'),auth[_0x79e1('0x6')](),controller[_0x79e1('0x9')]);router[_0x79e1('0xa')]('/',auth[_0x79e1('0x6')](),controller[_0x79e1('0xb')]);router[_0x79e1('0xc')](_0x79e1('0x8'),auth[_0x79e1('0x6')](),controller[_0x79e1('0xd')]);router[_0x79e1('0xe')](_0x79e1('0x8'),auth['isAuthenticated'](),controller[_0x79e1('0xf')]);module[_0x79e1('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a0b5582..80b1bdb 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 _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 +var _0xa4c2=['values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','select'];(function(_0x4b9108,_0x2cce77){var _0x365982=function(_0x4dc3fb){while(--_0x4dc3fb){_0x4b9108['push'](_0x4b9108['shift']());}};_0x365982(++_0x2cce77);}(_0xa4c2,0xf0));var _0x2a4c=function(_0x5799e1,_0x25ef85){_0x5799e1=_0x5799e1-0x0;var _0x30822c=_0xa4c2[_0x5799e1];return _0x30822c;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2a4c('0x0'));module[_0x2a4c('0x1')]={'name':{'type':Sequelize[_0x2a4c('0x2')],'get':function(_0x41b06b){return this['getDataValue'](_0x2a4c('0x3'));}},'alias':{'type':Sequelize[_0x2a4c('0x4')],'allowNull':![],'set':function(_0x9c66c2){this[_0x2a4c('0x5')](_0x2a4c('0x3'),_0x9c66c2?_0x9c66c2:this[_0x2a4c('0x6')](_0x2a4c('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x2a4c('0x8')](_0x2a4c('0x9')),'get':function(){if(this['getDataValue'](_0x2a4c('0xa'))===_0x2a4c('0xb')){return JSON['parse'](this[_0x2a4c('0x6')](_0x2a4c('0xc')));}else{return this[_0x2a4c('0x6')]('values');}},'set':function(_0x4c8117){if(Array[_0x2a4c('0xd')](_0x4c8117)){this[_0x2a4c('0x5')](_0x2a4c('0xc'),JSON[_0x2a4c('0xe')](_0x4c8117));}else{this[_0x2a4c('0x5')](_0x2a4c('0xc'),_0x4c8117);}}},'required':{'type':Sequelize[_0x2a4c('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x2a4c('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2a4c('0x10')](_0x2a4c('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d09c7da..dbae48b 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 _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 +var _0xb628=['length','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','rows','show','params','rawAttributes','find','catch','body','sequelize','transaction','create','Sequelize','TEXT','text','switch','defaultValue','queryInterface','addColumn','cm_contacts','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','map','CmCustomField','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x3020e0,_0x8f72ac){var _0x3de063=function(_0x69444a){while(--_0x69444a){_0x3020e0['push'](_0x3020e0['shift']());}};_0x3de063(++_0x8f72ac);}(_0xb628,0x113));var _0x8b62=function(_0x15c6a4,_0x29051a){_0x15c6a4=_0x15c6a4-0x0;var _0x13f835=_0xb628[_0x15c6a4];return _0x13f835;};'use strict';var emlformat=require(_0x8b62('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b62('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b62('0x2'));var moment=require(_0x8b62('0x3'));var BPromise=require(_0x8b62('0x4'));var Mustache=require(_0x8b62('0x5'));var util=require(_0x8b62('0x6'));var path=require(_0x8b62('0x7'));var sox=require(_0x8b62('0x8'));var csv=require('to-csv');var ejs=require(_0x8b62('0x9'));var fs=require('fs');var fs_extra=require(_0x8b62('0xa'));var _=require(_0x8b62('0xb'));var squel=require(_0x8b62('0xc'));var crypto=require(_0x8b62('0xd'));var jsforce=require(_0x8b62('0xe'));var deskjs=require(_0x8b62('0xf'));var toCsv=require(_0x8b62('0x10'));var querystring=require(_0x8b62('0x11'));var Papa=require(_0x8b62('0x12'));var Redis=require('ioredis');var authService=require(_0x8b62('0x13'));var qs=require(_0x8b62('0x14'));var as=require(_0x8b62('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b62('0x16'))(_0x8b62('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b62('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bbc67,_0x16e5fe){_0x16e5fe=_0x16e5fe||0xcc;return function(_0x196f3f){if(_0x196f3f){return _0x3bbc67[_0x8b62('0x19')](_0x16e5fe);}return _0x3bbc67[_0x8b62('0x1a')](_0x16e5fe)[_0x8b62('0x1b')]();};}function respondWithResult(_0xa862dd,_0x52c1a5){_0x52c1a5=_0x52c1a5||0xc8;return function(_0x491c4c){if(_0x491c4c){return _0xa862dd[_0x8b62('0x1a')](_0x52c1a5)[_0x8b62('0x1c')](_0x491c4c);}};}function respondWithFilteredResult(_0xa75b0a,_0x1419ce){return function(_0x2cce4e){if(_0x2cce4e){var _0x43e006=typeof _0x1419ce[_0x8b62('0x1d')]===_0x8b62('0x1e')&&typeof _0x1419ce[_0x8b62('0x1f')]===_0x8b62('0x1e');var _0x431836=_0x2cce4e[_0x8b62('0x20')];var _0x26128e=_0x43e006?0x0:_0x1419ce[_0x8b62('0x1d')];var _0x103d5f=_0x43e006?_0x2cce4e[_0x8b62('0x20')]:_0x1419ce[_0x8b62('0x1d')]+_0x1419ce['limit'];var _0x28bb96;if(_0x103d5f>=_0x431836){_0x103d5f=_0x431836;_0x28bb96=0xc8;}else{_0x28bb96=0xce;}_0xa75b0a['status'](_0x28bb96);return _0xa75b0a[_0x8b62('0x21')](_0x8b62('0x22'),_0x26128e+'-'+_0x103d5f+'/'+_0x431836)[_0x8b62('0x1c')](_0x2cce4e);}return null;};}function patchUpdates(_0x47337c){return function(_0xaf75d){try{jsonpatch[_0x8b62('0x23')](_0xaf75d,_0x47337c,!![]);}catch(_0x4c9ba3){return BPromise['reject'](_0x4c9ba3);}return _0xaf75d[_0x8b62('0x24')]();};}function saveUpdates(_0x2a9123,_0x10402f){return function(_0x3bc263){if(_0x3bc263){return _0x3bc263[_0x8b62('0x25')](_0x2a9123)['then'](function(_0x3a1d22){return _0x3a1d22;});}return null;};}function removeEntity(_0x2578f1,_0x2c4f52){return function(_0x5af022){if(_0x5af022){return _0x5af022[_0x8b62('0x26')]()[_0x8b62('0x27')](function(){_0x2578f1[_0x8b62('0x1a')](0xcc)[_0x8b62('0x1b')]();});}};}function handleEntityNotFound(_0x1131d0,_0x5dbfd0){return function(_0x193f7d){if(!_0x193f7d){_0x1131d0[_0x8b62('0x19')](0x194);}return _0x193f7d;};}function handleError(_0x385e1f,_0x33b737){_0x33b737=_0x33b737||0x1f4;return function(_0x4a5f67){logger[_0x8b62('0x28')](_0x4a5f67[_0x8b62('0x29')]);if(_0x4a5f67[_0x8b62('0x2a')]){delete _0x4a5f67['name'];}_0x385e1f[_0x8b62('0x1a')](_0x33b737)['send'](_0x4a5f67);};}exports['index']=function(_0x5e64e2,_0x4488bc){var _0x5ee765={},_0x554741={},_0x5e80a3={'count':0x0,'rows':[]};var _0x5d3296=_[_0x8b62('0x2b')](db[_0x8b62('0x2c')]['rawAttributes'],function(_0x1431fe){return{'name':_0x1431fe['fieldName'],'type':_0x1431fe['type'][_0x8b62('0x2d')]};});_0x554741[_0x8b62('0x2e')]=_['differenceBy'](_[_0x8b62('0x2b')](_0x5d3296,'name'),['name']);_0x554741[_0x8b62('0x2f')]=_[_0x8b62('0x30')](_0x5e64e2[_0x8b62('0x2f')]);_0x554741[_0x8b62('0x31')]=_['intersection'](_0x554741['model'],_0x554741[_0x8b62('0x2f')]);_0x5ee765['attributes']=_[_0x8b62('0x32')](_0x554741['model'],qs[_0x8b62('0x33')](_0x5e64e2['query'][_0x8b62('0x33')]));_0x5ee765[_0x8b62('0x34')]=_0x5ee765['attributes'][_0x8b62('0x35')]?_0x5ee765[_0x8b62('0x34')]:_0x554741[_0x8b62('0x2e')];if(!_0x5e64e2[_0x8b62('0x2f')]['hasOwnProperty']('nolimit')){_0x5ee765[_0x8b62('0x1f')]=qs[_0x8b62('0x1f')](_0x5e64e2[_0x8b62('0x2f')][_0x8b62('0x1f')]);_0x5ee765[_0x8b62('0x1d')]=qs[_0x8b62('0x1d')](_0x5e64e2['query']['offset']);}_0x5ee765[_0x8b62('0x36')]=qs[_0x8b62('0x37')](_0x5e64e2['query'][_0x8b62('0x37')]);_0x5ee765[_0x8b62('0x38')]=qs[_0x8b62('0x31')](_[_0x8b62('0x39')](_0x5e64e2['query'],_0x554741[_0x8b62('0x31')]),_0x5d3296);if(_0x5e64e2['query']['filter']){_0x5ee765['where']=_['merge'](_0x5ee765[_0x8b62('0x38')],{'$or':_[_0x8b62('0x2b')](_0x5d3296,function(_0x470879){if(_0x470879[_0x8b62('0x3a')]!==_0x8b62('0x3b')){var _0x438573={};_0x438573[_0x470879[_0x8b62('0x2a')]]={'$like':'%'+_0x5e64e2[_0x8b62('0x2f')][_0x8b62('0x3c')]+'%'};return _0x438573;}})});}_0x5ee765=_[_0x8b62('0x3d')]({},_0x5ee765,_0x5e64e2[_0x8b62('0x3e')]);var _0x2b2b9c={'where':_0x5ee765[_0x8b62('0x38')]};return db[_0x8b62('0x2c')][_0x8b62('0x20')](_0x2b2b9c)[_0x8b62('0x27')](function(_0x379065){_0x5e80a3[_0x8b62('0x20')]=_0x379065;if(_0x5e64e2['query'][_0x8b62('0x3f')]){_0x5ee765['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x5ee765);})[_0x8b62('0x27')](function(_0x57653b){_0x5e80a3[_0x8b62('0x40')]=_0x57653b;return _0x5e80a3;})[_0x8b62('0x27')](respondWithFilteredResult(_0x4488bc,_0x5ee765))['catch'](handleError(_0x4488bc,null));};exports[_0x8b62('0x41')]=function(_0x9900cf,_0x4ac670){var _0x368a4a={'raw':!![],'where':{'id':_0x9900cf[_0x8b62('0x42')]['id']}},_0x243ac9={};_0x243ac9['model']=_['keys'](db[_0x8b62('0x2c')][_0x8b62('0x43')]);_0x243ac9[_0x8b62('0x2f')]=_[_0x8b62('0x30')](_0x9900cf[_0x8b62('0x2f')]);_0x243ac9[_0x8b62('0x31')]=_['intersection'](_0x243ac9[_0x8b62('0x2e')],_0x243ac9[_0x8b62('0x2f')]);_0x368a4a[_0x8b62('0x34')]=_[_0x8b62('0x32')](_0x243ac9[_0x8b62('0x2e')],qs['fields'](_0x9900cf[_0x8b62('0x2f')][_0x8b62('0x33')]));_0x368a4a[_0x8b62('0x34')]=_0x368a4a[_0x8b62('0x34')][_0x8b62('0x35')]?_0x368a4a[_0x8b62('0x34')]:_0x243ac9[_0x8b62('0x2e')];if(_0x9900cf[_0x8b62('0x2f')][_0x8b62('0x3f')]){_0x368a4a['include']=[{'all':!![]}];}_0x368a4a=_[_0x8b62('0x3d')]({},_0x368a4a,_0x9900cf[_0x8b62('0x3e')]);return db[_0x8b62('0x2c')][_0x8b62('0x44')](_0x368a4a)[_0x8b62('0x27')](handleEntityNotFound(_0x4ac670,null))[_0x8b62('0x27')](respondWithResult(_0x4ac670,null))[_0x8b62('0x45')](handleError(_0x4ac670,null));};exports[_0x8b62('0x25')]=function(_0x33e78c,_0x1e27de){if(_0x33e78c[_0x8b62('0x46')]['id']){delete _0x33e78c[_0x8b62('0x46')]['id'];}return db[_0x8b62('0x2c')][_0x8b62('0x44')]({'where':{'id':_0x33e78c[_0x8b62('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e27de,null))['then'](saveUpdates(_0x33e78c['body'],null))[_0x8b62('0x27')](respondWithResult(_0x1e27de,null))[_0x8b62('0x45')](handleError(_0x1e27de,null));};exports['destroy']=function(_0x52fd79,_0x563b1a){return db['CmCustomField'][_0x8b62('0x44')]({'where':{'id':_0x52fd79[_0x8b62('0x42')]['id']}})[_0x8b62('0x27')](handleEntityNotFound(_0x563b1a,null))['then'](removeEntity(_0x563b1a,null))[_0x8b62('0x45')](handleError(_0x563b1a,null));};exports['create']=function(_0xcc326a,_0x54ed19){var _0x17f829;return db[_0x8b62('0x47')][_0x8b62('0x48')](function(_0x44be46){return db[_0x8b62('0x2c')][_0x8b62('0x49')](_0xcc326a['body'],{'transaction':_0x44be46})[_0x8b62('0x27')](function(_0x5b9f86){_0x17f829=_0x5b9f86;var _0x4df7aa={'type':db[_0x8b62('0x4a')][_0x8b62('0x4b')],'transaction':_0x44be46};switch(_0xcc326a[_0x8b62('0x46')][_0x8b62('0x3a')]){case _0x8b62('0x4c'):_0x4df7aa[_0x8b62('0x3a')]=db[_0x8b62('0x4a')][_0x8b62('0x4b')];break;case'number':_0x4df7aa[_0x8b62('0x3a')]=db[_0x8b62('0x4a')]['INTEGER'];break;case _0x8b62('0x4d'):_0x4df7aa[_0x8b62('0x3a')]=db[_0x8b62('0x4a')]['BOOLEAN'];_0x4df7aa[_0x8b62('0x4e')]=![];break;default:}return db[_0x8b62('0x47')][_0x8b62('0x4f')][_0x8b62('0x50')](_0x8b62('0x51'),util['format']('cf_%d',_0x17f829['id']),_0x4df7aa);})[_0x8b62('0x27')](function(){return _0x17f829;});})[_0x8b62('0x27')](respondWithResult(_0x54ed19,0xc9))[_0x8b62('0x45')](handleError(_0x54ed19,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6447910..04cc3e4 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 _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 +var _0x0ced=['moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api'];(function(_0x14a675,_0xcf4dbb){var _0x9a6cb4=function(_0x1ef8b5){while(--_0x1ef8b5){_0x14a675['push'](_0x14a675['shift']());}};_0x9a6cb4(++_0xcf4dbb);}(_0x0ced,0x7e));var _0xd0ce=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x0ced[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0xd0ce('0x0'));var util=require(_0xd0ce('0x1'));var logger=require(_0xd0ce('0x2'))(_0xd0ce('0x3'));var moment=require(_0xd0ce('0x4'));var BPromise=require('bluebird');var rp=require(_0xd0ce('0x5'));var fs=require('fs');var path=require(_0xd0ce('0x6'));var rimraf=require(_0xd0ce('0x7'));var config=require(_0xd0ce('0x8'));var attributes=require(_0xd0ce('0x9'));module[_0xd0ce('0xa')]=function(_0x5bf410,_0x4a7789){return _0x5bf410['define'](_0xd0ce('0xb'),attributes,{'tableName':_0xd0ce('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 25e2a4a..b304748 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 _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 +var _0xd6ac=['error','CmCustomField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','debug','stringify'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0xd6ac,0x92));var _0xcd6a=function(_0x57504a,_0x518579){_0x57504a=_0x57504a-0x0;var _0x47d994=_0xd6ac[_0x57504a];return _0x47d994;};'use strict';var _=require(_0xcd6a('0x0'));var util=require(_0xcd6a('0x1'));var moment=require(_0xcd6a('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd6a('0x3'));var fs=require('fs');var Redis=require(_0xcd6a('0x4'));var db=require(_0xcd6a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd6a('0x6'))(_0xcd6a('0x7'));var config=require('../../config/environment');var jayson=require(_0xcd6a('0x8'));var client=jayson[_0xcd6a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16caa6,_0x50ed14,_0x5e2e86){return new BPromise(function(_0x2fad69,_0x226ff5){return client[_0xcd6a('0xa')](_0x16caa6,_0x5e2e86)[_0xcd6a('0xb')](function(_0x14dd91){logger['info']('CmCustomField,\x20%s,\x20%s',_0x50ed14,'request\x20sent');logger[_0xcd6a('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x50ed14,'request\x20sent',JSON[_0xcd6a('0xd')](_0x14dd91));if(_0x14dd91['error']){if(_0x14dd91[_0xcd6a('0xe')]['code']===0x1f4){logger['error'](_0xcd6a('0xf'),_0x50ed14,_0x14dd91[_0xcd6a('0xe')][_0xcd6a('0x10')]);return _0x226ff5(_0x14dd91[_0xcd6a('0xe')]['message']);}logger['error'](_0xcd6a('0xf'),_0x50ed14,_0x14dd91[_0xcd6a('0xe')][_0xcd6a('0x10')]);return _0x2fad69(_0x14dd91[_0xcd6a('0xe')][_0xcd6a('0x10')]);}else{logger['info'](_0xcd6a('0xf'),_0x50ed14,_0xcd6a('0x11'));_0x2fad69(_0x14dd91[_0xcd6a('0x12')]['message']);}})[_0xcd6a('0x13')](function(_0x399598){logger[_0xcd6a('0xe')](_0xcd6a('0xf'),_0x50ed14,_0x399598);_0x226ff5(_0x399598);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index acc23b5..888adfe 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 _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 +var _0x9ab0=['show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x2af655,_0x43eac3){var _0x54380a=function(_0x2a76fd){while(--_0x2a76fd){_0x2af655['push'](_0x2af655['shift']());}};_0x54380a(++_0x43eac3);}(_0x9ab0,0x195));var _0x09ab=function(_0x497e9d,_0x2f07cd){_0x497e9d=_0x497e9d-0x0;var _0x11e8bd=_0x9ab0[_0x497e9d];return _0x11e8bd;};'use strict';var multer=require(_0x09ab('0x0'));var util=require(_0x09ab('0x1'));var path=require(_0x09ab('0x2'));var timeout=require(_0x09ab('0x3'));var express=require(_0x09ab('0x4'));var router=express[_0x09ab('0x5')]();var fs_extra=require(_0x09ab('0x6'));var auth=require(_0x09ab('0x7'));var interaction=require(_0x09ab('0x8'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x09ab('0x9')](),controller[_0x09ab('0xa')]);router[_0x09ab('0xb')](_0x09ab('0xc'),auth[_0x09ab('0x9')](),controller[_0x09ab('0xd')]);router[_0x09ab('0xe')]('/',auth[_0x09ab('0x9')](),controller[_0x09ab('0xf')]);router['put'](_0x09ab('0xc'),auth['isAuthenticated'](),controller[_0x09ab('0x10')]);router[_0x09ab('0x11')](_0x09ab('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x09ab('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7124bd3..5193fbf 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 _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 +var _0xa38e=['INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa38e,0x83));var _0xea38=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0xa38e[_0x4defd6];return _0x4c9276;};'use strict';var moment=require(_0xea38('0x0'));var Sequelize=require(_0xea38('0x1'));module['exports']={'phone':{'type':Sequelize[_0xea38('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xea38('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xea38('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xea38('0x5')](0x2)[_0xea38('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xea38('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xea38('0x5')],'unique':_0xea38('0x7')},'ListId':{'type':Sequelize[_0xea38('0x5')],'unique':_0xea38('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xea38('0x5')],'unique':_0xea38('0x7')},'CampaignId':{'type':Sequelize[_0xea38('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xea38('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xea38('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xea38('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 71039c7..e2cbbec 100644 --- a/server/api/cmHopper/cmHopper.controller.js +++ b/server/api/cmHopper/cmHopper.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44e8=['merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','end','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','List','Queue','dialActive','getPreviewRecall','recallme','Contact','CmCompany','Company','CmList','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','moment','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','keys','query','filters','intersection','$and','$or','$gt','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$notIn','$iLike','$notILike','$like','$contains','$contained','$any','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44e8,0xd7));var _0x844e=function(_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 +var _0xb458=['update','then','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','query','filters','concat','$and','$or','$lt','$lte','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','sequelize','dialPreviewAutoRecallMe','value','direction','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','transaction','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','sendStatus','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/environment','../../mysqldb','status','offset','undefined','count','Content-Range','json'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xb458,0x103));var _0x8b45=function(_0x2331af,_0xa80e25){_0x2331af=_0x2331af-0x0;var _0x478d81=_0xb458[_0x2331af];return _0x478d81;};'use strict';var moment=require(_0x8b45('0x0'));var _=require(_0x8b45('0x1'));var qs=require(_0x8b45('0x2'));var logger=require('../../config/logger')('api');var shared=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];function respondWithResult(_0x141a44,_0x13a8c6){_0x13a8c6=_0x13a8c6||0xc8;return function(_0x5d51e4){if(_0x5d51e4){return _0x141a44[_0x8b45('0x5')](_0x13a8c6)['json'](_0x5d51e4);}};}function respondWithFilteredResult(_0x5cc2d5,_0xe8d774){return function(_0x12bd05){if(_0x12bd05){var _0x2daa9a=typeof _0xe8d774[_0x8b45('0x6')]===_0x8b45('0x7')&&typeof _0xe8d774['limit']===_0x8b45('0x7');var _0x12bea8=_0x12bd05[_0x8b45('0x8')];var _0x2bc809=_0x2daa9a?0x0:_0xe8d774[_0x8b45('0x6')];var _0x499899=_0x2daa9a?_0x12bd05[_0x8b45('0x8')]:_0xe8d774[_0x8b45('0x6')]+_0xe8d774['limit'];var _0x5316af;if(_0x499899>=_0x12bea8){_0x499899=_0x12bea8;_0x5316af=0xc8;}else{_0x5316af=0xce;}_0x5cc2d5['status'](_0x5316af);return _0x5cc2d5['set'](_0x8b45('0x9'),_0x2bc809+'-'+_0x499899+'/'+_0x12bea8)[_0x8b45('0xa')](_0x12bd05);}return null;};}function saveUpdates(_0x37c220,_0x52c4db){return function(_0x30d38c){if(_0x30d38c){return _0x30d38c[_0x8b45('0xb')](_0x37c220)[_0x8b45('0xc')](function(_0x2e5ec3){return _0x2e5ec3;});}return null;};}function handleEntityNotFound(_0x32babc,_0x2ad2ae){return function(_0x5f0b20){if(!_0x5f0b20){_0x32babc['sendStatus'](0x194);}return _0x5f0b20;};}function handleError(_0x45881c,_0x23f1dd){_0x23f1dd=_0x23f1dd||0x1f4;return function(_0x445170){logger[_0x8b45('0xd')](_0x445170[_0x8b45('0xe')]);if(_0x445170[_0x8b45('0xf')]){delete _0x445170[_0x8b45('0xf')];}_0x45881c[_0x8b45('0x5')](_0x23f1dd)[_0x8b45('0x10')](_0x445170);};}exports[_0x8b45('0x11')]=function(_0x287a3b,_0x21d5b2){var _0x1ed5ca={},_0x43ffb7={},_0x1623d8={'count':0x0,'rows':[]};var _0x31c6b4=_[_0x8b45('0x12')](db[_0x8b45('0x13')]['rawAttributes'],function(_0x25e8a1){return{'name':_0x25e8a1[_0x8b45('0x14')],'type':_0x25e8a1[_0x8b45('0x15')][_0x8b45('0x16')]};});_0x43ffb7[_0x8b45('0x17')]=_[_0x8b45('0x12')](_0x31c6b4,_0x8b45('0xf'));_0x43ffb7[_0x8b45('0x18')]=_['keys'](_0x287a3b['query']);_0x43ffb7[_0x8b45('0x19')]=_['intersection'](_0x43ffb7[_0x8b45('0x17')],_0x43ffb7[_0x8b45('0x18')]);_0x43ffb7[_0x8b45('0x19')]=_[_0x8b45('0x1a')](_0x43ffb7[_0x8b45('0x19')],[_0x8b45('0x1b'),_0x8b45('0x1c'),'$gt','$gte',_0x8b45('0x1d'),_0x8b45('0x1e'),'$ne','$eq',_0x8b45('0x1f'),_0x8b45('0x20'),_0x8b45('0x21'),_0x8b45('0x22'),'$notIn',_0x8b45('0x23'),_0x8b45('0x24'),_0x8b45('0x25'),_0x8b45('0x26'),_0x8b45('0x23'),_0x8b45('0x27'),_0x8b45('0x28'),_0x8b45('0x29'),_0x8b45('0x2a')]);_0x1ed5ca[_0x8b45('0x2b')]=_[_0x8b45('0x2c')](_0x43ffb7[_0x8b45('0x17')],qs[_0x8b45('0x2d')](_0x287a3b['query'][_0x8b45('0x2d')]));_0x1ed5ca[_0x8b45('0x2b')]=_0x1ed5ca[_0x8b45('0x2b')][_0x8b45('0x2e')]?_0x1ed5ca[_0x8b45('0x2b')]:_0x43ffb7[_0x8b45('0x17')];if(!_0x287a3b[_0x8b45('0x18')][_0x8b45('0x2f')]('nolimit')){_0x1ed5ca[_0x8b45('0x30')]=qs[_0x8b45('0x30')](_0x287a3b[_0x8b45('0x18')][_0x8b45('0x30')]);_0x1ed5ca[_0x8b45('0x6')]=qs['offset'](_0x287a3b[_0x8b45('0x18')]['offset']);}_0x1ed5ca['order']=qs[_0x8b45('0x31')](_0x287a3b[_0x8b45('0x18')][_0x8b45('0x31')]);_0x1ed5ca[_0x8b45('0x32')]=qs[_0x8b45('0x19')](_[_0x8b45('0x33')](_0x287a3b['query'],_0x43ffb7[_0x8b45('0x19')]),_0x31c6b4);if(_0x287a3b[_0x8b45('0x18')][_0x8b45('0x34')]){_0x1ed5ca[_0x8b45('0x32')]=_['merge'](_0x1ed5ca[_0x8b45('0x32')],{'$or':_[_0x8b45('0x12')](_0x31c6b4,function(_0x191db0){if(_0x191db0['type']!==_0x8b45('0x35')){var _0x475401={};_0x475401[_0x191db0[_0x8b45('0xf')]]={'$like':'%'+_0x287a3b['query'][_0x8b45('0x34')]+'%'};return _0x475401;}})});}_0x1ed5ca=_[_0x8b45('0x36')]({},_0x1ed5ca,_0x287a3b[_0x8b45('0x37')]);var _0x4016b7={'where':_0x1ed5ca['where']};return db[_0x8b45('0x13')][_0x8b45('0x8')](_0x4016b7)[_0x8b45('0xc')](function(_0x15df7c){_0x1623d8[_0x8b45('0x8')]=_0x15df7c;if(_0x287a3b[_0x8b45('0x18')]['includeAll']){_0x1ed5ca['include']=[{'all':!![]}];}return db[_0x8b45('0x13')][_0x8b45('0x38')](_0x1ed5ca);})[_0x8b45('0xc')](function(_0x12d4b2){_0x1623d8[_0x8b45('0x39')]=_0x12d4b2;return _0x1623d8;})['then'](respondWithFilteredResult(_0x21d5b2,_0x1ed5ca))[_0x8b45('0x3a')](handleError(_0x21d5b2,null));};exports['show']=function(_0x67c59a,_0x17e9a8){var _0x5fae26={'raw':!![],'where':{'id':_0x67c59a[_0x8b45('0x3b')]['id']}},_0x280bb0={};_0x280bb0[_0x8b45('0x17')]=_[_0x8b45('0x3c')](db[_0x8b45('0x13')][_0x8b45('0x3d')]);_0x280bb0[_0x8b45('0x18')]=_[_0x8b45('0x3c')](_0x67c59a['query']);_0x280bb0[_0x8b45('0x19')]=_['intersection'](_0x280bb0[_0x8b45('0x17')],_0x280bb0['query']);_0x5fae26[_0x8b45('0x2b')]=_[_0x8b45('0x2c')](_0x280bb0[_0x8b45('0x17')],qs[_0x8b45('0x2d')](_0x67c59a[_0x8b45('0x18')][_0x8b45('0x2d')]));_0x5fae26['attributes']=_0x5fae26[_0x8b45('0x2b')]['length']?_0x5fae26['attributes']:_0x280bb0[_0x8b45('0x17')];if(_0x67c59a[_0x8b45('0x18')][_0x8b45('0x3e')]){_0x5fae26['include']=[{'all':!![]}];}_0x5fae26=_[_0x8b45('0x36')]({},_0x5fae26,_0x67c59a['options']);return db[_0x8b45('0x13')][_0x8b45('0x3f')](_0x5fae26)[_0x8b45('0xc')](handleEntityNotFound(_0x17e9a8,null))[_0x8b45('0xc')](respondWithResult(_0x17e9a8,null))[_0x8b45('0x3a')](handleError(_0x17e9a8,null));};exports[_0x8b45('0x40')]=function(_0x526c90,_0x3cebd2){return db[_0x8b45('0x13')][_0x8b45('0x40')](_0x526c90[_0x8b45('0x41')],{})[_0x8b45('0xc')](respondWithResult(_0x3cebd2,0xc9))[_0x8b45('0x3a')](handleError(_0x3cebd2,null));};exports[_0x8b45('0xb')]=function(_0x3de3c2,_0x37b94a){if(_0x3de3c2[_0x8b45('0x41')]['id']){delete _0x3de3c2[_0x8b45('0x41')]['id'];}return db[_0x8b45('0x13')][_0x8b45('0x3f')]({'where':{'id':_0x3de3c2[_0x8b45('0x3b')]['id']}})[_0x8b45('0xc')](handleEntityNotFound(_0x37b94a,null))[_0x8b45('0xc')](saveUpdates(_0x3de3c2['body'],null))['then'](respondWithResult(_0x37b94a,null))['catch'](handleError(_0x37b94a,null));};exports[_0x8b45('0x42')]=function(_0x214e28,_0x3a1621){return db[_0x8b45('0x13')][_0x8b45('0x42')]()[_0x8b45('0xc')](respondWithResult(_0x3a1621,null))[_0x8b45('0x3a')](handleError(_0x3a1621,null));};exports[_0x8b45('0x43')]=function(_0x5e2a03,_0x102d01){var _0x5d5be2;var _0x23b5c6=_0x5e2a03[_0x8b45('0x3b')]['id'];return db[_0x8b45('0x13')][_0x8b45('0x3f')]({'where':{'id':_0x5e2a03['params']['id']}})[_0x8b45('0xc')](handleEntityNotFound(_0x102d01,null))[_0x8b45('0xc')](function(_0x5e42e6){if(_0x5e42e6){return _0x5e42e6[_0x8b45('0x43')]()[_0x8b45('0xc')](function(_0x52970c){return _0x52970c;});}})[_0x8b45('0xc')](function(_0x5758c){_0x5d5be2=_0x5758c;if(_0x5758c){if(_0x5758c[_0x8b45('0x44')]||_0x5758c[_0x8b45('0x45')]){return db[_0x5758c[_0x8b45('0x44')]?_0x8b45('0x46'):'Campaign']['find']({'where':{'id':_0x5758c[_0x8b45('0x44')]?_0x5758c[_0x8b45('0x44')]:_0x5758c[_0x8b45('0x45')]},'attributes':['id','name'],'raw':!![]});}}})[_0x8b45('0xc')](function(_0x11d1a5){var _0x20a68b={};if(_0x11d1a5){_[_0x8b45('0x36')](_0x20a68b,_[_0x8b45('0x47')](_0x5d5be2['dataValues'],[_0x8b45('0x48'),_0x8b45('0x49'),'id']));_0x20a68b['state']=0x15;_0x20a68b[_0x8b45('0x4a')]='deleted';_0x20a68b[_0x8b45('0x4b')]=_0x11d1a5[_0x8b45('0xf')];_0x20a68b[_0x8b45('0x4c')]=_0x5e2a03[_0x8b45('0x4d')]['name'];_0x20a68b[_0x8b45('0x4e')]=_0x5e2a03[_0x8b45('0x4d')]['id'];_0x20a68b[_0x8b45('0x4f')]=!![];_0x20a68b[_0x8b45('0x50')]=moment()[_0x8b45('0x51')](_0x8b45('0x52'));_0x20a68b[_0x8b45('0x53')]=_0x5d5be2[_0x8b45('0x54')];_0x20a68b[_0x8b45('0x55')]=_0x5d5be2[_0x8b45('0x44')]?_0x8b45('0x56'):_0x8b45('0x57');return db[_0x8b45('0x58')][_0x8b45('0x3f')]({'where':{'id':_0x20a68b[_0x8b45('0x59')]},'attributes':['firstName',_0x8b45('0x5a')]})[_0x8b45('0xc')](function(_0x15c9ae){if(!_['isNil'](_0x102d01)&&!_[_0x8b45('0x5b')](_0x15c9ae[_0x8b45('0x5c')])){_0x20a68b[_0x8b45('0x5d')]=_0x15c9ae[_0x8b45('0x5c')];if(!_['isNil'](_0x15c9ae[_0x8b45('0x5a')])){_0x20a68b[_0x8b45('0x5d')]+='\x20'+_0x15c9ae[_0x8b45('0x5a')];}}})[_0x8b45('0x5e')](function(){return db['CmHopperFinal'][_0x8b45('0x40')](_0x20a68b);});}})[_0x8b45('0xc')](function(_0x417778){return db[_0x8b45('0x5f')][_0x8b45('0x43')]({'where':{'CmHopperId':_0x23b5c6}});})['then'](function(){return _0x102d01[_0x8b45('0x5')](0xcc)['end']();})[_0x8b45('0x3a')](handleError(_0x102d01,null));};exports[_0x8b45('0x60')]=function(_0x19152b,_0x19c80e){var _0x6a77bd=[];return db[_0x8b45('0x58')]['describe']()['then'](function(_0x5ace1){_0x6a77bd=_[_0x8b45('0x3c')](_0x5ace1);return _0x19152b['user'][_0x8b45('0x61')]({'where':{'type':_0x8b45('0x62'),'dialActive':!![],'dialMethod':_0x8b45('0x63')},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8b45('0xc')](function(_0x8e5a41){if(_0x8e5a41&&_0x8e5a41['length']){return db[_0x8b45('0x64')]['transaction'](function(_0xf1ab37){var _0x560c51={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x8b45('0x52'))},'VoiceQueueId':{'$in':_[_0x8b45('0x12')](_0x8e5a41,'id')},'$or':[{'UserId':null},{'UserId':_0x19152b['user']['id']}]};var _0x324592={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x8e5a41)[_0x8b45('0x34')]([_0x8b45('0x65'),0x0])[_0x8b45('0x12')]('id')[_0x8b45('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x19152b['user']['id']}]};var _0x37f580={'$or':[_0x560c51,_0x324592]};var _0x3b3d21=[];if(_0x19152b[_0x8b45('0x41')]['direction']&&_0x19152b['body'][_0x8b45('0x67')]==='prev'){if(!_[_0x8b45('0x68')](_0x19152b['body']['hopperIds'])){_0x37f580['id']={'$in':_0x19152b['body'][_0x8b45('0x69')]};}_0x3b3d21=[['priority',_0x8b45('0x6a')],[_0x8b45('0x6b'),_0x8e5a41[0x0]['dialOrderByScheduledAt']===_0x8b45('0x6a')?_0x8b45('0x6c'):'ASC'],db[_0x8b45('0x64')][_0x8b45('0x6d')](_0x8b45('0x6e')),['id',_0x8b45('0x6c')]];}else{if(!_[_0x8b45('0x68')](_0x19152b[_0x8b45('0x41')][_0x8b45('0x69')])){_0x37f580['id']={'$notIn':_0x19152b[_0x8b45('0x41')][_0x8b45('0x69')]};}_0x3b3d21=[[_0x8b45('0x6f'),_0x8b45('0x6c')],[_0x8b45('0x6b'),_0x8e5a41[0x0]['dialOrderByScheduledAt']],db[_0x8b45('0x64')][_0x8b45('0x6d')](_0x8b45('0x70')),['id',_0x8b45('0x6a')]];}return db[_0x8b45('0x13')][_0x8b45('0x71')]({'attributes':['id',_0x8b45('0x72'),_0x8b45('0x54'),_0x8b45('0x73')],'where':_0x37f580,'order':_0x3b3d21,'transaction':_0xf1ab37,'lock':_0xf1ab37[_0x8b45('0x74')][_0x8b45('0x75')],'include':[{'model':db[_0x8b45('0x58')],'as':_0x8b45('0x76'),'attributes':_0x6a77bd,'include':[{'model':db[_0x8b45('0x77')],'as':_0x8b45('0x78'),'attributes':['id','name']}]},{'model':db[_0x8b45('0x79')],'as':_0x8b45('0x7a'),'attributes':['id',_0x8b45('0xf')]},{'model':db[_0x8b45('0x46')],'as':_0x8b45('0x7b'),'attributes':['id',_0x8b45('0xf'),_0x8b45('0x7c')]}]})[_0x8b45('0xc')](function(_0x47d8f7){if(_0x47d8f7){return _0x47d8f7[_0x8b45('0xb')]({'UserId':_0x19152b[_0x8b45('0x4d')]['id']},{'transaction':_0xf1ab37});}});});}})[_0x8b45('0xc')](handleEntityNotFound(_0x19c80e,null))[_0x8b45('0xc')](respondWithResult(_0x19c80e,null))[_0x8b45('0x3a')](handleError(_0x19c80e,null));};exports[_0x8b45('0x7d')]=function(_0xd5a325,_0x9b123d,_0x2a6fee){var _0xd19d7c=[];var _0x2d0045=_0xd5a325['params']['id'];var _0x4b5cd7=_0xd5a325[_0x8b45('0x4d')]['id'];return db[_0x8b45('0x58')][_0x8b45('0x42')]()[_0x8b45('0xc')](function(_0x6a235a){_0xd19d7c=_[_0x8b45('0x3c')](_0x6a235a);return db[_0x8b45('0x64')][_0x8b45('0x7e')](function(_0x63ab53){const _0x4b3fb3={'id':_0x2d0045};return db['CmHopper'][_0x8b45('0x71')]({'attributes':['id',_0x8b45('0x72'),_0x8b45('0x73')],'where':_0x4b3fb3,'transaction':_0x63ab53,'lock':_0x63ab53[_0x8b45('0x74')]['UPDATE'],'include':[{'model':db[_0x8b45('0x58')],'as':_0x8b45('0x76'),'attributes':_0xd19d7c,'include':[{'model':db[_0x8b45('0x77')],'as':_0x8b45('0x78'),'attributes':['id',_0x8b45('0xf')]}]},{'model':db[_0x8b45('0x79')],'as':'List','attributes':['id','name']},{'model':db[_0x8b45('0x46')],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x8b45('0xc')](function(_0x170b95){if(_0x170b95){return _0x170b95[_0x8b45('0xb')]({'UserId':_0x4b5cd7},{'transaction':_0x63ab53});}});});})[_0x8b45('0xc')](handleEntityNotFound(_0x9b123d,null))[_0x8b45('0xc')](respondWithResult(_0x9b123d,null))[_0x8b45('0x3a')](handleError(_0x9b123d,null));};exports[_0x8b45('0x7f')]=function(_0xc9be77,_0xc89fc6){return _0xc9be77[_0x8b45('0x4d')][_0x8b45('0x61')]({'where':{'type':_0x8b45('0x62'),'dialActive':!![],'dialMethod':_0x8b45('0x63')},'attributes':['id'],'raw':!![]})[_0x8b45('0xc')](function(_0x42b192){if(_0x42b192&&_0x42b192['length']){return db[_0x8b45('0x13')][_0x8b45('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8b45('0x51')](_0x8b45('0x52'))},'VoiceQueueId':{'$in':_[_0x8b45('0x12')](_0x42b192,'id')},'$or':[{'UserId':null},{'UserId':_0xc9be77[_0x8b45('0x4d')]['id']}]}});}return 0x0;})[_0x8b45('0xc')](function(_0x251584){if(!_[_0x8b45('0x5b')](_0x251584)&&_[_0x8b45('0x80')](_0x251584)){return _0xc89fc6['status'](0xc8)[_0x8b45('0xa')]({'contacts':_0x251584});}else{logger[_0x8b45('0xd')](_0x8b45('0x81'),_0x8b45('0x7f'),0x194,'entity\x20not\x20found');_0xc89fc6[_0x8b45('0x82')](0x194);}})['catch'](handleError(_0xc89fc6,null));};exports[_0x8b45('0x83')]=function(_0x55acc4,_0x2d3b89){var _0x6966ea=shared[_0x8b45('0x84')];var _0x3e4437=[];_[_0x8b45('0x12')](_0x6966ea,function(_0x45beb9){_0x3e4437['push']({'id':_0x45beb9[_0x8b45('0xf')],'name':_0x45beb9[_0x8b45('0xf')],'utcOffset':_0x45beb9[_0x8b45('0x85')]});});return _0x2d3b89[_0x8b45('0x5')](0xc8)['json']({'tz':_0x3e4437});};exports[_0x8b45('0x86')]=function(_0x3bdd64,_0x4adb06){var _0x5c3dbd=shared[_0x8b45('0x84')];var _0x24a570={};if(!_[_0x8b45('0x5b')](_0x5c3dbd[_0x3bdd64['body']['id']]))_0x24a570=_0x5c3dbd[_0x3bdd64[_0x8b45('0x41')]['id']];return _0x4adb06['status'](0xc8)[_0x8b45('0xa')](_0x24a570);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8e8b7b9..cc789f1 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 _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 +var _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0xe7f261,_0x549392){var _0x2eda0a=function(_0x389fc0){while(--_0x389fc0){_0xe7f261['push'](_0xe7f261['shift']());}};_0x2eda0a(++_0x549392);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x86d3('0x9')]},{'name':_0x86d3('0xa'),'fields':[_0x86d3('0xa')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 10b6e9b..a09f40a 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 _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 +var _0xfde6=['CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','literal','\x20MINUTE','NOW()','name','List','util','moment','../../mysqldb','rpc','GetCmHopper','CmHopper','options','attributes','limit','include','model','map','then','debug','error','message','where','info','stringify','catch','ShowCmHopper','CreateCmHopper','create','update','raw','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','findAll','order','LOCK','UPDATE','keys','User','Agent','voicePause','length','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0xfde6,0xaf));var _0x6fde=function(_0x2237bb,_0x46a955){_0x2237bb=_0x2237bb-0x0;var _0xdb379b=_0xfde6[_0x2237bb];return _0xdb379b;};'use strict';var _=require('lodash');var util=require(_0x6fde('0x0'));var moment=require(_0x6fde('0x1'));var BPromise=require('bluebird');var db=require(_0x6fde('0x2'))['db'];var logger=require('../../config/logger')(_0x6fde('0x3'));exports[_0x6fde('0x4')]=function(_0x4aeb66){var _0x2eebf9=this;return new Promise(function(_0x43e3b6,_0xd3f939){return db[_0x6fde('0x5')]['findAll']({'raw':_0x4aeb66['options']?_0x4aeb66[_0x6fde('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x4aeb66[_0x6fde('0x6')]?_0x4aeb66[_0x6fde('0x6')]['where']||null:null,'attributes':_0x4aeb66[_0x6fde('0x6')]?_0x4aeb66[_0x6fde('0x6')][_0x6fde('0x7')]||null:null,'limit':_0x4aeb66[_0x6fde('0x6')]?_0x4aeb66[_0x6fde('0x6')][_0x6fde('0x8')]||null:null,'include':_0x4aeb66[_0x6fde('0x6')]?_0x4aeb66[_0x6fde('0x6')][_0x6fde('0x9')]?_['map'](_0x4aeb66[_0x6fde('0x6')][_0x6fde('0x9')],function(_0x5ba24c){return{'model':db[_0x5ba24c[_0x6fde('0xa')]],'as':_0x5ba24c['as'],'attributes':_0x5ba24c[_0x6fde('0x7')],'include':_0x5ba24c['include']?_[_0x6fde('0xb')](_0x5ba24c[_0x6fde('0x9')],function(_0x29812c){return{'model':db[_0x29812c[_0x6fde('0xa')]],'as':_0x29812c['as'],'attributes':_0x29812c[_0x6fde('0x7')],'include':_0x29812c['include']?_[_0x6fde('0xb')](_0x29812c[_0x6fde('0x9')],function(_0x233680){return{'model':db[_0x233680['model']],'as':_0x233680['as'],'attributes':_0x233680[_0x6fde('0x7')]};}):[]};}):[]};}):[]:[]})[_0x6fde('0xc')](function(_0x1740c7){logger['info'](_0x6fde('0x4'),_0x4aeb66);logger[_0x6fde('0xd')](_0x6fde('0x4'),_0x4aeb66,JSON['stringify'](_0x1740c7));_0x43e3b6(_0x1740c7);})['catch'](function(_0x1f8da0){logger[_0x6fde('0xe')](_0x6fde('0x4'),_0x1f8da0[_0x6fde('0xf')],_0x4aeb66);_0xd3f939(_0x2eebf9[_0x6fde('0xe')](0x1f4,_0x1f8da0['message']));});});};exports['ShowCmHopper']=function(_0x5a9b90){var _0x5a0877=this;return new Promise(function(_0x382d22,_0x4a8a0d){return db['CmHopper']['find']({'raw':_0x5a9b90['options']?_0x5a9b90[_0x6fde('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x5a9b90[_0x6fde('0x6')]?_0x5a9b90[_0x6fde('0x6')][_0x6fde('0x10')]||null:null,'attributes':_0x5a9b90['options']?_0x5a9b90['options'][_0x6fde('0x7')]||null:null,'include':_0x5a9b90[_0x6fde('0x6')]?_0x5a9b90[_0x6fde('0x6')][_0x6fde('0x9')]?_[_0x6fde('0xb')](_0x5a9b90[_0x6fde('0x6')]['include'],function(_0x139fca){return{'model':db[_0x139fca[_0x6fde('0xa')]],'as':_0x139fca['as'],'attributes':_0x139fca[_0x6fde('0x7')],'include':_0x139fca[_0x6fde('0x9')]?_[_0x6fde('0xb')](_0x139fca[_0x6fde('0x9')],function(_0x8c2f8f){return{'model':db[_0x8c2f8f[_0x6fde('0xa')]],'as':_0x8c2f8f['as'],'attributes':_0x8c2f8f['attributes'],'include':_0x8c2f8f['include']?_[_0x6fde('0xb')](_0x8c2f8f[_0x6fde('0x9')],function(_0x282159){return{'model':db[_0x282159[_0x6fde('0xa')]],'as':_0x282159['as'],'attributes':_0x282159[_0x6fde('0x7')]};}):[]};}):[]};}):[]:[]})[_0x6fde('0xc')](function(_0x96491e){logger[_0x6fde('0x11')]('ShowCmHopper',_0x5a9b90);logger[_0x6fde('0xd')]('ShowCmHopper',_0x5a9b90,JSON[_0x6fde('0x12')](_0x96491e));_0x382d22(_0x96491e);})[_0x6fde('0x13')](function(_0x232524){logger['error'](_0x6fde('0x14'),_0x232524[_0x6fde('0xf')],_0x5a9b90);_0x4a8a0d(_0x5a0877['error'](0x1f4,_0x232524[_0x6fde('0xf')]));});});};exports[_0x6fde('0x15')]=function(_0x51981a){var _0x56361f=this;return new Promise(function(_0x5a6c86,_0x27da2c){return db[_0x6fde('0x5')][_0x6fde('0x16')](_0x51981a['body'],{'raw':_0x51981a['options']?_0x51981a['options']['raw']===undefined?!![]:![]:!![]})[_0x6fde('0xc')](function(_0x4ceaba){logger[_0x6fde('0x11')](_0x6fde('0x15'),_0x51981a);logger['debug'](_0x6fde('0x15'),_0x51981a,JSON[_0x6fde('0x12')](_0x4ceaba));_0x5a6c86(_0x4ceaba);})[_0x6fde('0x13')](function(_0x1accbe){logger['error'](_0x6fde('0x15'),_0x1accbe[_0x6fde('0xf')],_0x51981a);_0x27da2c(_0x56361f[_0x6fde('0xe')](0x1f4,_0x1accbe[_0x6fde('0xf')]));});});};exports['UpdateCmHopper']=function(_0x599365){var _0x10cae9=this;return new Promise(function(_0x4c4cbf,_0x1cc864){return db[_0x6fde('0x5')][_0x6fde('0x17')](_0x599365['body'],{'raw':_0x599365[_0x6fde('0x6')]?_0x599365[_0x6fde('0x6')][_0x6fde('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x599365[_0x6fde('0x6')]?_0x599365['options'][_0x6fde('0x10')]||null:null,'attributes':_0x599365[_0x6fde('0x6')]?_0x599365['options'][_0x6fde('0x7')]||null:null,'limit':_0x599365[_0x6fde('0x6')]?_0x599365[_0x6fde('0x6')][_0x6fde('0x8')]||null:null})[_0x6fde('0xc')](function(_0x4d5858){logger[_0x6fde('0x11')]('UpdateCmHopper',_0x599365);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x6fde('0x12')](_0x599365[_0x6fde('0x6')][_0x6fde('0x10')]),_0x599365[_0x6fde('0x19')]['active']);logger[_0x6fde('0xd')](_0x6fde('0x1a'),_0x599365,JSON[_0x6fde('0x12')](_0x4d5858));_0x4c4cbf(_0x4d5858);})[_0x6fde('0x13')](function(_0x7fde77){logger[_0x6fde('0xe')](_0x6fde('0x1a'),_0x7fde77[_0x6fde('0xf')],_0x599365);_0x1cc864(_0x10cae9[_0x6fde('0xe')](0x1f4,_0x7fde77['message']));});});};exports[_0x6fde('0x1b')]=function(_0x4bbd14){var _0xe2b72f=this;return new Promise(function(_0xd7f23a,_0x56a59f){return db[_0x6fde('0x5')][_0x6fde('0x1c')]({'where':_0x4bbd14['options']?_0x4bbd14[_0x6fde('0x6')][_0x6fde('0x10')]||null:null})[_0x6fde('0xc')](function(_0x3eff00){logger[_0x6fde('0x11')](_0x6fde('0x1b'),_0x4bbd14);logger['debug'](_0x6fde('0x1b'),_0x4bbd14,JSON[_0x6fde('0x12')](_0x3eff00));_0xd7f23a(_0x3eff00);})[_0x6fde('0x13')](function(_0x4ef62e){logger[_0x6fde('0xe')](_0x6fde('0x1b'),_0x4ef62e['message'],_0x4bbd14);_0x56a59f(_0xe2b72f[_0x6fde('0xe')](0x1f4,_0x4ef62e['message']));});});};exports[_0x6fde('0x1d')]=function(_0x2525a7){var _0xb90b72=this;return new Promise(function(_0x2f1544,_0x50b488){return db[_0x6fde('0x1e')][_0x6fde('0x1f')]()[_0x6fde('0xc')](function(_0x3832cd){return db['sequelize'][_0x6fde('0x20')](function(_0x494cf8){return db[_0x6fde('0x5')][_0x6fde('0x21')]({'where':_0x2525a7[_0x6fde('0x6')]?_0x2525a7[_0x6fde('0x6')]['where']||null:null,'attributes':_0x2525a7[_0x6fde('0x6')]?_0x2525a7['options'][_0x6fde('0x7')]||null:null,'limit':_0x2525a7[_0x6fde('0x6')]?_0x2525a7[_0x6fde('0x6')]['limit']||null:null,'order':_0x2525a7[_0x6fde('0x6')]?_0x2525a7[_0x6fde('0x6')][_0x6fde('0x22')]||null:null,'transaction':_0x494cf8,'lock':_0x494cf8[_0x6fde('0x23')][_0x6fde('0x24')],'include':[{'model':db[_0x6fde('0x1e')],'as':'Contact','attributes':_[_0x6fde('0x25')](_0x3832cd)},{'model':db[_0x6fde('0x26')],'as':_0x6fde('0x27'),'attributes':['id','name',_0x6fde('0x28')]}]})[_0x6fde('0xc')](function(_0xe72ea8){var _0x5a5057=[];var _0x2b7e4b=[];for(var _0x828260=0x0;_0x828260<_0xe72ea8[_0x6fde('0x29')];_0x828260+=0x1){var _0x15daa6=_0xe72ea8[_0x828260]['UserId'];if(_0x15daa6===null){_0x5a5057['push'](_0xe72ea8[_0x828260][_0x6fde('0x17')](_0x2525a7['body'],{'transaction':_0x494cf8}));}else if(!_0x2b7e4b[_0x6fde('0x2a')](_0x15daa6)){_0x2b7e4b[_0x6fde('0x2b')](_0x15daa6);_0x5a5057[_0x6fde('0x2b')](_0xe72ea8[_0x828260]['update'](_0x2525a7[_0x6fde('0x19')],{'transaction':_0x494cf8}));}}return BPromise[_0x6fde('0x2c')](_0x5a5057);});})['then'](function(_0x37569c){logger[_0x6fde('0x11')](_0x6fde('0x1d'),_0x2525a7);if(_0x37569c[_0x6fde('0x29')]>0x0){logger[_0x6fde('0x11')](_0x6fde('0x2d'),_0x37569c[0x0][_0x6fde('0x2e')]['id'],_0x37569c[0x0]['dataValues'][_0x6fde('0x2f')],_0x37569c[0x0]['dataValues'][_0x6fde('0x30')]);}logger[_0x6fde('0xd')](_0x6fde('0x1d'),_0x2525a7,JSON[_0x6fde('0x12')](_0x37569c));_0x2f1544(_0x37569c);})['catch'](function(_0x2f6abf){logger[_0x6fde('0xe')]('GetContactDialer',_0x2f6abf[_0x6fde('0xf')],_0x2525a7);_0x50b488(_0xb90b72[_0x6fde('0xe')](0x1f4,_0x2f6abf[_0x6fde('0xf')]));});});});};exports[_0x6fde('0x31')]=function(_0x4d74b3){var _0x430cf5=this;return new Promise(function(_0x537b4e,_0x54d1e7){return db[_0x6fde('0x32')][_0x6fde('0x20')](function(_0x207762){return db[_0x6fde('0x33')]['create'](_0x4d74b3[_0x6fde('0x19')],{'raw':_0x4d74b3[_0x6fde('0x6')]?_0x4d74b3['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x207762})[_0x6fde('0xc')](function(){logger[_0x6fde('0x11')](_0x6fde('0x34'),JSON['stringify'](_0x4d74b3['options'][_0x6fde('0x10')]),_0x4d74b3[_0x6fde('0x6')][_0x6fde('0x10')][_0x6fde('0x30')]);return db['CmHopper'][_0x6fde('0x1c')]({'where':_0x4d74b3[_0x6fde('0x6')]?_0x4d74b3[_0x6fde('0x6')][_0x6fde('0x10')]||null:null,'transaction':_0x207762});});})[_0x6fde('0xc')](function(_0x158e81){logger[_0x6fde('0x11')](_0x6fde('0x31'),_0x4d74b3);logger[_0x6fde('0xd')](_0x6fde('0x31'),_0x4d74b3,JSON[_0x6fde('0x12')](_0x158e81));_0x537b4e(_0x158e81);})[_0x6fde('0x13')](function(_0x3fa047){logger[_0x6fde('0xe')](_0x6fde('0x31'),_0x3fa047['message'],_0x4d74b3);_0x54d1e7(_0x430cf5[_0x6fde('0xe')](0x1f4,_0x3fa047[_0x6fde('0xf')]));});});};exports[_0x6fde('0x35')]=function(_0x3ccc1f){var _0xdceeb4=this;return new Promise(function(_0x4af212,_0x203788){return db['CmHopper'][_0x6fde('0x21')]({'raw':_0x3ccc1f[_0x6fde('0x6')]?_0x3ccc1f[_0x6fde('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x3ccc1f[_0x6fde('0x6')]?_0x3ccc1f[_0x6fde('0x6')][_0x6fde('0x10')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6fde('0x36'),db['sequelize']['fn']('IF',db[_0x6fde('0x32')]['literal'](_0x6fde('0x37')+util[_0x6fde('0x38')](_0x6fde('0x39'),moment()[_0x6fde('0x38')](_0x6fde('0x3a')))+'\x20,\x201,\x20null'))),_0x6fde('0x3b')]]})['then'](function(_0x2c79e1){logger[_0x6fde('0x11')](_0x6fde('0x35'),_0x3ccc1f);logger[_0x6fde('0xd')](_0x6fde('0x35'),_0x3ccc1f,JSON[_0x6fde('0x12')](_0x2c79e1));_0x4af212(_0x2c79e1);})['catch'](function(_0x1cebe1){logger[_0x6fde('0xe')](_0x6fde('0x35'),_0x1cebe1['message'],_0x3ccc1f);_0x203788(_0xdceeb4[_0x6fde('0xe')](0x1f4,_0x1cebe1['message']));});});};exports[_0x6fde('0x3c')]=function(_0x2860c9){var _0x5a370a=this;return new Promise(function(_0x275621,_0x471159){return db[_0x6fde('0x1e')][_0x6fde('0x1f')]()[_0x6fde('0xc')](function(){return db[_0x6fde('0x32')][_0x6fde('0x20')](function(_0x4ef465){return db[_0x6fde('0x5')]['findAll']({'where':_0x2860c9[_0x6fde('0x6')]?_0x2860c9[_0x6fde('0x6')][_0x6fde('0x10')]||null:null,'attributes':_0x2860c9[_0x6fde('0x6')]?_0x2860c9[_0x6fde('0x6')][_0x6fde('0x7')]||null:null,'limit':0x1,'order':_0x2860c9[_0x6fde('0x6')]?_0x2860c9[_0x6fde('0x6')][_0x6fde('0x22')]||null:null,'group':db[_0x6fde('0x5')][_0x6fde('0x3d')],'transaction':_0x4ef465,'lock':_0x4ef465['LOCK'][_0x6fde('0x24')],'include':_0x2860c9['options']?_0x2860c9[_0x6fde('0x6')][_0x6fde('0x9')]?_['map'](_0x2860c9[_0x6fde('0x6')][_0x6fde('0x9')],function(_0x38898b){return{'model':db[_0x38898b[_0x6fde('0xa')]],'as':_0x38898b['as'],'attributes':_0x38898b['attributes'],'include':_0x38898b[_0x6fde('0x9')]?_[_0x6fde('0xb')](_0x38898b[_0x6fde('0x9')],function(_0x18c24d){return{'model':db[_0x18c24d['model']],'as':_0x18c24d['as'],'attributes':_0x18c24d['attributes'],'include':_0x18c24d[_0x6fde('0x9')]?_['map'](_0x18c24d[_0x6fde('0x9')],function(_0x1edc48){return{'model':db[_0x1edc48[_0x6fde('0xa')]],'as':_0x1edc48['as'],'attributes':_0x1edc48['attributes']};}):[]};}):[]};}):[]:[]})[_0x6fde('0xc')](function(_0x271263){var _0x3d0685=[];for(var _0x3e2db1=0x0;_0x3e2db1<_0x271263['length'];_0x3e2db1+=0x1){_0x3d0685['push'](_0x271263[_0x3e2db1][_0x6fde('0x17')](_0x2860c9[_0x6fde('0x19')],{'transaction':_0x4ef465}));}return BPromise[_0x6fde('0x2c')](_0x3d0685);});})['then'](function(_0x21f792){logger['info'](_0x6fde('0x3c'),_0x2860c9);logger[_0x6fde('0xd')](_0x6fde('0x3c'),_0x2860c9,JSON[_0x6fde('0x12')](_0x21f792));_0x275621(_0x21f792);})[_0x6fde('0x13')](function(_0x46636d){logger['error'](_0x6fde('0x3c'),_0x46636d[_0x6fde('0xf')],_0x2860c9);_0x471159(_0x5a370a[_0x6fde('0xe')](0x1f4,_0x46636d[_0x6fde('0xf')]));});});});};exports[_0x6fde('0x3e')]=function(_0x51f268){var _0x344e1b=this;return new Promise(function(_0x41f7ee,_0x1328da){db['CmContact'][_0x6fde('0x1f')]()['then'](function(_0x3430a6){return db[_0x6fde('0x5')]['findAll']({'raw':_0x51f268['options']?_0x51f268['options'][_0x6fde('0x18')]===undefined?!![]:![]:!![],'where':_0x51f268[_0x6fde('0x6')]?_0x51f268[_0x6fde('0x6')][_0x6fde('0x10')]||null:null,'attributes':_0x51f268[_0x6fde('0x6')]?_0x51f268[_0x6fde('0x6')][_0x6fde('0x7')]||null:null,'limit':_0x51f268[_0x6fde('0x6')]?_0x51f268[_0x6fde('0x6')][_0x6fde('0x8')]||null:null,'include':_0x51f268['options']?_0x51f268[_0x6fde('0x6')][_0x6fde('0x9')]?_[_0x6fde('0xb')](_0x51f268[_0x6fde('0x6')]['include'],function(_0x310b62){return{'model':db[_0x310b62[_0x6fde('0xa')]],'as':_0x310b62['as'],'attributes':_0x310b62['as']==='Contact'?_[_0x6fde('0x25')](_0x3430a6):_0x310b62[_0x6fde('0x7')],'include':_0x310b62[_0x6fde('0x9')]?_['map'](_0x310b62[_0x6fde('0x9')],function(_0xf59fc1){return{'model':db[_0xf59fc1[_0x6fde('0xa')]],'as':_0xf59fc1['as'],'attributes':_0xf59fc1['attributes'],'include':_0xf59fc1[_0x6fde('0x9')]?_[_0x6fde('0xb')](_0xf59fc1[_0x6fde('0x9')],function(_0x3d78a6){return{'model':db[_0x3d78a6[_0x6fde('0xa')]],'as':_0x3d78a6['as'],'attributes':_0x3d78a6[_0x6fde('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf5a867){logger[_0x6fde('0x11')]('GetCmHopper',_0x51f268);logger['debug'](_0x6fde('0x4'),_0x51f268,JSON['stringify'](_0xf5a867));_0x41f7ee(_0xf5a867);})['catch'](function(_0x4b5046){logger[_0x6fde('0xe')]('GetCmHopper',_0x4b5046[_0x6fde('0xf')],_0x51f268);_0x1328da(_0x344e1b[_0x6fde('0xe')](0x1f4,_0x4b5046[_0x6fde('0xf')]));});});});};exports[_0x6fde('0x3f')]=function(_0x1c0d75){var _0x16cefb=this;return new Promise(function(_0x365e2f,_0x588c1d){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x1c0d75['options']['where'][_0x6fde('0x40')]},'attributes':['id','dialTimezone'],'order':[['id',_0x6fde('0x41')]]})[_0x6fde('0xc')](function(_0x46e930){logger[_0x6fde('0x11')](_0x6fde('0x42'),_0x1c0d75);logger['debug'](_0x6fde('0x42'),_0x1c0d75,JSON[_0x6fde('0x12')](_0x46e930));_0x365e2f(_0x46e930);})[_0x6fde('0x13')](function(_0x283f1e){logger[_0x6fde('0xe')](_0x6fde('0x42'),_0x283f1e[_0x6fde('0xf')],_0x1c0d75);_0x588c1d(_0x16cefb['error'](0x1f4,_0x283f1e[_0x6fde('0xf')]));});});};exports['ResetActiveCalls']=function(_0x1670ee){var _0x370984=this;return new Promise(function(_0x38ad44,_0xba9b71){return db[_0x6fde('0x32')]['transaction'](function(_0x273a1c){var _0x360597=_0x1670ee[_0x6fde('0x6')]&&_0x1670ee[_0x6fde('0x6')]['where']?_0x1670ee['options'][_0x6fde('0x10')]:{};return db[_0x6fde('0x5')][_0x6fde('0x17')](_0x1670ee[_0x6fde('0x19')],{'where':_0x360597,'transaction':_0x273a1c})[_0x6fde('0xc')](function(_0x932657){logger[_0x6fde('0x11')](_0x6fde('0x43'),_0x1670ee);logger[_0x6fde('0xd')](_0x6fde('0x43'),_0x1670ee,JSON[_0x6fde('0x12')](_0x932657));_0x38ad44(_0x932657);})[_0x6fde('0x13')](function(_0x3355fa){logger[_0x6fde('0xe')](_0x6fde('0x43'),_0x3355fa[_0x6fde('0xf')],_0x1670ee);_0xba9b71(_0x370984[_0x6fde('0xe')](0x1f4,_0x3355fa[_0x6fde('0xf')]));});});});};exports[_0x6fde('0x44')]=function(_0x3313ab){var _0x34b2b5=this;var _0x4fb7b7=_0x3313ab[_0x6fde('0x19')]['where'][_0x6fde('0x45')];var _0x1f2e8c=_0x3313ab[_0x6fde('0x19')][_0x6fde('0x10')]['interval'];var _0x8937a2=_0x3313ab[_0x6fde('0x19')][_0x6fde('0x10')][_0x6fde('0x46')];return new Promise(function(_0x3a049e,_0x3ec649){return db['CmHopper'][_0x6fde('0x21')]({'where':{'voiceQueueId':{'$in':_0x4fb7b7},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x6fde('0x32')][_0x6fde('0x47')]('NOW()\x20+\x20INTERVAL\x20'+_0x1f2e8c+_0x6fde('0x48')),'$gt':db[_0x6fde('0x32')][_0x6fde('0x47')](_0x6fde('0x49'))}},'UserId':{'$in':_0x8937a2}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db['User'],'as':_0x6fde('0x27'),'attributes':['id',_0x6fde('0x4a'),_0x6fde('0x28')]},{'model':db['CmList'],'as':_0x6fde('0x4b')}]})[_0x6fde('0xc')](function(_0x1a494a){if(_0x1a494a[_0x6fde('0x29')]>0x0){return db[_0x6fde('0x32')][_0x6fde('0x20')](function(_0x4dc34a){return db['CmHopper'][_0x6fde('0x17')]({'recallmeNotifiedDate':db[_0x6fde('0x32')]['literal'](_0x6fde('0x49'))},{'where':{'id':{'$in':_[_0x6fde('0xb')](_0x1a494a,'id')}},'transaction':_0x4dc34a})[_0x6fde('0xc')](function(){_0x3a049e(_0x1a494a);})[_0x6fde('0x13')](function(_0xbf6003){logger['error']('CmHopperHandlePreviewRecallNotifications',_0xbf6003[_0x6fde('0xf')],_0x3313ab);_0x3ec649(_0x34b2b5[_0x6fde('0xe')](0x1f4,_0xbf6003['message']));});})[_0x6fde('0x13')](function(_0x4ddd79){logger['error'](_0x6fde('0x44'),_0x4ddd79[_0x6fde('0xf')],_0x3313ab);_0x3ec649(_0x34b2b5[_0x6fde('0xe')](0x1f4,_0x4ddd79[_0x6fde('0xf')]));});}else{_0x3a049e(_0x1a494a);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 8226c4f..cd026cd 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 _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 +var _0xc172=['getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','post','create','/timezone','getTimezone','put','update','delete','exports','Router','../../components/auth/service','./cmHopper.controller','get','/describe','isAuthenticated','/opencontacts'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc172,0x161));var _0x2c17=function(_0x3d0ee4,_0x34c4fa){_0x3d0ee4=_0x3d0ee4-0x0;var _0x2c4202=_0xc172[_0x3d0ee4];return _0x2c4202;};'use strict';var express=require('express');var router=express[_0x2c17('0x0')]();var auth=require(_0x2c17('0x1'));var controller=require(_0x2c17('0x2'));router[_0x2c17('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2c17('0x3')](_0x2c17('0x4'),auth[_0x2c17('0x5')](),controller['describe']);router['get'](_0x2c17('0x6'),auth[_0x2c17('0x5')](),controller[_0x2c17('0x7')]);router[_0x2c17('0x3')](_0x2c17('0x8'),auth[_0x2c17('0x5')](),controller[_0x2c17('0x9')]);router[_0x2c17('0x3')](_0x2c17('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2c17('0x3')](_0x2c17('0xb'),auth[_0x2c17('0x5')](),controller['getPreviewRecall']);router[_0x2c17('0xc')]('/',auth['isAuthenticated'](),controller[_0x2c17('0xd')]);router[_0x2c17('0xc')]('/preview',auth[_0x2c17('0x5')](),controller['getPreview']);router[_0x2c17('0xc')](_0x2c17('0xe'),auth[_0x2c17('0x5')](),controller[_0x2c17('0xf')]);router[_0x2c17('0x10')](_0x2c17('0xa'),auth[_0x2c17('0x5')](),controller[_0x2c17('0x11')]);router[_0x2c17('0x12')](_0x2c17('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2c17('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index baaa28e..63b4b6f 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 _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 +var _0x64d9=['exports','INTEGER','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0xea43d,_0x4246e8){var _0x53e4c1=function(_0x35b6d8){while(--_0x35b6d8){_0xea43d['push'](_0xea43d['shift']());}};_0x53e4c1(++_0x4246e8);}(_0x64d9,0x1cb));var _0x964d=function(_0x2a0e5c,_0x29daeb){_0x2a0e5c=_0x2a0e5c-0x0;var _0x289d4b=_0x64d9[_0x2a0e5c];return _0x289d4b;};'use strict';var moment=require('moment');var Sequelize=require(_0x964d('0x0'));module[_0x964d('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x964d('0x3')](_0x964d('0x4'))},'countbusyretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x964d('0x2')],'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 a3cab27..bce13ee 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 _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 +var _0xb2b1=['sort','pick','filter','where','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xb2b1,0x11d));var _0x1b2b=function(_0x239089,_0x511f9b){_0x239089=_0x239089-0x0;var _0x3ac7f1=_0xb2b1[_0x239089];return _0x3ac7f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b2b('0x0'));var zipdir=require(_0x1b2b('0x1'));var jsonpatch=require(_0x1b2b('0x2'));var rp=require(_0x1b2b('0x3'));var moment=require(_0x1b2b('0x4'));var BPromise=require(_0x1b2b('0x5'));var Mustache=require(_0x1b2b('0x6'));var util=require('util');var path=require(_0x1b2b('0x7'));var sox=require(_0x1b2b('0x8'));var csv=require(_0x1b2b('0x9'));var ejs=require(_0x1b2b('0xa'));var fs=require('fs');var fs_extra=require(_0x1b2b('0xb'));var _=require(_0x1b2b('0xc'));var squel=require(_0x1b2b('0xd'));var crypto=require(_0x1b2b('0xe'));var jsforce=require(_0x1b2b('0xf'));var deskjs=require(_0x1b2b('0x10'));var toCsv=require(_0x1b2b('0x9'));var querystring=require('querystring');var Papa=require(_0x1b2b('0x11'));var Redis=require(_0x1b2b('0x12'));var authService=require(_0x1b2b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1b2b('0x14'));var hardwareService=require(_0x1b2b('0x15'));var logger=require('../../config/logger')(_0x1b2b('0x16'));var utils=require(_0x1b2b('0x17'));var config=require(_0x1b2b('0x18'));var licenseUtil=require(_0x1b2b('0x19'));var db=require(_0x1b2b('0x1a'))['db'];function respondWithStatusCode(_0x3ce305,_0x569fd6){_0x569fd6=_0x569fd6||0xcc;return function(_0x9d8123){if(_0x9d8123){return _0x3ce305['sendStatus'](_0x569fd6);}return _0x3ce305['status'](_0x569fd6)[_0x1b2b('0x1b')]();};}function respondWithResult(_0x52f5b9,_0x2885f0){_0x2885f0=_0x2885f0||0xc8;return function(_0x5ec046){if(_0x5ec046){return _0x52f5b9['status'](_0x2885f0)['json'](_0x5ec046);}};}function respondWithFilteredResult(_0x49a96e,_0x253df0){return function(_0x515fe6){if(_0x515fe6){var _0x73dfd2=typeof _0x253df0[_0x1b2b('0x1c')]==='undefined'&&typeof _0x253df0['limit']==='undefined';var _0x48598a=_0x515fe6[_0x1b2b('0x1d')];var _0x18c742=_0x73dfd2?0x0:_0x253df0[_0x1b2b('0x1c')];var _0x3ce292=_0x73dfd2?_0x515fe6[_0x1b2b('0x1d')]:_0x253df0[_0x1b2b('0x1c')]+_0x253df0[_0x1b2b('0x1e')];var _0x34bfa9;if(_0x3ce292>=_0x48598a){_0x3ce292=_0x48598a;_0x34bfa9=0xc8;}else{_0x34bfa9=0xce;}_0x49a96e[_0x1b2b('0x1f')](_0x34bfa9);return _0x49a96e[_0x1b2b('0x20')](_0x1b2b('0x21'),_0x18c742+'-'+_0x3ce292+'/'+_0x48598a)[_0x1b2b('0x22')](_0x515fe6);}return null;};}function patchUpdates(_0x275c26){return function(_0x250095){try{jsonpatch[_0x1b2b('0x23')](_0x250095,_0x275c26,!![]);}catch(_0x292746){return BPromise[_0x1b2b('0x24')](_0x292746);}return _0x250095[_0x1b2b('0x25')]();};}function saveUpdates(_0x10335f,_0x286517){return function(_0x41c33b){if(_0x41c33b){return _0x41c33b[_0x1b2b('0x26')](_0x10335f)[_0x1b2b('0x27')](function(_0x417a7d){return _0x417a7d;});}return null;};}function removeEntity(_0x5b997d,_0x5343b0){return function(_0x3b121f){if(_0x3b121f){return _0x3b121f[_0x1b2b('0x28')]()[_0x1b2b('0x27')](function(){var _0x201f45=_0x3b121f[_0x1b2b('0x29')]({'plain':!![]});var _0x5b5a96=_0x1b2b('0x2a');return db[_0x1b2b('0x2b')]['destroy']({'where':{'type':_0x5b5a96,'resourceId':_0x201f45['id']}})[_0x1b2b('0x27')](function(){return _0x3b121f;});})['then'](function(){_0x5b997d['status'](0xcc)[_0x1b2b('0x1b')]();});}};}function handleEntityNotFound(_0x32124a,_0x4be326){return function(_0x1e0064){if(!_0x1e0064){_0x32124a[_0x1b2b('0x2c')](0x194);}return _0x1e0064;};}function handleError(_0x49d084,_0x568f0e){_0x568f0e=_0x568f0e||0x1f4;return function(_0x27b291){logger['error'](_0x27b291['stack']);if(_0x27b291[_0x1b2b('0x2d')]){delete _0x27b291['name'];}_0x49d084[_0x1b2b('0x1f')](_0x568f0e)[_0x1b2b('0x2e')](_0x27b291);};}exports[_0x1b2b('0x2f')]=function(_0x3c3656,_0x35e914){var _0x13e16b={},_0x130a21={},_0x1176f1={'count':0x0,'rows':[]};var _0x5f3b69=_[_0x1b2b('0x30')](db[_0x1b2b('0x31')][_0x1b2b('0x32')],function(_0x3ff4f9){return{'name':_0x3ff4f9['fieldName'],'type':_0x3ff4f9[_0x1b2b('0x33')][_0x1b2b('0x34')]};});_0x130a21[_0x1b2b('0x35')]=_[_0x1b2b('0x30')](_0x5f3b69,_0x1b2b('0x2d'));_0x130a21[_0x1b2b('0x36')]=_[_0x1b2b('0x37')](_0x3c3656[_0x1b2b('0x36')]);_0x130a21[_0x1b2b('0x38')]=_['intersection'](_0x130a21[_0x1b2b('0x35')],_0x130a21[_0x1b2b('0x36')]);_0x13e16b[_0x1b2b('0x39')]=_[_0x1b2b('0x3a')](_0x130a21[_0x1b2b('0x35')],qs['fields'](_0x3c3656[_0x1b2b('0x36')][_0x1b2b('0x3b')]));_0x13e16b['attributes']=_0x13e16b[_0x1b2b('0x39')]['length']?_0x13e16b['attributes']:_0x130a21['model'];if(!_0x3c3656['query'][_0x1b2b('0x3c')](_0x1b2b('0x3d'))){_0x13e16b[_0x1b2b('0x1e')]=qs[_0x1b2b('0x1e')](_0x3c3656[_0x1b2b('0x36')][_0x1b2b('0x1e')]);_0x13e16b['offset']=qs[_0x1b2b('0x1c')](_0x3c3656[_0x1b2b('0x36')][_0x1b2b('0x1c')]);}_0x13e16b[_0x1b2b('0x3e')]=qs[_0x1b2b('0x3f')](_0x3c3656[_0x1b2b('0x36')][_0x1b2b('0x3f')]);_0x13e16b['where']=qs[_0x1b2b('0x38')](_[_0x1b2b('0x40')](_0x3c3656[_0x1b2b('0x36')],_0x130a21[_0x1b2b('0x38')]),_0x5f3b69);if(_0x3c3656['query'][_0x1b2b('0x41')]){_0x13e16b[_0x1b2b('0x42')]=_['merge'](_0x13e16b[_0x1b2b('0x42')],{'$or':_[_0x1b2b('0x30')](_0x5f3b69,function(_0x48865a){if(_0x48865a['type']!==_0x1b2b('0x43')){var _0x12d2ed={};_0x12d2ed[_0x48865a['name']]={'$like':'%'+_0x3c3656[_0x1b2b('0x36')][_0x1b2b('0x41')]+'%'};return _0x12d2ed;}})});}_0x13e16b=_['merge']({},_0x13e16b,_0x3c3656[_0x1b2b('0x44')]);var _0x1065f4={'where':_0x13e16b[_0x1b2b('0x42')]};return db['CmHopperAdditionalPhone']['count'](_0x1065f4)['then'](function(_0x77b32b){_0x1176f1[_0x1b2b('0x1d')]=_0x77b32b;if(_0x3c3656[_0x1b2b('0x36')]['includeAll']){_0x13e16b[_0x1b2b('0x45')]=[{'all':!![]}];}return db[_0x1b2b('0x31')]['findAll'](_0x13e16b);})['then'](function(_0x1c83a5){_0x1176f1[_0x1b2b('0x46')]=_0x1c83a5;return _0x1176f1;})[_0x1b2b('0x27')](respondWithFilteredResult(_0x35e914,_0x13e16b))[_0x1b2b('0x47')](handleError(_0x35e914,null));};exports[_0x1b2b('0x48')]=function(_0xa72896,_0x4ee4a0){var _0x388fa6={'raw':!![],'where':{'id':_0xa72896[_0x1b2b('0x49')]['id']}},_0x4921a7={};_0x4921a7[_0x1b2b('0x35')]=_['keys'](db[_0x1b2b('0x31')]['rawAttributes']);_0x4921a7[_0x1b2b('0x36')]=_['keys'](_0xa72896[_0x1b2b('0x36')]);_0x4921a7[_0x1b2b('0x38')]=_[_0x1b2b('0x3a')](_0x4921a7[_0x1b2b('0x35')],_0x4921a7['query']);_0x388fa6[_0x1b2b('0x39')]=_[_0x1b2b('0x3a')](_0x4921a7[_0x1b2b('0x35')],qs['fields'](_0xa72896[_0x1b2b('0x36')][_0x1b2b('0x3b')]));_0x388fa6[_0x1b2b('0x39')]=_0x388fa6[_0x1b2b('0x39')][_0x1b2b('0x4a')]?_0x388fa6[_0x1b2b('0x39')]:_0x4921a7[_0x1b2b('0x35')];if(_0xa72896[_0x1b2b('0x36')][_0x1b2b('0x4b')]){_0x388fa6[_0x1b2b('0x45')]=[{'all':!![]}];}_0x388fa6=_[_0x1b2b('0x4c')]({},_0x388fa6,_0xa72896[_0x1b2b('0x44')]);return db[_0x1b2b('0x31')]['find'](_0x388fa6)[_0x1b2b('0x27')](handleEntityNotFound(_0x4ee4a0,null))[_0x1b2b('0x27')](respondWithResult(_0x4ee4a0,null))[_0x1b2b('0x47')](handleError(_0x4ee4a0,null));};exports[_0x1b2b('0x4d')]=function(_0x3080f0,_0x490890){return db[_0x1b2b('0x31')][_0x1b2b('0x4d')](_0x3080f0[_0x1b2b('0x4e')],{})[_0x1b2b('0x27')](function(_0x3b8ab4){var _0x127738=_0x3080f0[_0x1b2b('0x4f')][_0x1b2b('0x29')]({'plain':!![]});if(!_0x127738)throw new Error(_0x1b2b('0x50'));if(_0x127738['role']===_0x1b2b('0x4f')){var _0x269867=_0x3b8ab4['get']({'plain':!![]});var _0x1aa21d='CmHopperAdditionalPhones';return db[_0x1b2b('0x51')][_0x1b2b('0x52')]({'where':{'name':_0x1aa21d,'userProfileId':_0x127738[_0x1b2b('0x53')]},'raw':!![]})[_0x1b2b('0x27')](function(_0x3950b9){if(_0x3950b9&&_0x3950b9[_0x1b2b('0x54')]===0x0){return db[_0x1b2b('0x2b')]['create']({'name':_0x269867['name'],'resourceId':_0x269867['id'],'type':_0x3950b9['name'],'sectionId':_0x3950b9['id']},{})[_0x1b2b('0x27')](function(){return _0x3b8ab4;});}else{return _0x3b8ab4;}})[_0x1b2b('0x47')](function(_0x199347){logger[_0x1b2b('0x55')](_0x1b2b('0x56'),_0x199347);throw _0x199347;});}return _0x3b8ab4;})['then'](respondWithResult(_0x490890,0xc9))[_0x1b2b('0x47')](handleError(_0x490890,null));};exports['update']=function(_0x53f1f4,_0x9ae621){if(_0x53f1f4[_0x1b2b('0x4e')]['id']){delete _0x53f1f4[_0x1b2b('0x4e')]['id'];}return db[_0x1b2b('0x31')][_0x1b2b('0x52')]({'where':{'id':_0x53f1f4[_0x1b2b('0x49')]['id']}})[_0x1b2b('0x27')](handleEntityNotFound(_0x9ae621,null))['then'](saveUpdates(_0x53f1f4[_0x1b2b('0x4e')],null))[_0x1b2b('0x27')](respondWithResult(_0x9ae621,null))[_0x1b2b('0x47')](handleError(_0x9ae621,null));};exports[_0x1b2b('0x28')]=function(_0x326c85,_0xada66d){return db[_0x1b2b('0x31')]['find']({'where':{'id':_0x326c85[_0x1b2b('0x49')]['id']}})[_0x1b2b('0x27')](handleEntityNotFound(_0xada66d,null))['then'](removeEntity(_0xada66d,null))['catch'](handleError(_0xada66d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index cab6978..0dbbc14 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 _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 +var _0xdcd9=['../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','api','request-promise','path','rimraf'];(function(_0xa7f384,_0x574bcd){var _0x57527f=function(_0x5c36b7){while(--_0x5c36b7){_0xa7f384['push'](_0xa7f384['shift']());}};_0x57527f(++_0x574bcd);}(_0xdcd9,0xf5));var _0x9dcd=function(_0x56c30b,_0x45d2b8){_0x56c30b=_0x56c30b-0x0;var _0x45168e=_0xdcd9[_0x56c30b];return _0x45168e;};'use strict';var _=require('lodash');var util=require(_0x9dcd('0x0'));var logger=require('../../config/logger')(_0x9dcd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9dcd('0x2'));var fs=require('fs');var path=require(_0x9dcd('0x3'));var rimraf=require(_0x9dcd('0x4'));var config=require(_0x9dcd('0x5'));var attributes=require(_0x9dcd('0x6'));module['exports']=function(_0x5ae811,_0xd105d3){return _0x5ae811[_0x9dcd('0x7')](_0x9dcd('0x8'),attributes,{'tableName':_0x9dcd('0x9'),'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 36bb8ca..2945c44 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 _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 +var _0x4fe5=['SwapAdditionalPhones','OrderBy','duration','waitTime','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnosuchnumberretry'];(function(_0x3e1fe8,_0x223c26){var _0x55d8e5=function(_0x15cd31){while(--_0x15cd31){_0x3e1fe8['push'](_0x3e1fe8['shift']());}};_0x55d8e5(++_0x223c26);}(_0x4fe5,0xbc));var _0x54fe=function(_0xcd9283,_0x35bd2e){_0xcd9283=_0xcd9283-0x0;var _0x1620e1=_0x4fe5[_0xcd9283];return _0x1620e1;};'use strict';var _=require(_0x54fe('0x0'));var util=require('util');var moment=require(_0x54fe('0x1'));var BPromise=require(_0x54fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54fe('0x3'));var db=require(_0x54fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54fe('0x5'));var config=require(_0x54fe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x54fe('0x7')][_0x54fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf75a2f,_0x46e422,_0x4d9244){return new BPromise(function(_0x2035c5,_0x178fe6){return client['request'](_0xf75a2f,_0x4d9244)[_0x54fe('0x9')](function(_0x379adc){logger[_0x54fe('0xa')](_0x54fe('0xb'),_0x46e422,_0x54fe('0xc'));logger[_0x54fe('0xd')](_0x54fe('0xe'),_0x46e422,_0x54fe('0xc'),JSON[_0x54fe('0xf')](_0x379adc));if(_0x379adc[_0x54fe('0x10')]){if(_0x379adc[_0x54fe('0x10')][_0x54fe('0x11')]===0x1f4){logger['error'](_0x54fe('0xb'),_0x46e422,_0x379adc['error']['message']);return _0x178fe6(_0x379adc[_0x54fe('0x10')][_0x54fe('0x12')]);}logger['error'](_0x54fe('0xb'),_0x46e422,_0x379adc['error']['message']);return _0x2035c5(_0x379adc[_0x54fe('0x10')][_0x54fe('0x12')]);}else{logger[_0x54fe('0xa')](_0x54fe('0xb'),_0x46e422,_0x54fe('0xc'));_0x2035c5(_0x379adc['result'][_0x54fe('0x12')]);}})[_0x54fe('0x13')](function(_0x40f4ec){logger[_0x54fe('0x10')](_0x54fe('0xb'),_0x46e422,_0x40f4ec);_0x178fe6(_0x40f4ec);});});}exports[_0x54fe('0x14')]=function(_0x56c673){var _0x32bd82=this;return new Promise(function(_0x825901,_0x4cb0d7){return db[_0x54fe('0x15')][_0x54fe('0x16')]({'raw':!![],'where':{'ContactId':_0x56c673['body'][_0x54fe('0x17')],'ListId':_0x56c673[_0x54fe('0x18')][_0x54fe('0x19')],'VoiceQueueId':_0x56c673[_0x54fe('0x18')][_0x54fe('0x1a')]===undefined?null:_0x56c673[_0x54fe('0x18')][_0x54fe('0x1a')],'CampaignId':_0x56c673[_0x54fe('0x18')][_0x54fe('0x1b')]===undefined?null:_0x56c673['body'][_0x54fe('0x1b')]}})[_0x54fe('0x9')](function(_0x56df8e){if(_0x56df8e!=null){return db[_0x54fe('0x1c')][_0x54fe('0x16')]({'raw':!![],'where':{'CmHopperId':_0x56df8e['id'],'OrderBy':{'$gt':_0x56df8e['OrderBy']}},'order':[['OrderBy',_0x54fe('0x1d')]]})[_0x54fe('0x9')](function(_0x597323){var _0x1577ad=0x0;if(_0x597323){if(_0x597323[_0x54fe('0x1e')]+_0x597323[_0x54fe('0x1f')]+_0x597323[_0x54fe('0x20')]+_0x597323['countnosuchnumberretry']+_0x597323[_0x54fe('0x21')]+_0x597323[_0x54fe('0x22')]+_0x597323[_0x54fe('0x23')]+_0x597323[_0x54fe('0x24')]<_0x56c673[_0x54fe('0x25')][_0x54fe('0x26')])_0x1577ad=0x1;_0x825901({'additional':_0x1577ad});}else{return db[_0x54fe('0x1c')][_0x54fe('0x16')]({'raw':!![],'where':{'CmHopperId':_0x56df8e['id']},'order':[['OrderBy','ASC']]})[_0x54fe('0x9')](function(_0x371202){var _0x4734c0=0x0;if(_0x371202){if(_0x371202[_0x54fe('0x1e')]+_0x371202[_0x54fe('0x1f')]+_0x371202[_0x54fe('0x20')]+_0x371202[_0x54fe('0x27')]+_0x371202[_0x54fe('0x21')]+_0x371202[_0x54fe('0x22')]+_0x371202[_0x54fe('0x23')]+_0x371202['countagentrejectretry']<_0x56c673[_0x54fe('0x25')][_0x54fe('0x26')])_0x4734c0=0x1;_0x825901({'additional':_0x4734c0});}else{_0x825901({'additional':0x0});}})['catch'](function(_0xbd591c){logger[_0x54fe('0x10')](_0x54fe('0x14'),_0xbd591c[_0x54fe('0x12')]);_0x4cb0d7(_0x32bd82[_0x54fe('0x10')](0x1f4,_0xbd591c[_0x54fe('0x12')]));});}})[_0x54fe('0x13')](function(_0x510af3){logger[_0x54fe('0x10')](_0x54fe('0x14'),_0x510af3[_0x54fe('0x12')]);_0x4cb0d7(_0x32bd82['error'](0x1f4,_0x510af3[_0x54fe('0x12')]));});}else _0x825901({'additional':0x0});});});};exports[_0x54fe('0x28')]=function(_0x38744f){var _0xd7a8e=this;return new Promise(function(_0xae21b5,_0x4e10ba){return db[_0x54fe('0x15')][_0x54fe('0x16')]({'raw':!![],'where':{'ContactId':_0x38744f[_0x54fe('0x18')][_0x54fe('0x17')],'ListId':_0x38744f[_0x54fe('0x18')][_0x54fe('0x19')],'VoiceQueueId':_0x38744f[_0x54fe('0x18')][_0x54fe('0x1a')]===undefined?null:_0x38744f['body'][_0x54fe('0x1a')],'CampaignId':_0x38744f[_0x54fe('0x18')]['CampaignId']===undefined?null:_0x38744f[_0x54fe('0x18')]['CampaignId']}})['then'](function(_0xee789a){if(_0xee789a!=null){return db[_0x54fe('0x1c')][_0x54fe('0x16')]({'raw':!![],'where':{'CmHopperId':_0xee789a['id'],'OrderBy':{'$gte':_0xee789a[_0x54fe('0x29')]}},'order':[[_0x54fe('0x29'),_0x54fe('0x1d')]]})[_0x54fe('0x9')](function(_0x1640fc){if(_0x1640fc)return activateAdditionalPhone(_0xee789a,_0x38744f[_0x54fe('0x18')],_0x1640fc,_0x38744f[_0x54fe('0x2a')],_0x38744f[_0x54fe('0x2b')])[_0x54fe('0x9')](function(_0x4fd5fa){_0xae21b5(_0x4fd5fa);});else{return db[_0x54fe('0x1c')][_0x54fe('0x16')]({'raw':!![],'where':{'CmHopperId':_0xee789a['id']},'order':[['OrderBy','ASC']]})[_0x54fe('0x9')](function(_0x50aee3){if(_0x50aee3)return activateAdditionalPhone(_0xee789a,_0x38744f['body'],_0x50aee3,_0x38744f[_0x54fe('0x2a')],_0x38744f['waitTime'])['then'](function(_0x144a07){_0xae21b5(_0x144a07);});else{_0xae21b5({'id':_0xee789a['id'],'phone':''});}})['catch'](function(_0x58fecb){logger[_0x54fe('0x10')]('VerifyAdditionalPhones',_0x58fecb[_0x54fe('0x12')]);_0x4e10ba(_0xd7a8e[_0x54fe('0x10')](0x1f4,_0x58fecb['message']));});}})['catch'](function(_0xdace65){logger[_0x54fe('0x10')](_0x54fe('0x14'),_0xdace65['message']);_0x4e10ba(_0xd7a8e['error'](0x1f4,_0xdace65['message']));});}else _0xae21b5(0x1);});});};function activateAdditionalPhone(_0x109b68,_0x1cb568,_0x2b0163,_0x33d77d,_0x4c1666){return new Promise(function(_0x2de1c1,_0x4b1ed8){var _0xab66b6;if(_[_0x54fe('0x2c')](_0x2b0163[_0x54fe('0x2d')])){_0x2b0163[_0x54fe('0x2d')]=moment();}if(moment()>moment(_0x2b0163[_0x54fe('0x2d')])){_0xab66b6=moment()['add'](_0x4c1666||0x3,_0x54fe('0x2e'));}else{if(_0x2b0163[_0x54fe('0x29')]==0x0){_0xab66b6=moment(_0x2b0163[_0x54fe('0x2d')]);}else{_0xab66b6=moment()['add'](_0x4c1666||0x3,_0x54fe('0x2e'));}}if(_[_0x54fe('0x2c')](_0xab66b6)){_0xab66b6=moment()[_0x54fe('0x2f')](_0x4c1666||0x3,_0x54fe('0x2e'));}var _0x9b66c2={'phone':_0x109b68[_0x54fe('0x30')],'active':0x0,'OrderBy':_[_0x54fe('0x2c')](_0x109b68[_0x54fe('0x29')])?0x0:_0x109b68[_0x54fe('0x29')],'scheduledat':moment()['add'](_0x33d77d||0x1,_0x54fe('0x2e')),'countbusyretry':_0x1cb568[_0x54fe('0x1e')],'countcongestionretry':_0x1cb568[_0x54fe('0x1f')],'countnoanswerretry':_0x1cb568[_0x54fe('0x20')],'countnosuchnumberretry':_0x1cb568[_0x54fe('0x27')],'countdropretry':_0x1cb568[_0x54fe('0x21')],'countabandonedretry':_0x1cb568['countabandonedretry'],'countmachineretry':_0x1cb568['countmachineretry'],'countagentrejectretry':_0x1cb568['countagentrejectretry'],'createdAt':_0x1cb568[_0x54fe('0x31')],'updatedAt':_0x1cb568['updatedAt']};var _0x197306={'CmHopperId':_0x109b68['id'],'phone':_0x2b0163['phone'],'active':0x0,'OrderBy':_[_0x54fe('0x2c')](_0x2b0163[_0x54fe('0x29')])?0x0:_0x2b0163[_0x54fe('0x29')],'scheduledat':_0xab66b6,'countbusyretry':_0x2b0163[_0x54fe('0x1e')],'countcongestionretry':_0x2b0163[_0x54fe('0x1f')],'countnoanswerretry':_0x2b0163['countnoanswerretry'],'countnosuchnumberretry':_0x2b0163[_0x54fe('0x27')],'countdropretry':_0x2b0163[_0x54fe('0x21')],'countabandonedretry':_0x2b0163[_0x54fe('0x22')],'countmachineretry':_0x2b0163[_0x54fe('0x23')],'countagentrejectretry':_0x2b0163['countagentrejectretry'],'createdAt':_0x2b0163['createdAt'],'updatedAt':_0x2b0163[_0x54fe('0x32')]};return db[_0x54fe('0x33')][_0x54fe('0x34')](function(_0x1ca6f9){return db[_0x54fe('0x1c')]['update'](_0x9b66c2,{'where':{'id':_0x2b0163['id']}},{'transaction':_0x1ca6f9})[_0x54fe('0x9')](function(){return db['CmHopper'][_0x54fe('0x35')](_0x197306,{'where':{'id':_0x109b68['id']}},{'transaction':_0x1ca6f9});});})[_0x54fe('0x9')](function(_0x3386f4){_0x2de1c1({'id':_0x109b68['id'],'phone':_0x2b0163[_0x54fe('0x30')]});})['catch'](function(_0x8e8277){logger['error'](_0x54fe('0x36'),_0x8e8277[_0x54fe('0x12')]);_0x4b1ed8({'error':_0x8e8277['message']});});});}exports[_0x54fe('0x37')]=function(_0x95d57b){var _0x784e7=this;return new Promise(function(_0x42e008,_0x2eba52){return db[_0x54fe('0x15')][_0x54fe('0x35')](_0x95d57b[_0x54fe('0x18')][_0x54fe('0x38')],{'where':{'id':_0x95d57b[_0x54fe('0x18')]['id']}})[_0x54fe('0x9')](function(_0x29512f){_0x42e008(_0x29512f);})[_0x54fe('0x13')](function(_0xebe5ba){logger[_0x54fe('0x10')]('IncrementPreviewCounters',_0xebe5ba[_0x54fe('0x12')]);_0x2eba52(_0x784e7['error'](0x1f4,_0xebe5ba[_0x54fe('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index cf1e9e1..754efe1 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 _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 +var _0x6208=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','post','put','update','delete'];(function(_0x3086d4,_0x2a53e6){var _0x814ec3=function(_0x261344){while(--_0x261344){_0x3086d4['push'](_0x3086d4['shift']());}};_0x814ec3(++_0x2a53e6);}(_0x6208,0x192));var _0x8620=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0x6208[_0x5f746f];return _0x198d15;};'use strict';var multer=require('multer');var util=require(_0x8620('0x0'));var path=require(_0x8620('0x1'));var timeout=require(_0x8620('0x2'));var express=require(_0x8620('0x3'));var router=express[_0x8620('0x4')]();var fs_extra=require(_0x8620('0x5'));var auth=require(_0x8620('0x6'));var interaction=require(_0x8620('0x7'));var config=require(_0x8620('0x8'));var controller=require(_0x8620('0x9'));router['get']('/',auth[_0x8620('0xa')](),controller[_0x8620('0xb')]);router[_0x8620('0xc')](_0x8620('0xd'),auth[_0x8620('0xa')](),controller['show']);router[_0x8620('0xe')]('/',auth[_0x8620('0xa')](),controller['create']);router[_0x8620('0xf')](_0x8620('0xd'),auth['isAuthenticated'](),controller[_0x8620('0x10')]);router[_0x8620('0x11')]('/:id',auth[_0x8620('0xa')](),controller[_0x8620('0x12')]);module[_0x8620('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 383415d..c171bb9 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 _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 +var _0xf228=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x446328,_0x33dbd2){var _0x4e3edb=function(_0x27e720){while(--_0x27e720){_0x446328['push'](_0x446328['shift']());}};_0x4e3edb(++_0x33dbd2);}(_0xf228,0x1a9));var _0x8f22=function(_0x5abd9b,_0x51e58b){_0x5abd9b=_0x5abd9b-0x0;var _0x10ebc7=_0xf228[_0x5abd9b];return _0x10ebc7;};'use strict';var moment=require(_0x8f22('0x0'));var Sequelize=require(_0x8f22('0x1'));module['exports']={'phone':{'type':Sequelize[_0x8f22('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8f22('0x3')],'unique':_0x8f22('0x4')},'ListId':{'type':Sequelize[_0x8f22('0x3')],'unique':_0x8f22('0x4')},'VoiceQueueId':{'type':Sequelize[_0x8f22('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c6ca299..8d18fb3 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 _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 +var _0xcedb=['send','map','CmHopperBlack','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','intersection','include','options','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0xcedb,0xc0));var _0xbced=function(_0x5b36d9,_0x15f4c6){_0x5b36d9=_0x5b36d9-0x0;var _0x9d5a55=_0xcedb[_0x5b36d9];return _0x9d5a55;};'use strict';var emlformat=require(_0xbced('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbced('0x1'));var jsonpatch=require(_0xbced('0x2'));var rp=require(_0xbced('0x3'));var moment=require(_0xbced('0x4'));var BPromise=require(_0xbced('0x5'));var Mustache=require(_0xbced('0x6'));var util=require(_0xbced('0x7'));var path=require(_0xbced('0x8'));var sox=require(_0xbced('0x9'));var csv=require(_0xbced('0xa'));var ejs=require(_0xbced('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbced('0xc'));var squel=require(_0xbced('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbced('0xe'));var toCsv=require(_0xbced('0xa'));var querystring=require(_0xbced('0xf'));var Papa=require(_0xbced('0x10'));var Redis=require(_0xbced('0x11'));var authService=require(_0xbced('0x12'));var qs=require(_0xbced('0x13'));var as=require(_0xbced('0x14'));var hardwareService=require(_0xbced('0x15'));var logger=require(_0xbced('0x16'))(_0xbced('0x17'));var utils=require(_0xbced('0x18'));var config=require(_0xbced('0x19'));var licenseUtil=require(_0xbced('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5356a6,_0x4ae519){_0x4ae519=_0x4ae519||0xcc;return function(_0x464192){if(_0x464192){return _0x5356a6[_0xbced('0x1b')](_0x4ae519);}return _0x5356a6[_0xbced('0x1c')](_0x4ae519)[_0xbced('0x1d')]();};}function respondWithResult(_0xb3b32b,_0xae3ca4){_0xae3ca4=_0xae3ca4||0xc8;return function(_0x32949f){if(_0x32949f){return _0xb3b32b[_0xbced('0x1c')](_0xae3ca4)[_0xbced('0x1e')](_0x32949f);}};}function respondWithFilteredResult(_0x191ff3,_0x1da994){return function(_0x50fe8b){if(_0x50fe8b){var _0x2af9a9=typeof _0x1da994[_0xbced('0x1f')]===_0xbced('0x20')&&typeof _0x1da994[_0xbced('0x21')]===_0xbced('0x20');var _0x4991dc=_0x50fe8b[_0xbced('0x22')];var _0x9d59e4=_0x2af9a9?0x0:_0x1da994[_0xbced('0x1f')];var _0x3b2e1a=_0x2af9a9?_0x50fe8b[_0xbced('0x22')]:_0x1da994['offset']+_0x1da994[_0xbced('0x21')];var _0x49dc50;if(_0x3b2e1a>=_0x4991dc){_0x3b2e1a=_0x4991dc;_0x49dc50=0xc8;}else{_0x49dc50=0xce;}_0x191ff3[_0xbced('0x1c')](_0x49dc50);return _0x191ff3[_0xbced('0x23')](_0xbced('0x24'),_0x9d59e4+'-'+_0x3b2e1a+'/'+_0x4991dc)['json'](_0x50fe8b);}return null;};}function patchUpdates(_0xc68376){return function(_0x26e4b5){try{jsonpatch[_0xbced('0x25')](_0x26e4b5,_0xc68376,!![]);}catch(_0x1a22fb){return BPromise['reject'](_0x1a22fb);}return _0x26e4b5[_0xbced('0x26')]();};}function saveUpdates(_0x8a1df0,_0x184b92){return function(_0xb5f8d){if(_0xb5f8d){return _0xb5f8d[_0xbced('0x27')](_0x8a1df0)['then'](function(_0x66bd43){return _0x66bd43;});}return null;};}function removeEntity(_0x160126,_0x50770c){return function(_0x1b1c01){if(_0x1b1c01){return _0x1b1c01[_0xbced('0x28')]()[_0xbced('0x29')](function(){_0x160126[_0xbced('0x1c')](0xcc)[_0xbced('0x1d')]();});}};}function handleEntityNotFound(_0x1000a2,_0x2127e5){return function(_0x1524e9){if(!_0x1524e9){_0x1000a2[_0xbced('0x1b')](0x194);}return _0x1524e9;};}function handleError(_0x322535,_0x5e614c){_0x5e614c=_0x5e614c||0x1f4;return function(_0x1fedfb){logger[_0xbced('0x2a')](_0x1fedfb[_0xbced('0x2b')]);if(_0x1fedfb[_0xbced('0x2c')]){delete _0x1fedfb[_0xbced('0x2c')];}_0x322535[_0xbced('0x1c')](_0x5e614c)[_0xbced('0x2d')](_0x1fedfb);};}exports['index']=function(_0x2329fd,_0xde31cd){var _0x4328d5={},_0x278f68={},_0x2b9a57={'count':0x0,'rows':[]};var _0x235a17=_[_0xbced('0x2e')](db[_0xbced('0x2f')][_0xbced('0x30')],function(_0x15d2b7){return{'name':_0x15d2b7[_0xbced('0x31')],'type':_0x15d2b7[_0xbced('0x32')][_0xbced('0x33')]};});_0x278f68['model']=_[_0xbced('0x2e')](_0x235a17,_0xbced('0x2c'));_0x278f68['query']=_[_0xbced('0x34')](_0x2329fd[_0xbced('0x35')]);_0x278f68[_0xbced('0x36')]=_['intersection'](_0x278f68[_0xbced('0x37')],_0x278f68['query']);_0x4328d5[_0xbced('0x38')]=_['intersection'](_0x278f68[_0xbced('0x37')],qs[_0xbced('0x39')](_0x2329fd[_0xbced('0x35')][_0xbced('0x39')]));_0x4328d5[_0xbced('0x38')]=_0x4328d5[_0xbced('0x38')][_0xbced('0x3a')]?_0x4328d5[_0xbced('0x38')]:_0x278f68[_0xbced('0x37')];if(!_0x2329fd[_0xbced('0x35')][_0xbced('0x3b')](_0xbced('0x3c'))){_0x4328d5[_0xbced('0x21')]=qs[_0xbced('0x21')](_0x2329fd['query'][_0xbced('0x21')]);_0x4328d5['offset']=qs[_0xbced('0x1f')](_0x2329fd['query']['offset']);}_0x4328d5[_0xbced('0x3d')]=qs[_0xbced('0x3e')](_0x2329fd[_0xbced('0x35')][_0xbced('0x3e')]);_0x4328d5['where']=qs[_0xbced('0x36')](_[_0xbced('0x3f')](_0x2329fd[_0xbced('0x35')],_0x278f68[_0xbced('0x36')]),_0x235a17);if(_0x2329fd[_0xbced('0x35')][_0xbced('0x40')]){_0x4328d5[_0xbced('0x41')]=_[_0xbced('0x42')](_0x4328d5[_0xbced('0x41')],{'$or':_['map'](_0x235a17,function(_0xbcdc86){if(_0xbcdc86[_0xbced('0x32')]!==_0xbced('0x43')){var _0x10f4c0={};_0x10f4c0[_0xbcdc86[_0xbced('0x2c')]]={'$like':'%'+_0x2329fd[_0xbced('0x35')]['filter']+'%'};return _0x10f4c0;}})});}_0x4328d5=_[_0xbced('0x42')]({},_0x4328d5,_0x2329fd['options']);var _0x39446e={'where':_0x4328d5[_0xbced('0x41')]};return db[_0xbced('0x2f')][_0xbced('0x22')](_0x39446e)[_0xbced('0x29')](function(_0x3ac03e){_0x2b9a57[_0xbced('0x22')]=_0x3ac03e;if(_0x2329fd[_0xbced('0x35')][_0xbced('0x44')]){_0x4328d5['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xbced('0x45')](_0x4328d5);})[_0xbced('0x29')](function(_0x3e87b7){_0x2b9a57['rows']=_0x3e87b7;return _0x2b9a57;})[_0xbced('0x29')](respondWithFilteredResult(_0xde31cd,_0x4328d5))[_0xbced('0x46')](handleError(_0xde31cd,null));};exports[_0xbced('0x47')]=function(_0x22bafd,_0x4ca322){var _0xbf5532={'raw':!![],'where':{'id':_0x22bafd['params']['id']}},_0x547f2c={};_0x547f2c[_0xbced('0x37')]=_[_0xbced('0x34')](db[_0xbced('0x2f')]['rawAttributes']);_0x547f2c[_0xbced('0x35')]=_['keys'](_0x22bafd[_0xbced('0x35')]);_0x547f2c['filters']=_[_0xbced('0x48')](_0x547f2c[_0xbced('0x37')],_0x547f2c['query']);_0xbf5532[_0xbced('0x38')]=_[_0xbced('0x48')](_0x547f2c[_0xbced('0x37')],qs['fields'](_0x22bafd[_0xbced('0x35')][_0xbced('0x39')]));_0xbf5532[_0xbced('0x38')]=_0xbf5532[_0xbced('0x38')][_0xbced('0x3a')]?_0xbf5532[_0xbced('0x38')]:_0x547f2c[_0xbced('0x37')];if(_0x22bafd['query'][_0xbced('0x44')]){_0xbf5532[_0xbced('0x49')]=[{'all':!![]}];}_0xbf5532=_[_0xbced('0x42')]({},_0xbf5532,_0x22bafd[_0xbced('0x4a')]);return db['CmHopperBlack'][_0xbced('0x4b')](_0xbf5532)['then'](handleEntityNotFound(_0x4ca322,null))[_0xbced('0x29')](respondWithResult(_0x4ca322,null))[_0xbced('0x46')](handleError(_0x4ca322,null));};exports[_0xbced('0x27')]=function(_0x163d3f,_0x5bb550){if(_0x163d3f[_0xbced('0x4c')]['id']){delete _0x163d3f[_0xbced('0x4c')]['id'];}return db[_0xbced('0x2f')][_0xbced('0x4b')]({'where':{'id':_0x163d3f[_0xbced('0x4d')]['id']}})[_0xbced('0x29')](handleEntityNotFound(_0x5bb550,null))['then'](saveUpdates(_0x163d3f[_0xbced('0x4c')],null))[_0xbced('0x29')](respondWithResult(_0x5bb550,null))[_0xbced('0x46')](handleError(_0x5bb550,null));};exports[_0xbced('0x28')]=function(_0x5eb146,_0x3afd0f){return db['CmHopperBlack'][_0xbced('0x4b')]({'where':{'id':_0x5eb146[_0xbced('0x4d')]['id']}})[_0xbced('0x29')](handleEntityNotFound(_0x3afd0f,null))[_0xbced('0x29')](removeEntity(_0x3afd0f,null))[_0xbced('0x46')](handleError(_0x3afd0f,null));};exports['describe']=function(_0x36960d,_0x5f05d4){return db[_0xbced('0x2f')][_0xbced('0x4e')]()[_0xbced('0x29')](respondWithResult(_0x5f05d4,null))[_0xbced('0x46')](handleError(_0x5f05d4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6d12e53..fa2a5b0 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 _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 +var _0xb534=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black'];(function(_0x16b645,_0x207b1){var _0xb03e2d=function(_0x176282){while(--_0x176282){_0x16b645['push'](_0x16b645['shift']());}};_0xb03e2d(++_0x207b1);}(_0xb534,0xfc));var _0x4b53=function(_0x20373a,_0x52d45d){_0x20373a=_0x20373a-0x0;var _0x34c16f=_0xb534[_0x20373a];return _0x34c16f;};'use strict';var _=require(_0x4b53('0x0'));var util=require(_0x4b53('0x1'));var logger=require(_0x4b53('0x2'))(_0x4b53('0x3'));var moment=require('moment');var BPromise=require(_0x4b53('0x4'));var rp=require(_0x4b53('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b53('0x6'));var config=require(_0x4b53('0x7'));var attributes=require(_0x4b53('0x8'));module['exports']=function(_0x383031,_0x1b6933){return _0x383031[_0x4b53('0x9')](_0x4b53('0xa'),attributes,{'tableName':_0x4b53('0xb'),'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 24ed028..b3910a6 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 _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 +var _0x6163=['raw','where','attributes','include','map','model','GetCmHopperBlack','stringify','UpdateCmHopperBlack','CmHopperBlack','body','limit','then','DestroyCmHopperBlack','destroy','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','findAll','options'];(function(_0x1411a8,_0x5629b1){var _0x57828d=function(_0xcfbfe6){while(--_0xcfbfe6){_0x1411a8['push'](_0x1411a8['shift']());}};_0x57828d(++_0x5629b1);}(_0x6163,0x153));var _0x3616=function(_0x27c91d,_0x37c914){_0x27c91d=_0x27c91d-0x0;var _0xb9f8b1=_0x6163[_0x27c91d];return _0xb9f8b1;};'use strict';var _=require(_0x3616('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3616('0x1'));var rs=require(_0x3616('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3616('0x3'))['db'];var utils=require(_0x3616('0x4'));var logger=require(_0x3616('0x5'))('rpc');var config=require(_0x3616('0x6'));var jayson=require(_0x3616('0x7'));var client=jayson['client'][_0x3616('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57632d,_0x45a123,_0x178e8e){return new BPromise(function(_0x4c2236,_0x405341){return client[_0x3616('0x9')](_0x57632d,_0x178e8e)['then'](function(_0x3431df){logger['info'](_0x3616('0xa'),_0x45a123,_0x3616('0xb'));logger[_0x3616('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x45a123,'request\x20sent',JSON['stringify'](_0x3431df));if(_0x3431df['error']){if(_0x3431df[_0x3616('0xd')][_0x3616('0xe')]===0x1f4){logger[_0x3616('0xd')](_0x3616('0xa'),_0x45a123,_0x3431df[_0x3616('0xd')][_0x3616('0xf')]);return _0x405341(_0x3431df[_0x3616('0xd')][_0x3616('0xf')]);}logger[_0x3616('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x45a123,_0x3431df[_0x3616('0xd')][_0x3616('0xf')]);return _0x4c2236(_0x3431df['error'][_0x3616('0xf')]);}else{logger[_0x3616('0x10')](_0x3616('0xa'),_0x45a123,_0x3616('0xb'));_0x4c2236(_0x3431df[_0x3616('0x11')][_0x3616('0xf')]);}})[_0x3616('0x12')](function(_0x1fdcf8){logger[_0x3616('0xd')](_0x3616('0xa'),_0x45a123,_0x1fdcf8);_0x405341(_0x1fdcf8);});});}exports['GetCmHopperBlack']=function(_0x39371f){var _0x1b9181=this;return new Promise(function(_0x38155e,_0x214704){return db['CmHopperBlack'][_0x3616('0x13')]({'raw':_0x39371f[_0x3616('0x14')]?_0x39371f[_0x3616('0x14')][_0x3616('0x15')]===undefined?!![]:![]:!![],'where':_0x39371f[_0x3616('0x14')]?_0x39371f[_0x3616('0x14')][_0x3616('0x16')]||null:null,'attributes':_0x39371f[_0x3616('0x14')]?_0x39371f[_0x3616('0x14')][_0x3616('0x17')]||null:null,'limit':_0x39371f[_0x3616('0x14')]?_0x39371f[_0x3616('0x14')]['limit']||null:null,'include':_0x39371f[_0x3616('0x14')]?_0x39371f[_0x3616('0x14')][_0x3616('0x18')]?_[_0x3616('0x19')](_0x39371f['options'][_0x3616('0x18')],function(_0x1dbe46){return{'model':db[_0x1dbe46['model']],'as':_0x1dbe46['as'],'attributes':_0x1dbe46['attributes'],'include':_0x1dbe46[_0x3616('0x18')]?_[_0x3616('0x19')](_0x1dbe46[_0x3616('0x18')],function(_0x2fe790){return{'model':db[_0x2fe790[_0x3616('0x1a')]],'as':_0x2fe790['as'],'attributes':_0x2fe790[_0x3616('0x17')],'include':_0x2fe790[_0x3616('0x18')]?_[_0x3616('0x19')](_0x2fe790[_0x3616('0x18')],function(_0xcecac2){return{'model':db[_0xcecac2[_0x3616('0x1a')]],'as':_0xcecac2['as'],'attributes':_0xcecac2[_0x3616('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe2c900){logger[_0x3616('0x10')]('GetCmHopperBlack',_0x39371f);logger[_0x3616('0xc')](_0x3616('0x1b'),_0x39371f,JSON[_0x3616('0x1c')](_0xe2c900));_0x38155e(_0xe2c900);})[_0x3616('0x12')](function(_0x2d09ea){logger[_0x3616('0xd')](_0x3616('0x1b'),_0x2d09ea[_0x3616('0xf')],_0x39371f);_0x214704(_0x1b9181[_0x3616('0xd')](0x1f4,_0x2d09ea[_0x3616('0xf')]));});});};exports[_0x3616('0x1d')]=function(_0x47f779){var _0x5bf3a6=this;return new Promise(function(_0x10ddbc,_0x48eae9){return db[_0x3616('0x1e')]['update'](_0x47f779[_0x3616('0x1f')],{'raw':_0x47f779['options']?_0x47f779[_0x3616('0x14')][_0x3616('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47f779[_0x3616('0x14')]?_0x47f779[_0x3616('0x14')][_0x3616('0x16')]||null:null,'attributes':_0x47f779['options']?_0x47f779[_0x3616('0x14')]['attributes']||null:null,'limit':_0x47f779[_0x3616('0x14')]?_0x47f779[_0x3616('0x14')][_0x3616('0x20')]||null:null})[_0x3616('0x21')](function(_0x1722ad){logger[_0x3616('0x10')](_0x3616('0x1d'),_0x47f779);logger[_0x3616('0xc')](_0x3616('0x1d'),_0x47f779,JSON[_0x3616('0x1c')](_0x1722ad));_0x10ddbc(_0x1722ad);})[_0x3616('0x12')](function(_0x4e7ca3){logger[_0x3616('0xd')](_0x3616('0x1d'),_0x4e7ca3[_0x3616('0xf')],_0x47f779);_0x48eae9(_0x5bf3a6['error'](0x1f4,_0x4e7ca3[_0x3616('0xf')]));});});};exports[_0x3616('0x22')]=function(_0x461ca7){var _0x228ff1=this;return new Promise(function(_0x2269a3,_0x407ab0){return db[_0x3616('0x1e')][_0x3616('0x23')]({'where':_0x461ca7[_0x3616('0x14')]?_0x461ca7[_0x3616('0x14')][_0x3616('0x16')]||null:null})['then'](function(_0x27ec9a){logger[_0x3616('0x10')](_0x3616('0x22'),_0x461ca7);logger[_0x3616('0xc')]('DestroyCmHopperBlack',_0x461ca7,JSON[_0x3616('0x1c')](_0x27ec9a));_0x2269a3(_0x27ec9a);})['catch'](function(_0x5dcc35){logger[_0x3616('0xd')]('DestroyCmHopperBlack',_0x5dcc35['message'],_0x461ca7);_0x407ab0(_0x228ff1[_0x3616('0xd')](0x1f4,_0x5dcc35['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index b37ba59..8843cd1 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 _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 +var _0xd101=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd101,0xc1));var _0x1d10=function(_0x24feea,_0x38275c){_0x24feea=_0x24feea-0x0;var _0x49442d=_0xd101[_0x24feea];return _0x49442d;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./cmHopperBlack.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0x9')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xe'),auth['isAuthenticated'](),controller[_0x1d10('0x13')]);module[_0x1d10('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 12f5e6d..6aa84b7 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 _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 +var _0x227b=['sequelize','moment','exports','INTEGER','STRING','DATE','followuptime','diff','seconds','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x227b,0xfa));var _0xb227=function(_0x3fceac,_0x583110){_0x3fceac=_0x3fceac-0x0;var _0x591300=_0x227b[_0x3fceac];return _0x591300;};'use strict';var Sequelize=require(_0xb227('0x0'));var moment=require(_0xb227('0x1'));module[_0xb227('0x2')]={'state':{'type':Sequelize[_0xb227('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xb227('0x4')]},'scheduledat':{'type':Sequelize[_0xb227('0x5')]},'countbusyretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xb227('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb227('0x4')]},'starttime':{'type':Sequelize[_0xb227('0x5')]},'responsetime':{'type':Sequelize[_0xb227('0x5')]},'answertime':{'type':Sequelize[_0xb227('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb227('0x4')]},'campaign':{'type':Sequelize[_0xb227('0x4')]},'campaigntype':{'type':Sequelize[_0xb227('0x4')]},'membername':{'type':Sequelize[_0xb227('0x4')]},'reason':{'type':Sequelize[_0xb227('0x4')]},'disposition':{'type':Sequelize[_0xb227('0x4')]},'secondDisposition':{'type':Sequelize[_0xb227('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb227('0x4')]},'dispositionat':{'type':Sequelize[_0xb227('0x5')],'set':function(_0x6cfb39){var _0x53f687=this['getDataValue']('endtime');if(_0x53f687&&_0x6cfb39){this['setDataValue'](_0xb227('0x6'),moment(_0x6cfb39)[_0xb227('0x7')](moment(_0x53f687),_0xb227('0x8')));}}},'amd':{'type':Sequelize[_0xb227('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb227('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb227('0x5')]},'callback':{'type':Sequelize[_0xb227('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb227('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb227('0x5')]},'deleted':{'type':Sequelize[_0xb227('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xb227('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb227('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 9fe849b..86c22cd 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 _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 +var _0x4819=['send','map','CmHopperFinal','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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'];(function(_0x91e24e,_0x2eddb3){var _0x642ebd=function(_0x4b53c7){while(--_0x4b53c7){_0x91e24e['push'](_0x91e24e['shift']());}};_0x642ebd(++_0x2eddb3);}(_0x4819,0xcd));var _0x9481=function(_0x3cb09b,_0x31c2a5){_0x3cb09b=_0x3cb09b-0x0;var _0x242048=_0x4819[_0x3cb09b];return _0x242048;};'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['CmHopperFinal']['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['describe']=function(_0xd36133,_0x5d3a06){return db['CmHopperFinal'][_0x9481('0x43')]()['then'](respondWithResult(_0x5d3a06,null))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports[_0x9481('0x24')]=function(_0x47f8b2,_0x277e2a){if(_0x47f8b2[_0x9481('0x44')][_0x9481('0x45')]){delete _0x47f8b2[_0x9481('0x44')][_0x9481('0x45')];}return db[_0x9481('0x2b')]['find']({'where':{'uniqueid':_0x47f8b2['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x277e2a,null))[_0x9481('0x25')](saveUpdates(_0x47f8b2[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x277e2a,null))[_0x9481('0x3f')](handleError(_0x277e2a,null));};exports[_0x9481('0x46')]=function(_0x1c070c,_0x3d2250,_0x580273){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x1c070c[_0x9481('0x48')]['id']},'attributes':[[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x9481('0x4b')](_0x9481('0x4c')))),_0x9481('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4e')))),_0x9481('0x4f')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db['sequelize']['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x56')))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0x3d2250,null))['then'](respondWithResult(_0x3d2250,null))['catch'](handleError(_0x3d2250,null));};exports[_0x9481('0x58')]=function(_0x3cbab5,_0xb58b67,_0xe008db){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'CampaignId':_0x3cbab5['params']['id']},'attributes':[[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4c')))),_0x9481('0x4d')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x4e')))),'busyContacts'],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db['sequelize']['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0xb58b67,null))[_0x9481('0x25')](respondWithResult(_0xb58b67,null))[_0x9481('0x3f')](handleError(_0xb58b67,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xa83176,_0x265f1c,_0x2a053a){return db[_0x9481('0x59')]['find']({'where':{'id':_0xa83176['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x265f1c,null))[_0x9481('0x25')](function(_0x193992){var _0x380f2a;if(_0x193992){_0x380f2a=squel[_0x9481('0x5a')]()['into'](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),_0x9481('0x5e'),_0x9481('0x5f'),_0x9481('0x60'),_0x9481('0x61'),_0x9481('0x62'),_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))[_0x9481('0x65')](_0x9481('0x67'),'scheduledAt')[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')]('ANY_VALUE(VoiceQueueId)',_0x9481('0x61'))[_0x9481('0x65')]('NOW()','createdAt')[_0x9481('0x65')]('NOW()','updatedAt')[_0x9481('0x6a')]('cm_hopper_final')[_0x9481('0x38')](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]())['where'](_0x9481('0x6d'),_0xa83176['body'][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')]('VoiceQueueId\x20=\x20?',_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x70'))['from'](_0x9481('0x71'))['where'](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id']['toString']())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')]('ContactId'))['toString']();return db[_0x9481('0x49')]['query'](_0x380f2a);}return[];})[_0x9481('0x25')](respondWithResult(_0x265f1c,null))[_0x9481('0x3f')](handleError(_0x265f1c,null));};exports[_0x9481('0x74')]=function(_0x55b428,_0x3f74f1,_0x287d06){return db[_0x9481('0x75')]['find']({'where':{'id':_0x55b428[_0x9481('0x48')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x3f74f1,null))[_0x9481('0x25')](function(_0x32b30f){var _0x347da1;if(_0x32b30f){_0x347da1=squel[_0x9481('0x5a')]()[_0x9481('0x76')](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),'scheduledAt',_0x9481('0x5f'),'ListId','CampaignId','createdAt',_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))['field'](_0x9481('0x67'),_0x9481('0x5e'))[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')](_0x9481('0x77'),'CampaignId')[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x62'))[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x63'))[_0x9481('0x6a')](_0x9481('0x71'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428['params']['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x6d'),_0x55b428[_0x9481('0x44')][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x79'))[_0x9481('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel['select']()[_0x9481('0x65')](_0x9481('0x70'))[_0x9481('0x6a')]('cm_hopper_final')['where'](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')](_0x9481('0x5f')))[_0x9481('0x6c')]();return db[_0x9481('0x49')]['query'](_0x347da1);}return[];})[_0x9481('0x25')](respondWithResult(_0x3f74f1,null))[_0x9481('0x3f')](handleError(_0x3f74f1,null));};exports['checkContactHopper']=function(_0x2c53df,_0x534979,_0x616b77){return db[_0x9481('0x7a')]['findOne']({'where':{'VoiceQueueId':_0x2c53df[_0x9481('0x44')][_0x9481('0x61')],'CampaignId':_0x2c53df[_0x9481('0x44')]['CampaignId'],'ContactId':_0x2c53df[_0x9481('0x44')][_0x9481('0x5f')]}})['then'](handleEntityNotFound(_0x534979,null))[_0x9481('0x25')](function(_0x5c7602){if(_0x5c7602){return _0x5c7602;}return null;})[_0x9481('0x25')](respondWithResult(_0x534979,null))[_0x9481('0x3f')](handleError(_0x534979,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index abb4197..97e7b16 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 _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 +var _0xd2f2=['../../config/logger','api','request-promise','path','../../config/environment','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x27aa2e,_0xed14ed){var _0x4da0cb=function(_0x519e46){while(--_0x519e46){_0x27aa2e['push'](_0x27aa2e['shift']());}};_0x4da0cb(++_0xed14ed);}(_0xd2f2,0xee));var _0x2d2f=function(_0x3e1438,_0xc6962a){_0x3e1438=_0x3e1438-0x0;var _0x39ee96=_0xd2f2[_0x3e1438];return _0x39ee96;};'use strict';var _=require(_0x2d2f('0x0'));var util=require(_0x2d2f('0x1'));var logger=require(_0x2d2f('0x2'))(_0x2d2f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d2f('0x4'));var fs=require('fs');var path=require(_0x2d2f('0x5'));var rimraf=require('rimraf');var config=require(_0x2d2f('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x2d2f('0x7')]=function(_0xe34653,_0x1f22a3){return _0xe34653['define'](_0x2d2f('0x8'),attributes,{'tableName':_0x2d2f('0x9'),'paranoid':![],'indexes':[{'name':_0x2d2f('0xa'),'fields':['calleridnum']},{'name':_0x2d2f('0xb'),'fields':[_0x2d2f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ef946b5..cf2556c 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_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 +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(_0x4d0325,_0x232025){var _0x4c9381=function(_0x16694a){while(--_0x16694a){_0x4d0325['push'](_0x4d0325['shift']());}};_0x4c9381(++_0x232025);}(_0xb10b,0x12a));var _0xbb10=function(_0x496ee9,_0x4dba12){_0x496ee9=_0x496ee9-0x0;var _0xb7016a=_0xb10b[_0x496ee9];return _0xb7016a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 529431a..f91065e 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 _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 +var _0xdd72=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x59fc6f,_0x4a71cf){var _0x2687ce=function(_0x40cb18){while(--_0x40cb18){_0x59fc6f['push'](_0x59fc6f['shift']());}};_0x2687ce(++_0x4a71cf);}(_0xdd72,0xb4));var _0x2dd7=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xdd72[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0x2dd7('0x0'));var util=require(_0x2dd7('0x1'));var path=require('path');var timeout=require(_0x2dd7('0x2'));var express=require(_0x2dd7('0x3'));var router=express[_0x2dd7('0x4')]();var fs_extra=require(_0x2dd7('0x5'));var auth=require(_0x2dd7('0x6'));var interaction=require(_0x2dd7('0x7'));var config=require(_0x2dd7('0x8'));var controller=require('./cmHopperFinal.controller');router[_0x2dd7('0x9')]('/',auth['isAuthenticated'](),controller[_0x2dd7('0xa')]);router[_0x2dd7('0x9')](_0x2dd7('0xb'),auth[_0x2dd7('0xc')](),controller['describe']);router['get'](_0x2dd7('0xd'),auth[_0x2dd7('0xc')](),controller[_0x2dd7('0xe')]);router[_0x2dd7('0x9')](_0x2dd7('0xf'),auth[_0x2dd7('0xc')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x2dd7('0x9')](_0x2dd7('0x10'),auth[_0x2dd7('0xc')](),controller[_0x2dd7('0x11')]);router[_0x2dd7('0x12')](_0x2dd7('0x13'),auth[_0x2dd7('0xc')](),controller[_0x2dd7('0x14')]);router[_0x2dd7('0x12')](_0x2dd7('0x15'),auth[_0x2dd7('0xc')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x2dd7('0x12')](_0x2dd7('0x16'),auth[_0x2dd7('0xc')](),controller[_0x2dd7('0x17')]);router[_0x2dd7('0x18')](_0x2dd7('0xd'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 62e24fd..4b15856 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 _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 +var _0xd115=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0xd115,0x192));var _0x5d11=function(_0x2dfe2c,_0x4fbb07){_0x2dfe2c=_0x2dfe2c-0x0;var _0x565802=_0xd115[_0x2dfe2c];return _0x565802;};'use strict';var Sequelize=require(_0x5d11('0x0'));module[_0x5d11('0x1')]={'state':{'type':Sequelize[_0x5d11('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5d11('0x3')]},'countbusyretry':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5d11('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x5d11('0x4')]},'calleridnum':{'type':Sequelize[_0x5d11('0x4')]},'calleridname':{'type':Sequelize[_0x5d11('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x5d11('0x3')]},'endtime':{'type':Sequelize[_0x5d11('0x3')]},'ringtime':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5d11('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5d11('0x4')]},'membername':{'type':Sequelize[_0x5d11('0x4')]},'reason':{'type':Sequelize[_0x5d11('0x4')]},'amd':{'type':Sequelize[_0x5d11('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x5d11('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d11('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5d11('0x3')]},'edited':{'type':Sequelize[_0x5d11('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5d11('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index f270b8e..d643dad 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 _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 +var _0xc806=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','create','body','describe','uniqueid','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model'];(function(_0x554443,_0x1a6f42){var _0x37f005=function(_0x6d9971){while(--_0x6d9971){_0x554443['push'](_0x554443['shift']());}};_0x37f005(++_0x1a6f42);}(_0xc806,0x143));var _0x6c80=function(_0x47f444,_0x1f4277){_0x47f444=_0x47f444-0x0;var _0x2fa0e6=_0xc806[_0x47f444];return _0x2fa0e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c80('0x0'));var zipdir=require(_0x6c80('0x1'));var jsonpatch=require(_0x6c80('0x2'));var rp=require(_0x6c80('0x3'));var moment=require(_0x6c80('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c80('0x5'));var util=require(_0x6c80('0x6'));var path=require('path');var sox=require(_0x6c80('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c80('0x8'));var _=require('lodash');var squel=require(_0x6c80('0x9'));var crypto=require(_0x6c80('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6c80('0xb'));var toCsv=require(_0x6c80('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c80('0xd'));var qs=require(_0x6c80('0xe'));var as=require(_0x6c80('0xf'));var hardwareService=require(_0x6c80('0x10'));var logger=require(_0x6c80('0x11'))(_0x6c80('0x12'));var utils=require('../../config/utils');var config=require(_0x6c80('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c80('0x14'))['db'];function respondWithStatusCode(_0x58b590,_0x23356f){_0x23356f=_0x23356f||0xcc;return function(_0x24d189){if(_0x24d189){return _0x58b590[_0x6c80('0x15')](_0x23356f);}return _0x58b590[_0x6c80('0x16')](_0x23356f)['end']();};}function respondWithResult(_0x3f7648,_0x29b822){_0x29b822=_0x29b822||0xc8;return function(_0x219c10){if(_0x219c10){return _0x3f7648[_0x6c80('0x16')](_0x29b822)['json'](_0x219c10);}};}function respondWithFilteredResult(_0x4903d8,_0x277312){return function(_0x508e99){if(_0x508e99){var _0xc8d108=typeof _0x277312[_0x6c80('0x17')]===_0x6c80('0x18')&&typeof _0x277312[_0x6c80('0x19')]===_0x6c80('0x18');var _0x4464c5=_0x508e99['count'];var _0xceb71=_0xc8d108?0x0:_0x277312['offset'];var _0x5d2199=_0xc8d108?_0x508e99[_0x6c80('0x1a')]:_0x277312[_0x6c80('0x17')]+_0x277312[_0x6c80('0x19')];var _0x15f8e6;if(_0x5d2199>=_0x4464c5){_0x5d2199=_0x4464c5;_0x15f8e6=0xc8;}else{_0x15f8e6=0xce;}_0x4903d8[_0x6c80('0x16')](_0x15f8e6);return _0x4903d8[_0x6c80('0x1b')](_0x6c80('0x1c'),_0xceb71+'-'+_0x5d2199+'/'+_0x4464c5)[_0x6c80('0x1d')](_0x508e99);}return null;};}function patchUpdates(_0x39e6a2){return function(_0x168a20){try{jsonpatch[_0x6c80('0x1e')](_0x168a20,_0x39e6a2,!![]);}catch(_0x570b9f){return BPromise['reject'](_0x570b9f);}return _0x168a20[_0x6c80('0x1f')]();};}function saveUpdates(_0x266cc7,_0x281e67){return function(_0x1098c4){if(_0x1098c4){return _0x1098c4[_0x6c80('0x20')](_0x266cc7)[_0x6c80('0x21')](function(_0x27ec26){return _0x27ec26;});}return null;};}function removeEntity(_0x45fc9f,_0x215124){return function(_0x3e9c7c){if(_0x3e9c7c){return _0x3e9c7c[_0x6c80('0x22')]()[_0x6c80('0x21')](function(){_0x45fc9f[_0x6c80('0x16')](0xcc)[_0x6c80('0x23')]();});}};}function handleEntityNotFound(_0x2b976e,_0x18b351){return function(_0x1ad82a){if(!_0x1ad82a){_0x2b976e[_0x6c80('0x15')](0x194);}return _0x1ad82a;};}function handleError(_0x5f2bf4,_0x51257c){_0x51257c=_0x51257c||0x1f4;return function(_0x10ee07){logger[_0x6c80('0x24')](_0x10ee07[_0x6c80('0x25')]);if(_0x10ee07[_0x6c80('0x26')]){delete _0x10ee07[_0x6c80('0x26')];}_0x5f2bf4[_0x6c80('0x16')](_0x51257c)[_0x6c80('0x27')](_0x10ee07);};}exports['index']=function(_0x1c9093,_0x5f006b){var _0xf2e41e={},_0x5f1b88={},_0x319dfb={'count':0x0,'rows':[]};var _0x25421c=_[_0x6c80('0x28')](db[_0x6c80('0x29')][_0x6c80('0x2a')],function(_0x1b9e2d){return{'name':_0x1b9e2d[_0x6c80('0x2b')],'type':_0x1b9e2d[_0x6c80('0x2c')][_0x6c80('0x2d')]};});_0x5f1b88[_0x6c80('0x2e')]=_[_0x6c80('0x28')](_0x25421c,_0x6c80('0x26'));_0x5f1b88[_0x6c80('0x2f')]=_[_0x6c80('0x30')](_0x1c9093['query']);_0x5f1b88[_0x6c80('0x31')]=_[_0x6c80('0x32')](_0x5f1b88[_0x6c80('0x2e')],_0x5f1b88[_0x6c80('0x2f')]);_0xf2e41e[_0x6c80('0x33')]=_[_0x6c80('0x32')](_0x5f1b88[_0x6c80('0x2e')],qs[_0x6c80('0x34')](_0x1c9093[_0x6c80('0x2f')]['fields']));_0xf2e41e[_0x6c80('0x33')]=_0xf2e41e[_0x6c80('0x33')][_0x6c80('0x35')]?_0xf2e41e[_0x6c80('0x33')]:_0x5f1b88['model'];if(!_0x1c9093[_0x6c80('0x2f')][_0x6c80('0x36')](_0x6c80('0x37'))){_0xf2e41e[_0x6c80('0x19')]=qs[_0x6c80('0x19')](_0x1c9093[_0x6c80('0x2f')][_0x6c80('0x19')]);_0xf2e41e['offset']=qs[_0x6c80('0x17')](_0x1c9093[_0x6c80('0x2f')][_0x6c80('0x17')]);}_0xf2e41e[_0x6c80('0x38')]=qs['sort'](_0x1c9093['query']['sort']);_0xf2e41e[_0x6c80('0x39')]=qs[_0x6c80('0x31')](_[_0x6c80('0x3a')](_0x1c9093[_0x6c80('0x2f')],_0x5f1b88[_0x6c80('0x31')]),_0x25421c);if(_0x1c9093[_0x6c80('0x2f')][_0x6c80('0x3b')]){_0xf2e41e[_0x6c80('0x39')]=_[_0x6c80('0x3c')](_0xf2e41e[_0x6c80('0x39')],{'$or':_[_0x6c80('0x28')](_0x25421c,function(_0x55af19){if(_0x55af19[_0x6c80('0x2c')]!==_0x6c80('0x3d')){var _0x38e862={};_0x38e862[_0x55af19[_0x6c80('0x26')]]={'$like':'%'+_0x1c9093[_0x6c80('0x2f')]['filter']+'%'};return _0x38e862;}})});}_0xf2e41e=_['merge']({},_0xf2e41e,_0x1c9093[_0x6c80('0x3e')]);var _0xd5325a={'where':_0xf2e41e[_0x6c80('0x39')]};return db['CmHopperHistory'][_0x6c80('0x1a')](_0xd5325a)['then'](function(_0x3c34c1){_0x319dfb['count']=_0x3c34c1;if(_0x1c9093[_0x6c80('0x2f')]['includeAll']){_0xf2e41e['include']=[{'all':!![]}];}return db[_0x6c80('0x29')][_0x6c80('0x3f')](_0xf2e41e);})[_0x6c80('0x21')](function(_0x4a3a6d){_0x319dfb[_0x6c80('0x40')]=_0x4a3a6d;return _0x319dfb;})['then'](respondWithFilteredResult(_0x5f006b,_0xf2e41e))[_0x6c80('0x41')](handleError(_0x5f006b,null));};exports[_0x6c80('0x42')]=function(_0x5d9829,_0x423af3){var _0x505344={'raw':!![],'where':{'id':_0x5d9829['params']['id']}},_0x120e65={};_0x120e65[_0x6c80('0x2e')]=_['keys'](db['CmHopperHistory'][_0x6c80('0x2a')]);_0x120e65['query']=_['keys'](_0x5d9829[_0x6c80('0x2f')]);_0x120e65['filters']=_[_0x6c80('0x32')](_0x120e65['model'],_0x120e65[_0x6c80('0x2f')]);_0x505344['attributes']=_[_0x6c80('0x32')](_0x120e65[_0x6c80('0x2e')],qs['fields'](_0x5d9829['query'][_0x6c80('0x34')]));_0x505344[_0x6c80('0x33')]=_0x505344[_0x6c80('0x33')]['length']?_0x505344[_0x6c80('0x33')]:_0x120e65[_0x6c80('0x2e')];if(_0x5d9829[_0x6c80('0x2f')][_0x6c80('0x43')]){_0x505344[_0x6c80('0x44')]=[{'all':!![]}];}_0x505344=_[_0x6c80('0x3c')]({},_0x505344,_0x5d9829['options']);return db[_0x6c80('0x29')]['find'](_0x505344)[_0x6c80('0x21')](handleEntityNotFound(_0x423af3,null))[_0x6c80('0x21')](respondWithResult(_0x423af3,null))[_0x6c80('0x41')](handleError(_0x423af3,null));};exports[_0x6c80('0x45')]=function(_0x4add35,_0x4d91a1){return db[_0x6c80('0x29')]['create'](_0x4add35[_0x6c80('0x46')],{})[_0x6c80('0x21')](respondWithResult(_0x4d91a1,0xc9))[_0x6c80('0x41')](handleError(_0x4d91a1,null));};exports[_0x6c80('0x47')]=function(_0x22112f,_0x570219){return db[_0x6c80('0x29')][_0x6c80('0x47')]()[_0x6c80('0x21')](respondWithResult(_0x570219,null))['catch'](handleError(_0x570219,null));};exports[_0x6c80('0x20')]=function(_0x4ca432,_0x2d0520){if(_0x4ca432[_0x6c80('0x46')][_0x6c80('0x48')]){delete _0x4ca432[_0x6c80('0x46')]['uniqueid'];}return db[_0x6c80('0x29')]['find']({'where':{'uniqueid':_0x4ca432[_0x6c80('0x49')]['id']}})[_0x6c80('0x21')](handleEntityNotFound(_0x2d0520,null))[_0x6c80('0x21')](saveUpdates(_0x4ca432['body'],null))[_0x6c80('0x21')](respondWithResult(_0x2d0520,null))[_0x6c80('0x41')](handleError(_0x2d0520,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index bf4d729..a362932 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 _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 +var _0xff01=['request-promise','path','../../config/environment','exports','cm_hopper_history','endtime','uniqueid','lodash','util','api','bluebird'];(function(_0x355d72,_0x138673){var _0x2ae2ec=function(_0x1a1e37){while(--_0x1a1e37){_0x355d72['push'](_0x355d72['shift']());}};_0x2ae2ec(++_0x138673);}(_0xff01,0xb7));var _0x1ff0=function(_0x29422e,_0x3d9af0){_0x29422e=_0x29422e-0x0;var _0x262d6e=_0xff01[_0x29422e];return _0x262d6e;};'use strict';var _=require(_0x1ff0('0x0'));var util=require(_0x1ff0('0x1'));var logger=require('../../config/logger')(_0x1ff0('0x2'));var moment=require('moment');var BPromise=require(_0x1ff0('0x3'));var rp=require(_0x1ff0('0x4'));var fs=require('fs');var path=require(_0x1ff0('0x5'));var rimraf=require('rimraf');var config=require(_0x1ff0('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0x1ff0('0x7')]=function(_0x4fd1b6,_0x3f8ca1){return _0x4fd1b6['define']('CmHopperHistory',attributes,{'tableName':_0x1ff0('0x8'),'paranoid':![],'indexes':[{'name':_0x1ff0('0x9'),'fields':['endtime']},{'name':_0x1ff0('0xa'),'fields':[_0x1ff0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index fea22c9..0b60990 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 _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 +var _0xb248=['debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperHistory','create','options','raw','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent'];(function(_0x5af532,_0x20afd7){var _0x2fa209=function(_0x27886e){while(--_0x27886e){_0x5af532['push'](_0x5af532['shift']());}};_0x2fa209(++_0x20afd7);}(_0xb248,0xc6));var _0x8b24=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xb248[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x8b24('0x0'));var util=require('util');var moment=require(_0x8b24('0x1'));var BPromise=require(_0x8b24('0x2'));var rs=require(_0x8b24('0x3'));var fs=require('fs');var Redis=require(_0x8b24('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b24('0x5'));var logger=require(_0x8b24('0x6'))('rpc');var config=require(_0x8b24('0x7'));var jayson=require(_0x8b24('0x8'));var client=jayson['client'][_0x8b24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4705e0,_0x588ca8,_0x3198a2){return new BPromise(function(_0x51bbad,_0x43b851){return client[_0x8b24('0xa')](_0x4705e0,_0x3198a2)[_0x8b24('0xb')](function(_0x4ad0db){logger[_0x8b24('0xc')](_0x8b24('0xd'),_0x588ca8,_0x8b24('0xe'));logger[_0x8b24('0xf')](_0x8b24('0x10'),_0x588ca8,_0x8b24('0xe'),JSON[_0x8b24('0x11')](_0x4ad0db));if(_0x4ad0db[_0x8b24('0x12')]){if(_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x13')]===0x1f4){logger[_0x8b24('0x12')](_0x8b24('0xd'),_0x588ca8,_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);return _0x43b851(_0x4ad0db['error']['message']);}logger[_0x8b24('0x12')](_0x8b24('0xd'),_0x588ca8,_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);return _0x51bbad(_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);}else{logger[_0x8b24('0xc')](_0x8b24('0xd'),_0x588ca8,'request\x20sent');_0x51bbad(_0x4ad0db['result']['message']);}})[_0x8b24('0x15')](function(_0x523863){logger['error'](_0x8b24('0xd'),_0x588ca8,_0x523863);_0x43b851(_0x523863);});});}exports[_0x8b24('0x16')]=function(_0x527af7){var _0x1bafdf=this;return new Promise(function(_0x5e3c52,_0x3b4805){return db['CmHopperHistory'][_0x8b24('0x17')](_0x527af7['body'],{'raw':_0x527af7[_0x8b24('0x18')]?_0x527af7[_0x8b24('0x18')][_0x8b24('0x19')]===undefined?!![]:![]:!![]})[_0x8b24('0xb')](function(_0x2a4f2d){logger[_0x8b24('0xc')](_0x8b24('0x16'),_0x527af7);logger['debug'](_0x8b24('0x16'),_0x527af7,JSON[_0x8b24('0x11')](_0x2a4f2d));_0x5e3c52(_0x2a4f2d);})['catch'](function(_0xd9b96){logger[_0x8b24('0x12')](_0x8b24('0x16'),_0xd9b96[_0x8b24('0x14')],_0x527af7);_0x3b4805(_0x1bafdf[_0x8b24('0x12')](0x1f4,_0xd9b96[_0x8b24('0x14')]));});});};exports[_0x8b24('0x1a')]=function(_0x3fddf8){var _0x2e8c46=this;return new Promise(function(_0xc1dc78,_0x2dd44b){return db[_0x8b24('0x1b')][_0x8b24('0x1c')]({'raw':_0x3fddf8[_0x8b24('0x18')]?_0x3fddf8[_0x8b24('0x18')][_0x8b24('0x19')]===undefined?!![]:![]:!![],'where':_0x3fddf8[_0x8b24('0x18')]?_0x3fddf8[_0x8b24('0x18')][_0x8b24('0x1d')]||null:null,'attributes':[[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')][_0x8b24('0x20')]('id')),_0x8b24('0x21')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')]['literal'](_0x8b24('0x22')))),_0x8b24('0x23')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),_0x8b24('0x25')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x8b24('0x26')))),_0x8b24('0x27')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x28'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x29')))),_0x8b24('0x2a')],[db['sequelize']['fn'](_0x8b24('0x28'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')]['literal'](_0x8b24('0x2b')))),_0x8b24('0x2c')]]})[_0x8b24('0xb')](function(_0x3567b2){logger[_0x8b24('0xc')](_0x8b24('0x1a'),_0x3fddf8);logger[_0x8b24('0xf')](_0x8b24('0x1a'),_0x3fddf8,JSON[_0x8b24('0x11')](_0x3567b2));_0xc1dc78(_0x3567b2);})['catch'](function(_0xdb46f5){logger[_0x8b24('0x12')]('AvgHandleTime',_0xdb46f5[_0x8b24('0x14')],_0x3fddf8);_0x2dd44b(_0x2e8c46[_0x8b24('0x12')](0x1f4,_0xdb46f5['message']));});});};exports[_0x8b24('0x2d')]=function(_0x1e9705){var _0x45ce67=this;return new Promise(function(_0xce3162,_0x51a2f3){return db[_0x8b24('0x1b')][_0x8b24('0x1c')]({'raw':_0x1e9705[_0x8b24('0x18')]?_0x1e9705[_0x8b24('0x18')][_0x8b24('0x19')]===undefined?!![]:![]:!![],'where':_0x1e9705[_0x8b24('0x18')]?_0x1e9705['options'][_0x8b24('0x1d')]||null:null,'attributes':[[_0x8b24('0x2e'),_0x8b24('0x2f')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x30')))),_0x8b24('0x31')],[db[_0x8b24('0x1e')]['fn']('COUNT',db[_0x8b24('0x1e')]['fn']('IF',db['sequelize'][_0x8b24('0x24')](_0x8b24('0x32')))),_0x8b24('0x33')],[db['sequelize']['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')]['literal'](_0x8b24('0x22')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x8b24('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8b24('0x24')](_0x8b24('0x34')))),_0x8b24('0x35')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x8b24('0x36')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db['sequelize'][_0x8b24('0x24')](_0x8b24('0x37')))),_0x8b24('0x38')],[db['sequelize']['fn'](_0x8b24('0x1f'),db['sequelize']['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8b24('0x39')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x3a')))),_0x8b24('0x3b')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')]['literal'](_0x8b24('0x3c')))),'outboundBlacklistCallsDay'],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8b24('0x24')](_0x8b24('0x3d')))),_0x8b24('0x3e')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x8b24('0x1f'),db['sequelize']['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x3f')))),_0x8b24('0x40')],[db['sequelize']['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x41')))),_0x8b24('0x42')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x43')))),_0x8b24('0x44')]],'group':[_0x8b24('0x2e')]})[_0x8b24('0xb')](function(_0x19bf6f){logger[_0x8b24('0xc')]('GetVoiceQueueHopperHistory',_0x1e9705);logger[_0x8b24('0xf')](_0x8b24('0x2d'),_0x1e9705,JSON[_0x8b24('0x11')](_0x19bf6f));_0xce3162(_0x19bf6f);})[_0x8b24('0x15')](function(_0x4bac9f){logger[_0x8b24('0x12')](_0x8b24('0x2d'),_0x4bac9f[_0x8b24('0x14')],_0x1e9705);_0x51a2f3(_0x45ce67[_0x8b24('0x12')](0x1f4,_0x4bac9f[_0x8b24('0x14')]));});});};exports[_0x8b24('0x45')]=function(_0x347f33){var _0x20188b=this;return new Promise(function(_0x15b96f,_0x17cf69){return db[_0x8b24('0x1b')][_0x8b24('0x1c')]({'raw':_0x347f33[_0x8b24('0x18')]?_0x347f33[_0x8b24('0x18')][_0x8b24('0x19')]===undefined?!![]:![]:!![],'where':_0x347f33[_0x8b24('0x18')]?_0x347f33['options']['where']||null:null,'attributes':[['campaign',_0x8b24('0x2f')],[db['sequelize']['fn']('COUNT',db[_0x8b24('0x1e')][_0x8b24('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x22')))),_0x8b24('0x46')]],'group':['campaign']})[_0x8b24('0xb')](function(_0x405172){logger[_0x8b24('0xc')]('GetCampaignHopperHistory',_0x347f33);logger['debug'](_0x8b24('0x45'),_0x347f33,JSON[_0x8b24('0x11')](_0x405172));_0x15b96f(_0x405172);})[_0x8b24('0x15')](function(_0x5a419c){logger[_0x8b24('0x12')]('GetCampaignHopperHistory',_0x5a419c[_0x8b24('0x14')],_0x347f33);_0x17cf69(_0x20188b[_0x8b24('0x12')](0x1f4,_0x5a419c[_0x8b24('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index efca338..216c0de 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 _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 +var _0x6008=['show','post','create','put','update','exports','path','express','fs-extra','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x479407,_0x136ea4){var _0x393ac0=function(_0x1fce7f){while(--_0x1fce7f){_0x479407['push'](_0x479407['shift']());}};_0x393ac0(++_0x136ea4);}(_0x6008,0x1b9));var _0x8600=function(_0x42b645,_0x193beb){_0x42b645=_0x42b645-0x0;var _0x16e5a8=_0x6008[_0x42b645];return _0x16e5a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8600('0x0'));var timeout=require('connect-timeout');var express=require(_0x8600('0x1'));var router=express['Router']();var fs_extra=require(_0x8600('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8600('0x3'));router['get']('/',auth[_0x8600('0x4')](),controller[_0x8600('0x5')]);router[_0x8600('0x6')](_0x8600('0x7'),auth[_0x8600('0x4')](),controller['describe']);router[_0x8600('0x6')](_0x8600('0x8'),auth[_0x8600('0x4')](),controller[_0x8600('0x9')]);router[_0x8600('0xa')]('/',auth[_0x8600('0x4')](),controller[_0x8600('0xb')]);router[_0x8600('0xc')](_0x8600('0x8'),auth[_0x8600('0x4')](),controller[_0x8600('0xd')]);module[_0x8600('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 5dff457..04e5421 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 _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 +var _0x0f89=['sequelize','exports','STRING'];(function(_0x54c38c,_0x11fc30){var _0xfcc1f8=function(_0x261718){while(--_0x261718){_0x54c38c['push'](_0x54c38c['shift']());}};_0xfcc1f8(++_0x11fc30);}(_0x0f89,0x111));var _0x90f8=function(_0x3a9955,_0x424c88){_0x3a9955=_0x3a9955-0x0;var _0xd9dafd=_0x0f89[_0x3a9955];return _0xd9dafd;};'use strict';var Sequelize=require(_0x90f8('0x0'));module[_0x90f8('0x1')]={'name':{'type':Sequelize[_0x90f8('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x90f8('0x2')]},'dialPrefix':{'type':Sequelize[_0x90f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index af0c3c2..570bd00 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 _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 +var _0x2f3d=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','localhost','redis','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','get','Lists','error','stack','name','send','map','CmList','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','item','from','cm_contact_has_items','additionalPhone_','description','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','request-promise'];(function(_0x560bbf,_0x519bbe){var _0x12a2a0=function(_0x2ff0a1){while(--_0x2ff0a1){_0x560bbf['push'](_0x560bbf['shift']());}};_0x12a2a0(++_0x519bbe);}(_0x2f3d,0xa6));var _0xd2f3=function(_0x125f69,_0x201680){_0x125f69=_0x125f69-0x0;var _0x22e9ce=_0x2f3d[_0x125f69];return _0x22e9ce;};'use strict';var emlformat=require(_0xd2f3('0x0'));var rimraf=require(_0xd2f3('0x1'));var zipdir=require(_0xd2f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2f3('0x3'));var moment=require('moment');var BPromise=require(_0xd2f3('0x4'));var Mustache=require(_0xd2f3('0x5'));var util=require(_0xd2f3('0x6'));var path=require(_0xd2f3('0x7'));var sox=require(_0xd2f3('0x8'));var csv=require(_0xd2f3('0x9'));var ejs=require(_0xd2f3('0xa'));var fs=require('fs');var fs_extra=require(_0xd2f3('0xb'));var _=require(_0xd2f3('0xc'));var squel=require(_0xd2f3('0xd'));var crypto=require(_0xd2f3('0xe'));var jsforce=require(_0xd2f3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd2f3('0x9'));var querystring=require('querystring');var Papa=require(_0xd2f3('0x10'));var Redis=require(_0xd2f3('0x11'));var authService=require(_0xd2f3('0x12'));var qs=require(_0xd2f3('0x13'));var as=require(_0xd2f3('0x14'));var hardwareService=require(_0xd2f3('0x15'));var logger=require(_0xd2f3('0x16'))(_0xd2f3('0x17'));var utils=require(_0xd2f3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd2f3('0x19'));var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0xd2f3('0x1a')](config['redis'],{'host':_0xd2f3('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2f3('0x1c')]));require(_0xd2f3('0x1d'))[_0xd2f3('0x1e')](socket);function respondWithStatusCode(_0x4f4d9b,_0x144f02){_0x144f02=_0x144f02||0xcc;return function(_0x57b0f8){if(_0x57b0f8){return _0x4f4d9b[_0xd2f3('0x1f')](_0x144f02);}return _0x4f4d9b[_0xd2f3('0x20')](_0x144f02)[_0xd2f3('0x21')]();};}function respondWithResult(_0x1d1c53,_0x28d724){_0x28d724=_0x28d724||0xc8;return function(_0x59b022){if(_0x59b022){return _0x1d1c53['status'](_0x28d724)[_0xd2f3('0x22')](_0x59b022);}};}function respondWithFilteredResult(_0x134148,_0xb0dc6a){return function(_0x51c88d){if(_0x51c88d){var _0x210148=typeof _0xb0dc6a[_0xd2f3('0x23')]===_0xd2f3('0x24')&&typeof _0xb0dc6a['limit']===_0xd2f3('0x24');var _0x53fda7=_0x51c88d['count'];var _0x3f12da=_0x210148?0x0:_0xb0dc6a[_0xd2f3('0x23')];var _0x2e562c=_0x210148?_0x51c88d['count']:_0xb0dc6a['offset']+_0xb0dc6a[_0xd2f3('0x25')];var _0x40eaf3;if(_0x2e562c>=_0x53fda7){_0x2e562c=_0x53fda7;_0x40eaf3=0xc8;}else{_0x40eaf3=0xce;}_0x134148['status'](_0x40eaf3);return _0x134148[_0xd2f3('0x26')]('Content-Range',_0x3f12da+'-'+_0x2e562c+'/'+_0x53fda7)[_0xd2f3('0x22')](_0x51c88d);}return null;};}function patchUpdates(_0x24f87a){return function(_0x5b0a13){try{jsonpatch[_0xd2f3('0x27')](_0x5b0a13,_0x24f87a,!![]);}catch(_0x4931ed){return BPromise[_0xd2f3('0x28')](_0x4931ed);}return _0x5b0a13[_0xd2f3('0x29')]();};}function saveUpdates(_0x4f7fbe,_0x5a8a58){return function(_0x389d3e){if(_0x389d3e){return _0x389d3e[_0xd2f3('0x2a')](_0x4f7fbe)[_0xd2f3('0x2b')](function(_0x3f5eda){return _0x3f5eda;});}return null;};}function removeEntity(_0x13b8de,_0x3abce0){return function(_0x3c21ed){if(_0x3c21ed){return _0x3c21ed[_0xd2f3('0x2c')]()[_0xd2f3('0x2b')](function(){var _0x5e93dd=_0x3c21ed[_0xd2f3('0x2d')]({'plain':!![]});var _0x1afe56=_0xd2f3('0x2e');return db['UserProfileResource'][_0xd2f3('0x2c')]({'where':{'type':_0x1afe56,'resourceId':_0x5e93dd['id']}})['then'](function(){return _0x3c21ed;});})['then'](function(){_0x13b8de[_0xd2f3('0x20')](0xcc)[_0xd2f3('0x21')]();});}};}function handleEntityNotFound(_0x5ef254,_0x514b65){return function(_0x2dc01c){if(!_0x2dc01c){_0x5ef254[_0xd2f3('0x1f')](0x194);}return _0x2dc01c;};}function handleError(_0x3e4458,_0x4340e2){_0x4340e2=_0x4340e2||0x1f4;return function(_0x2aae31){logger[_0xd2f3('0x2f')](_0x2aae31[_0xd2f3('0x30')]);if(_0x2aae31[_0xd2f3('0x31')]){delete _0x2aae31[_0xd2f3('0x31')];}_0x3e4458[_0xd2f3('0x20')](_0x4340e2)[_0xd2f3('0x32')](_0x2aae31);};}exports['index']=function(_0x4cf6bc,_0x3316dc){var _0x3cf2b7={},_0x5de5f1={},_0x4f8876={'count':0x0,'rows':[]};var _0x22fa5c=_[_0xd2f3('0x33')](db[_0xd2f3('0x34')][_0xd2f3('0x35')],function(_0x27ac6e){return{'name':_0x27ac6e[_0xd2f3('0x36')],'type':_0x27ac6e['type']['key']};});_0x5de5f1[_0xd2f3('0x37')]=_[_0xd2f3('0x33')](_0x22fa5c,'name');_0x5de5f1[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x4cf6bc[_0xd2f3('0x38')]);_0x5de5f1['filters']=_['intersection'](_0x5de5f1[_0xd2f3('0x37')],_0x5de5f1[_0xd2f3('0x38')]);_0x3cf2b7[_0xd2f3('0x3a')]=_[_0xd2f3('0x3b')](_0x5de5f1['model'],qs[_0xd2f3('0x3c')](_0x4cf6bc[_0xd2f3('0x38')][_0xd2f3('0x3c')]));_0x3cf2b7['attributes']=_0x3cf2b7[_0xd2f3('0x3a')][_0xd2f3('0x3d')]?_0x3cf2b7[_0xd2f3('0x3a')]:_0x5de5f1['model'];if(!_0x4cf6bc['query'][_0xd2f3('0x3e')](_0xd2f3('0x3f'))){_0x3cf2b7[_0xd2f3('0x25')]=qs[_0xd2f3('0x25')](_0x4cf6bc['query']['limit']);_0x3cf2b7[_0xd2f3('0x23')]=qs[_0xd2f3('0x23')](_0x4cf6bc[_0xd2f3('0x38')][_0xd2f3('0x23')]);}_0x3cf2b7[_0xd2f3('0x40')]=qs['sort'](_0x4cf6bc[_0xd2f3('0x38')][_0xd2f3('0x41')]);_0x3cf2b7[_0xd2f3('0x42')]=qs[_0xd2f3('0x43')](_[_0xd2f3('0x44')](_0x4cf6bc['query'],_0x5de5f1['filters']),_0x22fa5c);if(_0x4cf6bc['query'][_0xd2f3('0x45')]){_0x3cf2b7[_0xd2f3('0x42')]=_[_0xd2f3('0x46')](_0x3cf2b7[_0xd2f3('0x42')],{'$or':_[_0xd2f3('0x33')](_0x22fa5c,function(_0x251bc4){if(_0x251bc4[_0xd2f3('0x47')]!==_0xd2f3('0x48')){var _0x1e5aed={};_0x1e5aed[_0x251bc4[_0xd2f3('0x31')]]={'$like':'%'+_0x4cf6bc[_0xd2f3('0x38')][_0xd2f3('0x45')]+'%'};return _0x1e5aed;}})});}_0x3cf2b7=_['merge']({},_0x3cf2b7,_0x4cf6bc[_0xd2f3('0x49')]);var _0x577a24={'where':_0x3cf2b7[_0xd2f3('0x42')]};return db[_0xd2f3('0x34')][_0xd2f3('0x4a')](_0x577a24)[_0xd2f3('0x2b')](function(_0xefa2e){_0x4f8876[_0xd2f3('0x4a')]=_0xefa2e;if(_0x4cf6bc[_0xd2f3('0x38')][_0xd2f3('0x4b')]){_0x3cf2b7[_0xd2f3('0x4c')]=[{'all':!![]}];}return db[_0xd2f3('0x34')][_0xd2f3('0x4d')](_0x3cf2b7);})[_0xd2f3('0x2b')](function(_0x4bd9c7){_0x4f8876[_0xd2f3('0x4e')]=_0x4bd9c7;return _0x4f8876;})[_0xd2f3('0x2b')](respondWithFilteredResult(_0x3316dc,_0x3cf2b7))['catch'](handleError(_0x3316dc,null));};exports[_0xd2f3('0x4f')]=function(_0x151b3b,_0x4ce4f0){var _0x195b31={'raw':![],'where':{'id':_0x151b3b[_0xd2f3('0x50')]['id']}},_0x433656={};_0x433656[_0xd2f3('0x37')]=_[_0xd2f3('0x39')](db[_0xd2f3('0x34')][_0xd2f3('0x35')]);_0x433656[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x151b3b[_0xd2f3('0x38')]);_0x433656['filters']=_[_0xd2f3('0x3b')](_0x433656[_0xd2f3('0x37')],_0x433656[_0xd2f3('0x38')]);_0x195b31[_0xd2f3('0x3a')]=_[_0xd2f3('0x3b')](_0x433656['model'],qs[_0xd2f3('0x3c')](_0x151b3b[_0xd2f3('0x38')][_0xd2f3('0x3c')]));_0x195b31[_0xd2f3('0x3a')]=_0x195b31[_0xd2f3('0x3a')][_0xd2f3('0x3d')]?_0x195b31[_0xd2f3('0x3a')]:_0x433656[_0xd2f3('0x37')];if(_0x151b3b[_0xd2f3('0x38')]['includeAll']){_0x195b31[_0xd2f3('0x4c')]=[{'all':!![]}];}_0x195b31=_[_0xd2f3('0x46')]({},_0x195b31,_0x151b3b[_0xd2f3('0x49')]);return db['CmList'][_0xd2f3('0x51')](_0x195b31)[_0xd2f3('0x2b')](handleEntityNotFound(_0x4ce4f0,null))[_0xd2f3('0x2b')](respondWithResult(_0x4ce4f0,null))[_0xd2f3('0x52')](handleError(_0x4ce4f0,null));};exports[_0xd2f3('0x53')]=function(_0x3be6cd,_0x1a4303){return db[_0xd2f3('0x34')][_0xd2f3('0x53')](_0x3be6cd[_0xd2f3('0x54')],{})[_0xd2f3('0x2b')](function(_0x55900b){var _0x147104=_0x3be6cd[_0xd2f3('0x55')]['get']({'plain':!![]});if(!_0x147104)throw new Error(_0xd2f3('0x56'));if(_0x147104[_0xd2f3('0x57')]===_0xd2f3('0x55')){var _0x6f794d=_0x55900b[_0xd2f3('0x2d')]({'plain':!![]});var _0x33dbe1=_0xd2f3('0x2e');return db[_0xd2f3('0x58')]['find']({'where':{'name':_0x33dbe1,'userProfileId':_0x147104[_0xd2f3('0x59')]},'raw':!![]})['then'](function(_0x3ce686){if(_0x3ce686&&_0x3ce686['autoAssociation']===0x0){return db[_0xd2f3('0x5a')][_0xd2f3('0x53')]({'name':_0x6f794d[_0xd2f3('0x31')],'resourceId':_0x6f794d['id'],'type':_0x3ce686[_0xd2f3('0x31')],'sectionId':_0x3ce686['id']},{})[_0xd2f3('0x2b')](function(){return _0x55900b;});}else{return _0x55900b;}})[_0xd2f3('0x52')](function(_0x251621){logger[_0xd2f3('0x2f')](_0xd2f3('0x5b'),_0x251621);throw _0x251621;});}return _0x55900b;})['then'](respondWithResult(_0x1a4303,0xc9))['catch'](handleError(_0x1a4303,null));};exports[_0xd2f3('0x2a')]=function(_0x376d0e,_0x3ef136){if(_0x376d0e[_0xd2f3('0x54')]['id']){delete _0x376d0e['body']['id'];}return db[_0xd2f3('0x34')][_0xd2f3('0x51')]({'where':{'id':_0x376d0e[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x3ef136,null))[_0xd2f3('0x2b')](saveUpdates(_0x376d0e['body'],null))[_0xd2f3('0x2b')](respondWithResult(_0x3ef136,null))['catch'](handleError(_0x3ef136,null));};exports[_0xd2f3('0x2c')]=function(_0x32c651,_0x177047){return db['CmList'][_0xd2f3('0x51')]({'where':{'id':_0x32c651[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x177047,null))['then'](removeEntity(_0x177047,null))[_0xd2f3('0x52')](handleError(_0x177047,null));};exports[_0xd2f3('0x5c')]=function(_0x3093c2,_0x2c7048){return db['CmList'][_0xd2f3('0x5c')]()[_0xd2f3('0x2b')](respondWithResult(_0x2c7048,null))[_0xd2f3('0x52')](handleError(_0x2c7048,null));};exports['addDisposition']=function(_0x3e9cc9,_0x2878db,_0x5e0a5e){if(_0x3e9cc9[_0xd2f3('0x54')]['id']){delete _0x3e9cc9['body']['id'];}return db[_0xd2f3('0x34')][_0xd2f3('0x51')]({'where':{'id':_0x3e9cc9[_0xd2f3('0x50')]['id']}})['then'](handleEntityNotFound(_0x2878db,null))['then'](function(_0x5365f2){if(_0x5365f2){_0x3e9cc9[_0xd2f3('0x54')][_0xd2f3('0x5d')]=_0x5365f2['id'];return db[_0xd2f3('0x5e')][_0xd2f3('0x53')](_0x3e9cc9['body']);}})['then'](respondWithResult(_0x2878db,null))[_0xd2f3('0x52')](handleError(_0x2878db,null));};exports[_0xd2f3('0x5f')]=function(_0x1beb39,_0x1c1a4a,_0x26735f){var _0x4d496b={'raw':![],'where':{}};var _0x48f59c={};var _0x166bac={'count':0x0,'rows':[]};return db[_0xd2f3('0x34')][_0xd2f3('0x60')]({'where':{'id':_0x1beb39[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x1c1a4a,null))[_0xd2f3('0x2b')](function(_0x25116a){if(_0x25116a){_0x48f59c[_0xd2f3('0x37')]=_['keys'](db[_0xd2f3('0x5e')][_0xd2f3('0x35')]);_0x48f59c[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x1beb39['query']);_0x48f59c[_0xd2f3('0x43')]=_[_0xd2f3('0x3b')](_0x48f59c[_0xd2f3('0x37')],_0x48f59c[_0xd2f3('0x38')]);_0x4d496b[_0xd2f3('0x3a')]=_['intersection'](_0x48f59c[_0xd2f3('0x37')],qs['fields'](_0x1beb39[_0xd2f3('0x38')][_0xd2f3('0x3c')]));_0x4d496b[_0xd2f3('0x3a')]=_0x4d496b[_0xd2f3('0x3a')]['length']?_0x4d496b[_0xd2f3('0x3a')]:_0x48f59c[_0xd2f3('0x37')];if(!_0x1beb39[_0xd2f3('0x38')]['hasOwnProperty'](_0xd2f3('0x3f'))){_0x4d496b[_0xd2f3('0x25')]=qs[_0xd2f3('0x25')](_0x1beb39['query']['limit']);_0x4d496b[_0xd2f3('0x23')]=qs[_0xd2f3('0x23')](_0x1beb39['query'][_0xd2f3('0x23')]);}_0x4d496b[_0xd2f3('0x40')]=qs[_0xd2f3('0x41')](_0x1beb39[_0xd2f3('0x38')]['sort']);_0x4d496b[_0xd2f3('0x42')]=qs[_0xd2f3('0x43')](_[_0xd2f3('0x44')](_0x1beb39[_0xd2f3('0x38')],_0x48f59c[_0xd2f3('0x43')]));_0x4d496b[_0xd2f3('0x42')][_0xd2f3('0x5d')]=_0x25116a['id'];if(_0x1beb39[_0xd2f3('0x38')][_0xd2f3('0x45')]){_0x4d496b['where']=_[_0xd2f3('0x46')](_0x4d496b[_0xd2f3('0x42')],{'$or':_[_0xd2f3('0x33')](_0x4d496b[_0xd2f3('0x3a')],function(_0x688eb7){var _0x58845b={};_0x58845b[_0x688eb7]={'$like':'%'+_0x1beb39['query'][_0xd2f3('0x45')]+'%'};return _0x58845b;})});}_0x4d496b=_['merge']({},_0x4d496b,_0x1beb39[_0xd2f3('0x49')]);return db['Disposition'][_0xd2f3('0x4a')]({'where':_0x4d496b[_0xd2f3('0x42')]})[_0xd2f3('0x2b')](function(_0x5caf89){_0x166bac[_0xd2f3('0x4a')]=_0x5caf89;if(_0x1beb39['query']['includeAll']){_0x4d496b['include']=[{'all':!![]}];}return db['Disposition'][_0xd2f3('0x4d')](_0x4d496b);})[_0xd2f3('0x2b')](function(_0xbed3a9){_0x166bac[_0xd2f3('0x4e')]=_0xbed3a9;return _0x166bac;});}})[_0xd2f3('0x2b')](respondWithFilteredResult(_0x1c1a4a,_0x4d496b))['catch'](handleError(_0x1c1a4a,null));};exports[_0xd2f3('0x61')]=function(_0x5a9628,_0x560af6,_0x151d90){return db['CmList'][_0xd2f3('0x51')]({'where':{'id':_0x5a9628['params']['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x560af6,null))[_0xd2f3('0x2b')](function(_0xfe57e3){if(_0xfe57e3){return _0xfe57e3[_0xd2f3('0x61')](_0x5a9628['query'][_0xd2f3('0x62')]);}})[_0xd2f3('0x2b')](respondWithStatusCode(_0x560af6,null))[_0xd2f3('0x52')](handleError(_0x560af6,null));};exports[_0xd2f3('0x63')]=function(_0x3c014c,_0x417867,_0x14ad73){return db[_0xd2f3('0x34')][_0xd2f3('0x51')]({'where':{'id':_0x3c014c[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x417867,null))['then'](function(_0x180a06){if(_0x180a06){var _0x518dcc=[];var _0x26dba2={'success':[],'errors':[]};return db[_0xd2f3('0x64')]['describe']()['then'](function(_0x57d421){if(_0x3c014c[_0xd2f3('0x54')][_0xd2f3('0x65')]&&_[_0xd2f3('0x66')](_0x3c014c['body'][_0xd2f3('0x65')])){if(_0x3c014c['body'][_0xd2f3('0x65')][_0xd2f3('0x3d')]){_0x3c014c[_0xd2f3('0x54')][_0xd2f3('0x65')]=_0x3c014c['body']['tags'][_0xd2f3('0x67')](';')+';';}else{_0x3c014c['body'][_0xd2f3('0x65')]=null;}}else{_0x3c014c['body'][_0xd2f3('0x65')]=null;}if(_0x3c014c[_0xd2f3('0x54')]&&_[_0xd2f3('0x66')](_0x3c014c[_0xd2f3('0x54')])){for(var _0x4b305c=0x0;_0x4b305c<_0x3c014c[_0xd2f3('0x54')][_0xd2f3('0x3d')];_0x4b305c+=0x1){_0x3c014c[_0xd2f3('0x54')][_0x4b305c][_0xd2f3('0x5d')]=_0x3c014c[_0xd2f3('0x50')]['id'];_0x518dcc[_0xd2f3('0x68')](_0x3c014c['body'][_0x4b305c]);}return BPromise[_0xd2f3('0x69')](_0x518dcc,function(_0x5c75ed){return db[_0xd2f3('0x64')]['create'](_[_0xd2f3('0x6a')](_0x5c75ed,['ids','id'])||{},{'fields':_['keys'](_0x57d421),'raw':!![]})[_0xd2f3('0x2b')](function(_0x41381a){_0x26dba2['success']['push'](_0x41381a[_0xd2f3('0x6b')]);})['catch'](function(_0x5d0176){_0x26dba2[_0xd2f3('0x6c')]['push']({'data':_0x5c75ed,'error':_0x5d0176[_0xd2f3('0x6d')]});});})[_0xd2f3('0x2b')](function(_0x35d387){return _0x26dba2;})['catch'](function(_0x18f3a4){return _0x18f3a4;});}else{_0x417867['status'](0x190)['json']({'message':_0xd2f3('0x6e')});}});}})[_0xd2f3('0x2b')](respondWithResult(_0x417867,null))[_0xd2f3('0x52')](handleError(_0x417867,null));};exports[_0xd2f3('0x6f')]=function(_0x62abbf,_0x1122da,_0x5c7650){var _0x28869c;return db[_0xd2f3('0x34')]['find']({'where':{'id':_0x62abbf[_0xd2f3('0x50')]['id']},'include':[{'model':db[_0xd2f3('0x70')],'as':_0xd2f3('0x71')}]})['then'](handleEntityNotFound(_0x1122da,null))[_0xd2f3('0x2b')](function(_0x16092a){if(_0x16092a){_0x28869c=_0x16092a;return db[_0xd2f3('0x64')][_0xd2f3('0x35')];}})[_0xd2f3('0x2b')](function(_0x436861){if(_0x436861){var _0x41c560={};var _0x487128={};_0x487128[_0xd2f3('0x37')]=_[_0xd2f3('0x72')](_['keys'](_0x436861),_[_0xd2f3('0x33')](_0x28869c[_0xd2f3('0x71')],function(_0x1f829c){return util['format'](_0xd2f3('0x73'),_0x1f829c['id']);}));_0x487128[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x62abbf[_0xd2f3('0x38')]);_0x487128[_0xd2f3('0x43')]=_['intersection'](_0x487128[_0xd2f3('0x37')],_0x487128[_0xd2f3('0x38')]);_0x41c560[_0xd2f3('0x3a')]=_[_0xd2f3('0x3b')](_0x487128['model'],qs['fields'](_0x62abbf['query'][_0xd2f3('0x3c')]));_0x41c560[_0xd2f3('0x3a')]=_0x41c560[_0xd2f3('0x3a')][_0xd2f3('0x3d')]?_0x41c560[_0xd2f3('0x3a')]:_0x487128[_0xd2f3('0x37')];if(!_0x62abbf[_0xd2f3('0x38')][_0xd2f3('0x3e')]('nolimit')){_0x41c560['limit']=qs[_0xd2f3('0x25')](_0x62abbf[_0xd2f3('0x38')][_0xd2f3('0x25')]);_0x41c560[_0xd2f3('0x23')]=qs[_0xd2f3('0x23')](_0x62abbf['query'][_0xd2f3('0x23')]);}_0x41c560[_0xd2f3('0x40')]=qs['sort'](_0x62abbf['query']['sort']);_0x41c560[_0xd2f3('0x42')]=qs[_0xd2f3('0x43')](_[_0xd2f3('0x44')](_0x62abbf['query'],_0x487128[_0xd2f3('0x43')]));_0x41c560[_0xd2f3('0x74')]=!![];if(_0x62abbf[_0xd2f3('0x38')][_0xd2f3('0x45')]){_0x41c560['where']=_[_0xd2f3('0x46')](_0x41c560[_0xd2f3('0x42')],{'$or':_[_0xd2f3('0x33')](_0x41c560[_0xd2f3('0x3a')],function(_0x4e6a2b){var _0x300d5d={};_0x300d5d[_0x4e6a2b]={'$like':'%'+_0x62abbf[_0xd2f3('0x38')]['filter']+'%'};return _0x300d5d;})});}_0x41c560=_[_0xd2f3('0x46')]({},_0x41c560,_0x62abbf[_0xd2f3('0x49')]);return _0x28869c[_0xd2f3('0x6f')](_0x41c560);}})[_0xd2f3('0x2b')](respondWithResult(_0x1122da,null))[_0xd2f3('0x52')](handleError(_0x1122da,null));};exports[_0xd2f3('0x75')]=function(_0x38cbf1,_0x42ad67,_0x3fa609){var _0x17b976;var _0x177951;var _0x4ef399;var _0x1b5e3c=_0x38cbf1[_0xd2f3('0x50')]['id'];csv_results=[];return db[_0xd2f3('0x76')]['findAll']({'attributes':['id',_0xd2f3('0x31')],'raw':!![],'order':[_0xd2f3('0x77')]})['then'](function(_0x2e1d3e){_0x17b976=_0x2e1d3e;var _0x3cc641=_[_0xd2f3('0x39')](db[_0xd2f3('0x64')][_0xd2f3('0x35')]);return db[_0xd2f3('0x70')]['findAll']({'raw':!![],'attributes':['id',_0xd2f3('0x78')]})['then'](function(_0x4e21a7){_0x177951=_0x4e21a7;var _0x150455=squel[_0xd2f3('0x79')]()[_0xd2f3('0x3c')](_0x3cc641)['from']('cm_contacts','c')[_0xd2f3('0x42')](_0xd2f3('0x7a'),_0x1b5e3c)[_0xd2f3('0x42')](_0xd2f3('0x7b'))[_0xd2f3('0x7c')]();for(var _0xaee747=0x0;_0xaee747<_0x177951[_0xd2f3('0x3d')];_0xaee747++){_0x150455[_0xd2f3('0x7d')](_0xd2f3('0x7e')+_0x177951[_0xaee747]['id'],'customField_'+_0x177951[_0xaee747]['alias']);}for(var _0xaee747=0x0;_0xaee747<_0x17b976[_0xd2f3('0x3d')];_0xaee747++){_0x150455['field'](squel['select']()['field'](_0xd2f3('0x7f'))[_0xd2f3('0x80')](_0xd2f3('0x81'))[_0xd2f3('0x42')]('ItemTypeId\x20=\x20?',_0x17b976[_0xaee747]['id'])['where']('CmContactId\x20=\x20c.id'),_0xd2f3('0x82')+_0x17b976[_0xaee747][_0xd2f3('0x31')]);_0x150455['field'](squel['select']()[_0xd2f3('0x7d')](_0xd2f3('0x83'))[_0xd2f3('0x80')](_0xd2f3('0x81'))['where'](_0xd2f3('0x84'),_0x17b976[_0xaee747]['id'])['where'](_0xd2f3('0x85')),_0xd2f3('0x86')+_0x17b976[_0xaee747]['name']);}var _0x33c5ff=[];_0x33c5ff[_0xd2f3('0x68')](_0x150455['toString']());BPromise[_0xd2f3('0x69')](_0x33c5ff,handleQuery)[_0xd2f3('0x2b')](function(_0x531bb5){handleQuery(_0x150455[_0xd2f3('0x87')]());var _0x35bba5=csv_results[0x0];if(!_['isEmpty'](_0x35bba5)){var _0x101abf=toCsv(_0x35bba5);var _0x1e4db5=Date[_0xd2f3('0x88')]();fs[_0xd2f3('0x89')](util[_0xd2f3('0x8a')]('/tmp/list_%d_%s.csv',_0x1b5e3c,_0x1e4db5),_0x101abf);_0x42ad67[_0xd2f3('0x8b')](_0xd2f3('0x8c'),_0xd2f3('0x8d')+util['format']('list_%d_%s.csv',_0x1b5e3c,_0x1e4db5));_0x42ad67[_0xd2f3('0x8b')](_0xd2f3('0x8e'),'text/csv');return _0x42ad67[_0xd2f3('0x8f')](util[_0xd2f3('0x8a')](_0xd2f3('0x90'),_0x1b5e3c,_0x1e4db5));}else{return _0x42ad67[_0xd2f3('0x1f')](0xcc);}});});});};exports[_0xd2f3('0x91')]=function(_0x5ab875,_0x2a3cc3,_0x12f552){var _0x37bd30;delete _0x5ab875[_0xd2f3('0x54')]['id'];return db[_0xd2f3('0x34')][_0xd2f3('0x60')]({'where':{'id':_0x5ab875[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x2a3cc3,null))[_0xd2f3('0x2b')](function(_0x3990a0){if(_0x3990a0){return db[_0xd2f3('0x92')]['transaction'](function(_0x1217a4){return db[_0xd2f3('0x70')][_0xd2f3('0x53')](_0x5ab875[_0xd2f3('0x54')],{'transaction':_0x1217a4})[_0xd2f3('0x2b')](function(_0x8b4eb2){_0x37bd30=_0x8b4eb2;return _0x3990a0[_0xd2f3('0x93')](_0x8b4eb2,{'transaction':_0x1217a4});})[_0xd2f3('0x2b')](function(){var _0x206c01={'type':db[_0xd2f3('0x94')][_0xd2f3('0x95')],'transaction':_0x1217a4};switch(_0x5ab875[_0xd2f3('0x54')][_0xd2f3('0x47')]){case _0xd2f3('0x96'):_0x206c01[_0xd2f3('0x47')]=db[_0xd2f3('0x94')][_0xd2f3('0x95')];break;case _0xd2f3('0x97'):_0x206c01[_0xd2f3('0x47')]=db[_0xd2f3('0x94')]['INTEGER'];break;case _0xd2f3('0x98'):_0x206c01[_0xd2f3('0x47')]=db[_0xd2f3('0x94')]['BOOLEAN'];_0x206c01[_0xd2f3('0x99')]=![];break;default:}return db['sequelize'][_0xd2f3('0x9a')][_0xd2f3('0x9b')](_0xd2f3('0x9c'),util[_0xd2f3('0x8a')](_0xd2f3('0x9d'),_0x37bd30['id']),_0x206c01);})[_0xd2f3('0x2b')](function(){return _0x37bd30;});});}})[_0xd2f3('0x2b')](respondWithResult(_0x2a3cc3,null))[_0xd2f3('0x52')](handleError(_0x2a3cc3,null));};exports[_0xd2f3('0x9e')]=function(_0x150b14,_0x31a06e,_0x1d8340){var _0x16938f={};var _0x501bca={};var _0x498396;var _0x27457b;return db[_0xd2f3('0x34')][_0xd2f3('0x60')]({'where':{'id':_0x150b14['params']['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x31a06e,null))['then'](function(_0x3ee77d){if(_0x3ee77d){_0x498396=_0x3ee77d;_0x501bca[_0xd2f3('0x37')]=_[_0xd2f3('0x39')](db[_0xd2f3('0x70')][_0xd2f3('0x35')]);_0x501bca[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x150b14[_0xd2f3('0x38')]);_0x501bca[_0xd2f3('0x43')]=_[_0xd2f3('0x3b')](_0x501bca[_0xd2f3('0x37')],_0x501bca[_0xd2f3('0x38')]);_0x16938f[_0xd2f3('0x3a')]=_[_0xd2f3('0x3b')](_0x501bca['model'],qs['fields'](_0x150b14[_0xd2f3('0x38')][_0xd2f3('0x3c')]));_0x16938f[_0xd2f3('0x3a')]=_0x16938f[_0xd2f3('0x3a')][_0xd2f3('0x3d')]?_0x16938f[_0xd2f3('0x3a')]:_0x501bca[_0xd2f3('0x37')];_0x16938f['order']=qs[_0xd2f3('0x41')](_0x150b14['query'][_0xd2f3('0x41')]);_0x16938f['where']=qs['filters'](_['pick'](_0x150b14[_0xd2f3('0x38')],_0x501bca[_0xd2f3('0x43')]));_0x16938f[_0xd2f3('0x42')]=_['merge'](_0x16938f[_0xd2f3('0x42')],{'$or':[{'ListId':_0x3ee77d['id']},{'ListId':null}]});if(_0x150b14[_0xd2f3('0x38')][_0xd2f3('0x45')]){_0x16938f['where']=_[_0xd2f3('0x46')](_0x16938f[_0xd2f3('0x42')],{'$or':_[_0xd2f3('0x33')](_0x16938f[_0xd2f3('0x3a')],function(_0x2e8c12){var _0x2bc1bb={};_0x2bc1bb[_0x2e8c12]={'$like':'%'+_0x150b14['query'][_0xd2f3('0x45')]+'%'};return _0x2bc1bb;})});}_0x16938f=_['merge']({},_0x16938f,_0x150b14[_0xd2f3('0x49')]);return db[_0xd2f3('0x70')][_0xd2f3('0x9f')](_0x16938f);}})[_0xd2f3('0x2b')](respondWithResult(_0x31a06e,null))['catch'](handleError(_0x31a06e,null));};exports[_0xd2f3('0xa0')]=function(_0x4c9382,_0x1b8ca3){return db[_0xd2f3('0x70')][_0xd2f3('0x9f')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x1b8ca3,null))[_0xd2f3('0x2b')](function(_0x46a7e9){return _0x46a7e9;})[_0xd2f3('0x2b')](respondWithResult(_0x1b8ca3,null))[_0xd2f3('0x52')](handleError(_0x1b8ca3,null));};exports[_0xd2f3('0xa1')]=function(_0x43e9ad,_0x2c0f21,_0x516217){return db[_0xd2f3('0x34')]['find']({'where':{'id':_0x43e9ad[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x2c0f21,null))['then'](function(_0x339f4f){if(_0x339f4f){return _0x339f4f[_0xd2f3('0xa1')](_0x43e9ad[_0xd2f3('0x54')]['ids'],_['omit'](_0x43e9ad['body'],['ids','id'])||{})[_0xd2f3('0xa2')](function(_0x1a61be){for(var _0x4904fc=0x0;_0x4904fc<_0x43e9ad[_0xd2f3('0x54')][_0xd2f3('0x62')]['length'];_0x4904fc+=0x1){socket[_0xd2f3('0xa3')](_0xd2f3('0xa4'),{'UserId':Number(_0x43e9ad['body'][_0xd2f3('0x62')][_0x4904fc]),'CmListId':Number(_0x43e9ad[_0xd2f3('0x50')]['id'])});}return _0x1a61be;});}})[_0xd2f3('0x2b')](respondWithResult(_0x2c0f21,null))[_0xd2f3('0x52')](handleError(_0x2c0f21,null));};exports[_0xd2f3('0xa5')]=function(_0x105ac9,_0x507aae,_0x5d095c){return db[_0xd2f3('0x34')][_0xd2f3('0x51')]({'where':{'id':_0x105ac9[_0xd2f3('0x50')]['id']}})['then'](handleEntityNotFound(_0x507aae,null))['then'](function(_0x25fc18){if(_0x25fc18){return _0x25fc18[_0xd2f3('0xa5')](_0x105ac9[_0xd2f3('0x38')][_0xd2f3('0x62')])['then'](function(){if(_['isArray'](_0x105ac9[_0xd2f3('0x38')][_0xd2f3('0x62')])){for(var _0x15bb20=0x0;_0x15bb20<_0x105ac9['query'][_0xd2f3('0x62')]['length'];_0x15bb20+=0x1){socket[_0xd2f3('0xa3')]('userCmList:remove',{'UserId':Number(_0x105ac9[_0xd2f3('0x38')][_0xd2f3('0x62')][_0x15bb20]),'CmListId':Number(_0x105ac9[_0xd2f3('0x50')]['id'])});}}else{socket['emit'](_0xd2f3('0xa6'),{'UserId':Number(_0x105ac9['query'][_0xd2f3('0x62')]),'CmListId':Number(_0x105ac9[_0xd2f3('0x50')]['id'])});}});}})[_0xd2f3('0x2b')](respondWithStatusCode(_0x507aae,null))[_0xd2f3('0x52')](handleError(_0x507aae,null));};exports[_0xd2f3('0xa7')]=function(_0x18d60e,_0x51b448,_0x1fd926){var _0x1cce7e={};var _0x534648={};var _0x35a6b0;var _0x368891;return db['CmList'][_0xd2f3('0x60')]({'where':{'id':_0x18d60e['params']['id']}})['then'](handleEntityNotFound(_0x51b448,null))[_0xd2f3('0x2b')](function(_0x28342b){if(_0x28342b){_0x35a6b0=_0x28342b;_0x534648[_0xd2f3('0x37')]=_[_0xd2f3('0x39')](db[_0xd2f3('0xa8')][_0xd2f3('0x35')]);_0x534648[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x18d60e[_0xd2f3('0x38')]);_0x534648[_0xd2f3('0x43')]=_[_0xd2f3('0x3b')](_0x534648[_0xd2f3('0x37')],_0x534648[_0xd2f3('0x38')]);_0x1cce7e[_0xd2f3('0x3a')]=_['intersection'](_0x534648[_0xd2f3('0x37')],qs['fields'](_0x18d60e['query'][_0xd2f3('0x3c')]));_0x1cce7e[_0xd2f3('0x3a')]=_0x1cce7e[_0xd2f3('0x3a')][_0xd2f3('0x3d')]?_0x1cce7e[_0xd2f3('0x3a')]:_0x534648[_0xd2f3('0x37')];_0x1cce7e[_0xd2f3('0x40')]=qs[_0xd2f3('0x41')](_0x18d60e['query'][_0xd2f3('0x41')]);_0x1cce7e['where']=qs['filters'](_['pick'](_0x18d60e[_0xd2f3('0x38')],_0x534648['filters']));if(_0x18d60e[_0xd2f3('0x38')][_0xd2f3('0x45')]){_0x1cce7e[_0xd2f3('0x42')]=_[_0xd2f3('0x46')](_0x1cce7e[_0xd2f3('0x42')],{'$or':_['map'](_0x1cce7e[_0xd2f3('0x3a')],function(_0x4a2d7d){var _0xafc5fd={};_0xafc5fd[_0x4a2d7d]={'$like':'%'+_0x18d60e['query'][_0xd2f3('0x45')]+'%'};return _0xafc5fd;})});}_0x1cce7e=_['merge']({},_0x1cce7e,_0x18d60e[_0xd2f3('0x49')]);return _0x35a6b0[_0xd2f3('0xa7')](_0x1cce7e);}})[_0xd2f3('0x2b')](function(_0x5e5ff7){if(_0x5e5ff7){_0x368891=_0x5e5ff7[_0xd2f3('0x3d')];if(!_0x18d60e['query'][_0xd2f3('0x3e')](_0xd2f3('0x3f'))){_0x1cce7e[_0xd2f3('0x25')]=qs['limit'](_0x18d60e[_0xd2f3('0x38')][_0xd2f3('0x25')]);_0x1cce7e[_0xd2f3('0x23')]=qs[_0xd2f3('0x23')](_0x18d60e[_0xd2f3('0x38')][_0xd2f3('0x23')]);}return _0x35a6b0[_0xd2f3('0xa7')](_0x1cce7e);}})['then'](function(_0x33727a){if(_0x33727a){return _0x33727a?{'count':_0x368891,'rows':_0x33727a}:null;}})[_0xd2f3('0x2b')](respondWithResult(_0x51b448,null))[_0xd2f3('0x52')](handleError(_0x51b448,null));};function handleQuery(_0x45ee1d){logger[_0xd2f3('0xa9')](_0x45ee1d);return db[_0xd2f3('0x92')][_0xd2f3('0x38')](_0x45ee1d)[_0xd2f3('0xa2')](function(_0x3594d5){csv_results[_0xd2f3('0x68')](_0x3594d5);})[_0xd2f3('0x52')](function(_0x18b44f){logger[_0xd2f3('0x2f')](_0x18b44f[_0xd2f3('0x6d')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index ef12405..fcea5b2 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_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 +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x55ca,0x126));var _0xa55c=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0x55ca[_0x3825a8];return _0xabc9bc;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index eeaacc2..8e3cb1b 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_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 +var _0xb43b=['rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','api','moment','bluebird','path'];(function(_0x316255,_0x255c3f){var _0x912326=function(_0x3befd1){while(--_0x3befd1){_0x316255['push'](_0x316255['shift']());}};_0x912326(++_0x255c3f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3429c3,_0xb379bf){_0x3429c3=_0x3429c3-0x0;var _0x580823=_0xb43b[_0x3429c3];return _0x580823;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'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 f7fd6f2..52dbc4f 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 _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 +var _0x1d4c=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','info','result'];(function(_0xfca425,_0x2950d6){var _0x44ea89=function(_0x5c0db6){while(--_0x5c0db6){_0xfca425['push'](_0xfca425['shift']());}};_0x44ea89(++_0x2950d6);}(_0x1d4c,0x70));var _0xc1d4=function(_0x6224f4,_0x3524c5){_0x6224f4=_0x6224f4-0x0;var _0x2e9bef=_0x1d4c[_0x6224f4];return _0x2e9bef;};'use strict';var _=require(_0xc1d4('0x0'));var util=require(_0xc1d4('0x1'));var moment=require('moment');var BPromise=require(_0xc1d4('0x2'));var rs=require(_0xc1d4('0x3'));var fs=require('fs');var Redis=require(_0xc1d4('0x4'));var db=require(_0xc1d4('0x5'))['db'];var utils=require(_0xc1d4('0x6'));var logger=require(_0xc1d4('0x7'))(_0xc1d4('0x8'));var config=require(_0xc1d4('0x9'));var jayson=require(_0xc1d4('0xa'));var client=jayson['client'][_0xc1d4('0xb')]({'port':0x232a});config[_0xc1d4('0xc')]=_[_0xc1d4('0xd')](config[_0xc1d4('0xc')],{'host':_0xc1d4('0xe'),'port':0x18eb});var socket=require(_0xc1d4('0xf'))(new Redis(config[_0xc1d4('0xc')]));require(_0xc1d4('0x10'))[_0xc1d4('0x11')](socket);function respondWithRpcPromise(_0x152d22,_0x33293c,_0x5bdeb5){return new BPromise(function(_0x5342ab,_0x31f389){return client['request'](_0x152d22,_0x5bdeb5)[_0xc1d4('0x12')](function(_0x49924b){logger['info']('CmList,\x20%s,\x20%s',_0x33293c,_0xc1d4('0x13'));logger['debug'](_0xc1d4('0x14'),_0x33293c,'request\x20sent',JSON[_0xc1d4('0x15')](_0x49924b));if(_0x49924b['error']){if(_0x49924b[_0xc1d4('0x16')][_0xc1d4('0x17')]===0x1f4){logger[_0xc1d4('0x16')](_0xc1d4('0x18'),_0x33293c,_0x49924b[_0xc1d4('0x16')][_0xc1d4('0x19')]);return _0x31f389(_0x49924b['error'][_0xc1d4('0x19')]);}logger[_0xc1d4('0x16')](_0xc1d4('0x18'),_0x33293c,_0x49924b[_0xc1d4('0x16')][_0xc1d4('0x19')]);return _0x5342ab(_0x49924b[_0xc1d4('0x16')][_0xc1d4('0x19')]);}else{logger[_0xc1d4('0x1a')]('CmList,\x20%s,\x20%s',_0x33293c,'request\x20sent');_0x5342ab(_0x49924b[_0xc1d4('0x1b')][_0xc1d4('0x19')]);}})['catch'](function(_0x15ad25){logger[_0xc1d4('0x16')](_0xc1d4('0x18'),_0x33293c,_0x15ad25);_0x31f389(_0x15ad25);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 59122e1..377842d 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 _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 +var _0xdc79=['update','register','length','./cmList.events','save','remove'];(function(_0x2290dc,_0x14621b){var _0x2b1c3e=function(_0xcdd3e4){while(--_0xcdd3e4){_0x2290dc['push'](_0x2290dc['shift']());}};_0x2b1c3e(++_0x14621b);}(_0xdc79,0xed));var _0x9dc7=function(_0x103d14,_0x12e1a7){_0x103d14=_0x103d14-0x0;var _0x4d8531=_0xdc79[_0x103d14];return _0x4d8531;};'use strict';var CmListEvents=require(_0x9dc7('0x0'));var events=[_0x9dc7('0x1'),_0x9dc7('0x2'),_0x9dc7('0x3')];function createListener(_0x280097,_0x454903){return function(_0x5462e5){_0x454903['emit'](_0x280097,_0x5462e5);};}function removeListener(_0x62def2,_0x487e29){return function(){CmListEvents['removeListener'](_0x62def2,_0x487e29);};}exports[_0x9dc7('0x4')]=function(_0x209e44){for(var _0x462eb4=0x0,_0x5406b7=events[_0x9dc7('0x5')];_0x462eb4<_0x5406b7;_0x462eb4++){var _0x29109c=events[_0x462eb4];var _0x5e1b57=createListener('cmList:'+_0x29109c,_0x209e44);CmListEvents['on'](_0x29109c,_0x5e1b57);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index b1268a8..a3565c2 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 _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 +var _0xe562=['delete','destroy','/:id/dispositions','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','update'];(function(_0x5918eb,_0x290d56){var _0x428f70=function(_0x43bdb0){while(--_0x43bdb0){_0x5918eb['push'](_0x5918eb['shift']());}};_0x428f70(++_0x290d56);}(_0xe562,0x6b));var _0x2e56=function(_0x579906,_0x410344){_0x579906=_0x579906-0x0;var _0x5e1392=_0xe562[_0x579906];return _0x5e1392;};'use strict';var multer=require(_0x2e56('0x0'));var util=require('util');var path=require(_0x2e56('0x1'));var timeout=require(_0x2e56('0x2'));var express=require('express');var router=express[_0x2e56('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2e56('0x4'));var interaction=require(_0x2e56('0x5'));var config=require('../../config/environment');var controller=require(_0x2e56('0x6'));router[_0x2e56('0x7')]('/',auth[_0x2e56('0x8')](),controller['index']);router[_0x2e56('0x7')](_0x2e56('0x9'),auth['isAuthenticated'](),controller[_0x2e56('0xa')]);router['get'](_0x2e56('0xb'),auth[_0x2e56('0x8')](),controller['getGlobalCustomFields']);router['get'](_0x2e56('0xc'),auth[_0x2e56('0x8')](),controller[_0x2e56('0xd')]);router[_0x2e56('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2e56('0xe')]);router['get'](_0x2e56('0xf'),auth[_0x2e56('0x8')](),controller[_0x2e56('0x10')]);router[_0x2e56('0x7')](_0x2e56('0x11'),auth['isAuthenticated'](),controller[_0x2e56('0x12')]);router['get'](_0x2e56('0x13'),auth[_0x2e56('0x8')](),controller[_0x2e56('0x14')]);router[_0x2e56('0x7')]('/:id/users',auth[_0x2e56('0x8')](),controller[_0x2e56('0x15')]);router[_0x2e56('0x16')]('/',auth[_0x2e56('0x8')](),controller[_0x2e56('0x17')]);router[_0x2e56('0x16')]('/:id/dispositions',auth[_0x2e56('0x8')](),controller[_0x2e56('0x18')]);router[_0x2e56('0x16')](_0x2e56('0xf'),auth[_0x2e56('0x8')](),controller[_0x2e56('0x19')]);router[_0x2e56('0x16')](_0x2e56('0x13'),auth['isAuthenticated'](),controller[_0x2e56('0x1a')]);router['post'](_0x2e56('0x1b'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x2e56('0x8')](),controller[_0x2e56('0x1c')]);router[_0x2e56('0x1d')](_0x2e56('0xc'),auth[_0x2e56('0x8')](),controller[_0x2e56('0x1e')]);router[_0x2e56('0x1d')](_0x2e56('0x1f'),auth[_0x2e56('0x8')](),controller['removeDispositions']);router['delete'](_0x2e56('0x1b'),auth[_0x2e56('0x8')](),controller[_0x2e56('0x20')]);module[_0x2e56('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 91ba846..67637ca 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 _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 +var _0x4563=['STRING','sequelize','VIRTUAL','getDataValue'];(function(_0x404eed,_0x5390c5){var _0xd45887=function(_0x1ee42b){while(--_0x1ee42b){_0x404eed['push'](_0x404eed['shift']());}};_0xd45887(++_0x5390c5);}(_0x4563,0x1b1));var _0x3456=function(_0x1704fa,_0x4f7d65){_0x1704fa=_0x1704fa-0x0;var _0x7f5b47=_0x4563[_0x1704fa];return _0x7f5b47;};'use strict';var Sequelize=require(_0x3456('0x0'));module['exports']={'name':{'type':Sequelize[_0x3456('0x1')],'get':function(_0x5916dd){return this[_0x3456('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x3456('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 3d721be..f8bfb58 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_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 +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(_0x26a6c0,_0x31e7a1){var _0x342604=function(_0x479fa4){while(--_0x479fa4){_0x26a6c0['push'](_0x26a6c0['shift']());}};_0x342604(++_0x31e7a1);}(_0x7a54,0x106));var _0x47a5=function(_0x260510,_0x5d8637){_0x260510=_0x260510-0x0;var _0x5de28e=_0x7a54[_0x260510];return _0x5de28e;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index c29ca75..be5a576 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 _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 +var _0xc07d=['../../config/environment','./condition.attributes','Condition','tools_conditions','../../config/logger','api','moment','rimraf'];(function(_0x425d0d,_0x396c0d){var _0x36a8b8=function(_0x17f45b){while(--_0x17f45b){_0x425d0d['push'](_0x425d0d['shift']());}};_0x36a8b8(++_0x396c0d);}(_0xc07d,0x6c));var _0xdc07=function(_0x1630f1,_0x2eba83){_0x1630f1=_0x1630f1-0x0;var _0x1531e6=_0xc07d[_0x1630f1];return _0x1531e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdc07('0x0'))(_0xdc07('0x1'));var moment=require(_0xdc07('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdc07('0x3'));var config=require(_0xdc07('0x4'));var attributes=require(_0xdc07('0x5'));module['exports']=function(_0x4c5e32,_0x46083c){return _0x4c5e32['define'](_0xdc07('0x6'),attributes,{'tableName':_0xdc07('0x7'),'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 0ab33ec..ba99db7 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 _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 +var _0x650c=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x49a8a9,_0x38009b){var _0x48fc90=function(_0x364655){while(--_0x364655){_0x49a8a9['push'](_0x49a8a9['shift']());}};_0x48fc90(++_0x38009b);}(_0x650c,0x86));var _0xc650=function(_0x59adba,_0x189ca9){_0x59adba=_0x59adba-0x0;var _0x53d5d7=_0x650c[_0x59adba];return _0x53d5d7;};'use strict';var _=require(_0xc650('0x0'));var util=require(_0xc650('0x1'));var moment=require(_0xc650('0x2'));var BPromise=require(_0xc650('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc650('0x4'))['db'];var utils=require(_0xc650('0x5'));var logger=require(_0xc650('0x6'))(_0xc650('0x7'));var config=require(_0xc650('0x8'));var jayson=require(_0xc650('0x9'));var client=jayson['client'][_0xc650('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x433d6d,_0x4d280b,_0x4bfd19){return new BPromise(function(_0x1073ef,_0x421fde){return client['request'](_0x433d6d,_0x4bfd19)['then'](function(_0x1f4833){logger[_0xc650('0xb')](_0xc650('0xc'),_0x4d280b,_0xc650('0xd'));logger[_0xc650('0xe')](_0xc650('0xf'),_0x4d280b,'request\x20sent',JSON[_0xc650('0x10')](_0x1f4833));if(_0x1f4833[_0xc650('0x11')]){if(_0x1f4833[_0xc650('0x11')][_0xc650('0x12')]===0x1f4){logger[_0xc650('0x11')](_0xc650('0xc'),_0x4d280b,_0x1f4833[_0xc650('0x11')][_0xc650('0x13')]);return _0x421fde(_0x1f4833[_0xc650('0x11')][_0xc650('0x13')]);}logger[_0xc650('0x11')](_0xc650('0xc'),_0x4d280b,_0x1f4833['error'][_0xc650('0x13')]);return _0x1073ef(_0x1f4833['error']['message']);}else{logger[_0xc650('0xb')]('Condition,\x20%s,\x20%s',_0x4d280b,_0xc650('0xd'));_0x1073ef(_0x1f4833[_0xc650('0x14')][_0xc650('0x13')]);}})[_0xc650('0x15')](function(_0x39ff84){logger[_0xc650('0x11')](_0xc650('0xc'),_0x4d280b,_0x39ff84);_0x421fde(_0x39ff84);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 1f7c79a..b15bfdb 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 _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 +var _0xae09=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','put','update','delete','destroy','util'];(function(_0x54af57,_0x2051fa){var _0x1a4db7=function(_0x5686e6){while(--_0x5686e6){_0x54af57['push'](_0x54af57['shift']());}};_0x1a4db7(++_0x2051fa);}(_0xae09,0x154));var _0x9ae0=function(_0x34ca09,_0x210c9d){_0x34ca09=_0x34ca09-0x0;var _0x2e543e=_0xae09[_0x34ca09];return _0x2e543e;};'use strict';var multer=require('multer');var util=require(_0x9ae0('0x0'));var path=require(_0x9ae0('0x1'));var timeout=require(_0x9ae0('0x2'));var express=require(_0x9ae0('0x3'));var router=express[_0x9ae0('0x4')]();var fs_extra=require(_0x9ae0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9ae0('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x9ae0('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9ae0('0x8')]);router[_0x9ae0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9ae0('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 57e9418..1dc8758 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 _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 +var _0xf581=['INTEGER','sequelize','exports','STRING','name'];(function(_0x275293,_0x31bf61){var _0x539b28=function(_0x36e11c){while(--_0x36e11c){_0x275293['push'](_0x275293['shift']());}};_0x539b28(++_0x31bf61);}(_0xf581,0x114));var _0x1f58=function(_0x52fd3d,_0x3af718){_0x52fd3d=_0x52fd3d-0x0;var _0x49b06d=_0xf581[_0x52fd3d];return _0x49b06d;};'use strict';var Sequelize=require(_0x1f58('0x0'));module[_0x1f58('0x1')]={'name':{'type':Sequelize[_0x1f58('0x2')],'allowNull':![],'unique':_0x1f58('0x3')},'OrderBy':{'type':Sequelize[_0x1f58('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x1f58('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 29c6d13..f31827c 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 _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 +var _0x3de3=['update','then','get','ContactItemTypes','UserProfileResource','destroy','error','name','send','index','map','ContactItemType','fieldName','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','CmContactHasItem','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3de3,0x1ce));var _0x33de=function(_0x5982b7,_0x332365){_0x5982b7=_0x5982b7-0x0;var _0xef1a5e=_0x3de3[_0x5982b7];return _0xef1a5e;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33de('0x1'));var jsonpatch=require(_0x33de('0x2'));var rp=require('request-promise');var moment=require(_0x33de('0x3'));var BPromise=require(_0x33de('0x4'));var Mustache=require(_0x33de('0x5'));var util=require(_0x33de('0x6'));var path=require('path');var sox=require(_0x33de('0x7'));var csv=require(_0x33de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33de('0x9'));var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0x8'));var querystring=require(_0x33de('0xd'));var Papa=require(_0x33de('0xe'));var Redis=require('ioredis');var authService=require(_0x33de('0xf'));var qs=require(_0x33de('0x10'));var as=require(_0x33de('0x11'));var hardwareService=require(_0x33de('0x12'));var logger=require(_0x33de('0x13'))(_0x33de('0x14'));var utils=require(_0x33de('0x15'));var config=require(_0x33de('0x16'));var licenseUtil=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];function respondWithStatusCode(_0x27d1d8,_0x5170ad){_0x5170ad=_0x5170ad||0xcc;return function(_0x6b1a4c){if(_0x6b1a4c){return _0x27d1d8[_0x33de('0x19')](_0x5170ad);}return _0x27d1d8['status'](_0x5170ad)['end']();};}function respondWithResult(_0x4164ab,_0x22bda8){_0x22bda8=_0x22bda8||0xc8;return function(_0x2b3748){if(_0x2b3748){return _0x4164ab[_0x33de('0x1a')](_0x22bda8)['json'](_0x2b3748);}};}function respondWithFilteredResult(_0x11e6b5,_0x1b1166){return function(_0x522ba0){if(_0x522ba0){var _0x4ff69f=typeof _0x1b1166[_0x33de('0x1b')]===_0x33de('0x1c')&&typeof _0x1b1166[_0x33de('0x1d')]==='undefined';var _0x2db887=_0x522ba0[_0x33de('0x1e')];var _0x52cfa0=_0x4ff69f?0x0:_0x1b1166[_0x33de('0x1b')];var _0x201ff3=_0x4ff69f?_0x522ba0['count']:_0x1b1166['offset']+_0x1b1166[_0x33de('0x1d')];var _0x52d718;if(_0x201ff3>=_0x2db887){_0x201ff3=_0x2db887;_0x52d718=0xc8;}else{_0x52d718=0xce;}_0x11e6b5[_0x33de('0x1a')](_0x52d718);return _0x11e6b5[_0x33de('0x1f')](_0x33de('0x20'),_0x52cfa0+'-'+_0x201ff3+'/'+_0x2db887)[_0x33de('0x21')](_0x522ba0);}return null;};}function patchUpdates(_0xc4f1a4){return function(_0x40a8e6){try{jsonpatch[_0x33de('0x22')](_0x40a8e6,_0xc4f1a4,!![]);}catch(_0x493263){return BPromise['reject'](_0x493263);}return _0x40a8e6[_0x33de('0x23')]();};}function saveUpdates(_0x5af3fa,_0x8acd8d){return function(_0x4cd8db){if(_0x4cd8db){return _0x4cd8db[_0x33de('0x24')](_0x5af3fa)[_0x33de('0x25')](function(_0x575e88){return _0x575e88;});}return null;};}function removeEntity(_0x2dbcf2,_0x5cd77e){return function(_0x67d040){if(_0x67d040){return _0x67d040['destroy']()[_0x33de('0x25')](function(){var _0x24e282=_0x67d040[_0x33de('0x26')]({'plain':!![]});var _0x5b79d7=_0x33de('0x27');return db[_0x33de('0x28')][_0x33de('0x29')]({'where':{'type':_0x5b79d7,'resourceId':_0x24e282['id']}})['then'](function(){return _0x67d040;});})[_0x33de('0x25')](function(){_0x2dbcf2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c8de9,_0x17c760){return function(_0x1a870a){if(!_0x1a870a){_0x1c8de9[_0x33de('0x19')](0x194);}return _0x1a870a;};}function handleError(_0x44b10e,_0x160687){_0x160687=_0x160687||0x1f4;return function(_0x3f22fb){logger[_0x33de('0x2a')](_0x3f22fb['stack']);if(_0x3f22fb['name']){delete _0x3f22fb[_0x33de('0x2b')];}_0x44b10e[_0x33de('0x1a')](_0x160687)[_0x33de('0x2c')](_0x3f22fb);};}exports[_0x33de('0x2d')]=function(_0x167cec,_0x20f393){var _0x427e82={},_0x4e1898={},_0x282158={'count':0x0,'rows':[]};var _0x1cee91=_[_0x33de('0x2e')](db[_0x33de('0x2f')]['rawAttributes'],function(_0xe5dc68){return{'name':_0xe5dc68[_0x33de('0x30')],'type':_0xe5dc68['type']['key']};});_0x4e1898['model']=_[_0x33de('0x2e')](_0x1cee91,_0x33de('0x2b'));_0x4e1898['query']=_[_0x33de('0x31')](_0x167cec['query']);_0x4e1898['filters']=_[_0x33de('0x32')](_0x4e1898[_0x33de('0x33')],_0x4e1898[_0x33de('0x34')]);_0x427e82[_0x33de('0x35')]=_[_0x33de('0x32')](_0x4e1898[_0x33de('0x33')],qs[_0x33de('0x36')](_0x167cec[_0x33de('0x34')]['fields']));_0x427e82[_0x33de('0x35')]=_0x427e82['attributes'][_0x33de('0x37')]?_0x427e82['attributes']:_0x4e1898['model'];if(!_0x167cec[_0x33de('0x34')][_0x33de('0x38')](_0x33de('0x39'))){_0x427e82[_0x33de('0x1d')]=qs[_0x33de('0x1d')](_0x167cec[_0x33de('0x34')]['limit']);_0x427e82[_0x33de('0x1b')]=qs[_0x33de('0x1b')](_0x167cec[_0x33de('0x34')][_0x33de('0x1b')]);}_0x427e82[_0x33de('0x3a')]=qs[_0x33de('0x3b')](_0x167cec[_0x33de('0x34')]['sort']);_0x427e82[_0x33de('0x3c')]=qs[_0x33de('0x3d')](_[_0x33de('0x3e')](_0x167cec[_0x33de('0x34')],_0x4e1898[_0x33de('0x3d')]),_0x1cee91);if(_0x167cec[_0x33de('0x34')][_0x33de('0x3f')]){_0x427e82['where']=_[_0x33de('0x40')](_0x427e82[_0x33de('0x3c')],{'$or':_[_0x33de('0x2e')](_0x1cee91,function(_0x7eaa40){if(_0x7eaa40[_0x33de('0x41')]!==_0x33de('0x42')){var _0x58f236={};_0x58f236[_0x7eaa40[_0x33de('0x2b')]]={'$like':'%'+_0x167cec['query'][_0x33de('0x3f')]+'%'};return _0x58f236;}})});}_0x427e82=_[_0x33de('0x40')]({},_0x427e82,_0x167cec['options']);var _0x198b72={'where':_0x427e82[_0x33de('0x3c')]};return db[_0x33de('0x2f')][_0x33de('0x1e')](_0x198b72)[_0x33de('0x25')](function(_0x4251e3){_0x282158[_0x33de('0x1e')]=_0x4251e3;if(_0x167cec[_0x33de('0x34')][_0x33de('0x43')]){_0x427e82['include']=[{'all':!![]}];}return db['ContactItemType'][_0x33de('0x44')](_0x427e82);})[_0x33de('0x25')](function(_0x20d04f){_0x282158[_0x33de('0x45')]=_0x20d04f;return _0x282158;})['then'](respondWithFilteredResult(_0x20f393,_0x427e82))[_0x33de('0x46')](handleError(_0x20f393,null));};exports['show']=function(_0x553ef2,_0x1f164c){var _0x3caa1f={'raw':!![],'where':{'id':_0x553ef2[_0x33de('0x47')]['id']}},_0x384b12={};_0x384b12[_0x33de('0x33')]=_[_0x33de('0x31')](db[_0x33de('0x2f')]['rawAttributes']);_0x384b12[_0x33de('0x34')]=_['keys'](_0x553ef2[_0x33de('0x34')]);_0x384b12['filters']=_[_0x33de('0x32')](_0x384b12[_0x33de('0x33')],_0x384b12['query']);_0x3caa1f[_0x33de('0x35')]=_[_0x33de('0x32')](_0x384b12[_0x33de('0x33')],qs['fields'](_0x553ef2['query'][_0x33de('0x36')]));_0x3caa1f[_0x33de('0x35')]=_0x3caa1f['attributes']['length']?_0x3caa1f[_0x33de('0x35')]:_0x384b12['model'];if(_0x553ef2['query']['includeAll']){_0x3caa1f[_0x33de('0x48')]=[{'all':!![]}];}_0x3caa1f=_[_0x33de('0x40')]({},_0x3caa1f,_0x553ef2[_0x33de('0x49')]);return db[_0x33de('0x2f')]['find'](_0x3caa1f)['then'](handleEntityNotFound(_0x1f164c,null))[_0x33de('0x25')](respondWithResult(_0x1f164c,null))[_0x33de('0x46')](handleError(_0x1f164c,null));};exports['create']=function(_0x1d016b,_0xc23633){return db[_0x33de('0x2f')][_0x33de('0x4a')](_0x1d016b[_0x33de('0x4b')],{})['then'](function(_0x185e5f){var _0x3bf2e3=_0x1d016b['user'][_0x33de('0x26')]({'plain':!![]});if(!_0x3bf2e3)throw new Error(_0x33de('0x4c'));if(_0x3bf2e3[_0x33de('0x4d')]===_0x33de('0x4e')){var _0xbbb376=_0x185e5f[_0x33de('0x26')]({'plain':!![]});var _0x3d6424=_0x33de('0x27');return db[_0x33de('0x4f')][_0x33de('0x50')]({'where':{'name':_0x3d6424,'userProfileId':_0x3bf2e3['userProfileId']},'raw':!![]})[_0x33de('0x25')](function(_0x3d66e1){if(_0x3d66e1&&_0x3d66e1[_0x33de('0x51')]===0x0){return db[_0x33de('0x28')][_0x33de('0x4a')]({'name':_0xbbb376[_0x33de('0x2b')],'resourceId':_0xbbb376['id'],'type':_0x3d66e1[_0x33de('0x2b')],'sectionId':_0x3d66e1['id']},{})['then'](function(){return _0x185e5f;});}else{return _0x185e5f;}})[_0x33de('0x46')](function(_0x32042e){logger[_0x33de('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32042e);throw _0x32042e;});}return _0x185e5f;})[_0x33de('0x25')](respondWithResult(_0xc23633,0xc9))[_0x33de('0x46')](handleError(_0xc23633,null));};exports[_0x33de('0x24')]=function(_0x303f72,_0x492aa7){if(_0x303f72['body']['id']){delete _0x303f72[_0x33de('0x4b')]['id'];}return db[_0x33de('0x2f')][_0x33de('0x50')]({'where':{'id':_0x303f72[_0x33de('0x47')]['id']}})[_0x33de('0x25')](handleEntityNotFound(_0x492aa7,null))['then'](saveUpdates(_0x303f72['body'],null))[_0x33de('0x25')](respondWithResult(_0x492aa7,null))[_0x33de('0x46')](handleError(_0x492aa7,null));};exports[_0x33de('0x29')]=function(_0x7112db,_0x3bd3b1){return db[_0x33de('0x2f')][_0x33de('0x50')]({'where':{'id':_0x7112db[_0x33de('0x47')]['id']}})[_0x33de('0x25')](handleEntityNotFound(_0x3bd3b1,null))['then'](db[_0x33de('0x52')][_0x33de('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x7112db[_0x33de('0x47')]['id']}}))['then'](removeEntity(_0x3bd3b1,null))[_0x33de('0x46')](handleError(_0x3bd3b1,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 8f763de..911e6b2 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 _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 +var _0x2288=['../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x56d3cf,_0x20787b){var _0x5881e6=function(_0x2bd2cc){while(--_0x2bd2cc){_0x56d3cf['push'](_0x56d3cf['shift']());}};_0x5881e6(++_0x20787b);}(_0x2288,0x119));var _0x8228=function(_0x23739a,_0x14a461){_0x23739a=_0x23739a-0x0;var _0x587496=_0x2288[_0x23739a];return _0x587496;};'use strict';var _=require(_0x8228('0x0'));var util=require(_0x8228('0x1'));var logger=require(_0x8228('0x2'))('api');var moment=require(_0x8228('0x3'));var BPromise=require(_0x8228('0x4'));var rp=require(_0x8228('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8228('0x6'));var config=require(_0x8228('0x7'));var attributes=require(_0x8228('0x8'));module[_0x8228('0x9')]=function(_0x2f346f,_0x25a7fc){return _0x2f346f[_0x8228('0xa')](_0x8228('0xb'),attributes,{'tableName':'tools_contact_item_types','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 bda5bad..f5da2f6 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 _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 +var _0x1241=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5e6304,_0x493578){var _0x506e57=function(_0x78e5af){while(--_0x78e5af){_0x5e6304['push'](_0x5e6304['shift']());}};_0x506e57(++_0x493578);}(_0x1241,0x155));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1124('0x0'));var util=require(_0x1124('0x1'));var moment=require(_0x1124('0x2'));var BPromise=require(_0x1124('0x3'));var rs=require(_0x1124('0x4'));var fs=require('fs');var Redis=require(_0x1124('0x5'));var db=require(_0x1124('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1124('0x7'))(_0x1124('0x8'));var config=require(_0x1124('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1124('0xa')][_0x1124('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x214742,_0x58128a,_0x243606){return new BPromise(function(_0x5ca885,_0xcc972f){return client['request'](_0x214742,_0x243606)[_0x1124('0xc')](function(_0xb04f55){logger[_0x1124('0xd')]('ContactItemType,\x20%s,\x20%s',_0x58128a,'request\x20sent');logger['debug'](_0x1124('0xe'),_0x58128a,_0x1124('0xf'),JSON[_0x1124('0x10')](_0xb04f55));if(_0xb04f55['error']){if(_0xb04f55[_0x1124('0x11')][_0x1124('0x12')]===0x1f4){logger[_0x1124('0x11')](_0x1124('0x13'),_0x58128a,_0xb04f55['error']['message']);return _0xcc972f(_0xb04f55[_0x1124('0x11')][_0x1124('0x14')]);}logger[_0x1124('0x11')](_0x1124('0x13'),_0x58128a,_0xb04f55[_0x1124('0x11')][_0x1124('0x14')]);return _0x5ca885(_0xb04f55[_0x1124('0x11')]['message']);}else{logger[_0x1124('0xd')](_0x1124('0x13'),_0x58128a,_0x1124('0xf'));_0x5ca885(_0xb04f55[_0x1124('0x15')][_0x1124('0x14')]);}})[_0x1124('0x16')](function(_0x51cabc){logger[_0x1124('0x11')]('ContactItemType,\x20%s,\x20%s',_0x58128a,_0x51cabc);_0xcc972f(_0x51cabc);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 46a7642..75e00d9 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 _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 +var _0xcac6=['isAuthenticated','show','post','create','put','/:id','delete','util','path','express','fs-extra','../../components/interaction/service','get'];(function(_0x5630e5,_0x22d4d1){var _0x1d3d8f=function(_0x3aeb0e){while(--_0x3aeb0e){_0x5630e5['push'](_0x5630e5['shift']());}};_0x1d3d8f(++_0x22d4d1);}(_0xcac6,0x159));var _0x6cac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcac6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x6cac('0x0'));var path=require(_0x6cac('0x1'));var timeout=require('connect-timeout');var express=require(_0x6cac('0x2'));var router=express['Router']();var fs_extra=require(_0x6cac('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6cac('0x4'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x6cac('0x5')]('/',auth[_0x6cac('0x6')](),controller['index']);router[_0x6cac('0x5')]('/:id',auth[_0x6cac('0x6')](),controller[_0x6cac('0x7')]);router[_0x6cac('0x8')]('/',auth[_0x6cac('0x6')](),controller[_0x6cac('0x9')]);router[_0x6cac('0xa')](_0x6cac('0xb'),auth[_0x6cac('0x6')](),controller['update']);router[_0x6cac('0xc')](_0x6cac('0xb'),auth['isAuthenticated'](),controller['destroy']);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 54f418f..d739b61 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 _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 +var _0xe706=['STRING','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe706,0xa3));var _0x6e70=function(_0x3dd822,_0x3b9fed){_0x3dd822=_0x3dd822-0x0;var _0x4f58d0=_0xe706[_0x3dd822];return _0x4f58d0;};'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 39f6324..eddfb63 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 _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 +var _0x94a4=['value','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','DashboardId','getItems','findOne','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboard.socket','register','sendStatus','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','UserProfileResource','status','end','stack','name','map','rawAttributes','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','Dashboard','include','findAll','catch','show','intersection','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','update','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','attrTimezone'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x94a4,0x197));var _0x494a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x94a4[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x494a('0x0'));var rimraf=require(_0x494a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x494a('0x2'));var rp=require(_0x494a('0x3'));var moment=require('moment');var BPromise=require(_0x494a('0x4'));var Mustache=require(_0x494a('0x5'));var util=require(_0x494a('0x6'));var path=require(_0x494a('0x7'));var sox=require(_0x494a('0x8'));var csv=require(_0x494a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x494a('0xa'));var _=require(_0x494a('0xb'));var squel=require('squel');var crypto=require(_0x494a('0xc'));var jsforce=require(_0x494a('0xd'));var deskjs=require(_0x494a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x494a('0xf'));var Papa=require(_0x494a('0x10'));var Redis=require(_0x494a('0x11'));var authService=require(_0x494a('0x12'));var qs=require(_0x494a('0x13'));var as=require(_0x494a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x494a('0x15'))(_0x494a('0x16'));var utils=require(_0x494a('0x17'));var config=require(_0x494a('0x18'));var licenseUtil=require(_0x494a('0x19'));var db=require(_0x494a('0x1a'))['db'];config[_0x494a('0x1b')]=_[_0x494a('0x1c')](config[_0x494a('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x494a('0x1d'))[_0x494a('0x1e')](socket);function respondWithStatusCode(_0x5eafbb,_0x16e846){_0x16e846=_0x16e846||0xcc;return function(_0x5e47f7){if(_0x5e47f7){return _0x5eafbb[_0x494a('0x1f')](_0x16e846);}return _0x5eafbb['status'](_0x16e846)['end']();};}function respondWithResult(_0x31e827,_0x3edfef){_0x3edfef=_0x3edfef||0xc8;return function(_0x153a52){if(_0x153a52){return _0x31e827['status'](_0x3edfef)['json'](_0x153a52);}};}function respondWithFilteredResult(_0x1086b7,_0x166915){return function(_0x1aeb44){if(_0x1aeb44){var _0x1512d9=typeof _0x166915[_0x494a('0x20')]==='undefined'&&typeof _0x166915[_0x494a('0x21')]===_0x494a('0x22');var _0xc6b929=_0x1aeb44[_0x494a('0x23')];var _0x10df25=_0x1512d9?0x0:_0x166915[_0x494a('0x20')];var _0xe30a42=_0x1512d9?_0x1aeb44[_0x494a('0x23')]:_0x166915[_0x494a('0x20')]+_0x166915['limit'];var _0x4cb6f4;if(_0xe30a42>=_0xc6b929){_0xe30a42=_0xc6b929;_0x4cb6f4=0xc8;}else{_0x4cb6f4=0xce;}_0x1086b7['status'](_0x4cb6f4);return _0x1086b7[_0x494a('0x24')](_0x494a('0x25'),_0x10df25+'-'+_0xe30a42+'/'+_0xc6b929)['json'](_0x1aeb44);}return null;};}function patchUpdates(_0x18adfc){return function(_0xca4088){try{jsonpatch['apply'](_0xca4088,_0x18adfc,!![]);}catch(_0x54c965){return BPromise[_0x494a('0x26')](_0x54c965);}return _0xca4088[_0x494a('0x27')]();};}function saveUpdates(_0x504d5d,_0x3d50b9){return function(_0x274285){if(_0x274285){return _0x274285['update'](_0x504d5d)[_0x494a('0x28')](function(_0x514ebd){return _0x514ebd;});}return null;};}function removeEntity(_0x2e1306,_0x5eeaad){return function(_0x2d8bb3){if(_0x2d8bb3){return _0x2d8bb3[_0x494a('0x29')]()['then'](function(){var _0x5c8e1a=_0x2d8bb3['get']({'plain':!![]});var _0x23d6c6='CustomDashboards';return db[_0x494a('0x2a')]['destroy']({'where':{'type':_0x23d6c6,'resourceId':_0x5c8e1a['id']}})[_0x494a('0x28')](function(){return _0x2d8bb3;});})[_0x494a('0x28')](function(){_0x2e1306[_0x494a('0x2b')](0xcc)[_0x494a('0x2c')]();});}};}function handleEntityNotFound(_0x4a9f24,_0x59f03b){return function(_0x42c939){if(!_0x42c939){_0x4a9f24[_0x494a('0x1f')](0x194);}return _0x42c939;};}function handleError(_0x205947,_0x3817bd){_0x3817bd=_0x3817bd||0x1f4;return function(_0x1f2283){logger['error'](_0x1f2283[_0x494a('0x2d')]);if(_0x1f2283[_0x494a('0x2e')]){delete _0x1f2283['name'];}_0x205947[_0x494a('0x2b')](_0x3817bd)['send'](_0x1f2283);};}exports['index']=function(_0x1cff1b,_0x41c766){var _0x5dc4f4={},_0x503c6e={},_0x23bb02={'count':0x0,'rows':[]};var _0x12091b=_[_0x494a('0x2f')](db['Dashboard'][_0x494a('0x30')],function(_0x1b0044){return{'name':_0x1b0044['fieldName'],'type':_0x1b0044[_0x494a('0x31')][_0x494a('0x32')]};});_0x503c6e['model']=_[_0x494a('0x2f')](_0x12091b,_0x494a('0x2e'));_0x503c6e[_0x494a('0x33')]=_[_0x494a('0x34')](_0x1cff1b[_0x494a('0x33')]);_0x503c6e['filters']=_['intersection'](_0x503c6e[_0x494a('0x35')],_0x503c6e[_0x494a('0x33')]);_0x5dc4f4[_0x494a('0x36')]=_['intersection'](_0x503c6e[_0x494a('0x35')],qs[_0x494a('0x37')](_0x1cff1b['query'][_0x494a('0x37')]));_0x5dc4f4['attributes']=_0x5dc4f4[_0x494a('0x36')][_0x494a('0x38')]?_0x5dc4f4['attributes']:_0x503c6e[_0x494a('0x35')];if(!_0x1cff1b[_0x494a('0x33')][_0x494a('0x39')]('nolimit')){_0x5dc4f4[_0x494a('0x21')]=qs[_0x494a('0x21')](_0x1cff1b[_0x494a('0x33')]['limit']);_0x5dc4f4[_0x494a('0x20')]=qs['offset'](_0x1cff1b['query'][_0x494a('0x20')]);}_0x5dc4f4[_0x494a('0x3a')]=qs[_0x494a('0x3b')](_0x1cff1b[_0x494a('0x33')]['sort']);_0x5dc4f4['where']=qs[_0x494a('0x3c')](_[_0x494a('0x3d')](_0x1cff1b[_0x494a('0x33')],_0x503c6e[_0x494a('0x3c')]),_0x12091b);if(_0x1cff1b[_0x494a('0x33')][_0x494a('0x3e')]){_0x5dc4f4[_0x494a('0x3f')]=_[_0x494a('0x40')](_0x5dc4f4[_0x494a('0x3f')],{'$or':_['map'](_0x12091b,function(_0x4c2b66){if(_0x4c2b66[_0x494a('0x31')]!=='VIRTUAL'){var _0x5b2bec={};_0x5b2bec[_0x4c2b66['name']]={'$like':'%'+_0x1cff1b[_0x494a('0x33')]['filter']+'%'};return _0x5b2bec;}})});}_0x5dc4f4=_['merge']({},_0x5dc4f4,_0x1cff1b[_0x494a('0x41')]);var _0x1ba5ff={'where':_0x5dc4f4[_0x494a('0x3f')]};return db[_0x494a('0x42')][_0x494a('0x23')](_0x1ba5ff)[_0x494a('0x28')](function(_0xf78dfd){_0x23bb02[_0x494a('0x23')]=_0xf78dfd;if(_0x1cff1b[_0x494a('0x33')]['includeAll']){_0x5dc4f4[_0x494a('0x43')]=[{'all':!![]}];}return db[_0x494a('0x42')][_0x494a('0x44')](_0x5dc4f4);})[_0x494a('0x28')](function(_0x591ccf){_0x23bb02['rows']=_0x591ccf;return _0x23bb02;})[_0x494a('0x28')](respondWithFilteredResult(_0x41c766,_0x5dc4f4))[_0x494a('0x45')](handleError(_0x41c766,null));};exports[_0x494a('0x46')]=function(_0x4072c8,_0x18094b){var _0x47d0a9={'raw':![],'where':{'id':_0x4072c8['params']['id']}},_0x1e5475={};_0x1e5475[_0x494a('0x35')]=_[_0x494a('0x34')](db[_0x494a('0x42')][_0x494a('0x30')]);_0x1e5475[_0x494a('0x33')]=_[_0x494a('0x34')](_0x4072c8['query']);_0x1e5475[_0x494a('0x3c')]=_[_0x494a('0x47')](_0x1e5475[_0x494a('0x35')],_0x1e5475[_0x494a('0x33')]);_0x47d0a9[_0x494a('0x36')]=_['intersection'](_0x1e5475[_0x494a('0x35')],qs[_0x494a('0x37')](_0x4072c8[_0x494a('0x33')][_0x494a('0x37')]));_0x47d0a9[_0x494a('0x36')]=_0x47d0a9[_0x494a('0x36')]['length']?_0x47d0a9[_0x494a('0x36')]:_0x1e5475[_0x494a('0x35')];if(_0x4072c8[_0x494a('0x33')][_0x494a('0x48')]){_0x47d0a9[_0x494a('0x43')]=[{'all':!![]}];}_0x47d0a9=_[_0x494a('0x40')]({},_0x47d0a9,_0x4072c8['options']);return db[_0x494a('0x42')][_0x494a('0x49')](_0x47d0a9)[_0x494a('0x28')](handleEntityNotFound(_0x18094b,null))[_0x494a('0x28')](respondWithResult(_0x18094b,null))['catch'](handleError(_0x18094b,null));};exports[_0x494a('0x4a')]=function(_0x7e1f84,_0x4aa7c1){return db[_0x494a('0x42')][_0x494a('0x4a')](_0x7e1f84[_0x494a('0x4b')],{})[_0x494a('0x28')](function(_0x36d7de){var _0x599abc=_0x7e1f84[_0x494a('0x4c')][_0x494a('0x4d')]({'plain':!![]});if(!_0x599abc)throw new Error(_0x494a('0x4e'));if(_0x599abc[_0x494a('0x4f')]===_0x494a('0x4c')){var _0x48057d=_0x36d7de[_0x494a('0x4d')]({'plain':!![]});var _0x4b9979=_0x494a('0x50');return db[_0x494a('0x51')][_0x494a('0x49')]({'where':{'name':_0x4b9979,'userProfileId':_0x599abc[_0x494a('0x52')]},'raw':!![]})[_0x494a('0x28')](function(_0x5e2149){if(_0x5e2149&&_0x5e2149[_0x494a('0x53')]===0x0){return db[_0x494a('0x2a')][_0x494a('0x4a')]({'name':_0x48057d[_0x494a('0x2e')],'resourceId':_0x48057d['id'],'type':_0x5e2149[_0x494a('0x2e')],'sectionId':_0x5e2149['id']},{})[_0x494a('0x28')](function(){return _0x36d7de;});}else{return _0x36d7de;}})[_0x494a('0x45')](function(_0x58af0e){logger[_0x494a('0x54')](_0x494a('0x55'),_0x58af0e);throw _0x58af0e;});}return _0x36d7de;})[_0x494a('0x28')](respondWithResult(_0x4aa7c1,0xc9))[_0x494a('0x45')](handleError(_0x4aa7c1,null));};exports[_0x494a('0x56')]=function(_0xbef9df,_0x385b7b){var _0x19ceb6={'where':{'id':_0xbef9df[_0x494a('0x57')]['id']}},_0x46c340={};_0x46c340[_0x494a('0x35')]=_[_0x494a('0x34')](db[_0x494a('0x42')][_0x494a('0x30')]);_0x19ceb6[_0x494a('0x36')]=_[_0x494a('0x47')](_0x46c340['model'],qs['fields'](_0xbef9df[_0x494a('0x33')]['fields']));_0x19ceb6[_0x494a('0x36')]=_0x19ceb6[_0x494a('0x36')][_0x494a('0x38')]?_0x19ceb6['attributes']:_0x46c340[_0x494a('0x35')];if(_0xbef9df[_0x494a('0x33')][_0x494a('0x48')]){_0x19ceb6[_0x494a('0x43')]=[{'all':!![]}];}_0x19ceb6=_[_0x494a('0x40')]({},_0x19ceb6,_0xbef9df[_0x494a('0x41')]);return db[_0x494a('0x42')][_0x494a('0x49')](_0x19ceb6)[_0x494a('0x28')](handleEntityNotFound(_0x385b7b,null))['then'](function(_0x3ec8e8){if(_0x3ec8e8){var _0x82935a=_0x3ec8e8['get']({'plain':!![]});_0x82935a=qs[_0x494a('0x58')](_0x82935a,['id',_0x494a('0x59'),_0x494a('0x5a')]);_0xbef9df['body']=_['omit'](_0xbef9df['body'],['id',_0x494a('0x59'),_0x494a('0x5a')]);return db[_0x494a('0x42')][_0x494a('0x4a')](_['merge'](_0x82935a,_0xbef9df[_0x494a('0x4b')]),{'include':_0xbef9df[_0x494a('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x494a('0x28')](function(_0x1e471c){var _0x366f44=_0xbef9df[_0x494a('0x4c')][_0x494a('0x4d')]({'plain':!![]});if(!_0x366f44)throw new Error(_0x494a('0x4e'));if(_0x366f44[_0x494a('0x4f')]===_0x494a('0x4c')){var _0xbd19ab=_0x1e471c['get']({'plain':!![]});var _0x24c8ca='CustomDashboards';return db[_0x494a('0x51')][_0x494a('0x49')]({'where':{'name':_0x24c8ca,'userProfileId':_0x366f44[_0x494a('0x52')]},'raw':!![]})['then'](function(_0x13350f){if(_0x13350f&&_0x13350f['autoAssociation']===0x0){return db[_0x494a('0x2a')]['create']({'name':_0xbd19ab[_0x494a('0x2e')],'resourceId':_0xbd19ab['id'],'type':_0x13350f['name'],'sectionId':_0x13350f['id']},{})[_0x494a('0x28')](function(){return _0x1e471c;});}else{return _0x1e471c;}})[_0x494a('0x45')](function(_0x34bcb2){logger[_0x494a('0x54')](_0x494a('0x55'),_0x34bcb2);throw _0x34bcb2;});}return _0x1e471c;});}})[_0x494a('0x28')](respondWithResult(_0x385b7b,0xc9))[_0x494a('0x45')](handleError(_0x385b7b,null));};exports[_0x494a('0x5b')]=function(_0x4f1b1c,_0x1595c0){if(_0x4f1b1c[_0x494a('0x4b')]['id']){delete _0x4f1b1c[_0x494a('0x4b')]['id'];}return db[_0x494a('0x42')][_0x494a('0x49')]({'where':{'id':_0x4f1b1c[_0x494a('0x57')]['id']}})[_0x494a('0x28')](handleEntityNotFound(_0x1595c0,null))['then'](saveUpdates(_0x4f1b1c['body'],null))[_0x494a('0x28')](respondWithResult(_0x1595c0,null))[_0x494a('0x45')](handleError(_0x1595c0,null));};exports[_0x494a('0x29')]=function(_0x32474c,_0x4191d7){return db[_0x494a('0x42')][_0x494a('0x49')]({'where':{'id':_0x32474c[_0x494a('0x57')]['id']}})[_0x494a('0x28')](handleEntityNotFound(_0x4191d7,null))[_0x494a('0x28')](removeEntity(_0x4191d7,null))[_0x494a('0x45')](handleError(_0x4191d7,null));};function widgetAttributes(_0x3667a4){try{switch(_0x3667a4[_0x494a('0x31')]){case _0x494a('0x5c'):return[{'name':_0x494a('0x5d'),'value':_0x3667a4[_0x494a('0x5d')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x0]?_0x3667a4[_0x494a('0x5e')][0x0]['value']:undefined)||_0x494a('0x5f')}];case _0x494a('0x60'):return[{'name':_0x494a('0x61'),'value':_0x3667a4[_0x494a('0x61')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x0]?_0x3667a4[_0x494a('0x5e')][0x0]['value']:undefined)||''}];case _0x494a('0x62'):return[{'name':_0x494a('0x63'),'value':_0x3667a4[_0x494a('0x63')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x0]?_0x3667a4[_0x494a('0x5e')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x494a('0x64'),'value':_0x3667a4[_0x494a('0x64')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x1]?_0x3667a4[_0x494a('0x5e')][0x1][_0x494a('0x65')]:undefined)||'0.00'},{'name':_0x494a('0x66'),'value':_0x3667a4['attrFontSize']||(_0x3667a4['attrs']&&_0x3667a4[_0x494a('0x5e')][0x2]?_0x3667a4['attrs'][0x2]['value']:undefined)||0xc}];case _0x494a('0x67'):return[{'name':'attrMetric','value':_0x3667a4[_0x494a('0x68')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x0]?_0x3667a4[_0x494a('0x5e')][0x0][_0x494a('0x65')]:undefined)||_0x494a('0x69')},{'name':_0x494a('0x6a'),'value':_0x3667a4['attrVoiceQueues']||(_0x3667a4['attrs']&&_0x3667a4[_0x494a('0x5e')][0x1]?_0x3667a4[_0x494a('0x5e')][0x1][_0x494a('0x65')]:undefined)||[]},{'name':_0x494a('0x66'),'value':_0x3667a4[_0x494a('0x66')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x2]?_0x3667a4[_0x494a('0x5e')][0x2][_0x494a('0x65')]:undefined)||0x14},{'name':'attrChannel','value':_0x3667a4[_0x494a('0x6b')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x3]?_0x3667a4['attrs'][0x3][_0x494a('0x65')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x3667a4[_0x494a('0x6c')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x4]?_0x3667a4[_0x494a('0x5e')][0x4]['value']:undefined)||''},{'name':_0x494a('0x6d'),'value':_0x3667a4[_0x494a('0x6d')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x5]?_0x3667a4[_0x494a('0x5e')][0x5][_0x494a('0x65')]:undefined)||''},{'name':_0x494a('0x6e'),'value':_0x3667a4['attrSmsAccounts']||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x6]?_0x3667a4[_0x494a('0x5e')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3667a4[_0x494a('0x6f')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x7]?_0x3667a4[_0x494a('0x5e')][0x7][_0x494a('0x65')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3667a4['attrWhatsappAccounts']||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x8]?_0x3667a4['attrs'][0x8][_0x494a('0x65')]:undefined)||''},{'name':_0x494a('0x70'),'value':_0x3667a4[_0x494a('0x70')]||(_0x3667a4['attrs']&&_0x3667a4[_0x494a('0x5e')][0x9]?_0x3667a4[_0x494a('0x5e')][0x9][_0x494a('0x65')]:undefined)||''}];case _0x494a('0x71'):case _0x494a('0x72'):return[{'name':_0x494a('0x73'),'value':_0x3667a4[_0x494a('0x73')]||(_0x3667a4['attrs']&&_0x3667a4[_0x494a('0x5e')][0x0]?_0x3667a4['attrs'][0x0][_0x494a('0x65')]:undefined)||_0x494a('0x69')},{'name':_0x494a('0x74'),'value':_0x3667a4[_0x494a('0x74')]||(_0x3667a4['attrs']&&_0x3667a4['attrs'][0x1]?_0x3667a4[_0x494a('0x5e')][0x1][_0x494a('0x65')]:undefined)||null},{'name':'attrSerie3','value':_0x3667a4[_0x494a('0x75')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x2]?_0x3667a4[_0x494a('0x5e')][0x2][_0x494a('0x65')]:undefined)||null},{'name':_0x494a('0x6a'),'value':_0x3667a4[_0x494a('0x6a')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x3]?_0x3667a4[_0x494a('0x5e')][0x3][_0x494a('0x65')]:undefined)||[]},{'name':_0x494a('0x6b'),'value':_0x3667a4[_0x494a('0x6b')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x4]?_0x3667a4[_0x494a('0x5e')][0x4][_0x494a('0x65')]:undefined)||'voice'},{'name':_0x494a('0x6c'),'value':_0x3667a4[_0x494a('0x6c')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x5]?_0x3667a4[_0x494a('0x5e')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x3667a4['attrFaxAccounts']||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x6]?_0x3667a4[_0x494a('0x5e')][0x6][_0x494a('0x65')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3667a4[_0x494a('0x6e')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x7]?_0x3667a4[_0x494a('0x5e')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3667a4[_0x494a('0x6f')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x8]?_0x3667a4[_0x494a('0x5e')][0x8][_0x494a('0x65')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3667a4[_0x494a('0x76')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x9]?_0x3667a4['attrs'][0x9]['value']:undefined)||''},{'name':_0x494a('0x70'),'value':_0x3667a4[_0x494a('0x70')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0xa]?_0x3667a4['attrs'][0xa][_0x494a('0x65')]:undefined)||''}];case _0x494a('0x77'):return[{'name':'attrReport','type':_0x3667a4[_0x494a('0x78')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x0]?_0x3667a4['attrs'][0x0][_0x494a('0x31')]:undefined)||null,'value':_0x3667a4[_0x494a('0x79')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x0]?_0x3667a4[_0x494a('0x5e')][0x0][_0x494a('0x65')]:undefined)||null},{'name':'attrRefresh','value':_0x3667a4[_0x494a('0x7a')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x1]?_0x3667a4[_0x494a('0x5e')][0x1][_0x494a('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x29c6b1){logger['error'](_0x494a('0x7b'),JSON['stringify'](_0x29c6b1));return[];}}exports['addItem']=function(_0x2a3442,_0x462fcd,_0x83a184){if(_0x2a3442[_0x494a('0x4b')]['id']){delete _0x2a3442[_0x494a('0x4b')]['id'];}return db[_0x494a('0x42')]['find']({'where':{'id':_0x2a3442[_0x494a('0x57')]['id']}})[_0x494a('0x28')](handleEntityNotFound(_0x462fcd,null))['then'](function(_0x435552){if(_0x435552){_0x2a3442[_0x494a('0x4b')][_0x494a('0x7c')]=_0x435552['id'];_0x2a3442[_0x494a('0x4b')]['attrs']=widgetAttributes(_0x2a3442[_0x494a('0x4b')]);return db['DashboardItem'][_0x494a('0x4a')](_0x2a3442['body']);}})[_0x494a('0x28')](respondWithResult(_0x462fcd,null))[_0x494a('0x45')](handleError(_0x462fcd,null));};exports[_0x494a('0x7d')]=function(_0x56b76b,_0x2584bb,_0x9cb295){var _0x510c63={};var _0x59605d={};var _0x138395;var _0x165e45;return db[_0x494a('0x42')][_0x494a('0x7e')]({'where':{'id':_0x56b76b[_0x494a('0x57')]['id']}})[_0x494a('0x28')](handleEntityNotFound(_0x2584bb,null))[_0x494a('0x28')](function(_0x41651a){if(_0x41651a){_0x138395=_0x41651a;_0x59605d[_0x494a('0x35')]=_[_0x494a('0x34')](db['DashboardItem'][_0x494a('0x30')]);_0x59605d['query']=_[_0x494a('0x34')](_0x56b76b[_0x494a('0x33')]);_0x59605d['filters']=_[_0x494a('0x47')](_0x59605d[_0x494a('0x35')],_0x59605d[_0x494a('0x33')]);_0x510c63['attributes']=_[_0x494a('0x47')](_0x59605d[_0x494a('0x35')],qs[_0x494a('0x37')](_0x56b76b[_0x494a('0x33')]['fields']));_0x510c63['attributes']=_0x510c63[_0x494a('0x36')][_0x494a('0x38')]?_0x510c63[_0x494a('0x36')]:_0x59605d['model'];_0x510c63[_0x494a('0x3a')]=qs['sort'](_0x56b76b[_0x494a('0x33')][_0x494a('0x3b')]);_0x510c63[_0x494a('0x3f')]=qs[_0x494a('0x3c')](_[_0x494a('0x3d')](_0x56b76b[_0x494a('0x33')],_0x59605d[_0x494a('0x3c')]));if(_0x56b76b['query'][_0x494a('0x3e')]){_0x510c63[_0x494a('0x3f')]=_['merge'](_0x510c63['where'],{'$or':_[_0x494a('0x2f')](_0x510c63[_0x494a('0x36')],function(_0x3b226c){var _0x20240b={};_0x20240b[_0x3b226c]={'$like':'%'+_0x56b76b['query'][_0x494a('0x3e')]+'%'};return _0x20240b;})});}_0x510c63=_[_0x494a('0x40')]({},_0x510c63,_0x56b76b[_0x494a('0x41')]);return _0x138395[_0x494a('0x7d')](_0x510c63);}})[_0x494a('0x28')](function(_0x81ecd6){if(_0x81ecd6){_0x165e45=_0x81ecd6[_0x494a('0x38')];if(!_0x56b76b['query'][_0x494a('0x39')]('nolimit')){_0x510c63[_0x494a('0x21')]=qs[_0x494a('0x21')](_0x56b76b[_0x494a('0x33')][_0x494a('0x21')]);_0x510c63[_0x494a('0x20')]=qs['offset'](_0x56b76b[_0x494a('0x33')][_0x494a('0x20')]);}return _0x138395[_0x494a('0x7d')](_0x510c63);}})[_0x494a('0x28')](function(_0x7315f5){if(_0x7315f5){return _0x7315f5?{'count':_0x165e45,'rows':_0x7315f5}:null;}})[_0x494a('0x28')](respondWithResult(_0x2584bb,null))['catch'](handleError(_0x2584bb,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index ba65e3a..55e3a22 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 _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 +var _0xfef9=['remove','emit','hook','exports','events','Dashboard','setMaxListeners','update'];(function(_0x4c73b7,_0x2b2586){var _0x26d9b0=function(_0x2bfcf4){while(--_0x2bfcf4){_0x4c73b7['push'](_0x4c73b7['shift']());}};_0x26d9b0(++_0x2b2586);}(_0xfef9,0xcc));var _0x9fef=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0xfef9[_0x6173fc];return _0x965fbe;};'use strict';var EventEmitter=require(_0x9fef('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x9fef('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9fef('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9fef('0x3'),'afterDestroy':_0x9fef('0x4')};function emitEvent(_0x9a3337){return function(_0x2da779,_0x9dee3f,_0x121cf8){DashboardEvents[_0x9fef('0x5')](_0x9a3337+':'+_0x2da779['id'],_0x2da779);DashboardEvents[_0x9fef('0x5')](_0x9a3337,_0x2da779);_0x121cf8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x9fef('0x6')](e,emitEvent(event));}}module[_0x9fef('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 988a66e..71a25dd 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 _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 +var _0xf3ec=['./dashboard.attributes','define','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1a9ed0,_0x1085fc){var _0x47bbd6=function(_0x27bd1c){while(--_0x27bd1c){_0x1a9ed0['push'](_0x1a9ed0['shift']());}};_0x47bbd6(++_0x1085fc);}(_0xf3ec,0xbe));var _0xcf3e=function(_0x5c7bd9,_0x36f52a){_0x5c7bd9=_0x5c7bd9-0x0;var _0x523b46=_0xf3ec[_0x5c7bd9];return _0x523b46;};'use strict';var _=require(_0xcf3e('0x0'));var util=require(_0xcf3e('0x1'));var logger=require(_0xcf3e('0x2'))(_0xcf3e('0x3'));var moment=require(_0xcf3e('0x4'));var BPromise=require(_0xcf3e('0x5'));var rp=require(_0xcf3e('0x6'));var fs=require('fs');var path=require(_0xcf3e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf3e('0x8'));module['exports']=function(_0x5b38a5,_0x32c5aa){return _0x5b38a5[_0xcf3e('0x9')]('Dashboard',attributes,{'tableName':_0xcf3e('0xa'),'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 dcd903c..7e20ae2 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 _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 +var _0x4578=['debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','socket.io-emitter','./dashboard.socket','register','then','request\x20sent'];(function(_0x43156f,_0x22657f){var _0x5249a7=function(_0x50e870){while(--_0x50e870){_0x43156f['push'](_0x43156f['shift']());}};_0x5249a7(++_0x22657f);}(_0x4578,0xd2));var _0x8457=function(_0x5b6417,_0x29f4e4){_0x5b6417=_0x5b6417-0x0;var _0x527f95=_0x4578[_0x5b6417];return _0x527f95;};'use strict';var _=require('lodash');var util=require(_0x8457('0x0'));var moment=require(_0x8457('0x1'));var BPromise=require('bluebird');var rs=require(_0x8457('0x2'));var fs=require('fs');var Redis=require(_0x8457('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8457('0x4'));var logger=require(_0x8457('0x5'))(_0x8457('0x6'));var config=require('../../config/environment');var jayson=require(_0x8457('0x7'));var client=jayson[_0x8457('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x8457('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8457('0xa'))(new Redis(config[_0x8457('0x9')]));require(_0x8457('0xb'))[_0x8457('0xc')](socket);function respondWithRpcPromise(_0x3205d1,_0xb0189a,_0x5d9427){return new BPromise(function(_0x11d6fb,_0x536101){return client['request'](_0x3205d1,_0x5d9427)[_0x8457('0xd')](function(_0x3ad63d){logger['info']('Dashboard,\x20%s,\x20%s',_0xb0189a,_0x8457('0xe'));logger[_0x8457('0xf')](_0x8457('0x10'),_0xb0189a,_0x8457('0xe'),JSON[_0x8457('0x11')](_0x3ad63d));if(_0x3ad63d[_0x8457('0x12')]){if(_0x3ad63d['error'][_0x8457('0x13')]===0x1f4){logger[_0x8457('0x12')](_0x8457('0x14'),_0xb0189a,_0x3ad63d['error'][_0x8457('0x15')]);return _0x536101(_0x3ad63d[_0x8457('0x12')][_0x8457('0x15')]);}logger[_0x8457('0x12')]('Dashboard,\x20%s,\x20%s',_0xb0189a,_0x3ad63d[_0x8457('0x12')]['message']);return _0x11d6fb(_0x3ad63d['error'][_0x8457('0x15')]);}else{logger[_0x8457('0x16')](_0x8457('0x14'),_0xb0189a,_0x8457('0xe'));_0x11d6fb(_0x3ad63d[_0x8457('0x17')][_0x8457('0x15')]);}})[_0x8457('0x18')](function(_0x132056){logger[_0x8457('0x12')](_0x8457('0x14'),_0xb0189a,_0x132056);_0x536101(_0x132056);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index fd96266..ab596e9 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 _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 +var _0x874b=['./dashboard.events','save','remove','update','emit','dashboard:'];(function(_0xf5fbd5,_0xd39527){var _0x47e6cf=function(_0x2eb557){while(--_0x2eb557){_0xf5fbd5['push'](_0xf5fbd5['shift']());}};_0x47e6cf(++_0xd39527);}(_0x874b,0xf6));var _0xb874=function(_0x10a774,_0x4d1ba2){_0x10a774=_0x10a774-0x0;var _0xd05e5b=_0x874b[_0x10a774];return _0xd05e5b;};'use strict';var DashboardEvents=require(_0xb874('0x0'));var events=[_0xb874('0x1'),_0xb874('0x2'),_0xb874('0x3')];function createListener(_0x506f66,_0x4b43c3){return function(_0x4d6af0){_0x4b43c3[_0xb874('0x4')](_0x506f66,_0x4d6af0);};}function removeListener(_0x197901,_0xe51e76){return function(){DashboardEvents['removeListener'](_0x197901,_0xe51e76);};}exports['register']=function(_0x1964fa){for(var _0x4dd6ec=0x0,_0x280ec2=events['length'];_0x4dd6ec<_0x280ec2;_0x4dd6ec++){var _0x26314d=events[_0x4dd6ec];var _0x530cdd=createListener(_0xb874('0x5')+_0x26314d,_0x1964fa);DashboardEvents['on'](_0x26314d,_0x530cdd);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5fc0638..3ae69e9 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 _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 +var _0x52d1=['../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','index','/:id','show','get','getItems','create','post','/:id/items','addItem','put','update','util','Router','fs-extra'];(function(_0x4eec0f,_0xec3aee){var _0xb6cd47=function(_0x43dcee){while(--_0x43dcee){_0x4eec0f['push'](_0x4eec0f['shift']());}};_0xb6cd47(++_0xec3aee);}(_0x52d1,0x10b));var _0x152d=function(_0x486b55,_0x41c91b){_0x486b55=_0x486b55-0x0;var _0x378a03=_0x52d1[_0x486b55];return _0x378a03;};'use strict';var multer=require('multer');var util=require(_0x152d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x152d('0x1')]();var fs_extra=require(_0x152d('0x2'));var auth=require(_0x152d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x152d('0x4'));var controller=require(_0x152d('0x5'));router['get']('/',auth[_0x152d('0x6')](),controller[_0x152d('0x7')]);router['get'](_0x152d('0x8'),auth['isAuthenticated'](),controller[_0x152d('0x9')]);router[_0x152d('0xa')]('/:id/items',auth[_0x152d('0x6')](),controller[_0x152d('0xb')]);router['post']('/',auth[_0x152d('0x6')](),controller[_0x152d('0xc')]);router[_0x152d('0xd')]('/:id/clone',auth[_0x152d('0x6')](),controller['clone']);router[_0x152d('0xd')](_0x152d('0xe'),auth['isAuthenticated'](),controller[_0x152d('0xf')]);router[_0x152d('0x10')](_0x152d('0x8'),auth[_0x152d('0x6')](),controller[_0x152d('0x11')]);router['delete'](_0x152d('0x8'),auth[_0x152d('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index c772eba..3e81d92 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 _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 +var _0xd8fb=['exports','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','STRING','sequelize','squel','lodash'];(function(_0x59f6be,_0x472a09){var _0x2aef59=function(_0x4d72d9){while(--_0x4d72d9){_0x59f6be['push'](_0x59f6be['shift']());}};_0x2aef59(++_0x472a09);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4b659e,_0x12e462){_0x4b659e=_0x4b659e-0x0;var _0x23f5cc=_0xd8fb[_0x4b659e];return _0x23f5cc;};'use strict';var Sequelize=require(_0xbd8f('0x0'));var squel=require(_0xbd8f('0x1'));var _=require(_0xbd8f('0x2'));module[_0xbd8f('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xbd8f('0x4')),'get':function(){try{return JSON[_0xbd8f('0x5')](this['getDataValue'](_0xbd8f('0x6')));}catch(_0x2343bf){return[];}},'set':function(_0x5543b2){try{this[_0xbd8f('0x7')]('attrs',JSON[_0xbd8f('0x8')](_0x5543b2));}catch(_0x578499){this[_0xbd8f('0x7')](_0xbd8f('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xbd8f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xbd8f('0x9')]},'col':{'type':Sequelize[_0xbd8f('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd8f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xbd8f('0xb')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xbd8f('0x9')],'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 f5d6e93..200a54f 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 _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 +var _0x7ed1=['attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrReport','reportType','type','widgetAttributes:\x20%s','stringify','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','sendStatus','error','stack','name','send','params','model','keys','DashboardItem','query','filters','intersection','attributes','fields','includeAll','include','options','catch','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts'];(function(_0x10abfe,_0x7a9ad6){var _0x473c1b=function(_0x392758){while(--_0x392758){_0x10abfe['push'](_0x10abfe['shift']());}};_0x473c1b(++_0x7a9ad6);}(_0x7ed1,0xca));var _0x17ed=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x7ed1[_0x35da42];return _0x370035;};'use strict';var emlformat=require(_0x17ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17ed('0x1'));var jsonpatch=require(_0x17ed('0x2'));var rp=require(_0x17ed('0x3'));var moment=require(_0x17ed('0x4'));var BPromise=require(_0x17ed('0x5'));var Mustache=require(_0x17ed('0x6'));var util=require('util');var path=require(_0x17ed('0x7'));var sox=require(_0x17ed('0x8'));var csv=require(_0x17ed('0x9'));var ejs=require(_0x17ed('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x17ed('0xb'));var crypto=require(_0x17ed('0xc'));var jsforce=require(_0x17ed('0xd'));var deskjs=require(_0x17ed('0xe'));var toCsv=require('to-csv');var querystring=require(_0x17ed('0xf'));var Papa=require(_0x17ed('0x10'));var Redis=require(_0x17ed('0x11'));var authService=require(_0x17ed('0x12'));var qs=require(_0x17ed('0x13'));var as=require(_0x17ed('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17ed('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x17ed('0x16'));var licenseUtil=require(_0x17ed('0x17'));var db=require(_0x17ed('0x18'))['db'];config[_0x17ed('0x19')]=_[_0x17ed('0x1a')](config['redis'],{'host':_0x17ed('0x1b'),'port':0x18eb});var socket=require(_0x17ed('0x1c'))(new Redis(config[_0x17ed('0x19')]));require('./dashboardItem.socket')[_0x17ed('0x1d')](socket);function respondWithStatusCode(_0x53ec2a,_0x513e5c){_0x513e5c=_0x513e5c||0xcc;return function(_0x30a0c6){if(_0x30a0c6){return _0x53ec2a['sendStatus'](_0x513e5c);}return _0x53ec2a[_0x17ed('0x1e')](_0x513e5c)[_0x17ed('0x1f')]();};}function respondWithResult(_0xd10a00,_0x6ccf15){_0x6ccf15=_0x6ccf15||0xc8;return function(_0x5458ff){if(_0x5458ff){return _0xd10a00[_0x17ed('0x1e')](_0x6ccf15)[_0x17ed('0x20')](_0x5458ff);}};}function respondWithFilteredResult(_0x20b6d2,_0x5ade66){return function(_0x52518e){if(_0x52518e){var _0x81e1a6=typeof _0x5ade66[_0x17ed('0x21')]===_0x17ed('0x22')&&typeof _0x5ade66[_0x17ed('0x23')]===_0x17ed('0x22');var _0x49340f=_0x52518e[_0x17ed('0x24')];var _0x3dc4cb=_0x81e1a6?0x0:_0x5ade66['offset'];var _0x2cac50=_0x81e1a6?_0x52518e[_0x17ed('0x24')]:_0x5ade66['offset']+_0x5ade66[_0x17ed('0x23')];var _0x22f57d;if(_0x2cac50>=_0x49340f){_0x2cac50=_0x49340f;_0x22f57d=0xc8;}else{_0x22f57d=0xce;}_0x20b6d2[_0x17ed('0x1e')](_0x22f57d);return _0x20b6d2[_0x17ed('0x25')](_0x17ed('0x26'),_0x3dc4cb+'-'+_0x2cac50+'/'+_0x49340f)[_0x17ed('0x20')](_0x52518e);}return null;};}function patchUpdates(_0x43243e){return function(_0x50f6a3){try{jsonpatch[_0x17ed('0x27')](_0x50f6a3,_0x43243e,!![]);}catch(_0x3574f3){return BPromise['reject'](_0x3574f3);}return _0x50f6a3['save']();};}function saveUpdates(_0x464799,_0x5d095b){return function(_0x5e03b3){if(_0x5e03b3){return _0x5e03b3['update'](_0x464799)[_0x17ed('0x28')](function(_0x56722d){return _0x56722d;});}return null;};}function removeEntity(_0x2bbff3,_0x225721){return function(_0xf9c88c){if(_0xf9c88c){return _0xf9c88c['destroy']()[_0x17ed('0x28')](function(){_0x2bbff3[_0x17ed('0x1e')](0xcc)[_0x17ed('0x1f')]();});}};}function handleEntityNotFound(_0x4d1de9,_0x57470d){return function(_0x170d4f){if(!_0x170d4f){_0x4d1de9[_0x17ed('0x29')](0x194);}return _0x170d4f;};}function handleError(_0x376f03,_0x5a02ab){_0x5a02ab=_0x5a02ab||0x1f4;return function(_0x38bb50){logger[_0x17ed('0x2a')](_0x38bb50[_0x17ed('0x2b')]);if(_0x38bb50[_0x17ed('0x2c')]){delete _0x38bb50['name'];}_0x376f03[_0x17ed('0x1e')](_0x5a02ab)[_0x17ed('0x2d')](_0x38bb50);};}exports['show']=function(_0x35c300,_0xd0289){var _0xf325ed={'raw':![],'where':{'id':_0x35c300[_0x17ed('0x2e')]['id']}},_0x529966={};_0x529966[_0x17ed('0x2f')]=_[_0x17ed('0x30')](db[_0x17ed('0x31')]['rawAttributes']);_0x529966[_0x17ed('0x32')]=_['keys'](_0x35c300[_0x17ed('0x32')]);_0x529966[_0x17ed('0x33')]=_[_0x17ed('0x34')](_0x529966[_0x17ed('0x2f')],_0x529966['query']);_0xf325ed[_0x17ed('0x35')]=_[_0x17ed('0x34')](_0x529966[_0x17ed('0x2f')],qs[_0x17ed('0x36')](_0x35c300[_0x17ed('0x32')][_0x17ed('0x36')]));_0xf325ed[_0x17ed('0x35')]=_0xf325ed[_0x17ed('0x35')]['length']?_0xf325ed[_0x17ed('0x35')]:_0x529966[_0x17ed('0x2f')];if(_0x35c300[_0x17ed('0x32')][_0x17ed('0x37')]){_0xf325ed[_0x17ed('0x38')]=[{'all':!![]}];}_0xf325ed=_['merge']({},_0xf325ed,_0x35c300[_0x17ed('0x39')]);return db[_0x17ed('0x31')]['find'](_0xf325ed)['then'](handleEntityNotFound(_0xd0289,null))['then'](respondWithResult(_0xd0289,null))[_0x17ed('0x3a')](handleError(_0xd0289,null));};exports['destroy']=function(_0x14de84,_0x1c76c4){return db[_0x17ed('0x31')]['find']({'where':{'id':_0x14de84[_0x17ed('0x2e')]['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x1c76c4,null))[_0x17ed('0x28')](removeEntity(_0x1c76c4,null))[_0x17ed('0x3a')](handleError(_0x1c76c4,null));};function widgetAttributes(_0x7f62fa){try{switch(_0x7f62fa['type']){case _0x17ed('0x3b'):return[{'name':_0x17ed('0x3c'),'value':_0x7f62fa[_0x17ed('0x3c')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0]['value']:undefined)||'https://'}];case _0x17ed('0x3e'):return[{'name':_0x17ed('0x3f'),'value':_0x7f62fa['attrPath']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x0]?_0x7f62fa['attrs'][0x0][_0x17ed('0x40')]:undefined)||''}];case _0x17ed('0x41'):return[{'name':_0x17ed('0x42'),'value':_0x7f62fa[_0x17ed('0x42')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0][_0x17ed('0x40')]:undefined)||'HH:mm:ss'},{'name':_0x17ed('0x43'),'value':_0x7f62fa[_0x17ed('0x43')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x1]?_0x7f62fa[_0x17ed('0x3d')][0x1][_0x17ed('0x40')]:undefined)||_0x17ed('0x44')},{'name':_0x17ed('0x45'),'value':_0x7f62fa[_0x17ed('0x45')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x2]?_0x7f62fa[_0x17ed('0x3d')][0x2][_0x17ed('0x40')]:undefined)||0xc}];case _0x17ed('0x46'):return[{'name':_0x17ed('0x47'),'value':_0x7f62fa[_0x17ed('0x47')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0]['value']:undefined)||_0x17ed('0x48')},{'name':_0x17ed('0x49'),'value':_0x7f62fa[_0x17ed('0x49')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x1]?_0x7f62fa['attrs'][0x1][_0x17ed('0x40')]:undefined)||[]},{'name':_0x17ed('0x45'),'value':_0x7f62fa[_0x17ed('0x45')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x2]?_0x7f62fa[_0x17ed('0x3d')][0x2][_0x17ed('0x40')]:undefined)||0x14},{'name':_0x17ed('0x4a'),'value':_0x7f62fa[_0x17ed('0x4a')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x3]?_0x7f62fa['attrs'][0x3]['value']:undefined)||_0x17ed('0x4b')},{'name':_0x17ed('0x4c'),'value':_0x7f62fa[_0x17ed('0x4c')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x4]?_0x7f62fa[_0x17ed('0x3d')][0x4][_0x17ed('0x40')]:undefined)||''},{'name':_0x17ed('0x4d'),'value':_0x7f62fa[_0x17ed('0x4d')]||(_0x7f62fa['attrs']&&_0x7f62fa[_0x17ed('0x3d')][0x5]?_0x7f62fa[_0x17ed('0x3d')][0x5][_0x17ed('0x40')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x7f62fa['attrSmsAccounts']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x6]?_0x7f62fa['attrs'][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x7f62fa[_0x17ed('0x4e')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x7]?_0x7f62fa[_0x17ed('0x3d')][0x7][_0x17ed('0x40')]:undefined)||''},{'name':_0x17ed('0x4f'),'value':_0x7f62fa[_0x17ed('0x4f')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x8]?_0x7f62fa[_0x17ed('0x3d')][0x8][_0x17ed('0x40')]:undefined)||''},{'name':_0x17ed('0x50'),'value':_0x7f62fa['attrChatWebsites']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x9]?_0x7f62fa['attrs'][0x9][_0x17ed('0x40')]:undefined)||''}];case _0x17ed('0x51'):case _0x17ed('0x52'):return[{'name':_0x17ed('0x53'),'value':_0x7f62fa[_0x17ed('0x53')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa['attrs'][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0]['value']:undefined)||_0x17ed('0x48')},{'name':'attrSerie2','value':_0x7f62fa[_0x17ed('0x54')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x1]?_0x7f62fa['attrs'][0x1]['value']:undefined)||null},{'name':_0x17ed('0x55'),'value':_0x7f62fa[_0x17ed('0x55')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x2]?_0x7f62fa[_0x17ed('0x3d')][0x2][_0x17ed('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x7f62fa['attrVoiceQueues']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x3]?_0x7f62fa[_0x17ed('0x3d')][0x3][_0x17ed('0x40')]:undefined)||[]},{'name':'attrChannel','value':_0x7f62fa['attrChannel']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x4]?_0x7f62fa[_0x17ed('0x3d')][0x4][_0x17ed('0x40')]:undefined)||_0x17ed('0x4b')},{'name':_0x17ed('0x4c'),'value':_0x7f62fa['attrEmailAccounts']||(_0x7f62fa['attrs']&&_0x7f62fa[_0x17ed('0x3d')][0x5]?_0x7f62fa['attrs'][0x5][_0x17ed('0x40')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x7f62fa[_0x17ed('0x4d')]||(_0x7f62fa['attrs']&&_0x7f62fa[_0x17ed('0x3d')][0x6]?_0x7f62fa[_0x17ed('0x3d')][0x6][_0x17ed('0x40')]:undefined)||''},{'name':_0x17ed('0x56'),'value':_0x7f62fa['attrSmsAccounts']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x7]?_0x7f62fa[_0x17ed('0x3d')][0x7]['value']:undefined)||''},{'name':_0x17ed('0x4e'),'value':_0x7f62fa[_0x17ed('0x4e')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x8]?_0x7f62fa['attrs'][0x8][_0x17ed('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x7f62fa[_0x17ed('0x4f')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa['attrs'][0x9]?_0x7f62fa['attrs'][0x9][_0x17ed('0x40')]:undefined)||''},{'name':_0x17ed('0x50'),'value':_0x7f62fa[_0x17ed('0x50')]||(_0x7f62fa['attrs']&&_0x7f62fa[_0x17ed('0x3d')][0xa]?_0x7f62fa[_0x17ed('0x3d')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x17ed('0x57'),'type':_0x7f62fa[_0x17ed('0x58')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0][_0x17ed('0x59')]:undefined)||null,'value':_0x7f62fa[_0x17ed('0x57')]||(_0x7f62fa['attrs']&&_0x7f62fa['attrs'][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0][_0x17ed('0x40')]:undefined)||null},{'name':'attrRefresh','value':_0x7f62fa['attrRefresh']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa['attrs'][0x1]?_0x7f62fa['attrs'][0x1][_0x17ed('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x5368d5){logger['error'](_0x17ed('0x5a'),JSON[_0x17ed('0x5b')](_0x5368d5));return[];}}exports['create']=function(_0x3eb158,_0x31e86e){if(_0x3eb158[_0x17ed('0x5c')]){_0x3eb158[_0x17ed('0x5c')][_0x17ed('0x3d')]=widgetAttributes(_0x3eb158[_0x17ed('0x5c')]);}return db[_0x17ed('0x31')]['create'](_0x3eb158[_0x17ed('0x5c')],{})[_0x17ed('0x28')](respondWithResult(_0x31e86e,0xc9))[_0x17ed('0x3a')](handleError(_0x31e86e,null));};exports[_0x17ed('0x5d')]=function(_0x37f250,_0x3bb729){if(_0x37f250[_0x17ed('0x5c')]['id']){delete _0x37f250[_0x17ed('0x5c')]['id'];}_0x37f250[_0x17ed('0x5c')][_0x17ed('0x3d')]=widgetAttributes(_0x37f250[_0x17ed('0x5c')]);return db[_0x17ed('0x31')]['find']({'where':{'id':_0x37f250[_0x17ed('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3bb729,null))['then'](saveUpdates(_0x37f250['body'],null))[_0x17ed('0x28')](respondWithResult(_0x3bb729,null))[_0x17ed('0x3a')](handleError(_0x3bb729,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 018f8d2..a785601 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 _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 +var _0xe375=['events','../../mysqldb','save','emit','hasOwnProperty','hook','exports'];(function(_0x359842,_0xd7d82d){var _0x317362=function(_0x5cc5fb){while(--_0x5cc5fb){_0x359842['push'](_0x359842['shift']());}};_0x317362(++_0xd7d82d);}(_0xe375,0x7e));var _0x5e37=function(_0x2f9a30,_0x220d16){_0x2f9a30=_0x2f9a30-0x0;var _0x148096=_0xe375[_0x2f9a30];return _0x148096;};'use strict';var EventEmitter=require(_0x5e37('0x0'));var DashboardItem=require(_0x5e37('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e37('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4c47bd){return function(_0x1ca913,_0x844d80,_0x256716){DashboardItemEvents[_0x5e37('0x3')](_0x4c47bd+':'+_0x1ca913['id'],_0x1ca913);DashboardItemEvents[_0x5e37('0x3')](_0x4c47bd,_0x1ca913);_0x256716(null);};}for(var e in events){if(events[_0x5e37('0x4')](e)){var event=events[e];DashboardItem[_0x5e37('0x5')](e,emitEvent(event));}}module[_0x5e37('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 49708f1..555a1a6 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 _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 +var _0xa728=['../../config/logger','api','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util'];(function(_0x569019,_0x3fd3d9){var _0x53fbb1=function(_0x5afd7a){while(--_0x5afd7a){_0x569019['push'](_0x569019['shift']());}};_0x53fbb1(++_0x3fd3d9);}(_0xa728,0xb4));var _0x8a72=function(_0x3cfc43,_0x3d09e0){_0x3cfc43=_0x3cfc43-0x0;var _0x1e3ffe=_0xa728[_0x3cfc43];return _0x1e3ffe;};'use strict';var _=require(_0x8a72('0x0'));var util=require(_0x8a72('0x1'));var logger=require(_0x8a72('0x2'))(_0x8a72('0x3'));var moment=require('moment');var BPromise=require(_0x8a72('0x4'));var rp=require(_0x8a72('0x5'));var fs=require('fs');var path=require(_0x8a72('0x6'));var rimraf=require(_0x8a72('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a72('0x8'));module[_0x8a72('0x9')]=function(_0x11a345,_0x2a0d34){return _0x11a345[_0x8a72('0xa')](_0x8a72('0xb'),attributes,{'tableName':_0x8a72('0xc'),'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 ad4de30..2c21d30 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 _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 +var _0x81a8=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x2c429b,_0x11742b){var _0x35873d=function(_0x396a68){while(--_0x396a68){_0x2c429b['push'](_0x2c429b['shift']());}};_0x35873d(++_0x11742b);}(_0x81a8,0x155));var _0x881a=function(_0x4e4061,_0x26503b){_0x4e4061=_0x4e4061-0x0;var _0x371dbd=_0x81a8[_0x4e4061];return _0x371dbd;};'use strict';var _=require(_0x881a('0x0'));var util=require(_0x881a('0x1'));var moment=require(_0x881a('0x2'));var BPromise=require(_0x881a('0x3'));var rs=require(_0x881a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x881a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x881a('0x6'))(_0x881a('0x7'));var config=require('../../config/environment');var jayson=require(_0x881a('0x8'));var client=jayson[_0x881a('0x9')][_0x881a('0xa')]({'port':0x232a});config[_0x881a('0xb')]=_[_0x881a('0xc')](config[_0x881a('0xb')],{'host':_0x881a('0xd'),'port':0x18eb});var socket=require(_0x881a('0xe'))(new Redis(config[_0x881a('0xb')]));require('./dashboardItem.socket')[_0x881a('0xf')](socket);function respondWithRpcPromise(_0x55e926,_0x31199e,_0x4fdb07){return new BPromise(function(_0x1a41e9,_0x166e29){return client[_0x881a('0x10')](_0x55e926,_0x4fdb07)['then'](function(_0x1067b3){logger[_0x881a('0x11')](_0x881a('0x12'),_0x31199e,'request\x20sent');logger[_0x881a('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x31199e,_0x881a('0x14'),JSON['stringify'](_0x1067b3));if(_0x1067b3[_0x881a('0x15')]){if(_0x1067b3['error'][_0x881a('0x16')]===0x1f4){logger[_0x881a('0x15')](_0x881a('0x12'),_0x31199e,_0x1067b3['error'][_0x881a('0x17')]);return _0x166e29(_0x1067b3[_0x881a('0x15')]['message']);}logger[_0x881a('0x15')]('DashboardItem,\x20%s,\x20%s',_0x31199e,_0x1067b3[_0x881a('0x15')][_0x881a('0x17')]);return _0x1a41e9(_0x1067b3[_0x881a('0x15')][_0x881a('0x17')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x31199e,_0x881a('0x14'));_0x1a41e9(_0x1067b3['result']['message']);}})[_0x881a('0x18')](function(_0x3625c8){logger[_0x881a('0x15')]('DashboardItem,\x20%s,\x20%s',_0x31199e,_0x3625c8);_0x166e29(_0x3625c8);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b0f941f..42ec1ff 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 _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 +var _0xc4aa=['update','emit','removeListener','dashboardItem:','./dashboardItem.events','remove'];(function(_0x2f3d73,_0x2e35ac){var _0x2b5fb7=function(_0x427d46){while(--_0x427d46){_0x2f3d73['push'](_0x2f3d73['shift']());}};_0x2b5fb7(++_0x2e35ac);}(_0xc4aa,0xfa));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var DashboardItemEvents=require(_0xac4a('0x0'));var events=['save',_0xac4a('0x1'),_0xac4a('0x2')];function createListener(_0xc6c925,_0x4f80dc){return function(_0x30ef77){_0x4f80dc[_0xac4a('0x3')](_0xc6c925,_0x30ef77);};}function removeListener(_0x587846,_0x47a0c6){return function(){DashboardItemEvents[_0xac4a('0x4')](_0x587846,_0x47a0c6);};}exports['register']=function(_0x481a66){for(var _0x3dcd73=0x0,_0x2d6f7e=events['length'];_0x3dcd73<_0x2d6f7e;_0x3dcd73++){var _0x12b796=events[_0x3dcd73];var _0x571540=createListener(_0xac4a('0x5')+_0x12b796,_0x481a66);DashboardItemEvents['on'](_0x12b796,_0x571540);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c21fbd8..8076b71 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 _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 +var _0xe750=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe750,0x191));var _0x0e75=function(_0x1c9d86,_0x50342f){_0x1c9d86=_0x1c9d86-0x0;var _0x2892ba=_0xe750[_0x1c9d86];return _0x2892ba;};'use strict';var multer=require(_0x0e75('0x0'));var util=require(_0x0e75('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e75('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0e75('0x3'));var interaction=require(_0x0e75('0x4'));var config=require(_0x0e75('0x5'));var controller=require(_0x0e75('0x6'));router[_0x0e75('0x7')](_0x0e75('0x8'),auth[_0x0e75('0x9')](),controller[_0x0e75('0xa')]);router[_0x0e75('0xb')]('/',auth[_0x0e75('0x9')](),controller[_0x0e75('0xc')]);router['put'](_0x0e75('0x8'),auth['isAuthenticated'](),controller[_0x0e75('0xd')]);router[_0x0e75('0xe')](_0x0e75('0x8'),auth[_0x0e75('0x9')](),controller[_0x0e75('0xf')]);module[_0x0e75('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 1fad6ed..6f54325 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 _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 +var _0x541c=['second','third','sequelize','exports','STRING','ENUM','first'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x541c,0xe2));var _0xc541=function(_0xaec7d,_0x44dce6){_0xaec7d=_0xaec7d-0x0;var _0x54a0ce=_0x541c[_0xaec7d];return _0x54a0ce;};'use strict';var Sequelize=require(_0xc541('0x0'));module[_0xc541('0x1')]={'name':{'type':Sequelize[_0xc541('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xc541('0x3')](_0xc541('0x4'),_0xc541('0x5'),_0xc541('0x6')),'allowNull':![],'defaultValue':_0xc541('0x4')},'description':{'type':Sequelize[_0xc541('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d65bdb0..6ec6f50 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 _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 +var _0xdcf2=['name','send','Disposition','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','Dispositions','UserProfileResource','sendStatus','error','stack'];(function(_0xb1e62b,_0x237410){var _0x45c369=function(_0x57de57){while(--_0x57de57){_0xb1e62b['push'](_0xb1e62b['shift']());}};_0x45c369(++_0x237410);}(_0xdcf2,0x115));var _0x2dcf=function(_0x348a1c,_0x473ff2){_0x348a1c=_0x348a1c-0x0;var _0x16b380=_0xdcf2[_0x348a1c];return _0x16b380;};'use strict';var emlformat=require(_0x2dcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dcf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2dcf('0x2'));var BPromise=require(_0x2dcf('0x3'));var Mustache=require(_0x2dcf('0x4'));var util=require(_0x2dcf('0x5'));var path=require(_0x2dcf('0x6'));var sox=require(_0x2dcf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2dcf('0x8'));var _=require(_0x2dcf('0x9'));var squel=require(_0x2dcf('0xa'));var crypto=require('crypto');var jsforce=require(_0x2dcf('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2dcf('0xc'));var Papa=require(_0x2dcf('0xd'));var Redis=require(_0x2dcf('0xe'));var authService=require(_0x2dcf('0xf'));var qs=require(_0x2dcf('0x10'));var as=require(_0x2dcf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2dcf('0x12'));var licenseUtil=require(_0x2dcf('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35ef07,_0x3f78b4){_0x3f78b4=_0x3f78b4||0xcc;return function(_0x157a7e){if(_0x157a7e){return _0x35ef07['sendStatus'](_0x3f78b4);}return _0x35ef07[_0x2dcf('0x14')](_0x3f78b4)[_0x2dcf('0x15')]();};}function respondWithResult(_0x13f03d,_0x447c01){_0x447c01=_0x447c01||0xc8;return function(_0x53833c){if(_0x53833c){return _0x13f03d['status'](_0x447c01)[_0x2dcf('0x16')](_0x53833c);}};}function respondWithFilteredResult(_0x36835b,_0x33a3c6){return function(_0xa01830){if(_0xa01830){var _0x527e41=typeof _0x33a3c6['offset']==='undefined'&&typeof _0x33a3c6[_0x2dcf('0x17')]===_0x2dcf('0x18');var _0x39d275=_0xa01830[_0x2dcf('0x19')];var _0x32d52d=_0x527e41?0x0:_0x33a3c6[_0x2dcf('0x1a')];var _0x25df51=_0x527e41?_0xa01830[_0x2dcf('0x19')]:_0x33a3c6[_0x2dcf('0x1a')]+_0x33a3c6['limit'];var _0x5c48c0;if(_0x25df51>=_0x39d275){_0x25df51=_0x39d275;_0x5c48c0=0xc8;}else{_0x5c48c0=0xce;}_0x36835b[_0x2dcf('0x14')](_0x5c48c0);return _0x36835b[_0x2dcf('0x1b')](_0x2dcf('0x1c'),_0x32d52d+'-'+_0x25df51+'/'+_0x39d275)[_0x2dcf('0x16')](_0xa01830);}return null;};}function patchUpdates(_0x2e5fa6){return function(_0x266763){try{jsonpatch['apply'](_0x266763,_0x2e5fa6,!![]);}catch(_0x1193b8){return BPromise[_0x2dcf('0x1d')](_0x1193b8);}return _0x266763[_0x2dcf('0x1e')]();};}function saveUpdates(_0x40e1a0,_0x2acaa9){return function(_0x3d52d9){if(_0x3d52d9){return _0x3d52d9[_0x2dcf('0x1f')](_0x40e1a0)[_0x2dcf('0x20')](function(_0x5c333e){return _0x5c333e;});}return null;};}function removeEntity(_0x14511a,_0x1f4ffd){return function(_0x2c71c2){if(_0x2c71c2){return _0x2c71c2[_0x2dcf('0x21')]()[_0x2dcf('0x20')](function(){var _0x5d8024=_0x2c71c2['get']({'plain':!![]});var _0xa259dd=_0x2dcf('0x22');return db[_0x2dcf('0x23')]['destroy']({'where':{'type':_0xa259dd,'resourceId':_0x5d8024['id']}})[_0x2dcf('0x20')](function(){return _0x2c71c2;});})[_0x2dcf('0x20')](function(){_0x14511a[_0x2dcf('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x265178,_0x151daa){return function(_0x3f1f8a){if(!_0x3f1f8a){_0x265178[_0x2dcf('0x24')](0x194);}return _0x3f1f8a;};}function handleError(_0x4153a8,_0x2c29d1){_0x2c29d1=_0x2c29d1||0x1f4;return function(_0xf7e57d){logger[_0x2dcf('0x25')](_0xf7e57d[_0x2dcf('0x26')]);if(_0xf7e57d[_0x2dcf('0x27')]){delete _0xf7e57d[_0x2dcf('0x27')];}_0x4153a8[_0x2dcf('0x14')](_0x2c29d1)[_0x2dcf('0x28')](_0xf7e57d);};}exports['index']=function(_0x75a75d,_0x1f81de){var _0x4fbbd1={},_0x273564={},_0x34a63d={'count':0x0,'rows':[]};var _0x571f1f=_['map'](db[_0x2dcf('0x29')][_0x2dcf('0x2a')],function(_0x5bd8d3){return{'name':_0x5bd8d3[_0x2dcf('0x2b')],'type':_0x5bd8d3[_0x2dcf('0x2c')]['key']};});_0x273564[_0x2dcf('0x2d')]=_[_0x2dcf('0x2e')](_0x571f1f,_0x2dcf('0x27'));_0x273564[_0x2dcf('0x2f')]=_[_0x2dcf('0x30')](_0x75a75d[_0x2dcf('0x2f')]);_0x273564[_0x2dcf('0x31')]=_[_0x2dcf('0x32')](_0x273564[_0x2dcf('0x2d')],_0x273564[_0x2dcf('0x2f')]);_0x4fbbd1[_0x2dcf('0x33')]=_[_0x2dcf('0x32')](_0x273564[_0x2dcf('0x2d')],qs[_0x2dcf('0x34')](_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x34')]));_0x4fbbd1[_0x2dcf('0x33')]=_0x4fbbd1[_0x2dcf('0x33')]['length']?_0x4fbbd1[_0x2dcf('0x33')]:_0x273564[_0x2dcf('0x2d')];if(!_0x75a75d[_0x2dcf('0x2f')]['hasOwnProperty'](_0x2dcf('0x35'))){_0x4fbbd1[_0x2dcf('0x17')]=qs[_0x2dcf('0x17')](_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x17')]);_0x4fbbd1['offset']=qs['offset'](_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x1a')]);}_0x4fbbd1[_0x2dcf('0x36')]=qs['sort'](_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x37')]);_0x4fbbd1['where']=qs['filters'](_[_0x2dcf('0x38')](_0x75a75d[_0x2dcf('0x2f')],_0x273564['filters']),_0x571f1f);if(_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x39')]){_0x4fbbd1['where']=_[_0x2dcf('0x3a')](_0x4fbbd1[_0x2dcf('0x3b')],{'$or':_[_0x2dcf('0x2e')](_0x571f1f,function(_0x11ac5d){if(_0x11ac5d[_0x2dcf('0x2c')]!==_0x2dcf('0x3c')){var _0x317567={};_0x317567[_0x11ac5d[_0x2dcf('0x27')]]={'$like':'%'+_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x39')]+'%'};return _0x317567;}})});}_0x4fbbd1=_[_0x2dcf('0x3a')]({},_0x4fbbd1,_0x75a75d['options']);var _0x2948a4={'where':_0x4fbbd1['where']};return db[_0x2dcf('0x29')]['count'](_0x2948a4)[_0x2dcf('0x20')](function(_0x35e708){_0x34a63d[_0x2dcf('0x19')]=_0x35e708;if(_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x3d')]){_0x4fbbd1[_0x2dcf('0x3e')]=[{'all':!![]}];}return db[_0x2dcf('0x29')][_0x2dcf('0x3f')](_0x4fbbd1);})[_0x2dcf('0x20')](function(_0x259843){_0x34a63d[_0x2dcf('0x40')]=_0x259843;return _0x34a63d;})[_0x2dcf('0x20')](respondWithFilteredResult(_0x1f81de,_0x4fbbd1))[_0x2dcf('0x41')](handleError(_0x1f81de,null));};exports[_0x2dcf('0x42')]=function(_0x40e9d8,_0x6b8840){var _0x3d199b={'raw':!![],'where':{'id':_0x40e9d8['params']['id']}},_0xacc053={};_0xacc053['model']=_[_0x2dcf('0x30')](db[_0x2dcf('0x29')][_0x2dcf('0x2a')]);_0xacc053[_0x2dcf('0x2f')]=_[_0x2dcf('0x30')](_0x40e9d8[_0x2dcf('0x2f')]);_0xacc053['filters']=_['intersection'](_0xacc053['model'],_0xacc053[_0x2dcf('0x2f')]);_0x3d199b['attributes']=_['intersection'](_0xacc053['model'],qs[_0x2dcf('0x34')](_0x40e9d8[_0x2dcf('0x2f')][_0x2dcf('0x34')]));_0x3d199b['attributes']=_0x3d199b[_0x2dcf('0x33')][_0x2dcf('0x43')]?_0x3d199b[_0x2dcf('0x33')]:_0xacc053[_0x2dcf('0x2d')];if(_0x40e9d8[_0x2dcf('0x2f')]['includeAll']){_0x3d199b['include']=[{'all':!![]}];}_0x3d199b=_[_0x2dcf('0x3a')]({},_0x3d199b,_0x40e9d8[_0x2dcf('0x44')]);return db[_0x2dcf('0x29')][_0x2dcf('0x45')](_0x3d199b)[_0x2dcf('0x20')](handleEntityNotFound(_0x6b8840,null))[_0x2dcf('0x20')](respondWithResult(_0x6b8840,null))[_0x2dcf('0x41')](handleError(_0x6b8840,null));};exports['create']=function(_0x2ae991,_0x3945fd){return db[_0x2dcf('0x29')][_0x2dcf('0x46')](_0x2ae991['body'],{})['then'](function(_0x1a63ba){var _0x33951f=_0x2ae991[_0x2dcf('0x47')][_0x2dcf('0x48')]({'plain':!![]});if(!_0x33951f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33951f[_0x2dcf('0x49')]===_0x2dcf('0x47')){var _0x2c1148=_0x1a63ba[_0x2dcf('0x48')]({'plain':!![]});var _0x4c9fff=_0x2dcf('0x22');return db[_0x2dcf('0x4a')]['find']({'where':{'name':_0x4c9fff,'userProfileId':_0x33951f[_0x2dcf('0x4b')]},'raw':!![]})[_0x2dcf('0x20')](function(_0x3ac39f){if(_0x3ac39f&&_0x3ac39f['autoAssociation']===0x0){return db[_0x2dcf('0x23')][_0x2dcf('0x46')]({'name':_0x2c1148[_0x2dcf('0x27')],'resourceId':_0x2c1148['id'],'type':_0x3ac39f[_0x2dcf('0x27')],'sectionId':_0x3ac39f['id']},{})['then'](function(){return _0x1a63ba;});}else{return _0x1a63ba;}})[_0x2dcf('0x41')](function(_0x439f0c){logger['error'](_0x2dcf('0x4c'),_0x439f0c);throw _0x439f0c;});}return _0x1a63ba;})[_0x2dcf('0x20')](respondWithResult(_0x3945fd,0xc9))[_0x2dcf('0x41')](handleError(_0x3945fd,null));};exports[_0x2dcf('0x1f')]=function(_0x3b0c08,_0x4afc1d){if(_0x3b0c08[_0x2dcf('0x4d')]['id']){delete _0x3b0c08[_0x2dcf('0x4d')]['id'];}return db['Disposition']['find']({'where':{'id':_0x3b0c08['params']['id']}})[_0x2dcf('0x20')](handleEntityNotFound(_0x4afc1d,null))['then'](saveUpdates(_0x3b0c08[_0x2dcf('0x4d')],null))[_0x2dcf('0x20')](respondWithResult(_0x4afc1d,null))[_0x2dcf('0x41')](handleError(_0x4afc1d,null));};exports[_0x2dcf('0x21')]=function(_0x10cac3,_0x1bc9f0){return db[_0x2dcf('0x29')][_0x2dcf('0x45')]({'where':{'id':_0x10cac3[_0x2dcf('0x4e')]['id']}})[_0x2dcf('0x20')](handleEntityNotFound(_0x1bc9f0,null))[_0x2dcf('0x20')](removeEntity(_0x1bc9f0,null))[_0x2dcf('0x41')](handleError(_0x1bc9f0,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ed1085c..1e72907 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 _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 +var _0x6476=['FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','name_mail','MailAccountId','name_sms','name_fax'];(function(_0xe26a20,_0x232bb4){var _0x17c8ba=function(_0x43f2cd){while(--_0x43f2cd){_0xe26a20['push'](_0xe26a20['shift']());}};_0x17c8ba(++_0x232bb4);}(_0x6476,0x82));var _0x6647=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x6476[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x6647('0x0'));var util=require(_0x6647('0x1'));var logger=require(_0x6647('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6647('0x3'));var rp=require(_0x6647('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6647('0x5'));var config=require(_0x6647('0x6'));var attributes=require(_0x6647('0x7'));module[_0x6647('0x8')]=function(_0x243259,_0x5332da){return _0x243259[_0x6647('0x9')](_0x6647('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x6647('0xb'),'fields':[_0x6647('0xc'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x6647('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0x6647('0xd'),'fields':[_0x6647('0xc'),_0x6647('0xe')]},{'unique':!![],'name':_0x6647('0xf'),'fields':[_0x6647('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x6647('0x10'),'fields':[_0x6647('0xc'),_0x6647('0x11')]},{'unique':!![],'name':_0x6647('0x12'),'fields':['name',_0x6647('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x6647('0xc'),_0x6647('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 9a8778a..1be3de5 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(_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 +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(_0x476fc2,_0x476521){var _0x8db6f4=function(_0x7156fb){while(--_0x7156fb){_0x476fc2['push'](_0x476fc2['shift']());}};_0x8db6f4(++_0x476521);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index a587b3e..949c8fd 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 _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 +var _0x087b=['isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x4b2e5c,_0x129908){var _0x2f4e84=function(_0x2786ba){while(--_0x2786ba){_0x4b2e5c['push'](_0x4b2e5c['shift']());}};_0x2f4e84(++_0x129908);}(_0x087b,0x1cb));var _0xb087=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x087b[_0x263a74];return _0x2aa86c;};'use strict';var multer=require('multer');var util=require(_0xb087('0x0'));var path=require(_0xb087('0x1'));var timeout=require(_0xb087('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller['show']);router[_0xb087('0xc')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xd')]);router[_0xb087('0xe')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller['update']);router[_0xb087('0xf')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x10')]);module[_0xb087('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 5d6bb05..fcd58d6 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 _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 +var _0x0e4b=['sequelize','exports','STRING','ENUM','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x57d562,_0x379b0b){_0x57d562=_0x57d562-0x0;var _0x17ac79=_0x0e4b[_0x57d562];return _0x17ac79;};'use strict';var Sequelize=require(_0xb0e4('0x0'));module[_0xb0e4('0x1')]={'name':{'type':Sequelize[_0xb0e4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xb0e4('0x3')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xb0e4('0x2')],'unique':_0xb0e4('0x4')},'minrate':{'type':Sequelize['ENUM'](_0xb0e4('0x5'),_0xb0e4('0x6'),_0xb0e4('0x7'),_0xb0e4('0x8'),_0xb0e4('0x9'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xb0e4('0x3')](_0xb0e4('0x5'),_0xb0e4('0x6'),_0xb0e4('0x7'),_0xb0e4('0x8'),_0xb0e4('0x9'),_0xb0e4('0xa')),'defaultValue':_0xb0e4('0xa')},'modem':{'type':Sequelize[_0xb0e4('0x2')],'defaultValue':_0xb0e4('0xb')},'gateway':{'type':Sequelize[_0xb0e4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb0e4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb0e4('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb0e4('0x3')](_0xb0e4('0xd'),'IAX',_0xb0e4('0xe'),_0xb0e4('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xb0e4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb0e4('0x10')],'defaultValue':function(){return _0xb0e4('0x11');}},'notificationSound':{'type':Sequelize[_0xb0e4('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb0e4('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb0e4('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb0e4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb0e4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb0e4('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xb0e4('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xb0e4('0x12')],'defaultValue':![],'comment':_0xb0e4('0x14'),'set':function(_0x3355c6){if(!_0x3355c6)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xb0e4('0x15'),_0x3355c6);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 587781f..58bb138 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 _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 +var _0xeb22=['UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','order','include','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','system','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','updatedAt','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','user','filename','Messages','Contact\x20not\x20found','out','dataValues','SendFax','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','pick','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','get','FaxAccounts'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xeb22,0x158));var _0x2eb2=function(_0x4b33d1,_0x2414e1){_0x4b33d1=_0x4b33d1-0x0;var _0x9e7221=_0xeb22[_0x4b33d1];return _0x9e7221;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2eb2('0x0'));var jsonpatch=require(_0x2eb2('0x1'));var rp=require(_0x2eb2('0x2'));var moment=require(_0x2eb2('0x3'));var BPromise=require(_0x2eb2('0x4'));var Mustache=require(_0x2eb2('0x5'));var util=require(_0x2eb2('0x6'));var path=require(_0x2eb2('0x7'));var sox=require(_0x2eb2('0x8'));var csv=require(_0x2eb2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2eb2('0xa'));var _=require(_0x2eb2('0xb'));var squel=require(_0x2eb2('0xc'));var crypto=require(_0x2eb2('0xd'));var jsforce=require(_0x2eb2('0xe'));var deskjs=require(_0x2eb2('0xf'));var toCsv=require(_0x2eb2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2eb2('0x10'));var authService=require(_0x2eb2('0x11'));var qs=require(_0x2eb2('0x12'));var as=require(_0x2eb2('0x13'));var hardwareService=require(_0x2eb2('0x14'));var logger=require(_0x2eb2('0x15'))('api');var utils=require(_0x2eb2('0x16'));var config=require(_0x2eb2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2eb2('0x18'))['db'];config[_0x2eb2('0x19')]=_[_0x2eb2('0x1a')](config[_0x2eb2('0x19')],{'host':_0x2eb2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2eb2('0x19')]));require(_0x2eb2('0x1c'))[_0x2eb2('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2eb2('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x2eb2('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x57c79f,_0x694ffc,_0x334e22,_0x5487ea){return new BPromise(function(_0x3dd97f,_0x51016d){var _0xdc8c12=_0x5487ea||client;return _0xdc8c12[_0x2eb2('0x1f')](_0x57c79f,_0x334e22)[_0x2eb2('0x20')](function(_0x5d157e){logger[_0x2eb2('0x21')]('FaxAccount,\x20%s,\x20%s',_0x694ffc,_0x2eb2('0x22'));logger[_0x2eb2('0x23')](_0x2eb2('0x24'),_0x694ffc,_0x2eb2('0x22'),JSON[_0x2eb2('0x25')](_0x5d157e));if(_0x5d157e[_0x2eb2('0x26')]){if(_0x5d157e[_0x2eb2('0x26')][_0x2eb2('0x27')]===0x1f4){logger[_0x2eb2('0x26')](_0x2eb2('0x28'),_0x694ffc,_0x5d157e[_0x2eb2('0x26')]['message']);return _0x51016d(_0x5d157e[_0x2eb2('0x26')][_0x2eb2('0x29')]);}logger[_0x2eb2('0x26')]('FaxAccount,\x20%s,\x20%s',_0x694ffc,_0x5d157e[_0x2eb2('0x26')]['message']);return _0x3dd97f(_0x5d157e[_0x2eb2('0x26')][_0x2eb2('0x29')]);}else{logger['info'](_0x2eb2('0x28'),_0x694ffc,_0x2eb2('0x22'));_0x3dd97f(_0x5d157e[_0x2eb2('0x2a')]['message']);}})[_0x2eb2('0x2b')](function(_0x1b761e){logger[_0x2eb2('0x26')](_0x2eb2('0x28'),_0x694ffc,_0x1b761e);_0x51016d(_0x1b761e);});});}function respondWithStatusCode(_0x39f808,_0x43d162){_0x43d162=_0x43d162||0xcc;return function(_0x4e3bd4){if(_0x4e3bd4){return _0x39f808[_0x2eb2('0x2c')](_0x43d162);}return _0x39f808[_0x2eb2('0x2d')](_0x43d162)[_0x2eb2('0x2e')]();};}function respondWithResult(_0xfaf315,_0x2eb088){_0x2eb088=_0x2eb088||0xc8;return function(_0x277416){if(_0x277416){return _0xfaf315[_0x2eb2('0x2d')](_0x2eb088)[_0x2eb2('0x2f')](_0x277416);}};}function respondWithFilteredResult(_0x558278,_0x36c9f1){return function(_0x12de7b){if(_0x12de7b){var _0x265bcf=typeof _0x36c9f1[_0x2eb2('0x30')]===_0x2eb2('0x31')&&typeof _0x36c9f1[_0x2eb2('0x32')]===_0x2eb2('0x31');var _0x352c17=_0x12de7b['count'];var _0x1f2ddd=_0x265bcf?0x0:_0x36c9f1[_0x2eb2('0x30')];var _0x37d626=_0x265bcf?_0x12de7b['count']:_0x36c9f1[_0x2eb2('0x30')]+_0x36c9f1[_0x2eb2('0x32')];var _0x19381d;if(_0x37d626>=_0x352c17){_0x37d626=_0x352c17;_0x19381d=0xc8;}else{_0x19381d=0xce;}_0x558278[_0x2eb2('0x2d')](_0x19381d);return _0x558278[_0x2eb2('0x33')](_0x2eb2('0x34'),_0x1f2ddd+'-'+_0x37d626+'/'+_0x352c17)[_0x2eb2('0x2f')](_0x12de7b);}return null;};}function patchUpdates(_0xc8c163){return function(_0x578a08){try{jsonpatch['apply'](_0x578a08,_0xc8c163,!![]);}catch(_0x174764){return BPromise[_0x2eb2('0x35')](_0x174764);}return _0x578a08[_0x2eb2('0x36')]();};}function saveUpdates(_0x33dc59,_0x15f538){return function(_0x520fdb){if(_0x520fdb){return _0x520fdb[_0x2eb2('0x37')](_0x33dc59)['then'](function(_0x32510d){return _0x32510d;});}return null;};}function removeEntity(_0x13bf32,_0x381a5d){return function(_0x351289){if(_0x351289){return _0x351289['destroy']()['then'](function(){var _0x1276b2=_0x351289[_0x2eb2('0x38')]({'plain':!![]});var _0x171491=_0x2eb2('0x39');return db[_0x2eb2('0x3a')][_0x2eb2('0x3b')]({'where':{'type':_0x171491,'resourceId':_0x1276b2['id']}})['then'](function(){return _0x351289;});})[_0x2eb2('0x20')](function(){_0x13bf32[_0x2eb2('0x2d')](0xcc)[_0x2eb2('0x2e')]();});}};}function handleEntityNotFound(_0x4978d2,_0x379db0){return function(_0x3d1f19){if(!_0x3d1f19){_0x4978d2[_0x2eb2('0x2c')](0x194);}return _0x3d1f19;};}function handleError(_0x593a6a,_0x3c163e){_0x3c163e=_0x3c163e||0x1f4;return function(_0x159a7a){logger['error'](_0x159a7a[_0x2eb2('0x3c')]);if(_0x159a7a[_0x2eb2('0x3d')]){delete _0x159a7a['name'];}_0x593a6a[_0x2eb2('0x2d')](_0x3c163e)[_0x2eb2('0x3e')](_0x159a7a);};}exports[_0x2eb2('0x3f')]=function(_0x156aab,_0x280ee9){var _0xbd0730={'include':[{'model':db[_0x2eb2('0x40')],'as':_0x2eb2('0x41')}]},_0x2f4db7={},_0x296e47={'count':0x0,'rows':[]};var _0x369c07=_[_0x2eb2('0x42')](db[_0x2eb2('0x43')][_0x2eb2('0x44')],function(_0x1e027e){return{'name':_0x1e027e[_0x2eb2('0x45')],'type':_0x1e027e[_0x2eb2('0x46')][_0x2eb2('0x47')]};});_0x2f4db7[_0x2eb2('0x48')]=_[_0x2eb2('0x42')](_0x369c07,_0x2eb2('0x3d'));_0x2f4db7[_0x2eb2('0x49')]=_[_0x2eb2('0x4a')](_0x156aab[_0x2eb2('0x49')]);_0x2f4db7[_0x2eb2('0x4b')]=_[_0x2eb2('0x4c')](_0x2f4db7[_0x2eb2('0x48')],_0x2f4db7[_0x2eb2('0x49')]);_0xbd0730['attributes']=_['intersection'](_0x2f4db7['model'],qs[_0x2eb2('0x4d')](_0x156aab[_0x2eb2('0x49')]['fields']));_0xbd0730[_0x2eb2('0x4e')]=_0xbd0730[_0x2eb2('0x4e')]['length']?_0xbd0730[_0x2eb2('0x4e')]:_0x2f4db7['model'];if(!_0x156aab[_0x2eb2('0x49')][_0x2eb2('0x4f')]('nolimit')){_0xbd0730['limit']=qs[_0x2eb2('0x32')](_0x156aab['query']['limit']);_0xbd0730[_0x2eb2('0x30')]=qs['offset'](_0x156aab['query'][_0x2eb2('0x30')]);}_0xbd0730['order']=qs[_0x2eb2('0x50')](_0x156aab[_0x2eb2('0x49')][_0x2eb2('0x50')]);_0xbd0730['where']=qs[_0x2eb2('0x4b')](_['pick'](_0x156aab[_0x2eb2('0x49')],_0x2f4db7[_0x2eb2('0x4b')]),_0x369c07);if(_0x156aab[_0x2eb2('0x49')]['filter']){_0xbd0730[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0xbd0730[_0x2eb2('0x51')],{'$or':_[_0x2eb2('0x42')](_0x369c07,function(_0x1ad56f){if(_0x1ad56f[_0x2eb2('0x46')]!==_0x2eb2('0x53')){var _0xbb4ed5={};_0xbb4ed5[_0x1ad56f[_0x2eb2('0x3d')]]={'$like':'%'+_0x156aab['query'][_0x2eb2('0x54')]+'%'};return _0xbb4ed5;}})});}_0xbd0730=_[_0x2eb2('0x52')]({},_0xbd0730,_0x156aab[_0x2eb2('0x55')]);var _0x34f565={'where':_0xbd0730[_0x2eb2('0x51')]};return db['FaxAccount'][_0x2eb2('0x56')](_0x34f565)[_0x2eb2('0x20')](function(_0x3e1e25){_0x296e47[_0x2eb2('0x56')]=_0x3e1e25;if(_0x156aab[_0x2eb2('0x49')][_0x2eb2('0x57')]){_0xbd0730['include']=[{'all':!![]}];}return db[_0x2eb2('0x43')][_0x2eb2('0x58')](_0xbd0730);})[_0x2eb2('0x20')](function(_0x5c93dc){_0x296e47['rows']=_0x5c93dc;return _0x296e47;})['then'](respondWithFilteredResult(_0x280ee9,_0xbd0730))['catch'](handleError(_0x280ee9,null));};exports['show']=function(_0x55b0c7,_0x5926e1){var _0x5aba32={'raw':![],'where':{'id':_0x55b0c7['params']['id']},'include':[{'model':db[_0x2eb2('0x40')],'as':_0x2eb2('0x41')}]},_0x1eeae4={};_0x1eeae4[_0x2eb2('0x48')]=_[_0x2eb2('0x4a')](db[_0x2eb2('0x43')][_0x2eb2('0x44')]);_0x1eeae4[_0x2eb2('0x49')]=_[_0x2eb2('0x4a')](_0x55b0c7[_0x2eb2('0x49')]);_0x1eeae4[_0x2eb2('0x4b')]=_['intersection'](_0x1eeae4['model'],_0x1eeae4[_0x2eb2('0x49')]);_0x5aba32[_0x2eb2('0x4e')]=_[_0x2eb2('0x4c')](_0x1eeae4['model'],qs[_0x2eb2('0x4d')](_0x55b0c7['query'][_0x2eb2('0x4d')]));_0x5aba32[_0x2eb2('0x4e')]=_0x5aba32[_0x2eb2('0x4e')][_0x2eb2('0x59')]?_0x5aba32[_0x2eb2('0x4e')]:_0x1eeae4['model'];if(_0x55b0c7[_0x2eb2('0x49')][_0x2eb2('0x57')]){_0x5aba32['include']=[{'all':!![]}];}_0x5aba32=_[_0x2eb2('0x52')]({},_0x5aba32,_0x55b0c7[_0x2eb2('0x55')]);return db['FaxAccount'][_0x2eb2('0x5a')](_0x5aba32)[_0x2eb2('0x20')](handleEntityNotFound(_0x5926e1,null))[_0x2eb2('0x20')](respondWithResult(_0x5926e1,null))[_0x2eb2('0x2b')](handleError(_0x5926e1,null));};exports['create']=function(_0x536e31,_0x404adc){return db['FaxAccount'][_0x2eb2('0x5b')](_0x536e31[_0x2eb2('0x5c')],{})['then'](function(_0x2ba1c5){var _0x764c4e=_0x536e31['user'][_0x2eb2('0x38')]({'plain':!![]});if(!_0x764c4e)throw new Error(_0x2eb2('0x5d'));if(_0x764c4e[_0x2eb2('0x5e')]==='user'){var _0x2efe0d=_0x2ba1c5['get']({'plain':!![]});var _0x4877ac=_0x2eb2('0x39');return db[_0x2eb2('0x5f')][_0x2eb2('0x5a')]({'where':{'name':_0x4877ac,'userProfileId':_0x764c4e[_0x2eb2('0x60')]},'raw':!![]})[_0x2eb2('0x20')](function(_0x5186f1){if(_0x5186f1&&_0x5186f1[_0x2eb2('0x61')]===0x0){return db[_0x2eb2('0x3a')]['create']({'name':_0x2efe0d[_0x2eb2('0x3d')],'resourceId':_0x2efe0d['id'],'type':_0x5186f1['name'],'sectionId':_0x5186f1['id']},{})['then'](function(){return _0x2ba1c5;});}else{return _0x2ba1c5;}})['catch'](function(_0x4fe09a){logger[_0x2eb2('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fe09a);throw _0x4fe09a;});}return _0x2ba1c5;})[_0x2eb2('0x20')](respondWithResult(_0x404adc,0xc9))['catch'](handleError(_0x404adc,null));};exports[_0x2eb2('0x37')]=function(_0x127cb5,_0x302042){if(_0x127cb5[_0x2eb2('0x5c')]['id']){delete _0x127cb5[_0x2eb2('0x5c')]['id'];}return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x127cb5[_0x2eb2('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0x2eb2('0x41')}]})['then'](handleEntityNotFound(_0x302042,null))[_0x2eb2('0x20')](saveUpdates(_0x127cb5[_0x2eb2('0x5c')],null))[_0x2eb2('0x20')](respondWithResult(_0x302042,null))['catch'](handleError(_0x302042,null));};exports[_0x2eb2('0x3b')]=function(_0x16c5d3,_0x25a103){return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x16c5d3[_0x2eb2('0x62')]['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x25a103,null))[_0x2eb2('0x20')](removeEntity(_0x25a103,null))[_0x2eb2('0x2b')](handleError(_0x25a103,null));};exports[_0x2eb2('0x63')]=function(_0x1a76c9,_0x10fe3f){return db[_0x2eb2('0x43')][_0x2eb2('0x63')]()[_0x2eb2('0x20')](respondWithResult(_0x10fe3f,null))['catch'](handleError(_0x10fe3f,null));};exports[_0x2eb2('0x64')]=function(_0x46f82e,_0x331d6e,_0x5a2c0f){if(_0x46f82e['body']['id']){delete _0x46f82e[_0x2eb2('0x5c')]['id'];}return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x46f82e['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x331d6e,null))['then'](function(_0x8fbfc9){if(_0x8fbfc9){_0x46f82e[_0x2eb2('0x5c')][_0x2eb2('0x65')]=_0x8fbfc9['id'];return db[_0x2eb2('0x66')]['create'](_0x46f82e[_0x2eb2('0x5c')]);}})[_0x2eb2('0x20')](respondWithResult(_0x331d6e,null))[_0x2eb2('0x2b')](handleError(_0x331d6e,null));};exports[_0x2eb2('0x67')]=function(_0x2018bc,_0x183735,_0x324e81){var _0x129597={'raw':![],'where':{}};var _0x9515db={};var _0x3f256b={'count':0x0,'rows':[]};return db[_0x2eb2('0x43')][_0x2eb2('0x68')]({'where':{'id':_0x2018bc[_0x2eb2('0x62')]['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x183735,null))[_0x2eb2('0x20')](function(_0x359918){if(_0x359918){_0x9515db[_0x2eb2('0x48')]=_[_0x2eb2('0x4a')](db['Disposition']['rawAttributes']);_0x9515db[_0x2eb2('0x49')]=_['keys'](_0x2018bc[_0x2eb2('0x49')]);_0x9515db['filters']=_[_0x2eb2('0x4c')](_0x9515db[_0x2eb2('0x48')],_0x9515db[_0x2eb2('0x49')]);_0x129597[_0x2eb2('0x4e')]=_[_0x2eb2('0x4c')](_0x9515db[_0x2eb2('0x48')],qs[_0x2eb2('0x4d')](_0x2018bc['query']['fields']));_0x129597[_0x2eb2('0x4e')]=_0x129597['attributes'][_0x2eb2('0x59')]?_0x129597[_0x2eb2('0x4e')]:_0x9515db[_0x2eb2('0x48')];if(!_0x2018bc[_0x2eb2('0x49')][_0x2eb2('0x4f')](_0x2eb2('0x69'))){_0x129597[_0x2eb2('0x32')]=qs[_0x2eb2('0x32')](_0x2018bc['query'][_0x2eb2('0x32')]);_0x129597['offset']=qs['offset'](_0x2018bc[_0x2eb2('0x49')][_0x2eb2('0x30')]);}_0x129597[_0x2eb2('0x6a')]=qs[_0x2eb2('0x50')](_0x2018bc[_0x2eb2('0x49')]['sort']);_0x129597[_0x2eb2('0x51')]=qs[_0x2eb2('0x4b')](_['pick'](_0x2018bc[_0x2eb2('0x49')],_0x9515db[_0x2eb2('0x4b')]));_0x129597[_0x2eb2('0x51')][_0x2eb2('0x65')]=_0x359918['id'];if(_0x2018bc[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0x129597['where']=_[_0x2eb2('0x52')](_0x129597[_0x2eb2('0x51')],{'$or':_['map'](_0x129597[_0x2eb2('0x4e')],function(_0x393e5b){var _0x3436f7={};_0x3436f7[_0x393e5b]={'$like':'%'+_0x2018bc[_0x2eb2('0x49')][_0x2eb2('0x54')]+'%'};return _0x3436f7;})});}_0x129597=_[_0x2eb2('0x52')]({},_0x129597,_0x2018bc[_0x2eb2('0x55')]);return db[_0x2eb2('0x66')][_0x2eb2('0x56')]({'where':_0x129597[_0x2eb2('0x51')]})[_0x2eb2('0x20')](function(_0x1bac62){_0x3f256b[_0x2eb2('0x56')]=_0x1bac62;if(_0x2018bc[_0x2eb2('0x49')][_0x2eb2('0x57')]){_0x129597[_0x2eb2('0x6b')]=[{'all':!![]}];}return db[_0x2eb2('0x66')]['findAll'](_0x129597);})[_0x2eb2('0x20')](function(_0x378c2c){_0x3f256b[_0x2eb2('0x6c')]=_0x378c2c;return _0x3f256b;});}})['then'](respondWithFilteredResult(_0x183735,_0x129597))[_0x2eb2('0x2b')](handleError(_0x183735,null));};exports[_0x2eb2('0x6d')]=function(_0x42adfb,_0x4b0fc0,_0x41deb2){return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x42adfb['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x4b0fc0,null))[_0x2eb2('0x20')](function(_0x4fd999){if(_0x4fd999){return _0x4fd999[_0x2eb2('0x6d')](_0x42adfb[_0x2eb2('0x49')][_0x2eb2('0x6e')]);}})[_0x2eb2('0x20')](respondWithStatusCode(_0x4b0fc0,null))[_0x2eb2('0x2b')](handleError(_0x4b0fc0,null));};exports['addAnswer']=function(_0x556335,_0x5b01e4,_0x154b55){if(_0x556335[_0x2eb2('0x5c')]['id']){delete _0x556335[_0x2eb2('0x5c')]['id'];}return db['FaxAccount'][_0x2eb2('0x5a')]({'where':{'id':_0x556335[_0x2eb2('0x62')]['id']}})['then'](handleEntityNotFound(_0x5b01e4,null))['then'](function(_0x1dc58e){if(_0x1dc58e){_0x556335['body'][_0x2eb2('0x65')]=_0x1dc58e['id'];return db[_0x2eb2('0x6f')][_0x2eb2('0x5b')](_0x556335[_0x2eb2('0x5c')]);}})[_0x2eb2('0x20')](respondWithResult(_0x5b01e4,null))[_0x2eb2('0x2b')](handleError(_0x5b01e4,null));};exports[_0x2eb2('0x70')]=function(_0x3d6985,_0x30d5b1,_0x2eed29){var _0x8904d9={'raw':![],'where':{}};var _0x30177d={};var _0x21c86f={'count':0x0,'rows':[]};return db[_0x2eb2('0x43')][_0x2eb2('0x68')]({'where':{'id':_0x3d6985[_0x2eb2('0x62')]['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x30d5b1,null))[_0x2eb2('0x20')](function(_0x4074ea){if(_0x4074ea){_0x30177d[_0x2eb2('0x48')]=_['keys'](db['CannedAnswer'][_0x2eb2('0x44')]);_0x30177d[_0x2eb2('0x49')]=_[_0x2eb2('0x4a')](_0x3d6985['query']);_0x30177d[_0x2eb2('0x4b')]=_[_0x2eb2('0x4c')](_0x30177d[_0x2eb2('0x48')],_0x30177d[_0x2eb2('0x49')]);_0x8904d9[_0x2eb2('0x4e')]=_[_0x2eb2('0x4c')](_0x30177d['model'],qs['fields'](_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x4d')]));_0x8904d9['attributes']=_0x8904d9[_0x2eb2('0x4e')][_0x2eb2('0x59')]?_0x8904d9[_0x2eb2('0x4e')]:_0x30177d['model'];if(!_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x4f')](_0x2eb2('0x69'))){_0x8904d9[_0x2eb2('0x32')]=qs[_0x2eb2('0x32')](_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x32')]);_0x8904d9['offset']=qs[_0x2eb2('0x30')](_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x30')]);}_0x8904d9[_0x2eb2('0x6a')]=qs['sort'](_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x50')]);_0x8904d9[_0x2eb2('0x51')]=qs[_0x2eb2('0x4b')](_['pick'](_0x3d6985['query'],_0x30177d[_0x2eb2('0x4b')]));_0x8904d9[_0x2eb2('0x51')][_0x2eb2('0x65')]=_0x4074ea['id'];if(_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0x8904d9[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0x8904d9[_0x2eb2('0x51')],{'$or':_[_0x2eb2('0x42')](_0x8904d9[_0x2eb2('0x4e')],function(_0x2e2766){var _0x5a370e={};_0x5a370e[_0x2e2766]={'$like':'%'+_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x54')]+'%'};return _0x5a370e;})});}_0x8904d9=_[_0x2eb2('0x52')]({},_0x8904d9,_0x3d6985[_0x2eb2('0x55')]);return db[_0x2eb2('0x6f')][_0x2eb2('0x56')]({'where':_0x8904d9[_0x2eb2('0x51')]})['then'](function(_0x550c02){_0x21c86f[_0x2eb2('0x56')]=_0x550c02;if(_0x3d6985['query']['includeAll']){_0x8904d9['include']=[{'all':!![]}];}return db[_0x2eb2('0x6f')][_0x2eb2('0x58')](_0x8904d9);})['then'](function(_0x1a3c33){_0x21c86f[_0x2eb2('0x6c')]=_0x1a3c33;return _0x21c86f;});}})[_0x2eb2('0x20')](respondWithFilteredResult(_0x30d5b1,_0x8904d9))[_0x2eb2('0x2b')](handleError(_0x30d5b1,null));};exports['removeAnswers']=function(_0xbf208d,_0x59a995,_0x4e01f4){return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0xbf208d[_0x2eb2('0x62')]['id']}})['then'](handleEntityNotFound(_0x59a995,null))[_0x2eb2('0x20')](function(_0x33d450){if(_0x33d450){return _0x33d450[_0x2eb2('0x71')](_0xbf208d[_0x2eb2('0x49')][_0x2eb2('0x6e')]);}})[_0x2eb2('0x20')](respondWithStatusCode(_0x59a995,null))[_0x2eb2('0x2b')](handleError(_0x59a995,null));};exports['addInteraction']=function(_0x1fdb8b,_0x21f736,_0xded9a1){return db[_0x2eb2('0x72')][_0x2eb2('0x5a')]({'where':{'id':_0x1fdb8b['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x21f736,null))[_0x2eb2('0x20')](function(_0x29124d){if(_0x29124d){return _0x29124d[_0x2eb2('0x73')](_0x1fdb8b[_0x2eb2('0x5c')][_0x2eb2('0x6e')],_[_0x2eb2('0x74')](_0x1fdb8b[_0x2eb2('0x5c')],[_0x2eb2('0x6e'),'id'])||{});}})[_0x2eb2('0x20')](respondWithResult(_0x21f736,null))[_0x2eb2('0x2b')](handleError(_0x21f736,null));};exports[_0x2eb2('0x75')]=function(_0x1ffff7,_0x21373b,_0x686905){var _0x5e47a6={'raw':![],'where':{}};var _0x583bf9={};var _0x14e3e8={'count':0x0,'rows':[]};return db[_0x2eb2('0x43')][_0x2eb2('0x68')]({'where':{'id':_0x1ffff7[_0x2eb2('0x62')]['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x21373b,null))[_0x2eb2('0x20')](function(_0x329c8c){if(_0x329c8c){_0x583bf9[_0x2eb2('0x48')]=_[_0x2eb2('0x4a')](db[_0x2eb2('0x72')][_0x2eb2('0x44')]);_0x583bf9[_0x2eb2('0x49')]=_[_0x2eb2('0x4a')](_0x1ffff7[_0x2eb2('0x49')]);_0x583bf9[_0x2eb2('0x4b')]=_[_0x2eb2('0x4c')](_0x583bf9[_0x2eb2('0x48')],_0x583bf9[_0x2eb2('0x49')]);_0x5e47a6['attributes']=_['intersection'](_0x583bf9[_0x2eb2('0x48')],qs[_0x2eb2('0x4d')](_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x4d')]));_0x5e47a6[_0x2eb2('0x4e')]=_0x5e47a6['attributes'][_0x2eb2('0x59')]?_0x5e47a6[_0x2eb2('0x4e')]:_0x583bf9['model'];if(!_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x4f')](_0x2eb2('0x69'))){_0x5e47a6[_0x2eb2('0x32')]=qs[_0x2eb2('0x32')](_0x1ffff7[_0x2eb2('0x49')]['limit']);_0x5e47a6[_0x2eb2('0x30')]=qs[_0x2eb2('0x30')](_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x30')]);}_0x5e47a6['order']=qs[_0x2eb2('0x50')](_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x50')]);_0x5e47a6['where']=qs[_0x2eb2('0x4b')](_['pick'](_0x1ffff7[_0x2eb2('0x49')],_0x583bf9[_0x2eb2('0x4b')]));_0x5e47a6['where'][_0x2eb2('0x65')]=_0x329c8c['id'];if(_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0x5e47a6[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0x5e47a6[_0x2eb2('0x51')],{'$or':_[_0x2eb2('0x42')](_0x5e47a6['attributes'],function(_0x439072){var _0x5e12ab={};_0x5e12ab[_0x439072]={'$like':'%'+_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x54')]+'%'};return _0x5e12ab;})});}_0x5e47a6=_[_0x2eb2('0x52')]({},_0x5e47a6,_0x1ffff7['options']);return db[_0x2eb2('0x72')][_0x2eb2('0x56')]({'where':_0x5e47a6[_0x2eb2('0x51')]})[_0x2eb2('0x20')](function(_0x2bdbc7){_0x14e3e8[_0x2eb2('0x56')]=_0x2bdbc7;if(_0x1ffff7[_0x2eb2('0x49')]['includeAll']){_0x5e47a6[_0x2eb2('0x6b')]=[{'model':db[_0x2eb2('0x76')],'as':_0x2eb2('0x77'),'required':![]},{'model':db['User'],'as':_0x2eb2('0x78'),'attributes':[_0x2eb2('0x3d'),_0x2eb2('0x79'),_0x2eb2('0x7a')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x2eb2('0x3d'),_0x2eb2('0x7b')],'where':_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x7c')]?{'id':_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x7c')]}:undefined,'required':_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x7c')]?!![]:![]}];}return db[_0x2eb2('0x72')]['findAll'](_0x5e47a6);})[_0x2eb2('0x20')](function(_0x11c9fb){_0x14e3e8[_0x2eb2('0x6c')]=_0x11c9fb;return _0x14e3e8;});}})[_0x2eb2('0x20')](respondWithFilteredResult(_0x21373b,_0x5e47a6))[_0x2eb2('0x2b')](handleError(_0x21373b,null));};exports[_0x2eb2('0x7d')]=function(_0x1f5183,_0x5f2d6b){var _0x8aa068=_0x1f5183['params']['id'];var _0x29320e=_0x1f5183[_0x2eb2('0x5c')];var _0x58fe7e=0xc8;var _0x35814c=null;return db[_0x2eb2('0x7e')][_0x2eb2('0x7f')]({'isolationLevel':db[_0x2eb2('0x7e')][_0x2eb2('0x80')][_0x2eb2('0x81')][_0x2eb2('0x82')]},function(_0x18ea2a){return db[_0x2eb2('0x43')][_0x2eb2('0x68')]({'where':{'id':_0x8aa068},'transaction':_0x18ea2a})[_0x2eb2('0x20')](function(_0xb0c40c){if(_0xb0c40c){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x8aa068},'transaction':_0x18ea2a})['then'](function(){var _0x28d0e6=_[_0x2eb2('0x42')](_0x29320e,function(_0x660cb2){_0x660cb2[_0x2eb2('0x65')]=_0x8aa068;return _0x660cb2;});return db[_0x2eb2('0x83')][_0x2eb2('0x84')](_0x28d0e6,{'transaction':_0x18ea2a});});}else{_0x58fe7e=0x194;_0x35814c=[];}});})['then'](function(){if(_0x58fe7e!==0x194){return db[_0x2eb2('0x83')][_0x2eb2('0x85')]({'where':{'FaxAccountId':_0x8aa068},'order':_0x2eb2('0x86')})[_0x2eb2('0x20')](function(_0x33ed07){_0x35814c=_0x33ed07;});}})['catch'](function(_0x3f4e49){_0x58fe7e=0x1f4;logger[_0x2eb2('0x26')](_0x3f4e49[_0x2eb2('0x3c')]);if(_0x3f4e49['name']){delete _0x3f4e49[_0x2eb2('0x3d')];}_0x35814c=_0x3f4e49;})[_0x2eb2('0x87')](function(){if(_0x35814c===null){_0x5f2d6b['sendStatus'](_0x58fe7e);}else{if(_0x58fe7e===0x1f4){_0x5f2d6b['status'](_0x58fe7e)[_0x2eb2('0x3e')](_0x35814c);}else{_0x5f2d6b[_0x2eb2('0x2d')](_0x58fe7e)['json'](_0x35814c);}}});};exports[_0x2eb2('0x88')]=function(_0x10e26d,_0x936cb4,_0x14cf85){var _0xd716bb={};var _0xa31204={};var _0x52ca3b;var _0x3a2aa2;return db['FaxAccount'][_0x2eb2('0x68')]({'where':{'id':_0x10e26d['params']['id']}})['then'](handleEntityNotFound(_0x936cb4,null))[_0x2eb2('0x20')](function(_0x3ad9de){if(_0x3ad9de){_0x52ca3b=_0x3ad9de;_0xa31204['model']=_[_0x2eb2('0x4a')](db[_0x2eb2('0x83')][_0x2eb2('0x44')]);_0xa31204['query']=_[_0x2eb2('0x4a')](_0x10e26d[_0x2eb2('0x49')]);_0xa31204[_0x2eb2('0x4b')]=_[_0x2eb2('0x4c')](_0xa31204[_0x2eb2('0x48')],_0xa31204[_0x2eb2('0x49')]);_0xd716bb['attributes']=_['intersection'](_0xa31204[_0x2eb2('0x48')],qs[_0x2eb2('0x4d')](_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x4d')]));_0xd716bb['attributes']=_0xd716bb[_0x2eb2('0x4e')][_0x2eb2('0x59')]?_0xd716bb[_0x2eb2('0x4e')]:_0xa31204[_0x2eb2('0x48')];_0xd716bb[_0x2eb2('0x6a')]=qs[_0x2eb2('0x50')](_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x50')]);_0xd716bb[_0x2eb2('0x51')]=qs[_0x2eb2('0x4b')](_['pick'](_0x10e26d[_0x2eb2('0x49')],_0xa31204[_0x2eb2('0x4b')]));if(_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0xd716bb[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0xd716bb[_0x2eb2('0x51')],{'$or':_[_0x2eb2('0x42')](_0xd716bb[_0x2eb2('0x4e')],function(_0x3cb18e){var _0x4b8dc4={};_0x4b8dc4[_0x3cb18e]={'$like':'%'+_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x54')]+'%'};return _0x4b8dc4;})});}_0xd716bb=_[_0x2eb2('0x52')]({},_0xd716bb,_0x10e26d['options']);return _0x52ca3b[_0x2eb2('0x88')](_0xd716bb);}})[_0x2eb2('0x20')](function(_0x5c550a){if(_0x5c550a){_0x3a2aa2=_0x5c550a['length'];if(!_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x4f')](_0x2eb2('0x69'))){_0xd716bb[_0x2eb2('0x32')]=qs[_0x2eb2('0x32')](_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x32')]);_0xd716bb['offset']=qs[_0x2eb2('0x30')](_0x10e26d['query']['offset']);}return _0x52ca3b[_0x2eb2('0x88')](_0xd716bb);}})[_0x2eb2('0x20')](function(_0x4cbbd1){if(_0x4cbbd1){return _0x4cbbd1?{'count':_0x3a2aa2,'rows':_0x4cbbd1}:null;}})[_0x2eb2('0x20')](respondWithResult(_0x936cb4,null))[_0x2eb2('0x2b')](handleError(_0x936cb4,null));};function Extension(_0x538073,_0x5a7afa,_0x459e28,_0x95ff8d){this[_0x2eb2('0x89')]=_0x2eb2('0x8a');this[_0x2eb2('0x8b')]=_0x538073[_0x2eb2('0x8c')];this['app']=_0x95ff8d;this[_0x2eb2('0x46')]=_0x2eb2('0x8d');this['description']=_0x2eb2('0x8e');this[_0x2eb2('0x65')]=_0x538073['id'];this[_0x2eb2('0x86')]=_0x5a7afa;this[_0x2eb2('0x8f')]=_0x459e28;}function createExtensionsReciveFax(_0x2df15d){var _0xc48b6=0x1;var _0x3f1cbb=[];_0x3f1cbb['push'](new Extension(_0x2df15d,_0xc48b6,'',_0x2eb2('0x90')));_0xc48b6+=0x1;_0x3f1cbb[_0x2eb2('0x91')](new Extension(_0x2df15d,_0xc48b6,_0x2eb2('0x92'),_0x2eb2('0x93')));_0xc48b6+=0x1;for(var _0x2ad26e in _0x2df15d){if(_0x2df15d[_0x2eb2('0x4f')](_0x2ad26e)&&(_0x2ad26e===_0x2eb2('0x94')||_0x2ad26e===_0x2eb2('0x8c')||_0x2ad26e===_0x2eb2('0x95')||_0x2ad26e==='faxdetect'||_0x2ad26e===_0x2eb2('0x96')||_0x2ad26e===_0x2eb2('0x97')||_0x2ad26e===_0x2eb2('0x98')||_0x2ad26e===_0x2eb2('0x99')||_0x2ad26e===_0x2eb2('0x9a'))){_0x3f1cbb[_0x2eb2('0x91')](new Extension(_0x2df15d,_0xc48b6,_0x2eb2('0x9b')+_0x2ad26e+')='+_0x2df15d[_0x2ad26e],_0x2eb2('0x93')));_0xc48b6+=0x1;}}_0x3f1cbb[_0x2eb2('0x91')](new Extension(_0x2df15d,_0xc48b6,'6',_0x2eb2('0x9c')));_0xc48b6+=0x1;_0x3f1cbb[_0x2eb2('0x91')](new Extension(_0x2df15d,_0xc48b6,_0x2eb2('0x9d'),_0x2eb2('0x9e')));_0xc48b6=0x0;return _0x3f1cbb;}exports[_0x2eb2('0x9f')]=function(_0x259e11,_0x8affd9,_0x278cb2){var _0x4e1ca3;return db['sequelize'][_0x2eb2('0x7f')](function(_0x13239e){return db['FaxAccount']['create'](_0x259e11[_0x2eb2('0x5c')],{'transaction':_0x13239e})[_0x2eb2('0x20')](function(_0x597ddc){_0x4e1ca3=_0x597ddc[_0x2eb2('0x38')]({'plain':!![]});return db['VoiceExtension'][_0x2eb2('0x84')](createExtensionsReciveFax(_0x4e1ca3),{'transaction':_0x13239e});});})[_0x2eb2('0x20')](function(){return _0x4e1ca3;})[_0x2eb2('0x20')](respondWithResult(_0x8affd9,null))['catch'](handleError(_0x8affd9,null));};exports[_0x2eb2('0xa0')]=function(_0x1cdb35,_0x408315,_0x3cf33c){var _0x3de572;return db[_0x2eb2('0x7e')][_0x2eb2('0x7f')](function(_0x4c8d3c){return db[_0x2eb2('0x43')]['update'](_0x1cdb35[_0x2eb2('0x5c')],{'where':{'id':_0x1cdb35['body']['id']},'transaction':_0x4c8d3c})['then'](function(_0x455d94){return db[_0x2eb2('0xa1')]['destroy']({'where':{'FaxAccountId':_0x1cdb35[_0x2eb2('0x5c')]['id']},'transaction':_0x4c8d3c})[_0x2eb2('0x20')](function(_0x451e0d){return db['VoiceExtension'][_0x2eb2('0x84')](createExtensionsReciveFax(_[_0x2eb2('0x74')](_0x1cdb35[_0x2eb2('0x5c')],[_0x2eb2('0xa2'),'key','createdAt',_0x2eb2('0xa3'),'TrunkId','ListId'])),{'transaction':_0x4c8d3c});});});})[_0x2eb2('0x20')](function(){return db['FaxAccount'][_0x2eb2('0xa4')](_0x1cdb35[_0x2eb2('0x5c')]['id']);})[_0x2eb2('0x20')](respondWithResult(_0x408315,null))[_0x2eb2('0x2b')](handleError(_0x408315,null));};exports[_0x2eb2('0xa5')]=function(_0x5f4ab2,_0x57a11e,_0x434584){var _0x3b371c={'raw':!![],'where':{}};var _0x38ef45={};var _0xf47288={'count':0x0,'rows':[]};return db[_0x2eb2('0x43')][_0x2eb2('0x68')]({'where':{'id':_0x5f4ab2[_0x2eb2('0x62')]['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x57a11e,null))[_0x2eb2('0x20')](function(_0x44fcbd){if(_0x44fcbd){_0x38ef45[_0x2eb2('0x48')]=_[_0x2eb2('0x4a')](db[_0x2eb2('0xa6')]['rawAttributes']);_0x38ef45['query']=_[_0x2eb2('0x4a')](_0x5f4ab2[_0x2eb2('0x49')]);_0x38ef45[_0x2eb2('0x4b')]=_[_0x2eb2('0x4c')](_0x38ef45[_0x2eb2('0x48')],_0x38ef45[_0x2eb2('0x49')]);_0x3b371c[_0x2eb2('0x4e')]=_[_0x2eb2('0x4c')](_0x38ef45['model'],qs[_0x2eb2('0x4d')](_0x5f4ab2[_0x2eb2('0x49')]['fields']));_0x3b371c[_0x2eb2('0x4e')]=_0x3b371c[_0x2eb2('0x4e')][_0x2eb2('0x59')]?_0x3b371c['attributes']:_0x38ef45[_0x2eb2('0x48')];if(!_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0x4f')](_0x2eb2('0x69'))){_0x3b371c['limit']=qs[_0x2eb2('0x32')](_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0x32')]);_0x3b371c[_0x2eb2('0x30')]=qs[_0x2eb2('0x30')](_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0x30')]);}_0x3b371c[_0x2eb2('0x6a')]=qs[_0x2eb2('0x50')](_0x5f4ab2[_0x2eb2('0x49')]['sort']);_0x3b371c[_0x2eb2('0x51')]=qs[_0x2eb2('0x4b')](_['pick'](_0x5f4ab2['query'],_0x38ef45['filters']));_0x3b371c[_0x2eb2('0x51')][_0x2eb2('0x65')]=_0x44fcbd['id'];if(_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0x3b371c[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0x3b371c['where'],{'$or':_[_0x2eb2('0x42')](_0x3b371c[_0x2eb2('0x4e')],function(_0x47f7e2){var _0x2d0b71={};_0x2d0b71[_0x47f7e2]={'$like':'%'+_0x5f4ab2['query'][_0x2eb2('0x54')]+'%'};return _0x2d0b71;})});}if(_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0xa7')]){var _0x26b1a7=_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0xa7')][_0x2eb2('0xa8')](',');var _0x157831={};_0x157831[_0x26b1a7[0x0]]={'$gte':moment(_0x26b1a7[0x1])[_0x2eb2('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3b371c[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0x3b371c[_0x2eb2('0x51')],_0x157831);}_0x3b371c=_[_0x2eb2('0x52')]({},_0x3b371c,_0x5f4ab2[_0x2eb2('0x55')]);return db[_0x2eb2('0xa6')][_0x2eb2('0x56')]({'where':_0x3b371c[_0x2eb2('0x51')]})[_0x2eb2('0x20')](function(_0x573012){_0xf47288[_0x2eb2('0x56')]=_0x573012;if(_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0x57')]){_0x3b371c['include']=[{'all':!![]}];}return db['FaxMessage'][_0x2eb2('0x58')](_0x3b371c);})[_0x2eb2('0x20')](function(_0x445316){_0xf47288[_0x2eb2('0x6c')]=_0x445316;return _0xf47288;});}})[_0x2eb2('0x20')](respondWithFilteredResult(_0x57a11e,_0x3b371c))['catch'](handleError(_0x57a11e,null));};exports['send']=function(_0x22e7a6,_0xc8592d,_0x138237){var _0x11fda8,_0x4ab600={},_0x210157;if(_0x22e7a6['body']['to']){_0x210157=_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0];}return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x22e7a6['params']['id']},'include':[{'model':db[_0x2eb2('0xaa')],'as':_0x2eb2('0xab'),'include':[{'model':db['CmContact'],'as':_0x2eb2('0xac'),'where':{'fax':_0x210157},'limit':0x1,'order':[[_0x2eb2('0xa3'),'DESC']]}]}]})[_0x2eb2('0x20')](handleEntityNotFound(_0xc8592d,null))[_0x2eb2('0x20')](function(_0xe9d09f){_0x11fda8=_0xe9d09f;if(_0x22e7a6[_0x2eb2('0x5c')]['attachments']&&_0x22e7a6[_0x2eb2('0x5c')]['attachments']['length']){for(var _0x3316fd=0x0;_0x3316fd<_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')]['length'];_0x3316fd+=0x1){_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][_0x3316fd]={'filename':_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][_0x3316fd][_0x2eb2('0x3d')],'id':_0x22e7a6['body'][_0x2eb2('0xad')][_0x3316fd]['id'],'path':path[_0x2eb2('0xae')](config[_0x2eb2('0xaf')],'server/files/attachments',_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][_0x3316fd][_0x2eb2('0xb0')])};}}return respondWithRpcPromise(_0x2eb2('0xb1'),_0x2eb2('0xb1'),{'FaxAccountId':_[_0x2eb2('0xb2')](_0x22e7a6['params']['id'])?undefined:_0x22e7a6[_0x2eb2('0x62')]['id'],'path':_[_0x2eb2('0xb2')](_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0][_0x2eb2('0x7')])?undefined:_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0][_0x2eb2('0x7')],'fax':_[_0x2eb2('0xb2')](_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0])?undefined:_0x22e7a6['body']['to'][0x0]},client9002);})[_0x2eb2('0x20')](function(){if(_0x11fda8){if(_[_0x2eb2('0xb2')](_0x22e7a6[_0x2eb2('0x5c')]['from'])){_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xb3')]=util[_0x2eb2('0xa9')](_0x2eb2('0xb4'),_0x11fda8[_0x2eb2('0x3d')],_0x11fda8[_0x2eb2('0xb5')]);}if(_0x11fda8['List']){if(_0x11fda8['List'][_0x2eb2('0xac')]['length']){return _0x11fda8[_0x2eb2('0xab')][_0x2eb2('0xac')][0x0];}else{return db[_0x2eb2('0x76')][_0x2eb2('0x5b')](_[_0x2eb2('0x1a')](_0x22e7a6[_0x2eb2('0x5c')],{'firstName':_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0],'phone':_0x22e7a6['body']['to'][0x0],'fax':_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0],'ListId':_0x11fda8[_0x2eb2('0xb6')]}));}}else{throw new Error(_0x2eb2('0xb7'));}}else{throw new Error(_0x2eb2('0xb8'));}})['then'](function(_0x4dc36d){if(_0x4dc36d){return db['FaxInteraction'][_0x2eb2('0x5a')]({'where':{'ContactId':_0x4dc36d['id'],'closed':![],'FaxAccountId':_0x11fda8['id']}})[_0x2eb2('0x20')](function(_0x4a9816){if(_0x4a9816){return[_0x4a9816,![]];}return db[_0x2eb2('0x72')][_0x2eb2('0x5b')]({'UserId':_0x22e7a6[_0x2eb2('0xb9')]['id'],'ContactId':_0x4dc36d['id'],'FaxAccountId':_0x11fda8['id'],'fax':_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x22e7a6[_0x2eb2('0x5c')],{'read':![],'body':_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0][_0x2eb2('0xba')],'FaxAccountId':_0x11fda8['id'],'UserId':_0x22e7a6['user']['id'],'ContactId':_0x4dc36d['id'],'AttachmentId':_0x22e7a6['body'][_0x2eb2('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x2eb2('0xbb')}]})[_0x2eb2('0x20')](function(_0x21f061){return[_0x21f061,!![]];});});}else{throw new Error(_0x2eb2('0xbc'));}})['spread'](function(_0x6a2f6e,_0x395594){if(_0x395594){return _0x6a2f6e;}return db['FaxMessage'][_0x2eb2('0x5b')]({'direction':_0x2eb2('0xbd'),'read':![],'body':_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0][_0x2eb2('0xba')],'FaxAccountId':_0x11fda8['id'],'FaxInteractionId':_0x6a2f6e['id'],'UserId':_0x22e7a6[_0x2eb2('0xb9')]['id'],'ContactId':_0x6a2f6e['ContactId'],'AttachmentId':_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0]['id']})['then'](function(_0x1a5762){_0x6a2f6e[_0x2eb2('0xbe')][_0x2eb2('0xbb')]=[];_0x6a2f6e[_0x2eb2('0xbe')][_0x2eb2('0xbb')]['push'](_0x1a5762[_0x2eb2('0xbe')]);return _0x6a2f6e;});})[_0x2eb2('0x20')](function(_0x39b05c){respondWithRpcPromise('SendFax',_0x2eb2('0xbf'),{'FaxAccountId':_['isNil'](_0x22e7a6[_0x2eb2('0x62')]['id'])?undefined:_0x22e7a6['params']['id'],'path':_['isNil'](_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0]['path'])?undefined:_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0]['path'],'fax':_[_0x2eb2('0xb2')](_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0])?undefined:_0x22e7a6['body']['to'][0x0],'AttachmentId':_0x22e7a6[_0x2eb2('0x5c')]['attachments'][0x0]['id']},client9002)['then'](function(_0x1a5c3a){logger[_0x2eb2('0x21')]('SendFaxRpc,\x20%s',_0x1a5c3a);})[_0x2eb2('0x2b')](function(_0x2a1363){logger['info']('SendFaxRpc,\x20%s',_0x2a1363);});return _0x39b05c;})['then'](respondWithResult(_0xc8592d,null))[_0x2eb2('0x2b')](handleError(_0xc8592d,null));};exports[_0x2eb2('0xc0')]=function(_0x4b9698,_0x2eb74a,_0x55b0d5){return db['FaxAccount'][_0x2eb2('0x5a')]({'where':{'id':_0x4b9698['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x2eb74a,null))[_0x2eb2('0x20')](function(_0x311fc9){if(_0x311fc9){return _0x311fc9['addAgents'](_0x4b9698[_0x2eb2('0x5c')]['ids'],_['omit'](_0x4b9698[_0x2eb2('0x5c')],[_0x2eb2('0x6e'),'id'])||{})[_0x2eb2('0xc1')](function(_0x4c77ef){for(var _0x74e3e4=0x0;_0x74e3e4<_0x4b9698[_0x2eb2('0x5c')][_0x2eb2('0x6e')][_0x2eb2('0x59')];_0x74e3e4+=0x1){socket['emit'](_0x2eb2('0xc2'),{'UserId':Number(_0x4b9698[_0x2eb2('0x5c')]['ids'][_0x74e3e4]),'FaxAccountId':Number(_0x4b9698[_0x2eb2('0x62')]['id'])});}return _0x4c77ef;});}})[_0x2eb2('0x20')](respondWithResult(_0x2eb74a,null))[_0x2eb2('0x2b')](handleError(_0x2eb74a,null));};exports[_0x2eb2('0xc3')]=function(_0x20bbf4,_0x5e398f,_0x6f4356){return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x20bbf4['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x5e398f,null))[_0x2eb2('0x20')](function(_0x1eaeb4){if(_0x1eaeb4){return _0x1eaeb4[_0x2eb2('0xc3')](_0x20bbf4[_0x2eb2('0x49')][_0x2eb2('0x6e')])[_0x2eb2('0x20')](function(){if(_[_0x2eb2('0xc4')](_0x20bbf4['query'][_0x2eb2('0x6e')])){for(var _0x55fea3=0x0;_0x55fea3<_0x20bbf4[_0x2eb2('0x49')][_0x2eb2('0x6e')][_0x2eb2('0x59')];_0x55fea3+=0x1){socket[_0x2eb2('0xc5')](_0x2eb2('0xc6'),{'UserId':Number(_0x20bbf4['query'][_0x2eb2('0x6e')][_0x55fea3]),'FaxAccountId':Number(_0x20bbf4[_0x2eb2('0x62')]['id'])});}}else{socket[_0x2eb2('0xc5')](_0x2eb2('0xc6'),{'UserId':Number(_0x20bbf4[_0x2eb2('0x49')][_0x2eb2('0x6e')]),'FaxAccountId':Number(_0x20bbf4['params']['id'])});}});}})[_0x2eb2('0x20')](respondWithStatusCode(_0x5e398f,null))['catch'](handleError(_0x5e398f,null));};exports[_0x2eb2('0xc7')]=function(_0x1c2204,_0x48c04f,_0x44b3bd){var _0x141511={};var _0x5a1284={};var _0x23f47e;var _0x1d7320;return db['FaxAccount']['findOne']({'where':{'id':_0x1c2204['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x48c04f,null))[_0x2eb2('0x20')](function(_0x3e7c2a){if(_0x3e7c2a){_0x23f47e=_0x3e7c2a;_0x5a1284[_0x2eb2('0x48')]=_[_0x2eb2('0x4a')](db['User'][_0x2eb2('0x44')]);_0x5a1284[_0x2eb2('0x49')]=_[_0x2eb2('0x4a')](_0x1c2204['query']);_0x5a1284['filters']=_[_0x2eb2('0x4c')](_0x5a1284[_0x2eb2('0x48')],_0x5a1284[_0x2eb2('0x49')]);_0x141511['attributes']=_[_0x2eb2('0x4c')](_0x5a1284[_0x2eb2('0x48')],qs['fields'](_0x1c2204[_0x2eb2('0x49')][_0x2eb2('0x4d')]));_0x141511['attributes']=_0x141511['attributes'][_0x2eb2('0x59')]?_0x141511[_0x2eb2('0x4e')]:_0x5a1284['model'];_0x141511[_0x2eb2('0x6a')]=qs[_0x2eb2('0x50')](_0x1c2204[_0x2eb2('0x49')][_0x2eb2('0x50')]);_0x141511[_0x2eb2('0x51')]=qs['filters'](_[_0x2eb2('0xc8')](_0x1c2204['query'],_0x5a1284[_0x2eb2('0x4b')]));if(_0x1c2204[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0x141511[_0x2eb2('0x51')]=_['merge'](_0x141511[_0x2eb2('0x51')],{'$or':_[_0x2eb2('0x42')](_0x141511['attributes'],function(_0x3398ef){var _0x17d1ea={};_0x17d1ea[_0x3398ef]={'$like':'%'+_0x1c2204['query'][_0x2eb2('0x54')]+'%'};return _0x17d1ea;})});}_0x141511=_['merge']({},_0x141511,_0x1c2204[_0x2eb2('0x55')]);return _0x23f47e[_0x2eb2('0xc7')](_0x141511);}})['then'](function(_0x420105){if(_0x420105){_0x1d7320=_0x420105[_0x2eb2('0x59')];if(!_0x1c2204['query']['hasOwnProperty'](_0x2eb2('0x69'))){_0x141511['limit']=qs[_0x2eb2('0x32')](_0x1c2204[_0x2eb2('0x49')]['limit']);_0x141511[_0x2eb2('0x30')]=qs[_0x2eb2('0x30')](_0x1c2204['query'][_0x2eb2('0x30')]);}return _0x23f47e[_0x2eb2('0xc7')](_0x141511);}})[_0x2eb2('0x20')](function(_0x4cf5a9){if(_0x4cf5a9){return _0x4cf5a9?{'count':_0x1d7320,'rows':_0x4cf5a9}:null;}})[_0x2eb2('0x20')](respondWithResult(_0x48c04f,null))[_0x2eb2('0x2b')](handleError(_0x48c04f,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index a15806f..01c419b 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 _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 +var _0xdddf=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x293617,_0x43ff20){var _0x1f9d33=function(_0x31f191){while(--_0x31f191){_0x293617['push'](_0x293617['shift']());}};_0x1f9d33(++_0x43ff20);}(_0xdddf,0x9b));var _0xfddd=function(_0x281b34,_0x2c518d){_0x281b34=_0x281b34-0x0;var _0x2ee85c=_0xdddf[_0x281b34];return _0x2ee85c;};'use strict';var EventEmitter=require(_0xfddd('0x0'));var FaxAccount=require(_0xfddd('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xfddd('0x2')](0x0);var events={'afterCreate':_0xfddd('0x3'),'afterUpdate':'update','afterDestroy':_0xfddd('0x4')};function emitEvent(_0x2407e7){return function(_0x1a424e,_0x17f9f8,_0x52ed8d){FaxAccountEvents[_0xfddd('0x5')](_0x2407e7+':'+_0x1a424e['id'],_0x1a424e);FaxAccountEvents['emit'](_0x2407e7,_0x1a424e);_0x52ed8d(null);};}for(var e in events){if(events[_0xfddd('0x6')](e)){var event=events[e];FaxAccount[_0xfddd('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 691f699..507dc32 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 _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 +var _0xc81a=['./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc81a,0x191));var _0xac81=function(_0x2effd6,_0x8e1532){_0x2effd6=_0x2effd6-0x0;var _0x4f2dd6=_0xc81a[_0x2effd6];return _0x4f2dd6;};'use strict';var _=require(_0xac81('0x0'));var util=require(_0xac81('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xac81('0x2'));var rp=require(_0xac81('0x3'));var fs=require('fs');var path=require(_0xac81('0x4'));var rimraf=require(_0xac81('0x5'));var config=require('../../config/environment');var attributes=require(_0xac81('0x6'));module[_0xac81('0x7')]=function(_0x1f0ceb,_0x1b7523){return _0x1f0ceb[_0xac81('0x8')](_0xac81('0x9'),attributes,{'tableName':_0xac81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 5e14130..8e95c0b 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 _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 +var _0x65a7=['waitForTheAssignedAgent','FaxQueue','queueId','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','then','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','keys','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','Contacts','length','FaxInteraction','Contact\x20not\x20found','spread','push','close','*,*,*,*','created','create','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x65a7,0x17a));var _0x765a=function(_0x504b73,_0x2b4a50){_0x504b73=_0x504b73-0x0;var _0x47e36a=_0x65a7[_0x504b73];return _0x47e36a;};'use strict';var _=require(_0x765a('0x0'));var util=require('util');var moment=require(_0x765a('0x1'));var BPromise=require(_0x765a('0x2'));var rs=require(_0x765a('0x3'));var fs=require('fs');var Redis=require(_0x765a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x765a('0x5'));var logger=require(_0x765a('0x6'))(_0x765a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x765a('0x8')][_0x765a('0x9')]({'port':0x232c});config[_0x765a('0xa')]=_[_0x765a('0xb')](config['redis'],{'host':_0x765a('0xc'),'port':0x18eb});var socket=require(_0x765a('0xd'))(new Redis(config[_0x765a('0xa')]));require(_0x765a('0xe'))['register'](socket);function respondWithRpcPromise(_0x3249f7,_0x2e9db7,_0x232079){return new BPromise(function(_0x5cd0ed,_0x5b6b57){return client[_0x765a('0xf')](_0x3249f7,_0x232079)['then'](function(_0x4166ea){logger[_0x765a('0x10')](_0x765a('0x11'),_0x2e9db7,'request\x20sent');logger[_0x765a('0x12')](_0x765a('0x13'),_0x2e9db7,_0x765a('0x14'),JSON[_0x765a('0x15')](_0x4166ea));if(_0x4166ea[_0x765a('0x16')]){if(_0x4166ea[_0x765a('0x16')]['code']===0x1f4){logger['error'](_0x765a('0x11'),_0x2e9db7,_0x4166ea['error']['message']);return _0x5b6b57(_0x4166ea['error']['message']);}logger[_0x765a('0x16')]('FaxAccount,\x20%s,\x20%s',_0x2e9db7,_0x4166ea[_0x765a('0x16')][_0x765a('0x17')]);return _0x5cd0ed(_0x4166ea[_0x765a('0x16')][_0x765a('0x17')]);}else{logger['info'](_0x765a('0x11'),_0x2e9db7,'request\x20sent');_0x5cd0ed(_0x4166ea[_0x765a('0x18')][_0x765a('0x17')]);}})[_0x765a('0x19')](function(_0x4c96ae){logger['error'](_0x765a('0x11'),_0x2e9db7,_0x4c96ae);_0x5b6b57(_0x4c96ae);});});}exports['GetFaxAccount']=function(_0x4af83f){var _0x2d0ec3=this;return new Promise(function(_0x5c14f8,_0x362195){return db[_0x765a('0x1a')][_0x765a('0x1b')]({'raw':_0x4af83f[_0x765a('0x1c')]?_0x4af83f[_0x765a('0x1c')][_0x765a('0x1d')]===undefined?!![]:![]:!![],'where':_0x4af83f[_0x765a('0x1c')]?_0x4af83f[_0x765a('0x1c')][_0x765a('0x1e')]||null:null,'attributes':_0x4af83f['options']?_0x4af83f[_0x765a('0x1c')][_0x765a('0x1f')]||null:null,'limit':_0x4af83f['options']?_0x4af83f['options'][_0x765a('0x20')]||null:null,'include':_0x4af83f[_0x765a('0x1c')]?_0x4af83f[_0x765a('0x1c')]['include']?_[_0x765a('0x21')](_0x4af83f[_0x765a('0x1c')][_0x765a('0x22')],function(_0x5495c6){return{'model':db[_0x5495c6[_0x765a('0x23')]],'as':_0x5495c6['as'],'attributes':_0x5495c6['attributes'],'include':_0x5495c6['include']?_['map'](_0x5495c6[_0x765a('0x22')],function(_0x1f1b4a){return{'model':db[_0x1f1b4a[_0x765a('0x23')]],'as':_0x1f1b4a['as'],'attributes':_0x1f1b4a[_0x765a('0x1f')],'include':_0x1f1b4a[_0x765a('0x22')]?_['map'](_0x1f1b4a[_0x765a('0x22')],function(_0x49c325){return{'model':db[_0x49c325[_0x765a('0x23')]],'as':_0x49c325['as'],'attributes':_0x49c325[_0x765a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x73f5f4){logger[_0x765a('0x10')](_0x765a('0x24'),_0x4af83f);logger['debug'](_0x765a('0x24'),_0x4af83f,JSON[_0x765a('0x15')](_0x73f5f4));_0x5c14f8(_0x73f5f4);})[_0x765a('0x19')](function(_0x274279){logger[_0x765a('0x16')](_0x765a('0x24'),_0x274279[_0x765a('0x17')],_0x4af83f);_0x362195(_0x2d0ec3['error'](0x1f4,_0x274279[_0x765a('0x17')]));});});};exports[_0x765a('0x25')]=function(_0x5b3e4f,_0x3c0b93,_0x4d57a2){var _0x47c730=this;return new Promise(function(_0x5e1f0e,_0x4c8d67){var _0x2e8570={'body':_0x5b3e4f[_0x765a('0x26')],'channel':_0x765a('0x27')};var _0x1a36b1=[];var _0x633fa7=[];var _0x19121d={};return db[_0x765a('0x28')]['describe']()[_0x765a('0x29')](function(_0x1d2c76){if(!_0x1d2c76){throw new db[(_0x765a('0x2a'))][(_0x765a('0x2b'))](_0x765a('0x2c'));}_0x1a36b1=_[_0x765a('0x2d')](_['keys'](_0x1d2c76),['createdAt',_0x765a('0x2e')]);_0x633fa7=_[_0x765a('0x2d')](_[_0x765a('0x2f')](_0x1d2c76),[_0x765a('0x30'),_0x765a('0x2e'),_0x765a('0x31'),_0x765a('0x32')]);if(_0x5b3e4f[_0x765a('0x26')]['id']){delete _0x5b3e4f['body']['id'];}if(_[_0x765a('0x33')](_0x5b3e4f['body'][_0x765a('0x34')])){throw new db[(_0x765a('0x2a'))][(_0x765a('0x2b'))](_0x765a('0x35'));}if(_['isNil'](_0x5b3e4f[_0x765a('0x26')]['body'])||_0x5b3e4f[_0x765a('0x26')]['body']===''){throw new db[(_0x765a('0x2a'))][(_0x765a('0x2b'))](_0x765a('0x36'));}if(_['isNil'](_0x5b3e4f[_0x765a('0x26')][_0x765a('0x37')])){throw new db[(_0x765a('0x2a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x633fa7);}if(!_['includes'](_0x633fa7,_0x5b3e4f[_0x765a('0x26')][_0x765a('0x37')])){throw new db[(_0x765a('0x2a'))][(_0x765a('0x2b'))](_0x765a('0x38')+_0x633fa7);}_0x19121d[_0x5b3e4f[_0x765a('0x26')][_0x765a('0x37')]]=_0x5b3e4f[_0x765a('0x26')][_0x765a('0x34')];})[_0x765a('0x29')](function(){return db[_0x765a('0x1a')]['find']({'where':{'id':_0x5b3e4f[_0x765a('0x39')]['id']},'include':[{'model':db[_0x765a('0x3a')],'as':_0x765a('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x19121d,'limit':0x1,'order':[['updatedAt',_0x765a('0x3c')]]}]},{'model':db[_0x765a('0x3d')],'as':_0x765a('0x3e')}]});})[_0x765a('0x29')](function(_0x7e24b5){if(_0x7e24b5&&_0x7e24b5['List']){var _0x1e8bd0=_0x7e24b5[_0x765a('0x3f')]({'plain':!![]});_0x2e8570[_0x765a('0x39')]=_0x1e8bd0;_0x2e8570[_0x765a('0x40')]=_0x1e8bd0[_0x765a('0x3e')];_0x2e8570[_0x765a('0x41')]=_0x1e8bd0[_0x765a('0x3b')];_0x2e8570[_0x765a('0x40')]=_[_0x765a('0x42')](_0x2e8570[_0x765a('0x40')],[_0x765a('0x43')],[_0x765a('0x44')]);if(_0x2e8570[_0x765a('0x39')][_0x765a('0x3e')]){delete _0x2e8570[_0x765a('0x39')]['Applications'];}if(_0x2e8570[_0x765a('0x39')][_0x765a('0x3b')]&&_0x2e8570[_0x765a('0x39')]['List'][_0x765a('0x45')][_0x765a('0x46')]){return _0x2e8570[_0x765a('0x39')]['List']['Contacts'][0x0];}var _0x12a5f9=_['defaults'](_0x5b3e4f[_0x765a('0x26')],{'firstName':_0x5b3e4f[_0x765a('0x26')][_0x765a('0x34')],'ListId':_0x1e8bd0[_0x765a('0x32')]});_0x12a5f9[_0x5b3e4f['body'][_0x765a('0x37')]]=_0x5b3e4f['body']['from'];return db[_0x765a('0x28')]['create'](_0x12a5f9,{'fields':_0x1a36b1,'raw':!![]});}})[_0x765a('0x29')](function(_0x59c82e){_0x2e8570['contact']=_0x59c82e;if(_0x59c82e){var _0x39c361={'ContactId':_0x59c82e['id'],'FaxAccountId':_0x5b3e4f[_0x765a('0x39')]['id'],'fax':_0x59c82e[_0x765a('0x27')]};return db[_0x765a('0x47')]['find']({'where':{'ContactId':_0x59c82e['id'],'closed':![],'FaxAccountId':_0x5b3e4f['account']['id']}})['then'](function(_0x2dd484){if(_0x2dd484){return[_0x2dd484,![]];}return db['FaxInteraction']['create'](_0x39c361)['then'](function(_0x1bac71){return[_0x1bac71,!![]];});});}else{throw new Error(_0x765a('0x48'));}})[_0x765a('0x49')](function(_0x41bdcd,_0xc687fc){var _0x13b7a3=_0x41bdcd['get']({'plain':!![]});if(_0xc687fc){if(_0x2e8570[_0x765a('0x39')]['autoclose']){_0x2e8570[_0x765a('0x40')][_0x765a('0x4a')]({'id':0x0,'priority':_0x2e8570[_0x765a('0x40')][_0x765a('0x46')]+0x1,'app':_0x765a('0x4b'),'appdata':'unmanaged','interval':_0x765a('0x4c')});}_0x13b7a3[_0x765a('0x4d')]=!![];}else{_0x13b7a3[_0x765a('0x4d')]=![];}_0x2e8570['interaction']=_0x13b7a3;return db['FaxMessage'][_0x765a('0x4e')]({'body':_0x5b3e4f['body'][_0x765a('0x26')],'FaxAccountId':_0x5b3e4f['account']['id'],'FaxInteractionId':_0x41bdcd['id'],'direction':'in','ContactId':_0x41bdcd[_0x765a('0x4f')],'AttachmentId':_0x5b3e4f[_0x765a('0x26')][_0x765a('0x50')]});})['then'](function(_0x214517){_0x2e8570[_0x765a('0x17')]=_0x214517;if(!_0x2e8570[_0x765a('0x51')][_0x765a('0x52')])return;return db[_0x765a('0x53')]['find']({'attributes':['id',_0x765a('0x54')],'where':{'id':_0x2e8570[_0x765a('0x51')]['UserId']}});})[_0x765a('0x29')](function(_0x24bacf){if(_0x24bacf){_0x2e8570[_0x765a('0x40')][_0x765a('0x55')]({'id':0x0,'priority':0x0,'app':_0x765a('0x56'),'appdata':_0x24bacf['name']+','+(_0x2e8570[_0x765a('0x39')][_0x765a('0x57')]||0xa),'interval':_0x765a('0x4c')});}if(!_0x2e8570[_0x765a('0x51')]['queueId'])return;return db[_0x765a('0x58')]['find']({'attributes':['id',_0x765a('0x54')],'where':{'id':_0x2e8570[_0x765a('0x51')][_0x765a('0x59')]}});})[_0x765a('0x29')](function(_0x2c3eac){if(_0x2c3eac){_0x2e8570[_0x765a('0x40')][_0x765a('0x55')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2c3eac[_0x765a('0x54')]+','+(_0x2e8570['account'][_0x765a('0x5a')]||0x12c),'interval':_0x765a('0x4c')});}return respondWithRpcPromise(_0x765a('0x5b'),_0x765a('0x5c'),_0x2e8570);})[_0x765a('0x29')](function(_0x1868ac){_0x5e1f0e(_0x1868ac);})[_0x765a('0x19')](function(_0x5e93c3){_0x4c8d67(_0x47c730[_0x765a('0x16')](0x1f4,_0x5e93c3[_0x765a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index ed52e34..cf362ea 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 _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 +var _0x85c2=['removeListener','register','length','./faxAccount.events','save','remove','update'];(function(_0x59155c,_0x586361){var _0x35423b=function(_0x290acc){while(--_0x290acc){_0x59155c['push'](_0x59155c['shift']());}};_0x35423b(++_0x586361);}(_0x85c2,0x168));var _0x285c=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x85c2[_0x1035c1];return _0x308d67;};'use strict';var FaxAccountEvents=require(_0x285c('0x0'));var events=[_0x285c('0x1'),_0x285c('0x2'),_0x285c('0x3')];function createListener(_0x15b730,_0x44a2c3){return function(_0x26440e){_0x44a2c3['emit'](_0x15b730,_0x26440e);};}function removeListener(_0x4f2efc,_0x3b5e0a){return function(){FaxAccountEvents[_0x285c('0x4')](_0x4f2efc,_0x3b5e0a);};}exports[_0x285c('0x5')]=function(_0x1552c2){for(var _0x1732ee=0x0,_0x2ace8a=events[_0x285c('0x6')];_0x1732ee<_0x2ace8a;_0x1732ee++){var _0x4056cc=events[_0x1732ee];var _0x54d491=createListener('faxAccount:'+_0x4056cc,_0x1552c2);FaxAccountEvents['on'](_0x4056cc,_0x54d491);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index b4135a3..393004c 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 _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 +var _0x34e1=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2dc11a,_0x1caf06){var _0xd6d9d2=function(_0x316248){while(--_0x316248){_0x2dc11a['push'](_0x2dc11a['shift']());}};_0xd6d9d2(++_0x1caf06);}(_0x34e1,0xcd));var _0x134e=function(_0x4050a2,_0x185d9d){_0x4050a2=_0x4050a2-0x0;var _0x2fea5c=_0x34e1[_0x4050a2];return _0x2fea5c;};'use strict';var multer=require(_0x134e('0x0'));var util=require(_0x134e('0x1'));var path=require('path');var timeout=require(_0x134e('0x2'));var express=require(_0x134e('0x3'));var router=express[_0x134e('0x4')]();var fs_extra=require(_0x134e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x134e('0x6'));var config=require(_0x134e('0x7'));var controller=require(_0x134e('0x8'));router[_0x134e('0x9')]('/',auth[_0x134e('0xa')](),controller[_0x134e('0xb')]);router[_0x134e('0x9')](_0x134e('0xc'),auth[_0x134e('0xa')](),controller[_0x134e('0xd')]);router['get'](_0x134e('0xe'),auth[_0x134e('0xa')](),controller[_0x134e('0xf')]);router[_0x134e('0x9')](_0x134e('0x10'),auth[_0x134e('0xa')](),controller[_0x134e('0x11')]);router[_0x134e('0x9')](_0x134e('0x12'),auth['isAuthenticated'](),controller[_0x134e('0x13')]);router[_0x134e('0x9')](_0x134e('0x14'),auth[_0x134e('0xa')](),controller['getInteractions']);router[_0x134e('0x9')](_0x134e('0x15'),auth[_0x134e('0xa')](),controller[_0x134e('0x16')]);router['get']('/:id/messages',auth[_0x134e('0xa')](),controller[_0x134e('0x17')]);router['get'](_0x134e('0x18'),auth[_0x134e('0xa')](),controller[_0x134e('0x19')]);router['post']('/',auth[_0x134e('0xa')](),controller[_0x134e('0x1a')]);router[_0x134e('0x1b')](_0x134e('0x10'),auth['isAuthenticated'](),controller[_0x134e('0x1c')]);router[_0x134e('0x1b')](_0x134e('0x12'),auth[_0x134e('0xa')](),controller[_0x134e('0x1d')]);router[_0x134e('0x1b')](_0x134e('0x14'),auth[_0x134e('0xa')](),controller[_0x134e('0x1e')]);router[_0x134e('0x1b')](_0x134e('0x15'),auth[_0x134e('0xa')](),controller[_0x134e('0x1f')]);router[_0x134e('0x1b')](_0x134e('0x20'),auth[_0x134e('0xa')](),controller[_0x134e('0x21')]);router[_0x134e('0x1b')](_0x134e('0x22'),auth[_0x134e('0xa')](),controller[_0x134e('0x23')]);router[_0x134e('0x1b')]('/:id/send',auth[_0x134e('0xa')](),controller['send']);router[_0x134e('0x1b')](_0x134e('0x18'),auth[_0x134e('0xa')](),controller[_0x134e('0x24')]);router[_0x134e('0x25')](_0x134e('0xe'),auth['isAuthenticated'](),controller[_0x134e('0x26')]);router[_0x134e('0x27')](_0x134e('0xe'),auth['isAuthenticated'](),controller[_0x134e('0x28')]);router[_0x134e('0x27')](_0x134e('0x10'),auth[_0x134e('0xa')](),controller[_0x134e('0x29')]);router[_0x134e('0x27')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x134e('0x27')]('/:id/users',auth[_0x134e('0xa')](),controller[_0x134e('0x2a')]);module[_0x134e('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 7b42763..29a366e 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 _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 +var _0x161d=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1a9364,_0x24304b){var _0x58640d=function(_0x47a58b){while(--_0x47a58b){_0x1a9364['push'](_0x1a9364['shift']());}};_0x58640d(++_0x24304b);}(_0x161d,0x13b));var _0xd161=function(_0x543538,_0x52c8f0){_0x543538=_0x543538-0x0;var _0x35fa8c=_0x161d[_0x543538];return _0x35fa8c;};'use strict';var Sequelize=require(_0xd161('0x0'));module[_0xd161('0x1')]={'priority':{'type':Sequelize[_0xd161('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd161('0x3')],'allowNull':![],'defaultValue':_0xd161('0x4')},'appdata':{'type':Sequelize[_0xd161('0x5')]()},'description':{'type':Sequelize[_0xd161('0x3')]},'interval':{'type':Sequelize[_0xd161('0x3')],'defaultValue':_0xd161('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 2d5762d..4d2f04b 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 _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 +var _0x0444=['merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','eml-format','zip-dir','bluebird','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter'];(function(_0x254081,_0x20731a){var _0x5d1e2a=function(_0x597854){while(--_0x597854){_0x254081['push'](_0x254081['shift']());}};_0x5d1e2a(++_0x20731a);}(_0x0444,0xe5));var _0x4044=function(_0x131b43,_0x308d50){_0x131b43=_0x131b43-0x0;var _0x199734=_0x0444[_0x131b43];return _0x199734;};'use strict';var emlformat=require(_0x4044('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4044('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4044('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4044('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4044('0x4'));var _=require(_0x4044('0x5'));var squel=require(_0x4044('0x6'));var crypto=require(_0x4044('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x4044('0x8'));var toCsv=require('to-csv');var querystring=require(_0x4044('0x9'));var Papa=require(_0x4044('0xa'));var Redis=require(_0x4044('0xb'));var authService=require(_0x4044('0xc'));var qs=require(_0x4044('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4044('0xe'))(_0x4044('0xf'));var utils=require(_0x4044('0x10'));var config=require(_0x4044('0x11'));var licenseUtil=require(_0x4044('0x12'));var db=require(_0x4044('0x13'))['db'];function respondWithStatusCode(_0x1b9e7e,_0x1285a2){_0x1285a2=_0x1285a2||0xcc;return function(_0x472f63){if(_0x472f63){return _0x1b9e7e[_0x4044('0x14')](_0x1285a2);}return _0x1b9e7e['status'](_0x1285a2)[_0x4044('0x15')]();};}function respondWithResult(_0x39a190,_0x300600){_0x300600=_0x300600||0xc8;return function(_0x3c4892){if(_0x3c4892){return _0x39a190[_0x4044('0x16')](_0x300600)[_0x4044('0x17')](_0x3c4892);}};}function respondWithFilteredResult(_0x541720,_0x58b957){return function(_0x1288ee){if(_0x1288ee){var _0x552fa8=typeof _0x58b957[_0x4044('0x18')]===_0x4044('0x19')&&typeof _0x58b957[_0x4044('0x1a')]===_0x4044('0x19');var _0x428d79=_0x1288ee['count'];var _0x57a1d8=_0x552fa8?0x0:_0x58b957['offset'];var _0xbf2ba9=_0x552fa8?_0x1288ee['count']:_0x58b957['offset']+_0x58b957[_0x4044('0x1a')];var _0x274984;if(_0xbf2ba9>=_0x428d79){_0xbf2ba9=_0x428d79;_0x274984=0xc8;}else{_0x274984=0xce;}_0x541720['status'](_0x274984);return _0x541720[_0x4044('0x1b')](_0x4044('0x1c'),_0x57a1d8+'-'+_0xbf2ba9+'/'+_0x428d79)[_0x4044('0x17')](_0x1288ee);}return null;};}function patchUpdates(_0x3b18ef){return function(_0x20468b){try{jsonpatch[_0x4044('0x1d')](_0x20468b,_0x3b18ef,!![]);}catch(_0x3e9989){return BPromise['reject'](_0x3e9989);}return _0x20468b[_0x4044('0x1e')]();};}function saveUpdates(_0x7db6c1,_0x56335c){return function(_0x630a0e){if(_0x630a0e){return _0x630a0e[_0x4044('0x1f')](_0x7db6c1)[_0x4044('0x20')](function(_0x33409d){return _0x33409d;});}return null;};}function removeEntity(_0x4f6efd,_0x81718f){return function(_0x3f2ce3){if(_0x3f2ce3){return _0x3f2ce3[_0x4044('0x21')]()[_0x4044('0x20')](function(){_0x4f6efd[_0x4044('0x16')](0xcc)[_0x4044('0x15')]();});}};}function handleEntityNotFound(_0x2d58ee,_0x1a00e7){return function(_0x38a465){if(!_0x38a465){_0x2d58ee[_0x4044('0x14')](0x194);}return _0x38a465;};}function handleError(_0x3ffe3d,_0x115f9c){_0x115f9c=_0x115f9c||0x1f4;return function(_0x296c6a){logger[_0x4044('0x22')](_0x296c6a[_0x4044('0x23')]);if(_0x296c6a[_0x4044('0x24')]){delete _0x296c6a['name'];}_0x3ffe3d[_0x4044('0x16')](_0x115f9c)[_0x4044('0x25')](_0x296c6a);};}exports[_0x4044('0x26')]=function(_0xfa1e30,_0x2abff2){var _0x5a8ec9={},_0x11176f={},_0x87730f={'count':0x0,'rows':[]};var _0x1da7cf=_[_0x4044('0x27')](db[_0x4044('0x28')]['rawAttributes'],function(_0x346342){return{'name':_0x346342[_0x4044('0x29')],'type':_0x346342['type'][_0x4044('0x2a')]};});_0x11176f[_0x4044('0x2b')]=_['map'](_0x1da7cf,_0x4044('0x24'));_0x11176f[_0x4044('0x2c')]=_['keys'](_0xfa1e30[_0x4044('0x2c')]);_0x11176f[_0x4044('0x2d')]=_[_0x4044('0x2e')](_0x11176f[_0x4044('0x2b')],_0x11176f[_0x4044('0x2c')]);_0x5a8ec9[_0x4044('0x2f')]=_[_0x4044('0x2e')](_0x11176f[_0x4044('0x2b')],qs[_0x4044('0x30')](_0xfa1e30['query'][_0x4044('0x30')]));_0x5a8ec9[_0x4044('0x2f')]=_0x5a8ec9[_0x4044('0x2f')][_0x4044('0x31')]?_0x5a8ec9[_0x4044('0x2f')]:_0x11176f[_0x4044('0x2b')];if(!_0xfa1e30[_0x4044('0x2c')][_0x4044('0x32')]('nolimit')){_0x5a8ec9[_0x4044('0x1a')]=qs[_0x4044('0x1a')](_0xfa1e30[_0x4044('0x2c')]['limit']);_0x5a8ec9['offset']=qs[_0x4044('0x18')](_0xfa1e30[_0x4044('0x2c')][_0x4044('0x18')]);}_0x5a8ec9[_0x4044('0x33')]=qs['sort'](_0xfa1e30[_0x4044('0x2c')]['sort']);_0x5a8ec9[_0x4044('0x34')]=qs['filters'](_[_0x4044('0x35')](_0xfa1e30[_0x4044('0x2c')],_0x11176f[_0x4044('0x2d')]),_0x1da7cf);if(_0xfa1e30[_0x4044('0x2c')][_0x4044('0x36')]){_0x5a8ec9[_0x4044('0x34')]=_[_0x4044('0x37')](_0x5a8ec9[_0x4044('0x34')],{'$or':_['map'](_0x1da7cf,function(_0x485e0b){if(_0x485e0b['type']!==_0x4044('0x38')){var _0x165b20={};_0x165b20[_0x485e0b[_0x4044('0x24')]]={'$like':'%'+_0xfa1e30[_0x4044('0x2c')][_0x4044('0x36')]+'%'};return _0x165b20;}})});}_0x5a8ec9=_['merge']({},_0x5a8ec9,_0xfa1e30[_0x4044('0x39')]);var _0x2c4fa7={'where':_0x5a8ec9[_0x4044('0x34')]};return db[_0x4044('0x28')][_0x4044('0x3a')](_0x2c4fa7)['then'](function(_0x6f2df9){_0x87730f[_0x4044('0x3a')]=_0x6f2df9;if(_0xfa1e30[_0x4044('0x2c')][_0x4044('0x3b')]){_0x5a8ec9[_0x4044('0x3c')]=[{'all':!![]}];}return db[_0x4044('0x28')][_0x4044('0x3d')](_0x5a8ec9);})['then'](function(_0x119f62){_0x87730f[_0x4044('0x3e')]=_0x119f62;return _0x87730f;})[_0x4044('0x20')](respondWithFilteredResult(_0x2abff2,_0x5a8ec9))[_0x4044('0x3f')](handleError(_0x2abff2,null));};exports[_0x4044('0x40')]=function(_0x219c80,_0x388c3c){var _0x3f7646={'raw':!![],'where':{'id':_0x219c80[_0x4044('0x41')]['id']}},_0x2b2bfa={};_0x2b2bfa[_0x4044('0x2b')]=_['keys'](db[_0x4044('0x28')][_0x4044('0x42')]);_0x2b2bfa[_0x4044('0x2c')]=_[_0x4044('0x43')](_0x219c80[_0x4044('0x2c')]);_0x2b2bfa[_0x4044('0x2d')]=_['intersection'](_0x2b2bfa[_0x4044('0x2b')],_0x2b2bfa['query']);_0x3f7646['attributes']=_[_0x4044('0x2e')](_0x2b2bfa[_0x4044('0x2b')],qs['fields'](_0x219c80['query'][_0x4044('0x30')]));_0x3f7646[_0x4044('0x2f')]=_0x3f7646[_0x4044('0x2f')]['length']?_0x3f7646['attributes']:_0x2b2bfa[_0x4044('0x2b')];if(_0x219c80[_0x4044('0x2c')][_0x4044('0x3b')]){_0x3f7646[_0x4044('0x3c')]=[{'all':!![]}];}_0x3f7646=_[_0x4044('0x37')]({},_0x3f7646,_0x219c80[_0x4044('0x39')]);return db[_0x4044('0x28')][_0x4044('0x44')](_0x3f7646)[_0x4044('0x20')](handleEntityNotFound(_0x388c3c,null))['then'](respondWithResult(_0x388c3c,null))[_0x4044('0x3f')](handleError(_0x388c3c,null));};exports[_0x4044('0x45')]=function(_0x4fda6f,_0x5c87b8){return db[_0x4044('0x28')]['create'](_0x4fda6f[_0x4044('0x46')],{})['then'](respondWithResult(_0x5c87b8,0xc9))[_0x4044('0x3f')](handleError(_0x5c87b8,null));};exports[_0x4044('0x1f')]=function(_0x271b94,_0xf264fd){if(_0x271b94[_0x4044('0x46')]['id']){delete _0x271b94[_0x4044('0x46')]['id'];}return db[_0x4044('0x28')][_0x4044('0x44')]({'where':{'id':_0x271b94['params']['id']}})[_0x4044('0x20')](handleEntityNotFound(_0xf264fd,null))[_0x4044('0x20')](saveUpdates(_0x271b94[_0x4044('0x46')],null))[_0x4044('0x20')](respondWithResult(_0xf264fd,null))[_0x4044('0x3f')](handleError(_0xf264fd,null));};exports[_0x4044('0x21')]=function(_0x92f2a5,_0x2d56ef){return db['FaxApplication'][_0x4044('0x44')]({'where':{'id':_0x92f2a5[_0x4044('0x41')]['id']}})[_0x4044('0x20')](handleEntityNotFound(_0x2d56ef,null))[_0x4044('0x20')](removeEntity(_0x2d56ef,null))['catch'](handleError(_0x2d56ef,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 98070d9..1e5888b 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 _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 +var _0x90e3=['rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x340cf6,_0xb5e3d){var _0x59ae2c=function(_0x3f50b0){while(--_0x3f50b0){_0x340cf6['push'](_0x340cf6['shift']());}};_0x59ae2c(++_0xb5e3d);}(_0x90e3,0xc5));var _0x390e=function(_0x517aba,_0x4814e5){_0x517aba=_0x517aba-0x0;var _0x246abe=_0x90e3[_0x517aba];return _0x246abe;};'use strict';var _=require('lodash');var util=require(_0x390e('0x0'));var logger=require(_0x390e('0x1'))(_0x390e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x390e('0x3'));var config=require(_0x390e('0x4'));var attributes=require('./faxApplication.attributes');module[_0x390e('0x5')]=function(_0x3fdfe0,_0x36287a){return _0x3fdfe0[_0x390e('0x6')](_0x390e('0x7'),attributes,{'tableName':_0x390e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x390e('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0f96016..db7f2e9 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 _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 +var _0x39a9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UpdateFaxApplication','update','body','options','raw','limit','stringify'];(function(_0x55336a,_0x240d59){var _0x28ceb3=function(_0x399d5c){while(--_0x399d5c){_0x55336a['push'](_0x55336a['shift']());}};_0x28ceb3(++_0x240d59);}(_0x39a9,0x1d0));var _0x939a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x39a9[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var moment=require(_0x939a('0x2'));var BPromise=require(_0x939a('0x3'));var rs=require(_0x939a('0x4'));var fs=require('fs');var Redis=require(_0x939a('0x5'));var db=require(_0x939a('0x6'))['db'];var utils=require(_0x939a('0x7'));var logger=require(_0x939a('0x8'))(_0x939a('0x9'));var config=require(_0x939a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x939a('0xb')][_0x939a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12cd66,_0x1c97c1,_0x3bed20){return new BPromise(function(_0xe6a08,_0x398389){return client[_0x939a('0xd')](_0x12cd66,_0x3bed20)['then'](function(_0x382b90){logger[_0x939a('0xe')](_0x939a('0xf'),_0x1c97c1,'request\x20sent');logger[_0x939a('0x10')](_0x939a('0x11'),_0x1c97c1,_0x939a('0x12'),JSON['stringify'](_0x382b90));if(_0x382b90[_0x939a('0x13')]){if(_0x382b90[_0x939a('0x13')][_0x939a('0x14')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x1c97c1,_0x382b90[_0x939a('0x13')][_0x939a('0x15')]);return _0x398389(_0x382b90[_0x939a('0x13')]['message']);}logger[_0x939a('0x13')](_0x939a('0xf'),_0x1c97c1,_0x382b90[_0x939a('0x13')][_0x939a('0x15')]);return _0xe6a08(_0x382b90[_0x939a('0x13')][_0x939a('0x15')]);}else{logger[_0x939a('0xe')]('FaxApplication,\x20%s,\x20%s',_0x1c97c1,_0x939a('0x12'));_0xe6a08(_0x382b90['result'][_0x939a('0x15')]);}})['catch'](function(_0x42c937){logger[_0x939a('0x13')](_0x939a('0xf'),_0x1c97c1,_0x42c937);_0x398389(_0x42c937);});});}exports[_0x939a('0x16')]=function(_0x48741c){var _0x4e8e70=this;return new Promise(function(_0x2a78c1,_0x5e5dbd){return db['FaxApplication'][_0x939a('0x17')](_0x48741c[_0x939a('0x18')],{'raw':_0x48741c[_0x939a('0x19')]?_0x48741c[_0x939a('0x19')][_0x939a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48741c['options']?_0x48741c[_0x939a('0x19')]['where']||null:null,'attributes':_0x48741c[_0x939a('0x19')]?_0x48741c['options']['attributes']||null:null,'limit':_0x48741c[_0x939a('0x19')]?_0x48741c[_0x939a('0x19')][_0x939a('0x1b')]||null:null})['then'](function(_0x588ccf){logger['info'](_0x939a('0x16'),_0x48741c);logger['debug'](_0x939a('0x16'),_0x48741c,JSON[_0x939a('0x1c')](_0x588ccf));_0x2a78c1(_0x588ccf);})['catch'](function(_0x2b345c){logger['error'](_0x939a('0x16'),_0x2b345c['message'],_0x48741c);_0x5e5dbd(_0x4e8e70[_0x939a('0x13')](0x1f4,_0x2b345c[_0x939a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 8c32f97..0a4f773 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 _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 +var _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1ec8f9,_0x22f5e7){var _0x17cd3d=function(_0x156ad2){while(--_0x156ad2){_0x1ec8f9['push'](_0x1ec8f9['shift']());}};_0x17cd3d(++_0x22f5e7);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x43e665,_0x2434b8){_0x43e665=_0x43e665-0x0;var _0x711f73=_0xd7d1[_0x43e665];return _0x711f73;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 203a5e7..b2f1bad 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 _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 +var _0x7708=['sequelize','exports','DATE','STRING','out','ENUM','INTEGER'];(function(_0x350979,_0x1e0e61){var _0xd51ab0=function(_0x5b2cd3){while(--_0x5b2cd3){_0x350979['push'](_0x350979['shift']());}};_0xd51ab0(++_0x1e0e61);}(_0x7708,0x188));var _0x8770=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x7708[_0x2389bc];return _0x170548;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8770('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8770('0x2')]},'fax':{'type':Sequelize[_0x8770('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8770('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8770('0x5')]('in',_0x8770('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x8770('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index c4d963c..c4df3c5 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 _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 +var _0xcfbe=['status','end','offset','undefined','limit','count','set','json','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','getOptions','findAll','fax','query','user','catch','show','params','FaxInteraction','keys','filters','intersection','model','attributes','fields','length','merge','find','create','body','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','include','addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','toString','tmp','join','root','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','existsSync','createWriteStream','basename','resolve','download','log','err','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x549c56,_0xc02b6a){var _0x385a97=function(_0x5f5c22){while(--_0x5f5c22){_0x549c56['push'](_0x549c56['shift']());}};_0x385a97(++_0xc02b6a);}(_0xcfbe,0x181));var _0xecfb=function(_0x1679cc,_0x242c53){_0x1679cc=_0x1679cc-0x0;var _0x4aaec8=_0xcfbe[_0x1679cc];return _0x4aaec8;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xecfb('0x0'));var moment=require(_0xecfb('0x1'));var BPromise=require(_0xecfb('0x2'));var util=require(_0xecfb('0x3'));var path=require(_0xecfb('0x4'));var fs=require('fs');var _=require(_0xecfb('0x5'));var Redis=require(_0xecfb('0x6'));var interaction=require(_0xecfb('0x7'));var qs=require(_0xecfb('0x8'));var logger=require('../../config/logger')(_0xecfb('0x9'));var config=require('../../config/environment');var db=require(_0xecfb('0xa'))['db'];config[_0xecfb('0xb')]=_['defaults'](config['redis'],{'host':_0xecfb('0xc'),'port':0x18eb});var socket=require(_0xecfb('0xd'))(new Redis(config[_0xecfb('0xb')]));require(_0xecfb('0xe'))['register'](socket);function respondWithStatusCode(_0x1e8e1a,_0x2d09be){_0x2d09be=_0x2d09be||0xcc;return function(_0x229623){if(_0x229623){return _0x1e8e1a['sendStatus'](_0x2d09be);}return _0x1e8e1a[_0xecfb('0xf')](_0x2d09be)[_0xecfb('0x10')]();};}function respondWithResult(_0x4a21c5,_0x550128){_0x550128=_0x550128||0xc8;return function(_0x3c548d){if(_0x3c548d){return _0x4a21c5[_0xecfb('0xf')](_0x550128)['json'](_0x3c548d);}};}function respondWithFilteredResult(_0x3e9d0e,_0x35e2b9){return function(_0x45778f){if(_0x45778f){var _0x2db17d=typeof _0x35e2b9[_0xecfb('0x11')]===_0xecfb('0x12')&&typeof _0x35e2b9[_0xecfb('0x13')]==='undefined';var _0x13f545=_0x45778f[_0xecfb('0x14')];var _0x5e098e=_0x2db17d?0x0:_0x35e2b9[_0xecfb('0x11')];var _0x4e09de=_0x2db17d?_0x45778f[_0xecfb('0x14')]:_0x35e2b9[_0xecfb('0x11')]+_0x35e2b9['limit'];var _0x391772;if(_0x4e09de>=_0x13f545){_0x4e09de=_0x13f545;_0x391772=0xc8;}else{_0x391772=0xce;}_0x3e9d0e[_0xecfb('0xf')](_0x391772);return _0x3e9d0e[_0xecfb('0x15')]('Content-Range',_0x5e098e+'-'+_0x4e09de+'/'+_0x13f545)[_0xecfb('0x16')](_0x45778f);}return null;};}function saveUpdates(_0x5932ce){return function(_0x49d557){if(_0x49d557){return _0x49d557['update'](_0x5932ce)[_0xecfb('0x17')](function(_0x62ebb6){return _0x62ebb6;});}return null;};}function removeEntity(_0x31ea58){return function(_0x37e655){if(_0x37e655){return _0x37e655[_0xecfb('0x18')]()[_0xecfb('0x17')](function(){_0x31ea58[_0xecfb('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df686){return function(_0x3e1ee9){if(!_0x3e1ee9){_0x1df686[_0xecfb('0x19')](0x194);}return _0x3e1ee9;};}function handleError(_0x1f68fc,_0x1de79c){_0x1de79c=_0x1de79c||0x1f4;return function(_0x38bddc){logger[_0xecfb('0x1a')](_0x38bddc[_0xecfb('0x1b')]);if(_0x38bddc[_0xecfb('0x1c')]){delete _0x38bddc['name'];}_0x1f68fc[_0xecfb('0xf')](_0x1de79c)[_0xecfb('0x1d')](_0x38bddc);};}exports[_0xecfb('0x1e')]=function(_0x53410c,_0x38143d){var _0x17b8a6={};var _0xde2fcd=_[_0xecfb('0x1f')](db['FaxInteraction'][_0xecfb('0x20')],function(_0x1582a0){return{'name':_0x1582a0[_0xecfb('0x21')],'type':_0x1582a0[_0xecfb('0x22')]['key']};});_0x17b8a6=qs[_0xecfb('0x23')](_0xde2fcd,_0x53410c);return interaction[_0xecfb('0x24')](_0xecfb('0x25'),_0x53410c[_0xecfb('0x26')],_0x53410c[_0xecfb('0x27')],_0x17b8a6,_0xde2fcd)['then'](respondWithFilteredResult(_0x38143d,_0x17b8a6))[_0xecfb('0x28')](handleError(_0x38143d,null));};exports[_0xecfb('0x29')]=function(_0x10579f,_0x526998){var _0x2b49c8={'raw':![],'where':{'id':_0x10579f[_0xecfb('0x2a')]['id']}},_0x4a7331={};_0x4a7331['model']=_['keys'](db[_0xecfb('0x2b')][_0xecfb('0x20')]);_0x4a7331[_0xecfb('0x26')]=_[_0xecfb('0x2c')](_0x10579f[_0xecfb('0x26')]);_0x4a7331[_0xecfb('0x2d')]=_[_0xecfb('0x2e')](_0x4a7331[_0xecfb('0x2f')],_0x4a7331['query']);_0x2b49c8[_0xecfb('0x30')]=_[_0xecfb('0x2e')](_0x4a7331[_0xecfb('0x2f')],qs['fields'](_0x10579f['query'][_0xecfb('0x31')]));_0x2b49c8[_0xecfb('0x30')]=_0x2b49c8['attributes'][_0xecfb('0x32')]?_0x2b49c8[_0xecfb('0x30')]:_0x4a7331[_0xecfb('0x2f')];if(_0x10579f['query']['includeAll']){_0x2b49c8['include']=[{'all':!![]}];}_0x2b49c8=_[_0xecfb('0x33')]({},_0x2b49c8,_0x10579f['options']);return db[_0xecfb('0x2b')][_0xecfb('0x34')](_0x2b49c8)[_0xecfb('0x17')](handleEntityNotFound(_0x526998,null))['then'](respondWithResult(_0x526998,null))[_0xecfb('0x28')](handleError(_0x526998,null));};exports[_0xecfb('0x35')]=function(_0x1c6bd6,_0x1476e3){return db[_0xecfb('0x2b')]['create'](_0x1c6bd6['body'],{})[_0xecfb('0x17')](respondWithResult(_0x1476e3,0xc9))[_0xecfb('0x28')](handleError(_0x1476e3,null));};exports['update']=function(_0x344f87,_0x1c37f0){if(_0x344f87[_0xecfb('0x36')]['id']){delete _0x344f87[_0xecfb('0x36')]['id'];}return db[_0xecfb('0x2b')][_0xecfb('0x34')]({'where':{'id':_0x344f87[_0xecfb('0x2a')]['id']}})[_0xecfb('0x17')](handleEntityNotFound(_0x1c37f0,null))[_0xecfb('0x17')](saveUpdates(_0x344f87[_0xecfb('0x36')],null))[_0xecfb('0x17')](respondWithResult(_0x1c37f0,null))[_0xecfb('0x28')](handleError(_0x1c37f0,null));};exports[_0xecfb('0x18')]=function(_0x439f52,_0x2239c2){return db[_0xecfb('0x2b')][_0xecfb('0x34')]({'where':{'id':_0x439f52[_0xecfb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2239c2,null))[_0xecfb('0x17')](removeEntity(_0x2239c2,null))[_0xecfb('0x28')](handleError(_0x2239c2,null));};exports[_0xecfb('0x37')]=function(_0xd8719c,_0x13e3a0){return db['FaxInteraction'][_0xecfb('0x37')]()[_0xecfb('0x17')](respondWithResult(_0x13e3a0,null))[_0xecfb('0x28')](handleError(_0x13e3a0,null));};exports['addMessage']=function(_0xd64a6,_0x173809){return db[_0xecfb('0x38')]['find']({'where':{'id':_0xd64a6[_0xecfb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x173809,null))[_0xecfb('0x17')](function(_0x68b811){if(_0x68b811){return _0x68b811[_0xecfb('0x39')](_0xd64a6['body'][_0xecfb('0x3a')],_[_0xecfb('0x3b')](_0xd64a6[_0xecfb('0x36')],[_0xecfb('0x3a'),'id'])||{});}})[_0xecfb('0x17')](respondWithResult(_0x173809,null))['catch'](handleError(_0x173809,null));};exports[_0xecfb('0x3c')]=function(_0x251dd2,_0x5e54dc){var _0x1bad1a={'raw':![],'where':{}};var _0x1988a7={};var _0x5708ed={'count':0x0,'rows':[]};return db[_0xecfb('0x2b')][_0xecfb('0x3d')]({'where':{'id':_0x251dd2[_0xecfb('0x2a')]['id']}})[_0xecfb('0x17')](handleEntityNotFound(_0x5e54dc,null))[_0xecfb('0x17')](function(_0x53ff6d){if(_0x53ff6d){_0x1988a7['model']=_[_0xecfb('0x2c')](db['FaxMessage'][_0xecfb('0x20')]);_0x1988a7[_0xecfb('0x26')]=_['keys'](_0x251dd2['query']);_0x1988a7[_0xecfb('0x2d')]=_[_0xecfb('0x2e')](_0x1988a7['model'],_0x1988a7[_0xecfb('0x26')]);_0x1bad1a['attributes']=_[_0xecfb('0x2e')](_0x1988a7['model'],qs[_0xecfb('0x31')](_0x251dd2['query'][_0xecfb('0x31')]));_0x1bad1a[_0xecfb('0x30')]=_0x1bad1a['attributes']['length']?_0x1bad1a['attributes']:_0x1988a7[_0xecfb('0x2f')];if(!_0x251dd2['query'][_0xecfb('0x3e')](_0xecfb('0x3f'))){_0x1bad1a[_0xecfb('0x13')]=qs[_0xecfb('0x13')](_0x251dd2[_0xecfb('0x26')][_0xecfb('0x13')]);_0x1bad1a[_0xecfb('0x11')]=qs[_0xecfb('0x11')](_0x251dd2[_0xecfb('0x26')][_0xecfb('0x11')]);}_0x1bad1a[_0xecfb('0x40')]=qs[_0xecfb('0x41')](_0x251dd2['query']['sort']);_0x1bad1a['where']=qs[_0xecfb('0x2d')](_['pick'](_0x251dd2[_0xecfb('0x26')],_0x1988a7[_0xecfb('0x2d')]));_0x1bad1a[_0xecfb('0x42')][_0xecfb('0x43')]=_0x53ff6d['id'];if(_0x251dd2[_0xecfb('0x26')]['filter']){_0x1bad1a['where']=_['merge'](_0x1bad1a['where'],{'$or':_[_0xecfb('0x1f')](_0x1bad1a[_0xecfb('0x30')],function(_0x9dcbe6){var _0x59fc42={};_0x59fc42[_0x9dcbe6]={'$like':'%'+_0x251dd2[_0xecfb('0x26')][_0xecfb('0x44')]+'%'};return _0x59fc42;})});}if(_0x251dd2['query'][_0xecfb('0x45')]){var _0x135586=_0x251dd2[_0xecfb('0x26')][_0xecfb('0x45')][_0xecfb('0x46')](',');var _0x11642d={};_0x11642d[_0x135586[0x0]]={'$gte':moment(_0x135586[0x1])['format'](_0xecfb('0x47'))};_0x1bad1a[_0xecfb('0x42')]=_['merge'](_0x1bad1a['where'],_0x11642d);}_0x1bad1a=_['merge']({},_0x1bad1a,_0x251dd2[_0xecfb('0x48')]);return db[_0xecfb('0x38')][_0xecfb('0x14')]({'where':_0x1bad1a[_0xecfb('0x42')]})['then'](function(_0x5d8d36){_0x5708ed[_0xecfb('0x14')]=_0x5d8d36;if(_0x251dd2[_0xecfb('0x26')][_0xecfb('0x49')]){_0x1bad1a[_0xecfb('0x4a')]=[{'all':!![]}];}return db[_0xecfb('0x38')][_0xecfb('0x24')](_0x1bad1a);})[_0xecfb('0x17')](function(_0x11e7b6){_0x5708ed['rows']=_0x11e7b6;return _0x5708ed;});}})[_0xecfb('0x17')](respondWithFilteredResult(_0x5e54dc,_0x1bad1a))[_0xecfb('0x28')](handleError(_0x5e54dc,null));};exports[_0xecfb('0x4b')]=function(_0x4a1b91,_0x47daa0){return db[_0xecfb('0x2b')][_0xecfb('0x34')]({'where':{'id':_0x4a1b91['params']['id']}})['then'](handleEntityNotFound(_0x47daa0,null))['then'](function(_0x9555d5){if(_0x9555d5){return _0x9555d5[_0xecfb('0x4c')](_0x4a1b91[_0xecfb('0x36')][_0xecfb('0x3a')],_['omit'](_0x4a1b91['body'],[_0xecfb('0x3a'),'id'])||{})[_0xecfb('0x4d')](function(){return db[_0xecfb('0x4e')][_0xecfb('0x24')]({'attributes':['id','name',_0xecfb('0x4f')],'where':{'id':_0x4a1b91['body']['ids']}});})[_0xecfb('0x17')](function(_0x531555){socket['emit'](_0xecfb('0x50'),{'id':Number(_0x4a1b91[_0xecfb('0x2a')]['id']),'tags':_0x531555||[]});return{'id':Number(_0x4a1b91[_0xecfb('0x2a')]['id']),'tags':_0x531555||[]};});}})['then'](respondWithResult(_0x47daa0,null))['catch'](handleError(_0x47daa0,null));};exports['removeTags']=function(_0x4b1d33,_0x3913b1){return db[_0xecfb('0x2b')][_0xecfb('0x34')]({'where':{'id':_0x4b1d33[_0xecfb('0x2a')]['id']}})[_0xecfb('0x17')](handleEntityNotFound(_0x3913b1,null))[_0xecfb('0x17')](function(_0x303067){if(_0x303067){return _0x303067[_0xecfb('0x51')](_0x4b1d33['query'][_0xecfb('0x3a')]);}})[_0xecfb('0x17')](respondWithStatusCode(_0x3913b1,null))['catch'](handleError(_0x3913b1,null));};exports['download']=function(_0x431e54,_0x231dad){var _0x378d49=moment()['unix']()[_0xecfb('0x52')]();var _0x272271=path['join'](config['root'],'server','files',_0xecfb('0x53'));var _0x36bbc7=path[_0xecfb('0x54')](config[_0xecfb('0x55')],'server','files',_0xecfb('0x56'));var _0x48151c=path[_0xecfb('0x54')](_0x272271,_0x378d49);var _0x56085e=util[_0xecfb('0x57')](_0xecfb('0x58'),_0x431e54[_0xecfb('0x2a')]['id'],_0x378d49);var _0x19fbf8=path[_0xecfb('0x54')](_0x272271,_0x56085e);var _0x5f22ff=[];_0x5f22ff['push']({'model':db[_0xecfb('0x59')],'as':_0xecfb('0x59'),'raw':!![]});var _0x4e6c8d=[{'model':db[_0xecfb('0x38')],'as':_0xecfb('0x5a'),'attributes':['id',_0xecfb('0x36'),_0xecfb('0x5b')],'include':_0x5f22ff}];return db[_0xecfb('0x2b')][_0xecfb('0x34')]({'where':{'id':_0x431e54['params']['id']},'include':_0x4e6c8d})[_0xecfb('0x17')](handleEntityNotFound(_0x231dad,null))[_0xecfb('0x17')](function(_0x156972){if(_0x156972&&_0x156972[_0xecfb('0x5a')]){var _0x53f9f0=_0x156972['get']({'plain':!![]});fs[_0xecfb('0x5c')](_0x48151c);for(var _0x24209e=0x0;_0x24209e<_0x53f9f0['Messages'][_0xecfb('0x32')];_0x24209e++){var _0x2cd682=_0x53f9f0[_0xecfb('0x5a')][_0x24209e]['Attachment'];if(_0x2cd682){var _0x5ad9ae=path[_0xecfb('0x54')](_0x36bbc7,_0x2cd682['basename']);if(fs[_0xecfb('0x5d')](_0x5ad9ae)){fs['createReadStream'](_0x5ad9ae)['pipe'](fs[_0xecfb('0x5e')](path[_0xecfb('0x54')](_0x48151c,_0x2cd682[_0xecfb('0x5f')])));}}}return BPromise[_0xecfb('0x60')]()['then'](function(){return new BPromise(function(_0x86113c,_0xc847b2){zipdir(_0x48151c,{'saveTo':_0x19fbf8},function(_0x4b9ac4,_0xff5edb){if(_0x4b9ac4)return _0xc847b2(_0x4b9ac4);return _0x86113c(_0xff5edb);});})[_0xecfb('0x17')](function(){return new BPromise(function(_0x2bda52,_0x3eb426){rimraf(_0x48151c,function(_0x205c12){if(_0x205c12)_0x3eb426(_0x205c12);return _0x2bda52();});});})[_0xecfb('0x17')](function(){return _0x231dad[_0xecfb('0x61')](_0x19fbf8,_0x56085e,function(_0x58091c){if(_0x58091c){console[_0xecfb('0x62')](_0xecfb('0x63'),_0x58091c);}else{fs['unlinkSync'](_0x19fbf8);}});});});}else{return _0x231dad[_0xecfb('0x19')](0xc8);}})[_0xecfb('0x28')](handleError(_0x231dad,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index ea23c8d..70f0788 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 _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 +var _0x5f14=['../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','findAll','then','setDataValue','length','emit','hasOwnProperty','hook','exports','events'];(function(_0x240c3d,_0x481a90){var _0x59b6a7=function(_0x417fd2){while(--_0x417fd2){_0x240c3d['push'](_0x240c3d['shift']());}};_0x59b6a7(++_0x481a90);}(_0x5f14,0x1a8));var _0x45f1=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x5f14[_0x2652ef];return _0x2db578;};'use strict';var EventEmitter=require(_0x45f1('0x0'));var FaxInteraction=require(_0x45f1('0x1'))['db'][_0x45f1('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x45f1('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x45f1('0x4')](0x0);var events={'afterCreate':_0x45f1('0x5'),'afterUpdate':_0x45f1('0x6'),'afterDestroy':_0x45f1('0x7')};function emitEvent(_0x103ec9){return function(_0x1b0ba6,_0x2ad061,_0x138242){_0x1b0ba6[_0x45f1('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd932f6){_0x1b0ba6['setDataValue']('Users',_0xd932f6['map'](function(_0x362570){return{'id':_0x362570['id']};}));return FaxMessage[_0x45f1('0x9')]({'where':{'FaxInteractionId':_0x1b0ba6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x45f1('0xa')](function(_0x26cbf1){_0x1b0ba6[_0x45f1('0xb')]('unreadMessages',_0x26cbf1[_0x45f1('0xc')]);FaxInteractionEvents[_0x45f1('0xd')](_0x103ec9+':'+_0x1b0ba6['id'],_0x1b0ba6);FaxInteractionEvents['emit'](_0x103ec9,_0x1b0ba6);_0x138242(null);})['catch'](_0x138242(null));};}for(var e in events){if(events[_0x45f1('0xe')](e)){var event=events[e];FaxInteraction[_0x45f1('0xf')](e,emitEvent(event));}}module[_0x45f1('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index df1dbab..92e7b78 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 _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 +var _0x7335=['./faxInteraction.attributes','define','FaxInteraction','fax_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x7335,0x74));var _0x5733=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x7335[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0x5733('0x0'));var logger=require(_0x5733('0x1'))(_0x5733('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5733('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5733('0x4'));module['exports']=function(_0x26d441,_0x51dc7b){return _0x26d441[_0x5733('0x5')](_0x5733('0x6'),attributes,{'tableName':_0x5733('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22e403,_0x840917,_0x1eedd4){if(_0x22e403['changed'](_0x5733('0x8'))){_0x22e403[_0x5733('0x9')]=moment()[_0x5733('0xa')](_0x5733('0xb'));}_0x1eedd4(null,_0x22e403);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1995b09..6123098 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 _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 +var _0xee06=['register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','body','options','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0xee06,0x1f4));var _0x6ee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee06[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6ee0('0x0'));var util=require(_0x6ee0('0x1'));var moment=require(_0x6ee0('0x2'));var BPromise=require('bluebird');var rs=require(_0x6ee0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ee0('0x4'))['db'];var utils=require(_0x6ee0('0x5'));var logger=require(_0x6ee0('0x6'))(_0x6ee0('0x7'));var config=require(_0x6ee0('0x8'));var jayson=require(_0x6ee0('0x9'));var client=jayson[_0x6ee0('0xa')][_0x6ee0('0xb')]({'port':0x232a});config[_0x6ee0('0xc')]=_['defaults'](config[_0x6ee0('0xc')],{'host':_0x6ee0('0xd'),'port':0x18eb});var socket=require(_0x6ee0('0xe'))(new Redis(config['redis']));require(_0x6ee0('0xf'))[_0x6ee0('0x10')](socket);function respondWithRpcPromise(_0x3a928c,_0x140a0e,_0x31221c){return new BPromise(function(_0xc165bf,_0x1522a5){return client[_0x6ee0('0x11')](_0x3a928c,_0x31221c)[_0x6ee0('0x12')](function(_0x3ea207){logger[_0x6ee0('0x13')](_0x6ee0('0x14'),_0x140a0e,_0x6ee0('0x15'));logger[_0x6ee0('0x16')](_0x6ee0('0x17'),_0x140a0e,'request\x20sent',JSON[_0x6ee0('0x18')](_0x3ea207));if(_0x3ea207[_0x6ee0('0x19')]){if(_0x3ea207[_0x6ee0('0x19')]['code']===0x1f4){logger[_0x6ee0('0x19')](_0x6ee0('0x14'),_0x140a0e,_0x3ea207[_0x6ee0('0x19')][_0x6ee0('0x1a')]);return _0x1522a5(_0x3ea207[_0x6ee0('0x19')][_0x6ee0('0x1a')]);}logger[_0x6ee0('0x19')](_0x6ee0('0x14'),_0x140a0e,_0x3ea207[_0x6ee0('0x19')][_0x6ee0('0x1a')]);return _0xc165bf(_0x3ea207[_0x6ee0('0x19')][_0x6ee0('0x1a')]);}else{logger['info'](_0x6ee0('0x14'),_0x140a0e,'request\x20sent');_0xc165bf(_0x3ea207[_0x6ee0('0x1b')][_0x6ee0('0x1a')]);}})[_0x6ee0('0x1c')](function(_0x208846){logger['error'](_0x6ee0('0x14'),_0x140a0e,_0x208846);_0x1522a5(_0x208846);});});}exports['UpdateFaxInteraction']=function(_0x36100b){var _0x221211=this;return new Promise(function(_0x19d7a6,_0x83513a){return db['FaxInteraction'][_0x6ee0('0x1d')](_0x36100b[_0x6ee0('0x1e')],{'raw':_0x36100b[_0x6ee0('0x1f')]?_0x36100b[_0x6ee0('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36100b[_0x6ee0('0x1f')]?_0x36100b['options'][_0x6ee0('0x20')]||null:null,'attributes':_0x36100b[_0x6ee0('0x1f')]?_0x36100b[_0x6ee0('0x1f')][_0x6ee0('0x21')]||null:null,'limit':_0x36100b[_0x6ee0('0x1f')]?_0x36100b['options'][_0x6ee0('0x22')]||null:null})[_0x6ee0('0x12')](function(_0x270bef){logger[_0x6ee0('0x13')](_0x6ee0('0x23'),_0x36100b);logger[_0x6ee0('0x16')](_0x6ee0('0x23'),_0x36100b,JSON[_0x6ee0('0x18')](_0x270bef));_0x19d7a6(_0x270bef);})[_0x6ee0('0x1c')](function(_0x8659ec){logger['error'](_0x6ee0('0x23'),_0x8659ec[_0x6ee0('0x1a')],_0x36100b);_0x83513a(_0x221211[_0x6ee0('0x19')](0x1f4,_0x8659ec[_0x6ee0('0x1a')]));});});};exports[_0x6ee0('0x24')]=function(_0x2d5b75){return new Promise(function(_0x409a9e,_0x1cdbc1){return db[_0x6ee0('0x25')]['find']({'where':_0x2d5b75[_0x6ee0('0x1f')]?_0x2d5b75['options'][_0x6ee0('0x20')]||null:null})[_0x6ee0('0x12')](function(_0x2a159a){if(_0x2a159a){return _0x2a159a[_0x6ee0('0x26')](_0x2d5b75['body'][_0x6ee0('0x27')],_[_0x6ee0('0x28')](_0x2d5b75[_0x6ee0('0x1e')],[_0x6ee0('0x27'),'id'])||{});}})[_0x6ee0('0x29')](function(_0x40e637){logger[_0x6ee0('0x13')](_0x6ee0('0x2a'),_0x2d5b75);logger['debug']('AddTags',_0x2d5b75,JSON[_0x6ee0('0x18')](_0x40e637));_0x409a9e(_0x40e637);})[_0x6ee0('0x1c')](function(_0x8d7055){logger['error'](_0x6ee0('0x2a'),_0x8d7055[_0x6ee0('0x1a')],_0x2d5b75);_0x1cdbc1(_this['error'](0x1f4,_0x8d7055[_0x6ee0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c28fb93..270f6a7 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 _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 +var _0x25b3=['faxInteraction:','./faxInteraction.events','save','remove','update','removeListener'];(function(_0x584211,_0x263ced){var _0x4b5ae0=function(_0x58a2ba){while(--_0x58a2ba){_0x584211['push'](_0x584211['shift']());}};_0x4b5ae0(++_0x263ced);}(_0x25b3,0x1e7));var _0x325b=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x25b3[_0x3de7e0];return _0x11d0b3;};'use strict';var FaxInteractionEvents=require(_0x325b('0x0'));var events=[_0x325b('0x1'),_0x325b('0x2'),_0x325b('0x3')];function createListener(_0xbbe492,_0x53de28){return function(_0x52dea1){_0x53de28['emit'](_0xbbe492,_0x52dea1);};}function removeListener(_0x198ab9,_0xc62420){return function(){FaxInteractionEvents[_0x325b('0x4')](_0x198ab9,_0xc62420);};}exports['register']=function(_0x260c16){for(var _0xa58a51=0x0,_0x4dd354=events['length'];_0xa58a51<_0x4dd354;_0xa58a51++){var _0x12bd2b=events[_0xa58a51];var _0x1f7304=createListener(_0x325b('0x5')+_0x12bd2b,_0x260c16);FaxInteractionEvents['on'](_0x12bd2b,_0x1f7304);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b18157d..9bb0dde 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 _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 +var _0x1b11=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','create','post','fax','faxinteraction:addtags','addTags','put','tracked','delete','/:id','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer'];(function(_0xa6ab87,_0x4fc633){var _0x1e89c3=function(_0x543dcb){while(--_0x543dcb){_0xa6ab87['push'](_0xa6ab87['shift']());}};_0x1e89c3(++_0x4fc633);}(_0x1b11,0xf7));var _0x11b1=function(_0x319c42,_0x23dcf2){_0x319c42=_0x319c42-0x0;var _0x1a7994=_0x1b11[_0x319c42];return _0x1a7994;};'use strict';var multer=require(_0x11b1('0x0'));var util=require(_0x11b1('0x1'));var path=require('path');var timeout=require(_0x11b1('0x2'));var express=require('express');var router=express[_0x11b1('0x3')]();var fs_extra=require(_0x11b1('0x4'));var auth=require(_0x11b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x11b1('0x6'));var controller=require(_0x11b1('0x7'));router[_0x11b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x11b1('0x9')]);router[_0x11b1('0x8')](_0x11b1('0xa'),auth[_0x11b1('0xb')](),controller[_0x11b1('0xc')]);router[_0x11b1('0x8')]('/:id',auth[_0x11b1('0xb')](),controller[_0x11b1('0xd')]);router[_0x11b1('0x8')](_0x11b1('0xe'),auth[_0x11b1('0xb')](),controller[_0x11b1('0xf')]);router[_0x11b1('0x8')](_0x11b1('0x10'),auth[_0x11b1('0xb')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x11b1('0x11')]);router[_0x11b1('0x12')](_0x11b1('0xe'),auth[_0x11b1('0xb')](),controller['addMessage']);router[_0x11b1('0x12')]('/:id/tags',auth[_0x11b1('0xb')](),interaction['tracked'](_0x11b1('0x13'),_0x11b1('0x14')),controller[_0x11b1('0x15')]);router[_0x11b1('0x16')]('/:id',auth[_0x11b1('0xb')](),interaction[_0x11b1('0x17')](_0x11b1('0x13'),'faxinteraction:update'),controller['update']);router[_0x11b1('0x18')](_0x11b1('0x19'),auth[_0x11b1('0xb')](),interaction[_0x11b1('0x17')](_0x11b1('0x13'),_0x11b1('0x1a')),controller[_0x11b1('0x1b')]);router[_0x11b1('0x18')](_0x11b1('0x1c'),auth['isAuthenticated'](),controller[_0x11b1('0x1d')]);module[_0x11b1('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 31b57dc..6d6eb5b 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 _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 +var _0xb43b=['TEXT','DATE','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x3116d6,_0x2d574f){var _0x18729d=function(_0x1945a0){while(--_0x1945a0){_0x3116d6['push'](_0x3116d6['shift']());}};_0x18729d(++_0x2d574f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x148721,_0x55806c){_0x148721=_0x148721-0x0;var _0x289544=_0xb43b[_0x148721];return _0x289544;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbb43('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb43('0x4')]('in','out'),'defaultValue':_0xbb43('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index d2e5d9e..1f90c81 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 _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 +var _0xa466=['channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','sequelize','Sequelize','SIP/%s','rejectmessage','create','CmContact','ContactId','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','User','fullname','email','internal','interface'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0xa466,0x140));var _0x6a46=function(_0x17e653,_0x4c21e9){_0x17e653=_0x17e653-0x0;var _0x4341a1=_0xa466[_0x17e653];return _0x4341a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a46('0x0'));var zipdir=require(_0x6a46('0x1'));var jsonpatch=require(_0x6a46('0x2'));var rp=require('request-promise');var moment=require(_0x6a46('0x3'));var BPromise=require(_0x6a46('0x4'));var Mustache=require(_0x6a46('0x5'));var util=require(_0x6a46('0x6'));var path=require(_0x6a46('0x7'));var sox=require(_0x6a46('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a46('0x9'));var _=require('lodash');var squel=require(_0x6a46('0xa'));var crypto=require(_0x6a46('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a46('0xc'));var toCsv=require(_0x6a46('0xd'));var querystring=require(_0x6a46('0xe'));var Papa=require(_0x6a46('0xf'));var Redis=require(_0x6a46('0x10'));var authService=require(_0x6a46('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6a46('0x12'));var hardwareService=require(_0x6a46('0x13'));var logger=require(_0x6a46('0x14'))(_0x6a46('0x15'));var utils=require(_0x6a46('0x16'));var config=require(_0x6a46('0x17'));var licenseUtil=require(_0x6a46('0x18'));var db=require(_0x6a46('0x19'))['db'];config[_0x6a46('0x1a')]=_['defaults'](config[_0x6a46('0x1a')],{'host':_0x6a46('0x1b'),'port':0x18eb});var socket=require(_0x6a46('0x1c'))(new Redis(config[_0x6a46('0x1a')]));require(_0x6a46('0x1d'))['register'](socket);var jayson=require(_0x6a46('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x6a46('0x1f')][_0x6a46('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x46a00e,_0x3969bb,_0x3ffa20,_0x87f1e6){return new BPromise(function(_0x21d991,_0x84a781){var _0x2d0cde=_0x87f1e6||client;return _0x2d0cde['request'](_0x46a00e,_0x3ffa20)[_0x6a46('0x21')](function(_0x1f75b8){logger[_0x6a46('0x22')](_0x6a46('0x23'),_0x3969bb,_0x6a46('0x24'));logger[_0x6a46('0x25')](_0x6a46('0x26'),_0x3969bb,_0x6a46('0x24'),JSON[_0x6a46('0x27')](_0x1f75b8));if(_0x1f75b8['error']){if(_0x1f75b8[_0x6a46('0x28')]['code']===0x1f4){logger[_0x6a46('0x28')](_0x6a46('0x23'),_0x3969bb,_0x1f75b8[_0x6a46('0x28')]['message']);return _0x84a781(_0x1f75b8[_0x6a46('0x28')][_0x6a46('0x29')]);}logger[_0x6a46('0x28')](_0x6a46('0x23'),_0x3969bb,_0x1f75b8[_0x6a46('0x28')][_0x6a46('0x29')]);return _0x21d991(_0x1f75b8['error'][_0x6a46('0x29')]);}else{logger[_0x6a46('0x22')](_0x6a46('0x23'),_0x3969bb,_0x6a46('0x24'));_0x21d991(_0x1f75b8[_0x6a46('0x2a')]['message']);}})[_0x6a46('0x2b')](function(_0x3c60a4){logger[_0x6a46('0x28')](_0x6a46('0x23'),_0x3969bb,_0x3c60a4);_0x84a781(_0x3c60a4);});});}function respondWithStatusCode(_0x54988b,_0x312c4b){_0x312c4b=_0x312c4b||0xcc;return function(_0x2e55b4){if(_0x2e55b4){return _0x54988b[_0x6a46('0x2c')](_0x312c4b);}return _0x54988b[_0x6a46('0x2d')](_0x312c4b)['end']();};}function respondWithResult(_0x1239aa,_0x3005e2){_0x3005e2=_0x3005e2||0xc8;return function(_0x2aa9dc){if(_0x2aa9dc){return _0x1239aa[_0x6a46('0x2d')](_0x3005e2)[_0x6a46('0x2e')](_0x2aa9dc);}};}function respondWithFilteredResult(_0x1c2627,_0x539221){return function(_0x427a28){if(_0x427a28){var _0x506729=typeof _0x539221[_0x6a46('0x2f')]===_0x6a46('0x30')&&typeof _0x539221[_0x6a46('0x31')]===_0x6a46('0x30');var _0x15e56e=_0x427a28[_0x6a46('0x32')];var _0x371899=_0x506729?0x0:_0x539221[_0x6a46('0x2f')];var _0x202a8e=_0x506729?_0x427a28['count']:_0x539221[_0x6a46('0x2f')]+_0x539221[_0x6a46('0x31')];var _0x567c04;if(_0x202a8e>=_0x15e56e){_0x202a8e=_0x15e56e;_0x567c04=0xc8;}else{_0x567c04=0xce;}_0x1c2627[_0x6a46('0x2d')](_0x567c04);return _0x1c2627[_0x6a46('0x33')](_0x6a46('0x34'),_0x371899+'-'+_0x202a8e+'/'+_0x15e56e)['json'](_0x427a28);}return null;};}function patchUpdates(_0x24c62c){return function(_0x24f386){try{jsonpatch[_0x6a46('0x35')](_0x24f386,_0x24c62c,!![]);}catch(_0x803595){return BPromise[_0x6a46('0x36')](_0x803595);}return _0x24f386[_0x6a46('0x37')]();};}function saveUpdates(_0x2d41fc,_0x2feb4d){return function(_0x71a194){if(_0x71a194){return _0x71a194[_0x6a46('0x38')](_0x2d41fc)[_0x6a46('0x21')](function(_0x46c02c){return _0x46c02c;});}return null;};}function removeEntity(_0x2dc634,_0x471275){return function(_0x25ef2b){if(_0x25ef2b){return _0x25ef2b[_0x6a46('0x39')]()[_0x6a46('0x21')](function(){_0x2dc634[_0x6a46('0x2d')](0xcc)[_0x6a46('0x3a')]();});}};}function handleEntityNotFound(_0x3203eb,_0x250ef9){return function(_0x46353b){if(!_0x46353b){_0x3203eb[_0x6a46('0x2c')](0x194);}return _0x46353b;};}function handleError(_0x523268,_0x5e4b19){_0x5e4b19=_0x5e4b19||0x1f4;return function(_0x234ef4){logger[_0x6a46('0x28')](_0x234ef4['stack']);if(_0x234ef4[_0x6a46('0x3b')]){delete _0x234ef4[_0x6a46('0x3b')];}_0x523268[_0x6a46('0x2d')](_0x5e4b19)[_0x6a46('0x3c')](_0x234ef4);};}exports[_0x6a46('0x3d')]=function(_0x28b08b,_0x517ba9){var _0x56e47e={},_0x22eabf={},_0x4d9703={'count':0x0,'rows':[]};var _0x589c8a=_[_0x6a46('0x3e')](db[_0x6a46('0x3f')][_0x6a46('0x40')],function(_0x2fc5cf){return{'name':_0x2fc5cf[_0x6a46('0x41')],'type':_0x2fc5cf[_0x6a46('0x42')][_0x6a46('0x43')]};});_0x22eabf['model']=_[_0x6a46('0x3e')](_0x589c8a,'name');_0x22eabf[_0x6a46('0x44')]=_[_0x6a46('0x45')](_0x28b08b['query']);_0x22eabf['filters']=_[_0x6a46('0x46')](_0x22eabf[_0x6a46('0x47')],_0x22eabf[_0x6a46('0x44')]);_0x56e47e[_0x6a46('0x48')]=_[_0x6a46('0x46')](_0x22eabf['model'],qs[_0x6a46('0x49')](_0x28b08b[_0x6a46('0x44')][_0x6a46('0x49')]));_0x56e47e[_0x6a46('0x48')]=_0x56e47e[_0x6a46('0x48')][_0x6a46('0x4a')]?_0x56e47e['attributes']:_0x22eabf[_0x6a46('0x47')];if(!_0x28b08b[_0x6a46('0x44')][_0x6a46('0x4b')](_0x6a46('0x4c'))){_0x56e47e[_0x6a46('0x31')]=qs[_0x6a46('0x31')](_0x28b08b[_0x6a46('0x44')][_0x6a46('0x31')]);_0x56e47e[_0x6a46('0x2f')]=qs[_0x6a46('0x2f')](_0x28b08b[_0x6a46('0x44')]['offset']);}_0x56e47e[_0x6a46('0x4d')]=qs[_0x6a46('0x4e')](_0x28b08b[_0x6a46('0x44')][_0x6a46('0x4e')]);_0x56e47e[_0x6a46('0x4f')]=qs[_0x6a46('0x50')](_[_0x6a46('0x51')](_0x28b08b[_0x6a46('0x44')],_0x22eabf[_0x6a46('0x50')]),_0x589c8a);if(_0x28b08b[_0x6a46('0x44')][_0x6a46('0x52')]){_0x56e47e[_0x6a46('0x4f')]=_[_0x6a46('0x53')](_0x56e47e['where'],{'$or':_['map'](_0x589c8a,function(_0x57108e){if(_0x57108e[_0x6a46('0x42')]!==_0x6a46('0x54')){var _0x3ca861={};_0x3ca861[_0x57108e[_0x6a46('0x3b')]]={'$like':'%'+_0x28b08b[_0x6a46('0x44')][_0x6a46('0x52')]+'%'};return _0x3ca861;}})});}_0x56e47e=_['merge']({},_0x56e47e,_0x28b08b[_0x6a46('0x55')]);var _0x3c0e07={'where':_0x56e47e[_0x6a46('0x4f')]};return db[_0x6a46('0x3f')][_0x6a46('0x32')](_0x3c0e07)['then'](function(_0x15d339){_0x4d9703[_0x6a46('0x32')]=_0x15d339;if(_0x28b08b[_0x6a46('0x44')][_0x6a46('0x56')]){_0x56e47e[_0x6a46('0x57')]=[{'all':!![]}];}return db[_0x6a46('0x3f')][_0x6a46('0x58')](_0x56e47e);})[_0x6a46('0x21')](function(_0x335caa){_0x4d9703['rows']=_0x335caa;return _0x4d9703;})[_0x6a46('0x21')](respondWithFilteredResult(_0x517ba9,_0x56e47e))[_0x6a46('0x2b')](handleError(_0x517ba9,null));};exports[_0x6a46('0x59')]=function(_0x237fa8,_0x386aa3){var _0x4c0719={'raw':!![],'where':{'id':_0x237fa8[_0x6a46('0x5a')]['id']}},_0x145b1f={};_0x145b1f[_0x6a46('0x47')]=_[_0x6a46('0x45')](db[_0x6a46('0x3f')]['rawAttributes']);_0x145b1f[_0x6a46('0x44')]=_[_0x6a46('0x45')](_0x237fa8[_0x6a46('0x44')]);_0x145b1f[_0x6a46('0x50')]=_[_0x6a46('0x46')](_0x145b1f['model'],_0x145b1f[_0x6a46('0x44')]);_0x4c0719['attributes']=_['intersection'](_0x145b1f[_0x6a46('0x47')],qs[_0x6a46('0x49')](_0x237fa8['query'][_0x6a46('0x49')]));_0x4c0719[_0x6a46('0x48')]=_0x4c0719[_0x6a46('0x48')][_0x6a46('0x4a')]?_0x4c0719[_0x6a46('0x48')]:_0x145b1f[_0x6a46('0x47')];if(_0x237fa8['query']['includeAll']){_0x4c0719[_0x6a46('0x57')]=[{'all':!![]}];}_0x4c0719=_['merge']({},_0x4c0719,_0x237fa8['options']);return db[_0x6a46('0x3f')][_0x6a46('0x5b')](_0x4c0719)[_0x6a46('0x21')](handleEntityNotFound(_0x386aa3,null))[_0x6a46('0x21')](respondWithResult(_0x386aa3,null))[_0x6a46('0x2b')](handleError(_0x386aa3,null));};exports[_0x6a46('0x38')]=function(_0x1bc7f2,_0x53e78f){if(_0x1bc7f2['body']['id']){delete _0x1bc7f2['body']['id'];}return db[_0x6a46('0x3f')][_0x6a46('0x5b')]({'where':{'id':_0x1bc7f2[_0x6a46('0x5a')]['id']}})['then'](handleEntityNotFound(_0x53e78f,null))[_0x6a46('0x21')](saveUpdates(_0x1bc7f2[_0x6a46('0x5c')],null))[_0x6a46('0x21')](respondWithResult(_0x53e78f,null))['catch'](handleError(_0x53e78f,null));};exports[_0x6a46('0x39')]=function(_0x42ab8b,_0x3abd97){return db[_0x6a46('0x3f')][_0x6a46('0x5b')]({'where':{'id':_0x42ab8b[_0x6a46('0x5a')]['id']}})[_0x6a46('0x21')](handleEntityNotFound(_0x3abd97,null))[_0x6a46('0x21')](removeEntity(_0x3abd97,null))[_0x6a46('0x2b')](handleError(_0x3abd97,null));};exports[_0x6a46('0x5d')]=function(_0x20c35f,_0x232169){return db[_0x6a46('0x3f')][_0x6a46('0x5d')]()[_0x6a46('0x21')](respondWithResult(_0x232169,null))[_0x6a46('0x2b')](handleError(_0x232169,null));};var interaction_log=require(_0x6a46('0x14'))(_0x6a46('0x5e'));exports[_0x6a46('0x5f')]=function(_0x2682d2,_0x478628,_0x5aed2d){var _0x382ee5={'agent':{},'channel':_0x6a46('0x60')};if(_0x2682d2[_0x6a46('0x5c')]['id']){delete _0x2682d2[_0x6a46('0x5c')]['id'];}_0x2682d2[_0x6a46('0x5c')][_0x6a46('0x61')]=!![];_0x2682d2['body'][_0x6a46('0x62')]=moment()[_0x6a46('0x63')](_0x6a46('0x64'));_0x2682d2[_0x6a46('0x5c')][_0x6a46('0x65')]=_0x2682d2[_0x6a46('0x5c')][_0x6a46('0x65')]||_0x2682d2[_0x6a46('0x66')]['id'];_0x382ee5[_0x6a46('0x67')]['id']=_0x2682d2['body']['UserId'];return db[_0x6a46('0x3f')][_0x6a46('0x5b')]({'where':{'id':_0x2682d2['params']['id'],'UserId':null}})[_0x6a46('0x21')](handleEntityNotFound(_0x478628,null))[_0x6a46('0x21')](saveUpdates(_0x2682d2['body'],null))['then'](function(_0x494e35){if(_0x494e35){_0x382ee5['message']=_0x494e35[_0x6a46('0x68')]({'plain':!![]});return db[_0x6a46('0x69')][_0x6a46('0x5b')]({'where':{'id':_0x494e35[_0x6a46('0x6a')]}});}return null;})[_0x6a46('0x21')](handleEntityNotFound(_0x478628,null))['then'](function(_0x392c3b){if(_0x392c3b){return _0x392c3b[_0x6a46('0x38')]({'UserId':_0x2682d2['body']['UserId'],'read1stAt':_[_0x6a46('0x6b')](_0x392c3b[_0x6a46('0x6c')])?moment()[_0x6a46('0x63')](_0x6a46('0x64')):undefined});}return null;})['then'](function(_0x425682){if(_0x425682){_0x382ee5[_0x6a46('0x6d')]=_0x425682[_0x6a46('0x68')]({'plain':!![]});interaction_log[_0x6a46('0x22')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2682d2['user']['id'],_0x2682d2[_0x6a46('0x66')]['name'],_0x2682d2[_0x6a46('0x66')]['role'],_0x382ee5[_0x6a46('0x6d')]['id'],_0x2682d2[_0x6a46('0x5c')]?JSON[_0x6a46('0x27')](_0x2682d2['body']):'null');return respondWithRpcPromise(_0x6a46('0x6e'),_0x6a46('0x6f'),_0x382ee5);}return null;})[_0x6a46('0x21')](function(_0x5357a1){var _0x43cbfc=_0x6a46('0x70')+_0x5357a1[_0x6a46('0x29')]['ContactId'];return db['sequelize'][_0x6a46('0x44')](_0x43cbfc,{'type':db['Sequelize'][_0x6a46('0x71')][_0x6a46('0x72')],'raw':!![]})['then'](function(_0x427cc1){return _0x427cc1;});})[_0x6a46('0x21')](function(_0x182254){if(_0x182254){_0x382ee5['message'][_0x6a46('0x73')]=_0x182254[0x0];if(!_0x2682d2[_0x6a46('0x5c')][_0x6a46('0x65')])return;return db[_0x6a46('0x74')][_0x6a46('0x5b')]({'where':{'id':_0x2682d2['body']['UserId'],'role':_0x6a46('0x67')},'attributes':['id',_0x6a46('0x3b'),_0x6a46('0x75'),_0x6a46('0x76'),_0x6a46('0x77')],'raw':!![]});}return null;})[_0x6a46('0x21')](function(_0x499410){if(!_0x499410)return null;_0x382ee5['message']['agent']=_0x499410;return _0x382ee5;})[_0x6a46('0x21')](function(_0x52bdd1){if(_0x52bdd1){if(_0x2682d2['body']['manual']){_0x382ee5[_0x6a46('0x29')][_0x6a46('0x78')]=util[_0x6a46('0x63')]('SIP/%s',_0x2682d2['user']['name']);_0x382ee5[_0x6a46('0x29')]['channel']=_0x382ee5[_0x6a46('0x79')];_0x382ee5[_0x6a46('0x29')][_0x6a46('0x7a')]=_0x382ee5[_0x6a46('0x79')];_0x382ee5['message'][_0x6a46('0x7b')]=_0x6a46('0x5f');return respondWithRpcPromise(_0x6a46('0x7c'),'EventManager',{'event':'acceptmessage','message':_0x382ee5[_0x6a46('0x29')]},client9002)[_0x6a46('0x21')](function(){return _0x382ee5;});}return _0x382ee5;}return null;})[_0x6a46('0x21')](respondWithResult(_0x478628,null))[_0x6a46('0x2b')](handleError(_0x478628,null));};var interaction_log=require(_0x6a46('0x14'))(_0x6a46('0x5e'));exports[_0x6a46('0x36')]=function(_0x8cecb1,_0x514df0,_0x4c38f4){var _0x1c5a90={'agent':{},'channel':'fax'};if(_0x8cecb1[_0x6a46('0x5c')]['id']){delete _0x8cecb1[_0x6a46('0x5c')]['id'];}_0x8cecb1[_0x6a46('0x5c')]['UserId']=_0x8cecb1['body'][_0x6a46('0x65')]||_0x8cecb1['user']['id'];_0x1c5a90[_0x6a46('0x67')]['id']=_0x8cecb1[_0x6a46('0x5c')][_0x6a46('0x65')];return db['FaxMessage'][_0x6a46('0x5b')]({'where':{'id':_0x8cecb1[_0x6a46('0x5a')]['id'],'UserId':null}})[_0x6a46('0x21')](handleEntityNotFound(_0x514df0,null))[_0x6a46('0x21')](function(_0x2d8a34){if(_0x2d8a34){_0x1c5a90[_0x6a46('0x29')]=_0x2d8a34['get']({'plain':!![]});return db[_0x6a46('0x69')]['find']({'where':{'id':_0x2d8a34[_0x6a46('0x6a')]}});}return null;})[_0x6a46('0x21')](handleEntityNotFound(_0x514df0,null))['then'](function(_0x2a511a){if(_0x2a511a){_0x1c5a90[_0x6a46('0x6d')]=_0x2a511a[_0x6a46('0x68')]({'plain':!![]});interaction_log['info'](_0x6a46('0x7d'),_0x8cecb1[_0x6a46('0x66')]['id'],_0x8cecb1['user'][_0x6a46('0x3b')],_0x8cecb1[_0x6a46('0x66')][_0x6a46('0x7e')],_0x1c5a90[_0x6a46('0x6d')]['id'],_0x8cecb1[_0x6a46('0x5c')]?JSON[_0x6a46('0x27')](_0x8cecb1[_0x6a46('0x5c')]):_0x6a46('0x7f'));return respondWithRpcPromise('RejectMessage',_0x6a46('0x80'),_0x1c5a90);}return null;})['then'](function(_0x9c4c16){var _0x47326c=_0x6a46('0x70')+_0x9c4c16[_0x6a46('0x29')]['ContactId'];return db[_0x6a46('0x81')]['query'](_0x47326c,{'type':db[_0x6a46('0x82')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6a46('0x21')](function(_0x186f3a){return _0x186f3a;});})[_0x6a46('0x21')](function(_0xc88e01){if(_0xc88e01){_0x1c5a90[_0x6a46('0x29')][_0x6a46('0x73')]=_0xc88e01[0x0];if(!_0x8cecb1['body'][_0x6a46('0x65')])return;return db[_0x6a46('0x74')][_0x6a46('0x5b')]({'where':{'id':_0x8cecb1[_0x6a46('0x5c')][_0x6a46('0x65')],'role':_0x6a46('0x67')},'attributes':['id','name',_0x6a46('0x75'),_0x6a46('0x76'),_0x6a46('0x77')],'raw':!![]});}return null;})[_0x6a46('0x21')](function(_0x370b93){if(!_0x370b93)return null;_0x1c5a90[_0x6a46('0x29')]['agent']=_0x370b93;return _0x1c5a90;})[_0x6a46('0x21')](function(_0x28cbc1){if(_0x28cbc1){_0x28cbc1[_0x6a46('0x29')]['interface']=util[_0x6a46('0x63')](_0x6a46('0x83'),_0x8cecb1['user']['name']);_0x28cbc1[_0x6a46('0x29')][_0x6a46('0x79')]=_0x1c5a90['channel'];_0x28cbc1[_0x6a46('0x29')][_0x6a46('0x7a')]=_0x1c5a90[_0x6a46('0x79')];_0x28cbc1[_0x6a46('0x29')][_0x6a46('0x7b')]=_0x6a46('0x36');respondWithRpcPromise('EventManager',_0x6a46('0x7c'),{'event':_0x6a46('0x84'),'message':_0x28cbc1['message']},client9002);return _0x1c5a90;}return null;})[_0x6a46('0x21')](respondWithResult(_0x514df0,null))[_0x6a46('0x2b')](handleError(_0x514df0,null));};exports['create']=function(_0x33a4de,_0x20dad4){var _0x502bc8;return db[_0x6a46('0x3f')][_0x6a46('0x85')](_0x33a4de['body'],{})[_0x6a46('0x21')](function(_0x4634e2){_0x502bc8=_0x4634e2;return db[_0x6a46('0x86')]['findOne']({'where':{'id':_0x502bc8[_0x6a46('0x87')]}});})[_0x6a46('0x21')](function(_0x555e74){if(_[_0x6a46('0x6b')](_0x555e74)){return;}else{_0x502bc8['fax']=_0x555e74['fax'];return db[_0x6a46('0x88')]['findOne']({'where':{'id':_0x502bc8[_0x6a46('0x89')]}});}})[_0x6a46('0x21')](function(_0x3d5b85){return respondWithRpcPromise(_0x6a46('0x8a'),_0x6a46('0x8a'),{'FaxAccountId':_[_0x6a46('0x6b')](_0x33a4de[_0x6a46('0x5c')])?undefined:_0x33a4de[_0x6a46('0x5c')]['FaxAccountId'],'path':_['isNil'](_0x3d5b85)?undefined:util[_0x6a46('0x63')](_0x6a46('0x8b'),_0x3d5b85[_0x6a46('0x8c')]),'fax':_[_0x6a46('0x6b')](_0x502bc8[_0x6a46('0x60')])?undefined:_0x502bc8[_0x6a46('0x60')],'AttachmentId':_0x502bc8[_0x6a46('0x89')]},client9002);})[_0x6a46('0x21')](respondWithResult(_0x20dad4,0xc9))[_0x6a46('0x2b')](handleError(_0x20dad4,null));};exports[_0x6a46('0x8d')]=function(_0x44485d,_0x557cd2){var _0x52f0bf=path[_0x6a46('0x8e')](config[_0x6a46('0x8f')],_0x6a46('0x90'),_0x6a46('0x91'),_0x6a46('0x92'));return db[_0x6a46('0x3f')]['find']({'where':{'id':_0x44485d[_0x6a46('0x5a')]['id']},'include':[{'model':db[_0x6a46('0x88')],'as':_0x6a46('0x88')}]})[_0x6a46('0x21')](handleEntityNotFound(_0x557cd2,null))[_0x6a46('0x21')](function(_0x296ce6){if(_0x296ce6){return _0x557cd2[_0x6a46('0x8d')](path[_0x6a46('0x8e')](_0x52f0bf,_0x296ce6[_0x6a46('0x88')][_0x6a46('0x8c')]));}})['catch'](handleError(_0x557cd2,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index d4040e2..d0e6eb1 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 _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 +var _0x6829=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','update','remove'];(function(_0x4a3746,_0x37b7a8){var _0x3916c4=function(_0x3d8b1a){while(--_0x3d8b1a){_0x4a3746['push'](_0x4a3746['shift']());}};_0x3916c4(++_0x37b7a8);}(_0x6829,0x14c));var _0x9682=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x6829[_0x1ccdf7];return _0x52a0ae;};'use strict';var EventEmitter=require(_0x9682('0x0'));var FaxMessage=require(_0x9682('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9682('0x2'),'afterDestroy':_0x9682('0x3')};function emitEvent(_0x1bfe61){return function(_0x3b8d4a,_0x3b721e,_0x1b0e5f){FaxMessageEvents[_0x9682('0x4')](_0x1bfe61+':'+_0x3b8d4a['id'],_0x3b8d4a);FaxMessageEvents[_0x9682('0x4')](_0x1bfe61,_0x3b8d4a);_0x1b0e5f(null);};}for(var e in events){if(events[_0x9682('0x5')](e)){var event=events[e];FaxMessage[_0x9682('0x6')](e,emitEvent(event));}}module[_0x9682('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 dba13e6..9e0f193 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 _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 +var _0x9b6e=['secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x4dd7c2,_0x5e86af){var _0x48ae97=function(_0x477727){while(--_0x477727){_0x4dd7c2['push'](_0x4dd7c2['shift']());}};_0x48ae97(++_0x5e86af);}(_0x9b6e,0x70));var _0xe9b6=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x9b6e[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xe9b6('0x0'));var util=require(_0xe9b6('0x1'));var logger=require(_0xe9b6('0x2'))(_0xe9b6('0x3'));var moment=require(_0xe9b6('0x4'));var BPromise=require(_0xe9b6('0x5'));var rp=require(_0xe9b6('0x6'));var fs=require('fs');var path=require(_0xe9b6('0x7'));var rimraf=require(_0xe9b6('0x8'));var config=require(_0xe9b6('0x9'));var attributes=require('./faxMessage.attributes');module[_0xe9b6('0xa')]=function(_0x3c83ca,_0x1f060c){return _0x3c83ca[_0xe9b6('0xb')](_0xe9b6('0xc'),attributes,{'tableName':_0xe9b6('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xe9b6('0xe')],'type':_0xe9b6('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a930b,_0x47a6e6,_0x3d4c1c){var _0x282f6e=_0x3c83ca[_0xe9b6('0x10')];var _0x3cca30=_0x3a930b[_0xe9b6('0x11')]({'plain':!![]});if(_0x3cca30[_0xe9b6('0x12')][_0xe9b6('0x13')]()==='in'||_0x3cca30['direction'][_0xe9b6('0x13')]()==='out'&&!_0x3cca30[_0xe9b6('0x14')]&&!_[_0xe9b6('0x15')](_0x3cca30[_0xe9b6('0x16')])){_0x282f6e[_0xe9b6('0x17')][_0xe9b6('0x18')]({'where':{'id':_0x3cca30[_0xe9b6('0x19')]}})[_0xe9b6('0x1a')](function(_0x3bcc65){if(_0x3bcc65){_0x3bcc65[_0xe9b6('0x1b')]({'lastMsgAt':_0x3cca30[_0xe9b6('0x1c')],'lastMsgDirection':_0x3cca30[_0xe9b6('0x12')][_0xe9b6('0x13')]()});}})[_0xe9b6('0x1d')](function(_0x4f9001){console[_0xe9b6('0x1e')](_0x4f9001);});}_0x3d4c1c();}},'charset':_0xe9b6('0x1f'),'collate':_0xe9b6('0x20')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6fa6d16..bca7a56 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 _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 +var _0x9bde=['body','options','raw','CreateFaxMessage','debug','UpdateFaxMessage','limit','then','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','FaxMessage','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x18adc4,_0x220d5d){_0x18adc4=_0x18adc4-0x0;var _0x329193=_0x9bde[_0x18adc4];return _0x329193;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});config[_0xe9bd('0xa')]=_[_0xe9bd('0xb')](config[_0xe9bd('0xa')],{'host':_0xe9bd('0xc'),'port':0x18eb});var socket=require(_0xe9bd('0xd'))(new Redis(config[_0xe9bd('0xa')]));require(_0xe9bd('0xe'))[_0xe9bd('0xf')](socket);function respondWithRpcPromise(_0x45c7ba,_0x581602,_0x5f36c8){return new BPromise(function(_0x3c8e95,_0x145521){return client[_0xe9bd('0x10')](_0x45c7ba,_0x5f36c8)['then'](function(_0x12c96e){logger[_0xe9bd('0x11')](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));logger['debug'](_0xe9bd('0x14'),_0x581602,'request\x20sent',JSON[_0xe9bd('0x15')](_0x12c96e));if(_0x12c96e[_0xe9bd('0x16')]){if(_0x12c96e[_0xe9bd('0x16')]['code']===0x1f4){logger['error'](_0xe9bd('0x12'),_0x581602,_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);return _0x145521(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}logger[_0xe9bd('0x16')](_0xe9bd('0x12'),_0x581602,_0x12c96e['error'][_0xe9bd('0x17')]);return _0x3c8e95(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}else{logger['info'](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));_0x3c8e95(_0x12c96e[_0xe9bd('0x18')][_0xe9bd('0x17')]);}})['catch'](function(_0x20ec32){logger['error'](_0xe9bd('0x12'),_0x581602,_0x20ec32);_0x145521(_0x20ec32);});});}exports['CreateFaxMessage']=function(_0x26aa4a){var _0x417113=this;return new Promise(function(_0x134c4e,_0x3dda13){return db[_0xe9bd('0x19')][_0xe9bd('0x1a')](_0x26aa4a[_0xe9bd('0x1b')],{'raw':_0x26aa4a['options']?_0x26aa4a[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x37aec1){logger['info'](_0xe9bd('0x1e'),_0x26aa4a);logger[_0xe9bd('0x1f')](_0xe9bd('0x1e'),_0x26aa4a,JSON[_0xe9bd('0x15')](_0x37aec1));_0x134c4e(_0x37aec1);})['catch'](function(_0x24cf25){logger[_0xe9bd('0x16')](_0xe9bd('0x1e'),_0x24cf25[_0xe9bd('0x17')],_0x26aa4a);_0x3dda13(_0x417113[_0xe9bd('0x16')](0x1f4,_0x24cf25[_0xe9bd('0x17')]));});});};exports[_0xe9bd('0x20')]=function(_0x43ea90){var _0x1ae889=this;return new Promise(function(_0x5987af,_0x3c211a){return db[_0xe9bd('0x19')]['update'](_0x43ea90[_0xe9bd('0x1b')],{'raw':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')]['where']||null:null,'attributes':_0x43ea90['options']?_0x43ea90[_0xe9bd('0x1c')]['attributes']||null:null,'limit':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')][_0xe9bd('0x21')]||null:null})[_0xe9bd('0x22')](function(_0x4057df){logger['info']('UpdateFaxMessage',_0x43ea90);logger[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x43ea90,JSON[_0xe9bd('0x15')](_0x4057df));_0x5987af(_0x4057df);})[_0xe9bd('0x23')](function(_0xe2436){logger[_0xe9bd('0x16')](_0xe9bd('0x20'),_0xe2436[_0xe9bd('0x17')],_0x43ea90);_0x3c211a(_0x1ae889[_0xe9bd('0x16')](0x1f4,_0xe2436['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5159e70..bd0fdcb 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 _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 +var _0xd4b7=['length','faxMessage:','update','emit','register'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd4b7,0x1ec));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save','remove',_0x7d4b('0x0')];function createListener(_0x57f202,_0x5d9bcb){return function(_0x27d449){_0x5d9bcb[_0x7d4b('0x1')](_0x57f202,_0x27d449);};}function removeListener(_0x2fbcf1,_0x1606e1){return function(){FaxMessageEvents['removeListener'](_0x2fbcf1,_0x1606e1);};}exports[_0x7d4b('0x2')]=function(_0x9d68ee){for(var _0x2d2d86=0x0,_0x1dbc26=events[_0x7d4b('0x3')];_0x2d2d86<_0x1dbc26;_0x2d2d86++){var _0x482d00=events[_0x2d2d86];var _0x4996b9=createListener(_0x7d4b('0x4')+_0x482d00,_0x9d68ee);FaxMessageEvents['on'](_0x482d00,_0x4996b9);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 7a921aa..e8e5adc 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 _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 +var _0xdb94=['express','fs-extra','../../components/auth/service','./faxMessage.controller','index','/describe','describe','get','/:id','isAuthenticated','show','/:id/download','download','post','fax','faxmessage:create','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','connect-timeout'];(function(_0x41cce6,_0x1218e7){var _0x4890aa=function(_0x39f4a0){while(--_0x39f4a0){_0x41cce6['push'](_0x41cce6['shift']());}};_0x4890aa(++_0x1218e7);}(_0xdb94,0xab));var _0x4db9=function(_0x13884d,_0x35c80f){_0x13884d=_0x13884d-0x0;var _0x35c464=_0xdb94[_0x13884d];return _0x35c464;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),interaction['tracked'](_0x4db9('0x12'),_0x4db9('0x13')),controller['create']);router['put'](_0x4db9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4db9('0x14')](_0x4db9('0x15'),auth['isAuthenticated'](),controller[_0x4db9('0x16')]);router[_0x4db9('0x14')](_0x4db9('0x17'),auth[_0x4db9('0xd')](),controller['reject']);router['delete'](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller['destroy']);module[_0x4db9('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index e10cb6a..a1c4586 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 _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 +var _0x1d50=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x2c7933,_0x224c51){var _0x445360=function(_0x576156){while(--_0x576156){_0x2c7933['push'](_0x2c7933['shift']());}};_0x445360(++_0x224c51);}(_0x1d50,0xc0));var _0x01d5=function(_0x48ba95,_0x43557d){_0x48ba95=_0x48ba95-0x0;var _0x581976=_0x1d50[_0x48ba95];return _0x581976;};'use strict';var Sequelize=require(_0x01d5('0x0'));module[_0x01d5('0x1')]={'name':{'type':Sequelize[_0x01d5('0x2')],'unique':_0x01d5('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x01d5('0x2')]},'timeout':{'type':Sequelize[_0x01d5('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x01d5('0x5')](_0x01d5('0x6'),_0x01d5('0x7'),_0x01d5('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x01d5('0x4')],'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 600ffca..51f4106 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 _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 +var _0xa5c1=['sort','pick','filter','UserFaxQueue','User','findAndCountAll','UserId','agent','updatedAt','SIP','faxPause','createdAt','getTeams','hasOwnProperty','addTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userFaxQueue:save','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','toString','SELECT','every','includes','all','union','compact','value','transaction','removeTeams','isEmpty','emit','userFaxQueue:remove','addAgents','removeAgents','isArray','getAgents','bluebird','util','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','undefined','count','limit','set','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','FaxQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','nolimit','order'];(function(_0x35ce9e,_0x13cbd4){var _0x3da197=function(_0x536278){while(--_0x536278){_0x35ce9e['push'](_0x35ce9e['shift']());}};_0x3da197(++_0x13cbd4);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x51f6aa,_0x5bfd0c){_0x51f6aa=_0x51f6aa-0x0;var _0x11b1d7=_0xa5c1[_0x51f6aa];return _0x11b1d7;};'use strict';var BPromise=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var _=require(_0x1a5c('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x1a5c('0x3'));var logger=require('../../config/logger')(_0x1a5c('0x4'));var config=require(_0x1a5c('0x5'));var db=require(_0x1a5c('0x6'))['db'];config[_0x1a5c('0x7')]=_[_0x1a5c('0x8')](config[_0x1a5c('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a5c('0x9'))(new Redis(config['redis']));require(_0x1a5c('0xa'))[_0x1a5c('0xb')](socket);function respondWithStatusCode(_0x1702ce,_0x5666c3){_0x5666c3=_0x5666c3||0xcc;return function(_0x39fe5c){if(_0x39fe5c){return _0x1702ce['sendStatus'](_0x5666c3);}return _0x1702ce[_0x1a5c('0xc')](_0x5666c3)[_0x1a5c('0xd')]();};}function respondWithResult(_0x5097cf,_0x1323be){_0x1323be=_0x1323be||0xc8;return function(_0x1ac373){if(_0x1ac373){return _0x5097cf['status'](_0x1323be)[_0x1a5c('0xe')](_0x1ac373);}};}function respondWithFilteredResult(_0x3f7368,_0x591c3d){return function(_0x3f14af){if(_0x3f14af){var _0x3e344e=typeof _0x591c3d[_0x1a5c('0xf')]===_0x1a5c('0x10')&&typeof _0x591c3d['limit']===_0x1a5c('0x10');var _0x3ff425=_0x3f14af['count'];var _0x157ebb=_0x3e344e?0x0:_0x591c3d[_0x1a5c('0xf')];var _0x5cfdb9=_0x3e344e?_0x3f14af[_0x1a5c('0x11')]:_0x591c3d[_0x1a5c('0xf')]+_0x591c3d[_0x1a5c('0x12')];var _0x170112;if(_0x5cfdb9>=_0x3ff425){_0x5cfdb9=_0x3ff425;_0x170112=0xc8;}else{_0x170112=0xce;}_0x3f7368['status'](_0x170112);return _0x3f7368[_0x1a5c('0x13')]('Content-Range',_0x157ebb+'-'+_0x5cfdb9+'/'+_0x3ff425)[_0x1a5c('0xe')](_0x3f14af);}return null;};}function saveUpdates(_0x44648a){return function(_0x57cb61){if(_0x57cb61){return _0x57cb61['update'](_0x44648a)['then'](function(_0x32e177){return _0x32e177;});}return null;};}function removeEntity(_0x2e6a6f){return function(_0x18551c){if(_0x18551c){return _0x18551c[_0x1a5c('0x14')]()[_0x1a5c('0x15')](function(){var _0x57edcd=_0x18551c[_0x1a5c('0x16')]({'plain':!![]});var _0x505162=_0x1a5c('0x17');return db[_0x1a5c('0x18')][_0x1a5c('0x14')]({'where':{'type':_0x505162,'resourceId':_0x57edcd['id']}})['then'](function(){return _0x18551c;});})[_0x1a5c('0x15')](function(){_0x2e6a6f[_0x1a5c('0xc')](0xcc)[_0x1a5c('0xd')]();});}};}function handleEntityNotFound(_0x3502cb){return function(_0x144abf){if(!_0x144abf){_0x3502cb['sendStatus'](0x194);}return _0x144abf;};}function handleError(_0x11964c,_0xbd916e){_0xbd916e=_0xbd916e||0x1f4;return function(_0x8e81fa){logger[_0x1a5c('0x19')](_0x8e81fa[_0x1a5c('0x1a')]);if(_0x8e81fa[_0x1a5c('0x1b')]){delete _0x8e81fa[_0x1a5c('0x1b')];}_0x11964c[_0x1a5c('0xc')](_0xbd916e)[_0x1a5c('0x1c')](_0x8e81fa);};}exports[_0x1a5c('0x1d')]=function(_0x38244c,_0x323272){var _0x4c6520={};var _0x15e334={'count':0x0,'rows':[]};var _0x501397=_[_0x1a5c('0x1e')](db['FaxQueue'][_0x1a5c('0x1f')],function(_0x4323f8){return{'name':_0x4323f8[_0x1a5c('0x20')],'type':_0x4323f8[_0x1a5c('0x21')][_0x1a5c('0x22')]};});_0x4c6520=qs[_0x1a5c('0x23')](_0x501397,_0x38244c);var _0x157376={'where':_0x4c6520[_0x1a5c('0x24')]};return db[_0x1a5c('0x25')][_0x1a5c('0x11')](_0x157376)[_0x1a5c('0x15')](function(_0x4e2fe3){_0x15e334[_0x1a5c('0x11')]=_0x4e2fe3;_0x4c6520[_0x1a5c('0x26')]=qs[_0x1a5c('0x26')](_0x38244c[_0x1a5c('0x27')]);return db[_0x1a5c('0x25')][_0x1a5c('0x28')](_0x4c6520);})[_0x1a5c('0x15')](function(_0x1a2bec){_0x15e334[_0x1a5c('0x29')]=_0x1a2bec;return _0x15e334;})['then'](respondWithFilteredResult(_0x323272,_0x4c6520))[_0x1a5c('0x2a')](handleError(_0x323272,null));};exports[_0x1a5c('0x2b')]=function(_0x257013,_0x131215){var _0x5cce0c={'raw':!![],'where':{'id':_0x257013[_0x1a5c('0x2c')]['id']}},_0x10532b={};_0x10532b[_0x1a5c('0x2d')]=_[_0x1a5c('0x2e')](db[_0x1a5c('0x25')][_0x1a5c('0x1f')]);_0x10532b[_0x1a5c('0x27')]=_['keys'](_0x257013[_0x1a5c('0x27')]);_0x10532b[_0x1a5c('0x2f')]=_['intersection'](_0x10532b[_0x1a5c('0x2d')],_0x10532b[_0x1a5c('0x27')]);_0x5cce0c[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x10532b['model'],qs[_0x1a5c('0x32')](_0x257013[_0x1a5c('0x27')]['fields']));_0x5cce0c[_0x1a5c('0x30')]=_0x5cce0c[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x5cce0c[_0x1a5c('0x30')]:_0x10532b[_0x1a5c('0x2d')];if(_0x257013[_0x1a5c('0x27')][_0x1a5c('0x34')]){_0x5cce0c[_0x1a5c('0x26')]=[{'all':!![]}];}_0x5cce0c=_[_0x1a5c('0x35')]({},_0x5cce0c,_0x257013[_0x1a5c('0x36')]);return db['FaxQueue'][_0x1a5c('0x37')](_0x5cce0c)[_0x1a5c('0x15')](handleEntityNotFound(_0x131215,null))['then'](respondWithResult(_0x131215,null))[_0x1a5c('0x2a')](handleError(_0x131215,null));};exports[_0x1a5c('0x38')]=function(_0x4ba8cf,_0x4abca8){return db[_0x1a5c('0x25')][_0x1a5c('0x38')](_0x4ba8cf[_0x1a5c('0x39')],{})[_0x1a5c('0x15')](function(_0x562ff5){var _0x52ff6c=_0x4ba8cf[_0x1a5c('0x3a')][_0x1a5c('0x16')]({'plain':!![]});if(!_0x52ff6c)throw new Error(_0x1a5c('0x3b'));if(_0x52ff6c['role']===_0x1a5c('0x3a')){var _0x32fc23=_0x562ff5[_0x1a5c('0x16')]({'plain':!![]});var _0x216ba0=_0x1a5c('0x17');return db[_0x1a5c('0x3c')][_0x1a5c('0x37')]({'where':{'name':_0x216ba0,'userProfileId':_0x52ff6c[_0x1a5c('0x3d')]},'raw':!![]})['then'](function(_0x4cb0e8){if(_0x4cb0e8&&_0x4cb0e8['autoAssociation']===0x0){return db[_0x1a5c('0x18')]['create']({'name':_0x32fc23[_0x1a5c('0x1b')],'resourceId':_0x32fc23['id'],'type':_0x4cb0e8[_0x1a5c('0x1b')],'sectionId':_0x4cb0e8['id']},{})[_0x1a5c('0x15')](function(){return _0x562ff5;});}else{return _0x562ff5;}})[_0x1a5c('0x2a')](function(_0x1072d5){logger[_0x1a5c('0x19')](_0x1a5c('0x3e'),_0x1072d5);throw _0x1072d5;});}return _0x562ff5;})['then'](respondWithResult(_0x4abca8,0xc9))[_0x1a5c('0x2a')](handleError(_0x4abca8,null));};exports[_0x1a5c('0x3f')]=function(_0x2fef3e,_0x5e9d4c){if(_0x2fef3e[_0x1a5c('0x39')]['id']){delete _0x2fef3e[_0x1a5c('0x39')]['id'];}return db[_0x1a5c('0x25')]['find']({'where':{'id':_0x2fef3e[_0x1a5c('0x2c')]['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x5e9d4c,null))['then'](saveUpdates(_0x2fef3e[_0x1a5c('0x39')],null))[_0x1a5c('0x15')](respondWithResult(_0x5e9d4c,null))['catch'](handleError(_0x5e9d4c,null));};exports['destroy']=function(_0x56dceb,_0x3de0fa){return db[_0x1a5c('0x25')]['find']({'where':{'id':_0x56dceb[_0x1a5c('0x2c')]['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x3de0fa,null))[_0x1a5c('0x15')](removeEntity(_0x3de0fa,null))[_0x1a5c('0x2a')](handleError(_0x3de0fa,null));};exports[_0x1a5c('0x40')]=function(_0x33f03a,_0x120bdd){return db[_0x1a5c('0x25')][_0x1a5c('0x40')]()[_0x1a5c('0x15')](respondWithResult(_0x120bdd,null))['catch'](handleError(_0x120bdd,null));};exports[_0x1a5c('0x41')]=function(_0x20bad9,_0x3e03f5){var _0x11f4c2={'raw':!![],'where':{}},_0x3244c5={},_0x46d8bb;return db[_0x1a5c('0x25')][_0x1a5c('0x42')]({'where':{'id':_0x20bad9[_0x1a5c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3e03f5,null))['then'](function(_0x511c19){if(_0x511c19){_0x46d8bb=_0x511c19[_0x1a5c('0x16')]({'plain':!![]});_0x3244c5[_0x1a5c('0x2d')]=_[_0x1a5c('0x2e')](db['UserFaxQueue'][_0x1a5c('0x1f')]);_0x3244c5[_0x1a5c('0x27')]=_[_0x1a5c('0x2e')](_0x20bad9[_0x1a5c('0x27')]);_0x3244c5[_0x1a5c('0x2f')]=_['intersection'](_0x3244c5[_0x1a5c('0x2d')],_0x3244c5['query']);_0x11f4c2[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x3244c5[_0x1a5c('0x2d')],qs[_0x1a5c('0x32')](_0x20bad9['query'][_0x1a5c('0x32')]));_0x11f4c2[_0x1a5c('0x30')]=_0x11f4c2[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x11f4c2[_0x1a5c('0x30')]:_0x3244c5[_0x1a5c('0x2d')];if(!_0x20bad9[_0x1a5c('0x27')]['hasOwnProperty'](_0x1a5c('0x43'))){_0x11f4c2[_0x1a5c('0x12')]=qs['limit'](_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0x12')]);_0x11f4c2[_0x1a5c('0xf')]=qs[_0x1a5c('0xf')](_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0xf')]);}_0x11f4c2[_0x1a5c('0x44')]=qs[_0x1a5c('0x45')](_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0x45')]);_0x11f4c2[_0x1a5c('0x24')]=qs[_0x1a5c('0x2f')](_[_0x1a5c('0x46')](_0x20bad9[_0x1a5c('0x27')],_0x3244c5[_0x1a5c('0x2f')]));_0x11f4c2[_0x1a5c('0x24')]['FaxQueueId']=_0x511c19['id'];if(_0x20bad9[_0x1a5c('0x27')]['filter']){_0x11f4c2[_0x1a5c('0x24')]=_[_0x1a5c('0x35')](_0x11f4c2[_0x1a5c('0x24')],{'$or':_[_0x1a5c('0x1e')](_0x11f4c2[_0x1a5c('0x30')],function(_0xc19a6f){var _0x290e41={};_0x290e41[_0xc19a6f]={'$like':'%'+_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0x47')]+'%'};return _0x290e41;})});}_0x11f4c2=_[_0x1a5c('0x35')]({},_0x11f4c2,_0x20bad9['options']);return db[_0x1a5c('0x48')][_0x1a5c('0x28')](_0x11f4c2);}})[_0x1a5c('0x15')](function(_0x3c0268){if(_0x3c0268){return db[_0x1a5c('0x49')][_0x1a5c('0x4a')]({'where':{'id':_[_0x1a5c('0x1e')](_0x3c0268,_0x1a5c('0x4b')),'role':_0x1a5c('0x4c')},'attributes':['id',_0x1a5c('0x1b'),'faxPause',_0x1a5c('0x4d'),'createdAt']});}})['then'](function(_0x4bcbb7){if(_0x4bcbb7){return{'count':_0x4bcbb7[_0x1a5c('0x11')],'rows':_[_0x1a5c('0x1e')](_0x4bcbb7[_0x1a5c('0x29')],function(_0x50a2e5){return{'membername':_0x50a2e5[_0x1a5c('0x1b')],'UserId':_0x50a2e5['id'],'queue_name':_0x46d8bb[_0x1a5c('0x1b')],'FaxQueueId':_0x46d8bb['id'],'interface':util['format']('%s/%s',_0x1a5c('0x4e'),_0x50a2e5[_0x1a5c('0x1b')]),'penalty':0x0,'paused':_0x50a2e5[_0x1a5c('0x4f')],'createdAt':_0x50a2e5[_0x1a5c('0x50')],'updatedAt':_0x50a2e5[_0x1a5c('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1a5c('0x15')](respondWithFilteredResult(_0x3e03f5,_0x11f4c2))['catch'](handleError(_0x3e03f5,null));};exports['getTeams']=function(_0x288821,_0x4cc324){var _0x190d24={};var _0x2d71f7={};var _0x50ae82;var _0x2c00b4;return db['FaxQueue'][_0x1a5c('0x42')]({'where':{'id':_0x288821[_0x1a5c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4cc324,null))[_0x1a5c('0x15')](function(_0x17c53b){if(_0x17c53b){_0x50ae82=_0x17c53b;_0x2d71f7[_0x1a5c('0x2d')]=_['keys'](db['Team']['rawAttributes']);_0x2d71f7[_0x1a5c('0x27')]=_[_0x1a5c('0x2e')](_0x288821['query']);_0x2d71f7[_0x1a5c('0x2f')]=_['intersection'](_0x2d71f7['model'],_0x2d71f7['query']);_0x190d24['attributes']=_[_0x1a5c('0x31')](_0x2d71f7[_0x1a5c('0x2d')],qs[_0x1a5c('0x32')](_0x288821[_0x1a5c('0x27')][_0x1a5c('0x32')]));_0x190d24[_0x1a5c('0x30')]=_0x190d24[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x190d24['attributes']:_0x2d71f7[_0x1a5c('0x2d')];_0x190d24[_0x1a5c('0x44')]=qs[_0x1a5c('0x45')](_0x288821[_0x1a5c('0x27')][_0x1a5c('0x45')]);_0x190d24['where']=qs[_0x1a5c('0x2f')](_['pick'](_0x288821['query'],_0x2d71f7[_0x1a5c('0x2f')]));if(_0x288821[_0x1a5c('0x27')][_0x1a5c('0x47')]){_0x190d24[_0x1a5c('0x24')]=_[_0x1a5c('0x35')](_0x190d24[_0x1a5c('0x24')],{'$or':_[_0x1a5c('0x1e')](_0x190d24[_0x1a5c('0x30')],function(_0x16235f){var _0x39c226={};_0x39c226[_0x16235f]={'$like':'%'+_0x288821[_0x1a5c('0x27')][_0x1a5c('0x47')]+'%'};return _0x39c226;})});}_0x190d24=_[_0x1a5c('0x35')]({},_0x190d24,_0x288821['options']);return _0x50ae82[_0x1a5c('0x51')](_0x190d24);}})[_0x1a5c('0x15')](function(_0x29bd89){if(_0x29bd89){_0x2c00b4=_0x29bd89[_0x1a5c('0x33')];if(!_0x288821['query'][_0x1a5c('0x52')](_0x1a5c('0x43'))){_0x190d24[_0x1a5c('0x12')]=qs[_0x1a5c('0x12')](_0x288821[_0x1a5c('0x27')][_0x1a5c('0x12')]);_0x190d24[_0x1a5c('0xf')]=qs['offset'](_0x288821[_0x1a5c('0x27')][_0x1a5c('0xf')]);}return _0x50ae82['getTeams'](_0x190d24);}})[_0x1a5c('0x15')](function(_0x3694a7){if(_0x3694a7){return _0x3694a7?{'count':_0x2c00b4,'rows':_0x3694a7}:null;}})['then'](respondWithResult(_0x4cc324,null))[_0x1a5c('0x2a')](handleError(_0x4cc324,null));};exports[_0x1a5c('0x53')]=function(_0x51483c,_0x2c8caa){var _0x5a1e2d=_0x51483c[_0x1a5c('0x39')]['ids'];return db[_0x1a5c('0x54')][_0x1a5c('0x28')]({'where':{'id':_0x5a1e2d},'attributes':['id'],'include':[{'model':db[_0x1a5c('0x49')],'as':_0x1a5c('0x55'),'attributes':['id',_0x1a5c('0x1b'),_0x1a5c('0x56'),_0x1a5c('0x57'),_0x1a5c('0x58')],'raw':!![]}]})[_0x1a5c('0x15')](function(_0x5db4e1){if(_0x5db4e1){var _0x3ba5be=_[_0x1a5c('0x59')](_0x5db4e1,function(_0x3531f7){var _0x110a81=_0x3531f7[_0x1a5c('0x16')]({'plain':!![]});return _0x110a81[_0x1a5c('0x55')];});return db[_0x1a5c('0x25')][_0x1a5c('0x37')]({'where':{'id':_0x51483c[_0x1a5c('0x2c')]['id']}})['then'](function(_0x49304d){return db[_0x1a5c('0x5a')]['transaction'](function(_0x2bb9b3){return _0x49304d[_0x1a5c('0x53')](_0x5a1e2d,{'transaction':_0x2bb9b3})[_0x1a5c('0x15')](function(){return BPromise[_0x1a5c('0x5b')](_0x3ba5be,function(_0x558e21){return db[_0x1a5c('0x48')][_0x1a5c('0x5c')]({'where':{'UserId':_0x558e21['id'],'FaxQueueId':_0x51483c[_0x1a5c('0x2c')]['id']},'transaction':_0x2bb9b3});});})[_0x1a5c('0x15')](function(){_0x3ba5be[_0x1a5c('0x5d')](function(_0x55a65a){socket['emit'](_0x1a5c('0x5e'),{'UserId':_0x55a65a['id'],'FaxQueueId':_0x49304d['id']});});});});});}})[_0x1a5c('0x15')](respondWithStatusCode(_0x2c8caa,null))[_0x1a5c('0x2a')](handleError(_0x2c8caa,null));};exports['removeTeams']=function(_0x15d2ab,_0x4da8cd){return db[_0x1a5c('0x54')][_0x1a5c('0x28')]({'where':{'id':_0x15d2ab[_0x1a5c('0x27')][_0x1a5c('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x1a5c('0x49')],'as':_0x1a5c('0x55'),'attributes':['id'],'raw':!![]}]})[_0x1a5c('0x15')](handleEntityNotFound(_0x4da8cd,null))[_0x1a5c('0x15')](function(_0x43bd88){var _0x490c84=_[_0x1a5c('0x1e')](_0x43bd88,'id');var _0x10438b=[];var _0x12aa40=[];var _0x16dd12=squel[_0x1a5c('0x60')]();_0x16dd12['field'](_0x1a5c('0x61'))[_0x1a5c('0x62')]('team_has_fax_queues','tq')[_0x1a5c('0x63')](_0x1a5c('0x64'),'ut',_0x1a5c('0x65'))[_0x1a5c('0x24')](_0x1a5c('0x66'),_0x15d2ab['params']['id']);for(var _0x3e56e8=0x0;_0x3e56e8<_0x43bd88[_0x1a5c('0x33')];_0x3e56e8+=0x1){let _0x3802e3=_0x43bd88[_0x3e56e8];for(var _0x29d4ec=0x0;_0x29d4ec<_0x3802e3[_0x1a5c('0x55')][_0x1a5c('0x33')];_0x29d4ec+=0x1){let _0x1caa4b=_0x3802e3[_0x1a5c('0x55')][_0x29d4ec];var _0xeaa5e8=_0x16dd12[_0x1a5c('0x67')]();_0xeaa5e8[_0x1a5c('0x24')]('ut.UserId\x20=\x20?',_0x1caa4b['id']);_0x12aa40['push'](db[_0x1a5c('0x5a')][_0x1a5c('0x27')](_0xeaa5e8[_0x1a5c('0x68')](),{'type':db[_0x1a5c('0x5a')]['QueryTypes'][_0x1a5c('0x69')]})[_0x1a5c('0x15')](function(_0x182b5b){if(_0x182b5b[_0x1a5c('0x33')]===0x1){return _0x1caa4b['id'];}else{var _0x3447a9=_[_0x1a5c('0x6a')](_['map'](_0x182b5b,'TeamId'),function(_0x108276){return _[_0x1a5c('0x6b')](_0x490c84,_0x108276);});if(_0x3447a9){return _0x1caa4b['id'];}}}));}}return BPromise[_0x1a5c('0x6c')](_0x12aa40)[_0x1a5c('0x15')](function(_0x25fc67){_0x10438b=_(_0x10438b)[_0x1a5c('0x6d')](_0x25fc67)[_0x1a5c('0x6e')]()[_0x1a5c('0x6f')]();return db['FaxQueue'][_0x1a5c('0x37')]({'where':{'id':_0x15d2ab[_0x1a5c('0x2c')]['id']}})['then'](function(_0x3d4d37){return db[_0x1a5c('0x5a')][_0x1a5c('0x70')](function(_0x359d08){return _0x3d4d37[_0x1a5c('0x71')](_0x15d2ab['query']['ids'],{'transaction':_0x359d08})[_0x1a5c('0x15')](function(){if(!_[_0x1a5c('0x72')](_0x10438b)){return _0x3d4d37['removeAgents'](_0x10438b,{'transaction':_0x359d08});}})[_0x1a5c('0x15')](function(){_0x10438b[_0x1a5c('0x5d')](function(_0x467c1c){socket[_0x1a5c('0x73')](_0x1a5c('0x74'),{'UserId':_0x467c1c,'FaxQueueId':_0x3d4d37['id']});});});});});});})['then'](respondWithStatusCode(_0x4da8cd,null))[_0x1a5c('0x2a')](handleError(_0x4da8cd,null));};exports[_0x1a5c('0x75')]=function(_0x21cbe2,_0x166cd9){return db[_0x1a5c('0x25')]['find']({'where':{'id':_0x21cbe2[_0x1a5c('0x2c')]['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x166cd9,null))[_0x1a5c('0x15')](function(_0x54c34b){if(_0x54c34b){return _0x54c34b[_0x1a5c('0x75')](_0x21cbe2[_0x1a5c('0x39')][_0x1a5c('0x5f')],_['omit'](_0x21cbe2[_0x1a5c('0x39')],[_0x1a5c('0x5f'),'id'])||{})['spread'](function(_0x39c7f0){for(var _0x5bc8d0=0x0;_0x5bc8d0<_0x21cbe2[_0x1a5c('0x39')]['ids'][_0x1a5c('0x33')];_0x5bc8d0+=0x1){socket['emit'](_0x1a5c('0x5e'),{'UserId':Number(_0x21cbe2[_0x1a5c('0x39')]['ids'][_0x5bc8d0]),'FaxQueueId':Number(_0x21cbe2[_0x1a5c('0x2c')]['id'])});}return _0x39c7f0;});}})[_0x1a5c('0x15')](respondWithResult(_0x166cd9,null))[_0x1a5c('0x2a')](handleError(_0x166cd9,null));};exports[_0x1a5c('0x76')]=function(_0x3e3223,_0x104f24){return db[_0x1a5c('0x25')][_0x1a5c('0x37')]({'where':{'id':_0x3e3223['params']['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x104f24,null))['then'](function(_0x3b4a80){if(_0x3b4a80){return _0x3b4a80[_0x1a5c('0x76')](_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')])[_0x1a5c('0x15')](function(){if(_[_0x1a5c('0x77')](_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')])){for(var _0x26049a=0x0;_0x26049a<_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')]['length'];_0x26049a+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x3e3223['query'][_0x1a5c('0x5f')][_0x26049a]),'FaxQueueId':Number(_0x3e3223[_0x1a5c('0x2c')]['id'])});}}else{socket[_0x1a5c('0x73')](_0x1a5c('0x74'),{'UserId':Number(_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')]),'FaxQueueId':Number(_0x3e3223[_0x1a5c('0x2c')]['id'])});}});}})[_0x1a5c('0x15')](respondWithStatusCode(_0x104f24,null))[_0x1a5c('0x2a')](handleError(_0x104f24,null));};exports[_0x1a5c('0x78')]=function(_0x1aa9a4,_0x1e1716){var _0x2ead60={};var _0x15e72e={};var _0xbf5b38;var _0x347b04;return db[_0x1a5c('0x25')][_0x1a5c('0x42')]({'where':{'id':_0x1aa9a4['params']['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x1e1716,null))[_0x1a5c('0x15')](function(_0x45260b){if(_0x45260b){_0xbf5b38=_0x45260b;_0x15e72e[_0x1a5c('0x2d')]=_[_0x1a5c('0x2e')](db['User'][_0x1a5c('0x1f')]);_0x15e72e['query']=_[_0x1a5c('0x2e')](_0x1aa9a4[_0x1a5c('0x27')]);_0x15e72e[_0x1a5c('0x2f')]=_[_0x1a5c('0x31')](_0x15e72e['model'],_0x15e72e[_0x1a5c('0x27')]);_0x2ead60[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x15e72e['model'],qs[_0x1a5c('0x32')](_0x1aa9a4['query'][_0x1a5c('0x32')]));_0x2ead60['attributes']=_0x2ead60[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x2ead60[_0x1a5c('0x30')]:_0x15e72e['model'];_0x2ead60[_0x1a5c('0x44')]=qs[_0x1a5c('0x45')](_0x1aa9a4[_0x1a5c('0x27')][_0x1a5c('0x45')]);_0x2ead60[_0x1a5c('0x24')]=qs[_0x1a5c('0x2f')](_[_0x1a5c('0x46')](_0x1aa9a4[_0x1a5c('0x27')],_0x15e72e[_0x1a5c('0x2f')]));if(_0x1aa9a4['query']['filter']){_0x2ead60[_0x1a5c('0x24')]=_[_0x1a5c('0x35')](_0x2ead60[_0x1a5c('0x24')],{'$or':_[_0x1a5c('0x1e')](_0x2ead60[_0x1a5c('0x30')],function(_0x53d920){var _0x2f34fc={};_0x2f34fc[_0x53d920]={'$like':'%'+_0x1aa9a4[_0x1a5c('0x27')][_0x1a5c('0x47')]+'%'};return _0x2f34fc;})});}_0x2ead60=_['merge']({},_0x2ead60,_0x1aa9a4[_0x1a5c('0x36')]);return _0xbf5b38[_0x1a5c('0x78')](_0x2ead60);}})[_0x1a5c('0x15')](function(_0x565608){if(_0x565608){_0x347b04=_0x565608['length'];if(!_0x1aa9a4[_0x1a5c('0x27')][_0x1a5c('0x52')](_0x1a5c('0x43'))){_0x2ead60[_0x1a5c('0x12')]=qs[_0x1a5c('0x12')](_0x1aa9a4['query']['limit']);_0x2ead60[_0x1a5c('0xf')]=qs['offset'](_0x1aa9a4['query'][_0x1a5c('0xf')]);}return _0xbf5b38[_0x1a5c('0x78')](_0x2ead60);}})[_0x1a5c('0x15')](function(_0x18dfb8){if(_0x18dfb8){return _0x18dfb8?{'count':_0x347b04,'rows':_0x18dfb8}:null;}})[_0x1a5c('0x15')](respondWithResult(_0x1e1716,null))[_0x1a5c('0x2a')](handleError(_0x1e1716,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index eeb54c4..ca98eba 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 _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 +var _0x4aeb=['FaxQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x598fa2,_0x1bfd11){var _0x53dc25=function(_0x1a250f){while(--_0x1a250f){_0x598fa2['push'](_0x598fa2['shift']());}};_0x53dc25(++_0x1bfd11);}(_0x4aeb,0x170));var _0xb4ae=function(_0x528d4f,_0x19b4f9){_0x528d4f=_0x528d4f-0x0;var _0x3df605=_0x4aeb[_0x528d4f];return _0x3df605;};'use strict';var EventEmitter=require(_0xb4ae('0x0'));var FaxQueue=require(_0xb4ae('0x1'))['db'][_0xb4ae('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb4ae('0x3')](0x0);var events={'afterCreate':_0xb4ae('0x4'),'afterUpdate':_0xb4ae('0x5'),'afterDestroy':_0xb4ae('0x6')};function emitEvent(_0x203ba0){return function(_0x195799,_0x1ac9de,_0x4c6aa9){FaxQueueEvents['emit'](_0x203ba0+':'+_0x195799['id'],_0x195799);FaxQueueEvents['emit'](_0x203ba0,_0x195799);_0x4c6aa9(null);};}for(var e in events){if(events[_0xb4ae('0x7')](e)){var event=events[e];FaxQueue[_0xb4ae('0x8')](e,emitEvent(event));}}module[_0xb4ae('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 16f6574..47d53bc 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 _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 +var _0x06e1=['bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','../../config/logger'];(function(_0x5756be,_0x13a88a){var _0x42b9b0=function(_0x42d42d){while(--_0x42d42d){_0x5756be['push'](_0x5756be['shift']());}};_0x42b9b0(++_0x13a88a);}(_0x06e1,0xae));var _0x106e=function(_0x38eb99,_0x3f6ecd){_0x38eb99=_0x38eb99-0x0;var _0x5844da=_0x06e1[_0x38eb99];return _0x5844da;};'use strict';var _=require(_0x106e('0x0'));var util=require('util');var logger=require(_0x106e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x106e('0x2'));var rp=require(_0x106e('0x3'));var fs=require('fs');var path=require(_0x106e('0x4'));var rimraf=require(_0x106e('0x5'));var config=require(_0x106e('0x6'));var attributes=require(_0x106e('0x7'));module[_0x106e('0x8')]=function(_0x27e915,_0x1367e8){return _0x27e915[_0x106e('0x9')]('FaxQueue',attributes,{'tableName':_0x106e('0xa'),'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 df8f380..cf021ff 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 _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 +var _0xb22d=['debug','stringify','error','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','ShowFaxQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x62ec77,_0x53dc59){var _0x261fdd=function(_0x3ed6d2){while(--_0x3ed6d2){_0x62ec77['push'](_0x62ec77['shift']());}};_0x261fdd(++_0x53dc59);}(_0xb22d,0xe6));var _0xdb22=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0xb22d[_0x5aa373];return _0x590e8e;};'use strict';var _=require(_0xdb22('0x0'));var util=require('util');var moment=require(_0xdb22('0x1'));var BPromise=require(_0xdb22('0x2'));var rs=require(_0xdb22('0x3'));var fs=require('fs');var Redis=require(_0xdb22('0x4'));var db=require(_0xdb22('0x5'))['db'];var utils=require(_0xdb22('0x6'));var logger=require('../../config/logger')(_0xdb22('0x7'));var config=require(_0xdb22('0x8'));var jayson=require(_0xdb22('0x9'));var client=jayson[_0xdb22('0xa')][_0xdb22('0xb')]({'port':0x232a});config[_0xdb22('0xc')]=_[_0xdb22('0xd')](config[_0xdb22('0xc')],{'host':_0xdb22('0xe'),'port':0x18eb});var socket=require(_0xdb22('0xf'))(new Redis(config[_0xdb22('0xc')]));require(_0xdb22('0x10'))[_0xdb22('0x11')](socket);function respondWithRpcPromise(_0x2adf2d,_0x271ee,_0x40530e){return new BPromise(function(_0x5c75f4,_0x4d3a35){return client[_0xdb22('0x12')](_0x2adf2d,_0x40530e)[_0xdb22('0x13')](function(_0x59075a){logger['info'](_0xdb22('0x14'),_0x271ee,_0xdb22('0x15'));logger[_0xdb22('0x16')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x271ee,'request\x20sent',JSON[_0xdb22('0x17')](_0x59075a));if(_0x59075a[_0xdb22('0x18')]){if(_0x59075a[_0xdb22('0x18')]['code']===0x1f4){logger[_0xdb22('0x18')]('FaxQueue,\x20%s,\x20%s',_0x271ee,_0x59075a['error'][_0xdb22('0x19')]);return _0x4d3a35(_0x59075a[_0xdb22('0x18')][_0xdb22('0x19')]);}logger['error'](_0xdb22('0x14'),_0x271ee,_0x59075a[_0xdb22('0x18')][_0xdb22('0x19')]);return _0x5c75f4(_0x59075a[_0xdb22('0x18')]['message']);}else{logger[_0xdb22('0x1a')](_0xdb22('0x14'),_0x271ee,_0xdb22('0x15'));_0x5c75f4(_0x59075a[_0xdb22('0x1b')][_0xdb22('0x19')]);}})[_0xdb22('0x1c')](function(_0x43cb28){logger[_0xdb22('0x18')](_0xdb22('0x14'),_0x271ee,_0x43cb28);_0x4d3a35(_0x43cb28);});});}exports[_0xdb22('0x1d')]=function(_0x53d302){var _0x1a1241=this;return new Promise(function(_0x1fdcd6,_0x4556b0){return db[_0xdb22('0x1e')][_0xdb22('0x1f')]({'raw':_0x53d302['options']?_0x53d302['options']['raw']===undefined?!![]:![]:!![],'where':_0x53d302[_0xdb22('0x20')]?_0x53d302[_0xdb22('0x20')][_0xdb22('0x21')]||null:null,'attributes':_0x53d302['options']?_0x53d302[_0xdb22('0x20')][_0xdb22('0x22')]||null:null,'limit':_0x53d302[_0xdb22('0x20')]?_0x53d302['options'][_0xdb22('0x23')]||null:null,'include':_0x53d302['options']?_0x53d302[_0xdb22('0x20')][_0xdb22('0x24')]?_[_0xdb22('0x25')](_0x53d302[_0xdb22('0x20')][_0xdb22('0x24')],function(_0x11186e){return{'model':db[_0x11186e[_0xdb22('0x26')]],'as':_0x11186e['as'],'attributes':_0x11186e[_0xdb22('0x22')],'include':_0x11186e[_0xdb22('0x24')]?_[_0xdb22('0x25')](_0x11186e[_0xdb22('0x24')],function(_0x5b4ca2){return{'model':db[_0x5b4ca2[_0xdb22('0x26')]],'as':_0x5b4ca2['as'],'attributes':_0x5b4ca2[_0xdb22('0x22')],'include':_0x5b4ca2[_0xdb22('0x24')]?_[_0xdb22('0x25')](_0x5b4ca2[_0xdb22('0x24')],function(_0xb1c683){return{'model':db[_0xb1c683[_0xdb22('0x26')]],'as':_0xb1c683['as'],'attributes':_0xb1c683[_0xdb22('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4636ec){logger['info'](_0xdb22('0x1d'),_0x53d302);logger[_0xdb22('0x16')](_0xdb22('0x1d'),_0x53d302,JSON[_0xdb22('0x17')](_0x4636ec));_0x1fdcd6(_0x4636ec);})[_0xdb22('0x1c')](function(_0x3014e7){logger[_0xdb22('0x18')](_0xdb22('0x1d'),_0x3014e7[_0xdb22('0x19')],_0x53d302);_0x4556b0(_0x1a1241['error'](0x1f4,_0x3014e7[_0xdb22('0x19')]));});});};exports[_0xdb22('0x27')]=function(_0x98c544){var _0x4d0cb0=this;return new Promise(function(_0x381475,_0x5a0f26){return db[_0xdb22('0x1e')][_0xdb22('0x28')]({'raw':_0x98c544['options']?_0x98c544[_0xdb22('0x20')][_0xdb22('0x29')]===undefined?!![]:![]:!![],'where':_0x98c544[_0xdb22('0x20')]?_0x98c544[_0xdb22('0x20')][_0xdb22('0x21')]||null:null,'attributes':_0x98c544[_0xdb22('0x20')]?_0x98c544['options']['attributes']||null:null,'include':_0x98c544['options']?_0x98c544[_0xdb22('0x20')]['include']?_[_0xdb22('0x25')](_0x98c544['options'][_0xdb22('0x24')],function(_0x18b738){return{'model':db[_0x18b738[_0xdb22('0x26')]],'as':_0x18b738['as'],'attributes':_0x18b738[_0xdb22('0x22')],'include':_0x18b738[_0xdb22('0x24')]?_[_0xdb22('0x25')](_0x18b738[_0xdb22('0x24')],function(_0x5477b0){return{'model':db[_0x5477b0[_0xdb22('0x26')]],'as':_0x5477b0['as'],'attributes':_0x5477b0[_0xdb22('0x22')],'include':_0x5477b0[_0xdb22('0x24')]?_[_0xdb22('0x25')](_0x5477b0[_0xdb22('0x24')],function(_0x53557c){return{'model':db[_0x53557c[_0xdb22('0x26')]],'as':_0x53557c['as'],'attributes':_0x53557c['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb22('0x13')](function(_0x562c5f){logger[_0xdb22('0x1a')](_0xdb22('0x27'),_0x98c544);logger['debug'](_0xdb22('0x27'),_0x98c544,JSON[_0xdb22('0x17')](_0x562c5f));_0x381475(_0x562c5f);})[_0xdb22('0x1c')](function(_0x10dff2){logger[_0xdb22('0x18')](_0xdb22('0x27'),_0x10dff2['message'],_0x98c544);_0x5a0f26(_0x4d0cb0[_0xdb22('0x18')](0x1f4,_0x10dff2['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index eb9288b..4bc585c 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 _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 +var _0x54a7=['faxQueue:','./faxQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x237595,_0xb93473){var _0x1ca056=function(_0x3f2d33){while(--_0x3f2d33){_0x237595['push'](_0x237595['shift']());}};_0x1ca056(++_0xb93473);}(_0x54a7,0xe9));var _0x754a=function(_0x529671,_0x161540){_0x529671=_0x529671-0x0;var _0x4cf046=_0x54a7[_0x529671];return _0x4cf046;};'use strict';var FaxQueueEvents=require(_0x754a('0x0'));var events=[_0x754a('0x1'),_0x754a('0x2'),'update'];function createListener(_0x307b38,_0x57f58d){return function(_0x303a97){_0x57f58d[_0x754a('0x3')](_0x307b38,_0x303a97);};}function removeListener(_0x159af4,_0x39621e){return function(){FaxQueueEvents[_0x754a('0x4')](_0x159af4,_0x39621e);};}exports[_0x754a('0x5')]=function(_0x426afc){for(var _0x3ed013=0x0,_0x232644=events[_0x754a('0x6')];_0x3ed013<_0x232644;_0x3ed013++){var _0x407ec8=events[_0x3ed013];var _0xeddcc2=createListener(_0x754a('0x7')+_0x407ec8,_0x426afc);FaxQueueEvents['on'](_0x407ec8,_0xeddcc2);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 107b733..b456135 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 _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 +var _0xb145=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users'];(function(_0x4eb64a,_0x457978){var _0x34c50e=function(_0x578b8f){while(--_0x578b8f){_0x4eb64a['push'](_0x4eb64a['shift']());}};_0x34c50e(++_0x457978);}(_0xb145,0xa3));var _0x5b14=function(_0x5c83b7,_0x3383a1){_0x5c83b7=_0x5c83b7-0x0;var _0x291509=_0xb145[_0x5c83b7];return _0x291509;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x9')]('/:id/members',auth[_0x5b14('0xa')](),controller[_0x5b14('0x10')]);router[_0x5b14('0x9')](_0x5b14('0x11'),auth[_0x5b14('0xa')](),controller['getTeams']);router[_0x5b14('0x9')]('/:id/users',auth[_0x5b14('0xa')](),controller[_0x5b14('0x12')]);router[_0x5b14('0x13')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0x14')]);router[_0x5b14('0x13')]('/:id/teams',auth[_0x5b14('0xa')](),controller[_0x5b14('0x15')]);router[_0x5b14('0x13')](_0x5b14('0x16'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x17')]);router[_0x5b14('0x18')](_0x5b14('0xe'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x19')]);router[_0x5b14('0x1a')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0x1b')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x5b14('0x1c')]);router[_0x5b14('0x1a')](_0x5b14('0x16'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x1d')]);module[_0x5b14('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 95e61b7..991af5d 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 _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 +var _0x7488=['STRING','DATE','moment','sequelize'];(function(_0x393f6d,_0x289a2a){var _0xb591a8=function(_0x1174e2){while(--_0x1174e2){_0x393f6d['push'](_0x393f6d['shift']());}};_0xb591a8(++_0x289a2a);}(_0x7488,0x19a));var _0x8748=function(_0x1a5689,_0x4920ea){_0x1a5689=_0x1a5689-0x0;var _0x1dbd8a=_0x7488[_0x1a5689];return _0x1dbd8a;};'use strict';var moment=require(_0x8748('0x0'));var Sequelize=require(_0x8748('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8748('0x2')]},'joinAt':{'type':Sequelize[_0x8748('0x3')]},'leaveAt':{'type':Sequelize[_0x8748('0x3')]},'acceptAt':{'type':Sequelize[_0x8748('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8748('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 423f80a..4a7093a 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 _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 +var _0xac65=['status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','FaxQueueReport','includeAll','include','findAll','catch','show','params','find','create','body','describe','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','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'];(function(_0x7a6838,_0x42a8dd){var _0x2a0d72=function(_0x25175b){while(--_0x25175b){_0x7a6838['push'](_0x7a6838['shift']());}};_0x2a0d72(++_0x42a8dd);}(_0xac65,0x11d));var _0x5ac6=function(_0x18a819,_0x369e83){_0x18a819=_0x18a819-0x0;var _0x3161fe=_0xac65[_0x18a819];return _0x3161fe;};'use strict';var emlformat=require(_0x5ac6('0x0'));var rimraf=require(_0x5ac6('0x1'));var zipdir=require(_0x5ac6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ac6('0x3'));var moment=require(_0x5ac6('0x4'));var BPromise=require(_0x5ac6('0x5'));var Mustache=require('mustache');var util=require(_0x5ac6('0x6'));var path=require(_0x5ac6('0x7'));var sox=require(_0x5ac6('0x8'));var csv=require('to-csv');var ejs=require(_0x5ac6('0x9'));var fs=require('fs');var fs_extra=require(_0x5ac6('0xa'));var _=require(_0x5ac6('0xb'));var squel=require(_0x5ac6('0xc'));var crypto=require(_0x5ac6('0xd'));var jsforce=require(_0x5ac6('0xe'));var deskjs=require(_0x5ac6('0xf'));var toCsv=require(_0x5ac6('0x10'));var querystring=require(_0x5ac6('0x11'));var Papa=require(_0x5ac6('0x12'));var Redis=require(_0x5ac6('0x13'));var authService=require(_0x5ac6('0x14'));var qs=require(_0x5ac6('0x15'));var as=require(_0x5ac6('0x16'));var hardwareService=require(_0x5ac6('0x17'));var logger=require(_0x5ac6('0x18'))(_0x5ac6('0x19'));var utils=require(_0x5ac6('0x1a'));var config=require(_0x5ac6('0x1b'));var licenseUtil=require(_0x5ac6('0x1c'));var db=require(_0x5ac6('0x1d'))['db'];function respondWithStatusCode(_0x2d6f0a,_0x505ae7){_0x505ae7=_0x505ae7||0xcc;return function(_0x1e1ed0){if(_0x1e1ed0){return _0x2d6f0a[_0x5ac6('0x1e')](_0x505ae7);}return _0x2d6f0a[_0x5ac6('0x1f')](_0x505ae7)['end']();};}function respondWithResult(_0x23cfa7,_0x355f2a){_0x355f2a=_0x355f2a||0xc8;return function(_0x2af869){if(_0x2af869){return _0x23cfa7['status'](_0x355f2a)[_0x5ac6('0x20')](_0x2af869);}};}function respondWithFilteredResult(_0x23ad24,_0x2db3af){return function(_0x158e9a){if(_0x158e9a){var _0xefc444=typeof _0x2db3af['offset']===_0x5ac6('0x21')&&typeof _0x2db3af['limit']==='undefined';var _0x27924d=_0x158e9a[_0x5ac6('0x22')];var _0x2e62d9=_0xefc444?0x0:_0x2db3af[_0x5ac6('0x23')];var _0x24ccd2=_0xefc444?_0x158e9a[_0x5ac6('0x22')]:_0x2db3af[_0x5ac6('0x23')]+_0x2db3af[_0x5ac6('0x24')];var _0x446733;if(_0x24ccd2>=_0x27924d){_0x24ccd2=_0x27924d;_0x446733=0xc8;}else{_0x446733=0xce;}_0x23ad24['status'](_0x446733);return _0x23ad24[_0x5ac6('0x25')](_0x5ac6('0x26'),_0x2e62d9+'-'+_0x24ccd2+'/'+_0x27924d)[_0x5ac6('0x20')](_0x158e9a);}return null;};}function patchUpdates(_0x9ed30){return function(_0x593329){try{jsonpatch[_0x5ac6('0x27')](_0x593329,_0x9ed30,!![]);}catch(_0x4fa376){return BPromise[_0x5ac6('0x28')](_0x4fa376);}return _0x593329['save']();};}function saveUpdates(_0x2c55c5,_0x3c1db4){return function(_0x4e582f){if(_0x4e582f){return _0x4e582f[_0x5ac6('0x29')](_0x2c55c5)[_0x5ac6('0x2a')](function(_0x52ba3f){return _0x52ba3f;});}return null;};}function removeEntity(_0x1c81e7,_0x4c07d6){return function(_0x2f63f1){if(_0x2f63f1){return _0x2f63f1[_0x5ac6('0x2b')]()[_0x5ac6('0x2a')](function(){_0x1c81e7[_0x5ac6('0x1f')](0xcc)[_0x5ac6('0x2c')]();});}};}function handleEntityNotFound(_0x3da323,_0x4086ed){return function(_0x4b94c0){if(!_0x4b94c0){_0x3da323[_0x5ac6('0x1e')](0x194);}return _0x4b94c0;};}function handleError(_0x11188a,_0x5b741f){_0x5b741f=_0x5b741f||0x1f4;return function(_0x333464){logger['error'](_0x333464[_0x5ac6('0x2d')]);if(_0x333464[_0x5ac6('0x2e')]){delete _0x333464['name'];}_0x11188a[_0x5ac6('0x1f')](_0x5b741f)['send'](_0x333464);};}exports['index']=function(_0x2b9e40,_0x48007a){var _0x1827c5={},_0x2c02f7={},_0x490e59={'count':0x0,'rows':[]};var _0x4cb3bd=_[_0x5ac6('0x2f')](db['FaxQueueReport'][_0x5ac6('0x30')],function(_0x4a718d){return{'name':_0x4a718d[_0x5ac6('0x31')],'type':_0x4a718d['type'][_0x5ac6('0x32')]};});_0x2c02f7[_0x5ac6('0x33')]=_[_0x5ac6('0x2f')](_0x4cb3bd,'name');_0x2c02f7[_0x5ac6('0x34')]=_[_0x5ac6('0x35')](_0x2b9e40[_0x5ac6('0x34')]);_0x2c02f7[_0x5ac6('0x36')]=_[_0x5ac6('0x37')](_0x2c02f7[_0x5ac6('0x33')],_0x2c02f7['query']);_0x1827c5['attributes']=_[_0x5ac6('0x37')](_0x2c02f7[_0x5ac6('0x33')],qs[_0x5ac6('0x38')](_0x2b9e40[_0x5ac6('0x34')][_0x5ac6('0x38')]));_0x1827c5[_0x5ac6('0x39')]=_0x1827c5[_0x5ac6('0x39')]['length']?_0x1827c5[_0x5ac6('0x39')]:_0x2c02f7[_0x5ac6('0x33')];if(!_0x2b9e40[_0x5ac6('0x34')][_0x5ac6('0x3a')](_0x5ac6('0x3b'))){_0x1827c5[_0x5ac6('0x24')]=qs[_0x5ac6('0x24')](_0x2b9e40[_0x5ac6('0x34')]['limit']);_0x1827c5[_0x5ac6('0x23')]=qs[_0x5ac6('0x23')](_0x2b9e40['query']['offset']);}_0x1827c5[_0x5ac6('0x3c')]=qs[_0x5ac6('0x3d')](_0x2b9e40[_0x5ac6('0x34')]['sort']);_0x1827c5[_0x5ac6('0x3e')]=qs[_0x5ac6('0x36')](_[_0x5ac6('0x3f')](_0x2b9e40['query'],_0x2c02f7[_0x5ac6('0x36')]),_0x4cb3bd);if(_0x2b9e40['query']['filter']){_0x1827c5['where']=_[_0x5ac6('0x40')](_0x1827c5[_0x5ac6('0x3e')],{'$or':_[_0x5ac6('0x2f')](_0x4cb3bd,function(_0x1e16b0){if(_0x1e16b0[_0x5ac6('0x41')]!=='VIRTUAL'){var _0x4df597={};_0x4df597[_0x1e16b0[_0x5ac6('0x2e')]]={'$like':'%'+_0x2b9e40[_0x5ac6('0x34')][_0x5ac6('0x42')]+'%'};return _0x4df597;}})});}_0x1827c5=_[_0x5ac6('0x40')]({},_0x1827c5,_0x2b9e40[_0x5ac6('0x43')]);var _0x33a1ad={'where':_0x1827c5['where']};return db[_0x5ac6('0x44')]['count'](_0x33a1ad)['then'](function(_0x1eaad7){_0x490e59[_0x5ac6('0x22')]=_0x1eaad7;if(_0x2b9e40[_0x5ac6('0x34')][_0x5ac6('0x45')]){_0x1827c5[_0x5ac6('0x46')]=[{'all':!![]}];}return db[_0x5ac6('0x44')][_0x5ac6('0x47')](_0x1827c5);})[_0x5ac6('0x2a')](function(_0x6ec798){_0x490e59['rows']=_0x6ec798;return _0x490e59;})[_0x5ac6('0x2a')](respondWithFilteredResult(_0x48007a,_0x1827c5))[_0x5ac6('0x48')](handleError(_0x48007a,null));};exports[_0x5ac6('0x49')]=function(_0x2ba18a,_0x76aae3){var _0x4a1992={'raw':!![],'where':{'id':_0x2ba18a[_0x5ac6('0x4a')]['id']}},_0x365396={};_0x365396[_0x5ac6('0x33')]=_[_0x5ac6('0x35')](db['FaxQueueReport']['rawAttributes']);_0x365396[_0x5ac6('0x34')]=_[_0x5ac6('0x35')](_0x2ba18a[_0x5ac6('0x34')]);_0x365396['filters']=_[_0x5ac6('0x37')](_0x365396['model'],_0x365396[_0x5ac6('0x34')]);_0x4a1992['attributes']=_[_0x5ac6('0x37')](_0x365396[_0x5ac6('0x33')],qs[_0x5ac6('0x38')](_0x2ba18a['query']['fields']));_0x4a1992[_0x5ac6('0x39')]=_0x4a1992[_0x5ac6('0x39')]['length']?_0x4a1992[_0x5ac6('0x39')]:_0x365396['model'];if(_0x2ba18a['query'][_0x5ac6('0x45')]){_0x4a1992[_0x5ac6('0x46')]=[{'all':!![]}];}_0x4a1992=_[_0x5ac6('0x40')]({},_0x4a1992,_0x2ba18a['options']);return db[_0x5ac6('0x44')][_0x5ac6('0x4b')](_0x4a1992)[_0x5ac6('0x2a')](handleEntityNotFound(_0x76aae3,null))[_0x5ac6('0x2a')](respondWithResult(_0x76aae3,null))['catch'](handleError(_0x76aae3,null));};exports[_0x5ac6('0x4c')]=function(_0x2181c8,_0x55e210){return db[_0x5ac6('0x44')][_0x5ac6('0x4c')](_0x2181c8[_0x5ac6('0x4d')],{})[_0x5ac6('0x2a')](respondWithResult(_0x55e210,0xc9))['catch'](handleError(_0x55e210,null));};exports[_0x5ac6('0x29')]=function(_0x4133ed,_0x409d8c){if(_0x4133ed[_0x5ac6('0x4d')]['id']){delete _0x4133ed['body']['id'];}return db[_0x5ac6('0x44')][_0x5ac6('0x4b')]({'where':{'id':_0x4133ed[_0x5ac6('0x4a')]['id']}})[_0x5ac6('0x2a')](handleEntityNotFound(_0x409d8c,null))[_0x5ac6('0x2a')](saveUpdates(_0x4133ed[_0x5ac6('0x4d')],null))['then'](respondWithResult(_0x409d8c,null))[_0x5ac6('0x48')](handleError(_0x409d8c,null));};exports['destroy']=function(_0x5d4e9d,_0x9662d8){return db[_0x5ac6('0x44')][_0x5ac6('0x4b')]({'where':{'id':_0x5d4e9d['params']['id']}})[_0x5ac6('0x2a')](handleEntityNotFound(_0x9662d8,null))[_0x5ac6('0x2a')](removeEntity(_0x9662d8,null))[_0x5ac6('0x48')](handleError(_0x9662d8,null));};exports[_0x5ac6('0x4e')]=function(_0x253807,_0x1cddc3){return db[_0x5ac6('0x44')][_0x5ac6('0x4e')]()[_0x5ac6('0x2a')](respondWithResult(_0x1cddc3,null))[_0x5ac6('0x48')](handleError(_0x1cddc3,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 51082c9..150c0a1 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 _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 +var _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x507cd8,_0x1e31e3){var _0x149216=function(_0x25e7b0){while(--_0x25e7b0){_0x507cd8['push'](_0x507cd8['shift']());}};_0x149216(++_0x1e31e3);}(_0xe14b,0x93));var _0xbe14=function(_0x329d74,_0x23b3fc){_0x329d74=_0x329d74-0x0;var _0x5246d9=_0xe14b[_0x329d74];return _0x5246d9;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 40dd245..7905d2b 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 _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 +var _0x5a2a=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','info','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','update','attributes','limit','UpdateFaxQueueReport'];(function(_0x309eec,_0x351304){var _0x34bb0d=function(_0x4411b){while(--_0x4411b){_0x309eec['push'](_0x309eec['shift']());}};_0x34bb0d(++_0x351304);}(_0x5a2a,0x1b2));var _0xa5a2=function(_0x5b6c6f,_0x113cf3){_0x5b6c6f=_0x5b6c6f-0x0;var _0x517ee5=_0x5a2a[_0x5b6c6f];return _0x517ee5;};'use strict';var _=require('lodash');var util=require(_0xa5a2('0x0'));var moment=require(_0xa5a2('0x1'));var BPromise=require(_0xa5a2('0x2'));var rs=require(_0xa5a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5a2('0x4'))['db'];var utils=require(_0xa5a2('0x5'));var logger=require('../../config/logger')(_0xa5a2('0x6'));var config=require(_0xa5a2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa5a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24432f,_0xfe5336,_0x3d6533){return new BPromise(function(_0x187ffd,_0x3e403b){return client[_0xa5a2('0x9')](_0x24432f,_0x3d6533)[_0xa5a2('0xa')](function(_0x4d2b03){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0xfe5336,_0xa5a2('0xb'));logger[_0xa5a2('0xc')](_0xa5a2('0xd'),_0xfe5336,'request\x20sent',JSON[_0xa5a2('0xe')](_0x4d2b03));if(_0x4d2b03[_0xa5a2('0xf')]){if(_0x4d2b03['error'][_0xa5a2('0x10')]===0x1f4){logger[_0xa5a2('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0xfe5336,_0x4d2b03[_0xa5a2('0xf')][_0xa5a2('0x11')]);return _0x3e403b(_0x4d2b03[_0xa5a2('0xf')][_0xa5a2('0x11')]);}logger[_0xa5a2('0xf')](_0xa5a2('0x12'),_0xfe5336,_0x4d2b03['error']['message']);return _0x187ffd(_0x4d2b03[_0xa5a2('0xf')]['message']);}else{logger[_0xa5a2('0x13')](_0xa5a2('0x12'),_0xfe5336,_0xa5a2('0xb'));_0x187ffd(_0x4d2b03[_0xa5a2('0x14')][_0xa5a2('0x11')]);}})[_0xa5a2('0x15')](function(_0x20a7a5){logger[_0xa5a2('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0xfe5336,_0x20a7a5);_0x3e403b(_0x20a7a5);});});}exports[_0xa5a2('0x16')]=function(_0x39d981){var _0x4d01f0=this;return new Promise(function(_0x4d0d80,_0x35254a){return db[_0xa5a2('0x17')]['create'](_0x39d981[_0xa5a2('0x18')],{'raw':_0x39d981['options']?_0x39d981[_0xa5a2('0x19')][_0xa5a2('0x1a')]===undefined?!![]:![]:!![]})[_0xa5a2('0xa')](function(_0x102a38){logger[_0xa5a2('0x13')]('CreateFaxQueueReport',_0x39d981);logger[_0xa5a2('0xc')](_0xa5a2('0x16'),_0x39d981,JSON[_0xa5a2('0xe')](_0x102a38));_0x4d0d80(_0x102a38);})[_0xa5a2('0x15')](function(_0x537c25){logger['error'](_0xa5a2('0x16'),_0x537c25['message'],_0x39d981);_0x35254a(_0x4d01f0[_0xa5a2('0xf')](0x1f4,_0x537c25[_0xa5a2('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x48b88c){var _0x37402d=this;return new Promise(function(_0x1d56f1,_0x230fd9){return db[_0xa5a2('0x17')][_0xa5a2('0x1b')](_0x48b88c[_0xa5a2('0x18')],{'raw':_0x48b88c[_0xa5a2('0x19')]?_0x48b88c[_0xa5a2('0x19')][_0xa5a2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48b88c['options']?_0x48b88c['options']['where']||null:null,'attributes':_0x48b88c['options']?_0x48b88c['options'][_0xa5a2('0x1c')]||null:null,'limit':_0x48b88c[_0xa5a2('0x19')]?_0x48b88c['options'][_0xa5a2('0x1d')]||null:null})[_0xa5a2('0xa')](function(_0x4869a2){logger[_0xa5a2('0x13')]('UpdateFaxQueueReport',_0x48b88c);logger[_0xa5a2('0xc')](_0xa5a2('0x1e'),_0x48b88c,JSON[_0xa5a2('0xe')](_0x4869a2));_0x1d56f1(_0x4869a2);})[_0xa5a2('0x15')](function(_0xa81f20){logger[_0xa5a2('0xf')]('UpdateFaxQueueReport',_0xa81f20[_0xa5a2('0x11')],_0x48b88c);_0x230fd9(_0x37402d[_0xa5a2('0xf')](0x1f4,_0xa81f20[_0xa5a2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 1116a92..3303530 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 _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 +var _0xee6d=['show','post','create','put','update','delete','destroy','exports','util','connect-timeout','fs-extra','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x1d368d,_0x1bc3e3){var _0x3532fa=function(_0x5c790d){while(--_0x5c790d){_0x1d368d['push'](_0x1d368d['shift']());}};_0x3532fa(++_0x1bc3e3);}(_0xee6d,0x1ca));var _0xdee6=function(_0x4ce80d,_0x4a07e8){_0x4ce80d=_0x4ce80d-0x0;var _0x1251ba=_0xee6d[_0x4ce80d];return _0x1251ba;};'use strict';var multer=require('multer');var util=require(_0xdee6('0x0'));var path=require('path');var timeout=require(_0xdee6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdee6('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xdee6('0x3'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0xdee6('0x4')](),controller[_0xdee6('0x5')]);router['get'](_0xdee6('0x6'),auth[_0xdee6('0x4')](),controller[_0xdee6('0x7')]);router[_0xdee6('0x8')](_0xdee6('0x9'),auth['isAuthenticated'](),controller[_0xdee6('0xa')]);router[_0xdee6('0xb')]('/',auth['isAuthenticated'](),controller[_0xdee6('0xc')]);router[_0xdee6('0xd')](_0xdee6('0x9'),auth[_0xdee6('0x4')](),controller[_0xdee6('0xe')]);router[_0xdee6('0xf')](_0xdee6('0x9'),auth[_0xdee6('0x4')](),controller[_0xdee6('0x10')]);module[_0xdee6('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index a9ab211..f667fbd 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 _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 +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4205c4,_0x43b89e){var _0x17202c=function(_0x450764){while(--_0x450764){_0x4205c4['push'](_0x4205c4['shift']());}};_0x17202c(++_0x43b89e);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x4b84[_0x3b90ab];return _0x206e92;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d9cb2c2..c68a994 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 _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 +var _0xc466=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../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','Content-Range','apply','reject','save','update','then','destroy','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf'];(function(_0x5d1eca,_0x19ef13){var _0x4a9fc4=function(_0x48b7e1){while(--_0x48b7e1){_0x5d1eca['push'](_0x5d1eca['shift']());}};_0x4a9fc4(++_0x19ef13);}(_0xc466,0x98));var _0x6c46=function(_0x1c571e,_0x548a78){_0x1c571e=_0x1c571e-0x0;var _0x4c546e=_0xc466[_0x1c571e];return _0x4c546e;};'use strict';var emlformat=require(_0x6c46('0x0'));var rimraf=require(_0x6c46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c46('0x2'));var rp=require('request-promise');var moment=require(_0x6c46('0x3'));var BPromise=require(_0x6c46('0x4'));var Mustache=require(_0x6c46('0x5'));var util=require(_0x6c46('0x6'));var path=require(_0x6c46('0x7'));var sox=require(_0x6c46('0x8'));var csv=require(_0x6c46('0x9'));var ejs=require(_0x6c46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6c46('0xb'));var crypto=require(_0x6c46('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6c46('0xd'));var toCsv=require(_0x6c46('0x9'));var querystring=require(_0x6c46('0xe'));var Papa=require(_0x6c46('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6c46('0x10'));var hardwareService=require(_0x6c46('0x11'));var logger=require(_0x6c46('0x12'))(_0x6c46('0x13'));var utils=require(_0x6c46('0x14'));var config=require(_0x6c46('0x15'));var licenseUtil=require(_0x6c46('0x16'));var db=require(_0x6c46('0x17'))['db'];function respondWithStatusCode(_0x4c5537,_0x32eea2){_0x32eea2=_0x32eea2||0xcc;return function(_0x379a86){if(_0x379a86){return _0x4c5537[_0x6c46('0x18')](_0x32eea2);}return _0x4c5537[_0x6c46('0x19')](_0x32eea2)[_0x6c46('0x1a')]();};}function respondWithResult(_0x5d10fa,_0x13d273){_0x13d273=_0x13d273||0xc8;return function(_0x443349){if(_0x443349){return _0x5d10fa[_0x6c46('0x19')](_0x13d273)[_0x6c46('0x1b')](_0x443349);}};}function respondWithFilteredResult(_0x14574a,_0x3c0b47){return function(_0x372578){if(_0x372578){var _0x4f17fc=typeof _0x3c0b47[_0x6c46('0x1c')]===_0x6c46('0x1d')&&typeof _0x3c0b47['limit']==='undefined';var _0x1ee8f8=_0x372578[_0x6c46('0x1e')];var _0xbeac74=_0x4f17fc?0x0:_0x3c0b47[_0x6c46('0x1c')];var _0x3eccff=_0x4f17fc?_0x372578[_0x6c46('0x1e')]:_0x3c0b47[_0x6c46('0x1c')]+_0x3c0b47[_0x6c46('0x1f')];var _0x4de801;if(_0x3eccff>=_0x1ee8f8){_0x3eccff=_0x1ee8f8;_0x4de801=0xc8;}else{_0x4de801=0xce;}_0x14574a['status'](_0x4de801);return _0x14574a[_0x6c46('0x20')](_0x6c46('0x21'),_0xbeac74+'-'+_0x3eccff+'/'+_0x1ee8f8)['json'](_0x372578);}return null;};}function patchUpdates(_0x3a6542){return function(_0x2477bc){try{jsonpatch[_0x6c46('0x22')](_0x2477bc,_0x3a6542,!![]);}catch(_0x15efd4){return BPromise[_0x6c46('0x23')](_0x15efd4);}return _0x2477bc[_0x6c46('0x24')]();};}function saveUpdates(_0x17e517,_0x22907e){return function(_0x2f58a4){if(_0x2f58a4){return _0x2f58a4[_0x6c46('0x25')](_0x17e517)[_0x6c46('0x26')](function(_0x28eeb7){return _0x28eeb7;});}return null;};}function removeEntity(_0x18cf4e,_0x2999ae){return function(_0x377277){if(_0x377277){return _0x377277[_0x6c46('0x27')]()[_0x6c46('0x26')](function(){_0x18cf4e['status'](0xcc)[_0x6c46('0x1a')]();});}};}function handleEntityNotFound(_0x34da47,_0x5721f4){return function(_0x17d698){if(!_0x17d698){_0x34da47[_0x6c46('0x18')](0x194);}return _0x17d698;};}function handleError(_0x579ead,_0x2045a7){_0x2045a7=_0x2045a7||0x1f4;return function(_0x17ff40){logger['error'](_0x17ff40['stack']);if(_0x17ff40[_0x6c46('0x28')]){delete _0x17ff40[_0x6c46('0x28')];}_0x579ead[_0x6c46('0x19')](_0x2045a7)[_0x6c46('0x29')](_0x17ff40);};}exports[_0x6c46('0x2a')]=function(_0x61b64c,_0x7194ad){var _0xa25849={},_0x582bc8={},_0x48de79={'count':0x0,'rows':[]};var _0x1b784b=_['map'](db[_0x6c46('0x2b')][_0x6c46('0x2c')],function(_0x51c35f){return{'name':_0x51c35f[_0x6c46('0x2d')],'type':_0x51c35f[_0x6c46('0x2e')][_0x6c46('0x2f')]};});_0x582bc8['model']=_[_0x6c46('0x30')](_0x1b784b,_0x6c46('0x28'));_0x582bc8['query']=_['keys'](_0x61b64c[_0x6c46('0x31')]);_0x582bc8[_0x6c46('0x32')]=_['intersection'](_0x582bc8['model'],_0x582bc8['query']);_0xa25849['attributes']=_[_0x6c46('0x33')](_0x582bc8[_0x6c46('0x34')],qs[_0x6c46('0x35')](_0x61b64c[_0x6c46('0x31')]['fields']));_0xa25849['attributes']=_0xa25849[_0x6c46('0x36')][_0x6c46('0x37')]?_0xa25849[_0x6c46('0x36')]:_0x582bc8['model'];if(!_0x61b64c[_0x6c46('0x31')][_0x6c46('0x38')](_0x6c46('0x39'))){_0xa25849['limit']=qs[_0x6c46('0x1f')](_0x61b64c[_0x6c46('0x31')][_0x6c46('0x1f')]);_0xa25849[_0x6c46('0x1c')]=qs[_0x6c46('0x1c')](_0x61b64c[_0x6c46('0x31')][_0x6c46('0x1c')]);}_0xa25849[_0x6c46('0x3a')]=qs[_0x6c46('0x3b')](_0x61b64c[_0x6c46('0x31')]['sort']);_0xa25849['where']=qs[_0x6c46('0x32')](_[_0x6c46('0x3c')](_0x61b64c[_0x6c46('0x31')],_0x582bc8[_0x6c46('0x32')]),_0x1b784b);if(_0x61b64c[_0x6c46('0x31')][_0x6c46('0x3d')]){_0xa25849[_0x6c46('0x3e')]=_['merge'](_0xa25849['where'],{'$or':_[_0x6c46('0x30')](_0x1b784b,function(_0x4076e8){if(_0x4076e8[_0x6c46('0x2e')]!==_0x6c46('0x3f')){var _0x1954c9={};_0x1954c9[_0x4076e8[_0x6c46('0x28')]]={'$like':'%'+_0x61b64c[_0x6c46('0x31')][_0x6c46('0x3d')]+'%'};return _0x1954c9;}})});}_0xa25849=_[_0x6c46('0x40')]({},_0xa25849,_0x61b64c['options']);var _0x88b276={'where':_0xa25849['where']};return db[_0x6c46('0x2b')][_0x6c46('0x1e')](_0x88b276)[_0x6c46('0x26')](function(_0x1dd7ca){_0x48de79[_0x6c46('0x1e')]=_0x1dd7ca;if(_0x61b64c[_0x6c46('0x31')][_0x6c46('0x41')]){_0xa25849['include']=[{'all':!![]}];}return db[_0x6c46('0x2b')][_0x6c46('0x42')](_0xa25849);})[_0x6c46('0x26')](function(_0x42d423){_0x48de79[_0x6c46('0x43')]=_0x42d423;return _0x48de79;})[_0x6c46('0x26')](respondWithFilteredResult(_0x7194ad,_0xa25849))[_0x6c46('0x44')](handleError(_0x7194ad,null));};exports[_0x6c46('0x45')]=function(_0x46c18e,_0x26ff08){var _0x14b124={'raw':!![],'where':{'id':_0x46c18e[_0x6c46('0x46')]['id']}},_0x5352aa={};_0x5352aa['model']=_['keys'](db[_0x6c46('0x2b')][_0x6c46('0x2c')]);_0x5352aa[_0x6c46('0x31')]=_[_0x6c46('0x47')](_0x46c18e['query']);_0x5352aa[_0x6c46('0x32')]=_['intersection'](_0x5352aa['model'],_0x5352aa[_0x6c46('0x31')]);_0x14b124['attributes']=_[_0x6c46('0x33')](_0x5352aa[_0x6c46('0x34')],qs[_0x6c46('0x35')](_0x46c18e[_0x6c46('0x31')]['fields']));_0x14b124[_0x6c46('0x36')]=_0x14b124[_0x6c46('0x36')][_0x6c46('0x37')]?_0x14b124[_0x6c46('0x36')]:_0x5352aa['model'];if(_0x46c18e[_0x6c46('0x31')][_0x6c46('0x41')]){_0x14b124[_0x6c46('0x48')]=[{'all':!![]}];}_0x14b124=_[_0x6c46('0x40')]({},_0x14b124,_0x46c18e['options']);return db[_0x6c46('0x2b')][_0x6c46('0x49')](_0x14b124)['then'](handleEntityNotFound(_0x26ff08,null))[_0x6c46('0x26')](respondWithResult(_0x26ff08,null))[_0x6c46('0x44')](handleError(_0x26ff08,null));};exports[_0x6c46('0x4a')]=function(_0x42d58c,_0x2212ec){return db[_0x6c46('0x2b')]['create'](_0x42d58c[_0x6c46('0x4b')],{})[_0x6c46('0x26')](respondWithResult(_0x2212ec,0xc9))[_0x6c46('0x44')](handleError(_0x2212ec,null));};exports['update']=function(_0x1f25b2,_0x5018a1){if(_0x1f25b2[_0x6c46('0x4b')]['id']){delete _0x1f25b2['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x1f25b2[_0x6c46('0x46')]['id']}})['then'](handleEntityNotFound(_0x5018a1,null))[_0x6c46('0x26')](saveUpdates(_0x1f25b2[_0x6c46('0x4b')],null))[_0x6c46('0x26')](respondWithResult(_0x5018a1,null))[_0x6c46('0x44')](handleError(_0x5018a1,null));};exports[_0x6c46('0x27')]=function(_0x4ae006,_0x475018){return db[_0x6c46('0x2b')][_0x6c46('0x49')]({'where':{'id':_0x4ae006[_0x6c46('0x46')]['id']}})[_0x6c46('0x26')](handleEntityNotFound(_0x475018,null))[_0x6c46('0x26')](removeEntity(_0x475018,null))[_0x6c46('0x44')](handleError(_0x475018,null));};exports['describe']=function(_0xa0ce5d,_0x416a45){return db[_0x6c46('0x2b')][_0x6c46('0x4c')]()[_0x6c46('0x26')](respondWithResult(_0x416a45,null))[_0x6c46('0x44')](handleError(_0x416a45,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a2aef1e..f5d4f7d 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 _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 +var _0x3753=['uniqueid','lodash','../../config/logger','api','bluebird','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x42d7f4,_0x5e9ae8){var _0x49e630=function(_0x345ea1){while(--_0x345ea1){_0x42d7f4['push'](_0x42d7f4['shift']());}};_0x49e630(++_0x5e9ae8);}(_0x3753,0x6d));var _0x3375=function(_0x2ad921,_0x3ec1d1){_0x2ad921=_0x2ad921-0x0;var _0x419042=_0x3753[_0x2ad921];return _0x419042;};'use strict';var _=require(_0x3375('0x0'));var util=require('util');var logger=require(_0x3375('0x1'))(_0x3375('0x2'));var moment=require('moment');var BPromise=require(_0x3375('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3375('0x4'));var rimraf=require('rimraf');var config=require(_0x3375('0x5'));var attributes=require(_0x3375('0x6'));module[_0x3375('0x7')]=function(_0x3a4bff,_0xced98c){return _0x3a4bff[_0x3375('0x8')](_0x3375('0x9'),attributes,{'tableName':_0x3375('0xa'),'paranoid':![],'indexes':[{'name':_0x3375('0xb'),'fields':[_0x3375('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 308ea67..756b77d 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 _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 +var _0xbd0f=['message','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3e7301,_0x44a2f0){var _0x25ecec=function(_0x44f285){while(--_0x44f285){_0x3e7301['push'](_0x3e7301['shift']());}};_0x25ecec(++_0x44a2f0);}(_0xbd0f,0xca));var _0xfbd0=function(_0x38c4e2,_0x4b0fd3){_0x38c4e2=_0x38c4e2-0x0;var _0x56d329=_0xbd0f[_0x38c4e2];return _0x56d329;};'use strict';var _=require('lodash');var util=require(_0xfbd0('0x0'));var moment=require(_0xfbd0('0x1'));var BPromise=require(_0xfbd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfbd0('0x3'));var logger=require(_0xfbd0('0x4'))(_0xfbd0('0x5'));var config=require('../../config/environment');var jayson=require(_0xfbd0('0x6'));var client=jayson['client'][_0xfbd0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x225c39,_0x567b28,_0x333d01){return new BPromise(function(_0xd0851f,_0x3c5bfb){return client[_0xfbd0('0x8')](_0x225c39,_0x333d01)[_0xfbd0('0x9')](function(_0x5c51a1){logger[_0xfbd0('0xa')](_0xfbd0('0xb'),_0x567b28,_0xfbd0('0xc'));logger[_0xfbd0('0xd')](_0xfbd0('0xe'),_0x567b28,'request\x20sent',JSON[_0xfbd0('0xf')](_0x5c51a1));if(_0x5c51a1[_0xfbd0('0x10')]){if(_0x5c51a1[_0xfbd0('0x10')][_0xfbd0('0x11')]===0x1f4){logger['error'](_0xfbd0('0xb'),_0x567b28,_0x5c51a1['error']['message']);return _0x3c5bfb(_0x5c51a1[_0xfbd0('0x10')][_0xfbd0('0x12')]);}logger[_0xfbd0('0x10')](_0xfbd0('0xb'),_0x567b28,_0x5c51a1['error']['message']);return _0xd0851f(_0x5c51a1[_0xfbd0('0x10')][_0xfbd0('0x12')]);}else{logger[_0xfbd0('0xa')](_0xfbd0('0xb'),_0x567b28,_0xfbd0('0xc'));_0xd0851f(_0x5c51a1['result'][_0xfbd0('0x12')]);}})[_0xfbd0('0x13')](function(_0x9799d1){logger['error'](_0xfbd0('0xb'),_0x567b28,_0x9799d1);_0x3c5bfb(_0x9799d1);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index d1d6171..8a876cf 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 _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 +var _0xb946=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0xe5e7d3,_0x3e2a69){var _0x34f913=function(_0x5d9cc3){while(--_0x5d9cc3){_0xe5e7d3['push'](_0xe5e7d3['shift']());}};_0x34f913(++_0x3e2a69);}(_0xb946,0x1b3));var _0x6b94=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb946[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x6b94('0x0'));var util=require(_0x6b94('0x1'));var path=require(_0x6b94('0x2'));var timeout=require('connect-timeout');var express=require(_0x6b94('0x3'));var router=express[_0x6b94('0x4')]();var fs_extra=require(_0x6b94('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6b94('0x6'));var config=require(_0x6b94('0x7'));var controller=require('./faxTransferReport.controller');router[_0x6b94('0x8')]('/',auth[_0x6b94('0x9')](),controller[_0x6b94('0xa')]);router[_0x6b94('0x8')](_0x6b94('0xb'),auth[_0x6b94('0x9')](),controller[_0x6b94('0xc')]);router[_0x6b94('0x8')](_0x6b94('0xd'),auth[_0x6b94('0x9')](),controller[_0x6b94('0xe')]);router[_0x6b94('0xf')]('/',auth['isAuthenticated'](),controller[_0x6b94('0x10')]);router['put'](_0x6b94('0xd'),auth[_0x6b94('0x9')](),controller[_0x6b94('0x11')]);router[_0x6b94('0x12')](_0x6b94('0xd'),auth[_0x6b94('0x9')](),controller[_0x6b94('0x13')]);module[_0x6b94('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5d7ccb7..10c6217 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 _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 +var _0xe391=['./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xe391,0x156));var _0x1e39=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xe391[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require(_0x1e39('0x0'));var util=require(_0x1e39('0x1'));var path=require(_0x1e39('0x2'));var timeout=require(_0x1e39('0x3'));var express=require(_0x1e39('0x4'));var router=express['Router']();var fs_extra=require(_0x1e39('0x5'));var auth=require(_0x1e39('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1e39('0x7'));var controller=require(_0x1e39('0x8'));router[_0x1e39('0x9')]('/',auth[_0x1e39('0xa')](),controller[_0x1e39('0xb')]);router['get']('/:id',auth[_0x1e39('0xa')](),controller[_0x1e39('0xc')]);router[_0x1e39('0x9')](_0x1e39('0xd'),auth[_0x1e39('0xa')](),controller[_0x1e39('0xe')]);router[_0x1e39('0x9')](_0x1e39('0xf'),auth['isAuthenticated'](),controller[_0x1e39('0x10')]);router[_0x1e39('0x11')]('/',auth[_0x1e39('0xa')](),controller[_0x1e39('0x12')]);router[_0x1e39('0x11')](_0x1e39('0xd'),auth['isAuthenticated'](),controller[_0x1e39('0x13')]);router[_0x1e39('0x14')](_0x1e39('0x15'),auth[_0x1e39('0xa')](),controller[_0x1e39('0x16')]);router['delete'](_0x1e39('0x15'),auth[_0x1e39('0xa')](),controller[_0x1e39('0x17')]);module[_0x1e39('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 79aa4ce..9c325f2 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 _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 +var _0x197b=['ENUM','basic','sequelize','STRING'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x197b,0xfa));var _0xb197=function(_0x29ffd3,_0x16289b){_0x29ffd3=_0x29ffd3-0x0;var _0x2c2a06=_0x197b[_0x29ffd3];return _0x2c2a06;};'use strict';var Sequelize=require(_0xb197('0x0'));module['exports']={'name':{'type':Sequelize[_0xb197('0x1')]},'description':{'type':Sequelize[_0xb197('0x1')]},'username':{'type':Sequelize[_0xb197('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xb197('0x2')](_0xb197('0x3')),'defaultValue':_0xb197('0x3')},'password':{'type':Sequelize[_0xb197('0x1')]},'consumerKey':{'type':Sequelize[_0xb197('0x1')]},'consumerSecret':{'type':Sequelize[_0xb197('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xb197('0x1')]},'serverUrl':{'type':Sequelize[_0xb197('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb197('0x2')]('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 12c68c6..ee8aaaa 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 _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 +var _0x0ed6=['params','intersection','find','create','update','body','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','priority','remoteUri','authType','username','password','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','basic','Authorization','format','%s:%s','toString','base64','concat','_embedded','entries','label','test','getFields','stringify','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','limit','undefined','count','offset','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x2812c5,_0x124b54){var _0x4a99a1=function(_0x9116e2){while(--_0x9116e2){_0x2812c5['push'](_0x2812c5['shift']());}};_0x4a99a1(++_0x124b54);}(_0x0ed6,0x1d4));var _0x60ed=function(_0x21ea6f,_0x4416ad){_0x21ea6f=_0x21ea6f-0x0;var _0x30b29b=_0x0ed6[_0x21ea6f];return _0x30b29b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x60ed('0x0'));var jsonpatch=require(_0x60ed('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x60ed('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x60ed('0x3'));var sox=require('sox');var csv=require(_0x60ed('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x60ed('0x5'));var _=require(_0x60ed('0x6'));var squel=require(_0x60ed('0x7'));var crypto=require(_0x60ed('0x8'));var jsforce=require(_0x60ed('0x9'));var deskjs=require(_0x60ed('0xa'));var toCsv=require('to-csv');var querystring=require(_0x60ed('0xb'));var Papa=require(_0x60ed('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x60ed('0xd'));var hardwareService=require(_0x60ed('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x60ed('0xf'));var config=require(_0x60ed('0x10'));var licenseUtil=require(_0x60ed('0x11'));var db=require(_0x60ed('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x34ee9f,_0x522327){_0x522327=_0x522327||0xcc;return function(_0x3f9831){if(_0x3f9831){return _0x34ee9f['sendStatus'](_0x522327);}return _0x34ee9f['status'](_0x522327)[_0x60ed('0x13')]();};}function respondWithResult(_0x1255a9,_0x5f24b6){_0x5f24b6=_0x5f24b6||0xc8;return function(_0x170f58){if(_0x170f58){return _0x1255a9[_0x60ed('0x14')](_0x5f24b6)[_0x60ed('0x15')](_0x170f58);}};}function respondWithFilteredResult(_0x3e8942,_0x38ebb5){return function(_0x26f08e){if(_0x26f08e){var _0x3032a8=typeof _0x38ebb5['offset']==='undefined'&&typeof _0x38ebb5[_0x60ed('0x16')]===_0x60ed('0x17');var _0x1f69aa=_0x26f08e[_0x60ed('0x18')];var _0x585a86=_0x3032a8?0x0:_0x38ebb5['offset'];var _0x4aa3d3=_0x3032a8?_0x26f08e[_0x60ed('0x18')]:_0x38ebb5[_0x60ed('0x19')]+_0x38ebb5['limit'];var _0x211afd;if(_0x4aa3d3>=_0x1f69aa){_0x4aa3d3=_0x1f69aa;_0x211afd=0xc8;}else{_0x211afd=0xce;}_0x3e8942[_0x60ed('0x14')](_0x211afd);return _0x3e8942['set']('Content-Range',_0x585a86+'-'+_0x4aa3d3+'/'+_0x1f69aa)[_0x60ed('0x15')](_0x26f08e);}return null;};}function patchUpdates(_0x5d2928){return function(_0x5ac76d){try{jsonpatch[_0x60ed('0x1a')](_0x5ac76d,_0x5d2928,!![]);}catch(_0x151993){return BPromise[_0x60ed('0x1b')](_0x151993);}return _0x5ac76d['save']();};}function saveUpdates(_0x5371f5,_0x1ccda6){return function(_0x419e60){if(_0x419e60){return _0x419e60['update'](_0x5371f5)[_0x60ed('0x1c')](function(_0x30af8d){return _0x30af8d;});}return null;};}function removeEntity(_0x15aacb,_0x1e9009){return function(_0x26606d){if(_0x26606d){return _0x26606d[_0x60ed('0x1d')]()[_0x60ed('0x1c')](function(){_0x15aacb[_0x60ed('0x14')](0xcc)[_0x60ed('0x13')]();});}};}function handleEntityNotFound(_0x4ab71b,_0x285eab){return function(_0x5c9ce4){if(!_0x5c9ce4){_0x4ab71b[_0x60ed('0x1e')](0x194);}return _0x5c9ce4;};}function handleError(_0xd153c,_0x1a7834){_0x1a7834=_0x1a7834||0x1f4;return function(_0x5b0916){logger[_0x60ed('0x1f')](_0x5b0916[_0x60ed('0x20')]);if(_0x5b0916[_0x60ed('0x21')]){delete _0x5b0916['name'];}_0xd153c[_0x60ed('0x14')](_0x1a7834)[_0x60ed('0x22')](_0x5b0916);};}exports['index']=function(_0x3199ef,_0x3232c8){var _0x35299e={},_0xfde300={},_0x4ead6e={'count':0x0,'rows':[]};var _0x596f6e=_[_0x60ed('0x23')](db[_0x60ed('0x24')][_0x60ed('0x25')],function(_0x216f39){return{'name':_0x216f39[_0x60ed('0x26')],'type':_0x216f39[_0x60ed('0x27')][_0x60ed('0x28')]};});_0xfde300[_0x60ed('0x29')]=_[_0x60ed('0x23')](_0x596f6e,_0x60ed('0x21'));_0xfde300[_0x60ed('0x2a')]=_[_0x60ed('0x2b')](_0x3199ef[_0x60ed('0x2a')]);_0xfde300[_0x60ed('0x2c')]=_['intersection'](_0xfde300[_0x60ed('0x29')],_0xfde300[_0x60ed('0x2a')]);_0x35299e['attributes']=_['intersection'](_0xfde300['model'],qs[_0x60ed('0x2d')](_0x3199ef['query'][_0x60ed('0x2d')]));_0x35299e[_0x60ed('0x2e')]=_0x35299e[_0x60ed('0x2e')][_0x60ed('0x2f')]?_0x35299e[_0x60ed('0x2e')]:_0xfde300[_0x60ed('0x29')];if(!_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x30')]('nolimit')){_0x35299e[_0x60ed('0x16')]=qs[_0x60ed('0x16')](_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x16')]);_0x35299e[_0x60ed('0x19')]=qs[_0x60ed('0x19')](_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x19')]);}_0x35299e['order']=qs[_0x60ed('0x31')](_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x31')]);_0x35299e[_0x60ed('0x32')]=qs[_0x60ed('0x2c')](_[_0x60ed('0x33')](_0x3199ef['query'],_0xfde300[_0x60ed('0x2c')]),_0x596f6e);if(_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x34')]){_0x35299e[_0x60ed('0x32')]=_[_0x60ed('0x35')](_0x35299e[_0x60ed('0x32')],{'$or':_[_0x60ed('0x23')](_0x596f6e,function(_0x2b160b){if(_0x2b160b[_0x60ed('0x27')]!==_0x60ed('0x36')){var _0x11a2ab={};_0x11a2ab[_0x2b160b[_0x60ed('0x21')]]={'$like':'%'+_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x34')]+'%'};return _0x11a2ab;}})});}_0x35299e=_['merge']({},_0x35299e,_0x3199ef[_0x60ed('0x37')]);var _0x38048e={'where':_0x35299e['where']};return db[_0x60ed('0x24')][_0x60ed('0x18')](_0x38048e)[_0x60ed('0x1c')](function(_0x3462c8){_0x4ead6e[_0x60ed('0x18')]=_0x3462c8;if(_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x38')]){_0x35299e[_0x60ed('0x39')]=[{'all':!![]}];}return db['DeskAccount'][_0x60ed('0x3a')](_0x35299e);})['then'](function(_0x3388c9){_0x4ead6e[_0x60ed('0x3b')]=_0x3388c9;return _0x4ead6e;})[_0x60ed('0x1c')](respondWithFilteredResult(_0x3232c8,_0x35299e))[_0x60ed('0x3c')](handleError(_0x3232c8,null));};exports[_0x60ed('0x3d')]=function(_0x393c66,_0x487374){var _0x20ac59={'raw':![],'where':{'id':_0x393c66[_0x60ed('0x3e')]['id']}},_0x46d73a={};_0x46d73a['model']=_[_0x60ed('0x2b')](db['DeskAccount'][_0x60ed('0x25')]);_0x46d73a['query']=_[_0x60ed('0x2b')](_0x393c66['query']);_0x46d73a[_0x60ed('0x2c')]=_[_0x60ed('0x3f')](_0x46d73a[_0x60ed('0x29')],_0x46d73a[_0x60ed('0x2a')]);_0x20ac59['attributes']=_[_0x60ed('0x3f')](_0x46d73a[_0x60ed('0x29')],qs['fields'](_0x393c66[_0x60ed('0x2a')][_0x60ed('0x2d')]));_0x20ac59[_0x60ed('0x2e')]=_0x20ac59[_0x60ed('0x2e')][_0x60ed('0x2f')]?_0x20ac59[_0x60ed('0x2e')]:_0x46d73a[_0x60ed('0x29')];if(_0x393c66[_0x60ed('0x2a')][_0x60ed('0x38')]){_0x20ac59[_0x60ed('0x39')]=[{'all':!![]}];}_0x20ac59=_['merge']({},_0x20ac59,_0x393c66[_0x60ed('0x37')]);return db[_0x60ed('0x24')][_0x60ed('0x40')](_0x20ac59)[_0x60ed('0x1c')](handleEntityNotFound(_0x487374,null))[_0x60ed('0x1c')](respondWithResult(_0x487374,null))['catch'](handleError(_0x487374,null));};exports['create']=function(_0x4bb53c,_0x5838dc){return db[_0x60ed('0x24')][_0x60ed('0x41')](_0x4bb53c['body'],{})['then'](respondWithResult(_0x5838dc,0xc9))[_0x60ed('0x3c')](handleError(_0x5838dc,null));};exports[_0x60ed('0x42')]=function(_0x5b4cf5,_0xd4de5d){if(_0x5b4cf5[_0x60ed('0x43')]['id']){delete _0x5b4cf5['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x5b4cf5['params']['id']}})[_0x60ed('0x1c')](handleEntityNotFound(_0xd4de5d,null))[_0x60ed('0x1c')](saveUpdates(_0x5b4cf5[_0x60ed('0x43')],null))[_0x60ed('0x1c')](respondWithResult(_0xd4de5d,null))['catch'](handleError(_0xd4de5d,null));};exports[_0x60ed('0x1d')]=function(_0x271746,_0x47ce0e){return db[_0x60ed('0x24')]['find']({'where':{'id':_0x271746[_0x60ed('0x3e')]['id']}})[_0x60ed('0x1c')](handleEntityNotFound(_0x47ce0e,null))[_0x60ed('0x1c')](removeEntity(_0x47ce0e,null))['catch'](handleError(_0x47ce0e,null));};exports[_0x60ed('0x44')]=function(_0x73a479,_0x48670d,_0x32825d){var _0x8b3787={};var _0x3f15fb={};var _0x2e134e;var _0x20ea23;return db[_0x60ed('0x24')][_0x60ed('0x45')]({'where':{'id':_0x73a479[_0x60ed('0x3e')]['id']}})['then'](handleEntityNotFound(_0x48670d,null))[_0x60ed('0x1c')](function(_0x44b56d){if(_0x44b56d){_0x2e134e=_0x44b56d;_0x3f15fb[_0x60ed('0x29')]=_[_0x60ed('0x2b')](db[_0x60ed('0x46')][_0x60ed('0x25')]);_0x3f15fb['query']=_[_0x60ed('0x2b')](_0x73a479[_0x60ed('0x2a')]);_0x3f15fb[_0x60ed('0x2c')]=_[_0x60ed('0x3f')](_0x3f15fb[_0x60ed('0x29')],_0x3f15fb[_0x60ed('0x2a')]);_0x8b3787[_0x60ed('0x2e')]=_[_0x60ed('0x3f')](_0x3f15fb[_0x60ed('0x29')],qs[_0x60ed('0x2d')](_0x73a479[_0x60ed('0x2a')][_0x60ed('0x2d')]));_0x8b3787[_0x60ed('0x2e')]=_0x8b3787[_0x60ed('0x2e')]['length']?_0x8b3787[_0x60ed('0x2e')]:_0x3f15fb[_0x60ed('0x29')];_0x8b3787['order']=qs[_0x60ed('0x31')](_0x73a479['query'][_0x60ed('0x31')]);_0x8b3787[_0x60ed('0x32')]=qs[_0x60ed('0x2c')](_['pick'](_0x73a479[_0x60ed('0x2a')],_0x3f15fb[_0x60ed('0x2c')]));if(_0x73a479['query'][_0x60ed('0x34')]){_0x8b3787['where']=_[_0x60ed('0x35')](_0x8b3787['where'],{'$or':_['map'](_0x8b3787[_0x60ed('0x2e')],function(_0x5ebd2b){var _0x25b18f={};_0x25b18f[_0x5ebd2b]={'$like':'%'+_0x73a479[_0x60ed('0x2a')][_0x60ed('0x34')]+'%'};return _0x25b18f;})});}_0x8b3787=_[_0x60ed('0x35')]({},_0x8b3787,_0x73a479['options']);return _0x2e134e[_0x60ed('0x44')](_0x8b3787);}})['then'](function(_0x22f1fd){if(_0x22f1fd){_0x20ea23=_0x22f1fd[_0x60ed('0x2f')];if(!_0x73a479['query']['hasOwnProperty'](_0x60ed('0x47'))){_0x8b3787[_0x60ed('0x16')]=qs[_0x60ed('0x16')](_0x73a479['query']['limit']);_0x8b3787[_0x60ed('0x19')]=qs[_0x60ed('0x19')](_0x73a479['query'][_0x60ed('0x19')]);}return _0x2e134e[_0x60ed('0x44')](_0x8b3787);}})[_0x60ed('0x1c')](function(_0x3f0c05){if(_0x3f0c05){return _0x3f0c05?{'count':_0x20ea23,'rows':_0x3f0c05}:null;}})['then'](respondWithResult(_0x48670d,null))[_0x60ed('0x3c')](handleError(_0x48670d,null));};exports[_0x60ed('0x48')]=function(_0x23beb5,_0x136f9e,_0x13f3e8){if(_0x23beb5[_0x60ed('0x43')]['id']){delete _0x23beb5[_0x60ed('0x43')]['id'];}return db[_0x60ed('0x24')][_0x60ed('0x45')]({'where':{'id':_0x23beb5[_0x60ed('0x3e')]['id']}})[_0x60ed('0x1c')](handleEntityNotFound(_0x136f9e,null))['then'](function(_0x3e6e31){if(_0x3e6e31){_0x23beb5['body']['AccountId']=_0x3e6e31['id'];_0x23beb5['body'][_0x60ed('0x49')]=integrations[_0x60ed('0x4a')](_0x23beb5[_0x60ed('0x43')][_0x60ed('0x4b')],_0x23beb5['body']['type']);_0x23beb5[_0x60ed('0x43')][_0x60ed('0x4c')]=integrations[_0x60ed('0x4d')](_0x23beb5[_0x60ed('0x43')]['channel'],_0x23beb5['body']['type']);return db['DeskConfiguration'][_0x60ed('0x41')](_0x23beb5[_0x60ed('0x43')],{'include':[{'model':db[_0x60ed('0x4e')],'as':_0x60ed('0x49')},{'model':db[_0x60ed('0x4e')],'as':'Descriptions'}]});}return null;})[_0x60ed('0x1c')](respondWithResult(_0x136f9e,null))[_0x60ed('0x3c')](handleError(_0x136f9e,null));};exports['getFields']=function(_0x12775f,_0x455473,_0x58e429){var _0x322b68=[{'name':_0x60ed('0x4f'),'label':_0x60ed('0x4f'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4b4be0='';return db[_0x60ed('0x24')][_0x60ed('0x45')]({'where':{'id':_0x12775f['params']['id']},'attributes':['id',_0x60ed('0x50'),_0x60ed('0x51'),_0x60ed('0x52'),_0x60ed('0x53'),'consumerKey','consumerSecret',_0x60ed('0x54'),_0x60ed('0x55')]})[_0x60ed('0x1c')](handleEntityNotFound(_0x455473,null))[_0x60ed('0x1c')](function(_0x3f4bf2){if(_0x3f4bf2){_0x4b4be0=_0x3f4bf2[_0x60ed('0x50')];var _0x1ed31e=_0x4b4be0[_0x60ed('0x56')](-0x1);if(_0x1ed31e==='/'){_0x4b4be0=_0x4b4be0[_0x60ed('0x57')](0x0,_0x4b4be0[_0x60ed('0x58')](_0x1ed31e));}var _0x797413={'method':_0x60ed('0x59'),'uri':util['format'](_0x60ed('0x5a'),_0x4b4be0),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x3f4bf2[_0x60ed('0x51')]===_0x60ed('0x5b')){_0x797413['headers'][_0x60ed('0x5c')]=util['format']('Basic\x20%s',new Buffer(util[_0x60ed('0x5d')](_0x60ed('0x5e'),_0x3f4bf2[_0x60ed('0x52')],_0x3f4bf2[_0x60ed('0x53')]))[_0x60ed('0x5f')](_0x60ed('0x60')));}return rp(_0x797413)[_0x60ed('0x1c')](function(_0x1abeaa){return _0x322b68[_0x60ed('0x61')](_[_0x60ed('0x23')](_0x1abeaa[_0x60ed('0x62')][_0x60ed('0x63')],function(_0x2f370b){return{'id':_0x2f370b[_0x60ed('0x21')],'name':_0x2f370b[_0x60ed('0x21')],'type':_0x2f370b[_0x60ed('0x27')],'active':_0x2f370b['active'],'label':_0x2f370b[_0x60ed('0x64')],'custom':!![]};}));});}})[_0x60ed('0x1c')](function(_0x444fec){return{'count':_0x444fec[_0x60ed('0x2f')],'rows':_0x444fec};})[_0x60ed('0x1c')](respondWithResult(_0x455473,null))[_0x60ed('0x3c')](function(_0x548d13){var _0x4958c7=_0x12775f['query'][_0x60ed('0x65')]?0x1f4:_0x548d13['statusCode']||0x1f4;logger[_0x60ed('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x60ed('0x66'),_0x4958c7,JSON[_0x60ed('0x67')](_0x548d13));delete _0x548d13[_0x60ed('0x21')];if(_0x4958c7===0x191){_0x4958c7=0x190;}_0x455473[_0x60ed('0x14')](_0x4958c7)[_0x60ed('0x22')](_0x12775f[_0x60ed('0x2a')]['test']?{'message':_0x60ed('0x68'),'statusCode':_0x548d13[_0x60ed('0x69')]}:_0x548d13);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9cb4d2d..cb543ca 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 _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 +var _0x01d3=['request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x2e9c6d,_0xbecdb4){var _0x139a4f=function(_0x58566b){while(--_0x58566b){_0x2e9c6d['push'](_0x2e9c6d['shift']());}};_0x139a4f(++_0xbecdb4);}(_0x01d3,0xe9));var _0x301d=function(_0x151e0e,_0x126c83){_0x151e0e=_0x151e0e-0x0;var _0x1fd348=_0x01d3[_0x151e0e];return _0x1fd348;};'use strict';var _=require(_0x301d('0x0'));var util=require(_0x301d('0x1'));var logger=require(_0x301d('0x2'))(_0x301d('0x3'));var moment=require(_0x301d('0x4'));var BPromise=require('bluebird');var rp=require(_0x301d('0x5'));var fs=require('fs');var path=require(_0x301d('0x6'));var rimraf=require(_0x301d('0x7'));var config=require(_0x301d('0x8'));var attributes=require(_0x301d('0x9'));var integrations=require(_0x301d('0xa'));module[_0x301d('0xb')]=function(_0x2e0582,_0x598fe8){return _0x2e0582[_0x301d('0xc')](_0x301d('0xd'),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 4151a3a..d24ce6d 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 _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 +var _0x6057=['find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','options','where','attributes','limit','map','include','model'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x6057,0x162));var _0x7605=function(_0x39758d,_0x346423){_0x39758d=_0x39758d-0x0;var _0x44ac11=_0x6057[_0x39758d];return _0x44ac11;};'use strict';var _=require(_0x7605('0x0'));var util=require(_0x7605('0x1'));var moment=require(_0x7605('0x2'));var BPromise=require(_0x7605('0x3'));var rs=require(_0x7605('0x4'));var fs=require('fs');var Redis=require(_0x7605('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7605('0x6'))(_0x7605('0x7'));var config=require('../../config/environment');var jayson=require(_0x7605('0x8'));var client=jayson[_0x7605('0x9')][_0x7605('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x348e63,_0x24815f,_0x77ef97){return new BPromise(function(_0x3b5493,_0x1242e0){return client['request'](_0x348e63,_0x77ef97)[_0x7605('0xb')](function(_0x3a2a49){logger[_0x7605('0xc')](_0x7605('0xd'),_0x24815f,_0x7605('0xe'));logger[_0x7605('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x24815f,'request\x20sent',JSON[_0x7605('0x10')](_0x3a2a49));if(_0x3a2a49[_0x7605('0x11')]){if(_0x3a2a49[_0x7605('0x11')]['code']===0x1f4){logger[_0x7605('0x11')](_0x7605('0xd'),_0x24815f,_0x3a2a49[_0x7605('0x11')]['message']);return _0x1242e0(_0x3a2a49[_0x7605('0x11')][_0x7605('0x12')]);}logger[_0x7605('0x11')](_0x7605('0xd'),_0x24815f,_0x3a2a49[_0x7605('0x11')][_0x7605('0x12')]);return _0x3b5493(_0x3a2a49['error'][_0x7605('0x12')]);}else{logger['info'](_0x7605('0xd'),_0x24815f,_0x7605('0xe'));_0x3b5493(_0x3a2a49[_0x7605('0x13')][_0x7605('0x12')]);}})[_0x7605('0x14')](function(_0x35989e){logger[_0x7605('0x11')](_0x7605('0xd'),_0x24815f,_0x35989e);_0x1242e0(_0x35989e);});});}exports[_0x7605('0x15')]=function(_0x1c8420){var _0x5e1c44=this;return new Promise(function(_0x23adc7,_0x36d28d){return db[_0x7605('0x16')]['findAll']({'raw':_0x1c8420['options']?_0x1c8420[_0x7605('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1c8420[_0x7605('0x17')]?_0x1c8420[_0x7605('0x17')][_0x7605('0x18')]||null:null,'attributes':_0x1c8420[_0x7605('0x17')]?_0x1c8420['options'][_0x7605('0x19')]||null:null,'limit':_0x1c8420[_0x7605('0x17')]?_0x1c8420[_0x7605('0x17')][_0x7605('0x1a')]||null:null,'include':_0x1c8420['options']?_0x1c8420[_0x7605('0x17')]['include']?_[_0x7605('0x1b')](_0x1c8420[_0x7605('0x17')][_0x7605('0x1c')],function(_0x2ae194){return{'model':db[_0x2ae194['model']],'as':_0x2ae194['as'],'attributes':_0x2ae194['attributes'],'include':_0x2ae194[_0x7605('0x1c')]?_['map'](_0x2ae194['include'],function(_0x5edc15){return{'model':db[_0x5edc15[_0x7605('0x1d')]],'as':_0x5edc15['as'],'attributes':_0x5edc15[_0x7605('0x19')],'include':_0x5edc15['include']?_['map'](_0x5edc15[_0x7605('0x1c')],function(_0x193574){return{'model':db[_0x193574[_0x7605('0x1d')]],'as':_0x193574['as'],'attributes':_0x193574[_0x7605('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2560fa){logger[_0x7605('0xc')](_0x7605('0x15'),_0x1c8420);logger[_0x7605('0xf')](_0x7605('0x15'),_0x1c8420,JSON['stringify'](_0x2560fa));_0x23adc7(_0x2560fa);})[_0x7605('0x14')](function(_0x3fd342){logger[_0x7605('0x11')]('GetDeskAccount',_0x3fd342[_0x7605('0x12')],_0x1c8420);_0x36d28d(_0x5e1c44[_0x7605('0x11')](0x1f4,_0x3fd342['message']));});});};exports['ShowDeskAccount']=function(_0x1ff2fc){var _0x2e9b46=this;return new Promise(function(_0x44a493,_0x24962f){return db[_0x7605('0x16')][_0x7605('0x1e')]({'raw':_0x1ff2fc['options']?_0x1ff2fc['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ff2fc[_0x7605('0x17')]?_0x1ff2fc[_0x7605('0x17')]['where']||null:null,'attributes':_0x1ff2fc[_0x7605('0x17')]?_0x1ff2fc['options'][_0x7605('0x19')]||null:null,'include':_0x1ff2fc[_0x7605('0x17')]?_0x1ff2fc[_0x7605('0x17')]['include']?_['map'](_0x1ff2fc['options']['include'],function(_0x464acd){return{'model':db[_0x464acd['model']],'as':_0x464acd['as'],'attributes':_0x464acd['attributes'],'include':_0x464acd['include']?_[_0x7605('0x1b')](_0x464acd[_0x7605('0x1c')],function(_0x2c8fc8){return{'model':db[_0x2c8fc8[_0x7605('0x1d')]],'as':_0x2c8fc8['as'],'attributes':_0x2c8fc8[_0x7605('0x19')],'include':_0x2c8fc8[_0x7605('0x1c')]?_['map'](_0x2c8fc8[_0x7605('0x1c')],function(_0x4a2759){return{'model':db[_0x4a2759[_0x7605('0x1d')]],'as':_0x4a2759['as'],'attributes':_0x4a2759[_0x7605('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23a738){logger['info'](_0x7605('0x1f'),_0x1ff2fc);logger[_0x7605('0xf')](_0x7605('0x1f'),_0x1ff2fc,JSON[_0x7605('0x10')](_0x23a738));_0x44a493(_0x23a738);})[_0x7605('0x14')](function(_0x169dbf){logger['error'](_0x7605('0x1f'),_0x169dbf[_0x7605('0x12')],_0x1ff2fc);_0x24962f(_0x2e9b46[_0x7605('0x11')](0x1f4,_0x169dbf[_0x7605('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index bd0a8a5..a1de64a 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 _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 +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(_0x4aee90,_0x35faaa){var _0x4fd2ea=function(_0x1617cd){while(--_0x1617cd){_0x4aee90['push'](_0x4aee90['shift']());}};_0x4fd2ea(++_0x35faaa);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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 f60c91e..058f85d 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 _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 +var _0x9df1=['STRING','exports'];(function(_0x2cc74a,_0x3027cf){var _0x36340c=function(_0x3e3451){while(--_0x3e3451){_0x2cc74a['push'](_0x2cc74a['shift']());}};_0x36340c(++_0x3027cf);}(_0x9df1,0xd7));var _0x19df=function(_0x2ea067,_0x18fe65){_0x2ea067=_0x2ea067-0x0;var _0x412cfc=_0x9df1[_0x2ea067];return _0x412cfc;};'use strict';var Sequelize=require('sequelize');module[_0x19df('0x0')]={'name':{'type':Sequelize[_0x19df('0x1')]},'description':{'type':Sequelize[_0x19df('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4063cac..f3eed6b 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 _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 +var _0x7be5=['DeskConfiguration','count','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','getFields','findOne','DeskField','length','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x7be5,0x11a));var _0x57be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be5[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x57be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57be('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x57be('0x2'));var BPromise=require(_0x57be('0x3'));var Mustache=require(_0x57be('0x4'));var util=require(_0x57be('0x5'));var path=require(_0x57be('0x6'));var sox=require('sox');var csv=require(_0x57be('0x7'));var ejs=require(_0x57be('0x8'));var fs=require('fs');var fs_extra=require(_0x57be('0x9'));var _=require(_0x57be('0xa'));var squel=require(_0x57be('0xb'));var crypto=require(_0x57be('0xc'));var jsforce=require(_0x57be('0xd'));var deskjs=require(_0x57be('0xe'));var toCsv=require('to-csv');var querystring=require(_0x57be('0xf'));var Papa=require(_0x57be('0x10'));var Redis=require(_0x57be('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x57be('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57be('0x13'));var logger=require(_0x57be('0x14'))('api');var utils=require(_0x57be('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x57be('0x16'))['db'];function respondWithStatusCode(_0x3533f0,_0x5897d7){_0x5897d7=_0x5897d7||0xcc;return function(_0x420e6b){if(_0x420e6b){return _0x3533f0[_0x57be('0x17')](_0x5897d7);}return _0x3533f0['status'](_0x5897d7)[_0x57be('0x18')]();};}function respondWithResult(_0x419b4b,_0x9e693c){_0x9e693c=_0x9e693c||0xc8;return function(_0x3ee092){if(_0x3ee092){return _0x419b4b[_0x57be('0x19')](_0x9e693c)['json'](_0x3ee092);}};}function respondWithFilteredResult(_0x5e8664,_0x38028b){return function(_0x188edf){if(_0x188edf){var _0x366fda=typeof _0x38028b[_0x57be('0x1a')]===_0x57be('0x1b')&&typeof _0x38028b[_0x57be('0x1c')]===_0x57be('0x1b');var _0x1b7b67=_0x188edf['count'];var _0x2606ec=_0x366fda?0x0:_0x38028b[_0x57be('0x1a')];var _0x5725e9=_0x366fda?_0x188edf['count']:_0x38028b[_0x57be('0x1a')]+_0x38028b[_0x57be('0x1c')];var _0x5484d8;if(_0x5725e9>=_0x1b7b67){_0x5725e9=_0x1b7b67;_0x5484d8=0xc8;}else{_0x5484d8=0xce;}_0x5e8664[_0x57be('0x19')](_0x5484d8);return _0x5e8664[_0x57be('0x1d')](_0x57be('0x1e'),_0x2606ec+'-'+_0x5725e9+'/'+_0x1b7b67)[_0x57be('0x1f')](_0x188edf);}return null;};}function patchUpdates(_0x327f7c){return function(_0x3b776){try{jsonpatch[_0x57be('0x20')](_0x3b776,_0x327f7c,!![]);}catch(_0x2cbaab){return BPromise[_0x57be('0x21')](_0x2cbaab);}return _0x3b776[_0x57be('0x22')]();};}function saveUpdates(_0x4c2707,_0x2b0e8d){return function(_0x33aeea){if(_0x33aeea){return _0x33aeea[_0x57be('0x23')](_0x4c2707)[_0x57be('0x24')](function(_0x3cd312){return _0x3cd312;});}return null;};}function removeEntity(_0x15a06a,_0x2d6a75){return function(_0x5c9eaf){if(_0x5c9eaf){return _0x5c9eaf[_0x57be('0x25')]()[_0x57be('0x24')](function(){_0x15a06a[_0x57be('0x19')](0xcc)[_0x57be('0x18')]();});}};}function handleEntityNotFound(_0x1ce789,_0x5ae90b){return function(_0x5b517e){if(!_0x5b517e){_0x1ce789[_0x57be('0x17')](0x194);}return _0x5b517e;};}function handleError(_0x665015,_0x3d08d9){_0x3d08d9=_0x3d08d9||0x1f4;return function(_0x4e6070){logger[_0x57be('0x26')](_0x4e6070['stack']);if(_0x4e6070[_0x57be('0x27')]){delete _0x4e6070[_0x57be('0x27')];}_0x665015['status'](_0x3d08d9)[_0x57be('0x28')](_0x4e6070);};}exports[_0x57be('0x29')]=function(_0x40d0c4,_0x586873){var _0x311dca={},_0x5915e9={},_0x42b863={'count':0x0,'rows':[]};var _0x1a74d1=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0xb67954){return{'name':_0xb67954[_0x57be('0x2a')],'type':_0xb67954[_0x57be('0x2b')][_0x57be('0x2c')]};});_0x5915e9[_0x57be('0x2d')]=_[_0x57be('0x2e')](_0x1a74d1,_0x57be('0x27'));_0x5915e9[_0x57be('0x2f')]=_[_0x57be('0x30')](_0x40d0c4[_0x57be('0x2f')]);_0x5915e9[_0x57be('0x31')]=_['intersection'](_0x5915e9[_0x57be('0x2d')],_0x5915e9[_0x57be('0x2f')]);_0x311dca['attributes']=_[_0x57be('0x32')](_0x5915e9[_0x57be('0x2d')],qs[_0x57be('0x33')](_0x40d0c4[_0x57be('0x2f')]['fields']));_0x311dca['attributes']=_0x311dca[_0x57be('0x34')]['length']?_0x311dca[_0x57be('0x34')]:_0x5915e9['model'];if(!_0x40d0c4[_0x57be('0x2f')][_0x57be('0x35')](_0x57be('0x36'))){_0x311dca['limit']=qs[_0x57be('0x1c')](_0x40d0c4['query'][_0x57be('0x1c')]);_0x311dca[_0x57be('0x1a')]=qs[_0x57be('0x1a')](_0x40d0c4[_0x57be('0x2f')][_0x57be('0x1a')]);}_0x311dca[_0x57be('0x37')]=qs['sort'](_0x40d0c4[_0x57be('0x2f')][_0x57be('0x38')]);_0x311dca['where']=qs['filters'](_['pick'](_0x40d0c4[_0x57be('0x2f')],_0x5915e9[_0x57be('0x31')]),_0x1a74d1);if(_0x40d0c4['query']['filter']){_0x311dca[_0x57be('0x39')]=_[_0x57be('0x3a')](_0x311dca[_0x57be('0x39')],{'$or':_[_0x57be('0x2e')](_0x1a74d1,function(_0x401787){if(_0x401787[_0x57be('0x2b')]!==_0x57be('0x3b')){var _0x451273={};_0x451273[_0x401787['name']]={'$like':'%'+_0x40d0c4[_0x57be('0x2f')][_0x57be('0x3c')]+'%'};return _0x451273;}})});}_0x311dca=_['merge']({},_0x311dca,_0x40d0c4[_0x57be('0x3d')]);var _0x3786e8={'where':_0x311dca[_0x57be('0x39')]};return db[_0x57be('0x3e')][_0x57be('0x3f')](_0x3786e8)['then'](function(_0x160b70){_0x42b863[_0x57be('0x3f')]=_0x160b70;if(_0x40d0c4['query'][_0x57be('0x40')]){_0x311dca['include']=[{'all':!![]}];}return db[_0x57be('0x3e')][_0x57be('0x41')](_0x311dca);})['then'](function(_0x182581){_0x42b863[_0x57be('0x42')]=_0x182581;return _0x42b863;})[_0x57be('0x24')](respondWithFilteredResult(_0x586873,_0x311dca))[_0x57be('0x43')](handleError(_0x586873,null));};exports[_0x57be('0x44')]=function(_0x57db42,_0x2dd2cf){var _0x551647={'raw':![],'where':{'id':_0x57db42['params']['id']}},_0x59450c={};_0x59450c['model']=_['keys'](db[_0x57be('0x3e')][_0x57be('0x45')]);_0x59450c[_0x57be('0x2f')]=_[_0x57be('0x30')](_0x57db42[_0x57be('0x2f')]);_0x59450c[_0x57be('0x31')]=_[_0x57be('0x32')](_0x59450c[_0x57be('0x2d')],_0x59450c[_0x57be('0x2f')]);_0x551647[_0x57be('0x34')]=_[_0x57be('0x32')](_0x59450c[_0x57be('0x2d')],qs[_0x57be('0x33')](_0x57db42[_0x57be('0x2f')][_0x57be('0x33')]));_0x551647['attributes']=_0x551647[_0x57be('0x34')]['length']?_0x551647[_0x57be('0x34')]:_0x59450c['model'];if(_0x57db42[_0x57be('0x2f')]['includeAll']){_0x551647[_0x57be('0x46')]=[{'all':!![]}];}_0x551647=_[_0x57be('0x3a')]({},_0x551647,_0x57db42['options']);return db[_0x57be('0x3e')][_0x57be('0x47')](_0x551647)[_0x57be('0x24')](handleEntityNotFound(_0x2dd2cf,null))[_0x57be('0x24')](respondWithResult(_0x2dd2cf,null))[_0x57be('0x43')](handleError(_0x2dd2cf,null));};exports[_0x57be('0x48')]=function(_0x3490c4,_0x4806a5){return db[_0x57be('0x3e')][_0x57be('0x48')](_0x3490c4[_0x57be('0x49')],{})[_0x57be('0x24')](respondWithResult(_0x4806a5,0xc9))[_0x57be('0x43')](handleError(_0x4806a5,null));};exports[_0x57be('0x23')]=function(_0x464054,_0x49dfd4){if(_0x464054['body']['id']){delete _0x464054[_0x57be('0x49')]['id'];}return db[_0x57be('0x3e')]['find']({'where':{'id':_0x464054[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x49dfd4,null))[_0x57be('0x24')](saveUpdates(_0x464054['body'],null))[_0x57be('0x24')](respondWithResult(_0x49dfd4,null))['catch'](handleError(_0x49dfd4,null));};exports[_0x57be('0x25')]=function(_0x513b5,_0x1ff5b1){return db['DeskConfiguration'][_0x57be('0x47')]({'where':{'id':_0x513b5[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x1ff5b1,null))[_0x57be('0x24')](removeEntity(_0x1ff5b1,null))['catch'](handleError(_0x1ff5b1,null));};exports[_0x57be('0x4b')]=function(_0x7e9ce,_0x348b4f,_0x5535a7){var _0x1bcaf6={};var _0xdb732d={};var _0x569921;var _0x4d3fe6;return db[_0x57be('0x3e')][_0x57be('0x4c')]({'where':{'id':_0x7e9ce[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x348b4f,null))[_0x57be('0x24')](function(_0x2d6bb2){if(_0x2d6bb2){_0x569921=_0x2d6bb2;_0xdb732d[_0x57be('0x2d')]=_[_0x57be('0x30')](db[_0x57be('0x4d')]['rawAttributes']);_0xdb732d[_0x57be('0x2f')]=_[_0x57be('0x30')](_0x7e9ce['query']);_0xdb732d[_0x57be('0x31')]=_['intersection'](_0xdb732d['model'],_0xdb732d['query']);_0x1bcaf6[_0x57be('0x34')]=_[_0x57be('0x32')](_0xdb732d['model'],qs[_0x57be('0x33')](_0x7e9ce[_0x57be('0x2f')][_0x57be('0x33')]));_0x1bcaf6[_0x57be('0x34')]=_0x1bcaf6[_0x57be('0x34')][_0x57be('0x4e')]?_0x1bcaf6[_0x57be('0x34')]:_0xdb732d[_0x57be('0x2d')];_0x1bcaf6[_0x57be('0x37')]=qs[_0x57be('0x38')](_0x7e9ce[_0x57be('0x2f')][_0x57be('0x38')]);_0x1bcaf6['where']=qs[_0x57be('0x31')](_[_0x57be('0x4f')](_0x7e9ce[_0x57be('0x2f')],_0xdb732d[_0x57be('0x31')]));if(_0x7e9ce[_0x57be('0x2f')][_0x57be('0x3c')]){_0x1bcaf6[_0x57be('0x39')]=_[_0x57be('0x3a')](_0x1bcaf6['where'],{'$or':_[_0x57be('0x2e')](_0x1bcaf6[_0x57be('0x34')],function(_0x2c7b6b){var _0x335565={};_0x335565[_0x2c7b6b]={'$like':'%'+_0x7e9ce[_0x57be('0x2f')][_0x57be('0x3c')]+'%'};return _0x335565;})});}_0x1bcaf6=_[_0x57be('0x3a')]({},_0x1bcaf6,_0x7e9ce[_0x57be('0x3d')]);return _0x569921[_0x57be('0x4b')](_0x1bcaf6);}})[_0x57be('0x24')](function(_0x100b0e){if(_0x100b0e){_0x4d3fe6=_0x100b0e[_0x57be('0x4e')];if(!_0x7e9ce['query']['hasOwnProperty']('nolimit')){_0x1bcaf6['limit']=qs[_0x57be('0x1c')](_0x7e9ce[_0x57be('0x2f')][_0x57be('0x1c')]);_0x1bcaf6[_0x57be('0x1a')]=qs[_0x57be('0x1a')](_0x7e9ce['query']['offset']);}return _0x569921[_0x57be('0x4b')](_0x1bcaf6);}})['then'](function(_0x347e98){if(_0x347e98){return _0x347e98?{'count':_0x4d3fe6,'rows':_0x347e98}:null;}})[_0x57be('0x24')](respondWithResult(_0x348b4f,null))[_0x57be('0x43')](handleError(_0x348b4f,null));};exports[_0x57be('0x50')]=function(_0x47959f,_0x5849ce,_0x287e70){var _0x250498={};var _0x3b4b49={};var _0x478828;var _0x4c5fc9;return db[_0x57be('0x3e')][_0x57be('0x4c')]({'where':{'id':_0x47959f[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x5849ce,null))[_0x57be('0x24')](function(_0x108707){if(_0x108707){_0x478828=_0x108707;_0x3b4b49[_0x57be('0x2d')]=_['keys'](db['DeskField'][_0x57be('0x45')]);_0x3b4b49['query']=_[_0x57be('0x30')](_0x47959f[_0x57be('0x2f')]);_0x3b4b49['filters']=_[_0x57be('0x32')](_0x3b4b49[_0x57be('0x2d')],_0x3b4b49['query']);_0x250498[_0x57be('0x34')]=_['intersection'](_0x3b4b49['model'],qs[_0x57be('0x33')](_0x47959f[_0x57be('0x2f')][_0x57be('0x33')]));_0x250498['attributes']=_0x250498[_0x57be('0x34')][_0x57be('0x4e')]?_0x250498[_0x57be('0x34')]:_0x3b4b49[_0x57be('0x2d')];_0x250498[_0x57be('0x37')]=qs[_0x57be('0x38')](_0x47959f['query'][_0x57be('0x38')]);_0x250498[_0x57be('0x39')]=qs['filters'](_[_0x57be('0x4f')](_0x47959f['query'],_0x3b4b49[_0x57be('0x31')]));if(_0x47959f[_0x57be('0x2f')][_0x57be('0x3c')]){_0x250498['where']=_[_0x57be('0x3a')](_0x250498[_0x57be('0x39')],{'$or':_['map'](_0x250498[_0x57be('0x34')],function(_0x3fe213){var _0x54fe0={};_0x54fe0[_0x3fe213]={'$like':'%'+_0x47959f[_0x57be('0x2f')][_0x57be('0x3c')]+'%'};return _0x54fe0;})});}_0x250498=_[_0x57be('0x3a')]({},_0x250498,_0x47959f['options']);return _0x478828['getSubjects'](_0x250498);}})[_0x57be('0x24')](function(_0x48f99e){if(_0x48f99e){_0x4c5fc9=_0x48f99e[_0x57be('0x4e')];if(!_0x47959f[_0x57be('0x2f')][_0x57be('0x35')](_0x57be('0x36'))){_0x250498['limit']=qs[_0x57be('0x1c')](_0x47959f[_0x57be('0x2f')][_0x57be('0x1c')]);_0x250498[_0x57be('0x1a')]=qs[_0x57be('0x1a')](_0x47959f[_0x57be('0x2f')][_0x57be('0x1a')]);}return _0x478828[_0x57be('0x50')](_0x250498);}})['then'](function(_0x429823){if(_0x429823){return _0x429823?{'count':_0x4c5fc9,'rows':_0x429823}:null;}})[_0x57be('0x24')](respondWithResult(_0x5849ce,null))[_0x57be('0x43')](handleError(_0x5849ce,null));};exports[_0x57be('0x51')]=function(_0x30fb4c,_0x5ec785,_0x3f35f3){var _0x12a7e0={};var _0x2f4f99={};var _0x35aefd;var _0x401adc;return db['DeskConfiguration'][_0x57be('0x4c')]({'where':{'id':_0x30fb4c[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x5ec785,null))['then'](function(_0x108908){if(_0x108908){_0x35aefd=_0x108908;_0x2f4f99[_0x57be('0x2d')]=_[_0x57be('0x30')](db[_0x57be('0x4d')][_0x57be('0x45')]);_0x2f4f99[_0x57be('0x2f')]=_[_0x57be('0x30')](_0x30fb4c[_0x57be('0x2f')]);_0x2f4f99['filters']=_['intersection'](_0x2f4f99[_0x57be('0x2d')],_0x2f4f99[_0x57be('0x2f')]);_0x12a7e0[_0x57be('0x34')]=_['intersection'](_0x2f4f99[_0x57be('0x2d')],qs[_0x57be('0x33')](_0x30fb4c[_0x57be('0x2f')]['fields']));_0x12a7e0[_0x57be('0x34')]=_0x12a7e0['attributes'][_0x57be('0x4e')]?_0x12a7e0[_0x57be('0x34')]:_0x2f4f99[_0x57be('0x2d')];_0x12a7e0[_0x57be('0x37')]=qs[_0x57be('0x38')](_0x30fb4c[_0x57be('0x2f')]['sort']);_0x12a7e0[_0x57be('0x39')]=qs[_0x57be('0x31')](_[_0x57be('0x4f')](_0x30fb4c[_0x57be('0x2f')],_0x2f4f99[_0x57be('0x31')]));if(_0x30fb4c[_0x57be('0x2f')]['filter']){_0x12a7e0[_0x57be('0x39')]=_[_0x57be('0x3a')](_0x12a7e0[_0x57be('0x39')],{'$or':_['map'](_0x12a7e0['attributes'],function(_0x4ad032){var _0x54c4f6={};_0x54c4f6[_0x4ad032]={'$like':'%'+_0x30fb4c['query'][_0x57be('0x3c')]+'%'};return _0x54c4f6;})});}_0x12a7e0=_[_0x57be('0x3a')]({},_0x12a7e0,_0x30fb4c[_0x57be('0x3d')]);return _0x35aefd['getDescriptions'](_0x12a7e0);}})[_0x57be('0x24')](function(_0x281a0d){if(_0x281a0d){_0x401adc=_0x281a0d['length'];if(!_0x30fb4c[_0x57be('0x2f')][_0x57be('0x35')]('nolimit')){_0x12a7e0[_0x57be('0x1c')]=qs[_0x57be('0x1c')](_0x30fb4c[_0x57be('0x2f')][_0x57be('0x1c')]);_0x12a7e0[_0x57be('0x1a')]=qs['offset'](_0x30fb4c[_0x57be('0x2f')][_0x57be('0x1a')]);}return _0x35aefd['getDescriptions'](_0x12a7e0);}})[_0x57be('0x24')](function(_0x18f93d){if(_0x18f93d){return _0x18f93d?{'count':_0x401adc,'rows':_0x18f93d}:null;}})[_0x57be('0x24')](respondWithResult(_0x5ec785,null))[_0x57be('0x43')](handleError(_0x5ec785,null));};exports[_0x57be('0x52')]=function(_0x161dd5,_0x2b8103,_0x4d8192){var _0x2f8ad4={};var _0x38480b={};var _0x38bb33;var _0x22044c;return db['DeskConfiguration']['findOne']({'where':{'id':_0x161dd5[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x2b8103,null))[_0x57be('0x24')](function(_0x3168ed){if(_0x3168ed){_0x38bb33=_0x3168ed;_0x38480b['model']=_['keys'](db[_0x57be('0x53')][_0x57be('0x45')]);_0x38480b[_0x57be('0x2f')]=_[_0x57be('0x30')](_0x161dd5[_0x57be('0x2f')]);_0x38480b[_0x57be('0x31')]=_['intersection'](_0x38480b[_0x57be('0x2d')],_0x38480b[_0x57be('0x2f')]);_0x2f8ad4[_0x57be('0x34')]=_[_0x57be('0x32')](_0x38480b[_0x57be('0x2d')],qs[_0x57be('0x33')](_0x161dd5['query'][_0x57be('0x33')]));_0x2f8ad4[_0x57be('0x34')]=_0x2f8ad4[_0x57be('0x34')][_0x57be('0x4e')]?_0x2f8ad4[_0x57be('0x34')]:_0x38480b['model'];_0x2f8ad4[_0x57be('0x37')]=qs[_0x57be('0x38')](_0x161dd5[_0x57be('0x2f')]['sort']);_0x2f8ad4[_0x57be('0x39')]=qs[_0x57be('0x31')](_[_0x57be('0x4f')](_0x161dd5[_0x57be('0x2f')],_0x38480b[_0x57be('0x31')]));if(_0x161dd5[_0x57be('0x2f')][_0x57be('0x3c')]){_0x2f8ad4[_0x57be('0x39')]=_[_0x57be('0x3a')](_0x2f8ad4[_0x57be('0x39')],{'$or':_[_0x57be('0x2e')](_0x2f8ad4['attributes'],function(_0x58bd72){var _0x20b6bc={};_0x20b6bc[_0x58bd72]={'$like':'%'+_0x161dd5[_0x57be('0x2f')][_0x57be('0x3c')]+'%'};return _0x20b6bc;})});}_0x2f8ad4=_['merge']({},_0x2f8ad4,_0x161dd5['options']);return _0x38bb33[_0x57be('0x52')](_0x2f8ad4);}})[_0x57be('0x24')](function(_0x111d99){if(_0x111d99){_0x22044c=_0x111d99[_0x57be('0x4e')];if(!_0x161dd5['query'][_0x57be('0x35')]('nolimit')){_0x2f8ad4[_0x57be('0x1c')]=qs['limit'](_0x161dd5[_0x57be('0x2f')]['limit']);_0x2f8ad4[_0x57be('0x1a')]=qs[_0x57be('0x1a')](_0x161dd5[_0x57be('0x2f')][_0x57be('0x1a')]);}return _0x38bb33[_0x57be('0x52')](_0x2f8ad4);}})['then'](function(_0x380c64){if(_0x380c64){return _0x380c64?{'count':_0x22044c,'rows':_0x380c64}:null;}})['then'](respondWithResult(_0x2b8103,null))[_0x57be('0x43')](handleError(_0x2b8103,null));};exports[_0x57be('0x54')]=function(_0x5abc36,_0x4b6753,_0x326052){if(_0x5abc36[_0x57be('0x49')]['id']){delete _0x5abc36[_0x57be('0x49')]['id'];}return db[_0x57be('0x3e')][_0x57be('0x4c')]({'where':{'id':_0x5abc36[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x4b6753,null))['then'](function(_0x25dd3b){if(_0x25dd3b){return _0x25dd3b[_0x57be('0x54')](_0x5abc36['body'][_0x57be('0x55')]||[]);}return null;})['then'](respondWithResult(_0x4b6753,null))[_0x57be('0x43')](handleError(_0x4b6753,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 93992e8..ffca2d1 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 _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 +var _0xd96b=['define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x4e321f,_0x4f0209){var _0x42687d=function(_0x510458){while(--_0x510458){_0x4e321f['push'](_0x4e321f['shift']());}};_0x42687d(++_0x4f0209);}(_0xd96b,0x196));var _0xbd96=function(_0x1b582b,_0x904dbf){_0x1b582b=_0x1b582b-0x0;var _0x1cc573=_0xd96b[_0x1b582b];return _0x1cc573;};'use strict';var _=require(_0xbd96('0x0'));var util=require(_0xbd96('0x1'));var logger=require(_0xbd96('0x2'))(_0xbd96('0x3'));var moment=require(_0xbd96('0x4'));var BPromise=require(_0xbd96('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbd96('0x6'));var config=require(_0xbd96('0x7'));var attributes=require(_0xbd96('0x8'));module[_0xbd96('0x9')]=function(_0x195135,_0x2ff9c1){return _0x195135[_0xbd96('0xa')](_0xbd96('0xb'),attributes,{'tableName':_0xbd96('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index b9fd98b..f089c22 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 _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 +var _0x5c21=['http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5c21,0x90));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x15c2('0x0'));var moment=require(_0x15c2('0x1'));var BPromise=require(_0x15c2('0x2'));var rs=require(_0x15c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15c2('0x4'))['db'];var utils=require(_0x15c2('0x5'));var logger=require(_0x15c2('0x6'))(_0x15c2('0x7'));var config=require(_0x15c2('0x8'));var jayson=require(_0x15c2('0x9'));var client=jayson['client'][_0x15c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e1e25,_0xf7dd99,_0x1a78e6){return new BPromise(function(_0x3fc8ac,_0x4f6891){return client[_0x15c2('0xb')](_0x5e1e25,_0x1a78e6)['then'](function(_0x336780){logger[_0x15c2('0xc')](_0x15c2('0xd'),_0xf7dd99,_0x15c2('0xe'));logger['debug'](_0x15c2('0xf'),_0xf7dd99,'request\x20sent',JSON[_0x15c2('0x10')](_0x336780));if(_0x336780[_0x15c2('0x11')]){if(_0x336780[_0x15c2('0x11')][_0x15c2('0x12')]===0x1f4){logger[_0x15c2('0x11')](_0x15c2('0xd'),_0xf7dd99,_0x336780[_0x15c2('0x11')][_0x15c2('0x13')]);return _0x4f6891(_0x336780[_0x15c2('0x11')][_0x15c2('0x13')]);}logger['error'](_0x15c2('0xd'),_0xf7dd99,_0x336780['error'][_0x15c2('0x13')]);return _0x3fc8ac(_0x336780[_0x15c2('0x11')][_0x15c2('0x13')]);}else{logger[_0x15c2('0xc')](_0x15c2('0xd'),_0xf7dd99,_0x15c2('0xe'));_0x3fc8ac(_0x336780[_0x15c2('0x14')][_0x15c2('0x13')]);}})[_0x15c2('0x15')](function(_0x7a9f15){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xf7dd99,_0x7a9f15);_0x4f6891(_0x7a9f15);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index e63a169..5d6829e 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 _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 +var _0x41a6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','connect-timeout','Router'];(function(_0x30c83b,_0x1773d9){var _0x14bbc9=function(_0x3b034b){while(--_0x3b034b){_0x30c83b['push'](_0x30c83b['shift']());}};_0x14bbc9(++_0x1773d9);}(_0x41a6,0x1c8));var _0x641a=function(_0x14ab22,_0x1550c5){_0x14ab22=_0x14ab22-0x0;var _0x2447e5=_0x41a6[_0x14ab22];return _0x2447e5;};'use strict';var multer=require(_0x641a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x641a('0x1'));var express=require('express');var router=express[_0x641a('0x2')]();var fs_extra=require(_0x641a('0x3'));var auth=require(_0x641a('0x4'));var interaction=require(_0x641a('0x5'));var config=require(_0x641a('0x6'));var controller=require('./intDeskField.controller');router[_0x641a('0x7')]('/',auth[_0x641a('0x8')](),controller[_0x641a('0x9')]);router[_0x641a('0x7')](_0x641a('0xa'),auth[_0x641a('0x8')](),controller['show']);router[_0x641a('0xb')]('/',auth['isAuthenticated'](),controller[_0x641a('0xc')]);router[_0x641a('0xd')](_0x641a('0xa'),auth[_0x641a('0x8')](),controller[_0x641a('0xe')]);router[_0x641a('0xf')](_0x641a('0xa'),auth[_0x641a('0x8')](),controller['destroy']);module[_0x641a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 38f170c..460a85a 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 _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 +var _0x7e81=['keyValue','STRING','ENUM','variable','customVariable','BOOLEAN','exports','string'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x7e81,0x136));var _0x17e8=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x7e81[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require('sequelize');module[_0x17e8('0x0')]={'type':{'type':Sequelize['ENUM'](_0x17e8('0x1'),'variable','customVariable',_0x17e8('0x2'),'picklist'),'defaultValue':_0x17e8('0x1')},'content':{'type':Sequelize[_0x17e8('0x3')]},'key':{'type':Sequelize[_0x17e8('0x3')]},'keyType':{'type':Sequelize[_0x17e8('0x4')](_0x17e8('0x1'),_0x17e8('0x5'),_0x17e8('0x6'))},'keyContent':{'type':Sequelize[_0x17e8('0x3')]},'idField':{'type':Sequelize[_0x17e8('0x3')]},'nameField':{'type':Sequelize[_0x17e8('0x3')]},'customField':{'type':Sequelize[_0x17e8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x17e8('0x3')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 850225f..57b5efe 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 _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 +var _0x9829=['end','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','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','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x11fd66,_0x46c02d){var _0xb514b7=function(_0x40a8fc){while(--_0x40a8fc){_0x11fd66['push'](_0x11fd66['shift']());}};_0xb514b7(++_0x46c02d);}(_0x9829,0xc4));var _0x9982=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x9829[_0x2d2ca2];return _0x48489d;};'use strict';var emlformat=require(_0x9982('0x0'));var rimraf=require(_0x9982('0x1'));var zipdir=require(_0x9982('0x2'));var jsonpatch=require(_0x9982('0x3'));var rp=require(_0x9982('0x4'));var moment=require('moment');var BPromise=require(_0x9982('0x5'));var Mustache=require(_0x9982('0x6'));var util=require(_0x9982('0x7'));var path=require('path');var sox=require(_0x9982('0x8'));var csv=require(_0x9982('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9982('0xa'));var squel=require(_0x9982('0xb'));var crypto=require('crypto');var jsforce=require(_0x9982('0xc'));var deskjs=require(_0x9982('0xd'));var toCsv=require(_0x9982('0x9'));var querystring=require(_0x9982('0xe'));var Papa=require(_0x9982('0xf'));var Redis=require(_0x9982('0x10'));var authService=require(_0x9982('0x11'));var qs=require(_0x9982('0x12'));var as=require(_0x9982('0x13'));var hardwareService=require(_0x9982('0x14'));var logger=require(_0x9982('0x15'))(_0x9982('0x16'));var utils=require(_0x9982('0x17'));var config=require(_0x9982('0x18'));var licenseUtil=require(_0x9982('0x19'));var db=require(_0x9982('0x1a'))['db'];function respondWithStatusCode(_0x390539,_0x4637ca){_0x4637ca=_0x4637ca||0xcc;return function(_0x48e81f){if(_0x48e81f){return _0x390539[_0x9982('0x1b')](_0x4637ca);}return _0x390539[_0x9982('0x1c')](_0x4637ca)['end']();};}function respondWithResult(_0x3ca506,_0x5699c9){_0x5699c9=_0x5699c9||0xc8;return function(_0x39d32c){if(_0x39d32c){return _0x3ca506[_0x9982('0x1c')](_0x5699c9)[_0x9982('0x1d')](_0x39d32c);}};}function respondWithFilteredResult(_0x199688,_0x128118){return function(_0xcd1405){if(_0xcd1405){var _0x2883f6=typeof _0x128118[_0x9982('0x1e')]===_0x9982('0x1f')&&typeof _0x128118['limit']===_0x9982('0x1f');var _0x5385cc=_0xcd1405[_0x9982('0x20')];var _0x44b5ed=_0x2883f6?0x0:_0x128118['offset'];var _0x2558e1=_0x2883f6?_0xcd1405[_0x9982('0x20')]:_0x128118[_0x9982('0x1e')]+_0x128118[_0x9982('0x21')];var _0x1297d7;if(_0x2558e1>=_0x5385cc){_0x2558e1=_0x5385cc;_0x1297d7=0xc8;}else{_0x1297d7=0xce;}_0x199688[_0x9982('0x1c')](_0x1297d7);return _0x199688['set'](_0x9982('0x22'),_0x44b5ed+'-'+_0x2558e1+'/'+_0x5385cc)[_0x9982('0x1d')](_0xcd1405);}return null;};}function patchUpdates(_0x5ea55d){return function(_0x1c5214){try{jsonpatch[_0x9982('0x23')](_0x1c5214,_0x5ea55d,!![]);}catch(_0x6523c0){return BPromise[_0x9982('0x24')](_0x6523c0);}return _0x1c5214[_0x9982('0x25')]();};}function saveUpdates(_0x1eec90,_0xfde29b){return function(_0x541cc8){if(_0x541cc8){return _0x541cc8[_0x9982('0x26')](_0x1eec90)[_0x9982('0x27')](function(_0x11a7e8){return _0x11a7e8;});}return null;};}function removeEntity(_0x37bb60,_0x3797be){return function(_0x4a27d6){if(_0x4a27d6){return _0x4a27d6[_0x9982('0x28')]()[_0x9982('0x27')](function(){_0x37bb60[_0x9982('0x1c')](0xcc)[_0x9982('0x29')]();});}};}function handleEntityNotFound(_0x2d4622,_0x39747a){return function(_0x3c129a){if(!_0x3c129a){_0x2d4622[_0x9982('0x1b')](0x194);}return _0x3c129a;};}function handleError(_0xa6824b,_0x2be133){_0x2be133=_0x2be133||0x1f4;return function(_0xe752e3){logger[_0x9982('0x2a')](_0xe752e3[_0x9982('0x2b')]);if(_0xe752e3[_0x9982('0x2c')]){delete _0xe752e3[_0x9982('0x2c')];}_0xa6824b[_0x9982('0x1c')](_0x2be133)[_0x9982('0x2d')](_0xe752e3);};}exports[_0x9982('0x2e')]=function(_0x50d976,_0x533748){var _0xb1bc28={},_0x3b3bc5={},_0x4544b5={'count':0x0,'rows':[]};var _0x3c0596=_[_0x9982('0x2f')](db[_0x9982('0x30')][_0x9982('0x31')],function(_0x3337e2){return{'name':_0x3337e2[_0x9982('0x32')],'type':_0x3337e2[_0x9982('0x33')][_0x9982('0x34')]};});_0x3b3bc5[_0x9982('0x35')]=_['map'](_0x3c0596,_0x9982('0x2c'));_0x3b3bc5[_0x9982('0x36')]=_[_0x9982('0x37')](_0x50d976[_0x9982('0x36')]);_0x3b3bc5[_0x9982('0x38')]=_[_0x9982('0x39')](_0x3b3bc5['model'],_0x3b3bc5[_0x9982('0x36')]);_0xb1bc28['attributes']=_[_0x9982('0x39')](_0x3b3bc5[_0x9982('0x35')],qs[_0x9982('0x3a')](_0x50d976[_0x9982('0x36')][_0x9982('0x3a')]));_0xb1bc28[_0x9982('0x3b')]=_0xb1bc28[_0x9982('0x3b')]['length']?_0xb1bc28[_0x9982('0x3b')]:_0x3b3bc5[_0x9982('0x35')];if(!_0x50d976[_0x9982('0x36')][_0x9982('0x3c')](_0x9982('0x3d'))){_0xb1bc28['limit']=qs[_0x9982('0x21')](_0x50d976['query']['limit']);_0xb1bc28[_0x9982('0x1e')]=qs[_0x9982('0x1e')](_0x50d976['query'][_0x9982('0x1e')]);}_0xb1bc28[_0x9982('0x3e')]=qs[_0x9982('0x3f')](_0x50d976[_0x9982('0x36')][_0x9982('0x3f')]);_0xb1bc28[_0x9982('0x40')]=qs[_0x9982('0x38')](_[_0x9982('0x41')](_0x50d976[_0x9982('0x36')],_0x3b3bc5[_0x9982('0x38')]),_0x3c0596);if(_0x50d976[_0x9982('0x36')][_0x9982('0x42')]){_0xb1bc28['where']=_[_0x9982('0x43')](_0xb1bc28[_0x9982('0x40')],{'$or':_[_0x9982('0x2f')](_0x3c0596,function(_0x36e441){if(_0x36e441[_0x9982('0x33')]!=='VIRTUAL'){var _0x521c1f={};_0x521c1f[_0x36e441['name']]={'$like':'%'+_0x50d976[_0x9982('0x36')][_0x9982('0x42')]+'%'};return _0x521c1f;}})});}_0xb1bc28=_['merge']({},_0xb1bc28,_0x50d976[_0x9982('0x44')]);var _0x39afc0={'where':_0xb1bc28[_0x9982('0x40')]};return db[_0x9982('0x30')]['count'](_0x39afc0)[_0x9982('0x27')](function(_0x1942a5){_0x4544b5[_0x9982('0x20')]=_0x1942a5;if(_0x50d976[_0x9982('0x36')][_0x9982('0x45')]){_0xb1bc28[_0x9982('0x46')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0xb1bc28);})[_0x9982('0x27')](function(_0x3b0f1a){_0x4544b5[_0x9982('0x47')]=_0x3b0f1a;return _0x4544b5;})['then'](respondWithFilteredResult(_0x533748,_0xb1bc28))[_0x9982('0x48')](handleError(_0x533748,null));};exports[_0x9982('0x49')]=function(_0x1a5ea4,_0x56ad10){var _0x59be67={'raw':!![],'where':{'id':_0x1a5ea4['params']['id']}},_0x566c07={};_0x566c07['model']=_[_0x9982('0x37')](db['DeskField'][_0x9982('0x31')]);_0x566c07[_0x9982('0x36')]=_['keys'](_0x1a5ea4[_0x9982('0x36')]);_0x566c07[_0x9982('0x38')]=_[_0x9982('0x39')](_0x566c07[_0x9982('0x35')],_0x566c07[_0x9982('0x36')]);_0x59be67['attributes']=_[_0x9982('0x39')](_0x566c07[_0x9982('0x35')],qs[_0x9982('0x3a')](_0x1a5ea4[_0x9982('0x36')][_0x9982('0x3a')]));_0x59be67[_0x9982('0x3b')]=_0x59be67[_0x9982('0x3b')][_0x9982('0x4a')]?_0x59be67[_0x9982('0x3b')]:_0x566c07['model'];if(_0x1a5ea4[_0x9982('0x36')]['includeAll']){_0x59be67['include']=[{'all':!![]}];}_0x59be67=_[_0x9982('0x43')]({},_0x59be67,_0x1a5ea4[_0x9982('0x44')]);return db['DeskField'][_0x9982('0x4b')](_0x59be67)[_0x9982('0x27')](handleEntityNotFound(_0x56ad10,null))[_0x9982('0x27')](respondWithResult(_0x56ad10,null))[_0x9982('0x48')](handleError(_0x56ad10,null));};exports[_0x9982('0x4c')]=function(_0x55d1d3,_0x12261d){return db['DeskField'][_0x9982('0x4c')](_0x55d1d3[_0x9982('0x4d')],{})['then'](respondWithResult(_0x12261d,0xc9))[_0x9982('0x48')](handleError(_0x12261d,null));};exports[_0x9982('0x26')]=function(_0x251996,_0x46cac4){if(_0x251996[_0x9982('0x4d')]['id']){delete _0x251996['body']['id'];}return db[_0x9982('0x30')][_0x9982('0x4b')]({'where':{'id':_0x251996[_0x9982('0x4e')]['id']}})['then'](handleEntityNotFound(_0x46cac4,null))['then'](saveUpdates(_0x251996['body'],null))['then'](respondWithResult(_0x46cac4,null))[_0x9982('0x48')](handleError(_0x46cac4,null));};exports['destroy']=function(_0x2de9df,_0x6a7bed){return db['DeskField']['find']({'where':{'id':_0x2de9df[_0x9982('0x4e')]['id']}})[_0x9982('0x27')](handleEntityNotFound(_0x6a7bed,null))[_0x9982('0x27')](removeEntity(_0x6a7bed,null))[_0x9982('0x48')](handleError(_0x6a7bed,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d0cbc04..2bed4e5 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 _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 +var _0x21c2=['FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField'];(function(_0x79ef38,_0x101805){var _0x253c93=function(_0xa93204){while(--_0xa93204){_0x79ef38['push'](_0x79ef38['shift']());}};_0x253c93(++_0x101805);}(_0x21c2,0x178));var _0x221c=function(_0x1e0d7f,_0x10eb41){_0x1e0d7f=_0x1e0d7f-0x0;var _0x1e757d=_0x21c2[_0x1e0d7f];return _0x1e757d;};'use strict';var _=require(_0x221c('0x0'));var util=require(_0x221c('0x1'));var logger=require(_0x221c('0x2'))('api');var moment=require(_0x221c('0x3'));var BPromise=require(_0x221c('0x4'));var rp=require(_0x221c('0x5'));var fs=require('fs');var path=require(_0x221c('0x6'));var rimraf=require(_0x221c('0x7'));var config=require('../../config/environment');var attributes=require(_0x221c('0x8'));module[_0x221c('0x9')]=function(_0x25e7ab,_0x169cb8){return _0x25e7ab[_0x221c('0xa')](_0x221c('0xb'),attributes,{'tableName':_0x221c('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x221c('0xd'),_0x221c('0xe')],'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 d98409e..68229cb 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 _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 +var _0x223b=['then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x4f8258,_0x18fe18){var _0x2882f9=function(_0x27b51f){while(--_0x27b51f){_0x4f8258['push'](_0x4f8258['shift']());}};_0x2882f9(++_0x18fe18);}(_0x223b,0x1ee));var _0xb223=function(_0x2c8dbc,_0xafeeb){_0x2c8dbc=_0x2c8dbc-0x0;var _0x487501=_0x223b[_0x2c8dbc];return _0x487501;};'use strict';var _=require(_0xb223('0x0'));var util=require('util');var moment=require(_0xb223('0x1'));var BPromise=require(_0xb223('0x2'));var rs=require(_0xb223('0x3'));var fs=require('fs');var Redis=require(_0xb223('0x4'));var db=require(_0xb223('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb223('0x6'))(_0xb223('0x7'));var config=require(_0xb223('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb223('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c9407,_0x1eaf7a,_0x3d080e){return new BPromise(function(_0x21e753,_0x2e1ffe){return client['request'](_0x1c9407,_0x3d080e)[_0xb223('0xa')](function(_0x46f340){logger[_0xb223('0xb')](_0xb223('0xc'),_0x1eaf7a,'request\x20sent');logger[_0xb223('0xd')](_0xb223('0xe'),_0x1eaf7a,'request\x20sent',JSON[_0xb223('0xf')](_0x46f340));if(_0x46f340[_0xb223('0x10')]){if(_0x46f340['error'][_0xb223('0x11')]===0x1f4){logger[_0xb223('0x10')](_0xb223('0xc'),_0x1eaf7a,_0x46f340[_0xb223('0x10')][_0xb223('0x12')]);return _0x2e1ffe(_0x46f340[_0xb223('0x10')][_0xb223('0x12')]);}logger[_0xb223('0x10')](_0xb223('0xc'),_0x1eaf7a,_0x46f340[_0xb223('0x10')][_0xb223('0x12')]);return _0x21e753(_0x46f340[_0xb223('0x10')][_0xb223('0x12')]);}else{logger[_0xb223('0xb')]('DeskField,\x20%s,\x20%s',_0x1eaf7a,'request\x20sent');_0x21e753(_0x46f340[_0xb223('0x13')][_0xb223('0x12')]);}})[_0xb223('0x14')](function(_0x3f7855){logger[_0xb223('0x10')](_0xb223('0xc'),_0x1eaf7a,_0x3f7855);_0x2e1ffe(_0x3f7855);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a851280..3ca8a22 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 _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 +var _0xe25c=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xe25c,0xae));var _0xce25=function(_0x43ef4c,_0x32b98f){_0x43ef4c=_0x43ef4c-0x0;var _0x50e9ea=_0xe25c[_0x43ef4c];return _0x50e9ea;};'use strict';var multer=require(_0xce25('0x0'));var util=require(_0xce25('0x1'));var path=require(_0xce25('0x2'));var timeout=require(_0xce25('0x3'));var express=require(_0xce25('0x4'));var router=express[_0xce25('0x5')]();var fs_extra=require(_0xce25('0x6'));var auth=require(_0xce25('0x7'));var interaction=require(_0xce25('0x8'));var config=require(_0xce25('0x9'));var controller=require(_0xce25('0xa'));router[_0xce25('0xb')]('/',auth['isAuthenticated'](),controller[_0xce25('0xc')]);router[_0xce25('0xb')]('/:id',auth[_0xce25('0xd')](),controller[_0xce25('0xe')]);router[_0xce25('0xb')](_0xce25('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xce25('0xb')](_0xce25('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0xce25('0x11')]('/',auth[_0xce25('0xd')](),controller[_0xce25('0x12')]);router[_0xce25('0x11')](_0xce25('0xf'),auth[_0xce25('0xd')](),controller[_0xce25('0x13')]);router[_0xce25('0x14')]('/:id',auth[_0xce25('0xd')](),controller[_0xce25('0x15')]);router[_0xce25('0x16')](_0xce25('0x17'),auth['isAuthenticated'](),controller[_0xce25('0x18')]);module[_0xce25('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index fe3562b..d41eeda 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 _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 +var _0xb5bb=['STRING','sequelize','exports'];(function(_0x3008c4,_0x232045){var _0x5c59d7=function(_0x9bc55a){while(--_0x9bc55a){_0x3008c4['push'](_0x3008c4['shift']());}};_0x5c59d7(++_0x232045);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x3d5b44,_0x3a02fe){_0x3d5b44=_0x3d5b44-0x0;var _0x4a72a=_0xb5bb[_0x3d5b44];return _0x4a72a;};'use strict';var Sequelize=require(_0xbb5b('0x0'));module[_0xbb5b('0x1')]={'name':{'type':Sequelize[_0xbb5b('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbb5b('0x2')]},'remoteUri':{'type':Sequelize[_0xbb5b('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index aab0183..e8b987a 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 _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 +var _0xbe5e=['hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','%s/api/data/v9.0/','ticketType','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','primarycontactidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','username','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','push','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','set','update','then','end','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','getConfigurations','Dynamics365Configuration','pick'];(function(_0x366219,_0x87bcee){var _0x4bba95=function(_0x409f45){while(--_0x409f45){_0x366219['push'](_0x366219['shift']());}};_0x4bba95(++_0x87bcee);}(_0xbe5e,0x81));var _0xebe5=function(_0x1337a4,_0x6e0708){_0x1337a4=_0x1337a4-0x0;var _0xacd1b1=_0xbe5e[_0x1337a4];return _0xacd1b1;};'use strict';var rp=require(_0xebe5('0x0'));var util=require(_0xebe5('0x1'));var _=require('lodash');var qs=require(_0xebe5('0x2'));var logger=require(_0xebe5('0x3'))(_0xebe5('0x4'));var db=require(_0xebe5('0x5'))['db'];var integrations=require(_0xebe5('0x6'));function respondWithResult(_0x43d7f7,_0x1e3335){_0x1e3335=_0x1e3335||0xc8;return function(_0x5edcee){if(_0x5edcee){return _0x43d7f7[_0xebe5('0x7')](_0x1e3335)['json'](_0x5edcee);}};}function respondWithFilteredResult(_0x35cf69,_0x43c6df){return function(_0x152456){if(_0x152456){var _0x73d4df=typeof _0x43c6df[_0xebe5('0x8')]===_0xebe5('0x9')&&typeof _0x43c6df[_0xebe5('0xa')]===_0xebe5('0x9');var _0x60f242=_0x152456['count'];var _0x4c8cef=_0x73d4df?0x0:_0x43c6df[_0xebe5('0x8')];var _0x16c715=_0x73d4df?_0x152456['count']:_0x43c6df[_0xebe5('0x8')]+_0x43c6df[_0xebe5('0xa')];var _0x5d8bde;if(_0x16c715>=_0x60f242){_0x16c715=_0x60f242;_0x5d8bde=0xc8;}else{_0x5d8bde=0xce;}_0x35cf69[_0xebe5('0x7')](_0x5d8bde);return _0x35cf69[_0xebe5('0xb')]('Content-Range',_0x4c8cef+'-'+_0x16c715+'/'+_0x60f242)['json'](_0x152456);}return null;};}function saveUpdates(_0x560126){return function(_0x213c72){if(_0x213c72){return _0x213c72[_0xebe5('0xc')](_0x560126)['then'](function(_0x396b16){return _0x396b16;});}return null;};}function removeEntity(_0x643d28){return function(_0x4b2b62){if(_0x4b2b62){return _0x4b2b62['destroy']()[_0xebe5('0xd')](function(){_0x643d28[_0xebe5('0x7')](0xcc)[_0xebe5('0xe')]();});}};}function handleEntityNotFound(_0x5868b7){return function(_0x505224){if(!_0x505224){_0x5868b7['sendStatus'](0x194);}return _0x505224;};}function handleError(_0x23e4f2,_0x4f2105){_0x4f2105=_0x4f2105||0x1f4;return function(_0x4baafa){logger[_0xebe5('0xf')](_0x4baafa[_0xebe5('0x10')]);if(_0x4baafa[_0xebe5('0x11')]){delete _0x4baafa[_0xebe5('0x11')];}_0x23e4f2[_0xebe5('0x7')](_0x4f2105)[_0xebe5('0x12')](_0x4baafa);};}exports[_0xebe5('0x13')]=function(_0x521ac8,_0x3be153){var _0x5eae64={},_0xfd8586={},_0x28f7b4={'count':0x0,'rows':[]};var _0xa1debc=_[_0xebe5('0x14')](db[_0xebe5('0x15')]['rawAttributes'],function(_0x536380){return{'name':_0x536380[_0xebe5('0x16')],'type':_0x536380[_0xebe5('0x17')]['key']};});_0xfd8586['model']=_[_0xebe5('0x14')](_0xa1debc,_0xebe5('0x11'));_0xfd8586[_0xebe5('0x18')]=_[_0xebe5('0x19')](_0x521ac8[_0xebe5('0x18')]);_0xfd8586['filters']=_[_0xebe5('0x1a')](_0xfd8586[_0xebe5('0x1b')],_0xfd8586[_0xebe5('0x18')]);_0x5eae64[_0xebe5('0x1c')]=_[_0xebe5('0x1a')](_0xfd8586['model'],qs[_0xebe5('0x1d')](_0x521ac8[_0xebe5('0x18')][_0xebe5('0x1d')]));_0x5eae64[_0xebe5('0x1c')]=_0x5eae64[_0xebe5('0x1c')][_0xebe5('0x1e')]?_0x5eae64[_0xebe5('0x1c')]:_0xfd8586[_0xebe5('0x1b')];if(!_0x521ac8[_0xebe5('0x18')]['hasOwnProperty'](_0xebe5('0x1f'))){_0x5eae64[_0xebe5('0xa')]=qs['limit'](_0x521ac8[_0xebe5('0x18')][_0xebe5('0xa')]);_0x5eae64['offset']=qs['offset'](_0x521ac8[_0xebe5('0x18')]['offset']);}_0x5eae64[_0xebe5('0x20')]=qs[_0xebe5('0x21')](_0x521ac8[_0xebe5('0x18')][_0xebe5('0x21')]);_0x5eae64[_0xebe5('0x22')]=qs[_0xebe5('0x23')](_['pick'](_0x521ac8[_0xebe5('0x18')],_0xfd8586['filters']),_0xa1debc);if(_0x521ac8[_0xebe5('0x18')][_0xebe5('0x24')]){_0x5eae64[_0xebe5('0x22')]=_[_0xebe5('0x25')](_0x5eae64[_0xebe5('0x22')],{'$or':_[_0xebe5('0x14')](_0xa1debc,function(_0x3a63f6){if(_0x3a63f6['type']!==_0xebe5('0x26')){var _0xc3fd3c={};_0xc3fd3c[_0x3a63f6[_0xebe5('0x11')]]={'$like':'%'+_0x521ac8['query']['filter']+'%'};return _0xc3fd3c;}})});}_0x5eae64=_[_0xebe5('0x25')]({},_0x5eae64,_0x521ac8[_0xebe5('0x27')]);var _0x1f0040={'where':_0x5eae64['where']};return db[_0xebe5('0x15')][_0xebe5('0x28')](_0x1f0040)['then'](function(_0x1704d2){_0x28f7b4['count']=_0x1704d2;if(_0x521ac8[_0xebe5('0x18')][_0xebe5('0x29')]){_0x5eae64['include']=[{'all':!![]}];}return db[_0xebe5('0x15')]['findAll'](_0x5eae64);})[_0xebe5('0xd')](function(_0x30bd3e){_0x28f7b4[_0xebe5('0x2a')]=_0x30bd3e;return _0x28f7b4;})[_0xebe5('0xd')](respondWithFilteredResult(_0x3be153,_0x5eae64))[_0xebe5('0x2b')](handleError(_0x3be153,null));};exports[_0xebe5('0x2c')]=function(_0x37ab9f,_0x643866){var _0x4c445c={'raw':![],'where':{'id':_0x37ab9f[_0xebe5('0x2d')]['id']}},_0x2b4d90={};_0x2b4d90[_0xebe5('0x1b')]=_[_0xebe5('0x19')](db[_0xebe5('0x15')][_0xebe5('0x2e')]);_0x2b4d90[_0xebe5('0x18')]=_[_0xebe5('0x19')](_0x37ab9f[_0xebe5('0x18')]);_0x2b4d90[_0xebe5('0x23')]=_[_0xebe5('0x1a')](_0x2b4d90[_0xebe5('0x1b')],_0x2b4d90[_0xebe5('0x18')]);_0x4c445c['attributes']=_[_0xebe5('0x1a')](_0x2b4d90[_0xebe5('0x1b')],qs['fields'](_0x37ab9f[_0xebe5('0x18')][_0xebe5('0x1d')]));_0x4c445c['attributes']=_0x4c445c[_0xebe5('0x1c')][_0xebe5('0x1e')]?_0x4c445c[_0xebe5('0x1c')]:_0x2b4d90[_0xebe5('0x1b')];if(_0x37ab9f[_0xebe5('0x18')]['includeAll']){_0x4c445c[_0xebe5('0x2f')]=[{'all':!![]}];}_0x4c445c=_[_0xebe5('0x25')]({},_0x4c445c,_0x37ab9f['options']);return db['Dynamics365Account'][_0xebe5('0x30')](_0x4c445c)[_0xebe5('0xd')](handleEntityNotFound(_0x643866,null))[_0xebe5('0xd')](respondWithResult(_0x643866,null))[_0xebe5('0x2b')](handleError(_0x643866,null));};exports[_0xebe5('0x31')]=function(_0x37e8f4,_0x307488){return db[_0xebe5('0x15')][_0xebe5('0x31')](_0x37e8f4['body'],{})[_0xebe5('0xd')](respondWithResult(_0x307488,0xc9))[_0xebe5('0x2b')](handleError(_0x307488,null));};exports[_0xebe5('0xc')]=function(_0x398c9c,_0x4e4ca2){if(_0x398c9c[_0xebe5('0x32')]['id']){delete _0x398c9c[_0xebe5('0x32')]['id'];}return db[_0xebe5('0x15')][_0xebe5('0x30')]({'where':{'id':_0x398c9c['params']['id']}})['then'](handleEntityNotFound(_0x4e4ca2,null))[_0xebe5('0xd')](saveUpdates(_0x398c9c['body'],null))[_0xebe5('0xd')](respondWithResult(_0x4e4ca2,null))[_0xebe5('0x2b')](handleError(_0x4e4ca2,null));};exports[_0xebe5('0x33')]=function(_0x457332,_0x3449d4){return db[_0xebe5('0x15')][_0xebe5('0x30')]({'where':{'id':_0x457332[_0xebe5('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3449d4,null))[_0xebe5('0xd')](removeEntity(_0x3449d4,null))[_0xebe5('0x2b')](handleError(_0x3449d4,null));};exports[_0xebe5('0x34')]=function(_0x3e73a7,_0x35052e){var _0x506404={};var _0x242917={};var _0x23dc81;var _0x288081;return db[_0xebe5('0x15')]['findOne']({'where':{'id':_0x3e73a7[_0xebe5('0x2d')]['id']}})[_0xebe5('0xd')](handleEntityNotFound(_0x35052e,null))[_0xebe5('0xd')](function(_0x4ed0c8){if(_0x4ed0c8){_0x23dc81=_0x4ed0c8;_0x242917[_0xebe5('0x1b')]=_[_0xebe5('0x19')](db[_0xebe5('0x35')][_0xebe5('0x2e')]);_0x242917[_0xebe5('0x18')]=_['keys'](_0x3e73a7[_0xebe5('0x18')]);_0x242917[_0xebe5('0x23')]=_[_0xebe5('0x1a')](_0x242917[_0xebe5('0x1b')],_0x242917['query']);_0x506404[_0xebe5('0x1c')]=_[_0xebe5('0x1a')](_0x242917[_0xebe5('0x1b')],qs[_0xebe5('0x1d')](_0x3e73a7[_0xebe5('0x18')][_0xebe5('0x1d')]));_0x506404['attributes']=_0x506404[_0xebe5('0x1c')][_0xebe5('0x1e')]?_0x506404['attributes']:_0x242917[_0xebe5('0x1b')];_0x506404[_0xebe5('0x20')]=qs[_0xebe5('0x21')](_0x3e73a7['query'][_0xebe5('0x21')]);_0x506404[_0xebe5('0x22')]=qs['filters'](_[_0xebe5('0x36')](_0x3e73a7[_0xebe5('0x18')],_0x242917[_0xebe5('0x23')]));if(_0x3e73a7[_0xebe5('0x18')][_0xebe5('0x24')]){_0x506404[_0xebe5('0x22')]=_[_0xebe5('0x25')](_0x506404[_0xebe5('0x22')],{'$or':_[_0xebe5('0x14')](_0x506404[_0xebe5('0x1c')],function(_0x4e3891){var _0x22f0b8={};_0x22f0b8[_0x4e3891]={'$like':'%'+_0x3e73a7[_0xebe5('0x18')][_0xebe5('0x24')]+'%'};return _0x22f0b8;})});}_0x506404=_[_0xebe5('0x25')]({},_0x506404,_0x3e73a7[_0xebe5('0x27')]);return _0x23dc81['getConfigurations'](_0x506404);}})[_0xebe5('0xd')](function(_0xabfa7c){if(_0xabfa7c){_0x288081=_0xabfa7c['length'];if(!_0x3e73a7[_0xebe5('0x18')][_0xebe5('0x37')](_0xebe5('0x1f'))){_0x506404[_0xebe5('0xa')]=qs['limit'](_0x3e73a7['query'][_0xebe5('0xa')]);_0x506404[_0xebe5('0x8')]=qs[_0xebe5('0x8')](_0x3e73a7[_0xebe5('0x18')][_0xebe5('0x8')]);}return _0x23dc81[_0xebe5('0x34')](_0x506404);}})[_0xebe5('0xd')](function(_0x1e25cf){if(_0x1e25cf){return _0x1e25cf?{'count':_0x288081,'rows':_0x1e25cf}:null;}})[_0xebe5('0xd')](respondWithResult(_0x35052e,null))[_0xebe5('0x2b')](handleError(_0x35052e,null));};exports[_0xebe5('0x38')]=function(_0x2ffb3e,_0x1536c7){if(_0x2ffb3e[_0xebe5('0x32')]['id']){delete _0x2ffb3e['body']['id'];}return db[_0xebe5('0x15')][_0xebe5('0x39')]({'where':{'id':_0x2ffb3e[_0xebe5('0x2d')]['id']}})[_0xebe5('0xd')](handleEntityNotFound(_0x1536c7,null))[_0xebe5('0xd')](function(_0x36bd2b){if(_0x36bd2b){_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x3a')]=_0x36bd2b['id'];_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x3b')]=integrations[_0xebe5('0x3c')](_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x3d')],_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x17')]);_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x3e')]=integrations[_0xebe5('0x3f')](_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x3d')],_0x2ffb3e['body']['type']);return db[_0xebe5('0x35')][_0xebe5('0x31')](_0x2ffb3e[_0xebe5('0x32')],{'include':[{'model':db[_0xebe5('0x40')],'as':_0xebe5('0x3b')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xebe5('0xd')](respondWithResult(_0x1536c7,null))[_0xebe5('0x2b')](handleError(_0x1536c7,null));};function sanitizeRemoteUri(_0x23bfee){var _0x25e73c=_0x23bfee['slice'](-0x1);if(_0x25e73c==='/')return _0x23bfee[_0xebe5('0x41')](0x0,_0x23bfee[_0xebe5('0x42')](_0x25e73c));return _0x23bfee;}function getWebApiUrl(_0x4d759b){return util['format'](_0xebe5('0x43'),_0x4d759b);}exports['getFields']=function(_0x1322ee,_0x1acacf){var _0x421b79=_0x1322ee[_0xebe5('0x18')][_0xebe5('0x44')];var _0x3dea29=_0x421b79==='incident'?_0xebe5('0x45'):'PhoneCall';var _0x3151e4='';var _0x5c770d='';var _0x2f8e83='';var _0x126902='';var _0x3b6221='';var _0x448d43='';var _0x222620='';var _0x2d0119='';var _0x105186=[_0xebe5('0x46'),_0xebe5('0x47'),_0xebe5('0x48'),_0xebe5('0x49'),_0xebe5('0x4a'),_0xebe5('0x4b'),_0xebe5('0x4c'),_0xebe5('0x4d'),_0xebe5('0x4e'),'phonecall_activity_parties'];var _0x1f96b9=[_0xebe5('0x4f'),_0xebe5('0x50'),'actualserviceunits',_0xebe5('0x51'),'contactidname',_0xebe5('0x52'),_0xebe5('0x53'),'contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame',_0xebe5('0x54'),'createdbyyominame',_0xebe5('0x55'),_0xebe5('0x56'),'createdonbehalfbyyominame',_0xebe5('0x57'),_0xebe5('0x58'),_0xebe5('0x59'),_0xebe5('0x5a'),_0xebe5('0x5b'),_0xebe5('0x5c'),_0xebe5('0x5d'),'escalatedon',_0xebe5('0x5e'),_0xebe5('0x5f'),_0xebe5('0x60'),_0xebe5('0x61'),_0xebe5('0x62'),_0xebe5('0x63'),_0xebe5('0x64'),_0xebe5('0x65'),_0xebe5('0x66'),_0xebe5('0x67'),_0xebe5('0x68'),_0xebe5('0x69'),'modifiedon',_0xebe5('0x6a'),_0xebe5('0x6b'),_0xebe5('0x6c'),_0xebe5('0x6d'),_0xebe5('0x6e'),_0xebe5('0x6f'),_0xebe5('0x70'),'owneridname',_0xebe5('0x71'),_0xebe5('0x72'),'parentcaseidname',_0xebe5('0x73'),'primarycontactidyominame',_0xebe5('0x74'),'productidname',_0xebe5('0x75'),_0xebe5('0x76'),_0xebe5('0x77'),'responseby',_0xebe5('0x78'),_0xebe5('0x79'),_0xebe5('0x7a'),_0xebe5('0x7b'),_0xebe5('0x7c'),_0xebe5('0x7d'),_0xebe5('0x7e'),_0xebe5('0x7f'),_0xebe5('0x80'),_0xebe5('0x81'),_0xebe5('0x82'),_0xebe5('0x83'),'traversedpath',_0xebe5('0x84'),'versionnumber'];var _0x331aaa=_0x105186[_0xebe5('0x85')](_0x1f96b9);return db['Dynamics365Account'][_0xebe5('0x39')]({'where':{'id':_0x1322ee[_0xebe5('0x2d')]['id']},'attributes':['id','username',_0xebe5('0x86'),_0xebe5('0x87'),_0xebe5('0x88'),'clientId',_0xebe5('0x89'),_0xebe5('0x8a')],'include':[{'model':db[_0xebe5('0x8b')],'as':_0xebe5('0x8b'),'attributes':['id',_0xebe5('0x8c'),_0xebe5('0x8d')]}]})[_0xebe5('0xd')](handleEntityNotFound(_0x1acacf,null))[_0xebe5('0xd')](function(_0x272813){if(_0x272813){if(_0x272813[_0xebe5('0x8a')]){_0x272813[_0xebe5('0x8e')]=_0x272813[_0xebe5('0x8b')][_0xebe5('0x8c')];_0x2d0119=sanitizeRemoteUri(_0x272813[_0xebe5('0x8b')]['data7']);_0x222620=getWebApiUrl(_0x2d0119);return _0x272813;}_0x2d0119=sanitizeRemoteUri(_0x272813['remoteUri']);_0x222620=getWebApiUrl(_0x2d0119);var _0x467f8c={'method':_0xebe5('0x8f'),'uri':_0xebe5('0x90')+_0x272813[_0xebe5('0x88')]+_0xebe5('0x91'),'form':{'client_id':_0x272813[_0xebe5('0x92')],'resource':_0x2d0119,'username':_0x272813[_0xebe5('0x93')],'password':_0x272813[_0xebe5('0x86')],'grant_type':_0xebe5('0x86'),'client_secret':_0x272813[_0xebe5('0x89')]},'json':!![]};return rp(_0x467f8c);}})[_0xebe5('0xd')](function(_0x330690){_0x448d43=_0x330690[_0xebe5('0x8e')];var _0x41ace1={'method':_0xebe5('0x94'),'uri':encodeURI(_0x222620+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x3dea29+'\x27'),'headers':{'Authorization':_0xebe5('0x95')+_0x448d43,'If-None-Match':null,'OData-Version':_0xebe5('0x96')},'json':!![]};return rp(_0x41ace1);})[_0xebe5('0xd')](function(_0x2a5f6e){var _0x54a38a=_0x2a5f6e[_0xebe5('0x97')][0x0];var _0x2fb804=_0x54a38a[_0xebe5('0x98')];var _0x1ed648={'method':_0xebe5('0x94'),'uri':_0x222620+_0xebe5('0x99')+_0x2fb804+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xebe5('0x95')+_0x448d43,'If-None-Match':null,'OData-Version':_0xebe5('0x96')},'json':!![]};return rp(_0x1ed648);})[_0xebe5('0xd')](function(_0x56d94a){_0x3151e4=_0x56d94a;_0x5c770d=_0x3151e4[_0xebe5('0x9a')];_0x5c770d=_['remove'](_0x5c770d,function(_0x1293ef){return!_0x331aaa[_0xebe5('0x9b')](_0x1293ef[_0xebe5('0x9c')]);});var _0x1746b7=[];var _0x431ec8=[];_0x5c770d[_0xebe5('0x9d')](function(_0x2062cb){if(_0x2062cb[_0xebe5('0x9e')]){var _0x5af24d=_0x2062cb[_0xebe5('0x9e')]['substring'](_0x2062cb[_0xebe5('0x9e')][_0xebe5('0x42')]('.')+0x1);if(_0x5af24d===_0xebe5('0x9f')){_0x1746b7['push'](getSelectList(_0x222620,_0x421b79,_0x431ec8,_0x3151e4[_0xebe5('0x98')],_0x2062cb[_0xebe5('0x98')],_0x448d43));}}});return Promise[_0xebe5('0xa0')](_0x1746b7);})['then'](function(_0x40f28a){_0x2f8e83=_0x40f28a[0x0];var _0x21808c=[];var _0x473c6e=[];_0x5c770d[_0xebe5('0x9d')](function(_0x371d03){if(!_['isNil'](_0x371d03[_0xebe5('0x9e')])){var _0x2c3295=_0x371d03[_0xebe5('0x9e')][_0xebe5('0x41')](_0x371d03['@odata.type'][_0xebe5('0x42')]('.')+0x1);if(_0x2c3295===_0xebe5('0xa1')){_0x21808c['push'](getBooleanList(_0x222620,_0x421b79,_0x473c6e,_0x3151e4['MetadataId'],_0x371d03['MetadataId'],_0x448d43));}}});return Promise[_0xebe5('0xa0')](_0x21808c);})[_0xebe5('0xd')](function(_0x49cfb8){_0x126902=_0x49cfb8[0x0];var _0x41f0d3=[];var _0xf2ea49=[];_0x5c770d[_0xebe5('0x9d')](function(_0x11a0f1){if(_0x11a0f1['@odata.type']){var _0x17a71e=_0x11a0f1[_0xebe5('0x9e')][_0xebe5('0x41')](_0x11a0f1[_0xebe5('0x9e')][_0xebe5('0x42')]('.')+0x1);if(_0x17a71e===_0xebe5('0xa2')||_0x17a71e===_0xebe5('0xa3')||_0x17a71e===_0xebe5('0xa4')||_0x17a71e==='IntegerAttributeMetadata'||_0x17a71e==='MemoAttributeMetadata'||_0x17a71e===_0xebe5('0xa5')||_0x17a71e===_0xebe5('0xa6')||_0x17a71e===_0xebe5('0xa7')||_0x17a71e==='StateAttributeMetadata'||_0x17a71e==='DecimalAttributeMetadata'){_0x41f0d3[_0xebe5('0xa8')](getInputList(_0x222620,_0x421b79,_0x17a71e,_0xf2ea49,_0x3151e4[_0xebe5('0x98')],_0x11a0f1['MetadataId'],_0x448d43));}}});return Promise[_0xebe5('0xa0')](_0x41f0d3);})['then'](function(_0x358146){_0x3b6221=_0x358146[0x0];var _0x317acc=_0x2f8e83[_0xebe5('0x85')](_0x126902)[_0xebe5('0x85')](_0x3b6221);var _0x11f13d={'count':_0x317acc['length'],'rows':_0x317acc};return _0x11f13d;})[_0xebe5('0xd')](respondWithResult(_0x1acacf,null))[_0xebe5('0x2b')](function(_0x1a208f){var _0x1c284c=_0x1322ee['query'][_0xebe5('0xa9')]?0x1f4:_0x1a208f['statusCode']||0x1f4;logger[_0xebe5('0xf')](_0x1a208f[_0xebe5('0x10')]);delete _0x1a208f[_0xebe5('0x11')];if(_0x1c284c===0x191){_0x1c284c=0x190;}_0x1acacf[_0xebe5('0x7')](_0x1c284c)[_0xebe5('0x12')](_0x1322ee[_0xebe5('0x18')][_0xebe5('0xa9')]?{'message':_0xebe5('0xaa'),'statusCode':_0x1a208f['statusCode']}:_0x1a208f);});};function getSelectList(_0xdf1ce1,_0x2f7c7c,_0x56bec0,_0x2e7ae6,_0x488953,_0x1e8d08){var _0x24cb71={'method':_0xebe5('0x94'),'uri':_0xdf1ce1+_0xebe5('0x99')+_0x2e7ae6+')/Attributes('+_0x488953+_0xebe5('0xab')+_0xebe5('0xac'),'headers':{'Authorization':_0xebe5('0x95')+_0x1e8d08,'If-None-Match':null,'OData-Version':_0xebe5('0x96')},'json':!![]};return rp(_0x24cb71)[_0xebe5('0xd')](function(_0x3bae7a){var _0x2a4c0f=[];var _0x535798=_0x3bae7a[_0xebe5('0xad')]['Options'];_0x535798[_0xebe5('0x9d')](function(_0x559fec){_0x2a4c0f['push']({'name':_0x559fec[_0xebe5('0xae')]['UserLocalizedLabel']['Label'],'value':String(_0x559fec[_0xebe5('0xaf')])});});var _0xb33734={'id':_0x2f7c7c+'_'+_0x3bae7a[_0xebe5('0x9c')],'name':_0x3bae7a[_0xebe5('0xb0')][_0xebe5('0xb1')][_0xebe5('0xae')],'custom':![],'options':_0x2a4c0f};_0x56bec0['push'](_0xb33734);return _0x56bec0;});}function getBooleanList(_0x5c7c61,_0x30802d,_0x23c95b,_0x4d5709,_0x258936,_0x868792){var _0x5aa65b={'method':_0xebe5('0x94'),'uri':_0x5c7c61+_0xebe5('0x99')+_0x4d5709+_0xebe5('0xb2')+_0x258936+_0xebe5('0xb3'),'headers':{'Authorization':_0xebe5('0x95')+_0x868792,'If-None-Match':null,'OData-Version':_0xebe5('0x96')},'json':!![]};return rp(_0x5aa65b)[_0xebe5('0xd')](function(_0x5dbf93){var _0x357dbf=[];_0x357dbf[_0xebe5('0xa8')]({'name':_0x5dbf93['OptionSet'][_0xebe5('0xb4')][_0xebe5('0xae')][_0xebe5('0xb1')][_0xebe5('0xae')],'value':_0xebe5('0xb5')},{'name':_0x5dbf93[_0xebe5('0xad')][_0xebe5('0xb6')][_0xebe5('0xae')]['UserLocalizedLabel'][_0xebe5('0xae')],'value':'false'});var _0x3da339={'id':_0x30802d+'_'+_0x5dbf93[_0xebe5('0x9c')],'name':_0x5dbf93[_0xebe5('0xb0')][_0xebe5('0xb1')][_0xebe5('0xae')],'custom':![],'options':_0x357dbf};_0x23c95b[_0xebe5('0xa8')](_0x3da339);return _0x23c95b;});}function getInputList(_0x2d6631,_0x5f18b5,_0x11a1bc,_0x3ac1d2,_0xf664c1,_0x12fb1a,_0x51fb73){var _0x428061={'method':_0xebe5('0x94'),'uri':_0x2d6631+'EntityDefinitions('+_0xf664c1+_0xebe5('0xb2')+_0x12fb1a+_0xebe5('0xb7')+_0x11a1bc+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x51fb73,'If-None-Match':null,'OData-Version':_0xebe5('0x96')},'json':!![]};return rp(_0x428061)[_0xebe5('0xd')](function(_0x3d0ade){var _0x2166f0={'id':_0x5f18b5+'_'+_0x3d0ade[_0xebe5('0x9c')],'name':_0x3d0ade[_0xebe5('0xb0')][_0xebe5('0xb1')]?_0x3d0ade[_0xebe5('0xb0')]['UserLocalizedLabel'][_0xebe5('0xae')]:_0x3d0ade[_0xebe5('0x9c')],'custom':![],'options':[]};_0x3ac1d2['push'](_0x2166f0);return _0x3ac1d2;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 84199fc..a4141de 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(_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 +var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x40766f,_0x1e6935){var _0x11fb7e=function(_0x4e83c1){while(--_0x4e83c1){_0x40766f['push'](_0x40766f['shift']());}};_0x11fb7e(++_0x1e6935);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 394bd41..e730448 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 _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 +var _0x9012=['then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','Dynamics365Account','options','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x178176,_0x326f1a){var _0x36c404=function(_0x4dfe90){while(--_0x4dfe90){_0x178176['push'](_0x178176['shift']());}};_0x36c404(++_0x326f1a);}(_0x9012,0x147));var _0x2901=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x9012[_0xb0de07];return _0x4633d8;};'use strict';var _=require('lodash');var util=require(_0x2901('0x0'));var moment=require(_0x2901('0x1'));var BPromise=require(_0x2901('0x2'));var rs=require(_0x2901('0x3'));var fs=require('fs');var Redis=require(_0x2901('0x4'));var db=require(_0x2901('0x5'))['db'];var utils=require(_0x2901('0x6'));var logger=require(_0x2901('0x7'))(_0x2901('0x8'));var config=require(_0x2901('0x9'));var jayson=require(_0x2901('0xa'));var client=jayson[_0x2901('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x190ed9,_0x4d1111,_0x2119f7){return new BPromise(function(_0x37adee,_0x46de90){return client[_0x2901('0xc')](_0x190ed9,_0x2119f7)[_0x2901('0xd')](function(_0x208bff){logger[_0x2901('0xe')](_0x2901('0xf'),_0x4d1111,_0x2901('0x10'));logger[_0x2901('0x11')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4d1111,_0x2901('0x10'),JSON[_0x2901('0x12')](_0x208bff));if(_0x208bff[_0x2901('0x13')]){if(_0x208bff[_0x2901('0x13')]['code']===0x1f4){logger[_0x2901('0x13')](_0x2901('0xf'),_0x4d1111,_0x208bff['error']['message']);return _0x46de90(_0x208bff[_0x2901('0x13')][_0x2901('0x14')]);}logger[_0x2901('0x13')](_0x2901('0xf'),_0x4d1111,_0x208bff['error'][_0x2901('0x14')]);return _0x37adee(_0x208bff[_0x2901('0x13')][_0x2901('0x14')]);}else{logger[_0x2901('0xe')](_0x2901('0xf'),_0x4d1111,_0x2901('0x10'));_0x37adee(_0x208bff[_0x2901('0x15')][_0x2901('0x14')]);}})[_0x2901('0x16')](function(_0x30a6c8){logger[_0x2901('0x13')](_0x2901('0xf'),_0x4d1111,_0x30a6c8);_0x46de90(_0x30a6c8);});});}exports['GetDynamics365Account']=function(_0x4ceaa6){var _0x4c13e2=this;return new Promise(function(_0x40cd95,_0x1ea586){return db[_0x2901('0x17')]['findAll']({'raw':_0x4ceaa6[_0x2901('0x18')]?_0x4ceaa6[_0x2901('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4ceaa6[_0x2901('0x18')]?_0x4ceaa6[_0x2901('0x18')][_0x2901('0x19')]||null:null,'attributes':_0x4ceaa6[_0x2901('0x18')]?_0x4ceaa6[_0x2901('0x18')][_0x2901('0x1a')]||null:null,'limit':_0x4ceaa6['options']?_0x4ceaa6[_0x2901('0x18')][_0x2901('0x1b')]||null:null,'include':_0x4ceaa6[_0x2901('0x18')]?_0x4ceaa6[_0x2901('0x18')][_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x4ceaa6[_0x2901('0x18')][_0x2901('0x1c')],function(_0x5cef6b){return{'model':db[_0x5cef6b['model']],'as':_0x5cef6b['as'],'attributes':_0x5cef6b['attributes'],'include':_0x5cef6b[_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x5cef6b[_0x2901('0x1c')],function(_0x2c393f){return{'model':db[_0x2c393f[_0x2901('0x1e')]],'as':_0x2c393f['as'],'attributes':_0x2c393f[_0x2901('0x1a')],'include':_0x2c393f[_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x2c393f[_0x2901('0x1c')],function(_0x59cf73){return{'model':db[_0x59cf73[_0x2901('0x1e')]],'as':_0x59cf73['as'],'attributes':_0x59cf73[_0x2901('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ccbd1){logger['info'](_0x2901('0x1f'),_0x4ceaa6);logger[_0x2901('0x11')](_0x2901('0x1f'),_0x4ceaa6,JSON[_0x2901('0x12')](_0x2ccbd1));_0x40cd95(_0x2ccbd1);})[_0x2901('0x16')](function(_0x61824d){logger[_0x2901('0x13')](_0x2901('0x1f'),_0x61824d[_0x2901('0x14')],_0x4ceaa6);_0x1ea586(_0x4c13e2[_0x2901('0x13')](0x1f4,_0x61824d[_0x2901('0x14')]));});});};exports[_0x2901('0x20')]=function(_0x305f13){var _0x797e1d=this;return new Promise(function(_0x18bf34,_0x57d56b){return db[_0x2901('0x17')]['find']({'raw':_0x305f13[_0x2901('0x18')]?_0x305f13['options'][_0x2901('0x21')]===undefined?!![]:![]:!![],'where':_0x305f13[_0x2901('0x18')]?_0x305f13[_0x2901('0x18')][_0x2901('0x19')]||null:null,'attributes':_0x305f13['options']?_0x305f13[_0x2901('0x18')][_0x2901('0x1a')]||null:null,'include':_0x305f13[_0x2901('0x18')]?_0x305f13[_0x2901('0x18')][_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x305f13[_0x2901('0x18')][_0x2901('0x1c')],function(_0x598df2){return{'model':db[_0x598df2[_0x2901('0x1e')]],'as':_0x598df2['as'],'attributes':_0x598df2['attributes'],'include':_0x598df2[_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x598df2[_0x2901('0x1c')],function(_0x5955ac){return{'model':db[_0x5955ac[_0x2901('0x1e')]],'as':_0x5955ac['as'],'attributes':_0x5955ac[_0x2901('0x1a')],'include':_0x5955ac['include']?_[_0x2901('0x1d')](_0x5955ac[_0x2901('0x1c')],function(_0x387856){return{'model':db[_0x387856[_0x2901('0x1e')]],'as':_0x387856['as'],'attributes':_0x387856[_0x2901('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2901('0xd')](function(_0x3a72b0){logger[_0x2901('0xe')](_0x2901('0x20'),_0x305f13);logger[_0x2901('0x11')](_0x2901('0x20'),_0x305f13,JSON['stringify'](_0x3a72b0));_0x18bf34(_0x3a72b0);})[_0x2901('0x16')](function(_0x321426){logger[_0x2901('0x13')]('ShowDynamics365Account',_0x321426[_0x2901('0x14')],_0x305f13);_0x57d56b(_0x797e1d[_0x2901('0x13')](0x1f4,_0x321426[_0x2901('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7f83850..3605f1f 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 _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 +var _0x119c=['../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x36fbc5,_0x5c51d6){var _0x1aa625=function(_0x16fe6d){while(--_0x16fe6d){_0x36fbc5['push'](_0x36fbc5['shift']());}};_0x1aa625(++_0x5c51d6);}(_0x119c,0xea));var _0xc119=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0x119c[_0x1034ee];return _0x2922af;};'use strict';var multer=require('multer');var util=require(_0xc119('0x0'));var path=require('path');var timeout=require(_0xc119('0x1'));var express=require(_0xc119('0x2'));var router=express[_0xc119('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc119('0x4'));var interaction=require(_0xc119('0x5'));var config=require(_0xc119('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xc119('0x7')]('/',auth['isAuthenticated'](),controller[_0xc119('0x8')]);router['get'](_0xc119('0x9'),auth[_0xc119('0xa')](),controller[_0xc119('0xb')]);router[_0xc119('0x7')](_0xc119('0xc'),auth[_0xc119('0xa')](),controller[_0xc119('0xd')]);router[_0xc119('0x7')](_0xc119('0xe'),auth[_0xc119('0xa')](),controller[_0xc119('0xf')]);router['get'](_0xc119('0x10'),auth['isAuthenticated'](),controller[_0xc119('0x11')]);router[_0xc119('0x12')]('/',auth[_0xc119('0xa')](),controller[_0xc119('0x13')]);router[_0xc119('0x14')](_0xc119('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc119('0x15')](_0xc119('0x9'),auth[_0xc119('0xa')](),controller[_0xc119('0x16')]);module[_0xc119('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 58eeb9d..f9b2072 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 _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 +var _0x8b94=['contact','sequelize','exports','STRING','ENUM'];(function(_0x51be17,_0x14d549){var _0xf9eca4=function(_0x580b98){while(--_0x580b98){_0x51be17['push'](_0x51be17['shift']());}};_0xf9eca4(++_0x14d549);}(_0x8b94,0x1cd));var _0x48b9=function(_0x490299,_0x553441){_0x490299=_0x490299-0x0;var _0x412f5f=_0x8b94[_0x490299];return _0x412f5f;};'use strict';var Sequelize=require(_0x48b9('0x0'));module[_0x48b9('0x1')]={'name':{'type':Sequelize[_0x48b9('0x2')]},'description':{'type':Sequelize[_0x48b9('0x2')]},'ticketType':{'type':Sequelize[_0x48b9('0x3')]('incident','phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x48b9('0x3')](_0x48b9('0x4'),'nothing'),'defaultValue':_0x48b9('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8e33995..f2ad465 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 _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 +var _0x46e5=['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','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','findOne','Dynamics365Field','filter','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring'];(function(_0x25a950,_0x3b757b){var _0x40713d=function(_0xe360ac){while(--_0xe360ac){_0x25a950['push'](_0x25a950['shift']());}};_0x40713d(++_0x3b757b);}(_0x46e5,0xe8));var _0x546e=function(_0x4a325c,_0x422654){_0x4a325c=_0x4a325c-0x0;var _0x1b6676=_0x46e5[_0x4a325c];return _0x1b6676;};'use strict';var emlformat=require(_0x546e('0x0'));var rimraf=require(_0x546e('0x1'));var zipdir=require(_0x546e('0x2'));var jsonpatch=require(_0x546e('0x3'));var rp=require(_0x546e('0x4'));var moment=require('moment');var BPromise=require(_0x546e('0x5'));var Mustache=require('mustache');var util=require(_0x546e('0x6'));var path=require('path');var sox=require(_0x546e('0x7'));var csv=require(_0x546e('0x8'));var ejs=require(_0x546e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x546e('0xa'));var squel=require(_0x546e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x546e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x546e('0xd'));var Papa=require(_0x546e('0xe'));var Redis=require(_0x546e('0xf'));var authService=require(_0x546e('0x10'));var qs=require(_0x546e('0x11'));var as=require(_0x546e('0x12'));var hardwareService=require(_0x546e('0x13'));var logger=require(_0x546e('0x14'))(_0x546e('0x15'));var utils=require(_0x546e('0x16'));var config=require(_0x546e('0x17'));var licenseUtil=require(_0x546e('0x18'));var db=require(_0x546e('0x19'))['db'];function respondWithStatusCode(_0x30c6a5,_0x9abbf7){_0x9abbf7=_0x9abbf7||0xcc;return function(_0x27cf1d){if(_0x27cf1d){return _0x30c6a5[_0x546e('0x1a')](_0x9abbf7);}return _0x30c6a5[_0x546e('0x1b')](_0x9abbf7)[_0x546e('0x1c')]();};}function respondWithResult(_0x5a602a,_0x3509d8){_0x3509d8=_0x3509d8||0xc8;return function(_0x424f71){if(_0x424f71){return _0x5a602a['status'](_0x3509d8)['json'](_0x424f71);}};}function respondWithFilteredResult(_0x5a84a5,_0x4833d9){return function(_0x29b640){if(_0x29b640){var _0x34cd19=typeof _0x4833d9['offset']==='undefined'&&typeof _0x4833d9[_0x546e('0x1d')]==='undefined';var _0x4bbc6e=_0x29b640[_0x546e('0x1e')];var _0x5f0493=_0x34cd19?0x0:_0x4833d9[_0x546e('0x1f')];var _0x49da06=_0x34cd19?_0x29b640[_0x546e('0x1e')]:_0x4833d9['offset']+_0x4833d9[_0x546e('0x1d')];var _0x5cdc32;if(_0x49da06>=_0x4bbc6e){_0x49da06=_0x4bbc6e;_0x5cdc32=0xc8;}else{_0x5cdc32=0xce;}_0x5a84a5[_0x546e('0x1b')](_0x5cdc32);return _0x5a84a5[_0x546e('0x20')](_0x546e('0x21'),_0x5f0493+'-'+_0x49da06+'/'+_0x4bbc6e)[_0x546e('0x22')](_0x29b640);}return null;};}function patchUpdates(_0x25d721){return function(_0x57eb91){try{jsonpatch[_0x546e('0x23')](_0x57eb91,_0x25d721,!![]);}catch(_0x1ce9e4){return BPromise[_0x546e('0x24')](_0x1ce9e4);}return _0x57eb91[_0x546e('0x25')]();};}function saveUpdates(_0xe1064b,_0x2f0630){return function(_0x33033f){if(_0x33033f){return _0x33033f[_0x546e('0x26')](_0xe1064b)[_0x546e('0x27')](function(_0x4b038e){return _0x4b038e;});}return null;};}function removeEntity(_0x327d71,_0x31014d){return function(_0x5205f9){if(_0x5205f9){return _0x5205f9[_0x546e('0x28')]()[_0x546e('0x27')](function(){_0x327d71[_0x546e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf1eecb,_0x21e34b){return function(_0x505bc9){if(!_0x505bc9){_0xf1eecb[_0x546e('0x1a')](0x194);}return _0x505bc9;};}function handleError(_0x1bd900,_0x1dba59){_0x1dba59=_0x1dba59||0x1f4;return function(_0x2ff90e){logger[_0x546e('0x29')](_0x2ff90e[_0x546e('0x2a')]);if(_0x2ff90e[_0x546e('0x2b')]){delete _0x2ff90e['name'];}_0x1bd900[_0x546e('0x1b')](_0x1dba59)[_0x546e('0x2c')](_0x2ff90e);};}exports['index']=function(_0x278cab,_0x2df1c3){var _0x8deb0={},_0x529f51={},_0x54fd46={'count':0x0,'rows':[]};var _0x18fa04=_['map'](db['Dynamics365Configuration'][_0x546e('0x2d')],function(_0x13fd32){return{'name':_0x13fd32[_0x546e('0x2e')],'type':_0x13fd32[_0x546e('0x2f')]['key']};});_0x529f51['model']=_[_0x546e('0x30')](_0x18fa04,'name');_0x529f51[_0x546e('0x31')]=_[_0x546e('0x32')](_0x278cab[_0x546e('0x31')]);_0x529f51['filters']=_[_0x546e('0x33')](_0x529f51[_0x546e('0x34')],_0x529f51['query']);_0x8deb0[_0x546e('0x35')]=_[_0x546e('0x33')](_0x529f51[_0x546e('0x34')],qs['fields'](_0x278cab[_0x546e('0x31')]['fields']));_0x8deb0[_0x546e('0x35')]=_0x8deb0[_0x546e('0x35')]['length']?_0x8deb0['attributes']:_0x529f51['model'];if(!_0x278cab['query'][_0x546e('0x36')]('nolimit')){_0x8deb0[_0x546e('0x1d')]=qs[_0x546e('0x1d')](_0x278cab[_0x546e('0x31')][_0x546e('0x1d')]);_0x8deb0[_0x546e('0x1f')]=qs[_0x546e('0x1f')](_0x278cab[_0x546e('0x31')][_0x546e('0x1f')]);}_0x8deb0[_0x546e('0x37')]=qs[_0x546e('0x38')](_0x278cab['query'][_0x546e('0x38')]);_0x8deb0['where']=qs[_0x546e('0x39')](_[_0x546e('0x3a')](_0x278cab[_0x546e('0x31')],_0x529f51[_0x546e('0x39')]),_0x18fa04);if(_0x278cab['query']['filter']){_0x8deb0[_0x546e('0x3b')]=_[_0x546e('0x3c')](_0x8deb0[_0x546e('0x3b')],{'$or':_[_0x546e('0x30')](_0x18fa04,function(_0x344a47){if(_0x344a47[_0x546e('0x2f')]!==_0x546e('0x3d')){var _0x58dea1={};_0x58dea1[_0x344a47[_0x546e('0x2b')]]={'$like':'%'+_0x278cab[_0x546e('0x31')]['filter']+'%'};return _0x58dea1;}})});}_0x8deb0=_[_0x546e('0x3c')]({},_0x8deb0,_0x278cab[_0x546e('0x3e')]);var _0x230bd3={'where':_0x8deb0['where']};return db[_0x546e('0x3f')][_0x546e('0x1e')](_0x230bd3)[_0x546e('0x27')](function(_0x408285){_0x54fd46[_0x546e('0x1e')]=_0x408285;if(_0x278cab[_0x546e('0x31')][_0x546e('0x40')]){_0x8deb0[_0x546e('0x41')]=[{'all':!![]}];}return db[_0x546e('0x3f')][_0x546e('0x42')](_0x8deb0);})[_0x546e('0x27')](function(_0x399798){_0x54fd46[_0x546e('0x43')]=_0x399798;return _0x54fd46;})['then'](respondWithFilteredResult(_0x2df1c3,_0x8deb0))[_0x546e('0x44')](handleError(_0x2df1c3,null));};exports[_0x546e('0x45')]=function(_0x5c7179,_0xeb25ee){var _0x326f9d={'raw':![],'where':{'id':_0x5c7179[_0x546e('0x46')]['id']}},_0x59fa00={};_0x59fa00[_0x546e('0x34')]=_[_0x546e('0x32')](db[_0x546e('0x3f')]['rawAttributes']);_0x59fa00[_0x546e('0x31')]=_[_0x546e('0x32')](_0x5c7179['query']);_0x59fa00[_0x546e('0x39')]=_[_0x546e('0x33')](_0x59fa00[_0x546e('0x34')],_0x59fa00['query']);_0x326f9d['attributes']=_['intersection'](_0x59fa00['model'],qs[_0x546e('0x47')](_0x5c7179[_0x546e('0x31')]['fields']));_0x326f9d[_0x546e('0x35')]=_0x326f9d[_0x546e('0x35')][_0x546e('0x48')]?_0x326f9d[_0x546e('0x35')]:_0x59fa00[_0x546e('0x34')];if(_0x5c7179[_0x546e('0x31')][_0x546e('0x40')]){_0x326f9d[_0x546e('0x41')]=[{'all':!![]}];}_0x326f9d=_[_0x546e('0x3c')]({},_0x326f9d,_0x5c7179[_0x546e('0x3e')]);return db[_0x546e('0x3f')][_0x546e('0x49')](_0x326f9d)['then'](handleEntityNotFound(_0xeb25ee,null))['then'](respondWithResult(_0xeb25ee,null))[_0x546e('0x44')](handleError(_0xeb25ee,null));};exports[_0x546e('0x4a')]=function(_0x40b544,_0x2d567c){return db[_0x546e('0x3f')][_0x546e('0x4a')](_0x40b544[_0x546e('0x4b')],{})['then'](respondWithResult(_0x2d567c,0xc9))['catch'](handleError(_0x2d567c,null));};exports[_0x546e('0x26')]=function(_0x496411,_0xb655ed){if(_0x496411[_0x546e('0x4b')]['id']){delete _0x496411['body']['id'];}return db[_0x546e('0x3f')][_0x546e('0x49')]({'where':{'id':_0x496411['params']['id']}})['then'](handleEntityNotFound(_0xb655ed,null))[_0x546e('0x27')](saveUpdates(_0x496411[_0x546e('0x4b')],null))[_0x546e('0x27')](respondWithResult(_0xb655ed,null))['catch'](handleError(_0xb655ed,null));};exports[_0x546e('0x28')]=function(_0x5c0f48,_0xf663b0){return db[_0x546e('0x3f')]['find']({'where':{'id':_0x5c0f48[_0x546e('0x46')]['id']}})[_0x546e('0x27')](handleEntityNotFound(_0xf663b0,null))[_0x546e('0x27')](removeEntity(_0xf663b0,null))[_0x546e('0x44')](handleError(_0xf663b0,null));};exports['getFields']=function(_0x1279d3,_0x509cc9,_0x44bb94){var _0x5c3ac2={};var _0x578693={};var _0x49c271;var _0x182179;return db[_0x546e('0x3f')][_0x546e('0x4c')]({'where':{'id':_0x1279d3[_0x546e('0x46')]['id']}})[_0x546e('0x27')](handleEntityNotFound(_0x509cc9,null))[_0x546e('0x27')](function(_0x1ca575){if(_0x1ca575){_0x49c271=_0x1ca575;_0x578693['model']=_[_0x546e('0x32')](db[_0x546e('0x4d')][_0x546e('0x2d')]);_0x578693[_0x546e('0x31')]=_['keys'](_0x1279d3[_0x546e('0x31')]);_0x578693['filters']=_['intersection'](_0x578693[_0x546e('0x34')],_0x578693[_0x546e('0x31')]);_0x5c3ac2[_0x546e('0x35')]=_[_0x546e('0x33')](_0x578693['model'],qs[_0x546e('0x47')](_0x1279d3[_0x546e('0x31')][_0x546e('0x47')]));_0x5c3ac2[_0x546e('0x35')]=_0x5c3ac2[_0x546e('0x35')][_0x546e('0x48')]?_0x5c3ac2['attributes']:_0x578693[_0x546e('0x34')];_0x5c3ac2['order']=qs[_0x546e('0x38')](_0x1279d3[_0x546e('0x31')]['sort']);_0x5c3ac2[_0x546e('0x3b')]=qs['filters'](_['pick'](_0x1279d3[_0x546e('0x31')],_0x578693[_0x546e('0x39')]));if(_0x1279d3[_0x546e('0x31')][_0x546e('0x4e')]){_0x5c3ac2['where']=_[_0x546e('0x3c')](_0x5c3ac2[_0x546e('0x3b')],{'$or':_[_0x546e('0x30')](_0x5c3ac2['attributes'],function(_0xd17d93){var _0x3eaf14={};_0x3eaf14[_0xd17d93]={'$like':'%'+_0x1279d3['query'][_0x546e('0x4e')]+'%'};return _0x3eaf14;})});}_0x5c3ac2=_[_0x546e('0x3c')]({},_0x5c3ac2,_0x1279d3[_0x546e('0x3e')]);return _0x49c271['getFields'](_0x5c3ac2);}})[_0x546e('0x27')](function(_0x9d1613){if(_0x9d1613){_0x182179=_0x9d1613['length'];if(!_0x1279d3[_0x546e('0x31')]['hasOwnProperty'](_0x546e('0x4f'))){_0x5c3ac2[_0x546e('0x1d')]=qs['limit'](_0x1279d3['query'][_0x546e('0x1d')]);_0x5c3ac2[_0x546e('0x1f')]=qs[_0x546e('0x1f')](_0x1279d3[_0x546e('0x31')][_0x546e('0x1f')]);}return _0x49c271['getFields'](_0x5c3ac2);}})[_0x546e('0x27')](function(_0x150ace){if(_0x150ace){return _0x150ace?{'count':_0x182179,'rows':_0x150ace}:null;}})[_0x546e('0x27')](respondWithResult(_0x509cc9,null))[_0x546e('0x44')](handleError(_0x509cc9,null));};exports['getSubjects']=function(_0x12655a,_0x2c7204,_0x5c6277){var _0x3dbe7d={};var _0x102009={};var _0x14bdc9;var _0x189770;return db[_0x546e('0x3f')][_0x546e('0x4c')]({'where':{'id':_0x12655a[_0x546e('0x46')]['id']}})[_0x546e('0x27')](handleEntityNotFound(_0x2c7204,null))[_0x546e('0x27')](function(_0x244ee5){if(_0x244ee5){_0x14bdc9=_0x244ee5;_0x102009[_0x546e('0x34')]=_[_0x546e('0x32')](db[_0x546e('0x4d')]['rawAttributes']);_0x102009[_0x546e('0x31')]=_[_0x546e('0x32')](_0x12655a[_0x546e('0x31')]);_0x102009['filters']=_['intersection'](_0x102009[_0x546e('0x34')],_0x102009[_0x546e('0x31')]);_0x3dbe7d['attributes']=_['intersection'](_0x102009[_0x546e('0x34')],qs[_0x546e('0x47')](_0x12655a[_0x546e('0x31')]['fields']));_0x3dbe7d[_0x546e('0x35')]=_0x3dbe7d['attributes'][_0x546e('0x48')]?_0x3dbe7d[_0x546e('0x35')]:_0x102009['model'];_0x3dbe7d['order']=qs[_0x546e('0x38')](_0x12655a[_0x546e('0x31')][_0x546e('0x38')]);_0x3dbe7d[_0x546e('0x3b')]=qs[_0x546e('0x39')](_['pick'](_0x12655a[_0x546e('0x31')],_0x102009[_0x546e('0x39')]));if(_0x12655a[_0x546e('0x31')][_0x546e('0x4e')]){_0x3dbe7d['where']=_[_0x546e('0x3c')](_0x3dbe7d['where'],{'$or':_[_0x546e('0x30')](_0x3dbe7d[_0x546e('0x35')],function(_0x407293){var _0x578904={};_0x578904[_0x407293]={'$like':'%'+_0x12655a['query']['filter']+'%'};return _0x578904;})});}_0x3dbe7d=_['merge']({},_0x3dbe7d,_0x12655a['options']);return _0x14bdc9[_0x546e('0x50')](_0x3dbe7d);}})[_0x546e('0x27')](function(_0x53de06){if(_0x53de06){_0x189770=_0x53de06['length'];if(!_0x12655a[_0x546e('0x31')][_0x546e('0x36')](_0x546e('0x4f'))){_0x3dbe7d['limit']=qs[_0x546e('0x1d')](_0x12655a[_0x546e('0x31')][_0x546e('0x1d')]);_0x3dbe7d[_0x546e('0x1f')]=qs['offset'](_0x12655a[_0x546e('0x31')]['offset']);}return _0x14bdc9[_0x546e('0x50')](_0x3dbe7d);}})[_0x546e('0x27')](function(_0x466d60){if(_0x466d60){return _0x466d60?{'count':_0x189770,'rows':_0x466d60}:null;}})['then'](respondWithResult(_0x2c7204,null))['catch'](handleError(_0x2c7204,null));};exports['getDescriptions']=function(_0x3f5ae5,_0x75d646,_0xeef613){var _0x514bff={};var _0x29798a={};var _0x4af0ae;var _0x59e10c;return db[_0x546e('0x3f')][_0x546e('0x4c')]({'where':{'id':_0x3f5ae5[_0x546e('0x46')]['id']}})[_0x546e('0x27')](handleEntityNotFound(_0x75d646,null))[_0x546e('0x27')](function(_0x801f2a){if(_0x801f2a){_0x4af0ae=_0x801f2a;_0x29798a[_0x546e('0x34')]=_[_0x546e('0x32')](db[_0x546e('0x4d')][_0x546e('0x2d')]);_0x29798a['query']=_[_0x546e('0x32')](_0x3f5ae5[_0x546e('0x31')]);_0x29798a['filters']=_[_0x546e('0x33')](_0x29798a['model'],_0x29798a[_0x546e('0x31')]);_0x514bff[_0x546e('0x35')]=_['intersection'](_0x29798a[_0x546e('0x34')],qs['fields'](_0x3f5ae5[_0x546e('0x31')][_0x546e('0x47')]));_0x514bff['attributes']=_0x514bff[_0x546e('0x35')][_0x546e('0x48')]?_0x514bff[_0x546e('0x35')]:_0x29798a[_0x546e('0x34')];_0x514bff[_0x546e('0x37')]=qs['sort'](_0x3f5ae5[_0x546e('0x31')][_0x546e('0x38')]);_0x514bff['where']=qs[_0x546e('0x39')](_[_0x546e('0x3a')](_0x3f5ae5[_0x546e('0x31')],_0x29798a['filters']));if(_0x3f5ae5[_0x546e('0x31')]['filter']){_0x514bff[_0x546e('0x3b')]=_[_0x546e('0x3c')](_0x514bff[_0x546e('0x3b')],{'$or':_[_0x546e('0x30')](_0x514bff[_0x546e('0x35')],function(_0x27d4d5){var _0x1dd6be={};_0x1dd6be[_0x27d4d5]={'$like':'%'+_0x3f5ae5[_0x546e('0x31')]['filter']+'%'};return _0x1dd6be;})});}_0x514bff=_[_0x546e('0x3c')]({},_0x514bff,_0x3f5ae5[_0x546e('0x3e')]);return _0x4af0ae['getDescriptions'](_0x514bff);}})['then'](function(_0x3ae302){if(_0x3ae302){_0x59e10c=_0x3ae302[_0x546e('0x48')];if(!_0x3f5ae5['query'][_0x546e('0x36')](_0x546e('0x4f'))){_0x514bff['limit']=qs[_0x546e('0x1d')](_0x3f5ae5[_0x546e('0x31')][_0x546e('0x1d')]);_0x514bff[_0x546e('0x1f')]=qs[_0x546e('0x1f')](_0x3f5ae5[_0x546e('0x31')][_0x546e('0x1f')]);}return _0x4af0ae[_0x546e('0x51')](_0x514bff);}})['then'](function(_0x5632a5){if(_0x5632a5){return _0x5632a5?{'count':_0x59e10c,'rows':_0x5632a5}:null;}})[_0x546e('0x27')](respondWithResult(_0x75d646,null))[_0x546e('0x44')](handleError(_0x75d646,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f15cc6a..d345f7e 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 _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 +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x56d18c,_0x4e89aa){var _0x401257=function(_0x7fbc21){while(--_0x7fbc21){_0x56d18c['push'](_0x56d18c['shift']());}};_0x401257(++_0x4e89aa);}(_0x9bde,0xe1));var _0xe9bd=function(_0xde3bcd,_0x28f9da){_0xde3bcd=_0xde3bcd-0x0;var _0x50d9c3=_0x9bde[_0xde3bcd];return _0x50d9c3;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index f1f81d6..74245f2 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 _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 +var _0x69e1=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4b3f3e,_0x47dfcc){var _0x921fc3=function(_0x3e4b3b){while(--_0x3e4b3b){_0x4b3f3e['push'](_0x4b3f3e['shift']());}};_0x921fc3(++_0x47dfcc);}(_0x69e1,0x1f3));var _0x169e=function(_0x510124,_0x31987){_0x510124=_0x510124-0x0;var _0x480f86=_0x69e1[_0x510124];return _0x480f86;};'use strict';var _=require(_0x169e('0x0'));var util=require(_0x169e('0x1'));var moment=require(_0x169e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x169e('0x3'));var db=require(_0x169e('0x4'))['db'];var utils=require(_0x169e('0x5'));var logger=require(_0x169e('0x6'))(_0x169e('0x7'));var config=require(_0x169e('0x8'));var jayson=require(_0x169e('0x9'));var client=jayson[_0x169e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e4150,_0x53c1dc,_0x39379a){return new BPromise(function(_0x57ba4f,_0xb9b062){return client[_0x169e('0xb')](_0x1e4150,_0x39379a)[_0x169e('0xc')](function(_0x1c1e16){logger[_0x169e('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x53c1dc,_0x169e('0xe'));logger[_0x169e('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x53c1dc,_0x169e('0xe'),JSON[_0x169e('0x10')](_0x1c1e16));if(_0x1c1e16['error']){if(_0x1c1e16[_0x169e('0x11')][_0x169e('0x12')]===0x1f4){logger[_0x169e('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x53c1dc,_0x1c1e16[_0x169e('0x11')][_0x169e('0x13')]);return _0xb9b062(_0x1c1e16['error'][_0x169e('0x13')]);}logger[_0x169e('0x11')](_0x169e('0x14'),_0x53c1dc,_0x1c1e16[_0x169e('0x11')][_0x169e('0x13')]);return _0x57ba4f(_0x1c1e16[_0x169e('0x11')][_0x169e('0x13')]);}else{logger[_0x169e('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x53c1dc,_0x169e('0xe'));_0x57ba4f(_0x1c1e16[_0x169e('0x15')]['message']);}})['catch'](function(_0x385c9b){logger[_0x169e('0x11')](_0x169e('0x14'),_0x53c1dc,_0x385c9b);_0xb9b062(_0x385c9b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3f13e8c..354734b 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 _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 +var _0x3804=['/:id','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3804,0x15c));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4380('0x0'));var util=require(_0x4380('0x1'));var path=require(_0x4380('0x2'));var timeout=require(_0x4380('0x3'));var express=require(_0x4380('0x4'));var router=express['Router']();var fs_extra=require(_0x4380('0x5'));var auth=require(_0x4380('0x6'));var interaction=require(_0x4380('0x7'));var config=require(_0x4380('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x4380('0x9')]('/',auth[_0x4380('0xa')](),controller[_0x4380('0xb')]);router[_0x4380('0x9')](_0x4380('0xc'),auth[_0x4380('0xa')](),controller['show']);router[_0x4380('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4380('0xc'),auth[_0x4380('0xa')](),controller[_0x4380('0xe')]);router[_0x4380('0xf')]('/:id',auth[_0x4380('0xa')](),controller[_0x4380('0x10')]);module[_0x4380('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 28e9859..041405f 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 _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 +var _0x5d81=['ENUM','sequelize','string','customVariable','picklist','STRING'];(function(_0x4afafa,_0x3e2e25){var _0x4417f1=function(_0x438fb7){while(--_0x438fb7){_0x4afafa['push'](_0x4afafa['shift']());}};_0x4417f1(++_0x3e2e25);}(_0x5d81,0x1f3));var _0x15d8=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x5d81[_0x1a7846];return _0x48049;};'use strict';var Sequelize=require(_0x15d8('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x15d8('0x1'),'variable',_0x15d8('0x2'),'keyValue',_0x15d8('0x3')),'defaultValue':_0x15d8('0x1')},'content':{'type':Sequelize[_0x15d8('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x15d8('0x5')](_0x15d8('0x1'),'variable',_0x15d8('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x15d8('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x15d8('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ae32bab..9af8181 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 _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 +var _0x83c3=['undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x1b496f,_0x1fab72){var _0x2081b9=function(_0x143a4e){while(--_0x143a4e){_0x1b496f['push'](_0x1b496f['shift']());}};_0x2081b9(++_0x1fab72);}(_0x83c3,0xc5));var _0x383c=function(_0x429f82,_0x211f75){_0x429f82=_0x429f82-0x0;var _0x4d82bb=_0x83c3[_0x429f82];return _0x4d82bb;};'use strict';var emlformat=require(_0x383c('0x0'));var rimraf=require(_0x383c('0x1'));var zipdir=require(_0x383c('0x2'));var jsonpatch=require(_0x383c('0x3'));var rp=require(_0x383c('0x4'));var moment=require(_0x383c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x383c('0x6'));var util=require('util');var path=require(_0x383c('0x7'));var sox=require(_0x383c('0x8'));var csv=require(_0x383c('0x9'));var ejs=require(_0x383c('0xa'));var fs=require('fs');var fs_extra=require(_0x383c('0xb'));var _=require(_0x383c('0xc'));var squel=require(_0x383c('0xd'));var crypto=require('crypto');var jsforce=require(_0x383c('0xe'));var deskjs=require(_0x383c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x383c('0x10'));var Papa=require(_0x383c('0x11'));var Redis=require('ioredis');var authService=require(_0x383c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x383c('0x13'));var hardwareService=require(_0x383c('0x14'));var logger=require(_0x383c('0x15'))(_0x383c('0x16'));var utils=require(_0x383c('0x17'));var config=require(_0x383c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x383c('0x19'))['db'];function respondWithStatusCode(_0xa2e035,_0x47cf0b){_0x47cf0b=_0x47cf0b||0xcc;return function(_0x26e28a){if(_0x26e28a){return _0xa2e035[_0x383c('0x1a')](_0x47cf0b);}return _0xa2e035['status'](_0x47cf0b)[_0x383c('0x1b')]();};}function respondWithResult(_0xc676e0,_0x5b5ccf){_0x5b5ccf=_0x5b5ccf||0xc8;return function(_0x10219f){if(_0x10219f){return _0xc676e0[_0x383c('0x1c')](_0x5b5ccf)[_0x383c('0x1d')](_0x10219f);}};}function respondWithFilteredResult(_0x539477,_0x18583a){return function(_0x4cdee4){if(_0x4cdee4){var _0x24d568=typeof _0x18583a[_0x383c('0x1e')]===_0x383c('0x1f')&&typeof _0x18583a[_0x383c('0x20')]===_0x383c('0x1f');var _0x4ddc53=_0x4cdee4[_0x383c('0x21')];var _0x153adc=_0x24d568?0x0:_0x18583a[_0x383c('0x1e')];var _0x12a74c=_0x24d568?_0x4cdee4[_0x383c('0x21')]:_0x18583a[_0x383c('0x1e')]+_0x18583a[_0x383c('0x20')];var _0x26ad1a;if(_0x12a74c>=_0x4ddc53){_0x12a74c=_0x4ddc53;_0x26ad1a=0xc8;}else{_0x26ad1a=0xce;}_0x539477[_0x383c('0x1c')](_0x26ad1a);return _0x539477[_0x383c('0x22')](_0x383c('0x23'),_0x153adc+'-'+_0x12a74c+'/'+_0x4ddc53)['json'](_0x4cdee4);}return null;};}function patchUpdates(_0x102e51){return function(_0x59094d){try{jsonpatch[_0x383c('0x24')](_0x59094d,_0x102e51,!![]);}catch(_0x506f99){return BPromise['reject'](_0x506f99);}return _0x59094d[_0x383c('0x25')]();};}function saveUpdates(_0x4e476b,_0x92c1c3){return function(_0x23bc0f){if(_0x23bc0f){return _0x23bc0f[_0x383c('0x26')](_0x4e476b)['then'](function(_0x292e1f){return _0x292e1f;});}return null;};}function removeEntity(_0x3ad839,_0x3fcc48){return function(_0x5878f9){if(_0x5878f9){return _0x5878f9[_0x383c('0x27')]()[_0x383c('0x28')](function(){_0x3ad839[_0x383c('0x1c')](0xcc)[_0x383c('0x1b')]();});}};}function handleEntityNotFound(_0x3e3243,_0x4228fc){return function(_0x4436ec){if(!_0x4436ec){_0x3e3243[_0x383c('0x1a')](0x194);}return _0x4436ec;};}function handleError(_0x321c36,_0x4f2128){_0x4f2128=_0x4f2128||0x1f4;return function(_0x4dd1a1){logger[_0x383c('0x29')](_0x4dd1a1[_0x383c('0x2a')]);if(_0x4dd1a1[_0x383c('0x2b')]){delete _0x4dd1a1[_0x383c('0x2b')];}_0x321c36['status'](_0x4f2128)[_0x383c('0x2c')](_0x4dd1a1);};}exports[_0x383c('0x2d')]=function(_0x7b2c58,_0x42b2c2){var _0x5607b4={},_0x2b8b13={},_0x1527a2={'count':0x0,'rows':[]};var _0x8028cd=_['map'](db[_0x383c('0x2e')][_0x383c('0x2f')],function(_0x4bff63){return{'name':_0x4bff63[_0x383c('0x30')],'type':_0x4bff63['type']['key']};});_0x2b8b13['model']=_[_0x383c('0x31')](_0x8028cd,_0x383c('0x2b'));_0x2b8b13[_0x383c('0x32')]=_[_0x383c('0x33')](_0x7b2c58['query']);_0x2b8b13[_0x383c('0x34')]=_[_0x383c('0x35')](_0x2b8b13[_0x383c('0x36')],_0x2b8b13[_0x383c('0x32')]);_0x5607b4[_0x383c('0x37')]=_['intersection'](_0x2b8b13[_0x383c('0x36')],qs[_0x383c('0x38')](_0x7b2c58[_0x383c('0x32')]['fields']));_0x5607b4[_0x383c('0x37')]=_0x5607b4[_0x383c('0x37')][_0x383c('0x39')]?_0x5607b4['attributes']:_0x2b8b13[_0x383c('0x36')];if(!_0x7b2c58[_0x383c('0x32')][_0x383c('0x3a')](_0x383c('0x3b'))){_0x5607b4['limit']=qs[_0x383c('0x20')](_0x7b2c58[_0x383c('0x32')][_0x383c('0x20')]);_0x5607b4[_0x383c('0x1e')]=qs[_0x383c('0x1e')](_0x7b2c58[_0x383c('0x32')][_0x383c('0x1e')]);}_0x5607b4['order']=qs['sort'](_0x7b2c58[_0x383c('0x32')][_0x383c('0x3c')]);_0x5607b4[_0x383c('0x3d')]=qs[_0x383c('0x34')](_[_0x383c('0x3e')](_0x7b2c58[_0x383c('0x32')],_0x2b8b13[_0x383c('0x34')]),_0x8028cd);if(_0x7b2c58[_0x383c('0x32')][_0x383c('0x3f')]){_0x5607b4[_0x383c('0x3d')]=_[_0x383c('0x40')](_0x5607b4[_0x383c('0x3d')],{'$or':_[_0x383c('0x31')](_0x8028cd,function(_0x131f31){if(_0x131f31['type']!=='VIRTUAL'){var _0x4f4f30={};_0x4f4f30[_0x131f31[_0x383c('0x2b')]]={'$like':'%'+_0x7b2c58['query'][_0x383c('0x3f')]+'%'};return _0x4f4f30;}})});}_0x5607b4=_[_0x383c('0x40')]({},_0x5607b4,_0x7b2c58[_0x383c('0x41')]);var _0x26d4d4={'where':_0x5607b4[_0x383c('0x3d')]};return db[_0x383c('0x2e')]['count'](_0x26d4d4)[_0x383c('0x28')](function(_0x268373){_0x1527a2[_0x383c('0x21')]=_0x268373;if(_0x7b2c58[_0x383c('0x32')]['includeAll']){_0x5607b4[_0x383c('0x42')]=[{'all':!![]}];}return db[_0x383c('0x2e')][_0x383c('0x43')](_0x5607b4);})[_0x383c('0x28')](function(_0x3bf030){_0x1527a2[_0x383c('0x44')]=_0x3bf030;return _0x1527a2;})[_0x383c('0x28')](respondWithFilteredResult(_0x42b2c2,_0x5607b4))[_0x383c('0x45')](handleError(_0x42b2c2,null));};exports[_0x383c('0x46')]=function(_0x18540b,_0x2d9289){var _0x54a453={'raw':!![],'where':{'id':_0x18540b[_0x383c('0x47')]['id']}},_0x4010c0={};_0x4010c0['model']=_['keys'](db[_0x383c('0x2e')][_0x383c('0x2f')]);_0x4010c0[_0x383c('0x32')]=_[_0x383c('0x33')](_0x18540b[_0x383c('0x32')]);_0x4010c0[_0x383c('0x34')]=_[_0x383c('0x35')](_0x4010c0[_0x383c('0x36')],_0x4010c0[_0x383c('0x32')]);_0x54a453['attributes']=_[_0x383c('0x35')](_0x4010c0[_0x383c('0x36')],qs[_0x383c('0x38')](_0x18540b['query']['fields']));_0x54a453[_0x383c('0x37')]=_0x54a453[_0x383c('0x37')]['length']?_0x54a453['attributes']:_0x4010c0[_0x383c('0x36')];if(_0x18540b[_0x383c('0x32')][_0x383c('0x48')]){_0x54a453['include']=[{'all':!![]}];}_0x54a453=_[_0x383c('0x40')]({},_0x54a453,_0x18540b[_0x383c('0x41')]);return db['Dynamics365Field'][_0x383c('0x49')](_0x54a453)['then'](handleEntityNotFound(_0x2d9289,null))[_0x383c('0x28')](respondWithResult(_0x2d9289,null))[_0x383c('0x45')](handleError(_0x2d9289,null));};exports[_0x383c('0x4a')]=function(_0x5439ae,_0x1970ef){return db[_0x383c('0x2e')][_0x383c('0x4a')](_0x5439ae['body'],{})['then'](respondWithResult(_0x1970ef,0xc9))[_0x383c('0x45')](handleError(_0x1970ef,null));};exports[_0x383c('0x26')]=function(_0x5bc798,_0x2bdb24){if(_0x5bc798[_0x383c('0x4b')]['id']){delete _0x5bc798[_0x383c('0x4b')]['id'];}return db[_0x383c('0x2e')]['find']({'where':{'id':_0x5bc798['params']['id']}})[_0x383c('0x28')](handleEntityNotFound(_0x2bdb24,null))[_0x383c('0x28')](saveUpdates(_0x5bc798['body'],null))[_0x383c('0x28')](respondWithResult(_0x2bdb24,null))[_0x383c('0x45')](handleError(_0x2bdb24,null));};exports['destroy']=function(_0x17679b,_0xd4b7fe){return db[_0x383c('0x2e')][_0x383c('0x49')]({'where':{'id':_0x17679b[_0x383c('0x47')]['id']}})[_0x383c('0x28')](handleEntityNotFound(_0xd4b7fe,null))[_0x383c('0x28')](removeEntity(_0xd4b7fe,null))[_0x383c('0x45')](handleError(_0xd4b7fe,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 400a4bd..2ceabac 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 _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 +var _0xe38b=['./intDynamics365Field.attributes','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xe38b,0x198));var _0xbe38=function(_0x5c5940,_0xa5f767){_0x5c5940=_0x5c5940-0x0;var _0x26c147=_0xe38b[_0x5c5940];return _0x26c147;};'use strict';var _=require(_0xbe38('0x0'));var util=require('util');var logger=require(_0xbe38('0x1'))(_0xbe38('0x2'));var moment=require(_0xbe38('0x3'));var BPromise=require(_0xbe38('0x4'));var rp=require(_0xbe38('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe38('0x6'));var config=require(_0xbe38('0x7'));var attributes=require(_0xbe38('0x8'));module['exports']=function(_0xa7942e,_0x4cb698){return _0xa7942e['define']('Dynamics365Field',attributes,{'tableName':_0xbe38('0x9'),'paranoid':![],'indexes':[{'name':_0xbe38('0xa'),'fields':[_0xbe38('0xb'),_0xbe38('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 00b05d1..b10600d 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 _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 +var _0x02e1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4e1ff6,_0x3365f5){var _0x55f00f=function(_0x467109){while(--_0x467109){_0x4e1ff6['push'](_0x4e1ff6['shift']());}};_0x55f00f(++_0x3365f5);}(_0x02e1,0xec));var _0x102e=function(_0x35fc69,_0x5782b3){_0x35fc69=_0x35fc69-0x0;var _0x512adf=_0x02e1[_0x35fc69];return _0x512adf;};'use strict';var _=require(_0x102e('0x0'));var util=require('util');var moment=require(_0x102e('0x1'));var BPromise=require('bluebird');var rs=require(_0x102e('0x2'));var fs=require('fs');var Redis=require(_0x102e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x102e('0x4'));var logger=require(_0x102e('0x5'))(_0x102e('0x6'));var config=require(_0x102e('0x7'));var jayson=require(_0x102e('0x8'));var client=jayson[_0x102e('0x9')][_0x102e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dbd22,_0x171136,_0x4e65e3){return new BPromise(function(_0x4a6029,_0x11ae45){return client[_0x102e('0xb')](_0x4dbd22,_0x4e65e3)[_0x102e('0xc')](function(_0x2efeb3){logger[_0x102e('0xd')](_0x102e('0xe'),_0x171136,_0x102e('0xf'));logger[_0x102e('0x10')](_0x102e('0x11'),_0x171136,_0x102e('0xf'),JSON[_0x102e('0x12')](_0x2efeb3));if(_0x2efeb3['error']){if(_0x2efeb3['error']['code']===0x1f4){logger[_0x102e('0x13')](_0x102e('0xe'),_0x171136,_0x2efeb3[_0x102e('0x13')]['message']);return _0x11ae45(_0x2efeb3[_0x102e('0x13')][_0x102e('0x14')]);}logger[_0x102e('0x13')](_0x102e('0xe'),_0x171136,_0x2efeb3['error'][_0x102e('0x14')]);return _0x4a6029(_0x2efeb3[_0x102e('0x13')]['message']);}else{logger['info'](_0x102e('0xe'),_0x171136,_0x102e('0xf'));_0x4a6029(_0x2efeb3[_0x102e('0x15')][_0x102e('0x14')]);}})['catch'](function(_0x10dff0){logger['error'](_0x102e('0xe'),_0x171136,_0x10dff0);_0x11ae45(_0x10dff0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 93b70b7..ca9e629 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 _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 +var _0x9ee0=['../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x580a1a,_0x4ba2ab){var _0x18910b=function(_0x38f3b1){while(--_0x38f3b1){_0x580a1a['push'](_0x580a1a['shift']());}};_0x18910b(++_0x4ba2ab);}(_0x9ee0,0x16a));var _0x09ee=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0x9ee0[_0x367a3d];return _0x460539;};'use strict';var multer=require(_0x09ee('0x0'));var util=require('util');var path=require(_0x09ee('0x1'));var timeout=require(_0x09ee('0x2'));var express=require(_0x09ee('0x3'));var router=express[_0x09ee('0x4')]();var fs_extra=require(_0x09ee('0x5'));var auth=require(_0x09ee('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x09ee('0x7'));var controller=require(_0x09ee('0x8'));router[_0x09ee('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x09ee('0xa'),auth[_0x09ee('0xb')](),controller[_0x09ee('0xc')]);router['get'](_0x09ee('0xd'),auth[_0x09ee('0xb')](),controller[_0x09ee('0xe')]);router[_0x09ee('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x09ee('0xf')]);router[_0x09ee('0x10')]('/',auth[_0x09ee('0xb')](),controller[_0x09ee('0x11')]);router[_0x09ee('0x10')]('/:id/configurations',auth[_0x09ee('0xb')](),controller[_0x09ee('0x12')]);router[_0x09ee('0x13')](_0x09ee('0xa'),auth[_0x09ee('0xb')](),controller[_0x09ee('0x14')]);router['delete'](_0x09ee('0xa'),auth['isAuthenticated'](),controller[_0x09ee('0x15')]);module[_0x09ee('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 6a22f33..d8fa06b 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 _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 +var _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7b84,0x17c));var _0x47b8=function(_0x77aa88,_0xa8dfb2){_0x77aa88=_0x77aa88-0x0;var _0xa66c8a=_0x7b84[_0x77aa88];return _0xa66c8a;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 3f13349..f666b52 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 _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 +var _0x02f7=['Subjects','Descriptions','channel','FreshdeskField','getFields','remoteUri','slice','substring','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','description','ticket_type','group','company','includes','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','set','reject','save','update','then','destroy','stack','name','send','FreshdeskAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId'];(function(_0x5a1837,_0x3426a9){var _0x3f4508=function(_0xbd211e){while(--_0xbd211e){_0x5a1837['push'](_0x5a1837['shift']());}};_0x3f4508(++_0x3426a9);}(_0x02f7,0x1d3));var _0x702f=function(_0x36d2e4,_0x49819a){_0x36d2e4=_0x36d2e4-0x0;var _0x3c32ae=_0x02f7[_0x36d2e4];return _0x3c32ae;};'use strict';var emlformat=require(_0x702f('0x0'));var rimraf=require(_0x702f('0x1'));var zipdir=require(_0x702f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x702f('0x3'));var moment=require(_0x702f('0x4'));var BPromise=require(_0x702f('0x5'));var Mustache=require(_0x702f('0x6'));var util=require(_0x702f('0x7'));var path=require(_0x702f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x702f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x702f('0xa'));var squel=require(_0x702f('0xb'));var crypto=require(_0x702f('0xc'));var jsforce=require(_0x702f('0xd'));var deskjs=require(_0x702f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x702f('0xf'));var Papa=require(_0x702f('0x10'));var Redis=require(_0x702f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x702f('0x12'));var as=require(_0x702f('0x13'));var hardwareService=require(_0x702f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x702f('0x15'));var config=require(_0x702f('0x16'));var licenseUtil=require(_0x702f('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x702f('0x18'));function respondWithStatusCode(_0x3ac816,_0x4f8528){_0x4f8528=_0x4f8528||0xcc;return function(_0x39c277){if(_0x39c277){return _0x3ac816[_0x702f('0x19')](_0x4f8528);}return _0x3ac816[_0x702f('0x1a')](_0x4f8528)[_0x702f('0x1b')]();};}function respondWithResult(_0x1a714d,_0xe4f824){_0xe4f824=_0xe4f824||0xc8;return function(_0xa07719){if(_0xa07719){return _0x1a714d['status'](_0xe4f824)[_0x702f('0x1c')](_0xa07719);}};}function respondWithFilteredResult(_0x4104ae,_0x3bef6c){return function(_0x67a47e){if(_0x67a47e){var _0x1ab677=typeof _0x3bef6c['offset']==='undefined'&&typeof _0x3bef6c[_0x702f('0x1d')]==='undefined';var _0x922c85=_0x67a47e[_0x702f('0x1e')];var _0xa749fd=_0x1ab677?0x0:_0x3bef6c[_0x702f('0x1f')];var _0x53dd8f=_0x1ab677?_0x67a47e[_0x702f('0x1e')]:_0x3bef6c['offset']+_0x3bef6c['limit'];var _0x429813;if(_0x53dd8f>=_0x922c85){_0x53dd8f=_0x922c85;_0x429813=0xc8;}else{_0x429813=0xce;}_0x4104ae[_0x702f('0x1a')](_0x429813);return _0x4104ae[_0x702f('0x20')]('Content-Range',_0xa749fd+'-'+_0x53dd8f+'/'+_0x922c85)[_0x702f('0x1c')](_0x67a47e);}return null;};}function patchUpdates(_0x218e30){return function(_0x34864e){try{jsonpatch['apply'](_0x34864e,_0x218e30,!![]);}catch(_0x38ecba){return BPromise[_0x702f('0x21')](_0x38ecba);}return _0x34864e[_0x702f('0x22')]();};}function saveUpdates(_0x3f573e,_0x16cc77){return function(_0x431e6d){if(_0x431e6d){return _0x431e6d[_0x702f('0x23')](_0x3f573e)[_0x702f('0x24')](function(_0x1f47a2){return _0x1f47a2;});}return null;};}function removeEntity(_0xc030e5,_0x4699b4){return function(_0x28a0d8){if(_0x28a0d8){return _0x28a0d8[_0x702f('0x25')]()[_0x702f('0x24')](function(){_0xc030e5[_0x702f('0x1a')](0xcc)[_0x702f('0x1b')]();});}};}function handleEntityNotFound(_0x386086,_0x5f2961){return function(_0x3a2aeb){if(!_0x3a2aeb){_0x386086[_0x702f('0x19')](0x194);}return _0x3a2aeb;};}function handleError(_0x46136d,_0x244f42){_0x244f42=_0x244f42||0x1f4;return function(_0x9bb674){logger['error'](_0x9bb674[_0x702f('0x26')]);if(_0x9bb674['name']){delete _0x9bb674[_0x702f('0x27')];}_0x46136d[_0x702f('0x1a')](_0x244f42)[_0x702f('0x28')](_0x9bb674);};}exports['index']=function(_0x573103,_0x10d5c4){var _0x52fa34={},_0x2ee69d={},_0x228d4e={'count':0x0,'rows':[]};var _0x38dde7=_['map'](db[_0x702f('0x29')][_0x702f('0x2a')],function(_0x25e9df){return{'name':_0x25e9df['fieldName'],'type':_0x25e9df['type'][_0x702f('0x2b')]};});_0x2ee69d[_0x702f('0x2c')]=_[_0x702f('0x2d')](_0x38dde7,_0x702f('0x27'));_0x2ee69d[_0x702f('0x2e')]=_[_0x702f('0x2f')](_0x573103['query']);_0x2ee69d[_0x702f('0x30')]=_[_0x702f('0x31')](_0x2ee69d[_0x702f('0x2c')],_0x2ee69d[_0x702f('0x2e')]);_0x52fa34[_0x702f('0x32')]=_['intersection'](_0x2ee69d[_0x702f('0x2c')],qs[_0x702f('0x33')](_0x573103[_0x702f('0x2e')]['fields']));_0x52fa34[_0x702f('0x32')]=_0x52fa34[_0x702f('0x32')][_0x702f('0x34')]?_0x52fa34[_0x702f('0x32')]:_0x2ee69d[_0x702f('0x2c')];if(!_0x573103[_0x702f('0x2e')][_0x702f('0x35')](_0x702f('0x36'))){_0x52fa34[_0x702f('0x1d')]=qs[_0x702f('0x1d')](_0x573103[_0x702f('0x2e')]['limit']);_0x52fa34['offset']=qs[_0x702f('0x1f')](_0x573103[_0x702f('0x2e')][_0x702f('0x1f')]);}_0x52fa34[_0x702f('0x37')]=qs[_0x702f('0x38')](_0x573103[_0x702f('0x2e')]['sort']);_0x52fa34[_0x702f('0x39')]=qs[_0x702f('0x30')](_[_0x702f('0x3a')](_0x573103[_0x702f('0x2e')],_0x2ee69d[_0x702f('0x30')]),_0x38dde7);if(_0x573103[_0x702f('0x2e')][_0x702f('0x3b')]){_0x52fa34['where']=_[_0x702f('0x3c')](_0x52fa34[_0x702f('0x39')],{'$or':_[_0x702f('0x2d')](_0x38dde7,function(_0x2bbde4){if(_0x2bbde4[_0x702f('0x3d')]!==_0x702f('0x3e')){var _0x8f1d4={};_0x8f1d4[_0x2bbde4['name']]={'$like':'%'+_0x573103['query'][_0x702f('0x3b')]+'%'};return _0x8f1d4;}})});}_0x52fa34=_[_0x702f('0x3c')]({},_0x52fa34,_0x573103['options']);var _0xed3590={'where':_0x52fa34[_0x702f('0x39')]};return db['FreshdeskAccount'][_0x702f('0x1e')](_0xed3590)[_0x702f('0x24')](function(_0x334630){_0x228d4e[_0x702f('0x1e')]=_0x334630;if(_0x573103[_0x702f('0x2e')][_0x702f('0x3f')]){_0x52fa34[_0x702f('0x40')]=[{'all':!![]}];}return db[_0x702f('0x29')][_0x702f('0x41')](_0x52fa34);})[_0x702f('0x24')](function(_0xbfd3c9){_0x228d4e[_0x702f('0x42')]=_0xbfd3c9;return _0x228d4e;})['then'](respondWithFilteredResult(_0x10d5c4,_0x52fa34))['catch'](handleError(_0x10d5c4,null));};exports[_0x702f('0x43')]=function(_0x161ac4,_0xe8831a){var _0x180e6e={'raw':![],'where':{'id':_0x161ac4[_0x702f('0x44')]['id']}},_0x43f7ad={};_0x43f7ad[_0x702f('0x2c')]=_[_0x702f('0x2f')](db['FreshdeskAccount']['rawAttributes']);_0x43f7ad[_0x702f('0x2e')]=_[_0x702f('0x2f')](_0x161ac4[_0x702f('0x2e')]);_0x43f7ad[_0x702f('0x30')]=_['intersection'](_0x43f7ad[_0x702f('0x2c')],_0x43f7ad['query']);_0x180e6e[_0x702f('0x32')]=_[_0x702f('0x31')](_0x43f7ad['model'],qs['fields'](_0x161ac4[_0x702f('0x2e')][_0x702f('0x33')]));_0x180e6e['attributes']=_0x180e6e['attributes'][_0x702f('0x34')]?_0x180e6e[_0x702f('0x32')]:_0x43f7ad[_0x702f('0x2c')];if(_0x161ac4[_0x702f('0x2e')][_0x702f('0x3f')]){_0x180e6e[_0x702f('0x40')]=[{'all':!![]}];}_0x180e6e=_['merge']({},_0x180e6e,_0x161ac4['options']);return db[_0x702f('0x29')][_0x702f('0x45')](_0x180e6e)[_0x702f('0x24')](handleEntityNotFound(_0xe8831a,null))[_0x702f('0x24')](respondWithResult(_0xe8831a,null))[_0x702f('0x46')](handleError(_0xe8831a,null));};exports[_0x702f('0x47')]=function(_0x4d9e5e,_0x2e957b){return db[_0x702f('0x29')]['create'](_0x4d9e5e[_0x702f('0x48')],{})['then'](respondWithResult(_0x2e957b,0xc9))['catch'](handleError(_0x2e957b,null));};exports['update']=function(_0x2c8599,_0x1ae430){if(_0x2c8599['body']['id']){delete _0x2c8599[_0x702f('0x48')]['id'];}return db['FreshdeskAccount'][_0x702f('0x45')]({'where':{'id':_0x2c8599[_0x702f('0x44')]['id']}})[_0x702f('0x24')](handleEntityNotFound(_0x1ae430,null))[_0x702f('0x24')](saveUpdates(_0x2c8599[_0x702f('0x48')],null))[_0x702f('0x24')](respondWithResult(_0x1ae430,null))[_0x702f('0x46')](handleError(_0x1ae430,null));};exports[_0x702f('0x25')]=function(_0x3f378c,_0x8f260d){return db[_0x702f('0x29')][_0x702f('0x45')]({'where':{'id':_0x3f378c['params']['id']}})[_0x702f('0x24')](handleEntityNotFound(_0x8f260d,null))[_0x702f('0x24')](removeEntity(_0x8f260d,null))[_0x702f('0x46')](handleError(_0x8f260d,null));};exports[_0x702f('0x49')]=function(_0x4a7ea9,_0x13cfdc,_0xe28bb5){var _0x1d7a1a={};var _0x1f305a={};var _0x3f1da0;var _0x3f5899;return db['FreshdeskAccount'][_0x702f('0x4a')]({'where':{'id':_0x4a7ea9[_0x702f('0x44')]['id']}})[_0x702f('0x24')](handleEntityNotFound(_0x13cfdc,null))[_0x702f('0x24')](function(_0x541b9b){if(_0x541b9b){_0x3f1da0=_0x541b9b;_0x1f305a[_0x702f('0x2c')]=_[_0x702f('0x2f')](db[_0x702f('0x4b')]['rawAttributes']);_0x1f305a[_0x702f('0x2e')]=_[_0x702f('0x2f')](_0x4a7ea9[_0x702f('0x2e')]);_0x1f305a[_0x702f('0x30')]=_[_0x702f('0x31')](_0x1f305a['model'],_0x1f305a[_0x702f('0x2e')]);_0x1d7a1a['attributes']=_[_0x702f('0x31')](_0x1f305a[_0x702f('0x2c')],qs[_0x702f('0x33')](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x33')]));_0x1d7a1a[_0x702f('0x32')]=_0x1d7a1a[_0x702f('0x32')][_0x702f('0x34')]?_0x1d7a1a[_0x702f('0x32')]:_0x1f305a[_0x702f('0x2c')];_0x1d7a1a['order']=qs['sort'](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x38')]);_0x1d7a1a[_0x702f('0x39')]=qs[_0x702f('0x30')](_[_0x702f('0x3a')](_0x4a7ea9[_0x702f('0x2e')],_0x1f305a[_0x702f('0x30')]));if(_0x4a7ea9['query'][_0x702f('0x3b')]){_0x1d7a1a[_0x702f('0x39')]=_[_0x702f('0x3c')](_0x1d7a1a[_0x702f('0x39')],{'$or':_['map'](_0x1d7a1a['attributes'],function(_0x5e5c82){var _0x23d1d3={};_0x23d1d3[_0x5e5c82]={'$like':'%'+_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x3b')]+'%'};return _0x23d1d3;})});}_0x1d7a1a=_['merge']({},_0x1d7a1a,_0x4a7ea9['options']);return _0x3f1da0[_0x702f('0x49')](_0x1d7a1a);}})[_0x702f('0x24')](function(_0x599a40){if(_0x599a40){_0x3f5899=_0x599a40[_0x702f('0x34')];if(!_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x35')](_0x702f('0x36'))){_0x1d7a1a['limit']=qs[_0x702f('0x1d')](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x1d')]);_0x1d7a1a[_0x702f('0x1f')]=qs['offset'](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x1f')]);}return _0x3f1da0['getConfigurations'](_0x1d7a1a);}})[_0x702f('0x24')](function(_0x336ef6){if(_0x336ef6){return _0x336ef6?{'count':_0x3f5899,'rows':_0x336ef6}:null;}})[_0x702f('0x24')](respondWithResult(_0x13cfdc,null))[_0x702f('0x46')](handleError(_0x13cfdc,null));};exports[_0x702f('0x4c')]=function(_0x10de2a,_0x32e37b,_0x4facae){if(_0x10de2a[_0x702f('0x48')]['id']){delete _0x10de2a['body']['id'];}return db[_0x702f('0x29')][_0x702f('0x4a')]({'where':{'id':_0x10de2a[_0x702f('0x44')]['id']}})['then'](handleEntityNotFound(_0x32e37b,null))[_0x702f('0x24')](function(_0x4ca7ba){if(_0x4ca7ba){_0x10de2a[_0x702f('0x48')][_0x702f('0x4d')]=_0x4ca7ba['id'];_0x10de2a[_0x702f('0x48')][_0x702f('0x4e')]=integrations['getSubjects'](_0x10de2a[_0x702f('0x48')]['channel'],_0x10de2a[_0x702f('0x48')][_0x702f('0x3d')]);_0x10de2a[_0x702f('0x48')][_0x702f('0x4f')]=integrations['getDescriptions'](_0x10de2a['body'][_0x702f('0x50')],_0x10de2a[_0x702f('0x48')][_0x702f('0x3d')]);return db[_0x702f('0x4b')]['create'](_0x10de2a[_0x702f('0x48')],{'include':[{'model':db[_0x702f('0x51')],'as':_0x702f('0x4e')},{'model':db[_0x702f('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x32e37b,null))[_0x702f('0x46')](handleError(_0x32e37b,null));};exports[_0x702f('0x52')]=function(_0x3ee283,_0x57d505,_0x25709c){var _0x30b74f='';return db['FreshdeskAccount'][_0x702f('0x4a')]({'where':{'id':_0x3ee283[_0x702f('0x44')]['id']},'attributes':['id',_0x702f('0x53'),'apiKey']})['then'](handleEntityNotFound(_0x57d505,null))['then'](function(_0x31efbf){if(_0x31efbf){_0x30b74f=_0x31efbf[_0x702f('0x53')];var _0x1bf58f=_0x30b74f[_0x702f('0x54')](-0x1);if(_0x1bf58f==='/'){_0x30b74f=_0x30b74f[_0x702f('0x55')](0x0,_0x30b74f['lastIndexOf'](_0x1bf58f));}return rp({'method':'GET','uri':util[_0x702f('0x56')](_0x702f('0x57'),_0x30b74f,_0x702f('0x58')),'headers':{'Authorization':util['format'](_0x702f('0x59'),new Buffer(util[_0x702f('0x56')](_0x702f('0x5a'),_0x31efbf[_0x702f('0x5b')]))[_0x702f('0x5c')](_0x702f('0x5d')))},'json':!![]});}})[_0x702f('0x24')](function(_0x13142f){if(_0x13142f){var _0x2b6454=[_0x702f('0x5e'),'subject','agent',_0x702f('0x5f'),_0x702f('0x1a'),'priority','group','source',_0x702f('0x60'),_0x702f('0x61'),_0x702f('0x62')];_['remove'](_0x13142f,function(_0xc86c4b){return _0x2b6454[_0x702f('0x63')](_0xc86c4b['name'])||!_0xc86c4b['default']&&_0xc86c4b['type']!==_0x702f('0x64')&&_0xc86c4b[_0x702f('0x3d')]!==_0x702f('0x65');});return{'count':_0x13142f[_0x702f('0x34')],'rows':_[_0x702f('0x2d')](_0x13142f,function(_0x45ee70){return{'id':_0x45ee70['name'],'name':_0x45ee70[_0x702f('0x66')],'custom':!_0x45ee70['default'],'options':_0x45ee70[_0x702f('0x67')]?_[_0x702f('0x2d')](_0x45ee70[_0x702f('0x67')],function(_0x1daac9){return{'name':_[_0x702f('0x68')](_0x1daac9),'value':_0x1daac9};}):[]};})};}})[_0x702f('0x24')](respondWithResult(_0x57d505,null))[_0x702f('0x46')](function(_0x1ee2c0){var _0x13340e=_0x3ee283[_0x702f('0x2e')][_0x702f('0x69')]?0x1f4:_0x1ee2c0[_0x702f('0x6a')]||0x1f4;logger['error'](_0x702f('0x6b'),_0x702f('0x52'),_0x13340e,JSON['stringify'](_0x1ee2c0));delete _0x1ee2c0['name'];if(_0x13340e===0x191){_0x13340e=0x190;}_0x57d505['status'](_0x13340e)[_0x702f('0x28')](_0x3ee283[_0x702f('0x2e')][_0x702f('0x69')]?{'message':_0x702f('0x6c'),'statusCode':_0x1ee2c0['statusCode']}:_0x1ee2c0);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f011dd5..8de0563 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 _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 +var _0x977b=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4a25e7,_0x31483a){var _0x2238bb=function(_0x32c49e){while(--_0x32c49e){_0x4a25e7['push'](_0x4a25e7['shift']());}};_0x2238bb(++_0x31483a);}(_0x977b,0xb0));var _0xb977=function(_0x5d01f9,_0x303620){_0x5d01f9=_0x5d01f9-0x0;var _0x1fe316=_0x977b[_0x5d01f9];return _0x1fe316;};'use strict';var _=require(_0xb977('0x0'));var util=require('util');var logger=require(_0xb977('0x1'))('api');var moment=require(_0xb977('0x2'));var BPromise=require(_0xb977('0x3'));var rp=require(_0xb977('0x4'));var fs=require('fs');var path=require(_0xb977('0x5'));var rimraf=require(_0xb977('0x6'));var config=require(_0xb977('0x7'));var attributes=require(_0xb977('0x8'));var integrations=require(_0xb977('0x9'));module[_0xb977('0xa')]=function(_0x35c421,_0x2900cd){return _0x35c421['define'](_0xb977('0xb'),attributes,{'tableName':_0xb977('0xc'),'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 f03348a..84a1b4e 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 _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 +var _0xdcab=['request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','include','model','map','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x14cadd,_0x18f999){var _0x1d63f9=function(_0x5cbc6c){while(--_0x5cbc6c){_0x14cadd['push'](_0x14cadd['shift']());}};_0x1d63f9(++_0x18f999);}(_0xdcab,0x1e9));var _0xbdca=function(_0x46ba0d,_0x4e5086){_0x46ba0d=_0x46ba0d-0x0;var _0x4aa60a=_0xdcab[_0x46ba0d];return _0x4aa60a;};'use strict';var _=require(_0xbdca('0x0'));var util=require(_0xbdca('0x1'));var moment=require(_0xbdca('0x2'));var BPromise=require(_0xbdca('0x3'));var rs=require(_0xbdca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbdca('0x5'));var logger=require(_0xbdca('0x6'))(_0xbdca('0x7'));var config=require(_0xbdca('0x8'));var jayson=require(_0xbdca('0x9'));var client=jayson[_0xbdca('0xa')][_0xbdca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37b1ff,_0x45cb63,_0xd4559f){return new BPromise(function(_0x4cde25,_0x1e46b9){return client['request'](_0x37b1ff,_0xd4559f)[_0xbdca('0xc')](function(_0x2c5579){logger[_0xbdca('0xd')](_0xbdca('0xe'),_0x45cb63,_0xbdca('0xf'));logger[_0xbdca('0x10')](_0xbdca('0x11'),_0x45cb63,_0xbdca('0xf'),JSON[_0xbdca('0x12')](_0x2c5579));if(_0x2c5579['error']){if(_0x2c5579[_0xbdca('0x13')][_0xbdca('0x14')]===0x1f4){logger[_0xbdca('0x13')](_0xbdca('0xe'),_0x45cb63,_0x2c5579['error'][_0xbdca('0x15')]);return _0x1e46b9(_0x2c5579['error'][_0xbdca('0x15')]);}logger[_0xbdca('0x13')](_0xbdca('0xe'),_0x45cb63,_0x2c5579['error']['message']);return _0x4cde25(_0x2c5579[_0xbdca('0x13')][_0xbdca('0x15')]);}else{logger[_0xbdca('0xd')](_0xbdca('0xe'),_0x45cb63,_0xbdca('0xf'));_0x4cde25(_0x2c5579[_0xbdca('0x16')]['message']);}})[_0xbdca('0x17')](function(_0x69ecf6){logger[_0xbdca('0x13')](_0xbdca('0xe'),_0x45cb63,_0x69ecf6);_0x1e46b9(_0x69ecf6);});});}exports['GetFreshdeskAccount']=function(_0xa813fc){var _0x90d3d=this;return new Promise(function(_0x1b98cc,_0xb19a6){return db['FreshdeskAccount'][_0xbdca('0x18')]({'raw':_0xa813fc[_0xbdca('0x19')]?_0xa813fc['options'][_0xbdca('0x1a')]===undefined?!![]:![]:!![],'where':_0xa813fc[_0xbdca('0x19')]?_0xa813fc['options'][_0xbdca('0x1b')]||null:null,'attributes':_0xa813fc[_0xbdca('0x19')]?_0xa813fc[_0xbdca('0x19')][_0xbdca('0x1c')]||null:null,'limit':_0xa813fc[_0xbdca('0x19')]?_0xa813fc[_0xbdca('0x19')]['limit']||null:null,'include':_0xa813fc[_0xbdca('0x19')]?_0xa813fc[_0xbdca('0x19')]['include']?_['map'](_0xa813fc[_0xbdca('0x19')][_0xbdca('0x1d')],function(_0x3fb260){return{'model':db[_0x3fb260[_0xbdca('0x1e')]],'as':_0x3fb260['as'],'attributes':_0x3fb260[_0xbdca('0x1c')],'include':_0x3fb260[_0xbdca('0x1d')]?_[_0xbdca('0x1f')](_0x3fb260[_0xbdca('0x1d')],function(_0x3b260c){return{'model':db[_0x3b260c[_0xbdca('0x1e')]],'as':_0x3b260c['as'],'attributes':_0x3b260c[_0xbdca('0x1c')],'include':_0x3b260c['include']?_['map'](_0x3b260c['include'],function(_0x4cdc60){return{'model':db[_0x4cdc60['model']],'as':_0x4cdc60['as'],'attributes':_0x4cdc60[_0xbdca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbdca('0xc')](function(_0x45113b){logger[_0xbdca('0xd')](_0xbdca('0x20'),_0xa813fc);logger[_0xbdca('0x10')]('GetFreshdeskAccount',_0xa813fc,JSON[_0xbdca('0x12')](_0x45113b));_0x1b98cc(_0x45113b);})[_0xbdca('0x17')](function(_0x4cc9c6){logger[_0xbdca('0x13')]('GetFreshdeskAccount',_0x4cc9c6[_0xbdca('0x15')],_0xa813fc);_0xb19a6(_0x90d3d[_0xbdca('0x13')](0x1f4,_0x4cc9c6[_0xbdca('0x15')]));});});};exports[_0xbdca('0x21')]=function(_0x47dbd2){var _0x230f32=this;return new Promise(function(_0x1998d8,_0x1e21c5){return db[_0xbdca('0x22')][_0xbdca('0x23')]({'raw':_0x47dbd2[_0xbdca('0x19')]?_0x47dbd2['options'][_0xbdca('0x1a')]===undefined?!![]:![]:!![],'where':_0x47dbd2['options']?_0x47dbd2[_0xbdca('0x19')][_0xbdca('0x1b')]||null:null,'attributes':_0x47dbd2[_0xbdca('0x19')]?_0x47dbd2[_0xbdca('0x19')][_0xbdca('0x1c')]||null:null,'include':_0x47dbd2[_0xbdca('0x19')]?_0x47dbd2[_0xbdca('0x19')][_0xbdca('0x1d')]?_['map'](_0x47dbd2['options'][_0xbdca('0x1d')],function(_0xe2b451){return{'model':db[_0xe2b451[_0xbdca('0x1e')]],'as':_0xe2b451['as'],'attributes':_0xe2b451['attributes'],'include':_0xe2b451[_0xbdca('0x1d')]?_[_0xbdca('0x1f')](_0xe2b451['include'],function(_0x51648c){return{'model':db[_0x51648c[_0xbdca('0x1e')]],'as':_0x51648c['as'],'attributes':_0x51648c[_0xbdca('0x1c')],'include':_0x51648c['include']?_[_0xbdca('0x1f')](_0x51648c[_0xbdca('0x1d')],function(_0x5a65a0){return{'model':db[_0x5a65a0[_0xbdca('0x1e')]],'as':_0x5a65a0['as'],'attributes':_0x5a65a0[_0xbdca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbdca('0xc')](function(_0x11e109){logger[_0xbdca('0xd')](_0xbdca('0x21'),_0x47dbd2);logger['debug'](_0xbdca('0x21'),_0x47dbd2,JSON[_0xbdca('0x12')](_0x11e109));_0x1998d8(_0x11e109);})[_0xbdca('0x17')](function(_0x3bf4d6){logger[_0xbdca('0x13')]('ShowFreshdeskAccount',_0x3bf4d6[_0xbdca('0x15')],_0x47dbd2);_0x1e21c5(_0x230f32[_0xbdca('0x13')](0x1f4,_0x3bf4d6[_0xbdca('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 3e57924..377abd1 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 _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 +var _0x8922=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x8922,0x158));var _0x2892=function(_0x4c85c0,_0x30262f){_0x4c85c0=_0x4c85c0-0x0;var _0x170238=_0x8922[_0x4c85c0];return _0x170238;};'use strict';var multer=require(_0x2892('0x0'));var util=require(_0x2892('0x1'));var path=require(_0x2892('0x2'));var timeout=require(_0x2892('0x3'));var express=require(_0x2892('0x4'));var router=express[_0x2892('0x5')]();var fs_extra=require(_0x2892('0x6'));var auth=require(_0x2892('0x7'));var interaction=require(_0x2892('0x8'));var config=require(_0x2892('0x9'));var controller=require(_0x2892('0xa'));router[_0x2892('0xb')]('/',auth[_0x2892('0xc')](),controller['index']);router[_0x2892('0xb')](_0x2892('0xd'),auth[_0x2892('0xc')](),controller[_0x2892('0xe')]);router[_0x2892('0xb')](_0x2892('0xf'),auth[_0x2892('0xc')](),controller[_0x2892('0x10')]);router[_0x2892('0xb')](_0x2892('0x11'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2892('0xb')](_0x2892('0x12'),auth['isAuthenticated'](),controller[_0x2892('0x13')]);router[_0x2892('0xb')](_0x2892('0x14'),auth[_0x2892('0xc')](),controller['getTags']);router[_0x2892('0x15')]('/',auth[_0x2892('0xc')](),controller[_0x2892('0x16')]);router[_0x2892('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0x2892('0x17')]);router[_0x2892('0x18')]('/:id',auth[_0x2892('0xc')](),controller[_0x2892('0x19')]);router[_0x2892('0x1a')](_0x2892('0xd'),auth[_0x2892('0xc')](),controller[_0x2892('0x1b')]);module[_0x2892('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 8b31aad..0333994 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 _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 +var _0x657a=['exports','STRING','sequelize'];(function(_0x5b09d4,_0x438d56){var _0x2d88d7=function(_0x45c207){while(--_0x45c207){_0x5b09d4['push'](_0x5b09d4['shift']());}};_0x2d88d7(++_0x438d56);}(_0x657a,0x188));var _0xa657=function(_0x503679,_0x1d99bf){_0x503679=_0x503679-0x0;var _0x2c6c2b=_0x657a[_0x503679];return _0x2c6c2b;};'use strict';var Sequelize=require(_0xa657('0x0'));module[_0xa657('0x1')]={'name':{'type':Sequelize[_0xa657('0x2')]},'description':{'type':Sequelize[_0xa657('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 2c4be16..3c053e7 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 _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 +var _0x8dac=['keys','FreshdeskConfiguration','length','find','create','update','body','getFields','findOne','FreshdeskField','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','findAll','rows','catch','params'];(function(_0x31b017,_0x103067){var _0x2c327a=function(_0x4e21c6){while(--_0x4e21c6){_0x31b017['push'](_0x31b017['shift']());}};_0x2c327a(++_0x103067);}(_0x8dac,0x103));var _0xc8da=function(_0x4272d8,_0x3435d5){_0x4272d8=_0x4272d8-0x0;var _0x15f27c=_0x8dac[_0x4272d8];return _0x15f27c;};'use strict';var emlformat=require(_0xc8da('0x0'));var rimraf=require(_0xc8da('0x1'));var zipdir=require(_0xc8da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8da('0x3'));var moment=require('moment');var BPromise=require(_0xc8da('0x4'));var Mustache=require(_0xc8da('0x5'));var util=require('util');var path=require(_0xc8da('0x6'));var sox=require(_0xc8da('0x7'));var csv=require(_0xc8da('0x8'));var ejs=require(_0xc8da('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8da('0xa'));var squel=require('squel');var crypto=require(_0xc8da('0xb'));var jsforce=require(_0xc8da('0xc'));var deskjs=require(_0xc8da('0xd'));var toCsv=require(_0xc8da('0x8'));var querystring=require(_0xc8da('0xe'));var Papa=require(_0xc8da('0xf'));var Redis=require(_0xc8da('0x10'));var authService=require(_0xc8da('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc8da('0x12'));var hardwareService=require(_0xc8da('0x13'));var logger=require(_0xc8da('0x14'))(_0xc8da('0x15'));var utils=require(_0xc8da('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc8da('0x17'));var db=require(_0xc8da('0x18'))['db'];function respondWithStatusCode(_0x1f44ab,_0x3dbe84){_0x3dbe84=_0x3dbe84||0xcc;return function(_0x4ea396){if(_0x4ea396){return _0x1f44ab[_0xc8da('0x19')](_0x3dbe84);}return _0x1f44ab[_0xc8da('0x1a')](_0x3dbe84)['end']();};}function respondWithResult(_0x1f2101,_0x465ded){_0x465ded=_0x465ded||0xc8;return function(_0x31e73f){if(_0x31e73f){return _0x1f2101[_0xc8da('0x1a')](_0x465ded)['json'](_0x31e73f);}};}function respondWithFilteredResult(_0x1f2468,_0x2af20b){return function(_0xa7fd4f){if(_0xa7fd4f){var _0x24fc5c=typeof _0x2af20b[_0xc8da('0x1b')]==='undefined'&&typeof _0x2af20b[_0xc8da('0x1c')]===_0xc8da('0x1d');var _0x5c9a1e=_0xa7fd4f[_0xc8da('0x1e')];var _0x4c2742=_0x24fc5c?0x0:_0x2af20b[_0xc8da('0x1b')];var _0x381bc5=_0x24fc5c?_0xa7fd4f[_0xc8da('0x1e')]:_0x2af20b[_0xc8da('0x1b')]+_0x2af20b[_0xc8da('0x1c')];var _0x377eab;if(_0x381bc5>=_0x5c9a1e){_0x381bc5=_0x5c9a1e;_0x377eab=0xc8;}else{_0x377eab=0xce;}_0x1f2468['status'](_0x377eab);return _0x1f2468[_0xc8da('0x1f')](_0xc8da('0x20'),_0x4c2742+'-'+_0x381bc5+'/'+_0x5c9a1e)['json'](_0xa7fd4f);}return null;};}function patchUpdates(_0x2d7476){return function(_0x4e1c93){try{jsonpatch['apply'](_0x4e1c93,_0x2d7476,!![]);}catch(_0x129957){return BPromise['reject'](_0x129957);}return _0x4e1c93[_0xc8da('0x21')]();};}function saveUpdates(_0x89a19f,_0x28a0f8){return function(_0x5af9d7){if(_0x5af9d7){return _0x5af9d7['update'](_0x89a19f)[_0xc8da('0x22')](function(_0x386b9f){return _0x386b9f;});}return null;};}function removeEntity(_0x253da8,_0x3a8dde){return function(_0x12d69f){if(_0x12d69f){return _0x12d69f[_0xc8da('0x23')]()['then'](function(){_0x253da8[_0xc8da('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e1f81,_0x9a4b1d){return function(_0x239562){if(!_0x239562){_0x2e1f81[_0xc8da('0x19')](0x194);}return _0x239562;};}function handleError(_0x2ab00c,_0x1e6e20){_0x1e6e20=_0x1e6e20||0x1f4;return function(_0x42af2f){logger[_0xc8da('0x24')](_0x42af2f[_0xc8da('0x25')]);if(_0x42af2f['name']){delete _0x42af2f[_0xc8da('0x26')];}_0x2ab00c[_0xc8da('0x1a')](_0x1e6e20)[_0xc8da('0x27')](_0x42af2f);};}exports[_0xc8da('0x28')]=function(_0x1871a5,_0x190120){var _0x2f0c05={},_0x484fb8={},_0x4e901d={'count':0x0,'rows':[]};var _0x37c52a=_[_0xc8da('0x29')](db['FreshdeskConfiguration'][_0xc8da('0x2a')],function(_0x48686f){return{'name':_0x48686f[_0xc8da('0x2b')],'type':_0x48686f[_0xc8da('0x2c')]['key']};});_0x484fb8[_0xc8da('0x2d')]=_[_0xc8da('0x29')](_0x37c52a,_0xc8da('0x26'));_0x484fb8[_0xc8da('0x2e')]=_['keys'](_0x1871a5[_0xc8da('0x2e')]);_0x484fb8['filters']=_['intersection'](_0x484fb8['model'],_0x484fb8[_0xc8da('0x2e')]);_0x2f0c05['attributes']=_[_0xc8da('0x2f')](_0x484fb8[_0xc8da('0x2d')],qs[_0xc8da('0x30')](_0x1871a5[_0xc8da('0x2e')]['fields']));_0x2f0c05[_0xc8da('0x31')]=_0x2f0c05['attributes']['length']?_0x2f0c05[_0xc8da('0x31')]:_0x484fb8[_0xc8da('0x2d')];if(!_0x1871a5[_0xc8da('0x2e')][_0xc8da('0x32')](_0xc8da('0x33'))){_0x2f0c05[_0xc8da('0x1c')]=qs[_0xc8da('0x1c')](_0x1871a5[_0xc8da('0x2e')][_0xc8da('0x1c')]);_0x2f0c05[_0xc8da('0x1b')]=qs['offset'](_0x1871a5['query'][_0xc8da('0x1b')]);}_0x2f0c05[_0xc8da('0x34')]=qs['sort'](_0x1871a5[_0xc8da('0x2e')][_0xc8da('0x35')]);_0x2f0c05[_0xc8da('0x36')]=qs[_0xc8da('0x37')](_['pick'](_0x1871a5[_0xc8da('0x2e')],_0x484fb8[_0xc8da('0x37')]),_0x37c52a);if(_0x1871a5['query']['filter']){_0x2f0c05[_0xc8da('0x36')]=_[_0xc8da('0x38')](_0x2f0c05[_0xc8da('0x36')],{'$or':_['map'](_0x37c52a,function(_0x10befe){if(_0x10befe[_0xc8da('0x2c')]!=='VIRTUAL'){var _0x60aeb9={};_0x60aeb9[_0x10befe[_0xc8da('0x26')]]={'$like':'%'+_0x1871a5[_0xc8da('0x2e')][_0xc8da('0x39')]+'%'};return _0x60aeb9;}})});}_0x2f0c05=_[_0xc8da('0x38')]({},_0x2f0c05,_0x1871a5[_0xc8da('0x3a')]);var _0x49545f={'where':_0x2f0c05[_0xc8da('0x36')]};return db['FreshdeskConfiguration'][_0xc8da('0x1e')](_0x49545f)[_0xc8da('0x22')](function(_0x3b422){_0x4e901d[_0xc8da('0x1e')]=_0x3b422;if(_0x1871a5[_0xc8da('0x2e')][_0xc8da('0x3b')]){_0x2f0c05[_0xc8da('0x3c')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xc8da('0x3d')](_0x2f0c05);})[_0xc8da('0x22')](function(_0x4f3a36){_0x4e901d[_0xc8da('0x3e')]=_0x4f3a36;return _0x4e901d;})['then'](respondWithFilteredResult(_0x190120,_0x2f0c05))[_0xc8da('0x3f')](handleError(_0x190120,null));};exports['show']=function(_0x4e4cc6,_0x30be00){var _0x817518={'raw':![],'where':{'id':_0x4e4cc6[_0xc8da('0x40')]['id']}},_0x48fa2e={};_0x48fa2e['model']=_[_0xc8da('0x41')](db[_0xc8da('0x42')][_0xc8da('0x2a')]);_0x48fa2e[_0xc8da('0x2e')]=_[_0xc8da('0x41')](_0x4e4cc6[_0xc8da('0x2e')]);_0x48fa2e[_0xc8da('0x37')]=_[_0xc8da('0x2f')](_0x48fa2e[_0xc8da('0x2d')],_0x48fa2e[_0xc8da('0x2e')]);_0x817518[_0xc8da('0x31')]=_[_0xc8da('0x2f')](_0x48fa2e[_0xc8da('0x2d')],qs[_0xc8da('0x30')](_0x4e4cc6[_0xc8da('0x2e')][_0xc8da('0x30')]));_0x817518[_0xc8da('0x31')]=_0x817518[_0xc8da('0x31')][_0xc8da('0x43')]?_0x817518[_0xc8da('0x31')]:_0x48fa2e[_0xc8da('0x2d')];if(_0x4e4cc6[_0xc8da('0x2e')][_0xc8da('0x3b')]){_0x817518[_0xc8da('0x3c')]=[{'all':!![]}];}_0x817518=_[_0xc8da('0x38')]({},_0x817518,_0x4e4cc6['options']);return db[_0xc8da('0x42')][_0xc8da('0x44')](_0x817518)[_0xc8da('0x22')](handleEntityNotFound(_0x30be00,null))['then'](respondWithResult(_0x30be00,null))['catch'](handleError(_0x30be00,null));};exports[_0xc8da('0x45')]=function(_0x3e9fba,_0xb2776b){return db[_0xc8da('0x42')][_0xc8da('0x45')](_0x3e9fba['body'],{})['then'](respondWithResult(_0xb2776b,0xc9))['catch'](handleError(_0xb2776b,null));};exports[_0xc8da('0x46')]=function(_0x1e1457,_0x3abe8f){if(_0x1e1457['body']['id']){delete _0x1e1457[_0xc8da('0x47')]['id'];}return db[_0xc8da('0x42')][_0xc8da('0x44')]({'where':{'id':_0x1e1457[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0x3abe8f,null))[_0xc8da('0x22')](saveUpdates(_0x1e1457[_0xc8da('0x47')],null))[_0xc8da('0x22')](respondWithResult(_0x3abe8f,null))[_0xc8da('0x3f')](handleError(_0x3abe8f,null));};exports[_0xc8da('0x23')]=function(_0x1de509,_0x4edde6){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1de509[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0x4edde6,null))['then'](removeEntity(_0x4edde6,null))[_0xc8da('0x3f')](handleError(_0x4edde6,null));};exports[_0xc8da('0x48')]=function(_0x231e97,_0x227980,_0x5ac56f){var _0x589389={};var _0x385461={};var _0x56c081;var _0x31d165;return db[_0xc8da('0x42')][_0xc8da('0x49')]({'where':{'id':_0x231e97[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0x227980,null))[_0xc8da('0x22')](function(_0x496c64){if(_0x496c64){_0x56c081=_0x496c64;_0x385461[_0xc8da('0x2d')]=_[_0xc8da('0x41')](db[_0xc8da('0x4a')][_0xc8da('0x2a')]);_0x385461[_0xc8da('0x2e')]=_['keys'](_0x231e97['query']);_0x385461['filters']=_['intersection'](_0x385461['model'],_0x385461[_0xc8da('0x2e')]);_0x589389['attributes']=_[_0xc8da('0x2f')](_0x385461[_0xc8da('0x2d')],qs['fields'](_0x231e97['query']['fields']));_0x589389[_0xc8da('0x31')]=_0x589389['attributes'][_0xc8da('0x43')]?_0x589389[_0xc8da('0x31')]:_0x385461[_0xc8da('0x2d')];_0x589389[_0xc8da('0x34')]=qs['sort'](_0x231e97[_0xc8da('0x2e')][_0xc8da('0x35')]);_0x589389[_0xc8da('0x36')]=qs['filters'](_['pick'](_0x231e97['query'],_0x385461[_0xc8da('0x37')]));if(_0x231e97[_0xc8da('0x2e')][_0xc8da('0x39')]){_0x589389[_0xc8da('0x36')]=_[_0xc8da('0x38')](_0x589389[_0xc8da('0x36')],{'$or':_[_0xc8da('0x29')](_0x589389['attributes'],function(_0x1d1cbd){var _0x36e609={};_0x36e609[_0x1d1cbd]={'$like':'%'+_0x231e97['query']['filter']+'%'};return _0x36e609;})});}_0x589389=_['merge']({},_0x589389,_0x231e97['options']);return _0x56c081['getFields'](_0x589389);}})[_0xc8da('0x22')](function(_0x5bd23c){if(_0x5bd23c){_0x31d165=_0x5bd23c[_0xc8da('0x43')];if(!_0x231e97[_0xc8da('0x2e')][_0xc8da('0x32')](_0xc8da('0x33'))){_0x589389[_0xc8da('0x1c')]=qs[_0xc8da('0x1c')](_0x231e97[_0xc8da('0x2e')][_0xc8da('0x1c')]);_0x589389[_0xc8da('0x1b')]=qs[_0xc8da('0x1b')](_0x231e97['query'][_0xc8da('0x1b')]);}return _0x56c081['getFields'](_0x589389);}})['then'](function(_0x19deb){if(_0x19deb){return _0x19deb?{'count':_0x31d165,'rows':_0x19deb}:null;}})[_0xc8da('0x22')](respondWithResult(_0x227980,null))['catch'](handleError(_0x227980,null));};exports['getSubjects']=function(_0x24a888,_0x5314f3,_0x147d9f){var _0x5a46d0={};var _0x423c0e={};var _0x353c60;var _0x5a88a3;return db['FreshdeskConfiguration'][_0xc8da('0x49')]({'where':{'id':_0x24a888[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0x5314f3,null))[_0xc8da('0x22')](function(_0x8a25be){if(_0x8a25be){_0x353c60=_0x8a25be;_0x423c0e[_0xc8da('0x2d')]=_[_0xc8da('0x41')](db[_0xc8da('0x4a')]['rawAttributes']);_0x423c0e[_0xc8da('0x2e')]=_[_0xc8da('0x41')](_0x24a888[_0xc8da('0x2e')]);_0x423c0e['filters']=_[_0xc8da('0x2f')](_0x423c0e[_0xc8da('0x2d')],_0x423c0e['query']);_0x5a46d0[_0xc8da('0x31')]=_[_0xc8da('0x2f')](_0x423c0e[_0xc8da('0x2d')],qs[_0xc8da('0x30')](_0x24a888['query'][_0xc8da('0x30')]));_0x5a46d0[_0xc8da('0x31')]=_0x5a46d0[_0xc8da('0x31')][_0xc8da('0x43')]?_0x5a46d0[_0xc8da('0x31')]:_0x423c0e[_0xc8da('0x2d')];_0x5a46d0[_0xc8da('0x34')]=qs['sort'](_0x24a888[_0xc8da('0x2e')][_0xc8da('0x35')]);_0x5a46d0[_0xc8da('0x36')]=qs[_0xc8da('0x37')](_[_0xc8da('0x4b')](_0x24a888[_0xc8da('0x2e')],_0x423c0e[_0xc8da('0x37')]));if(_0x24a888[_0xc8da('0x2e')]['filter']){_0x5a46d0['where']=_[_0xc8da('0x38')](_0x5a46d0[_0xc8da('0x36')],{'$or':_[_0xc8da('0x29')](_0x5a46d0[_0xc8da('0x31')],function(_0xb60dda){var _0x65c89d={};_0x65c89d[_0xb60dda]={'$like':'%'+_0x24a888[_0xc8da('0x2e')][_0xc8da('0x39')]+'%'};return _0x65c89d;})});}_0x5a46d0=_[_0xc8da('0x38')]({},_0x5a46d0,_0x24a888[_0xc8da('0x3a')]);return _0x353c60[_0xc8da('0x4c')](_0x5a46d0);}})[_0xc8da('0x22')](function(_0x1e5b84){if(_0x1e5b84){_0x5a88a3=_0x1e5b84[_0xc8da('0x43')];if(!_0x24a888['query'][_0xc8da('0x32')](_0xc8da('0x33'))){_0x5a46d0[_0xc8da('0x1c')]=qs[_0xc8da('0x1c')](_0x24a888[_0xc8da('0x2e')]['limit']);_0x5a46d0[_0xc8da('0x1b')]=qs[_0xc8da('0x1b')](_0x24a888['query'][_0xc8da('0x1b')]);}return _0x353c60[_0xc8da('0x4c')](_0x5a46d0);}})[_0xc8da('0x22')](function(_0x4a00d4){if(_0x4a00d4){return _0x4a00d4?{'count':_0x5a88a3,'rows':_0x4a00d4}:null;}})[_0xc8da('0x22')](respondWithResult(_0x5314f3,null))[_0xc8da('0x3f')](handleError(_0x5314f3,null));};exports[_0xc8da('0x4d')]=function(_0x23a878,_0xa0a9e0,_0x3cc6e4){var _0x40707f={};var _0x51be4d={};var _0x27afb0;var _0x33f19b;return db[_0xc8da('0x42')][_0xc8da('0x49')]({'where':{'id':_0x23a878[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0xa0a9e0,null))[_0xc8da('0x22')](function(_0x5a4753){if(_0x5a4753){_0x27afb0=_0x5a4753;_0x51be4d['model']=_[_0xc8da('0x41')](db[_0xc8da('0x4a')][_0xc8da('0x2a')]);_0x51be4d[_0xc8da('0x2e')]=_[_0xc8da('0x41')](_0x23a878[_0xc8da('0x2e')]);_0x51be4d['filters']=_[_0xc8da('0x2f')](_0x51be4d[_0xc8da('0x2d')],_0x51be4d[_0xc8da('0x2e')]);_0x40707f['attributes']=_[_0xc8da('0x2f')](_0x51be4d[_0xc8da('0x2d')],qs['fields'](_0x23a878[_0xc8da('0x2e')]['fields']));_0x40707f[_0xc8da('0x31')]=_0x40707f['attributes'][_0xc8da('0x43')]?_0x40707f[_0xc8da('0x31')]:_0x51be4d['model'];_0x40707f['order']=qs[_0xc8da('0x35')](_0x23a878[_0xc8da('0x2e')][_0xc8da('0x35')]);_0x40707f['where']=qs[_0xc8da('0x37')](_[_0xc8da('0x4b')](_0x23a878[_0xc8da('0x2e')],_0x51be4d[_0xc8da('0x37')]));if(_0x23a878[_0xc8da('0x2e')]['filter']){_0x40707f[_0xc8da('0x36')]=_[_0xc8da('0x38')](_0x40707f[_0xc8da('0x36')],{'$or':_[_0xc8da('0x29')](_0x40707f[_0xc8da('0x31')],function(_0x16fd34){var _0x1f5ff4={};_0x1f5ff4[_0x16fd34]={'$like':'%'+_0x23a878[_0xc8da('0x2e')][_0xc8da('0x39')]+'%'};return _0x1f5ff4;})});}_0x40707f=_[_0xc8da('0x38')]({},_0x40707f,_0x23a878[_0xc8da('0x3a')]);return _0x27afb0[_0xc8da('0x4d')](_0x40707f);}})[_0xc8da('0x22')](function(_0x4f300e){if(_0x4f300e){_0x33f19b=_0x4f300e[_0xc8da('0x43')];if(!_0x23a878['query'][_0xc8da('0x32')]('nolimit')){_0x40707f[_0xc8da('0x1c')]=qs[_0xc8da('0x1c')](_0x23a878[_0xc8da('0x2e')][_0xc8da('0x1c')]);_0x40707f['offset']=qs[_0xc8da('0x1b')](_0x23a878[_0xc8da('0x2e')][_0xc8da('0x1b')]);}return _0x27afb0[_0xc8da('0x4d')](_0x40707f);}})[_0xc8da('0x22')](function(_0x5e13bb){if(_0x5e13bb){return _0x5e13bb?{'count':_0x33f19b,'rows':_0x5e13bb}:null;}})[_0xc8da('0x22')](respondWithResult(_0xa0a9e0,null))[_0xc8da('0x3f')](handleError(_0xa0a9e0,null));};exports['getTags']=function(_0x166c8c,_0x21fa01,_0x5128f6){var _0x37f698={};var _0x484c41={};var _0x36c55f;var _0x1ca3cb;return db['FreshdeskConfiguration'][_0xc8da('0x49')]({'where':{'id':_0x166c8c[_0xc8da('0x40')]['id']}})['then'](handleEntityNotFound(_0x21fa01,null))['then'](function(_0x4950d0){if(_0x4950d0){_0x36c55f=_0x4950d0;_0x484c41[_0xc8da('0x2d')]=_['keys'](db['Tag'][_0xc8da('0x2a')]);_0x484c41[_0xc8da('0x2e')]=_[_0xc8da('0x41')](_0x166c8c['query']);_0x484c41[_0xc8da('0x37')]=_[_0xc8da('0x2f')](_0x484c41[_0xc8da('0x2d')],_0x484c41['query']);_0x37f698['attributes']=_[_0xc8da('0x2f')](_0x484c41[_0xc8da('0x2d')],qs[_0xc8da('0x30')](_0x166c8c[_0xc8da('0x2e')][_0xc8da('0x30')]));_0x37f698['attributes']=_0x37f698[_0xc8da('0x31')][_0xc8da('0x43')]?_0x37f698[_0xc8da('0x31')]:_0x484c41[_0xc8da('0x2d')];_0x37f698[_0xc8da('0x34')]=qs['sort'](_0x166c8c[_0xc8da('0x2e')][_0xc8da('0x35')]);_0x37f698['where']=qs[_0xc8da('0x37')](_[_0xc8da('0x4b')](_0x166c8c[_0xc8da('0x2e')],_0x484c41[_0xc8da('0x37')]));if(_0x166c8c['query'][_0xc8da('0x39')]){_0x37f698[_0xc8da('0x36')]=_[_0xc8da('0x38')](_0x37f698[_0xc8da('0x36')],{'$or':_[_0xc8da('0x29')](_0x37f698['attributes'],function(_0x18d72a){var _0xfd2a24={};_0xfd2a24[_0x18d72a]={'$like':'%'+_0x166c8c['query'][_0xc8da('0x39')]+'%'};return _0xfd2a24;})});}_0x37f698=_[_0xc8da('0x38')]({},_0x37f698,_0x166c8c[_0xc8da('0x3a')]);return _0x36c55f['getTags'](_0x37f698);}})[_0xc8da('0x22')](function(_0x5d38c4){if(_0x5d38c4){_0x1ca3cb=_0x5d38c4[_0xc8da('0x43')];if(!_0x166c8c['query'][_0xc8da('0x32')](_0xc8da('0x33'))){_0x37f698[_0xc8da('0x1c')]=qs['limit'](_0x166c8c[_0xc8da('0x2e')][_0xc8da('0x1c')]);_0x37f698[_0xc8da('0x1b')]=qs[_0xc8da('0x1b')](_0x166c8c[_0xc8da('0x2e')][_0xc8da('0x1b')]);}return _0x36c55f[_0xc8da('0x4e')](_0x37f698);}})[_0xc8da('0x22')](function(_0xf14f99){if(_0xf14f99){return _0xf14f99?{'count':_0x1ca3cb,'rows':_0xf14f99}:null;}})[_0xc8da('0x22')](respondWithResult(_0x21fa01,null))['catch'](handleError(_0x21fa01,null));};exports['setTags']=function(_0x59765a,_0x432e64,_0x7d177f){if(_0x59765a[_0xc8da('0x47')]['id']){delete _0x59765a['body']['id'];}return db[_0xc8da('0x42')][_0xc8da('0x49')]({'where':{'id':_0x59765a[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0x432e64,null))[_0xc8da('0x22')](function(_0x5e6dac){if(_0x5e6dac){return _0x5e6dac[_0xc8da('0x4f')](_0x59765a[_0xc8da('0x47')][_0xc8da('0x50')]||[]);}return null;})[_0xc8da('0x22')](respondWithResult(_0x432e64,null))[_0xc8da('0x3f')](handleError(_0x432e64,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 962382b..42e9732 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 _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 +var _0x6917=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x1153e6,_0x4178fe){var _0x2b9d1c=function(_0x4d66da){while(--_0x4d66da){_0x1153e6['push'](_0x1153e6['shift']());}};_0x2b9d1c(++_0x4178fe);}(_0x6917,0x68));var _0x7691=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x6917[_0x18a436];return _0x5c2cf8;};'use strict';var _=require(_0x7691('0x0'));var util=require('util');var logger=require(_0x7691('0x1'))(_0x7691('0x2'));var moment=require(_0x7691('0x3'));var BPromise=require(_0x7691('0x4'));var rp=require(_0x7691('0x5'));var fs=require('fs');var path=require(_0x7691('0x6'));var rimraf=require(_0x7691('0x7'));var config=require(_0x7691('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x7691('0x9')]=function(_0x3b84ba,_0x151ece){return _0x3b84ba[_0x7691('0xa')](_0x7691('0xb'),attributes,{'tableName':_0x7691('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 183549a..cb5cccf 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 _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 +var _0xbd37=['jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xbd37,0x1b0));var _0x7bd3=function(_0x49ffda,_0x45ae69){_0x49ffda=_0x49ffda-0x0;var _0x3960ea=_0xbd37[_0x49ffda];return _0x3960ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7bd3('0x0'));var BPromise=require(_0x7bd3('0x1'));var rs=require(_0x7bd3('0x2'));var fs=require('fs');var Redis=require(_0x7bd3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bd3('0x4'));var logger=require(_0x7bd3('0x5'))(_0x7bd3('0x6'));var config=require(_0x7bd3('0x7'));var jayson=require(_0x7bd3('0x8'));var client=jayson['client'][_0x7bd3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x564c74,_0x2b4c68,_0x683073){return new BPromise(function(_0x8414d9,_0x527a99){return client['request'](_0x564c74,_0x683073)[_0x7bd3('0xa')](function(_0x25a8a5){logger[_0x7bd3('0xb')](_0x7bd3('0xc'),_0x2b4c68,'request\x20sent');logger[_0x7bd3('0xd')](_0x7bd3('0xe'),_0x2b4c68,_0x7bd3('0xf'),JSON[_0x7bd3('0x10')](_0x25a8a5));if(_0x25a8a5[_0x7bd3('0x11')]){if(_0x25a8a5[_0x7bd3('0x11')][_0x7bd3('0x12')]===0x1f4){logger[_0x7bd3('0x11')](_0x7bd3('0xc'),_0x2b4c68,_0x25a8a5[_0x7bd3('0x11')][_0x7bd3('0x13')]);return _0x527a99(_0x25a8a5[_0x7bd3('0x11')]['message']);}logger[_0x7bd3('0x11')](_0x7bd3('0xc'),_0x2b4c68,_0x25a8a5[_0x7bd3('0x11')][_0x7bd3('0x13')]);return _0x8414d9(_0x25a8a5[_0x7bd3('0x11')][_0x7bd3('0x13')]);}else{logger[_0x7bd3('0xb')](_0x7bd3('0xc'),_0x2b4c68,'request\x20sent');_0x8414d9(_0x25a8a5[_0x7bd3('0x14')][_0x7bd3('0x13')]);}})[_0x7bd3('0x15')](function(_0x3da56d){logger[_0x7bd3('0x11')](_0x7bd3('0xc'),_0x2b4c68,_0x3da56d);_0x527a99(_0x3da56d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 915add9..d3dc069 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 _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 +var _0xe20b=['delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','post','create','put','update'];(function(_0x5c9397,_0xe6bc88){var _0x194baf=function(_0x50d093){while(--_0x50d093){_0x5c9397['push'](_0x5c9397['shift']());}};_0x194baf(++_0xe6bc88);}(_0xe20b,0x13e));var _0xbe20=function(_0x5a6fc4,_0x5f47f6){_0x5a6fc4=_0x5a6fc4-0x0;var _0x4cee09=_0xe20b[_0x5a6fc4];return _0x4cee09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbe20('0x0'));var timeout=require(_0xbe20('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbe20('0x2'));var auth=require(_0xbe20('0x3'));var interaction=require(_0xbe20('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0xbe20('0x5')](),controller['index']);router[_0xbe20('0x6')](_0xbe20('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xbe20('0x8')]('/',auth[_0xbe20('0x5')](),controller[_0xbe20('0x9')]);router[_0xbe20('0xa')](_0xbe20('0x7'),auth['isAuthenticated'](),controller[_0xbe20('0xb')]);router[_0xbe20('0xc')]('/:id',auth[_0xbe20('0x5')](),controller[_0xbe20('0xd')]);module[_0xbe20('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 3691e8d..48cf311 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 _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 +var _0xca27=['STRING','sequelize','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca27,0x89));var _0x7ca2=function(_0x498acc,_0x3fab56){_0x498acc=_0x498acc-0x0;var _0x125b22=_0xca27[_0x498acc];return _0x125b22;};'use strict';var Sequelize=require(_0x7ca2('0x0'));module['exports']={'type':{'type':Sequelize[_0x7ca2('0x1')]('string',_0x7ca2('0x2'),_0x7ca2('0x3'),_0x7ca2('0x4'),_0x7ca2('0x5')),'defaultValue':_0x7ca2('0x6')},'content':{'type':Sequelize[_0x7ca2('0x7')]},'key':{'type':Sequelize[_0x7ca2('0x7')]},'keyType':{'type':Sequelize[_0x7ca2('0x1')](_0x7ca2('0x6'),_0x7ca2('0x2'),_0x7ca2('0x3'))},'keyContent':{'type':Sequelize[_0x7ca2('0x7')]},'idField':{'type':Sequelize[_0x7ca2('0x7')]},'nameField':{'type':Sequelize[_0x7ca2('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ca2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index aff99d3..79cd4eb 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 _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 +var _0xa45c=['update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','save'];(function(_0x539902,_0x648798){var _0x55370f=function(_0x1a966d){while(--_0x1a966d){_0x539902['push'](_0x539902['shift']());}};_0x55370f(++_0x648798);}(_0xa45c,0x6d));var _0xca45=function(_0x44ef20,_0xc9a6b1){_0x44ef20=_0x44ef20-0x0;var _0xda501f=_0xa45c[_0x44ef20];return _0xda501f;};'use strict';var emlformat=require(_0xca45('0x0'));var rimraf=require(_0xca45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca45('0x2'));var moment=require('moment');var BPromise=require(_0xca45('0x3'));var Mustache=require('mustache');var util=require(_0xca45('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xca45('0x5'));var ejs=require(_0xca45('0x6'));var fs=require('fs');var fs_extra=require(_0xca45('0x7'));var _=require(_0xca45('0x8'));var squel=require('squel');var crypto=require(_0xca45('0x9'));var jsforce=require(_0xca45('0xa'));var deskjs=require(_0xca45('0xb'));var toCsv=require(_0xca45('0x5'));var querystring=require(_0xca45('0xc'));var Papa=require('papaparse');var Redis=require(_0xca45('0xd'));var authService=require(_0xca45('0xe'));var qs=require(_0xca45('0xf'));var as=require(_0xca45('0x10'));var hardwareService=require(_0xca45('0x11'));var logger=require(_0xca45('0x12'))(_0xca45('0x13'));var utils=require('../../config/utils');var config=require(_0xca45('0x14'));var licenseUtil=require(_0xca45('0x15'));var db=require(_0xca45('0x16'))['db'];function respondWithStatusCode(_0x17ebf7,_0x580c43){_0x580c43=_0x580c43||0xcc;return function(_0x3044b1){if(_0x3044b1){return _0x17ebf7[_0xca45('0x17')](_0x580c43);}return _0x17ebf7[_0xca45('0x18')](_0x580c43)['end']();};}function respondWithResult(_0x214939,_0x569ba6){_0x569ba6=_0x569ba6||0xc8;return function(_0x22ce19){if(_0x22ce19){return _0x214939[_0xca45('0x18')](_0x569ba6)[_0xca45('0x19')](_0x22ce19);}};}function respondWithFilteredResult(_0x1c822d,_0x35b130){return function(_0x323b19){if(_0x323b19){var _0x18dd61=typeof _0x35b130['offset']===_0xca45('0x1a')&&typeof _0x35b130['limit']==='undefined';var _0x213986=_0x323b19[_0xca45('0x1b')];var _0x553af4=_0x18dd61?0x0:_0x35b130[_0xca45('0x1c')];var _0x184bbf=_0x18dd61?_0x323b19['count']:_0x35b130[_0xca45('0x1c')]+_0x35b130[_0xca45('0x1d')];var _0x446243;if(_0x184bbf>=_0x213986){_0x184bbf=_0x213986;_0x446243=0xc8;}else{_0x446243=0xce;}_0x1c822d[_0xca45('0x18')](_0x446243);return _0x1c822d['set'](_0xca45('0x1e'),_0x553af4+'-'+_0x184bbf+'/'+_0x213986)[_0xca45('0x19')](_0x323b19);}return null;};}function patchUpdates(_0x1a16f1){return function(_0xdea7de){try{jsonpatch['apply'](_0xdea7de,_0x1a16f1,!![]);}catch(_0x2c0a39){return BPromise[_0xca45('0x1f')](_0x2c0a39);}return _0xdea7de[_0xca45('0x20')]();};}function saveUpdates(_0x34bb8d,_0x2068df){return function(_0x3e8068){if(_0x3e8068){return _0x3e8068[_0xca45('0x21')](_0x34bb8d)[_0xca45('0x22')](function(_0x14cd25){return _0x14cd25;});}return null;};}function removeEntity(_0x4998b5,_0x3d9007){return function(_0x1acb89){if(_0x1acb89){return _0x1acb89[_0xca45('0x23')]()[_0xca45('0x22')](function(){_0x4998b5[_0xca45('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5927e2,_0x4d4869){return function(_0x28d9f1){if(!_0x28d9f1){_0x5927e2['sendStatus'](0x194);}return _0x28d9f1;};}function handleError(_0x5c36c7,_0x3547cd){_0x3547cd=_0x3547cd||0x1f4;return function(_0x3e3b03){logger[_0xca45('0x24')](_0x3e3b03[_0xca45('0x25')]);if(_0x3e3b03[_0xca45('0x26')]){delete _0x3e3b03['name'];}_0x5c36c7[_0xca45('0x18')](_0x3547cd)[_0xca45('0x27')](_0x3e3b03);};}exports[_0xca45('0x28')]=function(_0x4d546c,_0x4da9b6){var _0x592ad2={},_0x430591={},_0x2e51b1={'count':0x0,'rows':[]};var _0x5cb991=_[_0xca45('0x29')](db[_0xca45('0x2a')][_0xca45('0x2b')],function(_0x3e1693){return{'name':_0x3e1693['fieldName'],'type':_0x3e1693['type']['key']};});_0x430591[_0xca45('0x2c')]=_['map'](_0x5cb991,'name');_0x430591['query']=_[_0xca45('0x2d')](_0x4d546c['query']);_0x430591['filters']=_[_0xca45('0x2e')](_0x430591[_0xca45('0x2c')],_0x430591[_0xca45('0x2f')]);_0x592ad2['attributes']=_[_0xca45('0x2e')](_0x430591[_0xca45('0x2c')],qs['fields'](_0x4d546c[_0xca45('0x2f')][_0xca45('0x30')]));_0x592ad2[_0xca45('0x31')]=_0x592ad2[_0xca45('0x31')][_0xca45('0x32')]?_0x592ad2[_0xca45('0x31')]:_0x430591[_0xca45('0x2c')];if(!_0x4d546c[_0xca45('0x2f')][_0xca45('0x33')](_0xca45('0x34'))){_0x592ad2[_0xca45('0x1d')]=qs[_0xca45('0x1d')](_0x4d546c[_0xca45('0x2f')]['limit']);_0x592ad2['offset']=qs['offset'](_0x4d546c[_0xca45('0x2f')][_0xca45('0x1c')]);}_0x592ad2['order']=qs['sort'](_0x4d546c[_0xca45('0x2f')]['sort']);_0x592ad2[_0xca45('0x35')]=qs['filters'](_[_0xca45('0x36')](_0x4d546c[_0xca45('0x2f')],_0x430591[_0xca45('0x37')]),_0x5cb991);if(_0x4d546c[_0xca45('0x2f')][_0xca45('0x38')]){_0x592ad2['where']=_[_0xca45('0x39')](_0x592ad2['where'],{'$or':_[_0xca45('0x29')](_0x5cb991,function(_0x370e8b){if(_0x370e8b[_0xca45('0x3a')]!==_0xca45('0x3b')){var _0x4e9b06={};_0x4e9b06[_0x370e8b[_0xca45('0x26')]]={'$like':'%'+_0x4d546c[_0xca45('0x2f')][_0xca45('0x38')]+'%'};return _0x4e9b06;}})});}_0x592ad2=_['merge']({},_0x592ad2,_0x4d546c['options']);var _0x39a76a={'where':_0x592ad2[_0xca45('0x35')]};return db[_0xca45('0x2a')][_0xca45('0x1b')](_0x39a76a)[_0xca45('0x22')](function(_0x27317f){_0x2e51b1[_0xca45('0x1b')]=_0x27317f;if(_0x4d546c[_0xca45('0x2f')][_0xca45('0x3c')]){_0x592ad2[_0xca45('0x3d')]=[{'all':!![]}];}return db[_0xca45('0x2a')][_0xca45('0x3e')](_0x592ad2);})[_0xca45('0x22')](function(_0x44a60a){_0x2e51b1[_0xca45('0x3f')]=_0x44a60a;return _0x2e51b1;})[_0xca45('0x22')](respondWithFilteredResult(_0x4da9b6,_0x592ad2))[_0xca45('0x40')](handleError(_0x4da9b6,null));};exports[_0xca45('0x41')]=function(_0x4788b1,_0x266a05){var _0x3273e8={'raw':!![],'where':{'id':_0x4788b1['params']['id']}},_0x2ae7a2={};_0x2ae7a2[_0xca45('0x2c')]=_[_0xca45('0x2d')](db[_0xca45('0x2a')][_0xca45('0x2b')]);_0x2ae7a2['query']=_[_0xca45('0x2d')](_0x4788b1[_0xca45('0x2f')]);_0x2ae7a2[_0xca45('0x37')]=_[_0xca45('0x2e')](_0x2ae7a2[_0xca45('0x2c')],_0x2ae7a2[_0xca45('0x2f')]);_0x3273e8[_0xca45('0x31')]=_[_0xca45('0x2e')](_0x2ae7a2[_0xca45('0x2c')],qs[_0xca45('0x30')](_0x4788b1[_0xca45('0x2f')][_0xca45('0x30')]));_0x3273e8[_0xca45('0x31')]=_0x3273e8[_0xca45('0x31')][_0xca45('0x32')]?_0x3273e8[_0xca45('0x31')]:_0x2ae7a2[_0xca45('0x2c')];if(_0x4788b1[_0xca45('0x2f')][_0xca45('0x3c')]){_0x3273e8['include']=[{'all':!![]}];}_0x3273e8=_[_0xca45('0x39')]({},_0x3273e8,_0x4788b1[_0xca45('0x42')]);return db[_0xca45('0x2a')][_0xca45('0x43')](_0x3273e8)[_0xca45('0x22')](handleEntityNotFound(_0x266a05,null))[_0xca45('0x22')](respondWithResult(_0x266a05,null))[_0xca45('0x40')](handleError(_0x266a05,null));};exports[_0xca45('0x44')]=function(_0x28516f,_0x427bf5){return db[_0xca45('0x2a')][_0xca45('0x44')](_0x28516f[_0xca45('0x45')],{})[_0xca45('0x22')](respondWithResult(_0x427bf5,0xc9))['catch'](handleError(_0x427bf5,null));};exports[_0xca45('0x21')]=function(_0x457008,_0x2c6ed1){if(_0x457008[_0xca45('0x45')]['id']){delete _0x457008[_0xca45('0x45')]['id'];}return db[_0xca45('0x2a')][_0xca45('0x43')]({'where':{'id':_0x457008[_0xca45('0x46')]['id']}})[_0xca45('0x22')](handleEntityNotFound(_0x2c6ed1,null))[_0xca45('0x22')](saveUpdates(_0x457008[_0xca45('0x45')],null))['then'](respondWithResult(_0x2c6ed1,null))['catch'](handleError(_0x2c6ed1,null));};exports[_0xca45('0x23')]=function(_0x1b15be,_0x56c0c0){return db[_0xca45('0x2a')][_0xca45('0x43')]({'where':{'id':_0x1b15be[_0xca45('0x46')]['id']}})[_0xca45('0x22')](handleEntityNotFound(_0x56c0c0,null))[_0xca45('0x22')](removeEntity(_0x56c0c0,null))[_0xca45('0x40')](handleError(_0x56c0c0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a16c49a..e9284fb 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 _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 +var _0xfb09=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes'];(function(_0x47d110,_0x5a3020){var _0xa8e9f1=function(_0x5d899d){while(--_0x5d899d){_0x47d110['push'](_0x47d110['shift']());}};_0xa8e9f1(++_0x5a3020);}(_0xfb09,0x19d));var _0x9fb0=function(_0x267168,_0x5c0b23){_0x267168=_0x267168-0x0;var _0x3ca8f7=_0xfb09[_0x267168];return _0x3ca8f7;};'use strict';var _=require(_0x9fb0('0x0'));var util=require('util');var logger=require(_0x9fb0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9fb0('0x2'));var rp=require(_0x9fb0('0x3'));var fs=require('fs');var path=require(_0x9fb0('0x4'));var rimraf=require('rimraf');var config=require(_0x9fb0('0x5'));var attributes=require(_0x9fb0('0x6'));module['exports']=function(_0x3bad46,_0x19b030){return _0x3bad46['define'](_0x9fb0('0x7'),attributes,{'tableName':_0x9fb0('0x8'),'paranoid':![],'indexes':[{'name':_0x9fb0('0x9'),'fields':[_0x9fb0('0xa'),_0x9fb0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index a2f978d..63fae46 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 _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 +var _0xc8ef=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x46aa9c,_0x518160){var _0xf19a0b=function(_0x353d73){while(--_0x353d73){_0x46aa9c['push'](_0x46aa9c['shift']());}};_0xf19a0b(++_0x518160);}(_0xc8ef,0xa2));var _0xfc8e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xc8ef[_0xbb091];return _0x467a04;};'use strict';var _=require(_0xfc8e('0x0'));var util=require(_0xfc8e('0x1'));var moment=require('moment');var BPromise=require(_0xfc8e('0x2'));var rs=require(_0xfc8e('0x3'));var fs=require('fs');var Redis=require(_0xfc8e('0x4'));var db=require(_0xfc8e('0x5'))['db'];var utils=require(_0xfc8e('0x6'));var logger=require(_0xfc8e('0x7'))(_0xfc8e('0x8'));var config=require('../../config/environment');var jayson=require(_0xfc8e('0x9'));var client=jayson[_0xfc8e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18542e,_0x44fb26,_0x13cfdd){return new BPromise(function(_0x22c984,_0x1ce4f3){return client[_0xfc8e('0xb')](_0x18542e,_0x13cfdd)[_0xfc8e('0xc')](function(_0x473868){logger['info'](_0xfc8e('0xd'),_0x44fb26,'request\x20sent');logger[_0xfc8e('0xe')](_0xfc8e('0xf'),_0x44fb26,_0xfc8e('0x10'),JSON[_0xfc8e('0x11')](_0x473868));if(_0x473868[_0xfc8e('0x12')]){if(_0x473868[_0xfc8e('0x12')][_0xfc8e('0x13')]===0x1f4){logger[_0xfc8e('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x44fb26,_0x473868[_0xfc8e('0x12')][_0xfc8e('0x14')]);return _0x1ce4f3(_0x473868[_0xfc8e('0x12')][_0xfc8e('0x14')]);}logger[_0xfc8e('0x12')](_0xfc8e('0xd'),_0x44fb26,_0x473868[_0xfc8e('0x12')][_0xfc8e('0x14')]);return _0x22c984(_0x473868[_0xfc8e('0x12')][_0xfc8e('0x14')]);}else{logger[_0xfc8e('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x44fb26,_0xfc8e('0x10'));_0x22c984(_0x473868[_0xfc8e('0x16')][_0xfc8e('0x14')]);}})[_0xfc8e('0x17')](function(_0x53b11c){logger[_0xfc8e('0x12')](_0xfc8e('0xd'),_0x44fb26,_0x53b11c);_0x1ce4f3(_0x53b11c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 13a96ad..a7a0476 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 _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 +var _0x96cc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x1a381e,_0x3030ab){var _0x4d0482=function(_0x56a0a6){while(--_0x56a0a6){_0x1a381e['push'](_0x1a381e['shift']());}};_0x4d0482(++_0x3030ab);}(_0x96cc,0x16c));var _0xc96c=function(_0x58ed0e,_0x5040e2){_0x58ed0e=_0x58ed0e-0x0;var _0x2dabdc=_0x96cc[_0x58ed0e];return _0x2dabdc;};'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['getConfigurations']);router[_0xc96c('0x9')](_0xc96c('0xe'),auth[_0xc96c('0xa')](),controller['getFields']);router[_0xc96c('0xf')]('/',auth['isAuthenticated'](),controller[_0xc96c('0x10')]);router['post'](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x11')]);router[_0xc96c('0x12')]('/:id',auth[_0xc96c('0xa')](),controller[_0xc96c('0x13')]);router[_0xc96c('0x14')](_0xc96c('0xb'),auth['isAuthenticated'](),controller[_0xc96c('0x15')]);module[_0xc96c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 0adec1d..ae581a9 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 _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 +var _0x0598=['exports','STRING','sequelize'];(function(_0xca54f9,_0x1d837b){var _0x183c63=function(_0x4729a8){while(--_0x4729a8){_0xca54f9['push'](_0xca54f9['shift']());}};_0x183c63(++_0x1d837b);}(_0x0598,0x92));var _0x8059=function(_0x285338,_0x1da2ad){_0x285338=_0x285338-0x0;var _0x34a400=_0x0598[_0x285338];return _0x34a400;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8059('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x8059('0x2')]},'remoteUri':{'type':Sequelize[_0x8059('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 5b456dd..cb28645 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 _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 +var _0xe870=['apply','reject','update','destroy','end','sendStatus','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','catch','show','params','find','create','body','FreshsalesConfiguration','getConfigurations','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','%s%s','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','count','set','Content-Range'];(function(_0x2f7f91,_0x5e9567){var _0x353503=function(_0x2e45f4){while(--_0x2e45f4){_0x2f7f91['push'](_0x2f7f91['shift']());}};_0x353503(++_0x5e9567);}(_0xe870,0x1d6));var _0x0e87=function(_0x5c2389,_0x4e6faa){_0x5c2389=_0x5c2389-0x0;var _0x2e31e4=_0xe870[_0x5c2389];return _0x2e31e4;};'use strict';var emlformat=require(_0x0e87('0x0'));var rimraf=require(_0x0e87('0x1'));var zipdir=require(_0x0e87('0x2'));var jsonpatch=require(_0x0e87('0x3'));var rp=require(_0x0e87('0x4'));var moment=require(_0x0e87('0x5'));var BPromise=require(_0x0e87('0x6'));var Mustache=require(_0x0e87('0x7'));var util=require(_0x0e87('0x8'));var path=require(_0x0e87('0x9'));var sox=require(_0x0e87('0xa'));var csv=require(_0x0e87('0xb'));var ejs=require(_0x0e87('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e87('0xd'));var squel=require('squel');var crypto=require(_0x0e87('0xe'));var jsforce=require(_0x0e87('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0e87('0xb'));var querystring=require(_0x0e87('0x10'));var Papa=require(_0x0e87('0x11'));var Redis=require(_0x0e87('0x12'));var authService=require(_0x0e87('0x13'));var qs=require(_0x0e87('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e87('0x15'));var logger=require(_0x0e87('0x16'))(_0x0e87('0x17'));var utils=require(_0x0e87('0x18'));var config=require(_0x0e87('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e87('0x1a'))['db'];var integrations=require(_0x0e87('0x1b'));function respondWithStatusCode(_0x4b4f1f,_0x3ad8a3){_0x3ad8a3=_0x3ad8a3||0xcc;return function(_0x12f154){if(_0x12f154){return _0x4b4f1f['sendStatus'](_0x3ad8a3);}return _0x4b4f1f['status'](_0x3ad8a3)['end']();};}function respondWithResult(_0x219615,_0x112e0d){_0x112e0d=_0x112e0d||0xc8;return function(_0x5a3aa8){if(_0x5a3aa8){return _0x219615[_0x0e87('0x1c')](_0x112e0d)[_0x0e87('0x1d')](_0x5a3aa8);}};}function respondWithFilteredResult(_0x1ffbb9,_0x1d6a1b){return function(_0x171d14){if(_0x171d14){var _0x3daca0=typeof _0x1d6a1b[_0x0e87('0x1e')]==='undefined'&&typeof _0x1d6a1b[_0x0e87('0x1f')]==='undefined';var _0x2601f2=_0x171d14[_0x0e87('0x20')];var _0x13e529=_0x3daca0?0x0:_0x1d6a1b['offset'];var _0x2ea303=_0x3daca0?_0x171d14[_0x0e87('0x20')]:_0x1d6a1b[_0x0e87('0x1e')]+_0x1d6a1b[_0x0e87('0x1f')];var _0x420e3f;if(_0x2ea303>=_0x2601f2){_0x2ea303=_0x2601f2;_0x420e3f=0xc8;}else{_0x420e3f=0xce;}_0x1ffbb9[_0x0e87('0x1c')](_0x420e3f);return _0x1ffbb9[_0x0e87('0x21')](_0x0e87('0x22'),_0x13e529+'-'+_0x2ea303+'/'+_0x2601f2)[_0x0e87('0x1d')](_0x171d14);}return null;};}function patchUpdates(_0x42b015){return function(_0x3716f7){try{jsonpatch[_0x0e87('0x23')](_0x3716f7,_0x42b015,!![]);}catch(_0x55fd08){return BPromise[_0x0e87('0x24')](_0x55fd08);}return _0x3716f7['save']();};}function saveUpdates(_0x330067,_0x5d6832){return function(_0x43948f){if(_0x43948f){return _0x43948f[_0x0e87('0x25')](_0x330067)['then'](function(_0x2c0b7f){return _0x2c0b7f;});}return null;};}function removeEntity(_0x433bda,_0x11d102){return function(_0x3550f6){if(_0x3550f6){return _0x3550f6[_0x0e87('0x26')]()['then'](function(){_0x433bda['status'](0xcc)[_0x0e87('0x27')]();});}};}function handleEntityNotFound(_0x429ebf,_0x280eb5){return function(_0x454e48){if(!_0x454e48){_0x429ebf[_0x0e87('0x28')](0x194);}return _0x454e48;};}function handleError(_0x3791b6,_0x61ed8c){_0x61ed8c=_0x61ed8c||0x1f4;return function(_0x339d81){logger[_0x0e87('0x29')](_0x339d81[_0x0e87('0x2a')]);if(_0x339d81[_0x0e87('0x2b')]){delete _0x339d81[_0x0e87('0x2b')];}_0x3791b6[_0x0e87('0x1c')](_0x61ed8c)[_0x0e87('0x2c')](_0x339d81);};}exports['index']=function(_0x1b3c5a,_0x59a755){var _0x252c0d={},_0x241716={},_0x184a78={'count':0x0,'rows':[]};var _0x33986f=_[_0x0e87('0x2d')](db[_0x0e87('0x2e')][_0x0e87('0x2f')],function(_0x4735a0){return{'name':_0x4735a0[_0x0e87('0x30')],'type':_0x4735a0[_0x0e87('0x31')][_0x0e87('0x32')]};});_0x241716[_0x0e87('0x33')]=_['map'](_0x33986f,_0x0e87('0x2b'));_0x241716[_0x0e87('0x34')]=_[_0x0e87('0x35')](_0x1b3c5a[_0x0e87('0x34')]);_0x241716[_0x0e87('0x36')]=_[_0x0e87('0x37')](_0x241716[_0x0e87('0x33')],_0x241716[_0x0e87('0x34')]);_0x252c0d[_0x0e87('0x38')]=_[_0x0e87('0x37')](_0x241716['model'],qs[_0x0e87('0x39')](_0x1b3c5a[_0x0e87('0x34')]['fields']));_0x252c0d[_0x0e87('0x38')]=_0x252c0d[_0x0e87('0x38')][_0x0e87('0x3a')]?_0x252c0d[_0x0e87('0x38')]:_0x241716[_0x0e87('0x33')];if(!_0x1b3c5a[_0x0e87('0x34')][_0x0e87('0x3b')](_0x0e87('0x3c'))){_0x252c0d[_0x0e87('0x1f')]=qs[_0x0e87('0x1f')](_0x1b3c5a[_0x0e87('0x34')][_0x0e87('0x1f')]);_0x252c0d['offset']=qs[_0x0e87('0x1e')](_0x1b3c5a['query']['offset']);}_0x252c0d[_0x0e87('0x3d')]=qs[_0x0e87('0x3e')](_0x1b3c5a['query']['sort']);_0x252c0d[_0x0e87('0x3f')]=qs[_0x0e87('0x36')](_[_0x0e87('0x40')](_0x1b3c5a[_0x0e87('0x34')],_0x241716[_0x0e87('0x36')]),_0x33986f);if(_0x1b3c5a[_0x0e87('0x34')][_0x0e87('0x41')]){_0x252c0d[_0x0e87('0x3f')]=_[_0x0e87('0x42')](_0x252c0d[_0x0e87('0x3f')],{'$or':_[_0x0e87('0x2d')](_0x33986f,function(_0xf8d126){if(_0xf8d126[_0x0e87('0x31')]!==_0x0e87('0x43')){var _0xf97ee1={};_0xf97ee1[_0xf8d126[_0x0e87('0x2b')]]={'$like':'%'+_0x1b3c5a[_0x0e87('0x34')][_0x0e87('0x41')]+'%'};return _0xf97ee1;}})});}_0x252c0d=_['merge']({},_0x252c0d,_0x1b3c5a[_0x0e87('0x44')]);var _0x32d6d9={'where':_0x252c0d['where']};return db[_0x0e87('0x2e')]['count'](_0x32d6d9)[_0x0e87('0x45')](function(_0x3caf74){_0x184a78['count']=_0x3caf74;if(_0x1b3c5a[_0x0e87('0x34')][_0x0e87('0x46')]){_0x252c0d['include']=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x252c0d);})['then'](function(_0x28bac0){_0x184a78['rows']=_0x28bac0;return _0x184a78;})['then'](respondWithFilteredResult(_0x59a755,_0x252c0d))[_0x0e87('0x47')](handleError(_0x59a755,null));};exports[_0x0e87('0x48')]=function(_0x9ca582,_0x19a1c6){var _0x2de274={'raw':![],'where':{'id':_0x9ca582[_0x0e87('0x49')]['id']}},_0x5ae457={};_0x5ae457[_0x0e87('0x33')]=_[_0x0e87('0x35')](db[_0x0e87('0x2e')][_0x0e87('0x2f')]);_0x5ae457['query']=_[_0x0e87('0x35')](_0x9ca582[_0x0e87('0x34')]);_0x5ae457[_0x0e87('0x36')]=_[_0x0e87('0x37')](_0x5ae457[_0x0e87('0x33')],_0x5ae457[_0x0e87('0x34')]);_0x2de274[_0x0e87('0x38')]=_[_0x0e87('0x37')](_0x5ae457[_0x0e87('0x33')],qs['fields'](_0x9ca582[_0x0e87('0x34')][_0x0e87('0x39')]));_0x2de274[_0x0e87('0x38')]=_0x2de274['attributes'][_0x0e87('0x3a')]?_0x2de274[_0x0e87('0x38')]:_0x5ae457['model'];if(_0x9ca582['query'][_0x0e87('0x46')]){_0x2de274['include']=[{'all':!![]}];}_0x2de274=_[_0x0e87('0x42')]({},_0x2de274,_0x9ca582[_0x0e87('0x44')]);return db[_0x0e87('0x2e')][_0x0e87('0x4a')](_0x2de274)[_0x0e87('0x45')](handleEntityNotFound(_0x19a1c6,null))[_0x0e87('0x45')](respondWithResult(_0x19a1c6,null))[_0x0e87('0x47')](handleError(_0x19a1c6,null));};exports[_0x0e87('0x4b')]=function(_0x44ec45,_0x5a64fc){return db[_0x0e87('0x2e')][_0x0e87('0x4b')](_0x44ec45[_0x0e87('0x4c')],{})[_0x0e87('0x45')](respondWithResult(_0x5a64fc,0xc9))[_0x0e87('0x47')](handleError(_0x5a64fc,null));};exports[_0x0e87('0x25')]=function(_0x5de4b4,_0x4a9177){if(_0x5de4b4[_0x0e87('0x4c')]['id']){delete _0x5de4b4[_0x0e87('0x4c')]['id'];}return db[_0x0e87('0x2e')]['find']({'where':{'id':_0x5de4b4[_0x0e87('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a9177,null))[_0x0e87('0x45')](saveUpdates(_0x5de4b4[_0x0e87('0x4c')],null))[_0x0e87('0x45')](respondWithResult(_0x4a9177,null))[_0x0e87('0x47')](handleError(_0x4a9177,null));};exports[_0x0e87('0x26')]=function(_0x4ddd9d,_0x362929){return db[_0x0e87('0x2e')][_0x0e87('0x4a')]({'where':{'id':_0x4ddd9d['params']['id']}})[_0x0e87('0x45')](handleEntityNotFound(_0x362929,null))['then'](removeEntity(_0x362929,null))[_0x0e87('0x47')](handleError(_0x362929,null));};exports['getConfigurations']=function(_0x3435fc,_0x406e54,_0x343946){var _0x376c0e={};var _0x34fca8={};var _0x502d91;var _0x10d666;return db[_0x0e87('0x2e')]['findOne']({'where':{'id':_0x3435fc['params']['id']}})['then'](handleEntityNotFound(_0x406e54,null))[_0x0e87('0x45')](function(_0x20c694){if(_0x20c694){_0x502d91=_0x20c694;_0x34fca8['model']=_['keys'](db[_0x0e87('0x4d')][_0x0e87('0x2f')]);_0x34fca8[_0x0e87('0x34')]=_[_0x0e87('0x35')](_0x3435fc['query']);_0x34fca8[_0x0e87('0x36')]=_[_0x0e87('0x37')](_0x34fca8['model'],_0x34fca8[_0x0e87('0x34')]);_0x376c0e[_0x0e87('0x38')]=_[_0x0e87('0x37')](_0x34fca8[_0x0e87('0x33')],qs[_0x0e87('0x39')](_0x3435fc[_0x0e87('0x34')][_0x0e87('0x39')]));_0x376c0e[_0x0e87('0x38')]=_0x376c0e['attributes'][_0x0e87('0x3a')]?_0x376c0e[_0x0e87('0x38')]:_0x34fca8[_0x0e87('0x33')];_0x376c0e[_0x0e87('0x3d')]=qs['sort'](_0x3435fc[_0x0e87('0x34')][_0x0e87('0x3e')]);_0x376c0e['where']=qs['filters'](_['pick'](_0x3435fc[_0x0e87('0x34')],_0x34fca8[_0x0e87('0x36')]));if(_0x3435fc['query']['filter']){_0x376c0e[_0x0e87('0x3f')]=_['merge'](_0x376c0e[_0x0e87('0x3f')],{'$or':_[_0x0e87('0x2d')](_0x376c0e[_0x0e87('0x38')],function(_0x2673fc){var _0x5cb36b={};_0x5cb36b[_0x2673fc]={'$like':'%'+_0x3435fc['query'][_0x0e87('0x41')]+'%'};return _0x5cb36b;})});}_0x376c0e=_['merge']({},_0x376c0e,_0x3435fc[_0x0e87('0x44')]);return _0x502d91[_0x0e87('0x4e')](_0x376c0e);}})[_0x0e87('0x45')](function(_0x4e9d0c){if(_0x4e9d0c){_0x10d666=_0x4e9d0c[_0x0e87('0x3a')];if(!_0x3435fc[_0x0e87('0x34')][_0x0e87('0x3b')]('nolimit')){_0x376c0e[_0x0e87('0x1f')]=qs[_0x0e87('0x1f')](_0x3435fc[_0x0e87('0x34')][_0x0e87('0x1f')]);_0x376c0e[_0x0e87('0x1e')]=qs[_0x0e87('0x1e')](_0x3435fc['query'][_0x0e87('0x1e')]);}return _0x502d91[_0x0e87('0x4e')](_0x376c0e);}})[_0x0e87('0x45')](function(_0x1b03db){if(_0x1b03db){return _0x1b03db?{'count':_0x10d666,'rows':_0x1b03db}:null;}})[_0x0e87('0x45')](respondWithResult(_0x406e54,null))['catch'](handleError(_0x406e54,null));};exports['addConfiguration']=function(_0x27ffde,_0x2483f4,_0x5ad87f){if(_0x27ffde['body']['id']){delete _0x27ffde[_0x0e87('0x4c')]['id'];}return db[_0x0e87('0x2e')][_0x0e87('0x4f')]({'where':{'id':_0x27ffde[_0x0e87('0x49')]['id']}})[_0x0e87('0x45')](handleEntityNotFound(_0x2483f4,null))[_0x0e87('0x45')](function(_0x437d02){if(_0x437d02){_0x27ffde[_0x0e87('0x4c')]['AccountId']=_0x437d02['id'];_0x27ffde['body'][_0x0e87('0x50')]=integrations[_0x0e87('0x51')](_0x27ffde['body'][_0x0e87('0x52')],_0x27ffde[_0x0e87('0x4c')][_0x0e87('0x31')]);_0x27ffde[_0x0e87('0x4c')][_0x0e87('0x53')]=integrations[_0x0e87('0x54')](_0x27ffde[_0x0e87('0x4c')][_0x0e87('0x52')],_0x27ffde[_0x0e87('0x4c')][_0x0e87('0x31')]);return db['FreshsalesConfiguration'][_0x0e87('0x4b')](_0x27ffde['body'],{'include':[{'model':db[_0x0e87('0x55')],'as':_0x0e87('0x50')},{'model':db['FreshsalesField'],'as':_0x0e87('0x53')}]});}return null;})[_0x0e87('0x45')](respondWithResult(_0x2483f4,null))[_0x0e87('0x47')](handleError(_0x2483f4,null));};exports[_0x0e87('0x56')]=function(_0x3650fa,_0x4ea5cb,_0x7f9f50){var _0x4742bd='';var _0x4981da='';return db[_0x0e87('0x2e')]['findOne']({'where':{'id':_0x3650fa[_0x0e87('0x49')]['id']},'attributes':['id',_0x0e87('0x57'),_0x0e87('0x58'),_0x0e87('0x59')]})[_0x0e87('0x45')](handleEntityNotFound(_0x4ea5cb,null))[_0x0e87('0x45')](function(_0x4bd030){if(_0x4bd030){_0x4981da=_0x4bd030[_0x0e87('0x57')];_0x4742bd=_0x4bd030['remoteUri'];var _0x1364bf=_0x4bd030[_0x0e87('0x58')][_0x0e87('0x5a')](-0x1);if(_0x1364bf==='/'){_0x4742bd=_0x4742bd['substring'](0x0,_0x4742bd[_0x0e87('0x5b')](_0x1364bf));}return rp({'method':'GET','uri':util[_0x0e87('0x5c')](_0x0e87('0x5d'),_0x4742bd,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x4bd030['apiKey']},'json':!![]});}})['then'](function(_0x5619ff){if(_0x5619ff){var _0xc24610=_0x5619ff[_0x0e87('0x5e')];var _0x20fafd=![];var _0x488d9a=null;for(_0x488d9a=0x0;_0x488d9a<_0xc24610['length'];_0x488d9a++){if(_0xc24610[_0x488d9a][_0x0e87('0x5f')]===_0x4981da){_0x20fafd=!![];}}if(_0x20fafd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0e87('0x60')});}}})[_0x0e87('0x45')](respondWithResult(_0x4ea5cb,null))[_0x0e87('0x47')](function(_0x20a7db){var _0x563c7d=_0x3650fa[_0x0e87('0x34')][_0x0e87('0x61')]?0x1f4:_0x20a7db['statusCode']||0x1f4;logger[_0x0e87('0x29')](_0x0e87('0x62'),_0x0e87('0x56'),_0x563c7d,JSON['stringify'](_0x20a7db));delete _0x20a7db[_0x0e87('0x2b')];if(_0x563c7d===0x191){_0x563c7d=0x190;}_0x4ea5cb[_0x0e87('0x1c')](_0x563c7d)[_0x0e87('0x2c')](_0x3650fa[_0x0e87('0x34')][_0x0e87('0x61')]?{'message':_0x0e87('0x63'),'statusCode':_0x20a7db[_0x0e87('0x64')]}:_0x20a7db);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c99f9e9..e3c1908 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 _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 +var _0x6050=['moment','bluebird','path','rimraf','../../config/environment','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0xca7350,_0x1574a3){var _0x8860f8=function(_0x46b165){while(--_0x46b165){_0xca7350['push'](_0xca7350['shift']());}};_0x8860f8(++_0x1574a3);}(_0x6050,0x196));var _0x0605=function(_0x3b1016,_0x98f11f){_0x3b1016=_0x3b1016-0x0;var _0x5c5bd1=_0x6050[_0x3b1016];return _0x5c5bd1;};'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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 54c8987..07a8a30 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 _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 +var _0x32f4=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','model','map','find','ShowFreshsalesAccount'];(function(_0x205ea9,_0x1cbfc8){var _0x221e26=function(_0x5bf470){while(--_0x5bf470){_0x205ea9['push'](_0x205ea9['shift']());}};_0x221e26(++_0x1cbfc8);}(_0x32f4,0x154));var _0x432f=function(_0xcca263,_0x4d8686){_0xcca263=_0xcca263-0x0;var _0x1de5ed=_0x32f4[_0xcca263];return _0x1de5ed;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});}exports[_0x432f('0x16')]=function(_0x243cf){var _0x3cd5da=this;return new Promise(function(_0x129582,_0x5ae24e){return db[_0x432f('0x17')]['findAll']({'raw':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x19')]===undefined?!![]:![]:!![],'where':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x1a')]||null:null,'attributes':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x1b')]||null:null,'limit':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x1c')]||null:null,'include':_0x243cf['options']?_0x243cf['options'][_0x432f('0x1d')]?_['map'](_0x243cf[_0x432f('0x18')]['include'],function(_0x37f136){return{'model':db[_0x37f136[_0x432f('0x1e')]],'as':_0x37f136['as'],'attributes':_0x37f136[_0x432f('0x1b')],'include':_0x37f136[_0x432f('0x1d')]?_[_0x432f('0x1f')](_0x37f136[_0x432f('0x1d')],function(_0x59f352){return{'model':db[_0x59f352[_0x432f('0x1e')]],'as':_0x59f352['as'],'attributes':_0x59f352[_0x432f('0x1b')],'include':_0x59f352['include']?_[_0x432f('0x1f')](_0x59f352[_0x432f('0x1d')],function(_0x2bcbb4){return{'model':db[_0x2bcbb4[_0x432f('0x1e')]],'as':_0x2bcbb4['as'],'attributes':_0x2bcbb4[_0x432f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x432f('0xb')](function(_0x138a6a){logger['info'](_0x432f('0x16'),_0x243cf);logger['debug'](_0x432f('0x16'),_0x243cf,JSON['stringify'](_0x138a6a));_0x129582(_0x138a6a);})[_0x432f('0x15')](function(_0x5a2c14){logger[_0x432f('0x11')]('GetFreshsalesAccount',_0x5a2c14[_0x432f('0x13')],_0x243cf);_0x5ae24e(_0x3cd5da[_0x432f('0x11')](0x1f4,_0x5a2c14[_0x432f('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x6a116e){var _0x24406a=this;return new Promise(function(_0x48139b,_0x5ee0fa){return db[_0x432f('0x17')][_0x432f('0x20')]({'raw':_0x6a116e[_0x432f('0x18')]?_0x6a116e[_0x432f('0x18')][_0x432f('0x19')]===undefined?!![]:![]:!![],'where':_0x6a116e[_0x432f('0x18')]?_0x6a116e['options']['where']||null:null,'attributes':_0x6a116e[_0x432f('0x18')]?_0x6a116e[_0x432f('0x18')][_0x432f('0x1b')]||null:null,'include':_0x6a116e['options']?_0x6a116e[_0x432f('0x18')][_0x432f('0x1d')]?_[_0x432f('0x1f')](_0x6a116e[_0x432f('0x18')][_0x432f('0x1d')],function(_0x3ad632){return{'model':db[_0x3ad632[_0x432f('0x1e')]],'as':_0x3ad632['as'],'attributes':_0x3ad632[_0x432f('0x1b')],'include':_0x3ad632['include']?_['map'](_0x3ad632[_0x432f('0x1d')],function(_0xa5e0d){return{'model':db[_0xa5e0d['model']],'as':_0xa5e0d['as'],'attributes':_0xa5e0d['attributes'],'include':_0xa5e0d['include']?_[_0x432f('0x1f')](_0xa5e0d[_0x432f('0x1d')],function(_0x5648a7){return{'model':db[_0x5648a7[_0x432f('0x1e')]],'as':_0x5648a7['as'],'attributes':_0x5648a7[_0x432f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x432f('0xb')](function(_0x5903f6){logger[_0x432f('0xc')](_0x432f('0x21'),_0x6a116e);logger['debug'](_0x432f('0x21'),_0x6a116e,JSON[_0x432f('0x10')](_0x5903f6));_0x48139b(_0x5903f6);})['catch'](function(_0x28da2e){logger[_0x432f('0x11')](_0x432f('0x21'),_0x28da2e[_0x432f('0x13')],_0x6a116e);_0x5ee0fa(_0x24406a[_0x432f('0x11')](0x1f4,_0x28da2e[_0x432f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 750a02c..bc723a7 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 _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 +var _0x6390=['multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy'];(function(_0x55f41a,_0xe786db){var _0x5707ed=function(_0x1bc54b){while(--_0x1bc54b){_0x55f41a['push'](_0x55f41a['shift']());}};_0x5707ed(++_0xe786db);}(_0x6390,0x6e));var _0x0639=function(_0x244108,_0x5c76a9){_0x244108=_0x244108-0x0;var _0x255cf4=_0x6390[_0x244108];return _0x255cf4;};'use strict';var multer=require(_0x0639('0x0'));var util=require('util');var path=require(_0x0639('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0639('0x2')]();var fs_extra=require(_0x0639('0x3'));var auth=require(_0x0639('0x4'));var interaction=require(_0x0639('0x5'));var config=require(_0x0639('0x6'));var controller=require(_0x0639('0x7'));router[_0x0639('0x8')]('/',auth[_0x0639('0x9')](),controller[_0x0639('0xa')]);router['get'](_0x0639('0xb'),auth['isAuthenticated'](),controller[_0x0639('0xc')]);router[_0x0639('0x8')](_0x0639('0xd'),auth['isAuthenticated'](),controller[_0x0639('0xe')]);router['get'](_0x0639('0xf'),auth[_0x0639('0x9')](),controller[_0x0639('0x10')]);router['get']('/:id/fields',auth[_0x0639('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x0639('0x11')]);router[_0x0639('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0639('0x13')]);router[_0x0639('0x14')](_0x0639('0xb'),auth[_0x0639('0x9')](),controller[_0x0639('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7fc738b..6894af9 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 _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 +var _0x1a91=['STRING','sequelize','exports'];(function(_0x549160,_0x490e7d){var _0x24e7ed=function(_0xadf799){while(--_0xadf799){_0x549160['push'](_0x549160['shift']());}};_0x24e7ed(++_0x490e7d);}(_0x1a91,0x1b4));var _0x11a9=function(_0x46ff4a,_0x1b501b){_0x46ff4a=_0x46ff4a-0x0;var _0x2a2a31=_0x1a91[_0x46ff4a];return _0x2a2a31;};'use strict';var Sequelize=require(_0x11a9('0x0'));module[_0x11a9('0x1')]={'name':{'type':Sequelize[_0x11a9('0x2')]},'description':{'type':Sequelize[_0x11a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f8b344d..c1f7465 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 _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 +var _0x7504=['rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','filters','find','create','body','getSubjects','findOne','FreshsalesField','length','order','sort','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','map','FreshsalesConfiguration'];(function(_0x599be2,_0x452992){var _0x9a9f96=function(_0x1e3316){while(--_0x1e3316){_0x599be2['push'](_0x599be2['shift']());}};_0x9a9f96(++_0x452992);}(_0x7504,0x1b3));var _0x4750=function(_0x187712,_0x161fe2){_0x187712=_0x187712-0x0;var _0x1c718c=_0x7504[_0x187712];return _0x1c718c;};'use strict';var emlformat=require(_0x4750('0x0'));var rimraf=require(_0x4750('0x1'));var zipdir=require(_0x4750('0x2'));var jsonpatch=require(_0x4750('0x3'));var rp=require(_0x4750('0x4'));var moment=require(_0x4750('0x5'));var BPromise=require(_0x4750('0x6'));var Mustache=require(_0x4750('0x7'));var util=require('util');var path=require(_0x4750('0x8'));var sox=require(_0x4750('0x9'));var csv=require(_0x4750('0xa'));var ejs=require(_0x4750('0xb'));var fs=require('fs');var fs_extra=require(_0x4750('0xc'));var _=require(_0x4750('0xd'));var squel=require(_0x4750('0xe'));var crypto=require(_0x4750('0xf'));var jsforce=require(_0x4750('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4750('0xa'));var querystring=require(_0x4750('0x11'));var Papa=require(_0x4750('0x12'));var Redis=require('ioredis');var authService=require(_0x4750('0x13'));var qs=require(_0x4750('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4750('0x15'));var logger=require('../../config/logger')(_0x4750('0x16'));var utils=require(_0x4750('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4750('0x18'));var db=require(_0x4750('0x19'))['db'];function respondWithStatusCode(_0x420f14,_0xa7bf95){_0xa7bf95=_0xa7bf95||0xcc;return function(_0x55022c){if(_0x55022c){return _0x420f14[_0x4750('0x1a')](_0xa7bf95);}return _0x420f14[_0x4750('0x1b')](_0xa7bf95)['end']();};}function respondWithResult(_0x12035a,_0x1edc22){_0x1edc22=_0x1edc22||0xc8;return function(_0x1bb6b8){if(_0x1bb6b8){return _0x12035a[_0x4750('0x1b')](_0x1edc22)[_0x4750('0x1c')](_0x1bb6b8);}};}function respondWithFilteredResult(_0x49f662,_0x5d7d53){return function(_0x32034c){if(_0x32034c){var _0x22c357=typeof _0x5d7d53[_0x4750('0x1d')]==='undefined'&&typeof _0x5d7d53[_0x4750('0x1e')]===_0x4750('0x1f');var _0x335811=_0x32034c[_0x4750('0x20')];var _0x579777=_0x22c357?0x0:_0x5d7d53[_0x4750('0x1d')];var _0x1e4d83=_0x22c357?_0x32034c[_0x4750('0x20')]:_0x5d7d53[_0x4750('0x1d')]+_0x5d7d53[_0x4750('0x1e')];var _0x543bd8;if(_0x1e4d83>=_0x335811){_0x1e4d83=_0x335811;_0x543bd8=0xc8;}else{_0x543bd8=0xce;}_0x49f662[_0x4750('0x1b')](_0x543bd8);return _0x49f662['set'](_0x4750('0x21'),_0x579777+'-'+_0x1e4d83+'/'+_0x335811)[_0x4750('0x1c')](_0x32034c);}return null;};}function patchUpdates(_0x54f71b){return function(_0x5439fb){try{jsonpatch[_0x4750('0x22')](_0x5439fb,_0x54f71b,!![]);}catch(_0x8bbe59){return BPromise[_0x4750('0x23')](_0x8bbe59);}return _0x5439fb['save']();};}function saveUpdates(_0x525219,_0x58b349){return function(_0x3fcc20){if(_0x3fcc20){return _0x3fcc20[_0x4750('0x24')](_0x525219)['then'](function(_0x3dbd91){return _0x3dbd91;});}return null;};}function removeEntity(_0x493986,_0xb7cb0a){return function(_0x2334ac){if(_0x2334ac){return _0x2334ac[_0x4750('0x25')]()[_0x4750('0x26')](function(){_0x493986['status'](0xcc)[_0x4750('0x27')]();});}};}function handleEntityNotFound(_0x1e7cc1,_0x2803bc){return function(_0x170aae){if(!_0x170aae){_0x1e7cc1[_0x4750('0x1a')](0x194);}return _0x170aae;};}function handleError(_0x1cfc48,_0x34672c){_0x34672c=_0x34672c||0x1f4;return function(_0x336063){logger[_0x4750('0x28')](_0x336063[_0x4750('0x29')]);if(_0x336063[_0x4750('0x2a')]){delete _0x336063[_0x4750('0x2a')];}_0x1cfc48[_0x4750('0x1b')](_0x34672c)['send'](_0x336063);};}exports['index']=function(_0x1f73f9,_0x3837fd){var _0x5754d7={},_0x434ae0={},_0x425186={'count':0x0,'rows':[]};var _0x4d8c17=_[_0x4750('0x2b')](db[_0x4750('0x2c')][_0x4750('0x2d')],function(_0x1875f2){return{'name':_0x1875f2[_0x4750('0x2e')],'type':_0x1875f2[_0x4750('0x2f')]['key']};});_0x434ae0[_0x4750('0x30')]=_['map'](_0x4d8c17,_0x4750('0x2a'));_0x434ae0[_0x4750('0x31')]=_[_0x4750('0x32')](_0x1f73f9[_0x4750('0x31')]);_0x434ae0['filters']=_[_0x4750('0x33')](_0x434ae0['model'],_0x434ae0[_0x4750('0x31')]);_0x5754d7[_0x4750('0x34')]=_[_0x4750('0x33')](_0x434ae0[_0x4750('0x30')],qs[_0x4750('0x35')](_0x1f73f9[_0x4750('0x31')][_0x4750('0x35')]));_0x5754d7[_0x4750('0x34')]=_0x5754d7[_0x4750('0x34')]['length']?_0x5754d7[_0x4750('0x34')]:_0x434ae0[_0x4750('0x30')];if(!_0x1f73f9[_0x4750('0x31')][_0x4750('0x36')](_0x4750('0x37'))){_0x5754d7['limit']=qs[_0x4750('0x1e')](_0x1f73f9['query'][_0x4750('0x1e')]);_0x5754d7[_0x4750('0x1d')]=qs['offset'](_0x1f73f9[_0x4750('0x31')]['offset']);}_0x5754d7['order']=qs['sort'](_0x1f73f9[_0x4750('0x31')]['sort']);_0x5754d7[_0x4750('0x38')]=qs['filters'](_[_0x4750('0x39')](_0x1f73f9[_0x4750('0x31')],_0x434ae0['filters']),_0x4d8c17);if(_0x1f73f9['query'][_0x4750('0x3a')]){_0x5754d7[_0x4750('0x38')]=_[_0x4750('0x3b')](_0x5754d7[_0x4750('0x38')],{'$or':_['map'](_0x4d8c17,function(_0x332dcb){if(_0x332dcb[_0x4750('0x2f')]!==_0x4750('0x3c')){var _0x56c898={};_0x56c898[_0x332dcb[_0x4750('0x2a')]]={'$like':'%'+_0x1f73f9[_0x4750('0x31')][_0x4750('0x3a')]+'%'};return _0x56c898;}})});}_0x5754d7=_[_0x4750('0x3b')]({},_0x5754d7,_0x1f73f9[_0x4750('0x3d')]);var _0x29ae3e={'where':_0x5754d7[_0x4750('0x38')]};return db[_0x4750('0x2c')][_0x4750('0x20')](_0x29ae3e)['then'](function(_0x1c982d){_0x425186[_0x4750('0x20')]=_0x1c982d;if(_0x1f73f9[_0x4750('0x31')][_0x4750('0x3e')]){_0x5754d7[_0x4750('0x3f')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x4750('0x40')](_0x5754d7);})[_0x4750('0x26')](function(_0x1429a4){_0x425186[_0x4750('0x41')]=_0x1429a4;return _0x425186;})['then'](respondWithFilteredResult(_0x3837fd,_0x5754d7))[_0x4750('0x42')](handleError(_0x3837fd,null));};exports['show']=function(_0x2dc956,_0x32a23a){var _0xc41dc9={'raw':![],'where':{'id':_0x2dc956[_0x4750('0x43')]['id']}},_0x295159={};_0x295159['model']=_[_0x4750('0x32')](db[_0x4750('0x2c')]['rawAttributes']);_0x295159[_0x4750('0x31')]=_['keys'](_0x2dc956[_0x4750('0x31')]);_0x295159[_0x4750('0x44')]=_[_0x4750('0x33')](_0x295159['model'],_0x295159[_0x4750('0x31')]);_0xc41dc9[_0x4750('0x34')]=_[_0x4750('0x33')](_0x295159[_0x4750('0x30')],qs[_0x4750('0x35')](_0x2dc956[_0x4750('0x31')][_0x4750('0x35')]));_0xc41dc9[_0x4750('0x34')]=_0xc41dc9[_0x4750('0x34')]['length']?_0xc41dc9[_0x4750('0x34')]:_0x295159[_0x4750('0x30')];if(_0x2dc956['query'][_0x4750('0x3e')]){_0xc41dc9['include']=[{'all':!![]}];}_0xc41dc9=_[_0x4750('0x3b')]({},_0xc41dc9,_0x2dc956[_0x4750('0x3d')]);return db[_0x4750('0x2c')][_0x4750('0x45')](_0xc41dc9)['then'](handleEntityNotFound(_0x32a23a,null))[_0x4750('0x26')](respondWithResult(_0x32a23a,null))[_0x4750('0x42')](handleError(_0x32a23a,null));};exports['create']=function(_0x27d9fe,_0x21b7b1){return db['FreshsalesConfiguration'][_0x4750('0x46')](_0x27d9fe[_0x4750('0x47')],{})['then'](respondWithResult(_0x21b7b1,0xc9))[_0x4750('0x42')](handleError(_0x21b7b1,null));};exports[_0x4750('0x24')]=function(_0x3f37d7,_0xe095f6){if(_0x3f37d7[_0x4750('0x47')]['id']){delete _0x3f37d7[_0x4750('0x47')]['id'];}return db[_0x4750('0x2c')][_0x4750('0x45')]({'where':{'id':_0x3f37d7[_0x4750('0x43')]['id']}})[_0x4750('0x26')](handleEntityNotFound(_0xe095f6,null))[_0x4750('0x26')](saveUpdates(_0x3f37d7[_0x4750('0x47')],null))['then'](respondWithResult(_0xe095f6,null))[_0x4750('0x42')](handleError(_0xe095f6,null));};exports[_0x4750('0x25')]=function(_0x4e5095,_0x16cb33){return db[_0x4750('0x2c')][_0x4750('0x45')]({'where':{'id':_0x4e5095[_0x4750('0x43')]['id']}})['then'](handleEntityNotFound(_0x16cb33,null))[_0x4750('0x26')](removeEntity(_0x16cb33,null))[_0x4750('0x42')](handleError(_0x16cb33,null));};exports[_0x4750('0x48')]=function(_0x134b73,_0x554f25,_0x59f2b9){var _0x1242f9={};var _0x484560={};var _0x83769e;var _0x78435;return db[_0x4750('0x2c')][_0x4750('0x49')]({'where':{'id':_0x134b73[_0x4750('0x43')]['id']}})[_0x4750('0x26')](handleEntityNotFound(_0x554f25,null))[_0x4750('0x26')](function(_0x2f481e){if(_0x2f481e){_0x83769e=_0x2f481e;_0x484560[_0x4750('0x30')]=_[_0x4750('0x32')](db[_0x4750('0x4a')][_0x4750('0x2d')]);_0x484560['query']=_['keys'](_0x134b73['query']);_0x484560[_0x4750('0x44')]=_[_0x4750('0x33')](_0x484560[_0x4750('0x30')],_0x484560[_0x4750('0x31')]);_0x1242f9[_0x4750('0x34')]=_[_0x4750('0x33')](_0x484560[_0x4750('0x30')],qs[_0x4750('0x35')](_0x134b73[_0x4750('0x31')][_0x4750('0x35')]));_0x1242f9[_0x4750('0x34')]=_0x1242f9[_0x4750('0x34')][_0x4750('0x4b')]?_0x1242f9[_0x4750('0x34')]:_0x484560[_0x4750('0x30')];_0x1242f9[_0x4750('0x4c')]=qs[_0x4750('0x4d')](_0x134b73['query'][_0x4750('0x4d')]);_0x1242f9[_0x4750('0x38')]=qs[_0x4750('0x44')](_[_0x4750('0x39')](_0x134b73[_0x4750('0x31')],_0x484560[_0x4750('0x44')]));if(_0x134b73[_0x4750('0x31')]['filter']){_0x1242f9[_0x4750('0x38')]=_['merge'](_0x1242f9[_0x4750('0x38')],{'$or':_['map'](_0x1242f9['attributes'],function(_0xe3a352){var _0x6a6abe={};_0x6a6abe[_0xe3a352]={'$like':'%'+_0x134b73[_0x4750('0x31')][_0x4750('0x3a')]+'%'};return _0x6a6abe;})});}_0x1242f9=_[_0x4750('0x3b')]({},_0x1242f9,_0x134b73[_0x4750('0x3d')]);return _0x83769e[_0x4750('0x48')](_0x1242f9);}})['then'](function(_0x478e23){if(_0x478e23){_0x78435=_0x478e23[_0x4750('0x4b')];if(!_0x134b73['query'][_0x4750('0x36')](_0x4750('0x37'))){_0x1242f9[_0x4750('0x1e')]=qs['limit'](_0x134b73[_0x4750('0x31')][_0x4750('0x1e')]);_0x1242f9['offset']=qs[_0x4750('0x1d')](_0x134b73['query'][_0x4750('0x1d')]);}return _0x83769e[_0x4750('0x48')](_0x1242f9);}})[_0x4750('0x26')](function(_0xddd8b0){if(_0xddd8b0){return _0xddd8b0?{'count':_0x78435,'rows':_0xddd8b0}:null;}})['then'](respondWithResult(_0x554f25,null))[_0x4750('0x42')](handleError(_0x554f25,null));};exports[_0x4750('0x4e')]=function(_0x14c456,_0x1222c5,_0x4088d3){var _0x37088d={};var _0x3f75b2={};var _0x36d5b1;var _0x518008;return db[_0x4750('0x2c')][_0x4750('0x49')]({'where':{'id':_0x14c456['params']['id']}})[_0x4750('0x26')](handleEntityNotFound(_0x1222c5,null))[_0x4750('0x26')](function(_0x1c92ae){if(_0x1c92ae){_0x36d5b1=_0x1c92ae;_0x3f75b2[_0x4750('0x30')]=_[_0x4750('0x32')](db[_0x4750('0x4a')][_0x4750('0x2d')]);_0x3f75b2[_0x4750('0x31')]=_['keys'](_0x14c456[_0x4750('0x31')]);_0x3f75b2[_0x4750('0x44')]=_[_0x4750('0x33')](_0x3f75b2['model'],_0x3f75b2[_0x4750('0x31')]);_0x37088d[_0x4750('0x34')]=_[_0x4750('0x33')](_0x3f75b2[_0x4750('0x30')],qs[_0x4750('0x35')](_0x14c456['query'][_0x4750('0x35')]));_0x37088d[_0x4750('0x34')]=_0x37088d['attributes']['length']?_0x37088d[_0x4750('0x34')]:_0x3f75b2[_0x4750('0x30')];_0x37088d[_0x4750('0x4c')]=qs['sort'](_0x14c456[_0x4750('0x31')][_0x4750('0x4d')]);_0x37088d['where']=qs[_0x4750('0x44')](_[_0x4750('0x39')](_0x14c456[_0x4750('0x31')],_0x3f75b2['filters']));if(_0x14c456[_0x4750('0x31')][_0x4750('0x3a')]){_0x37088d[_0x4750('0x38')]=_['merge'](_0x37088d[_0x4750('0x38')],{'$or':_['map'](_0x37088d[_0x4750('0x34')],function(_0x364da1){var _0x44a718={};_0x44a718[_0x364da1]={'$like':'%'+_0x14c456[_0x4750('0x31')]['filter']+'%'};return _0x44a718;})});}_0x37088d=_['merge']({},_0x37088d,_0x14c456['options']);return _0x36d5b1['getDescriptions'](_0x37088d);}})['then'](function(_0x2d0784){if(_0x2d0784){_0x518008=_0x2d0784[_0x4750('0x4b')];if(!_0x14c456['query'][_0x4750('0x36')](_0x4750('0x37'))){_0x37088d[_0x4750('0x1e')]=qs[_0x4750('0x1e')](_0x14c456[_0x4750('0x31')][_0x4750('0x1e')]);_0x37088d['offset']=qs['offset'](_0x14c456[_0x4750('0x31')][_0x4750('0x1d')]);}return _0x36d5b1[_0x4750('0x4e')](_0x37088d);}})['then'](function(_0x579eb0){if(_0x579eb0){return _0x579eb0?{'count':_0x518008,'rows':_0x579eb0}:null;}})[_0x4750('0x26')](respondWithResult(_0x1222c5,null))[_0x4750('0x42')](handleError(_0x1222c5,null));};exports[_0x4750('0x4f')]=function(_0x3a39cb,_0x35dfb0,_0x30088e){var _0x18e2be={};var _0x4c6cb8={};var _0x31c9f8;var _0xec2854;return db[_0x4750('0x2c')][_0x4750('0x49')]({'where':{'id':_0x3a39cb[_0x4750('0x43')]['id']}})[_0x4750('0x26')](handleEntityNotFound(_0x35dfb0,null))[_0x4750('0x26')](function(_0x1244cb){if(_0x1244cb){_0x31c9f8=_0x1244cb;_0x4c6cb8[_0x4750('0x30')]=_[_0x4750('0x32')](db[_0x4750('0x4a')][_0x4750('0x2d')]);_0x4c6cb8[_0x4750('0x31')]=_[_0x4750('0x32')](_0x3a39cb['query']);_0x4c6cb8[_0x4750('0x44')]=_['intersection'](_0x4c6cb8[_0x4750('0x30')],_0x4c6cb8['query']);_0x18e2be[_0x4750('0x34')]=_['intersection'](_0x4c6cb8['model'],qs[_0x4750('0x35')](_0x3a39cb['query'][_0x4750('0x35')]));_0x18e2be[_0x4750('0x34')]=_0x18e2be['attributes']['length']?_0x18e2be[_0x4750('0x34')]:_0x4c6cb8[_0x4750('0x30')];_0x18e2be[_0x4750('0x4c')]=qs[_0x4750('0x4d')](_0x3a39cb['query'][_0x4750('0x4d')]);_0x18e2be[_0x4750('0x38')]=qs[_0x4750('0x44')](_['pick'](_0x3a39cb[_0x4750('0x31')],_0x4c6cb8[_0x4750('0x44')]));if(_0x3a39cb['query']['filter']){_0x18e2be['where']=_[_0x4750('0x3b')](_0x18e2be['where'],{'$or':_[_0x4750('0x2b')](_0x18e2be[_0x4750('0x34')],function(_0x363a0b){var _0x26d2da={};_0x26d2da[_0x363a0b]={'$like':'%'+_0x3a39cb[_0x4750('0x31')][_0x4750('0x3a')]+'%'};return _0x26d2da;})});}_0x18e2be=_['merge']({},_0x18e2be,_0x3a39cb[_0x4750('0x3d')]);return _0x31c9f8[_0x4750('0x4f')](_0x18e2be);}})[_0x4750('0x26')](function(_0x2d7ce5){if(_0x2d7ce5){_0xec2854=_0x2d7ce5[_0x4750('0x4b')];if(!_0x3a39cb[_0x4750('0x31')][_0x4750('0x36')](_0x4750('0x37'))){_0x18e2be[_0x4750('0x1e')]=qs[_0x4750('0x1e')](_0x3a39cb[_0x4750('0x31')][_0x4750('0x1e')]);_0x18e2be[_0x4750('0x1d')]=qs[_0x4750('0x1d')](_0x3a39cb['query'][_0x4750('0x1d')]);}return _0x31c9f8[_0x4750('0x4f')](_0x18e2be);}})[_0x4750('0x26')](function(_0x1fb85a){if(_0x1fb85a){return _0x1fb85a?{'count':_0xec2854,'rows':_0x1fb85a}:null;}})[_0x4750('0x26')](respondWithResult(_0x35dfb0,null))[_0x4750('0x42')](handleError(_0x35dfb0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7470037..4846678 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 _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 +var _0x79b4=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x13558e,_0x1e3ace){var _0x501176=function(_0x3c81e8){while(--_0x3c81e8){_0x13558e['push'](_0x13558e['shift']());}};_0x501176(++_0x1e3ace);}(_0x79b4,0x1b6));var _0x479b=function(_0x112b0a,_0x55ffe6){_0x112b0a=_0x112b0a-0x0;var _0x2a5008=_0x79b4[_0x112b0a];return _0x2a5008;};'use strict';var _=require(_0x479b('0x0'));var util=require(_0x479b('0x1'));var logger=require(_0x479b('0x2'))(_0x479b('0x3'));var moment=require(_0x479b('0x4'));var BPromise=require(_0x479b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x479b('0x6'));var rimraf=require(_0x479b('0x7'));var config=require(_0x479b('0x8'));var attributes=require(_0x479b('0x9'));module[_0x479b('0xa')]=function(_0x97d51d,_0x427aa8){return _0x97d51d[_0x479b('0xb')](_0x479b('0xc'),attributes,{'tableName':_0x479b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index c0bd75f..44a45a8 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 _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 +var _0x552d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x2a560b,_0x328990){var _0x5ea293=function(_0x30e7eb){while(--_0x30e7eb){_0x2a560b['push'](_0x2a560b['shift']());}};_0x5ea293(++_0x328990);}(_0x552d,0x78));var _0xd552=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x552d[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd552('0x0'));var util=require(_0xd552('0x1'));var moment=require(_0xd552('0x2'));var BPromise=require(_0xd552('0x3'));var rs=require(_0xd552('0x4'));var fs=require('fs');var Redis=require(_0xd552('0x5'));var db=require(_0xd552('0x6'))['db'];var utils=require(_0xd552('0x7'));var logger=require(_0xd552('0x8'))(_0xd552('0x9'));var config=require(_0xd552('0xa'));var jayson=require(_0xd552('0xb'));var client=jayson[_0xd552('0xc')][_0xd552('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x393771,_0x140e03,_0x523a09){return new BPromise(function(_0x224ce6,_0x3815d2){return client['request'](_0x393771,_0x523a09)[_0xd552('0xe')](function(_0x2d5d5d){logger[_0xd552('0xf')](_0xd552('0x10'),_0x140e03,_0xd552('0x11'));logger[_0xd552('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x140e03,'request\x20sent',JSON[_0xd552('0x13')](_0x2d5d5d));if(_0x2d5d5d[_0xd552('0x14')]){if(_0x2d5d5d[_0xd552('0x14')][_0xd552('0x15')]===0x1f4){logger[_0xd552('0x14')](_0xd552('0x10'),_0x140e03,_0x2d5d5d['error'][_0xd552('0x16')]);return _0x3815d2(_0x2d5d5d[_0xd552('0x14')]['message']);}logger[_0xd552('0x14')](_0xd552('0x10'),_0x140e03,_0x2d5d5d[_0xd552('0x14')][_0xd552('0x16')]);return _0x224ce6(_0x2d5d5d[_0xd552('0x14')]['message']);}else{logger['info'](_0xd552('0x10'),_0x140e03,_0xd552('0x11'));_0x224ce6(_0x2d5d5d[_0xd552('0x17')][_0xd552('0x16')]);}})['catch'](function(_0x272113){logger[_0xd552('0x14')](_0xd552('0x10'),_0x140e03,_0x272113);_0x3815d2(_0x272113);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e0ac143..4f8d019 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 _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 +var _0x65b3=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x5e0926,_0x5f5ca7){var _0x2ffe9e=function(_0x4f23c2){while(--_0x4f23c2){_0x5e0926['push'](_0x5e0926['shift']());}};_0x2ffe9e(++_0x5f5ca7);}(_0x65b3,0xc6));var _0x365b=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x65b3[_0x50cfc3];return _0x5c11ef;};'use strict';var multer=require(_0x365b('0x0'));var util=require(_0x365b('0x1'));var path=require(_0x365b('0x2'));var timeout=require(_0x365b('0x3'));var express=require(_0x365b('0x4'));var router=express[_0x365b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x365b('0x6'));var interaction=require(_0x365b('0x7'));var config=require(_0x365b('0x8'));var controller=require('./intFreshsalesField.controller');router[_0x365b('0x9')]('/',auth[_0x365b('0xa')](),controller[_0x365b('0xb')]);router['get'](_0x365b('0xc'),auth[_0x365b('0xa')](),controller[_0x365b('0xd')]);router[_0x365b('0xe')]('/',auth[_0x365b('0xa')](),controller['create']);router[_0x365b('0xf')](_0x365b('0xc'),auth[_0x365b('0xa')](),controller[_0x365b('0x10')]);router[_0x365b('0x11')]('/:id',auth[_0x365b('0xa')](),controller[_0x365b('0x12')]);module[_0x365b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index e92984c..5585960 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 _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 +var _0x76bc=['STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x94030f,_0x476ed2){var _0x9f7747=function(_0x2b977a){while(--_0x2b977a){_0x94030f['push'](_0x94030f['shift']());}};_0x9f7747(++_0x476ed2);}(_0x76bc,0x147));var _0xc76b=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x76bc[_0x25c326];return _0x762452;};'use strict';var Sequelize=require(_0xc76b('0x0'));module[_0xc76b('0x1')]={'type':{'type':Sequelize[_0xc76b('0x2')]('string',_0xc76b('0x3'),_0xc76b('0x4'),_0xc76b('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc76b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc76b('0x7'),_0xc76b('0x3'),_0xc76b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc76b('0x6')]},'customField':{'type':Sequelize[_0xc76b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc76b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 505cdd6..226950f 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 _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 +var _0x95f5=['map','FreshsalesField','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','fields','includeAll','options','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index'];(function(_0x1ab597,_0x59629f){var _0xec975e=function(_0x49196c){while(--_0x49196c){_0x1ab597['push'](_0x1ab597['shift']());}};_0xec975e(++_0x59629f);}(_0x95f5,0xad));var _0x595f=function(_0x379019,_0x3d8955){_0x379019=_0x379019-0x0;var _0x319d15=_0x95f5[_0x379019];return _0x319d15;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x595f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x595f('0x1'));var rp=require(_0x595f('0x2'));var moment=require(_0x595f('0x3'));var BPromise=require(_0x595f('0x4'));var Mustache=require(_0x595f('0x5'));var util=require(_0x595f('0x6'));var path=require(_0x595f('0x7'));var sox=require(_0x595f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x595f('0x9'));var _=require(_0x595f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x595f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x595f('0xc'));var Papa=require(_0x595f('0xd'));var Redis=require(_0x595f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x595f('0xf'));var as=require(_0x595f('0x10'));var hardwareService=require(_0x595f('0x11'));var logger=require(_0x595f('0x12'))(_0x595f('0x13'));var utils=require(_0x595f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x595f('0x15'))['db'];function respondWithStatusCode(_0x598ef9,_0x37ec66){_0x37ec66=_0x37ec66||0xcc;return function(_0x29338c){if(_0x29338c){return _0x598ef9['sendStatus'](_0x37ec66);}return _0x598ef9['status'](_0x37ec66)['end']();};}function respondWithResult(_0x4c6792,_0x4ed95d){_0x4ed95d=_0x4ed95d||0xc8;return function(_0x41c4e5){if(_0x41c4e5){return _0x4c6792[_0x595f('0x16')](_0x4ed95d)[_0x595f('0x17')](_0x41c4e5);}};}function respondWithFilteredResult(_0x1d4c78,_0x57d702){return function(_0x187722){if(_0x187722){var _0x4174a0=typeof _0x57d702[_0x595f('0x18')]===_0x595f('0x19')&&typeof _0x57d702[_0x595f('0x1a')]===_0x595f('0x19');var _0x3f9e48=_0x187722[_0x595f('0x1b')];var _0x34fd28=_0x4174a0?0x0:_0x57d702[_0x595f('0x18')];var _0x57e8cf=_0x4174a0?_0x187722[_0x595f('0x1b')]:_0x57d702['offset']+_0x57d702[_0x595f('0x1a')];var _0x4aba81;if(_0x57e8cf>=_0x3f9e48){_0x57e8cf=_0x3f9e48;_0x4aba81=0xc8;}else{_0x4aba81=0xce;}_0x1d4c78['status'](_0x4aba81);return _0x1d4c78[_0x595f('0x1c')](_0x595f('0x1d'),_0x34fd28+'-'+_0x57e8cf+'/'+_0x3f9e48)['json'](_0x187722);}return null;};}function patchUpdates(_0x170d67){return function(_0x23b31f){try{jsonpatch[_0x595f('0x1e')](_0x23b31f,_0x170d67,!![]);}catch(_0x1c8c1f){return BPromise[_0x595f('0x1f')](_0x1c8c1f);}return _0x23b31f[_0x595f('0x20')]();};}function saveUpdates(_0x5a943a,_0x168f16){return function(_0x1e2081){if(_0x1e2081){return _0x1e2081[_0x595f('0x21')](_0x5a943a)[_0x595f('0x22')](function(_0x5aa773){return _0x5aa773;});}return null;};}function removeEntity(_0x10a7e2,_0x22d997){return function(_0x1fabb4){if(_0x1fabb4){return _0x1fabb4[_0x595f('0x23')]()[_0x595f('0x22')](function(){_0x10a7e2[_0x595f('0x16')](0xcc)[_0x595f('0x24')]();});}};}function handleEntityNotFound(_0x26f7f2,_0x40d403){return function(_0x5ca107){if(!_0x5ca107){_0x26f7f2[_0x595f('0x25')](0x194);}return _0x5ca107;};}function handleError(_0x96ab60,_0x4daefd){_0x4daefd=_0x4daefd||0x1f4;return function(_0x20f8c3){logger[_0x595f('0x26')](_0x20f8c3[_0x595f('0x27')]);if(_0x20f8c3[_0x595f('0x28')]){delete _0x20f8c3[_0x595f('0x28')];}_0x96ab60[_0x595f('0x16')](_0x4daefd)[_0x595f('0x29')](_0x20f8c3);};}exports[_0x595f('0x2a')]=function(_0x17b94d,_0x421d62){var _0x296539={},_0x425868={},_0x27d5e0={'count':0x0,'rows':[]};var _0x3cce57=_[_0x595f('0x2b')](db[_0x595f('0x2c')][_0x595f('0x2d')],function(_0x2c4af4){return{'name':_0x2c4af4['fieldName'],'type':_0x2c4af4['type'][_0x595f('0x2e')]};});_0x425868[_0x595f('0x2f')]=_[_0x595f('0x2b')](_0x3cce57,'name');_0x425868[_0x595f('0x30')]=_[_0x595f('0x31')](_0x17b94d[_0x595f('0x30')]);_0x425868[_0x595f('0x32')]=_[_0x595f('0x33')](_0x425868[_0x595f('0x2f')],_0x425868[_0x595f('0x30')]);_0x296539['attributes']=_[_0x595f('0x33')](_0x425868[_0x595f('0x2f')],qs['fields'](_0x17b94d['query']['fields']));_0x296539[_0x595f('0x34')]=_0x296539[_0x595f('0x34')][_0x595f('0x35')]?_0x296539['attributes']:_0x425868['model'];if(!_0x17b94d['query'][_0x595f('0x36')]('nolimit')){_0x296539[_0x595f('0x1a')]=qs[_0x595f('0x1a')](_0x17b94d[_0x595f('0x30')][_0x595f('0x1a')]);_0x296539[_0x595f('0x18')]=qs[_0x595f('0x18')](_0x17b94d[_0x595f('0x30')]['offset']);}_0x296539['order']=qs[_0x595f('0x37')](_0x17b94d[_0x595f('0x30')][_0x595f('0x37')]);_0x296539[_0x595f('0x38')]=qs[_0x595f('0x32')](_[_0x595f('0x39')](_0x17b94d[_0x595f('0x30')],_0x425868[_0x595f('0x32')]),_0x3cce57);if(_0x17b94d[_0x595f('0x30')][_0x595f('0x3a')]){_0x296539[_0x595f('0x38')]=_[_0x595f('0x3b')](_0x296539[_0x595f('0x38')],{'$or':_[_0x595f('0x2b')](_0x3cce57,function(_0x57cd50){if(_0x57cd50['type']!==_0x595f('0x3c')){var _0x254c7c={};_0x254c7c[_0x57cd50['name']]={'$like':'%'+_0x17b94d[_0x595f('0x30')][_0x595f('0x3a')]+'%'};return _0x254c7c;}})});}_0x296539=_[_0x595f('0x3b')]({},_0x296539,_0x17b94d['options']);var _0xce64e2={'where':_0x296539[_0x595f('0x38')]};return db[_0x595f('0x2c')][_0x595f('0x1b')](_0xce64e2)['then'](function(_0x3c4706){_0x27d5e0[_0x595f('0x1b')]=_0x3c4706;if(_0x17b94d[_0x595f('0x30')]['includeAll']){_0x296539[_0x595f('0x3d')]=[{'all':!![]}];}return db[_0x595f('0x2c')][_0x595f('0x3e')](_0x296539);})[_0x595f('0x22')](function(_0x2b2309){_0x27d5e0[_0x595f('0x3f')]=_0x2b2309;return _0x27d5e0;})['then'](respondWithFilteredResult(_0x421d62,_0x296539))[_0x595f('0x40')](handleError(_0x421d62,null));};exports[_0x595f('0x41')]=function(_0xd9cc45,_0x12c9c5){var _0x54f840={'raw':!![],'where':{'id':_0xd9cc45[_0x595f('0x42')]['id']}},_0x313bfc={};_0x313bfc[_0x595f('0x2f')]=_[_0x595f('0x31')](db[_0x595f('0x2c')][_0x595f('0x2d')]);_0x313bfc[_0x595f('0x30')]=_[_0x595f('0x31')](_0xd9cc45['query']);_0x313bfc['filters']=_[_0x595f('0x33')](_0x313bfc[_0x595f('0x2f')],_0x313bfc[_0x595f('0x30')]);_0x54f840[_0x595f('0x34')]=_['intersection'](_0x313bfc[_0x595f('0x2f')],qs['fields'](_0xd9cc45[_0x595f('0x30')][_0x595f('0x43')]));_0x54f840['attributes']=_0x54f840['attributes'][_0x595f('0x35')]?_0x54f840[_0x595f('0x34')]:_0x313bfc['model'];if(_0xd9cc45[_0x595f('0x30')][_0x595f('0x44')]){_0x54f840[_0x595f('0x3d')]=[{'all':!![]}];}_0x54f840=_[_0x595f('0x3b')]({},_0x54f840,_0xd9cc45[_0x595f('0x45')]);return db[_0x595f('0x2c')]['find'](_0x54f840)[_0x595f('0x22')](handleEntityNotFound(_0x12c9c5,null))[_0x595f('0x22')](respondWithResult(_0x12c9c5,null))[_0x595f('0x40')](handleError(_0x12c9c5,null));};exports['create']=function(_0x43e436,_0x1a8327){return db[_0x595f('0x2c')]['create'](_0x43e436[_0x595f('0x46')],{})[_0x595f('0x22')](respondWithResult(_0x1a8327,0xc9))[_0x595f('0x40')](handleError(_0x1a8327,null));};exports['update']=function(_0x57699f,_0x4b3a60){if(_0x57699f[_0x595f('0x46')]['id']){delete _0x57699f[_0x595f('0x46')]['id'];}return db[_0x595f('0x2c')][_0x595f('0x47')]({'where':{'id':_0x57699f['params']['id']}})[_0x595f('0x22')](handleEntityNotFound(_0x4b3a60,null))[_0x595f('0x22')](saveUpdates(_0x57699f[_0x595f('0x46')],null))[_0x595f('0x22')](respondWithResult(_0x4b3a60,null))[_0x595f('0x40')](handleError(_0x4b3a60,null));};exports[_0x595f('0x23')]=function(_0x1c7f18,_0xfc5478){return db[_0x595f('0x2c')][_0x595f('0x47')]({'where':{'id':_0x1c7f18[_0x595f('0x42')]['id']}})[_0x595f('0x22')](handleEntityNotFound(_0xfc5478,null))[_0x595f('0x22')](removeEntity(_0xfc5478,null))[_0x595f('0x40')](handleError(_0xfc5478,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7a538ce..af01cc5 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 _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 +var _0x48bc=['define','FreshsalesField','freshsales_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes'];(function(_0x909fbd,_0x3968fc){var _0x2e43cb=function(_0x1b4ec4){while(--_0x1b4ec4){_0x909fbd['push'](_0x909fbd['shift']());}};_0x2e43cb(++_0x3968fc);}(_0x48bc,0x1b6));var _0xc48b=function(_0xdf071c,_0x2581e7){_0xdf071c=_0xdf071c-0x0;var _0x2677d4=_0x48bc[_0xdf071c];return _0x2677d4;};'use strict';var _=require(_0xc48b('0x0'));var util=require(_0xc48b('0x1'));var logger=require(_0xc48b('0x2'))('api');var moment=require(_0xc48b('0x3'));var BPromise=require(_0xc48b('0x4'));var rp=require(_0xc48b('0x5'));var fs=require('fs');var path=require(_0xc48b('0x6'));var rimraf=require(_0xc48b('0x7'));var config=require(_0xc48b('0x8'));var attributes=require(_0xc48b('0x9'));module['exports']=function(_0x221555,_0x4c001c){return _0x221555[_0xc48b('0xa')](_0xc48b('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xc48b('0xc'),'fields':['idField',_0xc48b('0xd')],'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 b170459..1227da0 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 _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 +var _0x5d17=['request','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x24e8db,_0x89fc47){var _0x576cc1=function(_0x58f214){while(--_0x58f214){_0x24e8db['push'](_0x24e8db['shift']());}};_0x576cc1(++_0x89fc47);}(_0x5d17,0x114));var _0x75d1=function(_0x416a38,_0x5004e0){_0x416a38=_0x416a38-0x0;var _0xec6c28=_0x5d17[_0x416a38];return _0xec6c28;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 4f6246d..4539949 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(_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 +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x156e37,_0x5b8321){var _0x163cad=function(_0x3bf2a2){while(--_0x3bf2a2){_0x156e37['push'](_0x156e37['shift']());}};_0x163cad(++_0x5b8321);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 919d3d9..3cdab53 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 _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 +var _0x1399=['STRING','username','integrationTab','newTab','sequelize','exports'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x1399,0x16c));var _0x9139=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x1399[_0xd336fa];return _0x3370b1;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'remoteUri':{'type':Sequelize[_0x9139('0x2')]},'password':{'type':Sequelize[_0x9139('0x2')]},'clientId':{'type':Sequelize[_0x9139('0x2')]},'clientSecret':{'type':Sequelize[_0x9139('0x2')]},'securityToken':{'type':Sequelize[_0x9139('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9139('0x4'),_0x9139('0x5')),'defaultValue':_0x9139('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 5bf45bc..db46ad0 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 _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 +var _0x78b8=['password','securityToken','isNil','ticketType','describe','ActivityDate','IsRecurrence','Subject','Description','string','boolean','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','name','index','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','update','SalesforceConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','clientSecret','username','remoteUri','slice','substring','Connection','login'];(function(_0x53fd84,_0x319597){var _0x3c7f84=function(_0x125d13){while(--_0x125d13){_0x53fd84['push'](_0x53fd84['shift']());}};_0x3c7f84(++_0x319597);}(_0x78b8,0x1f3));var _0x878b=function(_0x3751ee,_0x53eeb4){_0x3751ee=_0x3751ee-0x0;var _0x3fbefd=_0x78b8[_0x3751ee];return _0x3fbefd;};'use strict';var emlformat=require(_0x878b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x878b('0x1'));var rp=require('request-promise');var moment=require(_0x878b('0x2'));var BPromise=require(_0x878b('0x3'));var Mustache=require(_0x878b('0x4'));var util=require(_0x878b('0x5'));var path=require(_0x878b('0x6'));var sox=require(_0x878b('0x7'));var csv=require(_0x878b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x878b('0x9'));var squel=require(_0x878b('0xa'));var crypto=require(_0x878b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x878b('0xc'));var toCsv=require(_0x878b('0x8'));var querystring=require(_0x878b('0xd'));var Papa=require(_0x878b('0xe'));var Redis=require(_0x878b('0xf'));var authService=require(_0x878b('0x10'));var qs=require(_0x878b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x878b('0x12'))(_0x878b('0x13'));var utils=require(_0x878b('0x14'));var config=require(_0x878b('0x15'));var licenseUtil=require(_0x878b('0x16'));var db=require(_0x878b('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2cc409,_0x2d4c4c){_0x2d4c4c=_0x2d4c4c||0xcc;return function(_0x57b4ac){if(_0x57b4ac){return _0x2cc409[_0x878b('0x18')](_0x2d4c4c);}return _0x2cc409['status'](_0x2d4c4c)[_0x878b('0x19')]();};}function respondWithResult(_0x528f96,_0x25bfd8){_0x25bfd8=_0x25bfd8||0xc8;return function(_0x56e364){if(_0x56e364){return _0x528f96[_0x878b('0x1a')](_0x25bfd8)[_0x878b('0x1b')](_0x56e364);}};}function respondWithFilteredResult(_0x2d9971,_0x3e7707){return function(_0x4a4a3d){if(_0x4a4a3d){var _0x49e4f1=typeof _0x3e7707[_0x878b('0x1c')]===_0x878b('0x1d')&&typeof _0x3e7707[_0x878b('0x1e')]===_0x878b('0x1d');var _0x2fde2b=_0x4a4a3d[_0x878b('0x1f')];var _0x211f08=_0x49e4f1?0x0:_0x3e7707[_0x878b('0x1c')];var _0x242f28=_0x49e4f1?_0x4a4a3d[_0x878b('0x1f')]:_0x3e7707['offset']+_0x3e7707[_0x878b('0x1e')];var _0x18e85f;if(_0x242f28>=_0x2fde2b){_0x242f28=_0x2fde2b;_0x18e85f=0xc8;}else{_0x18e85f=0xce;}_0x2d9971[_0x878b('0x1a')](_0x18e85f);return _0x2d9971[_0x878b('0x20')]('Content-Range',_0x211f08+'-'+_0x242f28+'/'+_0x2fde2b)[_0x878b('0x1b')](_0x4a4a3d);}return null;};}function patchUpdates(_0x56eb54){return function(_0x1ddf0c){try{jsonpatch[_0x878b('0x21')](_0x1ddf0c,_0x56eb54,!![]);}catch(_0x55bf21){return BPromise[_0x878b('0x22')](_0x55bf21);}return _0x1ddf0c[_0x878b('0x23')]();};}function saveUpdates(_0x1109e8,_0x2114c0){return function(_0x3a8bf6){if(_0x3a8bf6){return _0x3a8bf6['update'](_0x1109e8)['then'](function(_0x2badf2){return _0x2badf2;});}return null;};}function removeEntity(_0x380563,_0x4fe6fc){return function(_0x31e8be){if(_0x31e8be){return _0x31e8be[_0x878b('0x24')]()[_0x878b('0x25')](function(){_0x380563[_0x878b('0x1a')](0xcc)[_0x878b('0x19')]();});}};}function handleEntityNotFound(_0x223a1d,_0x30a634){return function(_0x5c4b5e){if(!_0x5c4b5e){_0x223a1d['sendStatus'](0x194);}return _0x5c4b5e;};}function handleError(_0x122ce8,_0x31a9b3){_0x31a9b3=_0x31a9b3||0x1f4;return function(_0x2406eb){logger[_0x878b('0x26')](_0x2406eb['stack']);if(_0x2406eb[_0x878b('0x27')]){delete _0x2406eb[_0x878b('0x27')];}_0x122ce8[_0x878b('0x1a')](_0x31a9b3)['send'](_0x2406eb);};}exports[_0x878b('0x28')]=function(_0x23e4d6,_0x3681f2){var _0x5caa1f={},_0x33c260={},_0x18ce8f={'count':0x0,'rows':[]};var _0x36bf1a=_[_0x878b('0x29')](db[_0x878b('0x2a')][_0x878b('0x2b')],function(_0x249750){return{'name':_0x249750['fieldName'],'type':_0x249750[_0x878b('0x2c')][_0x878b('0x2d')]};});_0x33c260[_0x878b('0x2e')]=_[_0x878b('0x29')](_0x36bf1a,_0x878b('0x27'));_0x33c260[_0x878b('0x2f')]=_[_0x878b('0x30')](_0x23e4d6[_0x878b('0x2f')]);_0x33c260['filters']=_[_0x878b('0x31')](_0x33c260[_0x878b('0x2e')],_0x33c260[_0x878b('0x2f')]);_0x5caa1f['attributes']=_['intersection'](_0x33c260[_0x878b('0x2e')],qs[_0x878b('0x32')](_0x23e4d6['query'][_0x878b('0x32')]));_0x5caa1f[_0x878b('0x33')]=_0x5caa1f[_0x878b('0x33')][_0x878b('0x34')]?_0x5caa1f['attributes']:_0x33c260[_0x878b('0x2e')];if(!_0x23e4d6[_0x878b('0x2f')][_0x878b('0x35')](_0x878b('0x36'))){_0x5caa1f[_0x878b('0x1e')]=qs['limit'](_0x23e4d6[_0x878b('0x2f')]['limit']);_0x5caa1f[_0x878b('0x1c')]=qs[_0x878b('0x1c')](_0x23e4d6[_0x878b('0x2f')][_0x878b('0x1c')]);}_0x5caa1f[_0x878b('0x37')]=qs[_0x878b('0x38')](_0x23e4d6[_0x878b('0x2f')][_0x878b('0x38')]);_0x5caa1f['where']=qs['filters'](_[_0x878b('0x39')](_0x23e4d6['query'],_0x33c260[_0x878b('0x3a')]),_0x36bf1a);if(_0x23e4d6[_0x878b('0x2f')][_0x878b('0x3b')]){_0x5caa1f['where']=_[_0x878b('0x3c')](_0x5caa1f[_0x878b('0x3d')],{'$or':_[_0x878b('0x29')](_0x36bf1a,function(_0x46f277){if(_0x46f277[_0x878b('0x2c')]!==_0x878b('0x3e')){var _0x4978f9={};_0x4978f9[_0x46f277['name']]={'$like':'%'+_0x23e4d6[_0x878b('0x2f')][_0x878b('0x3b')]+'%'};return _0x4978f9;}})});}_0x5caa1f=_['merge']({},_0x5caa1f,_0x23e4d6[_0x878b('0x3f')]);var _0x2f8778={'where':_0x5caa1f[_0x878b('0x3d')]};return db['SalesforceAccount'][_0x878b('0x1f')](_0x2f8778)[_0x878b('0x25')](function(_0x1e46ee){_0x18ce8f['count']=_0x1e46ee;if(_0x23e4d6[_0x878b('0x2f')]['includeAll']){_0x5caa1f[_0x878b('0x40')]=[{'all':!![]}];}return db[_0x878b('0x2a')][_0x878b('0x41')](_0x5caa1f);})['then'](function(_0x4545b6){_0x18ce8f[_0x878b('0x42')]=_0x4545b6;return _0x18ce8f;})['then'](respondWithFilteredResult(_0x3681f2,_0x5caa1f))[_0x878b('0x43')](handleError(_0x3681f2,null));};exports['show']=function(_0x498c43,_0x3cf49b){var _0x199fb0={'raw':![],'where':{'id':_0x498c43[_0x878b('0x44')]['id']}},_0x570f0d={};_0x570f0d['model']=_[_0x878b('0x30')](db[_0x878b('0x2a')][_0x878b('0x2b')]);_0x570f0d[_0x878b('0x2f')]=_[_0x878b('0x30')](_0x498c43['query']);_0x570f0d[_0x878b('0x3a')]=_[_0x878b('0x31')](_0x570f0d[_0x878b('0x2e')],_0x570f0d[_0x878b('0x2f')]);_0x199fb0[_0x878b('0x33')]=_[_0x878b('0x31')](_0x570f0d[_0x878b('0x2e')],qs['fields'](_0x498c43[_0x878b('0x2f')][_0x878b('0x32')]));_0x199fb0[_0x878b('0x33')]=_0x199fb0['attributes'][_0x878b('0x34')]?_0x199fb0[_0x878b('0x33')]:_0x570f0d[_0x878b('0x2e')];if(_0x498c43[_0x878b('0x2f')]['includeAll']){_0x199fb0['include']=[{'all':!![]}];}_0x199fb0=_[_0x878b('0x3c')]({},_0x199fb0,_0x498c43[_0x878b('0x3f')]);return db[_0x878b('0x2a')][_0x878b('0x45')](_0x199fb0)[_0x878b('0x25')](handleEntityNotFound(_0x3cf49b,null))[_0x878b('0x25')](respondWithResult(_0x3cf49b,null))[_0x878b('0x43')](handleError(_0x3cf49b,null));};exports[_0x878b('0x46')]=function(_0x564afa,_0x463793){return db[_0x878b('0x2a')]['create'](_0x564afa[_0x878b('0x47')],{})['then'](respondWithResult(_0x463793,0xc9))[_0x878b('0x43')](handleError(_0x463793,null));};exports[_0x878b('0x48')]=function(_0x541f6e,_0x46d3ef){if(_0x541f6e[_0x878b('0x47')]['id']){delete _0x541f6e[_0x878b('0x47')]['id'];}return db[_0x878b('0x2a')][_0x878b('0x45')]({'where':{'id':_0x541f6e['params']['id']}})[_0x878b('0x25')](handleEntityNotFound(_0x46d3ef,null))[_0x878b('0x25')](saveUpdates(_0x541f6e[_0x878b('0x47')],null))[_0x878b('0x25')](respondWithResult(_0x46d3ef,null))['catch'](handleError(_0x46d3ef,null));};exports['destroy']=function(_0x11b274,_0x29d59a){return db[_0x878b('0x2a')][_0x878b('0x45')]({'where':{'id':_0x11b274[_0x878b('0x44')]['id']}})[_0x878b('0x25')](handleEntityNotFound(_0x29d59a,null))[_0x878b('0x25')](removeEntity(_0x29d59a,null))[_0x878b('0x43')](handleError(_0x29d59a,null));};exports['getConfigurations']=function(_0x27e6a9,_0x44e567,_0x37a5d8){var _0x4f8f76={};var _0x4e689c={};var _0x3fc1ed;var _0x10e293;return db[_0x878b('0x2a')]['findOne']({'where':{'id':_0x27e6a9[_0x878b('0x44')]['id']}})['then'](handleEntityNotFound(_0x44e567,null))[_0x878b('0x25')](function(_0x173913){if(_0x173913){_0x3fc1ed=_0x173913;_0x4e689c[_0x878b('0x2e')]=_[_0x878b('0x30')](db[_0x878b('0x49')][_0x878b('0x2b')]);_0x4e689c['query']=_[_0x878b('0x30')](_0x27e6a9[_0x878b('0x2f')]);_0x4e689c[_0x878b('0x3a')]=_[_0x878b('0x31')](_0x4e689c[_0x878b('0x2e')],_0x4e689c['query']);_0x4f8f76[_0x878b('0x33')]=_[_0x878b('0x31')](_0x4e689c[_0x878b('0x2e')],qs[_0x878b('0x32')](_0x27e6a9['query'][_0x878b('0x32')]));_0x4f8f76['attributes']=_0x4f8f76[_0x878b('0x33')][_0x878b('0x34')]?_0x4f8f76[_0x878b('0x33')]:_0x4e689c[_0x878b('0x2e')];_0x4f8f76[_0x878b('0x37')]=qs[_0x878b('0x38')](_0x27e6a9[_0x878b('0x2f')][_0x878b('0x38')]);_0x4f8f76[_0x878b('0x3d')]=qs[_0x878b('0x3a')](_[_0x878b('0x39')](_0x27e6a9['query'],_0x4e689c['filters']));if(_0x27e6a9['query'][_0x878b('0x3b')]){_0x4f8f76[_0x878b('0x3d')]=_[_0x878b('0x3c')](_0x4f8f76[_0x878b('0x3d')],{'$or':_[_0x878b('0x29')](_0x4f8f76[_0x878b('0x33')],function(_0x50ab51){var _0x27ea48={};_0x27ea48[_0x50ab51]={'$like':'%'+_0x27e6a9['query'][_0x878b('0x3b')]+'%'};return _0x27ea48;})});}_0x4f8f76=_[_0x878b('0x3c')]({},_0x4f8f76,_0x27e6a9[_0x878b('0x3f')]);return _0x3fc1ed['getConfigurations'](_0x4f8f76);}})[_0x878b('0x25')](function(_0x25c08d){if(_0x25c08d){_0x10e293=_0x25c08d[_0x878b('0x34')];if(!_0x27e6a9['query'][_0x878b('0x35')](_0x878b('0x36'))){_0x4f8f76[_0x878b('0x1e')]=qs[_0x878b('0x1e')](_0x27e6a9[_0x878b('0x2f')][_0x878b('0x1e')]);_0x4f8f76[_0x878b('0x1c')]=qs[_0x878b('0x1c')](_0x27e6a9[_0x878b('0x2f')][_0x878b('0x1c')]);}return _0x3fc1ed['getConfigurations'](_0x4f8f76);}})[_0x878b('0x25')](function(_0x1a0519){if(_0x1a0519){return _0x1a0519?{'count':_0x10e293,'rows':_0x1a0519}:null;}})[_0x878b('0x25')](respondWithResult(_0x44e567,null))[_0x878b('0x43')](handleError(_0x44e567,null));};exports['addConfiguration']=function(_0x5b935b,_0x41195d,_0x1a64d1){if(_0x5b935b[_0x878b('0x47')]['id']){delete _0x5b935b[_0x878b('0x47')]['id'];}return db['SalesforceAccount'][_0x878b('0x4a')]({'where':{'id':_0x5b935b['params']['id']}})['then'](handleEntityNotFound(_0x41195d,null))[_0x878b('0x25')](function(_0x52a1ed){if(_0x52a1ed){_0x5b935b[_0x878b('0x47')][_0x878b('0x4b')]=_0x52a1ed['id'];_0x5b935b[_0x878b('0x47')][_0x878b('0x4c')]=integrations[_0x878b('0x4d')](_0x5b935b['body']['channel'],_0x5b935b[_0x878b('0x47')][_0x878b('0x2c')]);_0x5b935b[_0x878b('0x47')][_0x878b('0x4e')]=integrations[_0x878b('0x4f')](_0x5b935b[_0x878b('0x47')][_0x878b('0x50')],_0x5b935b[_0x878b('0x47')]['type']);return db[_0x878b('0x49')][_0x878b('0x46')](_0x5b935b[_0x878b('0x47')],{'include':[{'model':db['SalesforceField'],'as':_0x878b('0x4c')},{'model':db[_0x878b('0x51')],'as':_0x878b('0x4e')}]});}return null;})[_0x878b('0x25')](respondWithResult(_0x41195d,null))[_0x878b('0x43')](handleError(_0x41195d,null));};exports[_0x878b('0x52')]=function(_0x412fe7,_0x3de486,_0x597e25){var _0x4fb1eb;var _0x440508='';var _0x26eb4d=_0x878b('0x53');return db[_0x878b('0x2a')][_0x878b('0x4a')]({'where':{'id':_0x412fe7['params']['id']},'attributes':['id','remoteUri','clientId',_0x878b('0x54'),_0x878b('0x55'),'password','securityToken']})['then'](handleEntityNotFound(_0x3de486,null))[_0x878b('0x25')](function(_0x38ebe5){if(_0x38ebe5){_0x440508=_0x38ebe5[_0x878b('0x56')];var _0x5015a3=_0x440508[_0x878b('0x57')](-0x1);if(_0x5015a3==='/'){_0x440508=_0x440508[_0x878b('0x58')](0x0,_0x440508['lastIndexOf'](_0x5015a3));}_0x4fb1eb=new jsforce[(_0x878b('0x59'))]({'oauth2':{'loginUrl':_0x440508,'clientId':_0x38ebe5['clientId'],'clientSecret':_0x38ebe5[_0x878b('0x54')]}});return _0x4fb1eb[_0x878b('0x5a')](_0x38ebe5['username'],_0x38ebe5[_0x878b('0x5b')]['concat'](_0x38ebe5[_0x878b('0x5c')]));}})[_0x878b('0x25')](function(_0x40848e){if(_0x40848e){if(!_[_0x878b('0x5d')](_0x412fe7[_0x878b('0x2f')][_0x878b('0x5e')])){_0x26eb4d=_0x412fe7['query'][_0x878b('0x5e')];}return _0x4fb1eb['sobject'](_0x26eb4d)[_0x878b('0x5f')]();}})[_0x878b('0x25')](function(_0xb2a010){var _0x45d91f=['OwnerId',_0x878b('0x60'),'IsReminderSet',_0x878b('0x61'),_0x878b('0x62'),_0x878b('0x63')];var _0x469d19=[_0x878b('0x64'),'int','picklist',_0x878b('0x65'),'email',_0x878b('0x66'),_0x878b('0x67')];if(_0xb2a010){_[_0x878b('0x68')](_0xb2a010['fields'],function(_0x3f1850){return _0x45d91f[_0x878b('0x69')](_0x3f1850[_0x878b('0x27')])||!_0x469d19[_0x878b('0x69')](_0x3f1850[_0x878b('0x2c')]);});return{'count':_0xb2a010[_0x878b('0x32')][_0x878b('0x34')],'rows':_[_0x878b('0x29')](_0xb2a010[_0x878b('0x32')],function(_0x3cd81e){return{'id':_0x3cd81e[_0x878b('0x27')],'name':_0x3cd81e[_0x878b('0x6a')],'custom':_0x3cd81e[_0x878b('0x6b')],'options':_0x3cd81e[_0x878b('0x6c')][_0x878b('0x34')]>0x0?_[_0x878b('0x29')](_0x3cd81e[_0x878b('0x6c')],function(_0x47a1ea){return{'name':_0x47a1ea[_0x878b('0x6a')],'value':_0x47a1ea[_0x878b('0x6d')]};}):_0x3cd81e['type']=='boolean'?[{'name':_0x878b('0x6e'),'value':_0x878b('0x6f')},{'name':_0x878b('0x70'),'value':_0x878b('0x71')}]:[]};})};}})['then'](respondWithResult(_0x3de486,null))['catch'](function(_0x1d05cd){var _0x307a17=_0x412fe7['query'][_0x878b('0x72')]?0x1f4:_0x1d05cd[_0x878b('0x73')]||0x1f4;logger[_0x878b('0x26')](_0x878b('0x74'),_0x878b('0x52'),_0x307a17,JSON[_0x878b('0x75')](_0x1d05cd));delete _0x1d05cd[_0x878b('0x27')];if(_0x307a17===0x191){_0x307a17=0x190;}_0x3de486[_0x878b('0x1a')](_0x307a17)['send'](_0x412fe7[_0x878b('0x2f')][_0x878b('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x1d05cd[_0x878b('0x73')]}:_0x1d05cd);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index c4f19a2..3793eef 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 _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 +var _0xd1a6=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','moment','bluebird'];(function(_0x3f6955,_0x88bd71){var _0x3b0e08=function(_0x5b28d9){while(--_0x5b28d9){_0x3f6955['push'](_0x3f6955['shift']());}};_0x3b0e08(++_0x88bd71);}(_0xd1a6,0x176));var _0x6d1a=function(_0x59fffa,_0x5a61db){_0x59fffa=_0x59fffa-0x0;var _0x281d4e=_0xd1a6[_0x59fffa];return _0x281d4e;};'use strict';var _=require('lodash');var util=require(_0x6d1a('0x0'));var logger=require(_0x6d1a('0x1'))('api');var moment=require(_0x6d1a('0x2'));var BPromise=require(_0x6d1a('0x3'));var rp=require(_0x6d1a('0x4'));var fs=require('fs');var path=require(_0x6d1a('0x5'));var rimraf=require(_0x6d1a('0x6'));var config=require(_0x6d1a('0x7'));var attributes=require(_0x6d1a('0x8'));var integrations=require(_0x6d1a('0x9'));module[_0x6d1a('0xa')]=function(_0x7dbe27,_0x2a0c3d){return _0x7dbe27[_0x6d1a('0xb')](_0x6d1a('0xc'),attributes,{'tableName':_0x6d1a('0xd'),'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 38aead7..05541b2 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 _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 +var _0x4fac=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','find','ShowSalesforceAccount'];(function(_0x13e7dc,_0x4c8bdb){var _0x37684f=function(_0x1bb498){while(--_0x1bb498){_0x13e7dc['push'](_0x13e7dc['shift']());}};_0x37684f(++_0x4c8bdb);}(_0x4fac,0xd8));var _0xc4fa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4fac[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xc4fa('0x0'));var moment=require(_0xc4fa('0x1'));var BPromise=require('bluebird');var rs=require(_0xc4fa('0x2'));var fs=require('fs');var Redis=require(_0xc4fa('0x3'));var db=require(_0xc4fa('0x4'))['db'];var utils=require(_0xc4fa('0x5'));var logger=require(_0xc4fa('0x6'))(_0xc4fa('0x7'));var config=require(_0xc4fa('0x8'));var jayson=require(_0xc4fa('0x9'));var client=jayson['client'][_0xc4fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x329116,_0x194194,_0x231f58){return new BPromise(function(_0x2df9d7,_0x1e130a){return client[_0xc4fa('0xb')](_0x329116,_0x231f58)['then'](function(_0x4fc9ab){logger['info'](_0xc4fa('0xc'),_0x194194,_0xc4fa('0xd'));logger[_0xc4fa('0xe')](_0xc4fa('0xf'),_0x194194,'request\x20sent',JSON[_0xc4fa('0x10')](_0x4fc9ab));if(_0x4fc9ab['error']){if(_0x4fc9ab[_0xc4fa('0x11')][_0xc4fa('0x12')]===0x1f4){logger[_0xc4fa('0x11')](_0xc4fa('0xc'),_0x194194,_0x4fc9ab[_0xc4fa('0x11')][_0xc4fa('0x13')]);return _0x1e130a(_0x4fc9ab['error'][_0xc4fa('0x13')]);}logger[_0xc4fa('0x11')](_0xc4fa('0xc'),_0x194194,_0x4fc9ab[_0xc4fa('0x11')][_0xc4fa('0x13')]);return _0x2df9d7(_0x4fc9ab[_0xc4fa('0x11')][_0xc4fa('0x13')]);}else{logger[_0xc4fa('0x14')](_0xc4fa('0xc'),_0x194194,_0xc4fa('0xd'));_0x2df9d7(_0x4fc9ab['result'][_0xc4fa('0x13')]);}})['catch'](function(_0x2b9cd4){logger['error'](_0xc4fa('0xc'),_0x194194,_0x2b9cd4);_0x1e130a(_0x2b9cd4);});});}exports[_0xc4fa('0x15')]=function(_0x146ff5){var _0x1bfa20=this;return new Promise(function(_0x40d8ac,_0xa97b4b){return db[_0xc4fa('0x16')][_0xc4fa('0x17')]({'raw':_0x146ff5[_0xc4fa('0x18')]?_0x146ff5[_0xc4fa('0x18')][_0xc4fa('0x19')]===undefined?!![]:![]:!![],'where':_0x146ff5['options']?_0x146ff5[_0xc4fa('0x18')][_0xc4fa('0x1a')]||null:null,'attributes':_0x146ff5[_0xc4fa('0x18')]?_0x146ff5[_0xc4fa('0x18')][_0xc4fa('0x1b')]||null:null,'limit':_0x146ff5[_0xc4fa('0x18')]?_0x146ff5[_0xc4fa('0x18')][_0xc4fa('0x1c')]||null:null,'include':_0x146ff5[_0xc4fa('0x18')]?_0x146ff5[_0xc4fa('0x18')][_0xc4fa('0x1d')]?_[_0xc4fa('0x1e')](_0x146ff5['options'][_0xc4fa('0x1d')],function(_0x4ebe6c){return{'model':db[_0x4ebe6c['model']],'as':_0x4ebe6c['as'],'attributes':_0x4ebe6c['attributes'],'include':_0x4ebe6c['include']?_[_0xc4fa('0x1e')](_0x4ebe6c[_0xc4fa('0x1d')],function(_0x4dbbf8){return{'model':db[_0x4dbbf8[_0xc4fa('0x1f')]],'as':_0x4dbbf8['as'],'attributes':_0x4dbbf8[_0xc4fa('0x1b')],'include':_0x4dbbf8[_0xc4fa('0x1d')]?_[_0xc4fa('0x1e')](_0x4dbbf8[_0xc4fa('0x1d')],function(_0x932231){return{'model':db[_0x932231[_0xc4fa('0x1f')]],'as':_0x932231['as'],'attributes':_0x932231['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4fa('0x20')](function(_0x483d97){logger[_0xc4fa('0x14')](_0xc4fa('0x15'),_0x146ff5);logger[_0xc4fa('0xe')](_0xc4fa('0x15'),_0x146ff5,JSON[_0xc4fa('0x10')](_0x483d97));_0x40d8ac(_0x483d97);})[_0xc4fa('0x21')](function(_0x3f960a){logger['error'](_0xc4fa('0x15'),_0x3f960a[_0xc4fa('0x13')],_0x146ff5);_0xa97b4b(_0x1bfa20[_0xc4fa('0x11')](0x1f4,_0x3f960a[_0xc4fa('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x21a110){var _0xbee653=this;return new Promise(function(_0x598095,_0x5745a6){return db[_0xc4fa('0x16')][_0xc4fa('0x22')]({'raw':_0x21a110[_0xc4fa('0x18')]?_0x21a110[_0xc4fa('0x18')][_0xc4fa('0x19')]===undefined?!![]:![]:!![],'where':_0x21a110[_0xc4fa('0x18')]?_0x21a110[_0xc4fa('0x18')][_0xc4fa('0x1a')]||null:null,'attributes':_0x21a110[_0xc4fa('0x18')]?_0x21a110[_0xc4fa('0x18')][_0xc4fa('0x1b')]||null:null,'include':_0x21a110[_0xc4fa('0x18')]?_0x21a110[_0xc4fa('0x18')]['include']?_[_0xc4fa('0x1e')](_0x21a110[_0xc4fa('0x18')][_0xc4fa('0x1d')],function(_0x2d1a65){return{'model':db[_0x2d1a65['model']],'as':_0x2d1a65['as'],'attributes':_0x2d1a65[_0xc4fa('0x1b')],'include':_0x2d1a65['include']?_[_0xc4fa('0x1e')](_0x2d1a65[_0xc4fa('0x1d')],function(_0x2c6679){return{'model':db[_0x2c6679[_0xc4fa('0x1f')]],'as':_0x2c6679['as'],'attributes':_0x2c6679[_0xc4fa('0x1b')],'include':_0x2c6679[_0xc4fa('0x1d')]?_[_0xc4fa('0x1e')](_0x2c6679[_0xc4fa('0x1d')],function(_0x50e7c7){return{'model':db[_0x50e7c7[_0xc4fa('0x1f')]],'as':_0x50e7c7['as'],'attributes':_0x50e7c7[_0xc4fa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc4fa('0x20')](function(_0x1819ad){logger['info'](_0xc4fa('0x23'),_0x21a110);logger[_0xc4fa('0xe')](_0xc4fa('0x23'),_0x21a110,JSON[_0xc4fa('0x10')](_0x1819ad));_0x598095(_0x1819ad);})[_0xc4fa('0x21')](function(_0x185dd2){logger[_0xc4fa('0x11')]('ShowSalesforceAccount',_0x185dd2[_0xc4fa('0x13')],_0x21a110);_0x5745a6(_0xbee653[_0xc4fa('0x11')](0x1f4,_0x185dd2[_0xc4fa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6187506..b873212 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_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 +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5111a1,_0x3a42f3){var _0x2af76d=function(_0x1d79b8){while(--_0x1d79b8){_0x5111a1['push'](_0x5111a1['shift']());}};_0x2af76d(++_0x3a42f3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f9ba859..4045cfd 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 _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 +var _0xc479=['account','nothing','sequelize','exports','STRING','Task','Case','ENUM','contact_lead','contact','lead','account_contact_lead'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xc479,0x182));var _0x9c47=function(_0x3cf750,_0x347dee){_0x3cf750=_0x3cf750-0x0;var _0x5ca79e=_0xc479[_0x3cf750];return _0x5ca79e;};'use strict';var Sequelize=require(_0x9c47('0x0'));module[_0x9c47('0x1')]={'name':{'type':Sequelize[_0x9c47('0x2')]},'description':{'type':Sequelize[_0x9c47('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x9c47('0x3'),_0x9c47('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x9c47('0x5')](_0x9c47('0x6'),_0x9c47('0x7'),_0x9c47('0x8'),_0x9c47('0x9'),_0x9c47('0xa')),'defaultValue':_0x9c47('0x6')},'moduleCreate':{'type':Sequelize[_0x9c47('0x5')](_0x9c47('0xb'),_0x9c47('0x7'),_0x9c47('0x8'),'account'),'defaultValue':_0x9c47('0x8')},'leadId':{'type':Sequelize[_0x9c47('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x9c47('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x9c47('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index eca014c..3e5f509 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 _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 +var _0xbdf3=['fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','getFields','SalesforceField','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection'];(function(_0x20138f,_0x7b2b26){var _0x4f258=function(_0x4352c0){while(--_0x4352c0){_0x20138f['push'](_0x20138f['shift']());}};_0x4f258(++_0x7b2b26);}(_0xbdf3,0x10a));var _0x3bdf=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0xbdf3[_0x38622b];return _0x2c1a7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bdf('0x0'));var zipdir=require(_0x3bdf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3bdf('0x2'));var moment=require('moment');var BPromise=require(_0x3bdf('0x3'));var Mustache=require(_0x3bdf('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3bdf('0x5'));var csv=require(_0x3bdf('0x6'));var ejs=require(_0x3bdf('0x7'));var fs=require('fs');var fs_extra=require(_0x3bdf('0x8'));var _=require(_0x3bdf('0x9'));var squel=require('squel');var crypto=require(_0x3bdf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3bdf('0xb'));var toCsv=require(_0x3bdf('0x6'));var querystring=require(_0x3bdf('0xc'));var Papa=require(_0x3bdf('0xd'));var Redis=require(_0x3bdf('0xe'));var authService=require(_0x3bdf('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3bdf('0x10'));var logger=require(_0x3bdf('0x11'))(_0x3bdf('0x12'));var utils=require(_0x3bdf('0x13'));var config=require(_0x3bdf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419fd7,_0x51a88f){_0x51a88f=_0x51a88f||0xcc;return function(_0x4237d1){if(_0x4237d1){return _0x419fd7['sendStatus'](_0x51a88f);}return _0x419fd7['status'](_0x51a88f)[_0x3bdf('0x15')]();};}function respondWithResult(_0x66026b,_0x38a735){_0x38a735=_0x38a735||0xc8;return function(_0x4b3cda){if(_0x4b3cda){return _0x66026b[_0x3bdf('0x16')](_0x38a735)[_0x3bdf('0x17')](_0x4b3cda);}};}function respondWithFilteredResult(_0x2e15a1,_0x373708){return function(_0x2847fd){if(_0x2847fd){var _0x3ca17a=typeof _0x373708[_0x3bdf('0x18')]===_0x3bdf('0x19')&&typeof _0x373708[_0x3bdf('0x1a')]===_0x3bdf('0x19');var _0x38fa8a=_0x2847fd[_0x3bdf('0x1b')];var _0x51b247=_0x3ca17a?0x0:_0x373708[_0x3bdf('0x18')];var _0x16f3aa=_0x3ca17a?_0x2847fd[_0x3bdf('0x1b')]:_0x373708[_0x3bdf('0x18')]+_0x373708['limit'];var _0x3fd8ef;if(_0x16f3aa>=_0x38fa8a){_0x16f3aa=_0x38fa8a;_0x3fd8ef=0xc8;}else{_0x3fd8ef=0xce;}_0x2e15a1[_0x3bdf('0x16')](_0x3fd8ef);return _0x2e15a1[_0x3bdf('0x1c')](_0x3bdf('0x1d'),_0x51b247+'-'+_0x16f3aa+'/'+_0x38fa8a)['json'](_0x2847fd);}return null;};}function patchUpdates(_0x1fe112){return function(_0x1762c4){try{jsonpatch[_0x3bdf('0x1e')](_0x1762c4,_0x1fe112,!![]);}catch(_0x4cefd9){return BPromise[_0x3bdf('0x1f')](_0x4cefd9);}return _0x1762c4[_0x3bdf('0x20')]();};}function saveUpdates(_0x5248ba,_0xd18285){return function(_0x23ab3c){if(_0x23ab3c){return _0x23ab3c[_0x3bdf('0x21')](_0x5248ba)[_0x3bdf('0x22')](function(_0x2900c1){return _0x2900c1;});}return null;};}function removeEntity(_0x48951d,_0x173d2b){return function(_0x2bc07d){if(_0x2bc07d){return _0x2bc07d[_0x3bdf('0x23')]()[_0x3bdf('0x22')](function(){_0x48951d[_0x3bdf('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7495f4,_0x59869d){return function(_0x541f97){if(!_0x541f97){_0x7495f4[_0x3bdf('0x24')](0x194);}return _0x541f97;};}function handleError(_0x14d6c5,_0x3892f8){_0x3892f8=_0x3892f8||0x1f4;return function(_0x453427){logger['error'](_0x453427[_0x3bdf('0x25')]);if(_0x453427[_0x3bdf('0x26')]){delete _0x453427[_0x3bdf('0x26')];}_0x14d6c5['status'](_0x3892f8)[_0x3bdf('0x27')](_0x453427);};}exports[_0x3bdf('0x28')]=function(_0x1298b9,_0x175bd7){var _0x49966f={},_0x40c95b={},_0x511e7b={'count':0x0,'rows':[]};var _0x527bf2=_[_0x3bdf('0x29')](db[_0x3bdf('0x2a')][_0x3bdf('0x2b')],function(_0x56387c){return{'name':_0x56387c[_0x3bdf('0x2c')],'type':_0x56387c[_0x3bdf('0x2d')]['key']};});_0x40c95b[_0x3bdf('0x2e')]=_['map'](_0x527bf2,_0x3bdf('0x26'));_0x40c95b[_0x3bdf('0x2f')]=_['keys'](_0x1298b9[_0x3bdf('0x2f')]);_0x40c95b[_0x3bdf('0x30')]=_['intersection'](_0x40c95b['model'],_0x40c95b[_0x3bdf('0x2f')]);_0x49966f['attributes']=_[_0x3bdf('0x31')](_0x40c95b[_0x3bdf('0x2e')],qs[_0x3bdf('0x32')](_0x1298b9['query'][_0x3bdf('0x32')]));_0x49966f[_0x3bdf('0x33')]=_0x49966f[_0x3bdf('0x33')]['length']?_0x49966f[_0x3bdf('0x33')]:_0x40c95b['model'];if(!_0x1298b9['query'][_0x3bdf('0x34')]('nolimit')){_0x49966f[_0x3bdf('0x1a')]=qs[_0x3bdf('0x1a')](_0x1298b9[_0x3bdf('0x2f')]['limit']);_0x49966f['offset']=qs[_0x3bdf('0x18')](_0x1298b9[_0x3bdf('0x2f')]['offset']);}_0x49966f[_0x3bdf('0x35')]=qs[_0x3bdf('0x36')](_0x1298b9[_0x3bdf('0x2f')][_0x3bdf('0x36')]);_0x49966f[_0x3bdf('0x37')]=qs[_0x3bdf('0x30')](_[_0x3bdf('0x38')](_0x1298b9['query'],_0x40c95b[_0x3bdf('0x30')]),_0x527bf2);if(_0x1298b9['query'][_0x3bdf('0x39')]){_0x49966f['where']=_['merge'](_0x49966f['where'],{'$or':_['map'](_0x527bf2,function(_0x4633c9){if(_0x4633c9[_0x3bdf('0x2d')]!==_0x3bdf('0x3a')){var _0x30e4ae={};_0x30e4ae[_0x4633c9['name']]={'$like':'%'+_0x1298b9['query']['filter']+'%'};return _0x30e4ae;}})});}_0x49966f=_[_0x3bdf('0x3b')]({},_0x49966f,_0x1298b9[_0x3bdf('0x3c')]);var _0x3bde1a={'where':_0x49966f[_0x3bdf('0x37')]};return db[_0x3bdf('0x2a')][_0x3bdf('0x1b')](_0x3bde1a)[_0x3bdf('0x22')](function(_0x44e2a6){_0x511e7b[_0x3bdf('0x1b')]=_0x44e2a6;if(_0x1298b9[_0x3bdf('0x2f')][_0x3bdf('0x3d')]){_0x49966f[_0x3bdf('0x3e')]=[{'all':!![]}];}return db[_0x3bdf('0x2a')][_0x3bdf('0x3f')](_0x49966f);})[_0x3bdf('0x22')](function(_0x1fedfc){_0x511e7b[_0x3bdf('0x40')]=_0x1fedfc;return _0x511e7b;})['then'](respondWithFilteredResult(_0x175bd7,_0x49966f))[_0x3bdf('0x41')](handleError(_0x175bd7,null));};exports[_0x3bdf('0x42')]=function(_0xfc2e0e,_0x482fee){var _0x327501={'raw':![],'where':{'id':_0xfc2e0e[_0x3bdf('0x43')]['id']}},_0x46d6b7={};_0x46d6b7[_0x3bdf('0x2e')]=_[_0x3bdf('0x44')](db['SalesforceConfiguration'][_0x3bdf('0x2b')]);_0x46d6b7[_0x3bdf('0x2f')]=_[_0x3bdf('0x44')](_0xfc2e0e['query']);_0x46d6b7[_0x3bdf('0x30')]=_[_0x3bdf('0x31')](_0x46d6b7[_0x3bdf('0x2e')],_0x46d6b7[_0x3bdf('0x2f')]);_0x327501['attributes']=_[_0x3bdf('0x31')](_0x46d6b7['model'],qs[_0x3bdf('0x32')](_0xfc2e0e[_0x3bdf('0x2f')]['fields']));_0x327501['attributes']=_0x327501[_0x3bdf('0x33')][_0x3bdf('0x45')]?_0x327501[_0x3bdf('0x33')]:_0x46d6b7[_0x3bdf('0x2e')];if(_0xfc2e0e[_0x3bdf('0x2f')]['includeAll']){_0x327501[_0x3bdf('0x3e')]=[{'all':!![]}];}_0x327501=_[_0x3bdf('0x3b')]({},_0x327501,_0xfc2e0e[_0x3bdf('0x3c')]);return db[_0x3bdf('0x2a')][_0x3bdf('0x46')](_0x327501)[_0x3bdf('0x22')](handleEntityNotFound(_0x482fee,null))[_0x3bdf('0x22')](respondWithResult(_0x482fee,null))[_0x3bdf('0x41')](handleError(_0x482fee,null));};exports[_0x3bdf('0x47')]=function(_0xc8f495,_0x40855a){return db[_0x3bdf('0x2a')][_0x3bdf('0x47')](_0xc8f495[_0x3bdf('0x48')],{})['then'](respondWithResult(_0x40855a,0xc9))['catch'](handleError(_0x40855a,null));};exports[_0x3bdf('0x21')]=function(_0x5ca205,_0x132c0d){if(_0x5ca205[_0x3bdf('0x48')]['id']){delete _0x5ca205[_0x3bdf('0x48')]['id'];}return db[_0x3bdf('0x2a')]['find']({'where':{'id':_0x5ca205[_0x3bdf('0x43')]['id']}})[_0x3bdf('0x22')](handleEntityNotFound(_0x132c0d,null))['then'](saveUpdates(_0x5ca205[_0x3bdf('0x48')],null))[_0x3bdf('0x22')](respondWithResult(_0x132c0d,null))[_0x3bdf('0x41')](handleError(_0x132c0d,null));};exports[_0x3bdf('0x23')]=function(_0x373973,_0x27bd07){return db['SalesforceConfiguration'][_0x3bdf('0x46')]({'where':{'id':_0x373973[_0x3bdf('0x43')]['id']}})['then'](handleEntityNotFound(_0x27bd07,null))[_0x3bdf('0x22')](removeEntity(_0x27bd07,null))[_0x3bdf('0x41')](handleError(_0x27bd07,null));};exports[_0x3bdf('0x49')]=function(_0x531420,_0x1375f0,_0x23ead3){var _0x2696ff={};var _0x4f1633={};var _0x3aaea9;var _0x1710b2;return db[_0x3bdf('0x2a')]['findOne']({'where':{'id':_0x531420['params']['id']}})['then'](handleEntityNotFound(_0x1375f0,null))[_0x3bdf('0x22')](function(_0x44e7b0){if(_0x44e7b0){_0x3aaea9=_0x44e7b0;_0x4f1633[_0x3bdf('0x2e')]=_[_0x3bdf('0x44')](db[_0x3bdf('0x4a')][_0x3bdf('0x2b')]);_0x4f1633[_0x3bdf('0x2f')]=_[_0x3bdf('0x44')](_0x531420[_0x3bdf('0x2f')]);_0x4f1633[_0x3bdf('0x30')]=_[_0x3bdf('0x31')](_0x4f1633[_0x3bdf('0x2e')],_0x4f1633[_0x3bdf('0x2f')]);_0x2696ff[_0x3bdf('0x33')]=_['intersection'](_0x4f1633[_0x3bdf('0x2e')],qs['fields'](_0x531420['query'][_0x3bdf('0x32')]));_0x2696ff[_0x3bdf('0x33')]=_0x2696ff[_0x3bdf('0x33')][_0x3bdf('0x45')]?_0x2696ff['attributes']:_0x4f1633['model'];_0x2696ff[_0x3bdf('0x35')]=qs[_0x3bdf('0x36')](_0x531420[_0x3bdf('0x2f')][_0x3bdf('0x36')]);_0x2696ff[_0x3bdf('0x37')]=qs[_0x3bdf('0x30')](_[_0x3bdf('0x38')](_0x531420[_0x3bdf('0x2f')],_0x4f1633[_0x3bdf('0x30')]));if(_0x531420[_0x3bdf('0x2f')]['filter']){_0x2696ff[_0x3bdf('0x37')]=_['merge'](_0x2696ff[_0x3bdf('0x37')],{'$or':_[_0x3bdf('0x29')](_0x2696ff[_0x3bdf('0x33')],function(_0x2da27c){var _0x4fcf3b={};_0x4fcf3b[_0x2da27c]={'$like':'%'+_0x531420[_0x3bdf('0x2f')][_0x3bdf('0x39')]+'%'};return _0x4fcf3b;})});}_0x2696ff=_[_0x3bdf('0x3b')]({},_0x2696ff,_0x531420[_0x3bdf('0x3c')]);return _0x3aaea9[_0x3bdf('0x49')](_0x2696ff);}})[_0x3bdf('0x22')](function(_0x3b1125){if(_0x3b1125){_0x1710b2=_0x3b1125[_0x3bdf('0x45')];if(!_0x531420['query'][_0x3bdf('0x34')](_0x3bdf('0x4b'))){_0x2696ff[_0x3bdf('0x1a')]=qs[_0x3bdf('0x1a')](_0x531420[_0x3bdf('0x2f')][_0x3bdf('0x1a')]);_0x2696ff['offset']=qs[_0x3bdf('0x18')](_0x531420['query'][_0x3bdf('0x18')]);}return _0x3aaea9[_0x3bdf('0x49')](_0x2696ff);}})[_0x3bdf('0x22')](function(_0x1771e3){if(_0x1771e3){return _0x1771e3?{'count':_0x1710b2,'rows':_0x1771e3}:null;}})[_0x3bdf('0x22')](respondWithResult(_0x1375f0,null))[_0x3bdf('0x41')](handleError(_0x1375f0,null));};exports[_0x3bdf('0x4c')]=function(_0x10a936,_0x1e62c8,_0x131e9c){var _0x24c423={};var _0x13a29c={};var _0x5125ba;var _0x1ca633;return db[_0x3bdf('0x2a')][_0x3bdf('0x4d')]({'where':{'id':_0x10a936[_0x3bdf('0x43')]['id']}})[_0x3bdf('0x22')](handleEntityNotFound(_0x1e62c8,null))[_0x3bdf('0x22')](function(_0x1e38fc){if(_0x1e38fc){_0x5125ba=_0x1e38fc;_0x13a29c[_0x3bdf('0x2e')]=_[_0x3bdf('0x44')](db[_0x3bdf('0x4a')]['rawAttributes']);_0x13a29c[_0x3bdf('0x2f')]=_[_0x3bdf('0x44')](_0x10a936['query']);_0x13a29c['filters']=_['intersection'](_0x13a29c[_0x3bdf('0x2e')],_0x13a29c[_0x3bdf('0x2f')]);_0x24c423[_0x3bdf('0x33')]=_[_0x3bdf('0x31')](_0x13a29c[_0x3bdf('0x2e')],qs[_0x3bdf('0x32')](_0x10a936[_0x3bdf('0x2f')][_0x3bdf('0x32')]));_0x24c423[_0x3bdf('0x33')]=_0x24c423[_0x3bdf('0x33')][_0x3bdf('0x45')]?_0x24c423[_0x3bdf('0x33')]:_0x13a29c[_0x3bdf('0x2e')];_0x24c423[_0x3bdf('0x35')]=qs[_0x3bdf('0x36')](_0x10a936['query']['sort']);_0x24c423['where']=qs[_0x3bdf('0x30')](_[_0x3bdf('0x38')](_0x10a936[_0x3bdf('0x2f')],_0x13a29c[_0x3bdf('0x30')]));if(_0x10a936[_0x3bdf('0x2f')][_0x3bdf('0x39')]){_0x24c423[_0x3bdf('0x37')]=_[_0x3bdf('0x3b')](_0x24c423[_0x3bdf('0x37')],{'$or':_[_0x3bdf('0x29')](_0x24c423[_0x3bdf('0x33')],function(_0x2e1abc){var _0x25f6d3={};_0x25f6d3[_0x2e1abc]={'$like':'%'+_0x10a936[_0x3bdf('0x2f')][_0x3bdf('0x39')]+'%'};return _0x25f6d3;})});}_0x24c423=_[_0x3bdf('0x3b')]({},_0x24c423,_0x10a936['options']);return _0x5125ba[_0x3bdf('0x4c')](_0x24c423);}})[_0x3bdf('0x22')](function(_0x548871){if(_0x548871){_0x1ca633=_0x548871[_0x3bdf('0x45')];if(!_0x10a936[_0x3bdf('0x2f')]['hasOwnProperty'](_0x3bdf('0x4b'))){_0x24c423[_0x3bdf('0x1a')]=qs['limit'](_0x10a936[_0x3bdf('0x2f')]['limit']);_0x24c423[_0x3bdf('0x18')]=qs[_0x3bdf('0x18')](_0x10a936[_0x3bdf('0x2f')][_0x3bdf('0x18')]);}return _0x5125ba[_0x3bdf('0x4c')](_0x24c423);}})[_0x3bdf('0x22')](function(_0x10cc41){if(_0x10cc41){return _0x10cc41?{'count':_0x1ca633,'rows':_0x10cc41}:null;}})['then'](respondWithResult(_0x1e62c8,null))[_0x3bdf('0x41')](handleError(_0x1e62c8,null));};exports[_0x3bdf('0x4e')]=function(_0x2977a7,_0x14c9a8,_0x95a6dd){var _0x2470c7={};var _0x4f5fde={};var _0x533106;var _0x470ec4;return db['SalesforceConfiguration'][_0x3bdf('0x4d')]({'where':{'id':_0x2977a7[_0x3bdf('0x43')]['id']}})['then'](handleEntityNotFound(_0x14c9a8,null))[_0x3bdf('0x22')](function(_0x5b7bad){if(_0x5b7bad){_0x533106=_0x5b7bad;_0x4f5fde[_0x3bdf('0x2e')]=_[_0x3bdf('0x44')](db[_0x3bdf('0x4a')][_0x3bdf('0x2b')]);_0x4f5fde[_0x3bdf('0x2f')]=_[_0x3bdf('0x44')](_0x2977a7['query']);_0x4f5fde['filters']=_[_0x3bdf('0x31')](_0x4f5fde[_0x3bdf('0x2e')],_0x4f5fde[_0x3bdf('0x2f')]);_0x2470c7[_0x3bdf('0x33')]=_[_0x3bdf('0x31')](_0x4f5fde[_0x3bdf('0x2e')],qs[_0x3bdf('0x32')](_0x2977a7[_0x3bdf('0x2f')]['fields']));_0x2470c7[_0x3bdf('0x33')]=_0x2470c7['attributes'][_0x3bdf('0x45')]?_0x2470c7[_0x3bdf('0x33')]:_0x4f5fde[_0x3bdf('0x2e')];_0x2470c7[_0x3bdf('0x35')]=qs['sort'](_0x2977a7[_0x3bdf('0x2f')][_0x3bdf('0x36')]);_0x2470c7['where']=qs[_0x3bdf('0x30')](_[_0x3bdf('0x38')](_0x2977a7[_0x3bdf('0x2f')],_0x4f5fde['filters']));if(_0x2977a7[_0x3bdf('0x2f')][_0x3bdf('0x39')]){_0x2470c7['where']=_['merge'](_0x2470c7[_0x3bdf('0x37')],{'$or':_[_0x3bdf('0x29')](_0x2470c7[_0x3bdf('0x33')],function(_0x1a5097){var _0x4e7368={};_0x4e7368[_0x1a5097]={'$like':'%'+_0x2977a7[_0x3bdf('0x2f')]['filter']+'%'};return _0x4e7368;})});}_0x2470c7=_[_0x3bdf('0x3b')]({},_0x2470c7,_0x2977a7[_0x3bdf('0x3c')]);return _0x533106[_0x3bdf('0x4e')](_0x2470c7);}})['then'](function(_0x81975d){if(_0x81975d){_0x470ec4=_0x81975d[_0x3bdf('0x45')];if(!_0x2977a7['query'][_0x3bdf('0x34')](_0x3bdf('0x4b'))){_0x2470c7['limit']=qs[_0x3bdf('0x1a')](_0x2977a7[_0x3bdf('0x2f')][_0x3bdf('0x1a')]);_0x2470c7['offset']=qs[_0x3bdf('0x18')](_0x2977a7[_0x3bdf('0x2f')][_0x3bdf('0x18')]);}return _0x533106[_0x3bdf('0x4e')](_0x2470c7);}})[_0x3bdf('0x22')](function(_0x47c677){if(_0x47c677){return _0x47c677?{'count':_0x470ec4,'rows':_0x47c677}:null;}})[_0x3bdf('0x22')](respondWithResult(_0x14c9a8,null))[_0x3bdf('0x41')](handleError(_0x14c9a8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ea4d93d..b847cb5 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 _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 +var _0x3be5=['define','SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x20e7a5,_0x471eb4){var _0x1f36a2=function(_0x2db7f0){while(--_0x2db7f0){_0x20e7a5['push'](_0x20e7a5['shift']());}};_0x1f36a2(++_0x471eb4);}(_0x3be5,0x1e3));var _0x53be=function(_0xea492e,_0x20dea6){_0xea492e=_0xea492e-0x0;var _0x108caf=_0x3be5[_0xea492e];return _0x108caf;};'use strict';var _=require(_0x53be('0x0'));var util=require(_0x53be('0x1'));var logger=require(_0x53be('0x2'))(_0x53be('0x3'));var moment=require(_0x53be('0x4'));var BPromise=require(_0x53be('0x5'));var rp=require(_0x53be('0x6'));var fs=require('fs');var path=require(_0x53be('0x7'));var rimraf=require(_0x53be('0x8'));var config=require(_0x53be('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x53be('0xa')]=function(_0x1b9b8b,_0x47e087){return _0x1b9b8b[_0x53be('0xb')](_0x53be('0xc'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 5dd63e5..c98b0b2 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 _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 +var _0x65ee=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message'];(function(_0x3ed6e4,_0x4146f7){var _0x366ae7=function(_0x27c853){while(--_0x27c853){_0x3ed6e4['push'](_0x3ed6e4['shift']());}};_0x366ae7(++_0x4146f7);}(_0x65ee,0xff));var _0xe65e=function(_0x5bd1cd,_0x23e643){_0x5bd1cd=_0x5bd1cd-0x0;var _0x33879f=_0x65ee[_0x5bd1cd];return _0x33879f;};'use strict';var _=require(_0xe65e('0x0'));var util=require(_0xe65e('0x1'));var moment=require(_0xe65e('0x2'));var BPromise=require(_0xe65e('0x3'));var rs=require(_0xe65e('0x4'));var fs=require('fs');var Redis=require(_0xe65e('0x5'));var db=require(_0xe65e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe65e('0x7'))(_0xe65e('0x8'));var config=require('../../config/environment');var jayson=require(_0xe65e('0x9'));var client=jayson[_0xe65e('0xa')][_0xe65e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33b815,_0x456a31,_0x19932a){return new BPromise(function(_0xab61ab,_0x683c19){return client[_0xe65e('0xc')](_0x33b815,_0x19932a)[_0xe65e('0xd')](function(_0x5bd14d){logger[_0xe65e('0xe')](_0xe65e('0xf'),_0x456a31,'request\x20sent');logger['debug'](_0xe65e('0x10'),_0x456a31,_0xe65e('0x11'),JSON['stringify'](_0x5bd14d));if(_0x5bd14d['error']){if(_0x5bd14d['error'][_0xe65e('0x12')]===0x1f4){logger[_0xe65e('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x456a31,_0x5bd14d[_0xe65e('0x13')]['message']);return _0x683c19(_0x5bd14d[_0xe65e('0x13')]['message']);}logger[_0xe65e('0x13')](_0xe65e('0xf'),_0x456a31,_0x5bd14d[_0xe65e('0x13')]['message']);return _0xab61ab(_0x5bd14d['error'][_0xe65e('0x14')]);}else{logger[_0xe65e('0xe')](_0xe65e('0xf'),_0x456a31,'request\x20sent');_0xab61ab(_0x5bd14d[_0xe65e('0x15')]['message']);}})[_0xe65e('0x16')](function(_0x5b1c21){logger[_0xe65e('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x456a31,_0x5b1c21);_0x683c19(_0x5b1c21);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a02fd4d..116eded 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 _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 +var _0x64b6=['multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','exports'];(function(_0xb4dff5,_0x5ea53f){var _0x143b59=function(_0x4ef9b1){while(--_0x4ef9b1){_0xb4dff5['push'](_0xb4dff5['shift']());}};_0x143b59(++_0x5ea53f);}(_0x64b6,0xc3));var _0x664b=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x64b6[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x664b('0x0'));var util=require('util');var path=require(_0x664b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x664b('0x2'));var interaction=require(_0x664b('0x3'));var config=require(_0x664b('0x4'));var controller=require(_0x664b('0x5'));router[_0x664b('0x6')]('/',auth[_0x664b('0x7')](),controller['index']);router[_0x664b('0x6')](_0x664b('0x8'),auth[_0x664b('0x7')](),controller['show']);router[_0x664b('0x9')]('/',auth['isAuthenticated'](),controller[_0x664b('0xa')]);router[_0x664b('0xb')](_0x664b('0x8'),auth[_0x664b('0x7')](),controller[_0x664b('0xc')]);router[_0x664b('0xd')]('/:id',auth[_0x664b('0x7')](),controller['destroy']);module[_0x664b('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 30e5cdb..e61e481 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 _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 +var _0x7bc6=['ENUM','customVariable','sequelize','string','variable','keyValue','picklist','STRING'];(function(_0x5bbc7a,_0x17eaf1){var _0x16f91a=function(_0x52f167){while(--_0x52f167){_0x5bbc7a['push'](_0x5bbc7a['shift']());}};_0x16f91a(++_0x17eaf1);}(_0x7bc6,0x11a));var _0x67bc=function(_0x5ae187,_0x8afd5c){_0x5ae187=_0x5ae187-0x0;var _0x211069=_0x7bc6[_0x5ae187];return _0x211069;};'use strict';var Sequelize=require(_0x67bc('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x67bc('0x1'),_0x67bc('0x2'),'customVariable',_0x67bc('0x3'),_0x67bc('0x4')),'defaultValue':_0x67bc('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x67bc('0x5')]},'keyType':{'type':Sequelize[_0x67bc('0x6')](_0x67bc('0x1'),_0x67bc('0x2'),_0x67bc('0x7'))},'keyContent':{'type':Sequelize[_0x67bc('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x67bc('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index bef5259..6cfb39f 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 _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 +var _0xefac=['show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','SalesforceField','includeAll','include','findAll','catch'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xefac,0x118));var _0xcefa=function(_0x3540bb,_0x1735ff){_0x3540bb=_0x3540bb-0x0;var _0x3ed2b6=_0xefac[_0x3540bb];return _0x3ed2b6;};'use strict';var emlformat=require(_0xcefa('0x0'));var rimraf=require(_0xcefa('0x1'));var zipdir=require(_0xcefa('0x2'));var jsonpatch=require(_0xcefa('0x3'));var rp=require('request-promise');var moment=require(_0xcefa('0x4'));var BPromise=require(_0xcefa('0x5'));var Mustache=require('mustache');var util=require(_0xcefa('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcefa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcefa('0x8'));var squel=require(_0xcefa('0x9'));var crypto=require('crypto');var jsforce=require(_0xcefa('0xa'));var deskjs=require(_0xcefa('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcefa('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xcefa('0xd'));var as=require(_0xcefa('0xe'));var hardwareService=require(_0xcefa('0xf'));var logger=require('../../config/logger')(_0xcefa('0x10'));var utils=require(_0xcefa('0x11'));var config=require(_0xcefa('0x12'));var licenseUtil=require(_0xcefa('0x13'));var db=require(_0xcefa('0x14'))['db'];function respondWithStatusCode(_0x437a85,_0x36fbbf){_0x36fbbf=_0x36fbbf||0xcc;return function(_0x47c596){if(_0x47c596){return _0x437a85[_0xcefa('0x15')](_0x36fbbf);}return _0x437a85[_0xcefa('0x16')](_0x36fbbf)[_0xcefa('0x17')]();};}function respondWithResult(_0xf03992,_0x566223){_0x566223=_0x566223||0xc8;return function(_0x55d1d4){if(_0x55d1d4){return _0xf03992[_0xcefa('0x16')](_0x566223)[_0xcefa('0x18')](_0x55d1d4);}};}function respondWithFilteredResult(_0x16cd4b,_0x3ed0a3){return function(_0x39223e){if(_0x39223e){var _0x2dba15=typeof _0x3ed0a3['offset']===_0xcefa('0x19')&&typeof _0x3ed0a3[_0xcefa('0x1a')]===_0xcefa('0x19');var _0x5bbcbc=_0x39223e[_0xcefa('0x1b')];var _0x3f07a5=_0x2dba15?0x0:_0x3ed0a3[_0xcefa('0x1c')];var _0xa65d9=_0x2dba15?_0x39223e[_0xcefa('0x1b')]:_0x3ed0a3['offset']+_0x3ed0a3['limit'];var _0x51559e;if(_0xa65d9>=_0x5bbcbc){_0xa65d9=_0x5bbcbc;_0x51559e=0xc8;}else{_0x51559e=0xce;}_0x16cd4b[_0xcefa('0x16')](_0x51559e);return _0x16cd4b[_0xcefa('0x1d')](_0xcefa('0x1e'),_0x3f07a5+'-'+_0xa65d9+'/'+_0x5bbcbc)['json'](_0x39223e);}return null;};}function patchUpdates(_0x15a2aa){return function(_0x3e63c9){try{jsonpatch['apply'](_0x3e63c9,_0x15a2aa,!![]);}catch(_0x4e6eb9){return BPromise[_0xcefa('0x1f')](_0x4e6eb9);}return _0x3e63c9[_0xcefa('0x20')]();};}function saveUpdates(_0x244ddf,_0xcf3688){return function(_0x180c18){if(_0x180c18){return _0x180c18[_0xcefa('0x21')](_0x244ddf)[_0xcefa('0x22')](function(_0x3fb76f){return _0x3fb76f;});}return null;};}function removeEntity(_0x18805f,_0xcbba4){return function(_0x2f1f3b){if(_0x2f1f3b){return _0x2f1f3b[_0xcefa('0x23')]()['then'](function(){_0x18805f[_0xcefa('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47cf25,_0x504df8){return function(_0x4cb470){if(!_0x4cb470){_0x47cf25['sendStatus'](0x194);}return _0x4cb470;};}function handleError(_0x551869,_0x337c16){_0x337c16=_0x337c16||0x1f4;return function(_0x4ac32d){logger[_0xcefa('0x24')](_0x4ac32d['stack']);if(_0x4ac32d[_0xcefa('0x25')]){delete _0x4ac32d[_0xcefa('0x25')];}_0x551869[_0xcefa('0x16')](_0x337c16)[_0xcefa('0x26')](_0x4ac32d);};}exports[_0xcefa('0x27')]=function(_0x55f6de,_0x3247b4){var _0x34f98a={},_0x3940a2={},_0xeb5c42={'count':0x0,'rows':[]};var _0xedc00=_['map'](db['SalesforceField'][_0xcefa('0x28')],function(_0x25f292){return{'name':_0x25f292[_0xcefa('0x29')],'type':_0x25f292[_0xcefa('0x2a')][_0xcefa('0x2b')]};});_0x3940a2[_0xcefa('0x2c')]=_[_0xcefa('0x2d')](_0xedc00,'name');_0x3940a2['query']=_[_0xcefa('0x2e')](_0x55f6de[_0xcefa('0x2f')]);_0x3940a2[_0xcefa('0x30')]=_[_0xcefa('0x31')](_0x3940a2[_0xcefa('0x2c')],_0x3940a2['query']);_0x34f98a[_0xcefa('0x32')]=_[_0xcefa('0x31')](_0x3940a2[_0xcefa('0x2c')],qs['fields'](_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x33')]));_0x34f98a[_0xcefa('0x32')]=_0x34f98a[_0xcefa('0x32')][_0xcefa('0x34')]?_0x34f98a[_0xcefa('0x32')]:_0x3940a2[_0xcefa('0x2c')];if(!_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x35')](_0xcefa('0x36'))){_0x34f98a[_0xcefa('0x1a')]=qs[_0xcefa('0x1a')](_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x1a')]);_0x34f98a[_0xcefa('0x1c')]=qs[_0xcefa('0x1c')](_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x1c')]);}_0x34f98a['order']=qs[_0xcefa('0x37')](_0x55f6de['query'][_0xcefa('0x37')]);_0x34f98a[_0xcefa('0x38')]=qs[_0xcefa('0x30')](_['pick'](_0x55f6de[_0xcefa('0x2f')],_0x3940a2[_0xcefa('0x30')]),_0xedc00);if(_0x55f6de['query'][_0xcefa('0x39')]){_0x34f98a[_0xcefa('0x38')]=_['merge'](_0x34f98a[_0xcefa('0x38')],{'$or':_[_0xcefa('0x2d')](_0xedc00,function(_0x2223dd){if(_0x2223dd[_0xcefa('0x2a')]!==_0xcefa('0x3a')){var _0x483b15={};_0x483b15[_0x2223dd[_0xcefa('0x25')]]={'$like':'%'+_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x39')]+'%'};return _0x483b15;}})});}_0x34f98a=_['merge']({},_0x34f98a,_0x55f6de[_0xcefa('0x3b')]);var _0x4aab81={'where':_0x34f98a[_0xcefa('0x38')]};return db[_0xcefa('0x3c')][_0xcefa('0x1b')](_0x4aab81)[_0xcefa('0x22')](function(_0x5b34c6){_0xeb5c42[_0xcefa('0x1b')]=_0x5b34c6;if(_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x3d')]){_0x34f98a[_0xcefa('0x3e')]=[{'all':!![]}];}return db[_0xcefa('0x3c')][_0xcefa('0x3f')](_0x34f98a);})[_0xcefa('0x22')](function(_0x5b6d77){_0xeb5c42['rows']=_0x5b6d77;return _0xeb5c42;})['then'](respondWithFilteredResult(_0x3247b4,_0x34f98a))[_0xcefa('0x40')](handleError(_0x3247b4,null));};exports[_0xcefa('0x41')]=function(_0x16bec3,_0x26ec52){var _0x5940db={'raw':!![],'where':{'id':_0x16bec3[_0xcefa('0x42')]['id']}},_0xeccad9={};_0xeccad9[_0xcefa('0x2c')]=_[_0xcefa('0x2e')](db[_0xcefa('0x3c')][_0xcefa('0x28')]);_0xeccad9[_0xcefa('0x2f')]=_['keys'](_0x16bec3['query']);_0xeccad9[_0xcefa('0x30')]=_[_0xcefa('0x31')](_0xeccad9[_0xcefa('0x2c')],_0xeccad9[_0xcefa('0x2f')]);_0x5940db[_0xcefa('0x32')]=_['intersection'](_0xeccad9['model'],qs[_0xcefa('0x33')](_0x16bec3[_0xcefa('0x2f')]['fields']));_0x5940db[_0xcefa('0x32')]=_0x5940db['attributes']['length']?_0x5940db[_0xcefa('0x32')]:_0xeccad9[_0xcefa('0x2c')];if(_0x16bec3[_0xcefa('0x2f')]['includeAll']){_0x5940db[_0xcefa('0x3e')]=[{'all':!![]}];}_0x5940db=_['merge']({},_0x5940db,_0x16bec3[_0xcefa('0x3b')]);return db[_0xcefa('0x3c')][_0xcefa('0x43')](_0x5940db)[_0xcefa('0x22')](handleEntityNotFound(_0x26ec52,null))['then'](respondWithResult(_0x26ec52,null))['catch'](handleError(_0x26ec52,null));};exports['create']=function(_0xba8022,_0x550f07){return db[_0xcefa('0x3c')]['create'](_0xba8022[_0xcefa('0x44')],{})['then'](respondWithResult(_0x550f07,0xc9))[_0xcefa('0x40')](handleError(_0x550f07,null));};exports['update']=function(_0x337b20,_0x363e9c){if(_0x337b20['body']['id']){delete _0x337b20[_0xcefa('0x44')]['id'];}return db[_0xcefa('0x3c')][_0xcefa('0x43')]({'where':{'id':_0x337b20[_0xcefa('0x42')]['id']}})[_0xcefa('0x22')](handleEntityNotFound(_0x363e9c,null))[_0xcefa('0x22')](saveUpdates(_0x337b20[_0xcefa('0x44')],null))[_0xcefa('0x22')](respondWithResult(_0x363e9c,null))[_0xcefa('0x40')](handleError(_0x363e9c,null));};exports[_0xcefa('0x23')]=function(_0x2320f8,_0x599996){return db[_0xcefa('0x3c')]['find']({'where':{'id':_0x2320f8['params']['id']}})[_0xcefa('0x22')](handleEntityNotFound(_0x599996,null))['then'](removeEntity(_0x599996,null))[_0xcefa('0x40')](handleError(_0x599996,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 5cd871e..7693fe6 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 _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 +var _0xda22=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xda22,0x19e));var _0x2da2=function(_0x41cbe7,_0x2173e4){_0x41cbe7=_0x41cbe7-0x0;var _0x2a699d=_0xda22[_0x41cbe7];return _0x2a699d;};'use strict';var _=require(_0x2da2('0x0'));var util=require(_0x2da2('0x1'));var logger=require(_0x2da2('0x2'))(_0x2da2('0x3'));var moment=require(_0x2da2('0x4'));var BPromise=require(_0x2da2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2da2('0x6'));var rimraf=require(_0x2da2('0x7'));var config=require(_0x2da2('0x8'));var attributes=require(_0x2da2('0x9'));module[_0x2da2('0xa')]=function(_0x581272,_0x118f45){return _0x581272['define']('SalesforceField',attributes,{'tableName':_0x2da2('0xb'),'paranoid':![],'indexes':[{'name':_0x2da2('0xc'),'fields':[_0x2da2('0xd'),_0x2da2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index dec2bf7..d101b4f 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 _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 +var _0xa6d5=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6d5,0x1dc));var _0x5a6d=function(_0x241a24,_0x448a1d){_0x241a24=_0x241a24-0x0;var _0x1a1ee6=_0xa6d5[_0x241a24];return _0x1a1ee6;};'use strict';var _=require('lodash');var util=require(_0x5a6d('0x0'));var moment=require(_0x5a6d('0x1'));var BPromise=require(_0x5a6d('0x2'));var rs=require(_0x5a6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a6d('0x4'))['db'];var utils=require(_0x5a6d('0x5'));var logger=require('../../config/logger')(_0x5a6d('0x6'));var config=require('../../config/environment');var jayson=require(_0x5a6d('0x7'));var client=jayson[_0x5a6d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde0ca1,_0x449322,_0x31f0e6){return new BPromise(function(_0x2cdea5,_0x58d361){return client['request'](_0xde0ca1,_0x31f0e6)[_0x5a6d('0x9')](function(_0x3a669c){logger['info'](_0x5a6d('0xa'),_0x449322,_0x5a6d('0xb'));logger[_0x5a6d('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x449322,_0x5a6d('0xb'),JSON[_0x5a6d('0xd')](_0x3a669c));if(_0x3a669c[_0x5a6d('0xe')]){if(_0x3a669c['error'][_0x5a6d('0xf')]===0x1f4){logger[_0x5a6d('0xe')](_0x5a6d('0xa'),_0x449322,_0x3a669c['error'][_0x5a6d('0x10')]);return _0x58d361(_0x3a669c[_0x5a6d('0xe')][_0x5a6d('0x10')]);}logger[_0x5a6d('0xe')](_0x5a6d('0xa'),_0x449322,_0x3a669c[_0x5a6d('0xe')][_0x5a6d('0x10')]);return _0x2cdea5(_0x3a669c[_0x5a6d('0xe')][_0x5a6d('0x10')]);}else{logger[_0x5a6d('0x11')](_0x5a6d('0xa'),_0x449322,_0x5a6d('0xb'));_0x2cdea5(_0x3a669c[_0x5a6d('0x12')]['message']);}})[_0x5a6d('0x13')](function(_0x20cf89){logger[_0x5a6d('0xe')](_0x5a6d('0xa'),_0x449322,_0x20cf89);_0x58d361(_0x20cf89);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 45a2a5c..9102d78 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 _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 +var _0x99d2=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','/:id','show','get','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','put'];(function(_0x1b7c27,_0x38188f){var _0x19e02b=function(_0x383bb1){while(--_0x383bb1){_0x1b7c27['push'](_0x1b7c27['shift']());}};_0x19e02b(++_0x38188f);}(_0x99d2,0x88));var _0x299d=function(_0x180e84,_0x5eed6d){_0x180e84=_0x180e84-0x0;var _0x1e7d74=_0x99d2[_0x180e84];return _0x1e7d74;};'use strict';var multer=require(_0x299d('0x0'));var util=require(_0x299d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x299d('0x2'));var router=express[_0x299d('0x3')]();var fs_extra=require(_0x299d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x299d('0x5'));var config=require(_0x299d('0x6'));var controller=require(_0x299d('0x7'));router['get']('/',auth[_0x299d('0x8')](),controller['index']);router['get'](_0x299d('0x9'),auth[_0x299d('0x8')](),controller[_0x299d('0xa')]);router[_0x299d('0xb')]('/:id/configurations',auth[_0x299d('0x8')](),controller[_0x299d('0xc')]);router['get'](_0x299d('0xd'),auth[_0x299d('0x8')](),controller['getFields']);router[_0x299d('0xe')]('/',auth[_0x299d('0x8')](),controller['create']);router[_0x299d('0xe')](_0x299d('0xf'),auth[_0x299d('0x8')](),controller[_0x299d('0x10')]);router[_0x299d('0x11')](_0x299d('0x9'),auth['isAuthenticated'](),controller[_0x299d('0x12')]);router[_0x299d('0x13')]('/:id',auth[_0x299d('0x8')](),controller[_0x299d('0x14')]);module[_0x299d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 7e9a879..ad0ae11 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 _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 +var _0x38d9=['STRING','username','remoteUri','sequelize'];(function(_0x4ec628,_0xa0e103){var _0x598be1=function(_0x22432f){while(--_0x22432f){_0x4ec628['push'](_0x4ec628['shift']());}};_0x598be1(++_0xa0e103);}(_0x38d9,0x1b3));var _0x938d=function(_0x5b8b8f,_0x37723c){_0x5b8b8f=_0x5b8b8f-0x0;var _0x23c772=_0x38d9[_0x5b8b8f];return _0x23c772;};'use strict';var Sequelize=require(_0x938d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x938d('0x1')]},'username':{'type':Sequelize[_0x938d('0x1')],'unique':_0x938d('0x2')},'password':{'type':Sequelize[_0x938d('0x1')]},'email':{'type':Sequelize[_0x938d('0x1')]},'remoteUri':{'type':Sequelize[_0x938d('0x1')],'unique':_0x938d('0x3')},'serverUrl':{'type':Sequelize[_0x938d('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 f82f7dd..6535bf3 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 _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 +var _0x3c46=['sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','GET','incident?sysparm_display_value=all','result','assign','remove','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','ServicenowAccount','includeAll','include','rows','catch','show','params','rawAttributes','filters','find','create','body','getConfigurations','findOne','intersection','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','subcategory','short_description','close_code','delivery_task','work_start','assignment_group','description','sys_class_name','close_notes','closed_by','follow_up'];(function(_0x383335,_0x5b4ed9){var _0x388a3f=function(_0x1bc98b){while(--_0x1bc98b){_0x383335['push'](_0x383335['shift']());}};_0x388a3f(++_0x5b4ed9);}(_0x3c46,0xf3));var _0x63c4=function(_0xe5aee0,_0xa220a4){_0xe5aee0=_0xe5aee0-0x0;var _0x5379b9=_0x3c46[_0xe5aee0];return _0x5379b9;};'use strict';var emlformat=require(_0x63c4('0x0'));var rimraf=require(_0x63c4('0x1'));var zipdir=require(_0x63c4('0x2'));var jsonpatch=require(_0x63c4('0x3'));var rp=require(_0x63c4('0x4'));var moment=require(_0x63c4('0x5'));var BPromise=require(_0x63c4('0x6'));var Mustache=require('mustache');var util=require(_0x63c4('0x7'));var path=require(_0x63c4('0x8'));var sox=require(_0x63c4('0x9'));var csv=require(_0x63c4('0xa'));var ejs=require(_0x63c4('0xb'));var fs=require('fs');var fs_extra=require(_0x63c4('0xc'));var _=require(_0x63c4('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x63c4('0xe'));var deskjs=require(_0x63c4('0xf'));var toCsv=require(_0x63c4('0xa'));var querystring=require(_0x63c4('0x10'));var Papa=require(_0x63c4('0x11'));var Redis=require('ioredis');var authService=require(_0x63c4('0x12'));var qs=require(_0x63c4('0x13'));var as=require(_0x63c4('0x14'));var hardwareService=require(_0x63c4('0x15'));var logger=require('../../config/logger')(_0x63c4('0x16'));var utils=require('../../config/utils');var config=require(_0x63c4('0x17'));var licenseUtil=require(_0x63c4('0x18'));var db=require(_0x63c4('0x19'))['db'];var integrations=require(_0x63c4('0x1a'));function respondWithStatusCode(_0x246f98,_0x425eef){_0x425eef=_0x425eef||0xcc;return function(_0x1dbcd7){if(_0x1dbcd7){return _0x246f98['sendStatus'](_0x425eef);}return _0x246f98[_0x63c4('0x1b')](_0x425eef)['end']();};}function respondWithResult(_0x37cc62,_0x157916){_0x157916=_0x157916||0xc8;return function(_0x47d7fc){if(_0x47d7fc){return _0x37cc62[_0x63c4('0x1b')](_0x157916)[_0x63c4('0x1c')](_0x47d7fc);}};}function respondWithFilteredResult(_0x592a63,_0x34c9c7){return function(_0x83b383){if(_0x83b383){var _0x2dc7e4=typeof _0x34c9c7[_0x63c4('0x1d')]===_0x63c4('0x1e')&&typeof _0x34c9c7['limit']===_0x63c4('0x1e');var _0x3b8f8b=_0x83b383[_0x63c4('0x1f')];var _0x1c5626=_0x2dc7e4?0x0:_0x34c9c7['offset'];var _0x127ad1=_0x2dc7e4?_0x83b383[_0x63c4('0x1f')]:_0x34c9c7[_0x63c4('0x1d')]+_0x34c9c7[_0x63c4('0x20')];var _0xc606dd;if(_0x127ad1>=_0x3b8f8b){_0x127ad1=_0x3b8f8b;_0xc606dd=0xc8;}else{_0xc606dd=0xce;}_0x592a63[_0x63c4('0x1b')](_0xc606dd);return _0x592a63[_0x63c4('0x21')](_0x63c4('0x22'),_0x1c5626+'-'+_0x127ad1+'/'+_0x3b8f8b)['json'](_0x83b383);}return null;};}function patchUpdates(_0x274e66){return function(_0x5b346e){try{jsonpatch[_0x63c4('0x23')](_0x5b346e,_0x274e66,!![]);}catch(_0x216368){return BPromise[_0x63c4('0x24')](_0x216368);}return _0x5b346e[_0x63c4('0x25')]();};}function saveUpdates(_0x4049f8,_0x569492){return function(_0x14c101){if(_0x14c101){return _0x14c101[_0x63c4('0x26')](_0x4049f8)['then'](function(_0x1140de){return _0x1140de;});}return null;};}function removeEntity(_0x897a9c,_0x59700b){return function(_0x175885){if(_0x175885){return _0x175885[_0x63c4('0x27')]()[_0x63c4('0x28')](function(){_0x897a9c['status'](0xcc)[_0x63c4('0x29')]();});}};}function handleEntityNotFound(_0x3564cb,_0x1577a7){return function(_0xb391ef){if(!_0xb391ef){_0x3564cb[_0x63c4('0x2a')](0x194);}return _0xb391ef;};}function handleError(_0x13e304,_0x26f293){_0x26f293=_0x26f293||0x1f4;return function(_0x1d2bfc){logger[_0x63c4('0x2b')](_0x1d2bfc[_0x63c4('0x2c')]);if(_0x1d2bfc[_0x63c4('0x2d')]){delete _0x1d2bfc[_0x63c4('0x2d')];}_0x13e304[_0x63c4('0x1b')](_0x26f293)[_0x63c4('0x2e')](_0x1d2bfc);};}exports[_0x63c4('0x2f')]=function(_0x300d6a,_0x5115bc){var _0x1dcbcd={},_0xf84f26={},_0x4a2135={'count':0x0,'rows':[]};var _0x43867e=_[_0x63c4('0x30')](db['ServicenowAccount']['rawAttributes'],function(_0x31bbe3){return{'name':_0x31bbe3[_0x63c4('0x31')],'type':_0x31bbe3[_0x63c4('0x32')][_0x63c4('0x33')]};});_0xf84f26[_0x63c4('0x34')]=_['map'](_0x43867e,_0x63c4('0x2d'));_0xf84f26[_0x63c4('0x35')]=_[_0x63c4('0x36')](_0x300d6a[_0x63c4('0x35')]);_0xf84f26['filters']=_['intersection'](_0xf84f26[_0x63c4('0x34')],_0xf84f26['query']);_0x1dcbcd[_0x63c4('0x37')]=_['intersection'](_0xf84f26[_0x63c4('0x34')],qs[_0x63c4('0x38')](_0x300d6a['query'][_0x63c4('0x38')]));_0x1dcbcd[_0x63c4('0x37')]=_0x1dcbcd[_0x63c4('0x37')][_0x63c4('0x39')]?_0x1dcbcd[_0x63c4('0x37')]:_0xf84f26['model'];if(!_0x300d6a[_0x63c4('0x35')][_0x63c4('0x3a')]('nolimit')){_0x1dcbcd[_0x63c4('0x20')]=qs[_0x63c4('0x20')](_0x300d6a[_0x63c4('0x35')]['limit']);_0x1dcbcd[_0x63c4('0x1d')]=qs[_0x63c4('0x1d')](_0x300d6a[_0x63c4('0x35')][_0x63c4('0x1d')]);}_0x1dcbcd[_0x63c4('0x3b')]=qs[_0x63c4('0x3c')](_0x300d6a['query'][_0x63c4('0x3c')]);_0x1dcbcd[_0x63c4('0x3d')]=qs['filters'](_[_0x63c4('0x3e')](_0x300d6a[_0x63c4('0x35')],_0xf84f26['filters']),_0x43867e);if(_0x300d6a[_0x63c4('0x35')][_0x63c4('0x3f')]){_0x1dcbcd[_0x63c4('0x3d')]=_[_0x63c4('0x40')](_0x1dcbcd[_0x63c4('0x3d')],{'$or':_[_0x63c4('0x30')](_0x43867e,function(_0x5b03a6){if(_0x5b03a6['type']!=='VIRTUAL'){var _0x24f3c0={};_0x24f3c0[_0x5b03a6[_0x63c4('0x2d')]]={'$like':'%'+_0x300d6a[_0x63c4('0x35')][_0x63c4('0x3f')]+'%'};return _0x24f3c0;}})});}_0x1dcbcd=_[_0x63c4('0x40')]({},_0x1dcbcd,_0x300d6a['options']);var _0x5c9a8c={'where':_0x1dcbcd[_0x63c4('0x3d')]};return db[_0x63c4('0x41')][_0x63c4('0x1f')](_0x5c9a8c)[_0x63c4('0x28')](function(_0xfe43e7){_0x4a2135[_0x63c4('0x1f')]=_0xfe43e7;if(_0x300d6a['query'][_0x63c4('0x42')]){_0x1dcbcd[_0x63c4('0x43')]=[{'all':!![]}];}return db[_0x63c4('0x41')]['findAll'](_0x1dcbcd);})['then'](function(_0x27d921){_0x4a2135[_0x63c4('0x44')]=_0x27d921;return _0x4a2135;})['then'](respondWithFilteredResult(_0x5115bc,_0x1dcbcd))[_0x63c4('0x45')](handleError(_0x5115bc,null));};exports[_0x63c4('0x46')]=function(_0x1c9704,_0x40a0c6){var _0x113b38={'raw':![],'where':{'id':_0x1c9704[_0x63c4('0x47')]['id']}},_0x385dee={};_0x385dee['model']=_[_0x63c4('0x36')](db[_0x63c4('0x41')][_0x63c4('0x48')]);_0x385dee[_0x63c4('0x35')]=_[_0x63c4('0x36')](_0x1c9704[_0x63c4('0x35')]);_0x385dee[_0x63c4('0x49')]=_['intersection'](_0x385dee[_0x63c4('0x34')],_0x385dee[_0x63c4('0x35')]);_0x113b38[_0x63c4('0x37')]=_['intersection'](_0x385dee[_0x63c4('0x34')],qs[_0x63c4('0x38')](_0x1c9704['query'][_0x63c4('0x38')]));_0x113b38[_0x63c4('0x37')]=_0x113b38[_0x63c4('0x37')][_0x63c4('0x39')]?_0x113b38['attributes']:_0x385dee[_0x63c4('0x34')];if(_0x1c9704[_0x63c4('0x35')][_0x63c4('0x42')]){_0x113b38[_0x63c4('0x43')]=[{'all':!![]}];}_0x113b38=_[_0x63c4('0x40')]({},_0x113b38,_0x1c9704['options']);return db[_0x63c4('0x41')][_0x63c4('0x4a')](_0x113b38)[_0x63c4('0x28')](handleEntityNotFound(_0x40a0c6,null))['then'](respondWithResult(_0x40a0c6,null))[_0x63c4('0x45')](handleError(_0x40a0c6,null));};exports[_0x63c4('0x4b')]=function(_0x38a2d1,_0x2506ad){return db[_0x63c4('0x41')][_0x63c4('0x4b')](_0x38a2d1[_0x63c4('0x4c')],{})['then'](respondWithResult(_0x2506ad,0xc9))[_0x63c4('0x45')](handleError(_0x2506ad,null));};exports['update']=function(_0x4b26c6,_0x23fe1a){if(_0x4b26c6[_0x63c4('0x4c')]['id']){delete _0x4b26c6[_0x63c4('0x4c')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x4b26c6[_0x63c4('0x47')]['id']}})[_0x63c4('0x28')](handleEntityNotFound(_0x23fe1a,null))[_0x63c4('0x28')](saveUpdates(_0x4b26c6[_0x63c4('0x4c')],null))[_0x63c4('0x28')](respondWithResult(_0x23fe1a,null))['catch'](handleError(_0x23fe1a,null));};exports[_0x63c4('0x27')]=function(_0x2af09e,_0x40aad0){return db[_0x63c4('0x41')][_0x63c4('0x4a')]({'where':{'id':_0x2af09e[_0x63c4('0x47')]['id']}})[_0x63c4('0x28')](handleEntityNotFound(_0x40aad0,null))['then'](removeEntity(_0x40aad0,null))[_0x63c4('0x45')](handleError(_0x40aad0,null));};exports[_0x63c4('0x4d')]=function(_0x20e10a,_0x337458,_0x85f0ff){var _0x3983c3={};var _0x502d87={};var _0x2c1c27;var _0x575847;return db['ServicenowAccount'][_0x63c4('0x4e')]({'where':{'id':_0x20e10a[_0x63c4('0x47')]['id']}})[_0x63c4('0x28')](handleEntityNotFound(_0x337458,null))[_0x63c4('0x28')](function(_0x1ef580){if(_0x1ef580){_0x2c1c27=_0x1ef580;_0x502d87[_0x63c4('0x34')]=_[_0x63c4('0x36')](db['ServicenowConfiguration'][_0x63c4('0x48')]);_0x502d87['query']=_[_0x63c4('0x36')](_0x20e10a[_0x63c4('0x35')]);_0x502d87['filters']=_[_0x63c4('0x4f')](_0x502d87['model'],_0x502d87[_0x63c4('0x35')]);_0x3983c3[_0x63c4('0x37')]=_[_0x63c4('0x4f')](_0x502d87[_0x63c4('0x34')],qs[_0x63c4('0x38')](_0x20e10a[_0x63c4('0x35')][_0x63c4('0x38')]));_0x3983c3[_0x63c4('0x37')]=_0x3983c3[_0x63c4('0x37')][_0x63c4('0x39')]?_0x3983c3[_0x63c4('0x37')]:_0x502d87[_0x63c4('0x34')];_0x3983c3['order']=qs[_0x63c4('0x3c')](_0x20e10a['query'][_0x63c4('0x3c')]);_0x3983c3[_0x63c4('0x3d')]=qs['filters'](_['pick'](_0x20e10a[_0x63c4('0x35')],_0x502d87[_0x63c4('0x49')]));if(_0x20e10a[_0x63c4('0x35')]['filter']){_0x3983c3[_0x63c4('0x3d')]=_['merge'](_0x3983c3[_0x63c4('0x3d')],{'$or':_['map'](_0x3983c3['attributes'],function(_0x1c2197){var _0x12faef={};_0x12faef[_0x1c2197]={'$like':'%'+_0x20e10a[_0x63c4('0x35')][_0x63c4('0x3f')]+'%'};return _0x12faef;})});}_0x3983c3=_[_0x63c4('0x40')]({},_0x3983c3,_0x20e10a['options']);return _0x2c1c27['getConfigurations'](_0x3983c3);}})['then'](function(_0x23dca2){if(_0x23dca2){_0x575847=_0x23dca2[_0x63c4('0x39')];if(!_0x20e10a[_0x63c4('0x35')][_0x63c4('0x3a')](_0x63c4('0x50'))){_0x3983c3['limit']=qs[_0x63c4('0x20')](_0x20e10a[_0x63c4('0x35')]['limit']);_0x3983c3['offset']=qs[_0x63c4('0x1d')](_0x20e10a[_0x63c4('0x35')][_0x63c4('0x1d')]);}return _0x2c1c27[_0x63c4('0x4d')](_0x3983c3);}})[_0x63c4('0x28')](function(_0x533a00){if(_0x533a00){return _0x533a00?{'count':_0x575847,'rows':_0x533a00}:null;}})[_0x63c4('0x28')](respondWithResult(_0x337458,null))[_0x63c4('0x45')](handleError(_0x337458,null));};exports[_0x63c4('0x51')]=function(_0x3d2d42,_0x58262d,_0x411edd){if(_0x3d2d42[_0x63c4('0x4c')]['id']){delete _0x3d2d42[_0x63c4('0x4c')]['id'];}return db[_0x63c4('0x41')]['findOne']({'where':{'id':_0x3d2d42[_0x63c4('0x47')]['id']}})[_0x63c4('0x28')](handleEntityNotFound(_0x58262d,null))[_0x63c4('0x28')](function(_0x1cce7f){if(_0x1cce7f){_0x3d2d42[_0x63c4('0x4c')][_0x63c4('0x52')]=_0x1cce7f['id'];_0x3d2d42[_0x63c4('0x4c')][_0x63c4('0x53')]=integrations['getSubjects'](_0x3d2d42[_0x63c4('0x4c')][_0x63c4('0x54')],_0x3d2d42[_0x63c4('0x4c')]['type']);_0x3d2d42[_0x63c4('0x4c')][_0x63c4('0x55')]=integrations[_0x63c4('0x56')](_0x3d2d42[_0x63c4('0x4c')]['channel'],_0x3d2d42[_0x63c4('0x4c')]['type']);return db['ServicenowConfiguration'][_0x63c4('0x4b')](_0x3d2d42[_0x63c4('0x4c')],{'include':[{'model':db[_0x63c4('0x57')],'as':_0x63c4('0x53')},{'model':db['ServicenowField'],'as':_0x63c4('0x55')}]});}return null;})[_0x63c4('0x28')](respondWithResult(_0x58262d,null))[_0x63c4('0x45')](handleError(_0x58262d,null));};exports['getFields']=function(_0x226ae5,_0x3c91e3,_0x4e1d02){var _0x173ec0=[_0x63c4('0x58'),_0x63c4('0x59'),_0x63c4('0x5a'),'subcategory','close_code',_0x63c4('0x5b'),_0x63c4('0x5c'),_0x63c4('0x5d'),'category'];var _0x28eada=[_0x63c4('0x5e'),_0x63c4('0x58'),_0x63c4('0x5f'),_0x63c4('0x60'),_0x63c4('0x61'),_0x63c4('0x62'),_0x63c4('0x63'),_0x63c4('0x59'),'approval_history','number',_0x63c4('0x64'),_0x63c4('0x65'),_0x63c4('0x66'),_0x63c4('0x67'),_0x63c4('0x68'),_0x63c4('0x69'),_0x63c4('0x6a'),_0x63c4('0x6b'),_0x63c4('0x5a'),_0x63c4('0x3b'),'calendar_stc',_0x63c4('0x6c'),_0x63c4('0x6d'),_0x63c4('0x6e'),'impact',_0x63c4('0x6f'),_0x63c4('0x70'),_0x63c4('0x71'),_0x63c4('0x72'),_0x63c4('0x73'),_0x63c4('0x74'),_0x63c4('0x75'),_0x63c4('0x76'),_0x63c4('0x77'),_0x63c4('0x78'),_0x63c4('0x79'),_0x63c4('0x7a'),_0x63c4('0x7b'),'resolved_at',_0x63c4('0x7c'),_0x63c4('0x7d'),_0x63c4('0x7e'),'work_notes',_0x63c4('0x7f'),_0x63c4('0x80'),'correlation_display',_0x63c4('0x81'),_0x63c4('0x82'),_0x63c4('0x83'),'business_stc','additional_assignee_list',_0x63c4('0x84'),'calendar_duration','notify',_0x63c4('0x85'),_0x63c4('0x86'),_0x63c4('0x87'),_0x63c4('0x88'),'parent_incident',_0x63c4('0x89'),_0x63c4('0x8a'),_0x63c4('0x8b'),_0x63c4('0x5c'),_0x63c4('0x8c'),_0x63c4('0x8d'),_0x63c4('0x8e'),_0x63c4('0x8f'),_0x63c4('0x90'),_0x63c4('0x91'),_0x63c4('0x5d'),_0x63c4('0x92'),_0x63c4('0x93'),_0x63c4('0x94'),_0x63c4('0x95'),_0x63c4('0x96'),_0x63c4('0x97'),_0x63c4('0x98'),_0x63c4('0x99'),_0x63c4('0x9a'),'upon_approval',_0x63c4('0x9b'),_0x63c4('0x9c'),'category'];var _0x72739f='';var _0x260baa='';var _0x166003=[];var _0x154e55='';var _0x3aa3e9='';var _0x4444c3=[];var _0xfb2a5d='';var _0x57cf7f='';var _0x4bc66e={};var _0x28c508='';return db[_0x63c4('0x41')][_0x63c4('0x4e')]({'where':{'id':_0x226ae5[_0x63c4('0x47')]['id']},'attributes':['id',_0x63c4('0x9d'),'password',_0x63c4('0x9e'),_0x63c4('0x9f'),_0x63c4('0xa0')]})['then'](handleEntityNotFound(_0x3c91e3,null))['then'](function(_0x34fc8a){if(_0x34fc8a){_0x28c508=_0x34fc8a['remoteUri'];var _0x49320f=_0x28c508[_0x63c4('0xa1')](-0x1);if(_0x49320f==='/'){_0x28c508=_0x28c508[_0x63c4('0xa2')](0x0,_0x28c508[_0x63c4('0xa3')](_0x49320f));}_0x57cf7f=util[_0x63c4('0xa4')]('%s/api/now/doc/table/schema/',_0x28c508);_0xfb2a5d=util['format']('%s/api/now/table/',_0x28c508);_0x4bc66e={'user':_0x34fc8a[_0x63c4('0x9d')],'pass':_0x34fc8a['password']};var _0x5bc5e6={'method':_0x63c4('0xa5'),'uri':_0x57cf7f+_0x63c4('0xa6'),'auth':_0x4bc66e,'json':!![]};return rp(_0x5bc5e6);}})['then'](function(_0x59b971){if(_0x59b971['result'][_0x63c4('0x39')]>0x0){_0x72739f=_0x59b971[_0x63c4('0xa7')];}console['log']('incident\x20table\x20objects',_0x72739f);_0x4444c3=[];_0x260baa=Object[_0x63c4('0xa8')]([],_0x72739f);_[_0x63c4('0xa9')](_0x260baa,function(_0x311657){return!_0x173ec0[_0x63c4('0xaa')](_0x311657[_0x63c4('0x2d')]);});_0x260baa[_0x63c4('0xab')](function(_0x481ccb){var _0x20ef4b=createFieldObject(_0xfb2a5d,_0x4bc66e,_0x481ccb[_0x63c4('0xac')],_0x481ccb[_0x63c4('0x2d')],_0x481ccb[_0x63c4('0xad')],![]);_0x4444c3[_0x63c4('0xae')](_0x20ef4b);});return Promise[_0x63c4('0xaf')](_0x4444c3);})[_0x63c4('0x28')](function(_0x1f3d01){_0x166003=_0x1f3d01;_0x154e55=Object[_0x63c4('0xa8')]([],_0x72739f);console[_0x63c4('0xb0')](_0x63c4('0xb1'),_0x72739f);_['remove'](_0x154e55,function(_0x9bb6d6){return _0x28eada[_0x63c4('0xaa')](_0x9bb6d6['name']);});console[_0x63c4('0xb0')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x154e55);_0x4444c3=[];_0x154e55[_0x63c4('0xab')](function(_0x17ca9a){var _0x522252=createFieldObject(_0xfb2a5d,_0x4bc66e,_0x17ca9a[_0x63c4('0xac')],_0x17ca9a['name'],_0x17ca9a[_0x63c4('0xad')],!![]);_0x4444c3[_0x63c4('0xae')](_0x522252);});return Promise[_0x63c4('0xaf')](_0x4444c3);})['then'](function(_0xe9e4ef){_0x3aa3e9=_0xe9e4ef;var _0x55583b=_0x166003['concat'](_0x3aa3e9);return{'count':_0x55583b['length'],'rows':_0x55583b};})[_0x63c4('0x28')](respondWithResult(_0x3c91e3,null))[_0x63c4('0x45')](function(_0x2e033c){console['log'](_0x63c4('0xb2')+_0x2e033c);var _0x43f2da=_0x226ae5['query'][_0x63c4('0xb3')]?0x1f4:_0x2e033c[_0x63c4('0xb4')]||0x1f4;logger[_0x63c4('0x2b')](_0x2e033c['stack']);delete _0x2e033c[_0x63c4('0x2d')];if(_0x43f2da===0x191){_0x43f2da=0x190;}_0x3c91e3['status'](_0x43f2da)['send'](_0x226ae5[_0x63c4('0x35')][_0x63c4('0xb3')]?{'message':_0x63c4('0xb5'),'statusCode':_0x2e033c['statusCode']}:_0x2e033c);});};function createFieldObject(_0x3edbdd,_0x29c642,_0x2bf6dc,_0x2e7504,_0x53170d,_0x4f67e9){return new Promise(function(_0x213207,_0x8e0e1c){var _0x12b9f5={'id':_0x2e7504,'name':_0x53170d,'custom':_0x4f67e9};if(_0x2bf6dc===_0x63c4('0xb6')){_0x12b9f5['options']=[{'name':_0x63c4('0xb7'),'value':'true'},{'name':_0x63c4('0xb8'),'value':_0x63c4('0xb9')}];_0x213207(_0x12b9f5);}else{var _0x371f48={'method':'GET','uri':_0x3edbdd+_0x63c4('0xba')+_0x2e7504,'auth':_0x29c642,'json':!![]};return rp(_0x371f48)[_0x63c4('0x28')](function(_0x3eee30){var _0x1b4518=[];if(_0x3eee30['result'][_0x63c4('0x39')]>0x0){_0x3eee30['result'][_0x63c4('0xab')](function(_0x547105){if(_0x547105[_0x63c4('0xbb')]===_0x63c4('0xb9')){var _0x4747d4={'name':_0x547105[_0x63c4('0xad')],'value':_0x547105[_0x63c4('0xbc')]};_0x1b4518['push'](_0x4747d4);}});}_0x12b9f5[_0x63c4('0xbd')]=_0x1b4518;if(_0x12b9f5[_0x63c4('0xbd')][_0x63c4('0x39')]>0x0){_0x213207(_0x12b9f5);}else{if(_0x4f67e9==![]){_0x213207();}else{_0x213207(_0x12b9f5);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 8a5f447..4fad21e 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 _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 +var _0xabce=['path','rimraf','../../config/environment','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0xabce,0x103));var _0xeabc=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xabce[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xeabc('0x8')]=function(_0x52a4d7,_0x229ba4){return _0x52a4d7['define'](_0xeabc('0x9'),attributes,{'tableName':_0xeabc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index bf859ea..430c560 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 _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 +var _0x472f=['../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x498e33,_0x985556){var _0x80dcc1=function(_0x416e86){while(--_0x416e86){_0x498e33['push'](_0x498e33['shift']());}};_0x80dcc1(++_0x985556);}(_0x472f,0x1e5));var _0xf472=function(_0x539fc9,_0x4d414c){_0x539fc9=_0x539fc9-0x0;var _0x3824fe=_0x472f[_0x539fc9];return _0x3824fe;};'use strict';var _=require(_0xf472('0x0'));var util=require(_0xf472('0x1'));var moment=require(_0xf472('0x2'));var BPromise=require('bluebird');var rs=require(_0xf472('0x3'));var fs=require('fs');var Redis=require(_0xf472('0x4'));var db=require(_0xf472('0x5'))['db'];var utils=require(_0xf472('0x6'));var logger=require(_0xf472('0x7'))(_0xf472('0x8'));var config=require(_0xf472('0x9'));var jayson=require(_0xf472('0xa'));var client=jayson[_0xf472('0xb')][_0xf472('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2facc1,_0x386aa6,_0x317530){return new BPromise(function(_0x113643,_0x595897){return client[_0xf472('0xd')](_0x2facc1,_0x317530)[_0xf472('0xe')](function(_0x9d9a37){logger[_0xf472('0xf')](_0xf472('0x10'),_0x386aa6,_0xf472('0x11'));logger[_0xf472('0x12')](_0xf472('0x13'),_0x386aa6,_0xf472('0x11'),JSON[_0xf472('0x14')](_0x9d9a37));if(_0x9d9a37[_0xf472('0x15')]){if(_0x9d9a37['error'][_0xf472('0x16')]===0x1f4){logger[_0xf472('0x15')](_0xf472('0x10'),_0x386aa6,_0x9d9a37['error']['message']);return _0x595897(_0x9d9a37['error'][_0xf472('0x17')]);}logger['error'](_0xf472('0x10'),_0x386aa6,_0x9d9a37[_0xf472('0x15')][_0xf472('0x17')]);return _0x113643(_0x9d9a37['error']['message']);}else{logger[_0xf472('0xf')](_0xf472('0x10'),_0x386aa6,_0xf472('0x11'));_0x113643(_0x9d9a37[_0xf472('0x18')]['message']);}})[_0xf472('0x19')](function(_0x138558){logger[_0xf472('0x15')](_0xf472('0x10'),_0x386aa6,_0x138558);_0x595897(_0x138558);});});}exports[_0xf472('0x1a')]=function(_0x1b41cd){var _0x900121=this;return new Promise(function(_0x389c32,_0xe45edd){return db[_0xf472('0x1b')]['findAll']({'raw':_0x1b41cd[_0xf472('0x1c')]?_0x1b41cd[_0xf472('0x1c')][_0xf472('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b41cd[_0xf472('0x1c')]?_0x1b41cd[_0xf472('0x1c')][_0xf472('0x1e')]||null:null,'attributes':_0x1b41cd['options']?_0x1b41cd['options'][_0xf472('0x1f')]||null:null,'limit':_0x1b41cd[_0xf472('0x1c')]?_0x1b41cd[_0xf472('0x1c')][_0xf472('0x20')]||null:null,'include':_0x1b41cd[_0xf472('0x1c')]?_0x1b41cd[_0xf472('0x1c')][_0xf472('0x21')]?_[_0xf472('0x22')](_0x1b41cd[_0xf472('0x1c')][_0xf472('0x21')],function(_0x4c149c){return{'model':db[_0x4c149c['model']],'as':_0x4c149c['as'],'attributes':_0x4c149c['attributes'],'include':_0x4c149c['include']?_['map'](_0x4c149c['include'],function(_0x2ac633){return{'model':db[_0x2ac633[_0xf472('0x23')]],'as':_0x2ac633['as'],'attributes':_0x2ac633[_0xf472('0x1f')],'include':_0x2ac633[_0xf472('0x21')]?_[_0xf472('0x22')](_0x2ac633[_0xf472('0x21')],function(_0x1a3ef5){return{'model':db[_0x1a3ef5['model']],'as':_0x1a3ef5['as'],'attributes':_0x1a3ef5[_0xf472('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf472('0xe')](function(_0x53bd6d){logger[_0xf472('0xf')](_0xf472('0x1a'),_0x1b41cd);logger[_0xf472('0x12')](_0xf472('0x1a'),_0x1b41cd,JSON[_0xf472('0x14')](_0x53bd6d));_0x389c32(_0x53bd6d);})['catch'](function(_0x267f60){logger[_0xf472('0x15')](_0xf472('0x1a'),_0x267f60[_0xf472('0x17')],_0x1b41cd);_0xe45edd(_0x900121[_0xf472('0x15')](0x1f4,_0x267f60[_0xf472('0x17')]));});});};exports[_0xf472('0x24')]=function(_0x2a32e3){var _0x2d569f=this;return new Promise(function(_0x35bc6c,_0x13ded7){return db[_0xf472('0x1b')][_0xf472('0x25')]({'raw':_0x2a32e3['options']?_0x2a32e3['options'][_0xf472('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a32e3['options']?_0x2a32e3[_0xf472('0x1c')][_0xf472('0x1e')]||null:null,'attributes':_0x2a32e3[_0xf472('0x1c')]?_0x2a32e3[_0xf472('0x1c')][_0xf472('0x1f')]||null:null,'include':_0x2a32e3['options']?_0x2a32e3[_0xf472('0x1c')]['include']?_['map'](_0x2a32e3['options'][_0xf472('0x21')],function(_0x2f395b){return{'model':db[_0x2f395b[_0xf472('0x23')]],'as':_0x2f395b['as'],'attributes':_0x2f395b[_0xf472('0x1f')],'include':_0x2f395b['include']?_[_0xf472('0x22')](_0x2f395b[_0xf472('0x21')],function(_0x31634e){return{'model':db[_0x31634e[_0xf472('0x23')]],'as':_0x31634e['as'],'attributes':_0x31634e[_0xf472('0x1f')],'include':_0x31634e[_0xf472('0x21')]?_[_0xf472('0x22')](_0x31634e[_0xf472('0x21')],function(_0x31f394){return{'model':db[_0x31f394[_0xf472('0x23')]],'as':_0x31f394['as'],'attributes':_0x31f394[_0xf472('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47682a){logger[_0xf472('0xf')](_0xf472('0x24'),_0x2a32e3);logger[_0xf472('0x12')](_0xf472('0x24'),_0x2a32e3,JSON[_0xf472('0x14')](_0x47682a));_0x35bc6c(_0x47682a);})['catch'](function(_0x31c688){logger['error'](_0xf472('0x24'),_0x31c688[_0xf472('0x17')],_0x2a32e3);_0x13ded7(_0x2d569f[_0xf472('0x15')](0x1f4,_0x31c688[_0xf472('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index df5545d..cd54b70 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 _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 +var _0x5e06=['./intServicenowConfiguration.controller','get','index','/:id','show','/:id/fields','getFields','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment'];(function(_0x2c79f5,_0x363799){var _0x154903=function(_0x4d779a){while(--_0x4d779a){_0x2c79f5['push'](_0x2c79f5['shift']());}};_0x154903(++_0x363799);}(_0x5e06,0x1dd));var _0x65e0=function(_0x2e5be5,_0x1c95fa){_0x2e5be5=_0x2e5be5-0x0;var _0x92dc0e=_0x5e06[_0x2e5be5];return _0x92dc0e;};'use strict';var multer=require(_0x65e0('0x0'));var util=require(_0x65e0('0x1'));var path=require(_0x65e0('0x2'));var timeout=require(_0x65e0('0x3'));var express=require('express');var router=express[_0x65e0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x65e0('0x5'));var controller=require(_0x65e0('0x6'));router[_0x65e0('0x7')]('/',auth['isAuthenticated'](),controller[_0x65e0('0x8')]);router[_0x65e0('0x7')](_0x65e0('0x9'),auth['isAuthenticated'](),controller[_0x65e0('0xa')]);router['get'](_0x65e0('0xb'),auth['isAuthenticated'](),controller[_0x65e0('0xc')]);router[_0x65e0('0x7')]('/:id/subjects',auth[_0x65e0('0xd')](),controller[_0x65e0('0xe')]);router[_0x65e0('0x7')](_0x65e0('0xf'),auth[_0x65e0('0xd')](),controller[_0x65e0('0x10')]);router[_0x65e0('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x65e0('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65e0('0x12')]('/:id',auth[_0x65e0('0xd')](),controller[_0x65e0('0x13')]);module[_0x65e0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2d13bc5..2ed214a 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 _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 +var _0xe26b=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe26b,0x166));var _0xbe26=function(_0x282468,_0x4f863f){_0x282468=_0x282468-0x0;var _0x616c6c=_0xe26b[_0x282468];return _0x616c6c;};'use strict';var Sequelize=require(_0xbe26('0x0'));module[_0xbe26('0x1')]={'name':{'type':Sequelize[_0xbe26('0x2')]},'description':{'type':Sequelize[_0xbe26('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a7df201..c01188d 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 _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 +var _0x6423=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','show','params','find','catch','create','body','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3d9755,_0x17ec01){var _0x4df845=function(_0x35a69a){while(--_0x35a69a){_0x3d9755['push'](_0x3d9755['shift']());}};_0x4df845(++_0x17ec01);}(_0x6423,0x1cd));var _0x3642=function(_0x499054,_0x2eabeb){_0x499054=_0x499054-0x0;var _0x1702cf=_0x6423[_0x499054];return _0x1702cf;};'use strict';var emlformat=require(_0x3642('0x0'));var rimraf=require(_0x3642('0x1'));var zipdir=require(_0x3642('0x2'));var jsonpatch=require(_0x3642('0x3'));var rp=require(_0x3642('0x4'));var moment=require('moment');var BPromise=require(_0x3642('0x5'));var Mustache=require(_0x3642('0x6'));var util=require(_0x3642('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3642('0x8'));var ejs=require(_0x3642('0x9'));var fs=require('fs');var fs_extra=require(_0x3642('0xa'));var _=require(_0x3642('0xb'));var squel=require(_0x3642('0xc'));var crypto=require(_0x3642('0xd'));var jsforce=require(_0x3642('0xe'));var deskjs=require(_0x3642('0xf'));var toCsv=require(_0x3642('0x8'));var querystring=require(_0x3642('0x10'));var Papa=require(_0x3642('0x11'));var Redis=require(_0x3642('0x12'));var authService=require(_0x3642('0x13'));var qs=require(_0x3642('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3642('0x15'))(_0x3642('0x16'));var utils=require(_0x3642('0x17'));var config=require(_0x3642('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3642('0x19'))['db'];function respondWithStatusCode(_0x28c9f5,_0x48ccfc){_0x48ccfc=_0x48ccfc||0xcc;return function(_0x4fdacf){if(_0x4fdacf){return _0x28c9f5[_0x3642('0x1a')](_0x48ccfc);}return _0x28c9f5['status'](_0x48ccfc)[_0x3642('0x1b')]();};}function respondWithResult(_0x21c560,_0x13fdbb){_0x13fdbb=_0x13fdbb||0xc8;return function(_0x39c5e5){if(_0x39c5e5){return _0x21c560[_0x3642('0x1c')](_0x13fdbb)[_0x3642('0x1d')](_0x39c5e5);}};}function respondWithFilteredResult(_0x4c7ff5,_0x4b6059){return function(_0x5ee3da){if(_0x5ee3da){var _0xa2ff23=typeof _0x4b6059[_0x3642('0x1e')]===_0x3642('0x1f')&&typeof _0x4b6059[_0x3642('0x20')]===_0x3642('0x1f');var _0x2f6cd1=_0x5ee3da[_0x3642('0x21')];var _0x2dab39=_0xa2ff23?0x0:_0x4b6059[_0x3642('0x1e')];var _0x203885=_0xa2ff23?_0x5ee3da['count']:_0x4b6059[_0x3642('0x1e')]+_0x4b6059['limit'];var _0x319e8d;if(_0x203885>=_0x2f6cd1){_0x203885=_0x2f6cd1;_0x319e8d=0xc8;}else{_0x319e8d=0xce;}_0x4c7ff5[_0x3642('0x1c')](_0x319e8d);return _0x4c7ff5['set'](_0x3642('0x22'),_0x2dab39+'-'+_0x203885+'/'+_0x2f6cd1)['json'](_0x5ee3da);}return null;};}function patchUpdates(_0x226534){return function(_0x4e6512){try{jsonpatch['apply'](_0x4e6512,_0x226534,!![]);}catch(_0x257831){return BPromise[_0x3642('0x23')](_0x257831);}return _0x4e6512[_0x3642('0x24')]();};}function saveUpdates(_0x18b069,_0x216bdc){return function(_0x20cf78){if(_0x20cf78){return _0x20cf78[_0x3642('0x25')](_0x18b069)[_0x3642('0x26')](function(_0xe426a9){return _0xe426a9;});}return null;};}function removeEntity(_0x37bdc3,_0x13c2a0){return function(_0x5ef78b){if(_0x5ef78b){return _0x5ef78b[_0x3642('0x27')]()[_0x3642('0x26')](function(){_0x37bdc3[_0x3642('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24dccc,_0x217112){return function(_0x382e4f){if(!_0x382e4f){_0x24dccc[_0x3642('0x1a')](0x194);}return _0x382e4f;};}function handleError(_0x9dabbc,_0x52b3b8){_0x52b3b8=_0x52b3b8||0x1f4;return function(_0x161955){logger[_0x3642('0x28')](_0x161955[_0x3642('0x29')]);if(_0x161955['name']){delete _0x161955[_0x3642('0x2a')];}_0x9dabbc[_0x3642('0x1c')](_0x52b3b8)[_0x3642('0x2b')](_0x161955);};}exports['index']=function(_0x1cbe2f,_0x219393){var _0x26e4e8={},_0x587cb4={},_0x57568a={'count':0x0,'rows':[]};var _0x11ebaf=_[_0x3642('0x2c')](db[_0x3642('0x2d')][_0x3642('0x2e')],function(_0x472c27){return{'name':_0x472c27[_0x3642('0x2f')],'type':_0x472c27[_0x3642('0x30')]['key']};});_0x587cb4['model']=_['map'](_0x11ebaf,'name');_0x587cb4['query']=_[_0x3642('0x31')](_0x1cbe2f[_0x3642('0x32')]);_0x587cb4[_0x3642('0x33')]=_[_0x3642('0x34')](_0x587cb4['model'],_0x587cb4['query']);_0x26e4e8[_0x3642('0x35')]=_['intersection'](_0x587cb4[_0x3642('0x36')],qs[_0x3642('0x37')](_0x1cbe2f[_0x3642('0x32')]['fields']));_0x26e4e8[_0x3642('0x35')]=_0x26e4e8['attributes'][_0x3642('0x38')]?_0x26e4e8[_0x3642('0x35')]:_0x587cb4[_0x3642('0x36')];if(!_0x1cbe2f[_0x3642('0x32')][_0x3642('0x39')](_0x3642('0x3a'))){_0x26e4e8['limit']=qs[_0x3642('0x20')](_0x1cbe2f[_0x3642('0x32')][_0x3642('0x20')]);_0x26e4e8[_0x3642('0x1e')]=qs[_0x3642('0x1e')](_0x1cbe2f[_0x3642('0x32')][_0x3642('0x1e')]);}_0x26e4e8[_0x3642('0x3b')]=qs[_0x3642('0x3c')](_0x1cbe2f['query'][_0x3642('0x3c')]);_0x26e4e8[_0x3642('0x3d')]=qs[_0x3642('0x33')](_[_0x3642('0x3e')](_0x1cbe2f[_0x3642('0x32')],_0x587cb4[_0x3642('0x33')]),_0x11ebaf);if(_0x1cbe2f[_0x3642('0x32')][_0x3642('0x3f')]){_0x26e4e8[_0x3642('0x3d')]=_[_0x3642('0x40')](_0x26e4e8[_0x3642('0x3d')],{'$or':_['map'](_0x11ebaf,function(_0x11ad82){if(_0x11ad82['type']!=='VIRTUAL'){var _0x318464={};_0x318464[_0x11ad82[_0x3642('0x2a')]]={'$like':'%'+_0x1cbe2f['query'][_0x3642('0x3f')]+'%'};return _0x318464;}})});}_0x26e4e8=_['merge']({},_0x26e4e8,_0x1cbe2f[_0x3642('0x41')]);var _0x26181c={'where':_0x26e4e8[_0x3642('0x3d')]};return db[_0x3642('0x2d')][_0x3642('0x21')](_0x26181c)['then'](function(_0x20a2e1){_0x57568a['count']=_0x20a2e1;if(_0x1cbe2f[_0x3642('0x32')][_0x3642('0x42')]){_0x26e4e8[_0x3642('0x43')]=[{'all':!![]}];}return db[_0x3642('0x2d')]['findAll'](_0x26e4e8);})[_0x3642('0x26')](function(_0x17a6e0){_0x57568a['rows']=_0x17a6e0;return _0x57568a;})[_0x3642('0x26')](respondWithFilteredResult(_0x219393,_0x26e4e8))['catch'](handleError(_0x219393,null));};exports[_0x3642('0x44')]=function(_0x2eb54b,_0x4bfa29){var _0xa8d223={'raw':![],'where':{'id':_0x2eb54b[_0x3642('0x45')]['id']}},_0x555f21={};_0x555f21[_0x3642('0x36')]=_['keys'](db[_0x3642('0x2d')][_0x3642('0x2e')]);_0x555f21[_0x3642('0x32')]=_[_0x3642('0x31')](_0x2eb54b[_0x3642('0x32')]);_0x555f21[_0x3642('0x33')]=_[_0x3642('0x34')](_0x555f21[_0x3642('0x36')],_0x555f21[_0x3642('0x32')]);_0xa8d223[_0x3642('0x35')]=_['intersection'](_0x555f21[_0x3642('0x36')],qs[_0x3642('0x37')](_0x2eb54b[_0x3642('0x32')][_0x3642('0x37')]));_0xa8d223[_0x3642('0x35')]=_0xa8d223[_0x3642('0x35')][_0x3642('0x38')]?_0xa8d223[_0x3642('0x35')]:_0x555f21['model'];if(_0x2eb54b[_0x3642('0x32')][_0x3642('0x42')]){_0xa8d223[_0x3642('0x43')]=[{'all':!![]}];}_0xa8d223=_[_0x3642('0x40')]({},_0xa8d223,_0x2eb54b[_0x3642('0x41')]);return db[_0x3642('0x2d')][_0x3642('0x46')](_0xa8d223)[_0x3642('0x26')](handleEntityNotFound(_0x4bfa29,null))[_0x3642('0x26')](respondWithResult(_0x4bfa29,null))[_0x3642('0x47')](handleError(_0x4bfa29,null));};exports[_0x3642('0x48')]=function(_0x11482b,_0x137a0a){return db[_0x3642('0x2d')][_0x3642('0x48')](_0x11482b['body'],{})[_0x3642('0x26')](respondWithResult(_0x137a0a,0xc9))[_0x3642('0x47')](handleError(_0x137a0a,null));};exports[_0x3642('0x25')]=function(_0x280e25,_0x3de0cb){if(_0x280e25[_0x3642('0x49')]['id']){delete _0x280e25[_0x3642('0x49')]['id'];}return db['ServicenowConfiguration'][_0x3642('0x46')]({'where':{'id':_0x280e25[_0x3642('0x45')]['id']}})[_0x3642('0x26')](handleEntityNotFound(_0x3de0cb,null))[_0x3642('0x26')](saveUpdates(_0x280e25[_0x3642('0x49')],null))[_0x3642('0x26')](respondWithResult(_0x3de0cb,null))['catch'](handleError(_0x3de0cb,null));};exports[_0x3642('0x27')]=function(_0x2629b4,_0x2123f0){return db['ServicenowConfiguration'][_0x3642('0x46')]({'where':{'id':_0x2629b4[_0x3642('0x45')]['id']}})['then'](handleEntityNotFound(_0x2123f0,null))[_0x3642('0x26')](removeEntity(_0x2123f0,null))[_0x3642('0x47')](handleError(_0x2123f0,null));};exports['getFields']=function(_0x4b85b5,_0x3d26d9,_0x106f30){var _0x234595={};var _0x744fb={};var _0x5369c2;var _0x375533;return db[_0x3642('0x2d')][_0x3642('0x4a')]({'where':{'id':_0x4b85b5['params']['id']}})['then'](handleEntityNotFound(_0x3d26d9,null))['then'](function(_0x118bea){if(_0x118bea){_0x5369c2=_0x118bea;_0x744fb['model']=_['keys'](db[_0x3642('0x4b')][_0x3642('0x2e')]);_0x744fb[_0x3642('0x32')]=_['keys'](_0x4b85b5['query']);_0x744fb['filters']=_[_0x3642('0x34')](_0x744fb[_0x3642('0x36')],_0x744fb[_0x3642('0x32')]);_0x234595[_0x3642('0x35')]=_[_0x3642('0x34')](_0x744fb[_0x3642('0x36')],qs[_0x3642('0x37')](_0x4b85b5[_0x3642('0x32')]['fields']));_0x234595[_0x3642('0x35')]=_0x234595[_0x3642('0x35')]['length']?_0x234595[_0x3642('0x35')]:_0x744fb[_0x3642('0x36')];_0x234595['order']=qs[_0x3642('0x3c')](_0x4b85b5[_0x3642('0x32')]['sort']);_0x234595[_0x3642('0x3d')]=qs[_0x3642('0x33')](_[_0x3642('0x3e')](_0x4b85b5[_0x3642('0x32')],_0x744fb[_0x3642('0x33')]));if(_0x4b85b5[_0x3642('0x32')][_0x3642('0x3f')]){_0x234595[_0x3642('0x3d')]=_[_0x3642('0x40')](_0x234595[_0x3642('0x3d')],{'$or':_[_0x3642('0x2c')](_0x234595[_0x3642('0x35')],function(_0x3e3923){var _0x5a7f97={};_0x5a7f97[_0x3e3923]={'$like':'%'+_0x4b85b5[_0x3642('0x32')][_0x3642('0x3f')]+'%'};return _0x5a7f97;})});}_0x234595=_[_0x3642('0x40')]({},_0x234595,_0x4b85b5[_0x3642('0x41')]);return _0x5369c2[_0x3642('0x4c')](_0x234595);}})[_0x3642('0x26')](function(_0x39ae92){if(_0x39ae92){_0x375533=_0x39ae92[_0x3642('0x38')];if(!_0x4b85b5[_0x3642('0x32')]['hasOwnProperty'](_0x3642('0x3a'))){_0x234595[_0x3642('0x20')]=qs[_0x3642('0x20')](_0x4b85b5[_0x3642('0x32')]['limit']);_0x234595[_0x3642('0x1e')]=qs[_0x3642('0x1e')](_0x4b85b5['query'][_0x3642('0x1e')]);}return _0x5369c2[_0x3642('0x4c')](_0x234595);}})[_0x3642('0x26')](function(_0x34a598){if(_0x34a598){return _0x34a598?{'count':_0x375533,'rows':_0x34a598}:null;}})[_0x3642('0x26')](respondWithResult(_0x3d26d9,null))[_0x3642('0x47')](handleError(_0x3d26d9,null));};exports['getSubjects']=function(_0x2739f0,_0x38c608,_0x2bc37d){var _0x2a3e40={};var _0x30592f={};var _0x2b5811;var _0x259cab;return db[_0x3642('0x2d')][_0x3642('0x4a')]({'where':{'id':_0x2739f0[_0x3642('0x45')]['id']}})[_0x3642('0x26')](handleEntityNotFound(_0x38c608,null))[_0x3642('0x26')](function(_0x494500){if(_0x494500){_0x2b5811=_0x494500;_0x30592f[_0x3642('0x36')]=_['keys'](db[_0x3642('0x4b')]['rawAttributes']);_0x30592f[_0x3642('0x32')]=_['keys'](_0x2739f0[_0x3642('0x32')]);_0x30592f['filters']=_['intersection'](_0x30592f[_0x3642('0x36')],_0x30592f[_0x3642('0x32')]);_0x2a3e40[_0x3642('0x35')]=_['intersection'](_0x30592f['model'],qs['fields'](_0x2739f0[_0x3642('0x32')][_0x3642('0x37')]));_0x2a3e40[_0x3642('0x35')]=_0x2a3e40[_0x3642('0x35')][_0x3642('0x38')]?_0x2a3e40[_0x3642('0x35')]:_0x30592f[_0x3642('0x36')];_0x2a3e40[_0x3642('0x3b')]=qs[_0x3642('0x3c')](_0x2739f0['query']['sort']);_0x2a3e40[_0x3642('0x3d')]=qs['filters'](_[_0x3642('0x3e')](_0x2739f0['query'],_0x30592f[_0x3642('0x33')]));if(_0x2739f0[_0x3642('0x32')][_0x3642('0x3f')]){_0x2a3e40[_0x3642('0x3d')]=_[_0x3642('0x40')](_0x2a3e40[_0x3642('0x3d')],{'$or':_[_0x3642('0x2c')](_0x2a3e40[_0x3642('0x35')],function(_0x4a843e){var _0x5727e6={};_0x5727e6[_0x4a843e]={'$like':'%'+_0x2739f0[_0x3642('0x32')][_0x3642('0x3f')]+'%'};return _0x5727e6;})});}_0x2a3e40=_[_0x3642('0x40')]({},_0x2a3e40,_0x2739f0[_0x3642('0x41')]);return _0x2b5811['getSubjects'](_0x2a3e40);}})['then'](function(_0x28357b){if(_0x28357b){_0x259cab=_0x28357b[_0x3642('0x38')];if(!_0x2739f0[_0x3642('0x32')][_0x3642('0x39')](_0x3642('0x3a'))){_0x2a3e40[_0x3642('0x20')]=qs[_0x3642('0x20')](_0x2739f0['query'][_0x3642('0x20')]);_0x2a3e40[_0x3642('0x1e')]=qs[_0x3642('0x1e')](_0x2739f0[_0x3642('0x32')][_0x3642('0x1e')]);}return _0x2b5811[_0x3642('0x4d')](_0x2a3e40);}})[_0x3642('0x26')](function(_0x4ba1c6){if(_0x4ba1c6){return _0x4ba1c6?{'count':_0x259cab,'rows':_0x4ba1c6}:null;}})['then'](respondWithResult(_0x38c608,null))[_0x3642('0x47')](handleError(_0x38c608,null));};exports[_0x3642('0x4e')]=function(_0x24b23f,_0x420ca2,_0x2e3efb){var _0x57cfb6={};var _0x1c98a7={};var _0x37299c;var _0x226d4e;return db[_0x3642('0x2d')]['findOne']({'where':{'id':_0x24b23f['params']['id']}})[_0x3642('0x26')](handleEntityNotFound(_0x420ca2,null))[_0x3642('0x26')](function(_0x550338){if(_0x550338){_0x37299c=_0x550338;_0x1c98a7[_0x3642('0x36')]=_[_0x3642('0x31')](db[_0x3642('0x4b')][_0x3642('0x2e')]);_0x1c98a7['query']=_[_0x3642('0x31')](_0x24b23f[_0x3642('0x32')]);_0x1c98a7[_0x3642('0x33')]=_[_0x3642('0x34')](_0x1c98a7[_0x3642('0x36')],_0x1c98a7[_0x3642('0x32')]);_0x57cfb6[_0x3642('0x35')]=_[_0x3642('0x34')](_0x1c98a7[_0x3642('0x36')],qs[_0x3642('0x37')](_0x24b23f['query'][_0x3642('0x37')]));_0x57cfb6[_0x3642('0x35')]=_0x57cfb6[_0x3642('0x35')][_0x3642('0x38')]?_0x57cfb6[_0x3642('0x35')]:_0x1c98a7['model'];_0x57cfb6[_0x3642('0x3b')]=qs[_0x3642('0x3c')](_0x24b23f['query'][_0x3642('0x3c')]);_0x57cfb6['where']=qs[_0x3642('0x33')](_[_0x3642('0x3e')](_0x24b23f['query'],_0x1c98a7[_0x3642('0x33')]));if(_0x24b23f[_0x3642('0x32')][_0x3642('0x3f')]){_0x57cfb6['where']=_[_0x3642('0x40')](_0x57cfb6[_0x3642('0x3d')],{'$or':_['map'](_0x57cfb6[_0x3642('0x35')],function(_0x36bbe5){var _0x5cca5e={};_0x5cca5e[_0x36bbe5]={'$like':'%'+_0x24b23f[_0x3642('0x32')][_0x3642('0x3f')]+'%'};return _0x5cca5e;})});}_0x57cfb6=_[_0x3642('0x40')]({},_0x57cfb6,_0x24b23f[_0x3642('0x41')]);return _0x37299c[_0x3642('0x4e')](_0x57cfb6);}})['then'](function(_0x221b83){if(_0x221b83){_0x226d4e=_0x221b83['length'];if(!_0x24b23f[_0x3642('0x32')][_0x3642('0x39')]('nolimit')){_0x57cfb6['limit']=qs[_0x3642('0x20')](_0x24b23f['query'][_0x3642('0x20')]);_0x57cfb6[_0x3642('0x1e')]=qs[_0x3642('0x1e')](_0x24b23f[_0x3642('0x32')][_0x3642('0x1e')]);}return _0x37299c['getDescriptions'](_0x57cfb6);}})['then'](function(_0x7aa9a6){if(_0x7aa9a6){return _0x7aa9a6?{'count':_0x226d4e,'rows':_0x7aa9a6}:null;}})[_0x3642('0x26')](respondWithResult(_0x420ca2,null))['catch'](handleError(_0x420ca2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index cbc4494..e4364f5 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 _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 +var _0x594d=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x5b6d78,_0x24b5ee){var _0x1b5432=function(_0x1168d4){while(--_0x1168d4){_0x5b6d78['push'](_0x5b6d78['shift']());}};_0x1b5432(++_0x24b5ee);}(_0x594d,0x92));var _0xd594=function(_0x5f7fc0,_0x251897){_0x5f7fc0=_0x5f7fc0-0x0;var _0xa02472=_0x594d[_0x5f7fc0];return _0xa02472;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd594('0x1'));var moment=require(_0xd594('0x2'));var BPromise=require(_0xd594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd594('0x4'));var rimraf=require(_0xd594('0x5'));var config=require(_0xd594('0x6'));var attributes=require(_0xd594('0x7'));module['exports']=function(_0x3347cd,_0x498ef4){return _0x3347cd[_0xd594('0x8')](_0xd594('0x9'),attributes,{'tableName':_0xd594('0xa'),'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 6e454b8..5e865bb 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 _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 +var _0x6e06=['message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x1bb37d,_0x56496a){var _0x29e971=function(_0x28a5c2){while(--_0x28a5c2){_0x1bb37d['push'](_0x1bb37d['shift']());}};_0x29e971(++_0x56496a);}(_0x6e06,0x9a));var _0x66e0=function(_0x48a7b8,_0x320352){_0x48a7b8=_0x48a7b8-0x0;var _0x3ce9ca=_0x6e06[_0x48a7b8];return _0x3ce9ca;};'use strict';var _=require(_0x66e0('0x0'));var util=require(_0x66e0('0x1'));var moment=require(_0x66e0('0x2'));var BPromise=require(_0x66e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e0('0x4'))['db'];var utils=require(_0x66e0('0x5'));var logger=require(_0x66e0('0x6'))(_0x66e0('0x7'));var config=require(_0x66e0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x66e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a93f0,_0x35fbe7,_0x2a37e9){return new BPromise(function(_0x2dc4fa,_0x138fbe){return client[_0x66e0('0xa')](_0x5a93f0,_0x2a37e9)['then'](function(_0x29d28b){logger[_0x66e0('0xb')](_0x66e0('0xc'),_0x35fbe7,_0x66e0('0xd'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x35fbe7,_0x66e0('0xd'),JSON['stringify'](_0x29d28b));if(_0x29d28b[_0x66e0('0xe')]){if(_0x29d28b[_0x66e0('0xe')][_0x66e0('0xf')]===0x1f4){logger[_0x66e0('0xe')](_0x66e0('0xc'),_0x35fbe7,_0x29d28b['error'][_0x66e0('0x10')]);return _0x138fbe(_0x29d28b[_0x66e0('0xe')][_0x66e0('0x10')]);}logger[_0x66e0('0xe')](_0x66e0('0xc'),_0x35fbe7,_0x29d28b[_0x66e0('0xe')][_0x66e0('0x10')]);return _0x2dc4fa(_0x29d28b['error'][_0x66e0('0x10')]);}else{logger[_0x66e0('0xb')](_0x66e0('0xc'),_0x35fbe7,_0x66e0('0xd'));_0x2dc4fa(_0x29d28b['result'][_0x66e0('0x10')]);}})['catch'](function(_0x20f896){logger[_0x66e0('0xe')](_0x66e0('0xc'),_0x35fbe7,_0x20f896);_0x138fbe(_0x20f896);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index b82ae12..b0b473d 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 _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 +var _0x9be4=['post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id'];(function(_0x26a4ea,_0xa72fb8){var _0x1b669e=function(_0x4e8bba){while(--_0x4e8bba){_0x26a4ea['push'](_0x26a4ea['shift']());}};_0x1b669e(++_0xa72fb8);}(_0x9be4,0x116));var _0x49be=function(_0x58fe84,_0x312d3d){_0x58fe84=_0x58fe84-0x0;var _0x325362=_0x9be4[_0x58fe84];return _0x325362;};'use strict';var multer=require(_0x49be('0x0'));var util=require(_0x49be('0x1'));var path=require('path');var timeout=require(_0x49be('0x2'));var express=require(_0x49be('0x3'));var router=express[_0x49be('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x49be('0x5'));var interaction=require(_0x49be('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x49be('0x7')](),controller['index']);router[_0x49be('0x8')](_0x49be('0x9'),auth[_0x49be('0x7')](),controller['show']);router[_0x49be('0xa')]('/',auth[_0x49be('0x7')](),controller[_0x49be('0xb')]);router[_0x49be('0xc')](_0x49be('0x9'),auth[_0x49be('0x7')](),controller[_0x49be('0xd')]);router['delete'](_0x49be('0x9'),auth[_0x49be('0x7')](),controller[_0x49be('0xe')]);module[_0x49be('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b7649d1..5329332 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 _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 +var _0x6aa4=['ENUM','string','variable','customVariable','picklist','STRING','sequelize'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0x6aa4,0x15d));var _0x46aa=function(_0x122183,_0x30dd3a){_0x122183=_0x122183-0x0;var _0x1c919f=_0x6aa4[_0x122183];return _0x1c919f;};'use strict';var Sequelize=require(_0x46aa('0x0'));module['exports']={'type':{'type':Sequelize[_0x46aa('0x1')](_0x46aa('0x2'),_0x46aa('0x3'),_0x46aa('0x4'),'keyValue',_0x46aa('0x5')),'defaultValue':_0x46aa('0x2')},'content':{'type':Sequelize[_0x46aa('0x6')]},'key':{'type':Sequelize[_0x46aa('0x6')]},'keyType':{'type':Sequelize[_0x46aa('0x1')](_0x46aa('0x2'),_0x46aa('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x46aa('0x6')]},'idField':{'type':Sequelize[_0x46aa('0x6')]},'nameField':{'type':Sequelize[_0x46aa('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x46aa('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 1c700db..195d24c 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 _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 +var _0xd2f5=['status','end','json','offset','limit','count','reject','save','update','destroy','then','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x46cbab,_0x1a943d){var _0x5d8f04=function(_0x227542){while(--_0x227542){_0x46cbab['push'](_0x46cbab['shift']());}};_0x5d8f04(++_0x1a943d);}(_0xd2f5,0x78));var _0x5d2f=function(_0x2073ff,_0x398943){_0x2073ff=_0x2073ff-0x0;var _0x19e7c4=_0xd2f5[_0x2073ff];return _0x19e7c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d2f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5d2f('0x1'));var moment=require(_0x5d2f('0x2'));var BPromise=require(_0x5d2f('0x3'));var Mustache=require(_0x5d2f('0x4'));var util=require(_0x5d2f('0x5'));var path=require(_0x5d2f('0x6'));var sox=require(_0x5d2f('0x7'));var csv=require(_0x5d2f('0x8'));var ejs=require(_0x5d2f('0x9'));var fs=require('fs');var fs_extra=require(_0x5d2f('0xa'));var _=require(_0x5d2f('0xb'));var squel=require(_0x5d2f('0xc'));var crypto=require('crypto');var jsforce=require(_0x5d2f('0xd'));var deskjs=require(_0x5d2f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5d2f('0xf'));var Papa=require(_0x5d2f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d2f('0x11'));var hardwareService=require(_0x5d2f('0x12'));var logger=require('../../config/logger')(_0x5d2f('0x13'));var utils=require(_0x5d2f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5d2f('0x15'));var db=require(_0x5d2f('0x16'))['db'];function respondWithStatusCode(_0x6e12d6,_0x5320c9){_0x5320c9=_0x5320c9||0xcc;return function(_0x10c675){if(_0x10c675){return _0x6e12d6[_0x5d2f('0x17')](_0x5320c9);}return _0x6e12d6[_0x5d2f('0x18')](_0x5320c9)[_0x5d2f('0x19')]();};}function respondWithResult(_0x40a802,_0x53ecde){_0x53ecde=_0x53ecde||0xc8;return function(_0x22ffb3){if(_0x22ffb3){return _0x40a802['status'](_0x53ecde)[_0x5d2f('0x1a')](_0x22ffb3);}};}function respondWithFilteredResult(_0x341706,_0x31fa19){return function(_0x2bdb26){if(_0x2bdb26){var _0x2fd180=typeof _0x31fa19[_0x5d2f('0x1b')]==='undefined'&&typeof _0x31fa19[_0x5d2f('0x1c')]==='undefined';var _0xb917ff=_0x2bdb26[_0x5d2f('0x1d')];var _0x2e7d51=_0x2fd180?0x0:_0x31fa19['offset'];var _0x5736f9=_0x2fd180?_0x2bdb26[_0x5d2f('0x1d')]:_0x31fa19[_0x5d2f('0x1b')]+_0x31fa19[_0x5d2f('0x1c')];var _0x3312a6;if(_0x5736f9>=_0xb917ff){_0x5736f9=_0xb917ff;_0x3312a6=0xc8;}else{_0x3312a6=0xce;}_0x341706[_0x5d2f('0x18')](_0x3312a6);return _0x341706['set']('Content-Range',_0x2e7d51+'-'+_0x5736f9+'/'+_0xb917ff)['json'](_0x2bdb26);}return null;};}function patchUpdates(_0x416801){return function(_0x3b618a){try{jsonpatch['apply'](_0x3b618a,_0x416801,!![]);}catch(_0x4b11c7){return BPromise[_0x5d2f('0x1e')](_0x4b11c7);}return _0x3b618a[_0x5d2f('0x1f')]();};}function saveUpdates(_0x133f9d,_0x41cc56){return function(_0x4d3b89){if(_0x4d3b89){return _0x4d3b89[_0x5d2f('0x20')](_0x133f9d)['then'](function(_0x43e892){return _0x43e892;});}return null;};}function removeEntity(_0x1dde52,_0x4a93dd){return function(_0x5833a8){if(_0x5833a8){return _0x5833a8[_0x5d2f('0x21')]()[_0x5d2f('0x22')](function(){_0x1dde52[_0x5d2f('0x18')](0xcc)[_0x5d2f('0x19')]();});}};}function handleEntityNotFound(_0x2df381,_0xa1a337){return function(_0x74dbf5){if(!_0x74dbf5){_0x2df381[_0x5d2f('0x17')](0x194);}return _0x74dbf5;};}function handleError(_0x3f0712,_0x22a813){_0x22a813=_0x22a813||0x1f4;return function(_0x4e028f){logger['error'](_0x4e028f[_0x5d2f('0x23')]);if(_0x4e028f['name']){delete _0x4e028f[_0x5d2f('0x24')];}_0x3f0712[_0x5d2f('0x18')](_0x22a813)[_0x5d2f('0x25')](_0x4e028f);};}exports[_0x5d2f('0x26')]=function(_0x40533e,_0x3e38c0){var _0x25de14={},_0x9c27e3={},_0x2f4458={'count':0x0,'rows':[]};var _0x245460=_[_0x5d2f('0x27')](db[_0x5d2f('0x28')][_0x5d2f('0x29')],function(_0x2c253b){return{'name':_0x2c253b[_0x5d2f('0x2a')],'type':_0x2c253b[_0x5d2f('0x2b')][_0x5d2f('0x2c')]};});_0x9c27e3[_0x5d2f('0x2d')]=_[_0x5d2f('0x27')](_0x245460,_0x5d2f('0x24'));_0x9c27e3[_0x5d2f('0x2e')]=_[_0x5d2f('0x2f')](_0x40533e['query']);_0x9c27e3['filters']=_['intersection'](_0x9c27e3[_0x5d2f('0x2d')],_0x9c27e3['query']);_0x25de14[_0x5d2f('0x30')]=_[_0x5d2f('0x31')](_0x9c27e3[_0x5d2f('0x2d')],qs[_0x5d2f('0x32')](_0x40533e[_0x5d2f('0x2e')]['fields']));_0x25de14[_0x5d2f('0x30')]=_0x25de14[_0x5d2f('0x30')][_0x5d2f('0x33')]?_0x25de14['attributes']:_0x9c27e3[_0x5d2f('0x2d')];if(!_0x40533e[_0x5d2f('0x2e')][_0x5d2f('0x34')](_0x5d2f('0x35'))){_0x25de14[_0x5d2f('0x1c')]=qs[_0x5d2f('0x1c')](_0x40533e[_0x5d2f('0x2e')][_0x5d2f('0x1c')]);_0x25de14['offset']=qs['offset'](_0x40533e[_0x5d2f('0x2e')][_0x5d2f('0x1b')]);}_0x25de14[_0x5d2f('0x36')]=qs[_0x5d2f('0x37')](_0x40533e[_0x5d2f('0x2e')]['sort']);_0x25de14[_0x5d2f('0x38')]=qs['filters'](_[_0x5d2f('0x39')](_0x40533e[_0x5d2f('0x2e')],_0x9c27e3['filters']),_0x245460);if(_0x40533e['query']['filter']){_0x25de14['where']=_['merge'](_0x25de14[_0x5d2f('0x38')],{'$or':_[_0x5d2f('0x27')](_0x245460,function(_0x29c8f1){if(_0x29c8f1['type']!==_0x5d2f('0x3a')){var _0xc34d9c={};_0xc34d9c[_0x29c8f1[_0x5d2f('0x24')]]={'$like':'%'+_0x40533e[_0x5d2f('0x2e')]['filter']+'%'};return _0xc34d9c;}})});}_0x25de14=_[_0x5d2f('0x3b')]({},_0x25de14,_0x40533e[_0x5d2f('0x3c')]);var _0x195353={'where':_0x25de14[_0x5d2f('0x38')]};return db[_0x5d2f('0x28')][_0x5d2f('0x1d')](_0x195353)[_0x5d2f('0x22')](function(_0x4a35aa){_0x2f4458['count']=_0x4a35aa;if(_0x40533e[_0x5d2f('0x2e')][_0x5d2f('0x3d')]){_0x25de14[_0x5d2f('0x3e')]=[{'all':!![]}];}return db[_0x5d2f('0x28')][_0x5d2f('0x3f')](_0x25de14);})[_0x5d2f('0x22')](function(_0x4e462e){_0x2f4458[_0x5d2f('0x40')]=_0x4e462e;return _0x2f4458;})[_0x5d2f('0x22')](respondWithFilteredResult(_0x3e38c0,_0x25de14))[_0x5d2f('0x41')](handleError(_0x3e38c0,null));};exports[_0x5d2f('0x42')]=function(_0x1db576,_0x6d9782){var _0x3a6398={'raw':!![],'where':{'id':_0x1db576[_0x5d2f('0x43')]['id']}},_0x30e0de={};_0x30e0de['model']=_[_0x5d2f('0x2f')](db['ServicenowField'][_0x5d2f('0x29')]);_0x30e0de[_0x5d2f('0x2e')]=_['keys'](_0x1db576['query']);_0x30e0de[_0x5d2f('0x44')]=_[_0x5d2f('0x31')](_0x30e0de['model'],_0x30e0de[_0x5d2f('0x2e')]);_0x3a6398[_0x5d2f('0x30')]=_[_0x5d2f('0x31')](_0x30e0de[_0x5d2f('0x2d')],qs[_0x5d2f('0x32')](_0x1db576[_0x5d2f('0x2e')][_0x5d2f('0x32')]));_0x3a6398[_0x5d2f('0x30')]=_0x3a6398[_0x5d2f('0x30')][_0x5d2f('0x33')]?_0x3a6398['attributes']:_0x30e0de['model'];if(_0x1db576[_0x5d2f('0x2e')][_0x5d2f('0x3d')]){_0x3a6398[_0x5d2f('0x3e')]=[{'all':!![]}];}_0x3a6398=_['merge']({},_0x3a6398,_0x1db576['options']);return db[_0x5d2f('0x28')][_0x5d2f('0x45')](_0x3a6398)[_0x5d2f('0x22')](handleEntityNotFound(_0x6d9782,null))[_0x5d2f('0x22')](respondWithResult(_0x6d9782,null))[_0x5d2f('0x41')](handleError(_0x6d9782,null));};exports[_0x5d2f('0x46')]=function(_0x22790b,_0x1a5d84){return db[_0x5d2f('0x28')][_0x5d2f('0x46')](_0x22790b[_0x5d2f('0x47')],{})['then'](respondWithResult(_0x1a5d84,0xc9))[_0x5d2f('0x41')](handleError(_0x1a5d84,null));};exports[_0x5d2f('0x20')]=function(_0x2889ec,_0x5a2903){if(_0x2889ec['body']['id']){delete _0x2889ec[_0x5d2f('0x47')]['id'];}return db[_0x5d2f('0x28')][_0x5d2f('0x45')]({'where':{'id':_0x2889ec[_0x5d2f('0x43')]['id']}})[_0x5d2f('0x22')](handleEntityNotFound(_0x5a2903,null))[_0x5d2f('0x22')](saveUpdates(_0x2889ec['body'],null))[_0x5d2f('0x22')](respondWithResult(_0x5a2903,null))['catch'](handleError(_0x5a2903,null));};exports[_0x5d2f('0x21')]=function(_0xfe2cad,_0x4b399a){return db['ServicenowField'][_0x5d2f('0x45')]({'where':{'id':_0xfe2cad[_0x5d2f('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b399a,null))[_0x5d2f('0x22')](removeEntity(_0x4b399a,null))[_0x5d2f('0x41')](handleError(_0x4b399a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 5ba3dc4..afb769f 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 _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 +var _0x0fe4=['./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x598d67,_0x16e458){var _0x193f53=function(_0xe66ed6){while(--_0xe66ed6){_0x598d67['push'](_0x598d67['shift']());}};_0x193f53(++_0x16e458);}(_0x0fe4,0x172));var _0x40fe=function(_0xf19b15,_0x4f36ca){_0xf19b15=_0xf19b15-0x0;var _0x112420=_0x0fe4[_0xf19b15];return _0x112420;};'use strict';var _=require('lodash');var util=require(_0x40fe('0x0'));var logger=require(_0x40fe('0x1'))(_0x40fe('0x2'));var moment=require(_0x40fe('0x3'));var BPromise=require(_0x40fe('0x4'));var rp=require(_0x40fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40fe('0x6'));var config=require('../../config/environment');var attributes=require(_0x40fe('0x7'));module['exports']=function(_0x41d7d0,_0x1e3e47){return _0x41d7d0['define'](_0x40fe('0x8'),attributes,{'tableName':_0x40fe('0x9'),'paranoid':![],'indexes':[{'name':_0x40fe('0xa'),'fields':[_0x40fe('0xb'),_0x40fe('0xc')],'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 cc899c4..6b43fa4 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 _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 +var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x52943f,_0x458fbf){var _0x245bf1=function(_0x3f2c6a){while(--_0x3f2c6a){_0x52943f['push'](_0x52943f['shift']());}};_0x245bf1(++_0x458fbf);}(_0xe706,0xa3));var _0x6e70=function(_0x4193fc,_0x2b7bf5){_0x4193fc=_0x4193fc-0x0;var _0x541099=_0xe706[_0x4193fc];return _0x541099;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 19df7f5..7580d6c 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(_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 +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(_0x2f568f,_0x3a43fa){var _0x5b9c94=function(_0x1760ef){while(--_0x1760ef){_0x2f568f['push'](_0x2f568f['shift']());}};_0x5b9c94(++_0x3a43fa);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 0f2291d..eb42c4d 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(_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 +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3c0890,_0x568fb2){var _0x3356d5=function(_0x2a1eac){while(--_0x2a1eac){_0x3c0890['push'](_0x3c0890['shift']());}};_0x3356d5(++_0x568fb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 135c44f..840972e 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 _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 +var _0xb132=['destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SugarcrmAccount','count','includeAll','include','findAll','rows','keys','fields','options','find','catch','create','body','update','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','login','JSON','stringify','POST','%s%s','get_module_fields','Calls','values','module_fields','remove','label','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save'];(function(_0x26a0c8,_0xc39418){var _0x59448b=function(_0x5e9541){while(--_0x5e9541){_0x26a0c8['push'](_0x26a0c8['shift']());}};_0x59448b(++_0xc39418);}(_0xb132,0x140));var _0x2b13=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xb132[_0x59d0cc];return _0x2ae79f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2b13('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b13('0x1'));var moment=require(_0x2b13('0x2'));var BPromise=require(_0x2b13('0x3'));var Mustache=require(_0x2b13('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2b13('0x5'));var csv=require('to-csv');var ejs=require(_0x2b13('0x6'));var fs=require('fs');var fs_extra=require(_0x2b13('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b13('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x2b13('0x9'));var toCsv=require(_0x2b13('0xa'));var querystring=require(_0x2b13('0xb'));var Papa=require(_0x2b13('0xc'));var Redis=require(_0x2b13('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b13('0xe'))('api');var utils=require(_0x2b13('0xf'));var config=require(_0x2b13('0x10'));var licenseUtil=require(_0x2b13('0x11'));var db=require(_0x2b13('0x12'))['db'];var integrations=require(_0x2b13('0x13'));function respondWithStatusCode(_0x4511c6,_0x4aa57b){_0x4aa57b=_0x4aa57b||0xcc;return function(_0x5d1234){if(_0x5d1234){return _0x4511c6['sendStatus'](_0x4aa57b);}return _0x4511c6[_0x2b13('0x14')](_0x4aa57b)[_0x2b13('0x15')]();};}function respondWithResult(_0x564307,_0x2ace3d){_0x2ace3d=_0x2ace3d||0xc8;return function(_0x11f1e1){if(_0x11f1e1){return _0x564307[_0x2b13('0x14')](_0x2ace3d)[_0x2b13('0x16')](_0x11f1e1);}};}function respondWithFilteredResult(_0x37948b,_0x467028){return function(_0x15be75){if(_0x15be75){var _0x3deb33=typeof _0x467028['offset']==='undefined'&&typeof _0x467028[_0x2b13('0x17')]===_0x2b13('0x18');var _0x334866=_0x15be75['count'];var _0x427c20=_0x3deb33?0x0:_0x467028['offset'];var _0x4662cd=_0x3deb33?_0x15be75['count']:_0x467028[_0x2b13('0x19')]+_0x467028['limit'];var _0x5dd72c;if(_0x4662cd>=_0x334866){_0x4662cd=_0x334866;_0x5dd72c=0xc8;}else{_0x5dd72c=0xce;}_0x37948b[_0x2b13('0x14')](_0x5dd72c);return _0x37948b[_0x2b13('0x1a')](_0x2b13('0x1b'),_0x427c20+'-'+_0x4662cd+'/'+_0x334866)['json'](_0x15be75);}return null;};}function patchUpdates(_0x40d9aa){return function(_0x337e9e){try{jsonpatch[_0x2b13('0x1c')](_0x337e9e,_0x40d9aa,!![]);}catch(_0x2c1413){return BPromise[_0x2b13('0x1d')](_0x2c1413);}return _0x337e9e[_0x2b13('0x1e')]();};}function saveUpdates(_0x2e661f,_0x2b1d73){return function(_0x1b2734){if(_0x1b2734){return _0x1b2734['update'](_0x2e661f)['then'](function(_0x31665b){return _0x31665b;});}return null;};}function removeEntity(_0x548b8c,_0x2f4686){return function(_0x2e57fe){if(_0x2e57fe){return _0x2e57fe[_0x2b13('0x1f')]()[_0x2b13('0x20')](function(){_0x548b8c[_0x2b13('0x14')](0xcc)[_0x2b13('0x15')]();});}};}function handleEntityNotFound(_0x460aea,_0x926cbc){return function(_0x327b10){if(!_0x327b10){_0x460aea[_0x2b13('0x21')](0x194);}return _0x327b10;};}function handleError(_0x1f190a,_0xef5ac8){_0xef5ac8=_0xef5ac8||0x1f4;return function(_0x3e83e3){logger[_0x2b13('0x22')](_0x3e83e3[_0x2b13('0x23')]);if(_0x3e83e3[_0x2b13('0x24')]){delete _0x3e83e3[_0x2b13('0x24')];}_0x1f190a[_0x2b13('0x14')](_0xef5ac8)[_0x2b13('0x25')](_0x3e83e3);};}exports[_0x2b13('0x26')]=function(_0x352d46,_0x3588c5){var _0x17d0d4={},_0x392ca4={},_0x4a24f7={'count':0x0,'rows':[]};var _0x15d25a=_[_0x2b13('0x27')](db['SugarcrmAccount'][_0x2b13('0x28')],function(_0x5780b0){return{'name':_0x5780b0[_0x2b13('0x29')],'type':_0x5780b0['type'][_0x2b13('0x2a')]};});_0x392ca4[_0x2b13('0x2b')]=_['map'](_0x15d25a,_0x2b13('0x24'));_0x392ca4[_0x2b13('0x2c')]=_['keys'](_0x352d46[_0x2b13('0x2c')]);_0x392ca4[_0x2b13('0x2d')]=_[_0x2b13('0x2e')](_0x392ca4[_0x2b13('0x2b')],_0x392ca4[_0x2b13('0x2c')]);_0x17d0d4[_0x2b13('0x2f')]=_[_0x2b13('0x2e')](_0x392ca4[_0x2b13('0x2b')],qs['fields'](_0x352d46[_0x2b13('0x2c')]['fields']));_0x17d0d4[_0x2b13('0x2f')]=_0x17d0d4['attributes'][_0x2b13('0x30')]?_0x17d0d4[_0x2b13('0x2f')]:_0x392ca4[_0x2b13('0x2b')];if(!_0x352d46['query'][_0x2b13('0x31')](_0x2b13('0x32'))){_0x17d0d4[_0x2b13('0x17')]=qs['limit'](_0x352d46[_0x2b13('0x2c')][_0x2b13('0x17')]);_0x17d0d4[_0x2b13('0x19')]=qs[_0x2b13('0x19')](_0x352d46['query'][_0x2b13('0x19')]);}_0x17d0d4[_0x2b13('0x33')]=qs[_0x2b13('0x34')](_0x352d46[_0x2b13('0x2c')][_0x2b13('0x34')]);_0x17d0d4[_0x2b13('0x35')]=qs['filters'](_[_0x2b13('0x36')](_0x352d46[_0x2b13('0x2c')],_0x392ca4[_0x2b13('0x2d')]),_0x15d25a);if(_0x352d46[_0x2b13('0x2c')][_0x2b13('0x37')]){_0x17d0d4[_0x2b13('0x35')]=_[_0x2b13('0x38')](_0x17d0d4[_0x2b13('0x35')],{'$or':_['map'](_0x15d25a,function(_0x7e5b10){if(_0x7e5b10['type']!==_0x2b13('0x39')){var _0x18a6cb={};_0x18a6cb[_0x7e5b10[_0x2b13('0x24')]]={'$like':'%'+_0x352d46[_0x2b13('0x2c')]['filter']+'%'};return _0x18a6cb;}})});}_0x17d0d4=_[_0x2b13('0x38')]({},_0x17d0d4,_0x352d46['options']);var _0x22b4dd={'where':_0x17d0d4[_0x2b13('0x35')]};return db[_0x2b13('0x3a')][_0x2b13('0x3b')](_0x22b4dd)[_0x2b13('0x20')](function(_0x3dd571){_0x4a24f7[_0x2b13('0x3b')]=_0x3dd571;if(_0x352d46[_0x2b13('0x2c')][_0x2b13('0x3c')]){_0x17d0d4[_0x2b13('0x3d')]=[{'all':!![]}];}return db[_0x2b13('0x3a')][_0x2b13('0x3e')](_0x17d0d4);})[_0x2b13('0x20')](function(_0xdb3749){_0x4a24f7[_0x2b13('0x3f')]=_0xdb3749;return _0x4a24f7;})[_0x2b13('0x20')](respondWithFilteredResult(_0x3588c5,_0x17d0d4))['catch'](handleError(_0x3588c5,null));};exports['show']=function(_0x2ed5c4,_0x1f0953){var _0x205a09={'raw':![],'where':{'id':_0x2ed5c4['params']['id']}},_0x214b8b={};_0x214b8b['model']=_['keys'](db[_0x2b13('0x3a')]['rawAttributes']);_0x214b8b[_0x2b13('0x2c')]=_[_0x2b13('0x40')](_0x2ed5c4[_0x2b13('0x2c')]);_0x214b8b['filters']=_[_0x2b13('0x2e')](_0x214b8b[_0x2b13('0x2b')],_0x214b8b[_0x2b13('0x2c')]);_0x205a09[_0x2b13('0x2f')]=_['intersection'](_0x214b8b[_0x2b13('0x2b')],qs[_0x2b13('0x41')](_0x2ed5c4[_0x2b13('0x2c')]['fields']));_0x205a09[_0x2b13('0x2f')]=_0x205a09['attributes'][_0x2b13('0x30')]?_0x205a09[_0x2b13('0x2f')]:_0x214b8b[_0x2b13('0x2b')];if(_0x2ed5c4['query']['includeAll']){_0x205a09['include']=[{'all':!![]}];}_0x205a09=_['merge']({},_0x205a09,_0x2ed5c4[_0x2b13('0x42')]);return db['SugarcrmAccount'][_0x2b13('0x43')](_0x205a09)[_0x2b13('0x20')](handleEntityNotFound(_0x1f0953,null))['then'](respondWithResult(_0x1f0953,null))[_0x2b13('0x44')](handleError(_0x1f0953,null));};exports[_0x2b13('0x45')]=function(_0x2d17a0,_0x22801d){return db[_0x2b13('0x3a')]['create'](_0x2d17a0[_0x2b13('0x46')],{})[_0x2b13('0x20')](respondWithResult(_0x22801d,0xc9))[_0x2b13('0x44')](handleError(_0x22801d,null));};exports[_0x2b13('0x47')]=function(_0x59a49a,_0xff37a3){if(_0x59a49a[_0x2b13('0x46')]['id']){delete _0x59a49a[_0x2b13('0x46')]['id'];}return db[_0x2b13('0x3a')][_0x2b13('0x43')]({'where':{'id':_0x59a49a[_0x2b13('0x48')]['id']}})['then'](handleEntityNotFound(_0xff37a3,null))['then'](saveUpdates(_0x59a49a['body'],null))[_0x2b13('0x20')](respondWithResult(_0xff37a3,null))['catch'](handleError(_0xff37a3,null));};exports[_0x2b13('0x1f')]=function(_0xf4e71d,_0xe44e8d){return db[_0x2b13('0x3a')][_0x2b13('0x43')]({'where':{'id':_0xf4e71d[_0x2b13('0x48')]['id']}})[_0x2b13('0x20')](handleEntityNotFound(_0xe44e8d,null))[_0x2b13('0x20')](removeEntity(_0xe44e8d,null))[_0x2b13('0x44')](handleError(_0xe44e8d,null));};exports[_0x2b13('0x49')]=function(_0x1acc9b,_0x2ec238,_0x74c5c5){var _0x2e1fe0={};var _0x30bdc3={};var _0x3d2972;var _0x5d217f;return db[_0x2b13('0x3a')][_0x2b13('0x4a')]({'where':{'id':_0x1acc9b[_0x2b13('0x48')]['id']}})['then'](handleEntityNotFound(_0x2ec238,null))['then'](function(_0x498415){if(_0x498415){_0x3d2972=_0x498415;_0x30bdc3['model']=_[_0x2b13('0x40')](db[_0x2b13('0x4b')]['rawAttributes']);_0x30bdc3[_0x2b13('0x2c')]=_[_0x2b13('0x40')](_0x1acc9b[_0x2b13('0x2c')]);_0x30bdc3[_0x2b13('0x2d')]=_[_0x2b13('0x2e')](_0x30bdc3[_0x2b13('0x2b')],_0x30bdc3['query']);_0x2e1fe0[_0x2b13('0x2f')]=_['intersection'](_0x30bdc3[_0x2b13('0x2b')],qs['fields'](_0x1acc9b[_0x2b13('0x2c')][_0x2b13('0x41')]));_0x2e1fe0[_0x2b13('0x2f')]=_0x2e1fe0[_0x2b13('0x2f')][_0x2b13('0x30')]?_0x2e1fe0['attributes']:_0x30bdc3[_0x2b13('0x2b')];_0x2e1fe0[_0x2b13('0x33')]=qs[_0x2b13('0x34')](_0x1acc9b[_0x2b13('0x2c')]['sort']);_0x2e1fe0['where']=qs[_0x2b13('0x2d')](_[_0x2b13('0x36')](_0x1acc9b[_0x2b13('0x2c')],_0x30bdc3[_0x2b13('0x2d')]));if(_0x1acc9b[_0x2b13('0x2c')]['filter']){_0x2e1fe0[_0x2b13('0x35')]=_['merge'](_0x2e1fe0[_0x2b13('0x35')],{'$or':_['map'](_0x2e1fe0[_0x2b13('0x2f')],function(_0x2ac244){var _0x222250={};_0x222250[_0x2ac244]={'$like':'%'+_0x1acc9b[_0x2b13('0x2c')][_0x2b13('0x37')]+'%'};return _0x222250;})});}_0x2e1fe0=_[_0x2b13('0x38')]({},_0x2e1fe0,_0x1acc9b[_0x2b13('0x42')]);return _0x3d2972[_0x2b13('0x49')](_0x2e1fe0);}})[_0x2b13('0x20')](function(_0x388f4d){if(_0x388f4d){_0x5d217f=_0x388f4d['length'];if(!_0x1acc9b[_0x2b13('0x2c')][_0x2b13('0x31')](_0x2b13('0x32'))){_0x2e1fe0[_0x2b13('0x17')]=qs[_0x2b13('0x17')](_0x1acc9b[_0x2b13('0x2c')][_0x2b13('0x17')]);_0x2e1fe0[_0x2b13('0x19')]=qs[_0x2b13('0x19')](_0x1acc9b[_0x2b13('0x2c')]['offset']);}return _0x3d2972['getConfigurations'](_0x2e1fe0);}})[_0x2b13('0x20')](function(_0x7671c){if(_0x7671c){return _0x7671c?{'count':_0x5d217f,'rows':_0x7671c}:null;}})[_0x2b13('0x20')](respondWithResult(_0x2ec238,null))[_0x2b13('0x44')](handleError(_0x2ec238,null));};exports[_0x2b13('0x4c')]=function(_0x4309c7,_0x4583ff,_0x4f7369){if(_0x4309c7['body']['id']){delete _0x4309c7['body']['id'];}return db['SugarcrmAccount'][_0x2b13('0x4a')]({'where':{'id':_0x4309c7[_0x2b13('0x48')]['id']}})[_0x2b13('0x20')](handleEntityNotFound(_0x4583ff,null))[_0x2b13('0x20')](function(_0xd8e8c){if(_0xd8e8c){_0x4309c7[_0x2b13('0x46')][_0x2b13('0x4d')]=_0xd8e8c['id'];_0x4309c7[_0x2b13('0x46')][_0x2b13('0x4e')]=integrations[_0x2b13('0x4f')](_0x4309c7[_0x2b13('0x46')][_0x2b13('0x50')],_0x4309c7[_0x2b13('0x46')][_0x2b13('0x51')]);_0x4309c7[_0x2b13('0x46')][_0x2b13('0x52')]=integrations[_0x2b13('0x53')](_0x4309c7[_0x2b13('0x46')]['channel'],_0x4309c7[_0x2b13('0x46')][_0x2b13('0x51')]);return db[_0x2b13('0x4b')][_0x2b13('0x45')](_0x4309c7[_0x2b13('0x46')],{'include':[{'model':db[_0x2b13('0x54')],'as':'Subjects'},{'model':db[_0x2b13('0x54')],'as':'Descriptions'}]});}return null;})[_0x2b13('0x20')](respondWithResult(_0x4583ff,null))[_0x2b13('0x44')](handleError(_0x4583ff,null));};exports[_0x2b13('0x55')]=function(_0x39a08e,_0x51fb11,_0x66651c){var _0x59d64c='';var _0x3f3a51=['id','name',_0x2b13('0x56'),_0x2b13('0x57'),_0x2b13('0x58'),'date_start',_0x2b13('0x59'),_0x2b13('0x5a'),'parent_id',_0x2b13('0x5b'),_0x2b13('0x5c'),_0x2b13('0x5d')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x39a08e[_0x2b13('0x48')]['id']},'attributes':['id',_0x2b13('0x5e'),_0x2b13('0x5f'),'remoteUri']})['then'](handleEntityNotFound(_0x51fb11,null))[_0x2b13('0x20')](function(_0x227c97){if(_0x227c97){_0x59d64c=_0x227c97['remoteUri'];var _0x59013d=_0x59d64c[_0x2b13('0x60')](-0x1);if(_0x59013d==='/'){_0x59d64c=_0x59d64c[_0x2b13('0x61')](0x0,_0x59d64c[_0x2b13('0x62')](_0x59013d));}return rp({'method':'POST','uri':util[_0x2b13('0x63')]('%s%s',_0x59d64c,_0x2b13('0x64')),'json':!![],'form':{'method':_0x2b13('0x65'),'input_type':_0x2b13('0x66'),'response_type':'JSON','rest_data':JSON[_0x2b13('0x67')]({'user_auth':{'user_name':_0x227c97[_0x2b13('0x5e')],'password':_0x227c97['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x2b13('0x20')](function(_0xb6dfcf){if(_0xb6dfcf&&_0xb6dfcf['name']!=='Invalid\x20Login'&&_0xb6dfcf[_0x2b13('0x24')]!=='Password\x20Expired'){return rp({'method':_0x2b13('0x68'),'uri':util[_0x2b13('0x63')](_0x2b13('0x69'),_0x59d64c,_0x2b13('0x64')),'json':!![],'form':{'method':_0x2b13('0x6a'),'input_type':_0x2b13('0x66'),'response_type':_0x2b13('0x66'),'rest_data':JSON[_0x2b13('0x67')]({'session':_0xb6dfcf['id'],'module_name':_0x2b13('0x6b')})}})['then'](function(_0x2e5d85){if(_0x2e5d85){var _0x29eda1=_[_0x2b13('0x6c')](_0x2e5d85[_0x2b13('0x6d')]);_[_0x2b13('0x6e')](_0x29eda1,function(_0x32fd96){return _0x3f3a51['includes'](_0x32fd96[_0x2b13('0x24')]);});return{'count':_0x29eda1[_0x2b13('0x30')],'rows':_[_0x2b13('0x27')](_0x29eda1,function(_0x2051ac){return{'id':_0x2051ac['name'],'name':_0x2051ac[_0x2b13('0x6f')],'custom':_['endsWith'](_0x2051ac[_0x2b13('0x24')],'_c')?!![]:![],'options':_0x2051ac[_0x2b13('0x42')]?_[_0x2b13('0x27')](_[_0x2b13('0x6c')](_0x2051ac[_0x2b13('0x42')]),function(_0x23ea68){return{'name':_0x23ea68[_0x2b13('0x70')],'value':_0x23ea68[_0x2b13('0x24')]};}):[]};})};}})['then'](respondWithResult(_0x51fb11,null))[_0x2b13('0x44')](function(_0x5ba3bd){var _0x3f2b0b=_0x39a08e['query'][_0x2b13('0x71')]?0x1f4:_0x5ba3bd['statusCode']||0x1f4;logger[_0x2b13('0x22')](_0x2b13('0x72'),_0x2b13('0x55'),_0x3f2b0b,JSON['stringify'](_0x5ba3bd));delete _0x5ba3bd[_0x2b13('0x24')];if(_0x3f2b0b===0x191){_0x3f2b0b=0x190;}_0x51fb11[_0x2b13('0x14')](_0x3f2b0b)[_0x2b13('0x25')](_0x39a08e['query'][_0x2b13('0x71')]?{'message':_0x2b13('0x73'),'statusCode':_0x5ba3bd[_0x2b13('0x74')]}:_0x5ba3bd);});}else{var _0x342a03=0x1f4;_0x51fb11[_0x2b13('0x14')](_0x342a03)[_0x2b13('0x25')]({'message':_0x2b13('0x73'),'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 d395579..c07cb73 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 _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 +var _0x2080=['bluebird','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','moment'];(function(_0x476c6c,_0x434db8){var _0xbb94db=function(_0x4be12){while(--_0x4be12){_0x476c6c['push'](_0x476c6c['shift']());}};_0xbb94db(++_0x434db8);}(_0x2080,0x19f));var _0x0208=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2080[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0208('0x0'))(_0x0208('0x1'));var moment=require(_0x0208('0x2'));var BPromise=require(_0x0208('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0208('0x4'));var rimraf=require(_0x0208('0x5'));var config=require('../../config/environment');var attributes=require(_0x0208('0x6'));var integrations=require(_0x0208('0x7'));module[_0x0208('0x8')]=function(_0x115952,_0x29ab94){return _0x115952['define'](_0x0208('0x9'),attributes,{'tableName':_0x0208('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 5a2da77..1857fb2 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 _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 +var _0x774f=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x6dc241,_0x3d6db7){var _0xac50e7=function(_0x42c8a1){while(--_0x42c8a1){_0x6dc241['push'](_0x6dc241['shift']());}};_0xac50e7(++_0x3d6db7);}(_0x774f,0x1f0));var _0xf774=function(_0x2bbf32,_0x4e63f4){_0x2bbf32=_0x2bbf32-0x0;var _0x2b9814=_0x774f[_0x2bbf32];return _0x2b9814;};'use strict';var _=require(_0xf774('0x0'));var util=require(_0xf774('0x1'));var moment=require(_0xf774('0x2'));var BPromise=require(_0xf774('0x3'));var rs=require(_0xf774('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf774('0x5'))['db'];var utils=require(_0xf774('0x6'));var logger=require(_0xf774('0x7'))(_0xf774('0x8'));var config=require(_0xf774('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf774('0xa')][_0xf774('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c6cf7,_0x97a242,_0x3b5bab){return new BPromise(function(_0x5b5a78,_0x36ef11){return client[_0xf774('0xc')](_0x5c6cf7,_0x3b5bab)[_0xf774('0xd')](function(_0x7e229c){logger[_0xf774('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x97a242,_0xf774('0xf'));logger[_0xf774('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x97a242,_0xf774('0xf'),JSON[_0xf774('0x11')](_0x7e229c));if(_0x7e229c[_0xf774('0x12')]){if(_0x7e229c[_0xf774('0x12')][_0xf774('0x13')]===0x1f4){logger[_0xf774('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x97a242,_0x7e229c['error'][_0xf774('0x14')]);return _0x36ef11(_0x7e229c['error'][_0xf774('0x14')]);}logger[_0xf774('0x12')](_0xf774('0x15'),_0x97a242,_0x7e229c[_0xf774('0x12')][_0xf774('0x14')]);return _0x5b5a78(_0x7e229c[_0xf774('0x12')][_0xf774('0x14')]);}else{logger[_0xf774('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x97a242,_0xf774('0xf'));_0x5b5a78(_0x7e229c[_0xf774('0x16')][_0xf774('0x14')]);}})[_0xf774('0x17')](function(_0x281f73){logger['error'](_0xf774('0x15'),_0x97a242,_0x281f73);_0x36ef11(_0x281f73);});});}exports[_0xf774('0x18')]=function(_0x4acef2){var _0x3e4c15=this;return new Promise(function(_0x158345,_0x37af33){return db[_0xf774('0x19')][_0xf774('0x1a')]({'raw':_0x4acef2['options']?_0x4acef2[_0xf774('0x1b')][_0xf774('0x1c')]===undefined?!![]:![]:!![],'where':_0x4acef2[_0xf774('0x1b')]?_0x4acef2['options'][_0xf774('0x1d')]||null:null,'attributes':_0x4acef2['options']?_0x4acef2['options'][_0xf774('0x1e')]||null:null,'limit':_0x4acef2[_0xf774('0x1b')]?_0x4acef2[_0xf774('0x1b')]['limit']||null:null,'include':_0x4acef2[_0xf774('0x1b')]?_0x4acef2['options'][_0xf774('0x1f')]?_[_0xf774('0x20')](_0x4acef2['options']['include'],function(_0x3d6c81){return{'model':db[_0x3d6c81['model']],'as':_0x3d6c81['as'],'attributes':_0x3d6c81[_0xf774('0x1e')],'include':_0x3d6c81[_0xf774('0x1f')]?_[_0xf774('0x20')](_0x3d6c81['include'],function(_0x4d9113){return{'model':db[_0x4d9113[_0xf774('0x21')]],'as':_0x4d9113['as'],'attributes':_0x4d9113[_0xf774('0x1e')],'include':_0x4d9113['include']?_['map'](_0x4d9113[_0xf774('0x1f')],function(_0x51698f){return{'model':db[_0x51698f[_0xf774('0x21')]],'as':_0x51698f['as'],'attributes':_0x51698f[_0xf774('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf774('0xd')](function(_0x302786){logger[_0xf774('0xe')]('GetSugarcrmAccount',_0x4acef2);logger[_0xf774('0x10')]('GetSugarcrmAccount',_0x4acef2,JSON[_0xf774('0x11')](_0x302786));_0x158345(_0x302786);})['catch'](function(_0x93ae58){logger[_0xf774('0x12')]('GetSugarcrmAccount',_0x93ae58[_0xf774('0x14')],_0x4acef2);_0x37af33(_0x3e4c15[_0xf774('0x12')](0x1f4,_0x93ae58[_0xf774('0x14')]));});});};exports[_0xf774('0x22')]=function(_0x2eb9c6){var _0x5855f8=this;return new Promise(function(_0x3b75f3,_0x29f53f){return db[_0xf774('0x19')][_0xf774('0x23')]({'raw':_0x2eb9c6[_0xf774('0x1b')]?_0x2eb9c6[_0xf774('0x1b')][_0xf774('0x1c')]===undefined?!![]:![]:!![],'where':_0x2eb9c6[_0xf774('0x1b')]?_0x2eb9c6[_0xf774('0x1b')][_0xf774('0x1d')]||null:null,'attributes':_0x2eb9c6['options']?_0x2eb9c6['options'][_0xf774('0x1e')]||null:null,'include':_0x2eb9c6[_0xf774('0x1b')]?_0x2eb9c6['options'][_0xf774('0x1f')]?_[_0xf774('0x20')](_0x2eb9c6[_0xf774('0x1b')][_0xf774('0x1f')],function(_0x1dd0bd){return{'model':db[_0x1dd0bd[_0xf774('0x21')]],'as':_0x1dd0bd['as'],'attributes':_0x1dd0bd[_0xf774('0x1e')],'include':_0x1dd0bd[_0xf774('0x1f')]?_['map'](_0x1dd0bd['include'],function(_0x212e09){return{'model':db[_0x212e09[_0xf774('0x21')]],'as':_0x212e09['as'],'attributes':_0x212e09[_0xf774('0x1e')],'include':_0x212e09[_0xf774('0x1f')]?_[_0xf774('0x20')](_0x212e09[_0xf774('0x1f')],function(_0x55f8d9){return{'model':db[_0x55f8d9[_0xf774('0x21')]],'as':_0x55f8d9['as'],'attributes':_0x55f8d9[_0xf774('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf774('0xd')](function(_0x1f2eab){logger[_0xf774('0xe')]('ShowSugarcrmAccount',_0x2eb9c6);logger[_0xf774('0x10')](_0xf774('0x22'),_0x2eb9c6,JSON[_0xf774('0x11')](_0x1f2eab));_0x3b75f3(_0x1f2eab);})[_0xf774('0x17')](function(_0x4ecf50){logger[_0xf774('0x12')]('ShowSugarcrmAccount',_0x4ecf50['message'],_0x2eb9c6);_0x29f53f(_0x5855f8[_0xf774('0x12')](0x1f4,_0x4ecf50[_0xf774('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index dcfb5ba..a142d83 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 _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 +var _0xf0c5=['../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x13bf4d,_0x3f86c3){var _0x292410=function(_0x20fd8e){while(--_0x20fd8e){_0x13bf4d['push'](_0x13bf4d['shift']());}};_0x292410(++_0x3f86c3);}(_0xf0c5,0x1d5));var _0x5f0c=function(_0x52a397,_0x50af17){_0x52a397=_0x52a397-0x0;var _0x14f164=_0xf0c5[_0x52a397];return _0x14f164;};'use strict';var multer=require(_0x5f0c('0x0'));var util=require(_0x5f0c('0x1'));var path=require('path');var timeout=require(_0x5f0c('0x2'));var express=require(_0x5f0c('0x3'));var router=express[_0x5f0c('0x4')]();var fs_extra=require(_0x5f0c('0x5'));var auth=require(_0x5f0c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f0c('0x7'));var controller=require(_0x5f0c('0x8'));router[_0x5f0c('0x9')]('/',auth[_0x5f0c('0xa')](),controller[_0x5f0c('0xb')]);router[_0x5f0c('0x9')]('/:id',auth[_0x5f0c('0xa')](),controller[_0x5f0c('0xc')]);router[_0x5f0c('0x9')](_0x5f0c('0xd'),auth[_0x5f0c('0xa')](),controller[_0x5f0c('0xe')]);router[_0x5f0c('0x9')](_0x5f0c('0xf'),auth[_0x5f0c('0xa')](),controller['getSubjects']);router[_0x5f0c('0x9')](_0x5f0c('0x10'),auth['isAuthenticated'](),controller[_0x5f0c('0x11')]);router[_0x5f0c('0x12')]('/',auth['isAuthenticated'](),controller[_0x5f0c('0x13')]);router[_0x5f0c('0x14')](_0x5f0c('0x15'),auth[_0x5f0c('0xa')](),controller[_0x5f0c('0x16')]);router[_0x5f0c('0x17')](_0x5f0c('0x15'),auth[_0x5f0c('0xa')](),controller[_0x5f0c('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 224df35..32268cd 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 _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 +var _0xd03a=['sequelize','STRING'];(function(_0xbe48a,_0x4d3ec5){var _0x3eeda0=function(_0x2d758d){while(--_0x2d758d){_0xbe48a['push'](_0xbe48a['shift']());}};_0x3eeda0(++_0x4d3ec5);}(_0xd03a,0x180));var _0xad03=function(_0x20eb01,_0x59ae21){_0x20eb01=_0x20eb01-0x0;var _0x5c5e37=_0xd03a[_0x20eb01];return _0x5c5e37;};'use strict';var Sequelize=require(_0xad03('0x0'));module['exports']={'name':{'type':Sequelize[_0xad03('0x1')]},'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 30676eb..0e7f99a 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 _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 +var _0x86f8=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','getFields','findOne','pick','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5afbc2,_0x29aab5){var _0xe98381=function(_0x33038f){while(--_0x33038f){_0x5afbc2['push'](_0x5afbc2['shift']());}};_0xe98381(++_0x29aab5);}(_0x86f8,0x16a));var _0x886f=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0x86f8[_0x28fbe3];return _0x45db6a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x886f('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x886f('0x1'));var Mustache=require('mustache');var util=require(_0x886f('0x2'));var path=require(_0x886f('0x3'));var sox=require(_0x886f('0x4'));var csv=require(_0x886f('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x886f('0x6'));var _=require(_0x886f('0x7'));var squel=require(_0x886f('0x8'));var crypto=require(_0x886f('0x9'));var jsforce=require(_0x886f('0xa'));var deskjs=require(_0x886f('0xb'));var toCsv=require(_0x886f('0x5'));var querystring=require(_0x886f('0xc'));var Papa=require('papaparse');var Redis=require(_0x886f('0xd'));var authService=require(_0x886f('0xe'));var qs=require(_0x886f('0xf'));var as=require(_0x886f('0x10'));var hardwareService=require(_0x886f('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x886f('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x886f('0x13'))['db'];function respondWithStatusCode(_0x1b18b8,_0x22413e){_0x22413e=_0x22413e||0xcc;return function(_0x1a8bf1){if(_0x1a8bf1){return _0x1b18b8[_0x886f('0x14')](_0x22413e);}return _0x1b18b8[_0x886f('0x15')](_0x22413e)[_0x886f('0x16')]();};}function respondWithResult(_0x607c14,_0x5ebc84){_0x5ebc84=_0x5ebc84||0xc8;return function(_0x54f257){if(_0x54f257){return _0x607c14[_0x886f('0x15')](_0x5ebc84)['json'](_0x54f257);}};}function respondWithFilteredResult(_0x44893e,_0x5500df){return function(_0x247dd6){if(_0x247dd6){var _0x34ac5c=typeof _0x5500df[_0x886f('0x17')]===_0x886f('0x18')&&typeof _0x5500df[_0x886f('0x19')]===_0x886f('0x18');var _0x243937=_0x247dd6[_0x886f('0x1a')];var _0x1fe2dd=_0x34ac5c?0x0:_0x5500df[_0x886f('0x17')];var _0x5eae7b=_0x34ac5c?_0x247dd6[_0x886f('0x1a')]:_0x5500df['offset']+_0x5500df[_0x886f('0x19')];var _0x5651bf;if(_0x5eae7b>=_0x243937){_0x5eae7b=_0x243937;_0x5651bf=0xc8;}else{_0x5651bf=0xce;}_0x44893e['status'](_0x5651bf);return _0x44893e[_0x886f('0x1b')](_0x886f('0x1c'),_0x1fe2dd+'-'+_0x5eae7b+'/'+_0x243937)[_0x886f('0x1d')](_0x247dd6);}return null;};}function patchUpdates(_0x5bfe8d){return function(_0x3a5f17){try{jsonpatch[_0x886f('0x1e')](_0x3a5f17,_0x5bfe8d,!![]);}catch(_0x34dd13){return BPromise['reject'](_0x34dd13);}return _0x3a5f17['save']();};}function saveUpdates(_0x3ef97d,_0x49a18f){return function(_0x582ec3){if(_0x582ec3){return _0x582ec3[_0x886f('0x1f')](_0x3ef97d)[_0x886f('0x20')](function(_0x5ca85a){return _0x5ca85a;});}return null;};}function removeEntity(_0x2f24b0,_0xfa1026){return function(_0xb5ff51){if(_0xb5ff51){return _0xb5ff51[_0x886f('0x21')]()[_0x886f('0x20')](function(){_0x2f24b0[_0x886f('0x15')](0xcc)[_0x886f('0x16')]();});}};}function handleEntityNotFound(_0x1a81ae,_0x1388ab){return function(_0x2bcac6){if(!_0x2bcac6){_0x1a81ae[_0x886f('0x14')](0x194);}return _0x2bcac6;};}function handleError(_0x551c73,_0x49e91e){_0x49e91e=_0x49e91e||0x1f4;return function(_0x1e0b29){logger['error'](_0x1e0b29[_0x886f('0x22')]);if(_0x1e0b29['name']){delete _0x1e0b29[_0x886f('0x23')];}_0x551c73['status'](_0x49e91e)['send'](_0x1e0b29);};}exports[_0x886f('0x24')]=function(_0x16c06b,_0x388786){var _0xe34ee0={},_0x5b005e={},_0x169a83={'count':0x0,'rows':[]};var _0x41033d=_[_0x886f('0x25')](db[_0x886f('0x26')]['rawAttributes'],function(_0x275b36){return{'name':_0x275b36[_0x886f('0x27')],'type':_0x275b36[_0x886f('0x28')][_0x886f('0x29')]};});_0x5b005e[_0x886f('0x2a')]=_['map'](_0x41033d,_0x886f('0x23'));_0x5b005e[_0x886f('0x2b')]=_[_0x886f('0x2c')](_0x16c06b[_0x886f('0x2b')]);_0x5b005e[_0x886f('0x2d')]=_[_0x886f('0x2e')](_0x5b005e[_0x886f('0x2a')],_0x5b005e[_0x886f('0x2b')]);_0xe34ee0[_0x886f('0x2f')]=_[_0x886f('0x2e')](_0x5b005e[_0x886f('0x2a')],qs[_0x886f('0x30')](_0x16c06b[_0x886f('0x2b')][_0x886f('0x30')]));_0xe34ee0['attributes']=_0xe34ee0[_0x886f('0x2f')][_0x886f('0x31')]?_0xe34ee0[_0x886f('0x2f')]:_0x5b005e[_0x886f('0x2a')];if(!_0x16c06b['query']['hasOwnProperty'](_0x886f('0x32'))){_0xe34ee0[_0x886f('0x19')]=qs[_0x886f('0x19')](_0x16c06b['query'][_0x886f('0x19')]);_0xe34ee0[_0x886f('0x17')]=qs[_0x886f('0x17')](_0x16c06b['query'][_0x886f('0x17')]);}_0xe34ee0[_0x886f('0x33')]=qs[_0x886f('0x34')](_0x16c06b[_0x886f('0x2b')][_0x886f('0x34')]);_0xe34ee0[_0x886f('0x35')]=qs[_0x886f('0x2d')](_['pick'](_0x16c06b[_0x886f('0x2b')],_0x5b005e[_0x886f('0x2d')]),_0x41033d);if(_0x16c06b[_0x886f('0x2b')][_0x886f('0x36')]){_0xe34ee0[_0x886f('0x35')]=_[_0x886f('0x37')](_0xe34ee0['where'],{'$or':_[_0x886f('0x25')](_0x41033d,function(_0x6f76d3){if(_0x6f76d3[_0x886f('0x28')]!==_0x886f('0x38')){var _0x1c15ca={};_0x1c15ca[_0x6f76d3[_0x886f('0x23')]]={'$like':'%'+_0x16c06b['query'][_0x886f('0x36')]+'%'};return _0x1c15ca;}})});}_0xe34ee0=_[_0x886f('0x37')]({},_0xe34ee0,_0x16c06b[_0x886f('0x39')]);var _0x4617f6={'where':_0xe34ee0[_0x886f('0x35')]};return db[_0x886f('0x26')]['count'](_0x4617f6)[_0x886f('0x20')](function(_0x23077c){_0x169a83[_0x886f('0x1a')]=_0x23077c;if(_0x16c06b[_0x886f('0x2b')][_0x886f('0x3a')]){_0xe34ee0[_0x886f('0x3b')]=[{'all':!![]}];}return db[_0x886f('0x26')][_0x886f('0x3c')](_0xe34ee0);})[_0x886f('0x20')](function(_0x4b45f7){_0x169a83[_0x886f('0x3d')]=_0x4b45f7;return _0x169a83;})[_0x886f('0x20')](respondWithFilteredResult(_0x388786,_0xe34ee0))['catch'](handleError(_0x388786,null));};exports['show']=function(_0x27def1,_0x596a62){var _0xace6fa={'raw':![],'where':{'id':_0x27def1[_0x886f('0x3e')]['id']}},_0x4d090e={};_0x4d090e[_0x886f('0x2a')]=_['keys'](db[_0x886f('0x26')][_0x886f('0x3f')]);_0x4d090e[_0x886f('0x2b')]=_[_0x886f('0x2c')](_0x27def1[_0x886f('0x2b')]);_0x4d090e[_0x886f('0x2d')]=_['intersection'](_0x4d090e[_0x886f('0x2a')],_0x4d090e['query']);_0xace6fa[_0x886f('0x2f')]=_[_0x886f('0x2e')](_0x4d090e['model'],qs[_0x886f('0x30')](_0x27def1['query'][_0x886f('0x30')]));_0xace6fa[_0x886f('0x2f')]=_0xace6fa[_0x886f('0x2f')]['length']?_0xace6fa[_0x886f('0x2f')]:_0x4d090e['model'];if(_0x27def1[_0x886f('0x2b')][_0x886f('0x3a')]){_0xace6fa[_0x886f('0x3b')]=[{'all':!![]}];}_0xace6fa=_[_0x886f('0x37')]({},_0xace6fa,_0x27def1[_0x886f('0x39')]);return db[_0x886f('0x26')][_0x886f('0x40')](_0xace6fa)[_0x886f('0x20')](handleEntityNotFound(_0x596a62,null))[_0x886f('0x20')](respondWithResult(_0x596a62,null))[_0x886f('0x41')](handleError(_0x596a62,null));};exports[_0x886f('0x42')]=function(_0x58199e,_0x5b6f55){return db[_0x886f('0x26')]['create'](_0x58199e[_0x886f('0x43')],{})[_0x886f('0x20')](respondWithResult(_0x5b6f55,0xc9))['catch'](handleError(_0x5b6f55,null));};exports[_0x886f('0x1f')]=function(_0x5cde8f,_0xd00808){if(_0x5cde8f[_0x886f('0x43')]['id']){delete _0x5cde8f[_0x886f('0x43')]['id'];}return db[_0x886f('0x26')][_0x886f('0x40')]({'where':{'id':_0x5cde8f[_0x886f('0x3e')]['id']}})[_0x886f('0x20')](handleEntityNotFound(_0xd00808,null))[_0x886f('0x20')](saveUpdates(_0x5cde8f[_0x886f('0x43')],null))[_0x886f('0x20')](respondWithResult(_0xd00808,null))[_0x886f('0x41')](handleError(_0xd00808,null));};exports[_0x886f('0x21')]=function(_0x54104e,_0x44e24d){return db[_0x886f('0x26')][_0x886f('0x40')]({'where':{'id':_0x54104e[_0x886f('0x3e')]['id']}})[_0x886f('0x20')](handleEntityNotFound(_0x44e24d,null))[_0x886f('0x20')](removeEntity(_0x44e24d,null))[_0x886f('0x41')](handleError(_0x44e24d,null));};exports[_0x886f('0x44')]=function(_0x59985c,_0x2db05c,_0x1aeaf9){var _0x5e5412={};var _0x3190ed={};var _0x25ab17;var _0x171c63;return db[_0x886f('0x26')][_0x886f('0x45')]({'where':{'id':_0x59985c[_0x886f('0x3e')]['id']}})[_0x886f('0x20')](handleEntityNotFound(_0x2db05c,null))['then'](function(_0x4dbc0d){if(_0x4dbc0d){_0x25ab17=_0x4dbc0d;_0x3190ed['model']=_[_0x886f('0x2c')](db['SugarcrmField'][_0x886f('0x3f')]);_0x3190ed['query']=_[_0x886f('0x2c')](_0x59985c[_0x886f('0x2b')]);_0x3190ed['filters']=_['intersection'](_0x3190ed[_0x886f('0x2a')],_0x3190ed['query']);_0x5e5412['attributes']=_[_0x886f('0x2e')](_0x3190ed[_0x886f('0x2a')],qs[_0x886f('0x30')](_0x59985c[_0x886f('0x2b')][_0x886f('0x30')]));_0x5e5412[_0x886f('0x2f')]=_0x5e5412[_0x886f('0x2f')][_0x886f('0x31')]?_0x5e5412[_0x886f('0x2f')]:_0x3190ed[_0x886f('0x2a')];_0x5e5412[_0x886f('0x33')]=qs[_0x886f('0x34')](_0x59985c[_0x886f('0x2b')][_0x886f('0x34')]);_0x5e5412[_0x886f('0x35')]=qs[_0x886f('0x2d')](_[_0x886f('0x46')](_0x59985c['query'],_0x3190ed['filters']));if(_0x59985c[_0x886f('0x2b')][_0x886f('0x36')]){_0x5e5412['where']=_[_0x886f('0x37')](_0x5e5412[_0x886f('0x35')],{'$or':_[_0x886f('0x25')](_0x5e5412[_0x886f('0x2f')],function(_0x233273){var _0x4c2edc={};_0x4c2edc[_0x233273]={'$like':'%'+_0x59985c[_0x886f('0x2b')]['filter']+'%'};return _0x4c2edc;})});}_0x5e5412=_[_0x886f('0x37')]({},_0x5e5412,_0x59985c[_0x886f('0x39')]);return _0x25ab17[_0x886f('0x44')](_0x5e5412);}})['then'](function(_0x2cca34){if(_0x2cca34){_0x171c63=_0x2cca34[_0x886f('0x31')];if(!_0x59985c['query']['hasOwnProperty']('nolimit')){_0x5e5412[_0x886f('0x19')]=qs[_0x886f('0x19')](_0x59985c[_0x886f('0x2b')][_0x886f('0x19')]);_0x5e5412[_0x886f('0x17')]=qs[_0x886f('0x17')](_0x59985c[_0x886f('0x2b')][_0x886f('0x17')]);}return _0x25ab17[_0x886f('0x44')](_0x5e5412);}})['then'](function(_0x22fbcc){if(_0x22fbcc){return _0x22fbcc?{'count':_0x171c63,'rows':_0x22fbcc}:null;}})[_0x886f('0x20')](respondWithResult(_0x2db05c,null))['catch'](handleError(_0x2db05c,null));};exports['getSubjects']=function(_0x376f3a,_0x2f4f1d,_0x523306){var _0x3b2847={};var _0x516b9b={};var _0xbbd384;var _0x42aa7a;return db[_0x886f('0x26')][_0x886f('0x45')]({'where':{'id':_0x376f3a[_0x886f('0x3e')]['id']}})[_0x886f('0x20')](handleEntityNotFound(_0x2f4f1d,null))[_0x886f('0x20')](function(_0x3a82bd){if(_0x3a82bd){_0xbbd384=_0x3a82bd;_0x516b9b['model']=_[_0x886f('0x2c')](db[_0x886f('0x47')][_0x886f('0x3f')]);_0x516b9b[_0x886f('0x2b')]=_[_0x886f('0x2c')](_0x376f3a['query']);_0x516b9b['filters']=_[_0x886f('0x2e')](_0x516b9b['model'],_0x516b9b['query']);_0x3b2847[_0x886f('0x2f')]=_[_0x886f('0x2e')](_0x516b9b[_0x886f('0x2a')],qs[_0x886f('0x30')](_0x376f3a[_0x886f('0x2b')]['fields']));_0x3b2847[_0x886f('0x2f')]=_0x3b2847[_0x886f('0x2f')]['length']?_0x3b2847['attributes']:_0x516b9b['model'];_0x3b2847[_0x886f('0x33')]=qs[_0x886f('0x34')](_0x376f3a[_0x886f('0x2b')]['sort']);_0x3b2847[_0x886f('0x35')]=qs[_0x886f('0x2d')](_['pick'](_0x376f3a[_0x886f('0x2b')],_0x516b9b['filters']));if(_0x376f3a['query']['filter']){_0x3b2847[_0x886f('0x35')]=_[_0x886f('0x37')](_0x3b2847['where'],{'$or':_[_0x886f('0x25')](_0x3b2847[_0x886f('0x2f')],function(_0x1230c5){var _0x1c3b05={};_0x1c3b05[_0x1230c5]={'$like':'%'+_0x376f3a[_0x886f('0x2b')][_0x886f('0x36')]+'%'};return _0x1c3b05;})});}_0x3b2847=_[_0x886f('0x37')]({},_0x3b2847,_0x376f3a[_0x886f('0x39')]);return _0xbbd384['getSubjects'](_0x3b2847);}})[_0x886f('0x20')](function(_0x588c0c){if(_0x588c0c){_0x42aa7a=_0x588c0c[_0x886f('0x31')];if(!_0x376f3a[_0x886f('0x2b')][_0x886f('0x48')](_0x886f('0x32'))){_0x3b2847[_0x886f('0x19')]=qs[_0x886f('0x19')](_0x376f3a[_0x886f('0x2b')]['limit']);_0x3b2847['offset']=qs[_0x886f('0x17')](_0x376f3a[_0x886f('0x2b')][_0x886f('0x17')]);}return _0xbbd384[_0x886f('0x49')](_0x3b2847);}})[_0x886f('0x20')](function(_0x14f874){if(_0x14f874){return _0x14f874?{'count':_0x42aa7a,'rows':_0x14f874}:null;}})['then'](respondWithResult(_0x2f4f1d,null))[_0x886f('0x41')](handleError(_0x2f4f1d,null));};exports['getDescriptions']=function(_0x59db00,_0x48a633,_0x5cbfc8){var _0x58d116={};var _0xc029a7={};var _0x593162;var _0xebd5ba;return db['SugarcrmConfiguration'][_0x886f('0x45')]({'where':{'id':_0x59db00[_0x886f('0x3e')]['id']}})[_0x886f('0x20')](handleEntityNotFound(_0x48a633,null))['then'](function(_0x35a111){if(_0x35a111){_0x593162=_0x35a111;_0xc029a7['model']=_[_0x886f('0x2c')](db[_0x886f('0x47')]['rawAttributes']);_0xc029a7[_0x886f('0x2b')]=_[_0x886f('0x2c')](_0x59db00[_0x886f('0x2b')]);_0xc029a7[_0x886f('0x2d')]=_[_0x886f('0x2e')](_0xc029a7[_0x886f('0x2a')],_0xc029a7[_0x886f('0x2b')]);_0x58d116['attributes']=_[_0x886f('0x2e')](_0xc029a7[_0x886f('0x2a')],qs[_0x886f('0x30')](_0x59db00[_0x886f('0x2b')][_0x886f('0x30')]));_0x58d116[_0x886f('0x2f')]=_0x58d116[_0x886f('0x2f')][_0x886f('0x31')]?_0x58d116[_0x886f('0x2f')]:_0xc029a7[_0x886f('0x2a')];_0x58d116[_0x886f('0x33')]=qs[_0x886f('0x34')](_0x59db00[_0x886f('0x2b')]['sort']);_0x58d116[_0x886f('0x35')]=qs[_0x886f('0x2d')](_[_0x886f('0x46')](_0x59db00[_0x886f('0x2b')],_0xc029a7['filters']));if(_0x59db00['query'][_0x886f('0x36')]){_0x58d116[_0x886f('0x35')]=_[_0x886f('0x37')](_0x58d116[_0x886f('0x35')],{'$or':_[_0x886f('0x25')](_0x58d116[_0x886f('0x2f')],function(_0x3798e8){var _0x5bb9ca={};_0x5bb9ca[_0x3798e8]={'$like':'%'+_0x59db00[_0x886f('0x2b')][_0x886f('0x36')]+'%'};return _0x5bb9ca;})});}_0x58d116=_[_0x886f('0x37')]({},_0x58d116,_0x59db00[_0x886f('0x39')]);return _0x593162[_0x886f('0x4a')](_0x58d116);}})[_0x886f('0x20')](function(_0x386a0a){if(_0x386a0a){_0xebd5ba=_0x386a0a['length'];if(!_0x59db00[_0x886f('0x2b')][_0x886f('0x48')](_0x886f('0x32'))){_0x58d116[_0x886f('0x19')]=qs[_0x886f('0x19')](_0x59db00[_0x886f('0x2b')]['limit']);_0x58d116[_0x886f('0x17')]=qs['offset'](_0x59db00[_0x886f('0x2b')]['offset']);}return _0x593162[_0x886f('0x4a')](_0x58d116);}})[_0x886f('0x20')](function(_0x285d1b){if(_0x285d1b){return _0x285d1b?{'count':_0xebd5ba,'rows':_0x285d1b}:null;}})[_0x886f('0x20')](respondWithResult(_0x48a633,null))[_0x886f('0x41')](handleError(_0x48a633,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 39680c6..4cfcab5 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 _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 +var _0x3ed2=['util','api','moment','bluebird','request-promise','path','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x3af0d3,_0x4d0e1c){var _0x26de8d=function(_0x4fea55){while(--_0x4fea55){_0x3af0d3['push'](_0x3af0d3['shift']());}};_0x26de8d(++_0x4d0e1c);}(_0x3ed2,0x6b));var _0x23ed=function(_0x64a811,_0x4887b7){_0x64a811=_0x64a811-0x0;var _0x3d8099=_0x3ed2[_0x64a811];return _0x3d8099;};'use strict';var _=require(_0x23ed('0x0'));var util=require(_0x23ed('0x1'));var logger=require('../../config/logger')(_0x23ed('0x2'));var moment=require(_0x23ed('0x3'));var BPromise=require(_0x23ed('0x4'));var rp=require(_0x23ed('0x5'));var fs=require('fs');var path=require(_0x23ed('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0xfa787f,_0xcbf7cf){return _0xfa787f['define'](_0x23ed('0x7'),attributes,{'tableName':_0x23ed('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 422bf4c..35ea07f 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 _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 +var _0x2565=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4daafb,_0x528f2d){var _0x3367c5=function(_0x5dfc7c){while(--_0x5dfc7c){_0x4daafb['push'](_0x4daafb['shift']());}};_0x3367c5(++_0x528f2d);}(_0x2565,0xad));var _0x5256=function(_0x576ba2,_0x1d7dbd){_0x576ba2=_0x576ba2-0x0;var _0x280387=_0x2565[_0x576ba2];return _0x280387;};'use strict';var _=require(_0x5256('0x0'));var util=require(_0x5256('0x1'));var moment=require(_0x5256('0x2'));var BPromise=require(_0x5256('0x3'));var rs=require(_0x5256('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5256('0x5'))['db'];var utils=require(_0x5256('0x6'));var logger=require('../../config/logger')(_0x5256('0x7'));var config=require('../../config/environment');var jayson=require(_0x5256('0x8'));var client=jayson['client'][_0x5256('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1353a0,_0x1b230d,_0x43001f){return new BPromise(function(_0x2b2cfa,_0x820b28){return client[_0x5256('0xa')](_0x1353a0,_0x43001f)[_0x5256('0xb')](function(_0x36076f){logger[_0x5256('0xc')](_0x5256('0xd'),_0x1b230d,'request\x20sent');logger['debug'](_0x5256('0xe'),_0x1b230d,'request\x20sent',JSON[_0x5256('0xf')](_0x36076f));if(_0x36076f[_0x5256('0x10')]){if(_0x36076f[_0x5256('0x10')]['code']===0x1f4){logger['error'](_0x5256('0xd'),_0x1b230d,_0x36076f[_0x5256('0x10')][_0x5256('0x11')]);return _0x820b28(_0x36076f[_0x5256('0x10')]['message']);}logger[_0x5256('0x10')](_0x5256('0xd'),_0x1b230d,_0x36076f['error'][_0x5256('0x11')]);return _0x2b2cfa(_0x36076f[_0x5256('0x10')]['message']);}else{logger[_0x5256('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1b230d,'request\x20sent');_0x2b2cfa(_0x36076f['result'][_0x5256('0x11')]);}})[_0x5256('0x12')](function(_0x18916d){logger['error'](_0x5256('0xd'),_0x1b230d,_0x18916d);_0x820b28(_0x18916d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 08b0a51..4eea7b2 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 _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 +var _0x3866=['show','put','update','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x3866,0x7b));var _0x6386=function(_0x2bd0ad,_0x1d5726){_0x2bd0ad=_0x2bd0ad-0x0;var _0x1966b3=_0x3866[_0x2bd0ad];return _0x1966b3;};'use strict';var multer=require(_0x6386('0x0'));var util=require(_0x6386('0x1'));var path=require('path');var timeout=require(_0x6386('0x2'));var express=require(_0x6386('0x3'));var router=express['Router']();var fs_extra=require(_0x6386('0x4'));var auth=require(_0x6386('0x5'));var interaction=require(_0x6386('0x6'));var config=require(_0x6386('0x7'));var controller=require(_0x6386('0x8'));router[_0x6386('0x9')]('/',auth[_0x6386('0xa')](),controller[_0x6386('0xb')]);router[_0x6386('0x9')](_0x6386('0xc'),auth[_0x6386('0xa')](),controller[_0x6386('0xd')]);router['post']('/',auth[_0x6386('0xa')](),controller['create']);router[_0x6386('0xe')](_0x6386('0xc'),auth[_0x6386('0xa')](),controller[_0x6386('0xf')]);router[_0x6386('0x10')](_0x6386('0xc'),auth[_0x6386('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 45e9f0a..bf2e6ce 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 _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 +var _0xfab9=['string','variable','customVariable','picklist','STRING','BOOLEAN','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfab9,0x1aa));var _0x9fab=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfab9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x9fab('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9fab('0x1'),_0x9fab('0x2'),_0x9fab('0x3'),'keyValue',_0x9fab('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9fab('0x5')]},'key':{'type':Sequelize[_0x9fab('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x9fab('0x1'),'variable',_0x9fab('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9fab('0x5')]},'nameField':{'type':Sequelize[_0x9fab('0x5')]},'customField':{'type':Sequelize[_0x9fab('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9fab('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 870a8a2..bc7d832 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 _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 +var _0x7e17=['count','includeAll','rows','catch','show','params','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','save','update','then','destroy','error','name','send','index','SugarcrmField','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options'];(function(_0x43fda2,_0x1c5662){var _0xa492a2=function(_0x3a92c4){while(--_0x3a92c4){_0x43fda2['push'](_0x43fda2['shift']());}};_0xa492a2(++_0x1c5662);}(_0x7e17,0x121));var _0x77e1=function(_0x32d553,_0x12f5e8){_0x32d553=_0x32d553-0x0;var _0x1707a4=_0x7e17[_0x32d553];return _0x1707a4;};'use strict';var emlformat=require(_0x77e1('0x0'));var rimraf=require(_0x77e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77e1('0x2'));var moment=require(_0x77e1('0x3'));var BPromise=require(_0x77e1('0x4'));var Mustache=require(_0x77e1('0x5'));var util=require(_0x77e1('0x6'));var path=require(_0x77e1('0x7'));var sox=require('sox');var csv=require(_0x77e1('0x8'));var ejs=require(_0x77e1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77e1('0xa'));var squel=require(_0x77e1('0xb'));var crypto=require(_0x77e1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x77e1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x77e1('0xe'));var Redis=require(_0x77e1('0xf'));var authService=require(_0x77e1('0x10'));var qs=require(_0x77e1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x77e1('0x12'))(_0x77e1('0x13'));var utils=require(_0x77e1('0x14'));var config=require(_0x77e1('0x15'));var licenseUtil=require(_0x77e1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46b794,_0x29d03c){_0x29d03c=_0x29d03c||0xcc;return function(_0x4dd59a){if(_0x4dd59a){return _0x46b794[_0x77e1('0x17')](_0x29d03c);}return _0x46b794['status'](_0x29d03c)[_0x77e1('0x18')]();};}function respondWithResult(_0x2d3038,_0x12020c){_0x12020c=_0x12020c||0xc8;return function(_0x157870){if(_0x157870){return _0x2d3038[_0x77e1('0x19')](_0x12020c)[_0x77e1('0x1a')](_0x157870);}};}function respondWithFilteredResult(_0x477789,_0x338737){return function(_0x44cf79){if(_0x44cf79){var _0x1e8d22=typeof _0x338737['offset']===_0x77e1('0x1b')&&typeof _0x338737[_0x77e1('0x1c')]===_0x77e1('0x1b');var _0x3b8460=_0x44cf79['count'];var _0x5b081a=_0x1e8d22?0x0:_0x338737[_0x77e1('0x1d')];var _0x37c244=_0x1e8d22?_0x44cf79['count']:_0x338737[_0x77e1('0x1d')]+_0x338737['limit'];var _0x527ea8;if(_0x37c244>=_0x3b8460){_0x37c244=_0x3b8460;_0x527ea8=0xc8;}else{_0x527ea8=0xce;}_0x477789[_0x77e1('0x19')](_0x527ea8);return _0x477789[_0x77e1('0x1e')](_0x77e1('0x1f'),_0x5b081a+'-'+_0x37c244+'/'+_0x3b8460)['json'](_0x44cf79);}return null;};}function patchUpdates(_0xdadbaa){return function(_0xf55f59){try{jsonpatch['apply'](_0xf55f59,_0xdadbaa,!![]);}catch(_0xbaeed6){return BPromise['reject'](_0xbaeed6);}return _0xf55f59[_0x77e1('0x20')]();};}function saveUpdates(_0x20c66c,_0x33ca18){return function(_0x1e543c){if(_0x1e543c){return _0x1e543c[_0x77e1('0x21')](_0x20c66c)[_0x77e1('0x22')](function(_0x18cc9f){return _0x18cc9f;});}return null;};}function removeEntity(_0x4d21e5,_0x224ff6){return function(_0x49c140){if(_0x49c140){return _0x49c140[_0x77e1('0x23')]()[_0x77e1('0x22')](function(){_0x4d21e5['status'](0xcc)[_0x77e1('0x18')]();});}};}function handleEntityNotFound(_0x49e248,_0x1517cc){return function(_0x9da157){if(!_0x9da157){_0x49e248[_0x77e1('0x17')](0x194);}return _0x9da157;};}function handleError(_0x42107d,_0x1f4d87){_0x1f4d87=_0x1f4d87||0x1f4;return function(_0x306559){logger[_0x77e1('0x24')](_0x306559['stack']);if(_0x306559[_0x77e1('0x25')]){delete _0x306559[_0x77e1('0x25')];}_0x42107d[_0x77e1('0x19')](_0x1f4d87)[_0x77e1('0x26')](_0x306559);};}exports[_0x77e1('0x27')]=function(_0x1e2e12,_0x21c921){var _0x4021bb={},_0xc79507={},_0x11c662={'count':0x0,'rows':[]};var _0x3182f3=_['map'](db[_0x77e1('0x28')][_0x77e1('0x29')],function(_0x1096ec){return{'name':_0x1096ec[_0x77e1('0x2a')],'type':_0x1096ec[_0x77e1('0x2b')]['key']};});_0xc79507[_0x77e1('0x2c')]=_[_0x77e1('0x2d')](_0x3182f3,_0x77e1('0x25'));_0xc79507[_0x77e1('0x2e')]=_[_0x77e1('0x2f')](_0x1e2e12['query']);_0xc79507['filters']=_['intersection'](_0xc79507[_0x77e1('0x2c')],_0xc79507['query']);_0x4021bb['attributes']=_[_0x77e1('0x30')](_0xc79507['model'],qs[_0x77e1('0x31')](_0x1e2e12[_0x77e1('0x2e')][_0x77e1('0x31')]));_0x4021bb[_0x77e1('0x32')]=_0x4021bb[_0x77e1('0x32')][_0x77e1('0x33')]?_0x4021bb[_0x77e1('0x32')]:_0xc79507[_0x77e1('0x2c')];if(!_0x1e2e12[_0x77e1('0x2e')][_0x77e1('0x34')]('nolimit')){_0x4021bb[_0x77e1('0x1c')]=qs[_0x77e1('0x1c')](_0x1e2e12[_0x77e1('0x2e')][_0x77e1('0x1c')]);_0x4021bb[_0x77e1('0x1d')]=qs[_0x77e1('0x1d')](_0x1e2e12[_0x77e1('0x2e')]['offset']);}_0x4021bb['order']=qs[_0x77e1('0x35')](_0x1e2e12[_0x77e1('0x2e')]['sort']);_0x4021bb[_0x77e1('0x36')]=qs['filters'](_[_0x77e1('0x37')](_0x1e2e12['query'],_0xc79507[_0x77e1('0x38')]),_0x3182f3);if(_0x1e2e12[_0x77e1('0x2e')][_0x77e1('0x39')]){_0x4021bb[_0x77e1('0x36')]=_[_0x77e1('0x3a')](_0x4021bb[_0x77e1('0x36')],{'$or':_[_0x77e1('0x2d')](_0x3182f3,function(_0x42c93f){if(_0x42c93f[_0x77e1('0x2b')]!==_0x77e1('0x3b')){var _0x46d07f={};_0x46d07f[_0x42c93f['name']]={'$like':'%'+_0x1e2e12['query'][_0x77e1('0x39')]+'%'};return _0x46d07f;}})});}_0x4021bb=_[_0x77e1('0x3a')]({},_0x4021bb,_0x1e2e12[_0x77e1('0x3c')]);var _0x342e6c={'where':_0x4021bb[_0x77e1('0x36')]};return db[_0x77e1('0x28')][_0x77e1('0x3d')](_0x342e6c)[_0x77e1('0x22')](function(_0x5b396b){_0x11c662[_0x77e1('0x3d')]=_0x5b396b;if(_0x1e2e12[_0x77e1('0x2e')][_0x77e1('0x3e')]){_0x4021bb['include']=[{'all':!![]}];}return db[_0x77e1('0x28')]['findAll'](_0x4021bb);})['then'](function(_0x152b0e){_0x11c662[_0x77e1('0x3f')]=_0x152b0e;return _0x11c662;})[_0x77e1('0x22')](respondWithFilteredResult(_0x21c921,_0x4021bb))[_0x77e1('0x40')](handleError(_0x21c921,null));};exports[_0x77e1('0x41')]=function(_0x282373,_0x34db09){var _0x419519={'raw':!![],'where':{'id':_0x282373[_0x77e1('0x42')]['id']}},_0x27c78d={};_0x27c78d[_0x77e1('0x2c')]=_['keys'](db[_0x77e1('0x28')]['rawAttributes']);_0x27c78d[_0x77e1('0x2e')]=_['keys'](_0x282373[_0x77e1('0x2e')]);_0x27c78d[_0x77e1('0x38')]=_[_0x77e1('0x30')](_0x27c78d['model'],_0x27c78d[_0x77e1('0x2e')]);_0x419519['attributes']=_[_0x77e1('0x30')](_0x27c78d[_0x77e1('0x2c')],qs[_0x77e1('0x31')](_0x282373[_0x77e1('0x2e')]['fields']));_0x419519[_0x77e1('0x32')]=_0x419519[_0x77e1('0x32')][_0x77e1('0x33')]?_0x419519['attributes']:_0x27c78d[_0x77e1('0x2c')];if(_0x282373[_0x77e1('0x2e')][_0x77e1('0x3e')]){_0x419519['include']=[{'all':!![]}];}_0x419519=_[_0x77e1('0x3a')]({},_0x419519,_0x282373[_0x77e1('0x3c')]);return db[_0x77e1('0x28')][_0x77e1('0x43')](_0x419519)[_0x77e1('0x22')](handleEntityNotFound(_0x34db09,null))[_0x77e1('0x22')](respondWithResult(_0x34db09,null))[_0x77e1('0x40')](handleError(_0x34db09,null));};exports[_0x77e1('0x44')]=function(_0x505ea3,_0x2867eb){return db[_0x77e1('0x28')][_0x77e1('0x44')](_0x505ea3[_0x77e1('0x45')],{})['then'](respondWithResult(_0x2867eb,0xc9))[_0x77e1('0x40')](handleError(_0x2867eb,null));};exports[_0x77e1('0x21')]=function(_0x186ed5,_0x264e3a){if(_0x186ed5[_0x77e1('0x45')]['id']){delete _0x186ed5[_0x77e1('0x45')]['id'];}return db[_0x77e1('0x28')][_0x77e1('0x43')]({'where':{'id':_0x186ed5[_0x77e1('0x42')]['id']}})[_0x77e1('0x22')](handleEntityNotFound(_0x264e3a,null))[_0x77e1('0x22')](saveUpdates(_0x186ed5[_0x77e1('0x45')],null))[_0x77e1('0x22')](respondWithResult(_0x264e3a,null))[_0x77e1('0x40')](handleError(_0x264e3a,null));};exports['destroy']=function(_0xab4ed6,_0x51c878){return db[_0x77e1('0x28')][_0x77e1('0x43')]({'where':{'id':_0xab4ed6[_0x77e1('0x42')]['id']}})[_0x77e1('0x22')](handleEntityNotFound(_0x51c878,null))['then'](removeEntity(_0x51c878,null))[_0x77e1('0x40')](handleError(_0x51c878,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a9f4bcd..cf95446 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 _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 +var _0x0597=['int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x0597,0x173));var _0x7059=function(_0x4f0171,_0x1c51aa){_0x4f0171=_0x4f0171-0x0;var _0x1c0155=_0x0597[_0x4f0171];return _0x1c0155;};'use strict';var _=require(_0x7059('0x0'));var util=require(_0x7059('0x1'));var logger=require(_0x7059('0x2'))(_0x7059('0x3'));var moment=require('moment');var BPromise=require(_0x7059('0x4'));var rp=require(_0x7059('0x5'));var fs=require('fs');var path=require(_0x7059('0x6'));var rimraf=require(_0x7059('0x7'));var config=require(_0x7059('0x8'));var attributes=require(_0x7059('0x9'));module[_0x7059('0xa')]=function(_0x5c9dce,_0x2f0845){return _0x5c9dce[_0x7059('0xb')](_0x7059('0xc'),attributes,{'tableName':_0x7059('0xd'),'paranoid':![],'indexes':[{'name':_0x7059('0xe'),'fields':[_0x7059('0xf'),'FieldId'],'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 2b10050..36ad5e5 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 _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 +var _0xe200=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x52876c,_0x4ba4c7){var _0x38e085=function(_0x519d3f){while(--_0x519d3f){_0x52876c['push'](_0x52876c['shift']());}};_0x38e085(++_0x4ba4c7);}(_0xe200,0xed));var _0x0e20=function(_0x4a107e,_0x4de2f8){_0x4a107e=_0x4a107e-0x0;var _0x5ba66d=_0xe200[_0x4a107e];return _0x5ba66d;};'use strict';var _=require(_0x0e20('0x0'));var util=require(_0x0e20('0x1'));var moment=require(_0x0e20('0x2'));var BPromise=require(_0x0e20('0x3'));var rs=require(_0x0e20('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e20('0x5'))['db'];var utils=require(_0x0e20('0x6'));var logger=require(_0x0e20('0x7'))('rpc');var config=require(_0x0e20('0x8'));var jayson=require(_0x0e20('0x9'));var client=jayson[_0x0e20('0xa')][_0x0e20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e0699,_0x2e7e4a,_0x465ec1){return new BPromise(function(_0x50ebfd,_0x57669d){return client['request'](_0x4e0699,_0x465ec1)[_0x0e20('0xc')](function(_0x21614b){logger['info'](_0x0e20('0xd'),_0x2e7e4a,_0x0e20('0xe'));logger[_0x0e20('0xf')](_0x0e20('0x10'),_0x2e7e4a,_0x0e20('0xe'),JSON[_0x0e20('0x11')](_0x21614b));if(_0x21614b[_0x0e20('0x12')]){if(_0x21614b['error'][_0x0e20('0x13')]===0x1f4){logger[_0x0e20('0x12')](_0x0e20('0xd'),_0x2e7e4a,_0x21614b[_0x0e20('0x12')][_0x0e20('0x14')]);return _0x57669d(_0x21614b[_0x0e20('0x12')][_0x0e20('0x14')]);}logger['error'](_0x0e20('0xd'),_0x2e7e4a,_0x21614b[_0x0e20('0x12')][_0x0e20('0x14')]);return _0x50ebfd(_0x21614b[_0x0e20('0x12')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x2e7e4a,_0x0e20('0xe'));_0x50ebfd(_0x21614b['result'][_0x0e20('0x14')]);}})['catch'](function(_0x360690){logger[_0x0e20('0x12')](_0x0e20('0xd'),_0x2e7e4a,_0x360690);_0x57669d(_0x360690);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2516134..9c86630 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 _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 +var _0x0851=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0851,0x8a));var _0x1085=function(_0x2238fa,_0x46243c){_0x2238fa=_0x2238fa-0x0;var _0x8e1006=_0x0851[_0x2238fa];return _0x8e1006;};'use strict';var multer=require(_0x1085('0x0'));var util=require(_0x1085('0x1'));var path=require(_0x1085('0x2'));var timeout=require(_0x1085('0x3'));var express=require('express');var router=express[_0x1085('0x4')]();var fs_extra=require(_0x1085('0x5'));var auth=require(_0x1085('0x6'));var interaction=require(_0x1085('0x7'));var config=require(_0x1085('0x8'));var controller=require(_0x1085('0x9'));router[_0x1085('0xa')]('/',auth[_0x1085('0xb')](),controller[_0x1085('0xc')]);router[_0x1085('0xa')](_0x1085('0xd'),auth[_0x1085('0xb')](),controller['show']);router['get'](_0x1085('0xe'),auth[_0x1085('0xb')](),controller[_0x1085('0xf')]);router[_0x1085('0xa')](_0x1085('0x10'),auth[_0x1085('0xb')](),controller['getFields']);router[_0x1085('0x11')]('/',auth[_0x1085('0xb')](),controller[_0x1085('0x12')]);router[_0x1085('0x11')](_0x1085('0xe'),auth[_0x1085('0xb')](),controller[_0x1085('0x13')]);router[_0x1085('0x14')](_0x1085('0xd'),auth[_0x1085('0xb')](),controller[_0x1085('0x15')]);router['delete'](_0x1085('0xd'),auth['isAuthenticated'](),controller[_0x1085('0x16')]);module[_0x1085('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 84366b7..95e8468 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 _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 +var _0xd207=['exports','STRING'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xd207,0x1ca));var _0x7d20=function(_0x5972bf,_0x3d4058){_0x5972bf=_0x5972bf-0x0;var _0x248bef=_0xd207[_0x5972bf];return _0x248bef;};'use strict';var Sequelize=require('sequelize');module[_0x7d20('0x0')]={'name':{'type':Sequelize[_0x7d20('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7d20('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7d20('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7d20('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 017e735..d2019b9 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 _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 +var _0xfaf5=['rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','include','VtigerAccount','rows','catch','show','params','find','body','getConfigurations','VtigerConfiguration','length','hasOwnProperty','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','token','describe','result','sessionName','autogenerated','reference','remove','editable','label','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map'];(function(_0x26042f,_0x4cf1f1){var _0x10a8bf=function(_0x5ac0d6){while(--_0x5ac0d6){_0x26042f['push'](_0x26042f['shift']());}};_0x10a8bf(++_0x4cf1f1);}(_0xfaf5,0x197));var _0x5faf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaf5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5faf('0x0'));var rimraf=require(_0x5faf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5faf('0x2'));var rp=require(_0x5faf('0x3'));var moment=require(_0x5faf('0x4'));var BPromise=require(_0x5faf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5faf('0x6'));var sox=require(_0x5faf('0x7'));var csv=require('to-csv');var ejs=require(_0x5faf('0x8'));var fs=require('fs');var fs_extra=require(_0x5faf('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5faf('0xa'));var jsforce=require(_0x5faf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5faf('0xc'));var querystring=require('querystring');var Papa=require(_0x5faf('0xd'));var Redis=require('ioredis');var authService=require(_0x5faf('0xe'));var qs=require(_0x5faf('0xf'));var as=require(_0x5faf('0x10'));var hardwareService=require(_0x5faf('0x11'));var logger=require(_0x5faf('0x12'))('api');var utils=require(_0x5faf('0x13'));var config=require(_0x5faf('0x14'));var licenseUtil=require(_0x5faf('0x15'));var db=require(_0x5faf('0x16'))['db'];var integrations=require(_0x5faf('0x17'));function respondWithStatusCode(_0x4a0ac1,_0x6c17ce){_0x6c17ce=_0x6c17ce||0xcc;return function(_0x189ebf){if(_0x189ebf){return _0x4a0ac1[_0x5faf('0x18')](_0x6c17ce);}return _0x4a0ac1[_0x5faf('0x19')](_0x6c17ce)['end']();};}function respondWithResult(_0x366d9e,_0x39897b){_0x39897b=_0x39897b||0xc8;return function(_0x3f8ba5){if(_0x3f8ba5){return _0x366d9e[_0x5faf('0x19')](_0x39897b)[_0x5faf('0x1a')](_0x3f8ba5);}};}function respondWithFilteredResult(_0x13066a,_0x2e9ada){return function(_0x27c8c7){if(_0x27c8c7){var _0x25a24e=typeof _0x2e9ada[_0x5faf('0x1b')]==='undefined'&&typeof _0x2e9ada['limit']==='undefined';var _0x1e194e=_0x27c8c7[_0x5faf('0x1c')];var _0x86d020=_0x25a24e?0x0:_0x2e9ada[_0x5faf('0x1b')];var _0x35af2a=_0x25a24e?_0x27c8c7['count']:_0x2e9ada[_0x5faf('0x1b')]+_0x2e9ada['limit'];var _0x3ceda8;if(_0x35af2a>=_0x1e194e){_0x35af2a=_0x1e194e;_0x3ceda8=0xc8;}else{_0x3ceda8=0xce;}_0x13066a[_0x5faf('0x19')](_0x3ceda8);return _0x13066a[_0x5faf('0x1d')]('Content-Range',_0x86d020+'-'+_0x35af2a+'/'+_0x1e194e)[_0x5faf('0x1a')](_0x27c8c7);}return null;};}function patchUpdates(_0x28925b){return function(_0x35a72f){try{jsonpatch[_0x5faf('0x1e')](_0x35a72f,_0x28925b,!![]);}catch(_0x1d3e4c){return BPromise[_0x5faf('0x1f')](_0x1d3e4c);}return _0x35a72f[_0x5faf('0x20')]();};}function saveUpdates(_0x55ee0b,_0x350213){return function(_0x23e7ea){if(_0x23e7ea){return _0x23e7ea[_0x5faf('0x21')](_0x55ee0b)[_0x5faf('0x22')](function(_0x574600){return _0x574600;});}return null;};}function removeEntity(_0xe639f9,_0x120b13){return function(_0x57b612){if(_0x57b612){return _0x57b612[_0x5faf('0x23')]()[_0x5faf('0x22')](function(){_0xe639f9[_0x5faf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff0367,_0x3b68dc){return function(_0x4b12fa){if(!_0x4b12fa){_0xff0367[_0x5faf('0x18')](0x194);}return _0x4b12fa;};}function handleError(_0x2f35f5,_0x1f4fda){_0x1f4fda=_0x1f4fda||0x1f4;return function(_0x1615f1){logger[_0x5faf('0x24')](_0x1615f1[_0x5faf('0x25')]);if(_0x1615f1[_0x5faf('0x26')]){delete _0x1615f1[_0x5faf('0x26')];}_0x2f35f5['status'](_0x1f4fda)[_0x5faf('0x27')](_0x1615f1);};}exports['index']=function(_0xa9d69e,_0x4cf80d){var _0x5f4a34={},_0x5bc064={},_0x2de228={'count':0x0,'rows':[]};var _0x529710=_[_0x5faf('0x28')](db['VtigerAccount'][_0x5faf('0x29')],function(_0x42b76c){return{'name':_0x42b76c[_0x5faf('0x2a')],'type':_0x42b76c[_0x5faf('0x2b')][_0x5faf('0x2c')]};});_0x5bc064[_0x5faf('0x2d')]=_['map'](_0x529710,'name');_0x5bc064['query']=_[_0x5faf('0x2e')](_0xa9d69e['query']);_0x5bc064['filters']=_[_0x5faf('0x2f')](_0x5bc064[_0x5faf('0x2d')],_0x5bc064[_0x5faf('0x30')]);_0x5f4a34[_0x5faf('0x31')]=_['intersection'](_0x5bc064[_0x5faf('0x2d')],qs[_0x5faf('0x32')](_0xa9d69e['query']['fields']));_0x5f4a34[_0x5faf('0x31')]=_0x5f4a34['attributes']['length']?_0x5f4a34[_0x5faf('0x31')]:_0x5bc064[_0x5faf('0x2d')];if(!_0xa9d69e[_0x5faf('0x30')]['hasOwnProperty'](_0x5faf('0x33'))){_0x5f4a34[_0x5faf('0x34')]=qs['limit'](_0xa9d69e[_0x5faf('0x30')]['limit']);_0x5f4a34[_0x5faf('0x1b')]=qs['offset'](_0xa9d69e[_0x5faf('0x30')][_0x5faf('0x1b')]);}_0x5f4a34[_0x5faf('0x35')]=qs[_0x5faf('0x36')](_0xa9d69e[_0x5faf('0x30')][_0x5faf('0x36')]);_0x5f4a34[_0x5faf('0x37')]=qs[_0x5faf('0x38')](_['pick'](_0xa9d69e[_0x5faf('0x30')],_0x5bc064[_0x5faf('0x38')]),_0x529710);if(_0xa9d69e[_0x5faf('0x30')][_0x5faf('0x39')]){_0x5f4a34[_0x5faf('0x37')]=_['merge'](_0x5f4a34['where'],{'$or':_['map'](_0x529710,function(_0xaa80ec){if(_0xaa80ec[_0x5faf('0x2b')]!=='VIRTUAL'){var _0x36e072={};_0x36e072[_0xaa80ec['name']]={'$like':'%'+_0xa9d69e[_0x5faf('0x30')][_0x5faf('0x39')]+'%'};return _0x36e072;}})});}_0x5f4a34=_[_0x5faf('0x3a')]({},_0x5f4a34,_0xa9d69e[_0x5faf('0x3b')]);var _0x254374={'where':_0x5f4a34[_0x5faf('0x37')]};return db['VtigerAccount'][_0x5faf('0x1c')](_0x254374)[_0x5faf('0x22')](function(_0xc04509){_0x2de228[_0x5faf('0x1c')]=_0xc04509;if(_0xa9d69e[_0x5faf('0x30')][_0x5faf('0x3c')]){_0x5f4a34[_0x5faf('0x3d')]=[{'all':!![]}];}return db[_0x5faf('0x3e')]['findAll'](_0x5f4a34);})[_0x5faf('0x22')](function(_0x560a45){_0x2de228[_0x5faf('0x3f')]=_0x560a45;return _0x2de228;})[_0x5faf('0x22')](respondWithFilteredResult(_0x4cf80d,_0x5f4a34))[_0x5faf('0x40')](handleError(_0x4cf80d,null));};exports[_0x5faf('0x41')]=function(_0x548cf8,_0x4b5e4b){var _0x33c72d={'raw':![],'where':{'id':_0x548cf8[_0x5faf('0x42')]['id']}},_0x3fec56={};_0x3fec56[_0x5faf('0x2d')]=_['keys'](db[_0x5faf('0x3e')][_0x5faf('0x29')]);_0x3fec56[_0x5faf('0x30')]=_[_0x5faf('0x2e')](_0x548cf8[_0x5faf('0x30')]);_0x3fec56['filters']=_['intersection'](_0x3fec56[_0x5faf('0x2d')],_0x3fec56[_0x5faf('0x30')]);_0x33c72d['attributes']=_['intersection'](_0x3fec56[_0x5faf('0x2d')],qs[_0x5faf('0x32')](_0x548cf8[_0x5faf('0x30')][_0x5faf('0x32')]));_0x33c72d[_0x5faf('0x31')]=_0x33c72d[_0x5faf('0x31')]['length']?_0x33c72d[_0x5faf('0x31')]:_0x3fec56[_0x5faf('0x2d')];if(_0x548cf8[_0x5faf('0x30')]['includeAll']){_0x33c72d[_0x5faf('0x3d')]=[{'all':!![]}];}_0x33c72d=_['merge']({},_0x33c72d,_0x548cf8['options']);return db['VtigerAccount'][_0x5faf('0x43')](_0x33c72d)[_0x5faf('0x22')](handleEntityNotFound(_0x4b5e4b,null))[_0x5faf('0x22')](respondWithResult(_0x4b5e4b,null))[_0x5faf('0x40')](handleError(_0x4b5e4b,null));};exports['create']=function(_0x579035,_0x38067b){return db[_0x5faf('0x3e')]['create'](_0x579035[_0x5faf('0x44')],{})[_0x5faf('0x22')](respondWithResult(_0x38067b,0xc9))['catch'](handleError(_0x38067b,null));};exports[_0x5faf('0x21')]=function(_0x23a183,_0x2e2aed){if(_0x23a183[_0x5faf('0x44')]['id']){delete _0x23a183[_0x5faf('0x44')]['id'];}return db[_0x5faf('0x3e')]['find']({'where':{'id':_0x23a183['params']['id']}})['then'](handleEntityNotFound(_0x2e2aed,null))[_0x5faf('0x22')](saveUpdates(_0x23a183[_0x5faf('0x44')],null))[_0x5faf('0x22')](respondWithResult(_0x2e2aed,null))['catch'](handleError(_0x2e2aed,null));};exports['destroy']=function(_0x31994d,_0x4c4061){return db[_0x5faf('0x3e')]['find']({'where':{'id':_0x31994d[_0x5faf('0x42')]['id']}})[_0x5faf('0x22')](handleEntityNotFound(_0x4c4061,null))[_0x5faf('0x22')](removeEntity(_0x4c4061,null))[_0x5faf('0x40')](handleError(_0x4c4061,null));};exports[_0x5faf('0x45')]=function(_0x3e255c,_0x2df980,_0x851750){var _0xb2dda1={};var _0x1a0146={};var _0x408b50;var _0x547b29;return db[_0x5faf('0x3e')]['findOne']({'where':{'id':_0x3e255c[_0x5faf('0x42')]['id']}})['then'](handleEntityNotFound(_0x2df980,null))[_0x5faf('0x22')](function(_0x47376c){if(_0x47376c){_0x408b50=_0x47376c;_0x1a0146[_0x5faf('0x2d')]=_[_0x5faf('0x2e')](db[_0x5faf('0x46')][_0x5faf('0x29')]);_0x1a0146[_0x5faf('0x30')]=_['keys'](_0x3e255c[_0x5faf('0x30')]);_0x1a0146[_0x5faf('0x38')]=_[_0x5faf('0x2f')](_0x1a0146[_0x5faf('0x2d')],_0x1a0146[_0x5faf('0x30')]);_0xb2dda1[_0x5faf('0x31')]=_[_0x5faf('0x2f')](_0x1a0146['model'],qs[_0x5faf('0x32')](_0x3e255c[_0x5faf('0x30')][_0x5faf('0x32')]));_0xb2dda1[_0x5faf('0x31')]=_0xb2dda1[_0x5faf('0x31')][_0x5faf('0x47')]?_0xb2dda1[_0x5faf('0x31')]:_0x1a0146[_0x5faf('0x2d')];_0xb2dda1[_0x5faf('0x35')]=qs[_0x5faf('0x36')](_0x3e255c[_0x5faf('0x30')][_0x5faf('0x36')]);_0xb2dda1[_0x5faf('0x37')]=qs['filters'](_['pick'](_0x3e255c[_0x5faf('0x30')],_0x1a0146['filters']));if(_0x3e255c[_0x5faf('0x30')][_0x5faf('0x39')]){_0xb2dda1[_0x5faf('0x37')]=_[_0x5faf('0x3a')](_0xb2dda1[_0x5faf('0x37')],{'$or':_[_0x5faf('0x28')](_0xb2dda1[_0x5faf('0x31')],function(_0x114f30){var _0x401bb7={};_0x401bb7[_0x114f30]={'$like':'%'+_0x3e255c['query']['filter']+'%'};return _0x401bb7;})});}_0xb2dda1=_[_0x5faf('0x3a')]({},_0xb2dda1,_0x3e255c[_0x5faf('0x3b')]);return _0x408b50[_0x5faf('0x45')](_0xb2dda1);}})[_0x5faf('0x22')](function(_0x11e9e4){if(_0x11e9e4){_0x547b29=_0x11e9e4['length'];if(!_0x3e255c[_0x5faf('0x30')][_0x5faf('0x48')](_0x5faf('0x33'))){_0xb2dda1[_0x5faf('0x34')]=qs[_0x5faf('0x34')](_0x3e255c[_0x5faf('0x30')][_0x5faf('0x34')]);_0xb2dda1[_0x5faf('0x1b')]=qs[_0x5faf('0x1b')](_0x3e255c[_0x5faf('0x30')][_0x5faf('0x1b')]);}return _0x408b50[_0x5faf('0x45')](_0xb2dda1);}})[_0x5faf('0x22')](function(_0x35f6dc){if(_0x35f6dc){return _0x35f6dc?{'count':_0x547b29,'rows':_0x35f6dc}:null;}})[_0x5faf('0x22')](respondWithResult(_0x2df980,null))[_0x5faf('0x40')](handleError(_0x2df980,null));};exports[_0x5faf('0x49')]=function(_0x340f8e,_0x36c746,_0x14fd08){if(_0x340f8e[_0x5faf('0x44')]['id']){delete _0x340f8e[_0x5faf('0x44')]['id'];}return db[_0x5faf('0x3e')]['findOne']({'where':{'id':_0x340f8e[_0x5faf('0x42')]['id']}})[_0x5faf('0x22')](handleEntityNotFound(_0x36c746,null))[_0x5faf('0x22')](function(_0x2b2872){if(_0x2b2872){_0x340f8e[_0x5faf('0x44')]['AccountId']=_0x2b2872['id'];_0x340f8e[_0x5faf('0x44')]['Subjects']=integrations[_0x5faf('0x4a')](_0x340f8e[_0x5faf('0x44')]['channel'],_0x340f8e[_0x5faf('0x44')][_0x5faf('0x2b')]);_0x340f8e['body'][_0x5faf('0x4b')]=integrations[_0x5faf('0x4c')](_0x340f8e['body'][_0x5faf('0x4d')],_0x340f8e[_0x5faf('0x44')][_0x5faf('0x2b')]);return db[_0x5faf('0x46')]['create'](_0x340f8e[_0x5faf('0x44')],{'include':[{'model':db[_0x5faf('0x4e')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x5faf('0x4b')}]});}return null;})[_0x5faf('0x22')](respondWithResult(_0x36c746,null))[_0x5faf('0x40')](handleError(_0x36c746,null));};var md5=require(_0x5faf('0x4f'));exports[_0x5faf('0x50')]=function(_0x3da539,_0x589911,_0x3526b1){var _0x2c204e=null;var _0x4dcb36=null;var _0x18ba53=null;var _0x5235bf=null;var _0x3a96db='';return db[_0x5faf('0x3e')]['findOne']({'where':{'id':_0x3da539[_0x5faf('0x42')]['id']},'attributes':['id',_0x5faf('0x26'),_0x5faf('0x51'),_0x5faf('0x52'),_0x5faf('0x53'),'remoteUri',_0x5faf('0x54'),'accessKey']})[_0x5faf('0x22')](handleEntityNotFound(_0x589911,null))[_0x5faf('0x22')](function(_0xacab3e){if(_0xacab3e){_0x2c204e=_0xacab3e[_0x5faf('0x51')];_0x4dcb36=_0xacab3e[_0x5faf('0x55')];_0x18ba53=_0xacab3e[_0x5faf('0x53')];_0x3a96db=_0xacab3e['remoteUri'];var _0x435016=_0x3a96db[_0x5faf('0x56')](-0x1);if(_0x435016==='/'){_0x3a96db=_0x3a96db['substring'](0x0,_0x3a96db[_0x5faf('0x57')](_0x435016));}_0x5235bf=util[_0x5faf('0x58')](_0x5faf('0x59'),_0x3a96db);var _0x295b6e={'method':_0x5faf('0x5a'),'uri':_0x5235bf,'qs':{'operation':_0x5faf('0x5b'),'username':_0xacab3e[_0x5faf('0x51')]},'json':!![]};return rp(_0x295b6e);}})[_0x5faf('0x22')](function(_0x61c1d){if(_0x61c1d[_0x5faf('0x5c')]){var _0x16246a={'method':'POST','uri':_0x5235bf,'form':{'operation':_0x5faf('0x5d'),'username':_0x2c204e,'accessKey':md5(_0x61c1d['result'][_0x5faf('0x5e')]+_0x4dcb36)},'json':!![]};return rp(_0x16246a);}})[_0x5faf('0x22')](function(_0x5411d4){if(_0x5411d4[_0x5faf('0x5c')]){var _0x66dad5={'method':'GET','uri':_0x5235bf,'qs':{'operation':_0x5faf('0x5f'),'username':_0x2c204e,'sessionName':_0x5411d4[_0x5faf('0x60')][_0x5faf('0x61')],'elementType':_0x18ba53},'json':!![]};return rp(_0x66dad5);}})['then'](function(_0x4995b3){if(_0x4995b3[_0x5faf('0x5c')]){var _0x1ad837=[_0x5faf('0x62'),_0x5faf('0x63'),'owner'];_[_0x5faf('0x64')](_0x4995b3[_0x5faf('0x60')][_0x5faf('0x32')],function(_0x262f9b){return _0x1ad837['includes'](_0x262f9b[_0x5faf('0x2b')][_0x5faf('0x26')]);});_[_0x5faf('0x64')](_0x4995b3[_0x5faf('0x60')][_0x5faf('0x32')],function(_0x1d9ca4){return _0x1d9ca4[_0x5faf('0x65')]==='false';});return{'count':_0x4995b3[_0x5faf('0x60')][_0x5faf('0x32')][_0x5faf('0x47')],'rows':_['map'](_0x4995b3[_0x5faf('0x60')][_0x5faf('0x32')],function(_0x39efc1){return{'id':_0x39efc1['name'],'name':_0x39efc1[_0x5faf('0x66')],'custom':_['startsWith'](_0x39efc1[_0x5faf('0x26')],_0x5faf('0x67'))?!![]:![],'options':_0x39efc1[_0x5faf('0x2b')][_0x5faf('0x26')]===_0x5faf('0x68')&&_0x39efc1[_0x5faf('0x2b')][_0x5faf('0x69')][_0x5faf('0x47')]>0x0?_[_0x5faf('0x28')](_0x39efc1[_0x5faf('0x2b')][_0x5faf('0x69')],function(_0x356725){return{'name':_0x356725[_0x5faf('0x66')],'value':_0x356725[_0x5faf('0x6a')]};}):[]};})};}})[_0x5faf('0x22')](respondWithResult(_0x589911,null))['catch'](function(_0x366233){console['log'](_0x5faf('0x6b')+_0x366233);var _0x41bad1=_0x3da539[_0x5faf('0x30')]['test']?0x1f4:_0x366233[_0x5faf('0x6c')]||0x1f4;logger[_0x5faf('0x24')](_0x5faf('0x6d'),'getFields',_0x41bad1,JSON[_0x5faf('0x6e')](_0x366233));delete _0x366233[_0x5faf('0x26')];if(_0x41bad1===0x191){_0x41bad1=0x190;}_0x589911['status'](_0x41bad1)[_0x5faf('0x27')](_0x3da539[_0x5faf('0x30')]['test']?{'message':_0x5faf('0x6f'),'statusCode':_0x366233['statusCode']}:_0x366233);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index dbf700a..9e67828 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 _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 +var _0xc6d7=['../../components/integrations/configuration','exports','define','int_vtiger_accounts','../../config/logger','api','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x2f46e6,_0x14c14c){var _0x17d267=function(_0x2c0c99){while(--_0x2c0c99){_0x2f46e6['push'](_0x2f46e6['shift']());}};_0x17d267(++_0x14c14c);}(_0xc6d7,0x16f));var _0x7c6d=function(_0x1e3391,_0x2098c4){_0x1e3391=_0x1e3391-0x0;var _0xed3acb=_0xc6d7[_0x1e3391];return _0xed3acb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7c6d('0x0'))(_0x7c6d('0x1'));var moment=require(_0x7c6d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c6d('0x3'));var rimraf=require(_0x7c6d('0x4'));var config=require(_0x7c6d('0x5'));var attributes=require(_0x7c6d('0x6'));var integrations=require(_0x7c6d('0x7'));module[_0x7c6d('0x8')]=function(_0x384851,_0x23fb6c){return _0x384851[_0x7c6d('0x9')]('VtigerAccount',attributes,{'tableName':_0x7c6d('0xa'),'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 7255b54..54d9aeb 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 _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 +var _0xefda=['options','raw','attributes','include','map','model','ShowVtigerAccount','VtigerAccount','find','where','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','info','result','catch','GetVtigerAccount','findAll'];(function(_0x4b7582,_0x3fb424){var _0x33b14b=function(_0x33108b){while(--_0x33108b){_0x4b7582['push'](_0x4b7582['shift']());}};_0x33b14b(++_0x3fb424);}(_0xefda,0x96));var _0xaefd=function(_0xd25e89,_0x75ff39){_0xd25e89=_0xd25e89-0x0;var _0x303c0b=_0xefda[_0xd25e89];return _0x303c0b;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9736,_0x24d10c,_0x1d76f3){return new BPromise(function(_0x4ce248,_0x15193c){return client[_0xaefd('0xa')](_0x3b9736,_0x1d76f3)[_0xaefd('0xb')](function(_0x4d44ed){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x24d10c,_0xaefd('0xc'));logger[_0xaefd('0xd')](_0xaefd('0xe'),_0x24d10c,_0xaefd('0xc'),JSON[_0xaefd('0xf')](_0x4d44ed));if(_0x4d44ed[_0xaefd('0x10')]){if(_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x11')]===0x1f4){logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')]['message']);return _0x15193c(_0x4d44ed[_0xaefd('0x10')]['message']);}logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x13')]);return _0x4ce248(_0x4d44ed['error'][_0xaefd('0x13')]);}else{logger[_0xaefd('0x14')](_0xaefd('0x12'),_0x24d10c,_0xaefd('0xc'));_0x4ce248(_0x4d44ed[_0xaefd('0x15')][_0xaefd('0x13')]);}})[_0xaefd('0x16')](function(_0x23d736){logger['error'](_0xaefd('0x12'),_0x24d10c,_0x23d736);_0x15193c(_0x23d736);});});}exports[_0xaefd('0x17')]=function(_0x9748f4){var _0x1737a1=this;return new Promise(function(_0x2db61b,_0x244956){return db['VtigerAccount'][_0xaefd('0x18')]({'raw':_0x9748f4[_0xaefd('0x19')]?_0x9748f4[_0xaefd('0x19')][_0xaefd('0x1a')]===undefined?!![]:![]:!![],'where':_0x9748f4[_0xaefd('0x19')]?_0x9748f4[_0xaefd('0x19')]['where']||null:null,'attributes':_0x9748f4[_0xaefd('0x19')]?_0x9748f4[_0xaefd('0x19')][_0xaefd('0x1b')]||null:null,'limit':_0x9748f4[_0xaefd('0x19')]?_0x9748f4[_0xaefd('0x19')]['limit']||null:null,'include':_0x9748f4['options']?_0x9748f4['options'][_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x9748f4[_0xaefd('0x19')]['include'],function(_0x23060f){return{'model':db[_0x23060f['model']],'as':_0x23060f['as'],'attributes':_0x23060f[_0xaefd('0x1b')],'include':_0x23060f[_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x23060f['include'],function(_0x435413){return{'model':db[_0x435413[_0xaefd('0x1e')]],'as':_0x435413['as'],'attributes':_0x435413[_0xaefd('0x1b')],'include':_0x435413[_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x435413['include'],function(_0x2fe27e){return{'model':db[_0x2fe27e['model']],'as':_0x2fe27e['as'],'attributes':_0x2fe27e[_0xaefd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaefd('0xb')](function(_0x5470bd){logger[_0xaefd('0x14')](_0xaefd('0x17'),_0x9748f4);logger['debug'](_0xaefd('0x17'),_0x9748f4,JSON[_0xaefd('0xf')](_0x5470bd));_0x2db61b(_0x5470bd);})[_0xaefd('0x16')](function(_0x4c0898){logger[_0xaefd('0x10')]('GetVtigerAccount',_0x4c0898[_0xaefd('0x13')],_0x9748f4);_0x244956(_0x1737a1['error'](0x1f4,_0x4c0898['message']));});});};exports[_0xaefd('0x1f')]=function(_0x1b470c){var _0x4a032d=this;return new Promise(function(_0x578378,_0x4ee0c1){return db[_0xaefd('0x20')][_0xaefd('0x21')]({'raw':_0x1b470c['options']?_0x1b470c['options'][_0xaefd('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b470c[_0xaefd('0x19')]?_0x1b470c[_0xaefd('0x19')][_0xaefd('0x22')]||null:null,'attributes':_0x1b470c['options']?_0x1b470c[_0xaefd('0x19')][_0xaefd('0x1b')]||null:null,'include':_0x1b470c[_0xaefd('0x19')]?_0x1b470c[_0xaefd('0x19')][_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x1b470c[_0xaefd('0x19')][_0xaefd('0x1c')],function(_0x3e3fe2){return{'model':db[_0x3e3fe2[_0xaefd('0x1e')]],'as':_0x3e3fe2['as'],'attributes':_0x3e3fe2[_0xaefd('0x1b')],'include':_0x3e3fe2[_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x3e3fe2[_0xaefd('0x1c')],function(_0x1ffec4){return{'model':db[_0x1ffec4[_0xaefd('0x1e')]],'as':_0x1ffec4['as'],'attributes':_0x1ffec4['attributes'],'include':_0x1ffec4[_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x1ffec4[_0xaefd('0x1c')],function(_0x59aec9){return{'model':db[_0x59aec9[_0xaefd('0x1e')]],'as':_0x59aec9['as'],'attributes':_0x59aec9['attributes']};}):[]};}):[]};}):[]:[]})[_0xaefd('0xb')](function(_0x3498d9){logger[_0xaefd('0x14')](_0xaefd('0x1f'),_0x1b470c);logger[_0xaefd('0xd')](_0xaefd('0x1f'),_0x1b470c,JSON[_0xaefd('0xf')](_0x3498d9));_0x578378(_0x3498d9);})[_0xaefd('0x16')](function(_0x407bea){logger[_0xaefd('0x10')](_0xaefd('0x1f'),_0x407bea[_0xaefd('0x13')],_0x1b470c);_0x4ee0c1(_0x4a032d[_0xaefd('0x10')](0x1f4,_0x407bea[_0xaefd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index d7c956c..107f08f 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 _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 +var _0x4b89=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','get','/:id','/:id/fields'];(function(_0x26a818,_0x40708a){var _0x5d8ca0=function(_0x3cc7ed){while(--_0x3cc7ed){_0x26a818['push'](_0x26a818['shift']());}};_0x5d8ca0(++_0x40708a);}(_0x4b89,0x1c1));var _0x94b8=function(_0x5bcb0f,_0x221e89){_0x5bcb0f=_0x5bcb0f-0x0;var _0x57eec2=_0x4b89[_0x5bcb0f];return _0x57eec2;};'use strict';var multer=require(_0x94b8('0x0'));var util=require(_0x94b8('0x1'));var path=require(_0x94b8('0x2'));var timeout=require(_0x94b8('0x3'));var express=require('express');var router=express[_0x94b8('0x4')]();var fs_extra=require(_0x94b8('0x5'));var auth=require(_0x94b8('0x6'));var interaction=require(_0x94b8('0x7'));var config=require('../../config/environment');var controller=require(_0x94b8('0x8'));router['get']('/',auth[_0x94b8('0x9')](),controller['index']);router[_0x94b8('0xa')](_0x94b8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x94b8('0xa')](_0x94b8('0xc'),auth['isAuthenticated'](),controller[_0x94b8('0xd')]);router[_0x94b8('0xa')](_0x94b8('0xe'),auth[_0x94b8('0x9')](),controller[_0x94b8('0xf')]);router[_0x94b8('0xa')](_0x94b8('0x10'),auth[_0x94b8('0x9')](),controller[_0x94b8('0x11')]);router[_0x94b8('0x12')]('/',auth[_0x94b8('0x9')](),controller['create']);router['put'](_0x94b8('0xb'),auth['isAuthenticated'](),controller[_0x94b8('0x13')]);router['delete'](_0x94b8('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x94b8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 320f2e5..00521ce 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 _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 +var _0x55f3=['sequelize','exports','STRING'];(function(_0x2abcdd,_0x341092){var _0x126541=function(_0x363083){while(--_0x363083){_0x2abcdd['push'](_0x2abcdd['shift']());}};_0x126541(++_0x341092);}(_0x55f3,0x1bc));var _0x355f=function(_0x43c25a,_0x2b159a){_0x43c25a=_0x43c25a-0x0;var _0x11285f=_0x55f3[_0x43c25a];return _0x11285f;};'use strict';var Sequelize=require(_0x355f('0x0'));module[_0x355f('0x1')]={'name':{'type':Sequelize[_0x355f('0x2')]},'description':{'type':Sequelize[_0x355f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6699f27..3568798 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 _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 +var _0x493d=['undefined','count','Content-Range','save','update','then','destroy','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','getFields','findOne','VtigerField','order','pick','merge','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit'];(function(_0x4a15df,_0x50b596){var _0x54ceff=function(_0x13078d){while(--_0x13078d){_0x4a15df['push'](_0x4a15df['shift']());}};_0x54ceff(++_0x50b596);}(_0x493d,0xcd));var _0xd493=function(_0x4f94ee,_0x26e8fd){_0x4f94ee=_0x4f94ee-0x0;var _0x1bb8ec=_0x493d[_0x4f94ee];return _0x1bb8ec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd493('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd493('0x1'));var rp=require(_0xd493('0x2'));var moment=require(_0xd493('0x3'));var BPromise=require(_0xd493('0x4'));var Mustache=require(_0xd493('0x5'));var util=require(_0xd493('0x6'));var path=require(_0xd493('0x7'));var sox=require(_0xd493('0x8'));var csv=require(_0xd493('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd493('0xa'));var _=require(_0xd493('0xb'));var squel=require(_0xd493('0xc'));var crypto=require(_0xd493('0xd'));var jsforce=require(_0xd493('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd493('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd493('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd493('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd493('0x11'));var logger=require('../../config/logger')(_0xd493('0x12'));var utils=require(_0xd493('0x13'));var config=require(_0xd493('0x14'));var licenseUtil=require(_0xd493('0x15'));var db=require(_0xd493('0x16'))['db'];function respondWithStatusCode(_0x4e5ce9,_0x1c770c){_0x1c770c=_0x1c770c||0xcc;return function(_0xf13379){if(_0xf13379){return _0x4e5ce9[_0xd493('0x17')](_0x1c770c);}return _0x4e5ce9['status'](_0x1c770c)[_0xd493('0x18')]();};}function respondWithResult(_0x4f7e8c,_0x4c3d76){_0x4c3d76=_0x4c3d76||0xc8;return function(_0x104d50){if(_0x104d50){return _0x4f7e8c[_0xd493('0x19')](_0x4c3d76)[_0xd493('0x1a')](_0x104d50);}};}function respondWithFilteredResult(_0x560dd7,_0x27153c){return function(_0x158e12){if(_0x158e12){var _0x515c62=typeof _0x27153c[_0xd493('0x1b')]==='undefined'&&typeof _0x27153c[_0xd493('0x1c')]===_0xd493('0x1d');var _0xebdb5b=_0x158e12[_0xd493('0x1e')];var _0x4b7596=_0x515c62?0x0:_0x27153c[_0xd493('0x1b')];var _0x12e9b9=_0x515c62?_0x158e12[_0xd493('0x1e')]:_0x27153c['offset']+_0x27153c['limit'];var _0x345479;if(_0x12e9b9>=_0xebdb5b){_0x12e9b9=_0xebdb5b;_0x345479=0xc8;}else{_0x345479=0xce;}_0x560dd7[_0xd493('0x19')](_0x345479);return _0x560dd7['set'](_0xd493('0x1f'),_0x4b7596+'-'+_0x12e9b9+'/'+_0xebdb5b)['json'](_0x158e12);}return null;};}function patchUpdates(_0x52ef9e){return function(_0x3a6873){try{jsonpatch['apply'](_0x3a6873,_0x52ef9e,!![]);}catch(_0x124770){return BPromise['reject'](_0x124770);}return _0x3a6873[_0xd493('0x20')]();};}function saveUpdates(_0x13b28a,_0x5b65da){return function(_0x3fe48b){if(_0x3fe48b){return _0x3fe48b[_0xd493('0x21')](_0x13b28a)[_0xd493('0x22')](function(_0x587f42){return _0x587f42;});}return null;};}function removeEntity(_0x59ad7a,_0x4e698d){return function(_0x351159){if(_0x351159){return _0x351159[_0xd493('0x23')]()[_0xd493('0x22')](function(){_0x59ad7a[_0xd493('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f986,_0x16bb3d){return function(_0x5b6320){if(!_0x5b6320){_0x21f986[_0xd493('0x17')](0x194);}return _0x5b6320;};}function handleError(_0x1d23d2,_0xffcf23){_0xffcf23=_0xffcf23||0x1f4;return function(_0x38f75c){logger[_0xd493('0x24')](_0x38f75c['stack']);if(_0x38f75c[_0xd493('0x25')]){delete _0x38f75c[_0xd493('0x25')];}_0x1d23d2[_0xd493('0x19')](_0xffcf23)[_0xd493('0x26')](_0x38f75c);};}exports[_0xd493('0x27')]=function(_0x136db1,_0x594132){var _0x32cab8={},_0x5a6a28={},_0x14a0de={'count':0x0,'rows':[]};var _0x4eb4da=_[_0xd493('0x28')](db[_0xd493('0x29')][_0xd493('0x2a')],function(_0x717289){return{'name':_0x717289[_0xd493('0x2b')],'type':_0x717289[_0xd493('0x2c')][_0xd493('0x2d')]};});_0x5a6a28[_0xd493('0x2e')]=_['map'](_0x4eb4da,_0xd493('0x25'));_0x5a6a28['query']=_[_0xd493('0x2f')](_0x136db1['query']);_0x5a6a28[_0xd493('0x30')]=_[_0xd493('0x31')](_0x5a6a28[_0xd493('0x2e')],_0x5a6a28[_0xd493('0x32')]);_0x32cab8['attributes']=_[_0xd493('0x31')](_0x5a6a28[_0xd493('0x2e')],qs[_0xd493('0x33')](_0x136db1[_0xd493('0x32')][_0xd493('0x33')]));_0x32cab8[_0xd493('0x34')]=_0x32cab8['attributes'][_0xd493('0x35')]?_0x32cab8[_0xd493('0x34')]:_0x5a6a28['model'];if(!_0x136db1[_0xd493('0x32')][_0xd493('0x36')](_0xd493('0x37'))){_0x32cab8[_0xd493('0x1c')]=qs[_0xd493('0x1c')](_0x136db1['query']['limit']);_0x32cab8[_0xd493('0x1b')]=qs[_0xd493('0x1b')](_0x136db1[_0xd493('0x32')][_0xd493('0x1b')]);}_0x32cab8['order']=qs[_0xd493('0x38')](_0x136db1[_0xd493('0x32')][_0xd493('0x38')]);_0x32cab8[_0xd493('0x39')]=qs[_0xd493('0x30')](_['pick'](_0x136db1[_0xd493('0x32')],_0x5a6a28['filters']),_0x4eb4da);if(_0x136db1[_0xd493('0x32')][_0xd493('0x3a')]){_0x32cab8[_0xd493('0x39')]=_['merge'](_0x32cab8['where'],{'$or':_[_0xd493('0x28')](_0x4eb4da,function(_0x335b96){if(_0x335b96[_0xd493('0x2c')]!==_0xd493('0x3b')){var _0x21d005={};_0x21d005[_0x335b96['name']]={'$like':'%'+_0x136db1['query'][_0xd493('0x3a')]+'%'};return _0x21d005;}})});}_0x32cab8=_['merge']({},_0x32cab8,_0x136db1[_0xd493('0x3c')]);var _0x431195={'where':_0x32cab8[_0xd493('0x39')]};return db[_0xd493('0x29')][_0xd493('0x1e')](_0x431195)['then'](function(_0x9de689){_0x14a0de[_0xd493('0x1e')]=_0x9de689;if(_0x136db1[_0xd493('0x32')][_0xd493('0x3d')]){_0x32cab8[_0xd493('0x3e')]=[{'all':!![]}];}return db[_0xd493('0x29')][_0xd493('0x3f')](_0x32cab8);})[_0xd493('0x22')](function(_0xfbcd85){_0x14a0de['rows']=_0xfbcd85;return _0x14a0de;})[_0xd493('0x22')](respondWithFilteredResult(_0x594132,_0x32cab8))['catch'](handleError(_0x594132,null));};exports[_0xd493('0x40')]=function(_0x124520,_0x484afa){var _0x36bdad={'raw':![],'where':{'id':_0x124520[_0xd493('0x41')]['id']}},_0x4cc172={};_0x4cc172[_0xd493('0x2e')]=_[_0xd493('0x2f')](db[_0xd493('0x29')]['rawAttributes']);_0x4cc172['query']=_[_0xd493('0x2f')](_0x124520[_0xd493('0x32')]);_0x4cc172[_0xd493('0x30')]=_[_0xd493('0x31')](_0x4cc172[_0xd493('0x2e')],_0x4cc172[_0xd493('0x32')]);_0x36bdad[_0xd493('0x34')]=_['intersection'](_0x4cc172[_0xd493('0x2e')],qs[_0xd493('0x33')](_0x124520[_0xd493('0x32')][_0xd493('0x33')]));_0x36bdad[_0xd493('0x34')]=_0x36bdad[_0xd493('0x34')][_0xd493('0x35')]?_0x36bdad['attributes']:_0x4cc172[_0xd493('0x2e')];if(_0x124520[_0xd493('0x32')][_0xd493('0x3d')]){_0x36bdad[_0xd493('0x3e')]=[{'all':!![]}];}_0x36bdad=_['merge']({},_0x36bdad,_0x124520[_0xd493('0x3c')]);return db['VtigerConfiguration'][_0xd493('0x42')](_0x36bdad)[_0xd493('0x22')](handleEntityNotFound(_0x484afa,null))['then'](respondWithResult(_0x484afa,null))[_0xd493('0x43')](handleError(_0x484afa,null));};exports[_0xd493('0x44')]=function(_0x4d42fc,_0x129b0b){return db[_0xd493('0x29')][_0xd493('0x44')](_0x4d42fc[_0xd493('0x45')],{})[_0xd493('0x22')](respondWithResult(_0x129b0b,0xc9))[_0xd493('0x43')](handleError(_0x129b0b,null));};exports[_0xd493('0x21')]=function(_0x57ed53,_0x547012){if(_0x57ed53[_0xd493('0x45')]['id']){delete _0x57ed53[_0xd493('0x45')]['id'];}return db[_0xd493('0x29')]['find']({'where':{'id':_0x57ed53[_0xd493('0x41')]['id']}})[_0xd493('0x22')](handleEntityNotFound(_0x547012,null))[_0xd493('0x22')](saveUpdates(_0x57ed53[_0xd493('0x45')],null))['then'](respondWithResult(_0x547012,null))[_0xd493('0x43')](handleError(_0x547012,null));};exports[_0xd493('0x23')]=function(_0x4a6284,_0xd12ef7){return db[_0xd493('0x29')][_0xd493('0x42')]({'where':{'id':_0x4a6284[_0xd493('0x41')]['id']}})[_0xd493('0x22')](handleEntityNotFound(_0xd12ef7,null))[_0xd493('0x22')](removeEntity(_0xd12ef7,null))['catch'](handleError(_0xd12ef7,null));};exports[_0xd493('0x46')]=function(_0x35b09b,_0x13bc0b,_0x3f6b75){var _0x2a53e3={};var _0x1f2159={};var _0x37f8e4;var _0x451b9a;return db[_0xd493('0x29')][_0xd493('0x47')]({'where':{'id':_0x35b09b[_0xd493('0x41')]['id']}})[_0xd493('0x22')](handleEntityNotFound(_0x13bc0b,null))[_0xd493('0x22')](function(_0x37b455){if(_0x37b455){_0x37f8e4=_0x37b455;_0x1f2159['model']=_[_0xd493('0x2f')](db[_0xd493('0x48')][_0xd493('0x2a')]);_0x1f2159[_0xd493('0x32')]=_[_0xd493('0x2f')](_0x35b09b[_0xd493('0x32')]);_0x1f2159[_0xd493('0x30')]=_[_0xd493('0x31')](_0x1f2159[_0xd493('0x2e')],_0x1f2159[_0xd493('0x32')]);_0x2a53e3[_0xd493('0x34')]=_[_0xd493('0x31')](_0x1f2159[_0xd493('0x2e')],qs[_0xd493('0x33')](_0x35b09b[_0xd493('0x32')][_0xd493('0x33')]));_0x2a53e3['attributes']=_0x2a53e3[_0xd493('0x34')][_0xd493('0x35')]?_0x2a53e3[_0xd493('0x34')]:_0x1f2159[_0xd493('0x2e')];_0x2a53e3[_0xd493('0x49')]=qs['sort'](_0x35b09b[_0xd493('0x32')][_0xd493('0x38')]);_0x2a53e3[_0xd493('0x39')]=qs[_0xd493('0x30')](_[_0xd493('0x4a')](_0x35b09b['query'],_0x1f2159['filters']));if(_0x35b09b[_0xd493('0x32')]['filter']){_0x2a53e3[_0xd493('0x39')]=_[_0xd493('0x4b')](_0x2a53e3[_0xd493('0x39')],{'$or':_[_0xd493('0x28')](_0x2a53e3[_0xd493('0x34')],function(_0x248f5a){var _0x3555ed={};_0x3555ed[_0x248f5a]={'$like':'%'+_0x35b09b['query'][_0xd493('0x3a')]+'%'};return _0x3555ed;})});}_0x2a53e3=_['merge']({},_0x2a53e3,_0x35b09b[_0xd493('0x3c')]);return _0x37f8e4[_0xd493('0x46')](_0x2a53e3);}})[_0xd493('0x22')](function(_0x4aecb6){if(_0x4aecb6){_0x451b9a=_0x4aecb6[_0xd493('0x35')];if(!_0x35b09b[_0xd493('0x32')][_0xd493('0x36')](_0xd493('0x37'))){_0x2a53e3[_0xd493('0x1c')]=qs[_0xd493('0x1c')](_0x35b09b[_0xd493('0x32')][_0xd493('0x1c')]);_0x2a53e3[_0xd493('0x1b')]=qs['offset'](_0x35b09b[_0xd493('0x32')][_0xd493('0x1b')]);}return _0x37f8e4['getFields'](_0x2a53e3);}})[_0xd493('0x22')](function(_0x5c1139){if(_0x5c1139){return _0x5c1139?{'count':_0x451b9a,'rows':_0x5c1139}:null;}})[_0xd493('0x22')](respondWithResult(_0x13bc0b,null))[_0xd493('0x43')](handleError(_0x13bc0b,null));};exports[_0xd493('0x4c')]=function(_0x39fa93,_0xc6a48b,_0x44437a){var _0xadacad={};var _0x654549={};var _0x36d17d;var _0x263717;return db['VtigerConfiguration'][_0xd493('0x47')]({'where':{'id':_0x39fa93[_0xd493('0x41')]['id']}})['then'](handleEntityNotFound(_0xc6a48b,null))[_0xd493('0x22')](function(_0x2cadfb){if(_0x2cadfb){_0x36d17d=_0x2cadfb;_0x654549['model']=_[_0xd493('0x2f')](db[_0xd493('0x48')][_0xd493('0x2a')]);_0x654549[_0xd493('0x32')]=_['keys'](_0x39fa93[_0xd493('0x32')]);_0x654549[_0xd493('0x30')]=_[_0xd493('0x31')](_0x654549['model'],_0x654549['query']);_0xadacad[_0xd493('0x34')]=_[_0xd493('0x31')](_0x654549[_0xd493('0x2e')],qs[_0xd493('0x33')](_0x39fa93[_0xd493('0x32')][_0xd493('0x33')]));_0xadacad[_0xd493('0x34')]=_0xadacad[_0xd493('0x34')][_0xd493('0x35')]?_0xadacad[_0xd493('0x34')]:_0x654549[_0xd493('0x2e')];_0xadacad['order']=qs[_0xd493('0x38')](_0x39fa93['query'][_0xd493('0x38')]);_0xadacad[_0xd493('0x39')]=qs[_0xd493('0x30')](_[_0xd493('0x4a')](_0x39fa93[_0xd493('0x32')],_0x654549[_0xd493('0x30')]));if(_0x39fa93[_0xd493('0x32')][_0xd493('0x3a')]){_0xadacad[_0xd493('0x39')]=_['merge'](_0xadacad['where'],{'$or':_[_0xd493('0x28')](_0xadacad[_0xd493('0x34')],function(_0x136543){var _0x5ee4a6={};_0x5ee4a6[_0x136543]={'$like':'%'+_0x39fa93['query']['filter']+'%'};return _0x5ee4a6;})});}_0xadacad=_[_0xd493('0x4b')]({},_0xadacad,_0x39fa93[_0xd493('0x3c')]);return _0x36d17d[_0xd493('0x4c')](_0xadacad);}})[_0xd493('0x22')](function(_0x5679b6){if(_0x5679b6){_0x263717=_0x5679b6[_0xd493('0x35')];if(!_0x39fa93['query'][_0xd493('0x36')](_0xd493('0x37'))){_0xadacad[_0xd493('0x1c')]=qs[_0xd493('0x1c')](_0x39fa93[_0xd493('0x32')][_0xd493('0x1c')]);_0xadacad['offset']=qs[_0xd493('0x1b')](_0x39fa93[_0xd493('0x32')][_0xd493('0x1b')]);}return _0x36d17d[_0xd493('0x4c')](_0xadacad);}})[_0xd493('0x22')](function(_0x59ded6){if(_0x59ded6){return _0x59ded6?{'count':_0x263717,'rows':_0x59ded6}:null;}})[_0xd493('0x22')](respondWithResult(_0xc6a48b,null))[_0xd493('0x43')](handleError(_0xc6a48b,null));};exports[_0xd493('0x4d')]=function(_0x527db4,_0xd2274c,_0x233c61){var _0x16cfcc={};var _0x36892f={};var _0x1e8bd3;var _0x3c72a1;return db[_0xd493('0x29')][_0xd493('0x47')]({'where':{'id':_0x527db4['params']['id']}})[_0xd493('0x22')](handleEntityNotFound(_0xd2274c,null))[_0xd493('0x22')](function(_0x3a45fc){if(_0x3a45fc){_0x1e8bd3=_0x3a45fc;_0x36892f[_0xd493('0x2e')]=_[_0xd493('0x2f')](db['VtigerField'][_0xd493('0x2a')]);_0x36892f['query']=_[_0xd493('0x2f')](_0x527db4[_0xd493('0x32')]);_0x36892f[_0xd493('0x30')]=_[_0xd493('0x31')](_0x36892f[_0xd493('0x2e')],_0x36892f['query']);_0x16cfcc[_0xd493('0x34')]=_[_0xd493('0x31')](_0x36892f[_0xd493('0x2e')],qs[_0xd493('0x33')](_0x527db4[_0xd493('0x32')][_0xd493('0x33')]));_0x16cfcc[_0xd493('0x34')]=_0x16cfcc[_0xd493('0x34')][_0xd493('0x35')]?_0x16cfcc[_0xd493('0x34')]:_0x36892f['model'];_0x16cfcc['order']=qs['sort'](_0x527db4[_0xd493('0x32')][_0xd493('0x38')]);_0x16cfcc[_0xd493('0x39')]=qs[_0xd493('0x30')](_[_0xd493('0x4a')](_0x527db4[_0xd493('0x32')],_0x36892f[_0xd493('0x30')]));if(_0x527db4[_0xd493('0x32')][_0xd493('0x3a')]){_0x16cfcc[_0xd493('0x39')]=_[_0xd493('0x4b')](_0x16cfcc[_0xd493('0x39')],{'$or':_[_0xd493('0x28')](_0x16cfcc['attributes'],function(_0xd7f770){var _0xc0296e={};_0xc0296e[_0xd7f770]={'$like':'%'+_0x527db4[_0xd493('0x32')][_0xd493('0x3a')]+'%'};return _0xc0296e;})});}_0x16cfcc=_[_0xd493('0x4b')]({},_0x16cfcc,_0x527db4[_0xd493('0x3c')]);return _0x1e8bd3['getDescriptions'](_0x16cfcc);}})['then'](function(_0x75c213){if(_0x75c213){_0x3c72a1=_0x75c213['length'];if(!_0x527db4['query']['hasOwnProperty'](_0xd493('0x37'))){_0x16cfcc['limit']=qs['limit'](_0x527db4[_0xd493('0x32')][_0xd493('0x1c')]);_0x16cfcc['offset']=qs[_0xd493('0x1b')](_0x527db4[_0xd493('0x32')][_0xd493('0x1b')]);}return _0x1e8bd3[_0xd493('0x4d')](_0x16cfcc);}})[_0xd493('0x22')](function(_0xb40834){if(_0xb40834){return _0xb40834?{'count':_0x3c72a1,'rows':_0xb40834}:null;}})['then'](respondWithResult(_0xd2274c,null))[_0xd493('0x43')](handleError(_0xd2274c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 41867fc..11accc5 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 _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 +var _0x3c16=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','VtigerConfiguration'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x3c16,0x1dd));var _0x63c1=function(_0x590489,_0x4db824){_0x590489=_0x590489-0x0;var _0xb401c5=_0x3c16[_0x590489];return _0xb401c5;};'use strict';var _=require(_0x63c1('0x0'));var util=require(_0x63c1('0x1'));var logger=require(_0x63c1('0x2'))('api');var moment=require(_0x63c1('0x3'));var BPromise=require(_0x63c1('0x4'));var rp=require(_0x63c1('0x5'));var fs=require('fs');var path=require(_0x63c1('0x6'));var rimraf=require(_0x63c1('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x22cd2c,_0x13e8fc){return _0x22cd2c['define'](_0x63c1('0x8'),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 452e775..97182a7 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 _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 +var _0xf24b=['stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xdad376,_0x54454a){var _0x3b739a=function(_0x173387){while(--_0x173387){_0xdad376['push'](_0xdad376['shift']());}};_0x3b739a(++_0x54454a);}(_0xf24b,0xd5));var _0xbf24=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0xf24b[_0x11dc39];return _0x457277;};'use strict';var _=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var moment=require(_0xbf24('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf24('0x3'));var fs=require('fs');var Redis=require(_0xbf24('0x4'));var db=require(_0xbf24('0x5'))['db'];var utils=require(_0xbf24('0x6'));var logger=require(_0xbf24('0x7'))('rpc');var config=require(_0xbf24('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbf24('0x9')][_0xbf24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x470a8e,_0x649d46,_0x555754){return new BPromise(function(_0x2b63a3,_0x46c859){return client[_0xbf24('0xb')](_0x470a8e,_0x555754)[_0xbf24('0xc')](function(_0x1d6f16){logger[_0xbf24('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x649d46,_0xbf24('0xe'));logger[_0xbf24('0xf')](_0xbf24('0x10'),_0x649d46,_0xbf24('0xe'),JSON[_0xbf24('0x11')](_0x1d6f16));if(_0x1d6f16[_0xbf24('0x12')]){if(_0x1d6f16[_0xbf24('0x12')][_0xbf24('0x13')]===0x1f4){logger['error'](_0xbf24('0x14'),_0x649d46,_0x1d6f16[_0xbf24('0x12')][_0xbf24('0x15')]);return _0x46c859(_0x1d6f16['error'][_0xbf24('0x15')]);}logger[_0xbf24('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x649d46,_0x1d6f16[_0xbf24('0x12')]['message']);return _0x2b63a3(_0x1d6f16[_0xbf24('0x12')][_0xbf24('0x15')]);}else{logger[_0xbf24('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x649d46,'request\x20sent');_0x2b63a3(_0x1d6f16['result'][_0xbf24('0x15')]);}})[_0xbf24('0x16')](function(_0x2e9e0e){logger[_0xbf24('0x12')](_0xbf24('0x14'),_0x649d46,_0x2e9e0e);_0x46c859(_0x2e9e0e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index d3ebdf1..b9bbc3a 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 _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 +var _0x2569=['index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x43b929,_0x1ce9d0){var _0x2c3c43=function(_0x43ed7e){while(--_0x43ed7e){_0x43b929['push'](_0x43b929['shift']());}};_0x2c3c43(++_0x1ce9d0);}(_0x2569,0x97));var _0x9256=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x2569[_0x3ad7ad];return _0x225a60;};'use strict';var multer=require(_0x9256('0x0'));var util=require(_0x9256('0x1'));var path=require(_0x9256('0x2'));var timeout=require(_0x9256('0x3'));var express=require(_0x9256('0x4'));var router=express[_0x9256('0x5')]();var fs_extra=require(_0x9256('0x6'));var auth=require(_0x9256('0x7'));var interaction=require(_0x9256('0x8'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x9256('0x9')]('/',auth[_0x9256('0xa')](),controller[_0x9256('0xb')]);router['get'](_0x9256('0xc'),auth[_0x9256('0xa')](),controller[_0x9256('0xd')]);router['post']('/',auth[_0x9256('0xa')](),controller['create']);router[_0x9256('0xe')](_0x9256('0xc'),auth[_0x9256('0xa')](),controller['update']);router[_0x9256('0xf')](_0x9256('0xc'),auth[_0x9256('0xa')](),controller[_0x9256('0x10')]);module[_0x9256('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c91fa74..dff5bf7 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 _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 +var _0x4220=['ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN'];(function(_0x6c0b00,_0x29d361){var _0x4a97c0=function(_0x56063e){while(--_0x56063e){_0x6c0b00['push'](_0x6c0b00['shift']());}};_0x4a97c0(++_0x29d361);}(_0x4220,0x1f1));var _0x0422=function(_0x183830,_0x351931){_0x183830=_0x183830-0x0;var _0x219e32=_0x4220[_0x183830];return _0x219e32;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0422('0x0')](_0x0422('0x1'),'variable',_0x0422('0x2'),'keyValue',_0x0422('0x3')),'defaultValue':_0x0422('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0422('0x4')]},'keyType':{'type':Sequelize[_0x0422('0x0')]('string',_0x0422('0x5'),_0x0422('0x2'))},'keyContent':{'type':Sequelize[_0x0422('0x4')]},'idField':{'type':Sequelize[_0x0422('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0422('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0422('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9e88a31..3186144 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 _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 +var _0x5a9a=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','VtigerField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5a9a,0x7a));var _0xa5a9=function(_0x2faa8d,_0x22846c){_0x2faa8d=_0x2faa8d-0x0;var _0x3244dd=_0x5a9a[_0x2faa8d];return _0x3244dd;};'use strict';var emlformat=require(_0xa5a9('0x0'));var rimraf=require(_0xa5a9('0x1'));var zipdir=require(_0xa5a9('0x2'));var jsonpatch=require(_0xa5a9('0x3'));var rp=require(_0xa5a9('0x4'));var moment=require(_0xa5a9('0x5'));var BPromise=require(_0xa5a9('0x6'));var Mustache=require(_0xa5a9('0x7'));var util=require('util');var path=require(_0xa5a9('0x8'));var sox=require(_0xa5a9('0x9'));var csv=require(_0xa5a9('0xa'));var ejs=require(_0xa5a9('0xb'));var fs=require('fs');var fs_extra=require(_0xa5a9('0xc'));var _=require('lodash');var squel=require(_0xa5a9('0xd'));var crypto=require(_0xa5a9('0xe'));var jsforce=require(_0xa5a9('0xf'));var deskjs=require(_0xa5a9('0x10'));var toCsv=require(_0xa5a9('0xa'));var querystring=require(_0xa5a9('0x11'));var Papa=require(_0xa5a9('0x12'));var Redis=require(_0xa5a9('0x13'));var authService=require(_0xa5a9('0x14'));var qs=require(_0xa5a9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5a9('0x16'))(_0xa5a9('0x17'));var utils=require('../../config/utils');var config=require(_0xa5a9('0x18'));var licenseUtil=require(_0xa5a9('0x19'));var db=require(_0xa5a9('0x1a'))['db'];function respondWithStatusCode(_0x1d5812,_0x4fb40c){_0x4fb40c=_0x4fb40c||0xcc;return function(_0x3fe994){if(_0x3fe994){return _0x1d5812[_0xa5a9('0x1b')](_0x4fb40c);}return _0x1d5812[_0xa5a9('0x1c')](_0x4fb40c)[_0xa5a9('0x1d')]();};}function respondWithResult(_0x1753dc,_0x28531d){_0x28531d=_0x28531d||0xc8;return function(_0x32e18e){if(_0x32e18e){return _0x1753dc[_0xa5a9('0x1c')](_0x28531d)[_0xa5a9('0x1e')](_0x32e18e);}};}function respondWithFilteredResult(_0x2db095,_0x2096ea){return function(_0x2d0783){if(_0x2d0783){var _0x420b22=typeof _0x2096ea['offset']===_0xa5a9('0x1f')&&typeof _0x2096ea[_0xa5a9('0x20')]===_0xa5a9('0x1f');var _0x42c985=_0x2d0783[_0xa5a9('0x21')];var _0xdb3155=_0x420b22?0x0:_0x2096ea[_0xa5a9('0x22')];var _0x104d1c=_0x420b22?_0x2d0783[_0xa5a9('0x21')]:_0x2096ea[_0xa5a9('0x22')]+_0x2096ea[_0xa5a9('0x20')];var _0x115933;if(_0x104d1c>=_0x42c985){_0x104d1c=_0x42c985;_0x115933=0xc8;}else{_0x115933=0xce;}_0x2db095[_0xa5a9('0x1c')](_0x115933);return _0x2db095['set'](_0xa5a9('0x23'),_0xdb3155+'-'+_0x104d1c+'/'+_0x42c985)[_0xa5a9('0x1e')](_0x2d0783);}return null;};}function patchUpdates(_0x402cfb){return function(_0x274a00){try{jsonpatch[_0xa5a9('0x24')](_0x274a00,_0x402cfb,!![]);}catch(_0x2e4a83){return BPromise[_0xa5a9('0x25')](_0x2e4a83);}return _0x274a00[_0xa5a9('0x26')]();};}function saveUpdates(_0xa3da8d,_0x475a68){return function(_0x4ede31){if(_0x4ede31){return _0x4ede31[_0xa5a9('0x27')](_0xa3da8d)['then'](function(_0x4630d2){return _0x4630d2;});}return null;};}function removeEntity(_0x2dae16,_0x9b0ed6){return function(_0x103734){if(_0x103734){return _0x103734[_0xa5a9('0x28')]()[_0xa5a9('0x29')](function(){_0x2dae16[_0xa5a9('0x1c')](0xcc)[_0xa5a9('0x1d')]();});}};}function handleEntityNotFound(_0x54b293,_0x4de654){return function(_0x5800d6){if(!_0x5800d6){_0x54b293[_0xa5a9('0x1b')](0x194);}return _0x5800d6;};}function handleError(_0x537881,_0x1dd99a){_0x1dd99a=_0x1dd99a||0x1f4;return function(_0x18ee08){logger['error'](_0x18ee08[_0xa5a9('0x2a')]);if(_0x18ee08[_0xa5a9('0x2b')]){delete _0x18ee08[_0xa5a9('0x2b')];}_0x537881[_0xa5a9('0x1c')](_0x1dd99a)[_0xa5a9('0x2c')](_0x18ee08);};}exports['index']=function(_0x3da8e7,_0xd41eef){var _0x2d9fa6={},_0x54711f={},_0x58c087={'count':0x0,'rows':[]};var _0x248e2d=_[_0xa5a9('0x2d')](db[_0xa5a9('0x2e')][_0xa5a9('0x2f')],function(_0x1ae2ef){return{'name':_0x1ae2ef['fieldName'],'type':_0x1ae2ef[_0xa5a9('0x30')][_0xa5a9('0x31')]};});_0x54711f[_0xa5a9('0x32')]=_[_0xa5a9('0x2d')](_0x248e2d,'name');_0x54711f[_0xa5a9('0x33')]=_[_0xa5a9('0x34')](_0x3da8e7[_0xa5a9('0x33')]);_0x54711f[_0xa5a9('0x35')]=_[_0xa5a9('0x36')](_0x54711f[_0xa5a9('0x32')],_0x54711f[_0xa5a9('0x33')]);_0x2d9fa6['attributes']=_[_0xa5a9('0x36')](_0x54711f[_0xa5a9('0x32')],qs[_0xa5a9('0x37')](_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x37')]));_0x2d9fa6[_0xa5a9('0x38')]=_0x2d9fa6[_0xa5a9('0x38')]['length']?_0x2d9fa6[_0xa5a9('0x38')]:_0x54711f[_0xa5a9('0x32')];if(!_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x39')]('nolimit')){_0x2d9fa6[_0xa5a9('0x20')]=qs[_0xa5a9('0x20')](_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x20')]);_0x2d9fa6[_0xa5a9('0x22')]=qs[_0xa5a9('0x22')](_0x3da8e7['query']['offset']);}_0x2d9fa6['order']=qs[_0xa5a9('0x3a')](_0x3da8e7[_0xa5a9('0x33')]['sort']);_0x2d9fa6[_0xa5a9('0x3b')]=qs[_0xa5a9('0x35')](_[_0xa5a9('0x3c')](_0x3da8e7[_0xa5a9('0x33')],_0x54711f[_0xa5a9('0x35')]),_0x248e2d);if(_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x3d')]){_0x2d9fa6[_0xa5a9('0x3b')]=_[_0xa5a9('0x3e')](_0x2d9fa6['where'],{'$or':_[_0xa5a9('0x2d')](_0x248e2d,function(_0x2e24af){if(_0x2e24af[_0xa5a9('0x30')]!==_0xa5a9('0x3f')){var _0x1c0c05={};_0x1c0c05[_0x2e24af[_0xa5a9('0x2b')]]={'$like':'%'+_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x3d')]+'%'};return _0x1c0c05;}})});}_0x2d9fa6=_[_0xa5a9('0x3e')]({},_0x2d9fa6,_0x3da8e7[_0xa5a9('0x40')]);var _0x5742f9={'where':_0x2d9fa6[_0xa5a9('0x3b')]};return db[_0xa5a9('0x2e')][_0xa5a9('0x21')](_0x5742f9)['then'](function(_0x4563d8){_0x58c087['count']=_0x4563d8;if(_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x41')]){_0x2d9fa6['include']=[{'all':!![]}];}return db[_0xa5a9('0x2e')][_0xa5a9('0x42')](_0x2d9fa6);})[_0xa5a9('0x29')](function(_0x2b6eae){_0x58c087[_0xa5a9('0x43')]=_0x2b6eae;return _0x58c087;})[_0xa5a9('0x29')](respondWithFilteredResult(_0xd41eef,_0x2d9fa6))[_0xa5a9('0x44')](handleError(_0xd41eef,null));};exports['show']=function(_0x502c67,_0x1e097c){var _0x1ff359={'raw':!![],'where':{'id':_0x502c67[_0xa5a9('0x45')]['id']}},_0x5cbf74={};_0x5cbf74[_0xa5a9('0x32')]=_[_0xa5a9('0x34')](db[_0xa5a9('0x2e')][_0xa5a9('0x2f')]);_0x5cbf74[_0xa5a9('0x33')]=_[_0xa5a9('0x34')](_0x502c67[_0xa5a9('0x33')]);_0x5cbf74[_0xa5a9('0x35')]=_[_0xa5a9('0x36')](_0x5cbf74[_0xa5a9('0x32')],_0x5cbf74[_0xa5a9('0x33')]);_0x1ff359[_0xa5a9('0x38')]=_[_0xa5a9('0x36')](_0x5cbf74[_0xa5a9('0x32')],qs[_0xa5a9('0x37')](_0x502c67[_0xa5a9('0x33')][_0xa5a9('0x37')]));_0x1ff359[_0xa5a9('0x38')]=_0x1ff359[_0xa5a9('0x38')][_0xa5a9('0x46')]?_0x1ff359[_0xa5a9('0x38')]:_0x5cbf74[_0xa5a9('0x32')];if(_0x502c67['query'][_0xa5a9('0x41')]){_0x1ff359['include']=[{'all':!![]}];}_0x1ff359=_['merge']({},_0x1ff359,_0x502c67['options']);return db[_0xa5a9('0x2e')][_0xa5a9('0x47')](_0x1ff359)['then'](handleEntityNotFound(_0x1e097c,null))['then'](respondWithResult(_0x1e097c,null))[_0xa5a9('0x44')](handleError(_0x1e097c,null));};exports[_0xa5a9('0x48')]=function(_0x29cc2f,_0x3b4ca6){return db[_0xa5a9('0x2e')][_0xa5a9('0x48')](_0x29cc2f[_0xa5a9('0x49')],{})[_0xa5a9('0x29')](respondWithResult(_0x3b4ca6,0xc9))['catch'](handleError(_0x3b4ca6,null));};exports[_0xa5a9('0x27')]=function(_0x2e3d1a,_0x3e5ab0){if(_0x2e3d1a[_0xa5a9('0x49')]['id']){delete _0x2e3d1a[_0xa5a9('0x49')]['id'];}return db[_0xa5a9('0x2e')][_0xa5a9('0x47')]({'where':{'id':_0x2e3d1a[_0xa5a9('0x45')]['id']}})[_0xa5a9('0x29')](handleEntityNotFound(_0x3e5ab0,null))['then'](saveUpdates(_0x2e3d1a['body'],null))['then'](respondWithResult(_0x3e5ab0,null))['catch'](handleError(_0x3e5ab0,null));};exports[_0xa5a9('0x28')]=function(_0x4079e0,_0xe36c38){return db[_0xa5a9('0x2e')][_0xa5a9('0x47')]({'where':{'id':_0x4079e0[_0xa5a9('0x45')]['id']}})[_0xa5a9('0x29')](handleEntityNotFound(_0xe36c38,null))[_0xa5a9('0x29')](removeEntity(_0xe36c38,null))[_0xa5a9('0x44')](handleError(_0xe36c38,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c8f5d21..aeba7f9 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 _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 +var _0xe886=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x5e9f06,_0x3dd75c){var _0x4c9dd5=function(_0x5dc2e1){while(--_0x5dc2e1){_0x5e9f06['push'](_0x5e9f06['shift']());}};_0x4c9dd5(++_0x3dd75c);}(_0xe886,0x1ee));var _0x6e88=function(_0x7affc1,_0x17c238){_0x7affc1=_0x7affc1-0x0;var _0x5f4941=_0xe886[_0x7affc1];return _0x5f4941;};'use strict';var _=require(_0x6e88('0x0'));var util=require(_0x6e88('0x1'));var logger=require(_0x6e88('0x2'))(_0x6e88('0x3'));var moment=require('moment');var BPromise=require(_0x6e88('0x4'));var rp=require(_0x6e88('0x5'));var fs=require('fs');var path=require(_0x6e88('0x6'));var rimraf=require(_0x6e88('0x7'));var config=require(_0x6e88('0x8'));var attributes=require(_0x6e88('0x9'));module['exports']=function(_0x5087eb,_0x5b3392){return _0x5087eb[_0x6e88('0xa')](_0x6e88('0xb'),attributes,{'tableName':_0x6e88('0xc'),'paranoid':![],'indexes':[{'name':_0x6e88('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 5a231d5..ff23311 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 _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 +var _0x7d87=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x4318e1,_0x1df511){var _0xd4f7d1=function(_0x508836){while(--_0x508836){_0x4318e1['push'](_0x4318e1['shift']());}};_0xd4f7d1(++_0x1df511);}(_0x7d87,0x14c));var _0x77d8=function(_0x573a27,_0x26d295){_0x573a27=_0x573a27-0x0;var _0x49f7c0=_0x7d87[_0x573a27];return _0x49f7c0;};'use strict';var _=require(_0x77d8('0x0'));var util=require('util');var moment=require(_0x77d8('0x1'));var BPromise=require(_0x77d8('0x2'));var rs=require(_0x77d8('0x3'));var fs=require('fs');var Redis=require(_0x77d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x77d8('0x5'))(_0x77d8('0x6'));var config=require(_0x77d8('0x7'));var jayson=require(_0x77d8('0x8'));var client=jayson[_0x77d8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34922b,_0x1449ad,_0x21b92b){return new BPromise(function(_0x256e1e,_0x5a0dbf){return client[_0x77d8('0xa')](_0x34922b,_0x21b92b)['then'](function(_0x215155){logger['info'](_0x77d8('0xb'),_0x1449ad,'request\x20sent');logger[_0x77d8('0xc')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1449ad,_0x77d8('0xd'),JSON[_0x77d8('0xe')](_0x215155));if(_0x215155[_0x77d8('0xf')]){if(_0x215155['error'][_0x77d8('0x10')]===0x1f4){logger[_0x77d8('0xf')](_0x77d8('0xb'),_0x1449ad,_0x215155[_0x77d8('0xf')][_0x77d8('0x11')]);return _0x5a0dbf(_0x215155['error'][_0x77d8('0x11')]);}logger[_0x77d8('0xf')](_0x77d8('0xb'),_0x1449ad,_0x215155['error']['message']);return _0x256e1e(_0x215155[_0x77d8('0xf')][_0x77d8('0x11')]);}else{logger[_0x77d8('0x12')]('VtigerField,\x20%s,\x20%s',_0x1449ad,_0x77d8('0xd'));_0x256e1e(_0x215155[_0x77d8('0x13')][_0x77d8('0x11')]);}})[_0x77d8('0x14')](function(_0x49ef02){logger[_0x77d8('0xf')](_0x77d8('0xb'),_0x1449ad,_0x49ef02);_0x5a0dbf(_0x49ef02);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 508abcc..fe608b6 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 _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 +var _0x1bce=['getFields','create','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x1ff414,_0x12c95d){var _0x52c0fa=function(_0x57f936){while(--_0x57f936){_0x1ff414['push'](_0x1ff414['shift']());}};_0x52c0fa(++_0x12c95d);}(_0x1bce,0x73));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var path=require('path');var timeout=require(_0xe1bc('0x2'));var express=require(_0xe1bc('0x3'));var router=express[_0xe1bc('0x4')]();var fs_extra=require(_0xe1bc('0x5'));var auth=require(_0xe1bc('0x6'));var interaction=require(_0xe1bc('0x7'));var config=require(_0xe1bc('0x8'));var controller=require(_0xe1bc('0x9'));router[_0xe1bc('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe1bc('0xa')](_0xe1bc('0xb'),auth[_0xe1bc('0xc')](),controller[_0xe1bc('0xd')]);router[_0xe1bc('0xa')](_0xe1bc('0xe'),auth['isAuthenticated'](),controller[_0xe1bc('0xf')]);router['get'](_0xe1bc('0x10'),auth[_0xe1bc('0xc')](),controller[_0xe1bc('0x11')]);router['post']('/',auth[_0xe1bc('0xc')](),controller[_0xe1bc('0x12')]);router['post'](_0xe1bc('0xe'),auth[_0xe1bc('0xc')](),controller['addConfiguration']);router['put'](_0xe1bc('0xb'),auth[_0xe1bc('0xc')](),controller[_0xe1bc('0x13')]);router['delete']('/:id',auth[_0xe1bc('0xc')](),controller[_0xe1bc('0x14')]);module[_0xe1bc('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e6982d9..f71ab66 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 _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 +var _0x9af6=['token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9af6,0x1d7));var _0x69af=function(_0x449b6e,_0x25e5e0){_0x449b6e=_0x449b6e-0x0;var _0x467114=_0x9af6[_0x449b6e];return _0x467114;};'use strict';var Sequelize=require(_0x69af('0x0'));module[_0x69af('0x1')]={'name':{'type':Sequelize[_0x69af('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x69af('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x69af('0x2')],'unique':_0x69af('0x4')},'authType':{'type':Sequelize[_0x69af('0x5')]('password',_0x69af('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x69af('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x69af('0x5')](_0x69af('0x7'),_0x69af('0x8')),'defaultValue':_0x69af('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index e1c1c38..2999321 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 _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 +var _0x0102=['VIRTUAL','options','ZendeskAccount','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','ZendeskConfiguration','ZendeskField','getFields','password','token','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','username','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','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','status','end','offset','undefined','limit','count','json','apply','reject','then','sendStatus','error','stack','name','send','index','map','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','pick','filters','filter','merge'];(function(_0x17cb08,_0x386e2e){var _0x574dc5=function(_0x4a347e){while(--_0x4a347e){_0x17cb08['push'](_0x17cb08['shift']());}};_0x574dc5(++_0x386e2e);}(_0x0102,0x186));var _0x2010=function(_0x3aa522,_0x18606e){_0x3aa522=_0x3aa522-0x0;var _0x4356b2=_0x0102[_0x3aa522];return _0x4356b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];var integrations=require(_0x2010('0x18'));function respondWithStatusCode(_0x3e8624,_0x388991){_0x388991=_0x388991||0xcc;return function(_0x528a38){if(_0x528a38){return _0x3e8624['sendStatus'](_0x388991);}return _0x3e8624[_0x2010('0x19')](_0x388991)[_0x2010('0x1a')]();};}function respondWithResult(_0x2e8ec2,_0x10b587){_0x10b587=_0x10b587||0xc8;return function(_0x32d791){if(_0x32d791){return _0x2e8ec2[_0x2010('0x19')](_0x10b587)['json'](_0x32d791);}};}function respondWithFilteredResult(_0x3195fa,_0x136418){return function(_0x5ad412){if(_0x5ad412){var _0x41e267=typeof _0x136418[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x136418[_0x2010('0x1d')]===_0x2010('0x1c');var _0x11bd28=_0x5ad412[_0x2010('0x1e')];var _0x1476c0=_0x41e267?0x0:_0x136418[_0x2010('0x1b')];var _0x569de2=_0x41e267?_0x5ad412['count']:_0x136418[_0x2010('0x1b')]+_0x136418[_0x2010('0x1d')];var _0x3f9d62;if(_0x569de2>=_0x11bd28){_0x569de2=_0x11bd28;_0x3f9d62=0xc8;}else{_0x3f9d62=0xce;}_0x3195fa[_0x2010('0x19')](_0x3f9d62);return _0x3195fa['set']('Content-Range',_0x1476c0+'-'+_0x569de2+'/'+_0x11bd28)[_0x2010('0x1f')](_0x5ad412);}return null;};}function patchUpdates(_0x171e45){return function(_0x37b51b){try{jsonpatch[_0x2010('0x20')](_0x37b51b,_0x171e45,!![]);}catch(_0x103bbc){return BPromise[_0x2010('0x21')](_0x103bbc);}return _0x37b51b['save']();};}function saveUpdates(_0x3db13d,_0x1cfa57){return function(_0x58ff30){if(_0x58ff30){return _0x58ff30['update'](_0x3db13d)['then'](function(_0x424453){return _0x424453;});}return null;};}function removeEntity(_0x574719,_0x277dcc){return function(_0x5f4233){if(_0x5f4233){return _0x5f4233['destroy']()[_0x2010('0x22')](function(){_0x574719[_0x2010('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x99ebe0,_0x4cff59){return function(_0x2a12ee){if(!_0x2a12ee){_0x99ebe0[_0x2010('0x23')](0x194);}return _0x2a12ee;};}function handleError(_0x3929d9,_0x3dcea4){_0x3dcea4=_0x3dcea4||0x1f4;return function(_0x3c5862){logger[_0x2010('0x24')](_0x3c5862[_0x2010('0x25')]);if(_0x3c5862[_0x2010('0x26')]){delete _0x3c5862[_0x2010('0x26')];}_0x3929d9[_0x2010('0x19')](_0x3dcea4)[_0x2010('0x27')](_0x3c5862);};}exports[_0x2010('0x28')]=function(_0x499cbe,_0x2a4691){var _0x52fe5e={},_0x5b52fb={},_0x147a5a={'count':0x0,'rows':[]};var _0xd16c04=_[_0x2010('0x29')](db['ZendeskAccount']['rawAttributes'],function(_0x136d5f){return{'name':_0x136d5f['fieldName'],'type':_0x136d5f[_0x2010('0x2a')][_0x2010('0x2b')]};});_0x5b52fb['model']=_[_0x2010('0x29')](_0xd16c04,_0x2010('0x26'));_0x5b52fb[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x499cbe[_0x2010('0x2c')]);_0x5b52fb['filters']=_[_0x2010('0x2e')](_0x5b52fb[_0x2010('0x2f')],_0x5b52fb[_0x2010('0x2c')]);_0x52fe5e['attributes']=_['intersection'](_0x5b52fb[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x499cbe[_0x2010('0x2c')]['fields']));_0x52fe5e['attributes']=_0x52fe5e[_0x2010('0x31')][_0x2010('0x32')]?_0x52fe5e[_0x2010('0x31')]:_0x5b52fb[_0x2010('0x2f')];if(!_0x499cbe[_0x2010('0x2c')]['hasOwnProperty']('nolimit')){_0x52fe5e['limit']=qs[_0x2010('0x1d')](_0x499cbe[_0x2010('0x2c')][_0x2010('0x1d')]);_0x52fe5e['offset']=qs[_0x2010('0x1b')](_0x499cbe[_0x2010('0x2c')][_0x2010('0x1b')]);}_0x52fe5e[_0x2010('0x33')]=qs['sort'](_0x499cbe[_0x2010('0x2c')][_0x2010('0x34')]);_0x52fe5e[_0x2010('0x35')]=qs['filters'](_[_0x2010('0x36')](_0x499cbe['query'],_0x5b52fb[_0x2010('0x37')]),_0xd16c04);if(_0x499cbe[_0x2010('0x2c')][_0x2010('0x38')]){_0x52fe5e[_0x2010('0x35')]=_[_0x2010('0x39')](_0x52fe5e[_0x2010('0x35')],{'$or':_['map'](_0xd16c04,function(_0x1e4460){if(_0x1e4460['type']!==_0x2010('0x3a')){var _0x157c73={};_0x157c73[_0x1e4460[_0x2010('0x26')]]={'$like':'%'+_0x499cbe[_0x2010('0x2c')][_0x2010('0x38')]+'%'};return _0x157c73;}})});}_0x52fe5e=_[_0x2010('0x39')]({},_0x52fe5e,_0x499cbe[_0x2010('0x3b')]);var _0x36ff3e={'where':_0x52fe5e[_0x2010('0x35')]};return db[_0x2010('0x3c')][_0x2010('0x1e')](_0x36ff3e)[_0x2010('0x22')](function(_0x1c2b13){_0x147a5a[_0x2010('0x1e')]=_0x1c2b13;if(_0x499cbe['query']['includeAll']){_0x52fe5e[_0x2010('0x3d')]=[{'all':!![]}];}return db[_0x2010('0x3c')][_0x2010('0x3e')](_0x52fe5e);})[_0x2010('0x22')](function(_0x3d5906){_0x147a5a[_0x2010('0x3f')]=_0x3d5906;return _0x147a5a;})[_0x2010('0x22')](respondWithFilteredResult(_0x2a4691,_0x52fe5e))['catch'](handleError(_0x2a4691,null));};exports[_0x2010('0x40')]=function(_0x578645,_0x27fd64){var _0x3ff496={'raw':![],'where':{'id':_0x578645[_0x2010('0x41')]['id']}},_0x16db82={};_0x16db82[_0x2010('0x2f')]=_['keys'](db[_0x2010('0x3c')][_0x2010('0x42')]);_0x16db82[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x578645['query']);_0x16db82[_0x2010('0x37')]=_['intersection'](_0x16db82['model'],_0x16db82['query']);_0x3ff496[_0x2010('0x31')]=_[_0x2010('0x2e')](_0x16db82[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x578645[_0x2010('0x2c')][_0x2010('0x30')]));_0x3ff496['attributes']=_0x3ff496[_0x2010('0x31')][_0x2010('0x32')]?_0x3ff496[_0x2010('0x31')]:_0x16db82['model'];if(_0x578645['query'][_0x2010('0x43')]){_0x3ff496['include']=[{'all':!![]}];}_0x3ff496=_[_0x2010('0x39')]({},_0x3ff496,_0x578645[_0x2010('0x3b')]);return db[_0x2010('0x3c')][_0x2010('0x44')](_0x3ff496)['then'](handleEntityNotFound(_0x27fd64,null))[_0x2010('0x22')](respondWithResult(_0x27fd64,null))[_0x2010('0x45')](handleError(_0x27fd64,null));};exports[_0x2010('0x46')]=function(_0x231db7,_0x3ec24c){return db[_0x2010('0x3c')]['create'](_0x231db7[_0x2010('0x47')],{})[_0x2010('0x22')](respondWithResult(_0x3ec24c,0xc9))[_0x2010('0x45')](handleError(_0x3ec24c,null));};exports['update']=function(_0x30e5d0,_0x1dd027){if(_0x30e5d0['body']['id']){delete _0x30e5d0[_0x2010('0x47')]['id'];}return db[_0x2010('0x3c')][_0x2010('0x44')]({'where':{'id':_0x30e5d0[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x1dd027,null))[_0x2010('0x22')](saveUpdates(_0x30e5d0[_0x2010('0x47')],null))[_0x2010('0x22')](respondWithResult(_0x1dd027,null))['catch'](handleError(_0x1dd027,null));};exports['destroy']=function(_0xc9f070,_0xe1721f){return db['ZendeskAccount'][_0x2010('0x44')]({'where':{'id':_0xc9f070[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0xe1721f,null))[_0x2010('0x22')](removeEntity(_0xe1721f,null))[_0x2010('0x45')](handleError(_0xe1721f,null));};exports['getConfigurations']=function(_0x5f4e98,_0x3fca06,_0x137452){var _0x4694e7={};var _0x3b89de={};var _0x38e596;var _0x2d8164;return db[_0x2010('0x3c')][_0x2010('0x48')]({'where':{'id':_0x5f4e98[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x3fca06,null))[_0x2010('0x22')](function(_0x5313b5){if(_0x5313b5){_0x38e596=_0x5313b5;_0x3b89de[_0x2010('0x2f')]=_[_0x2010('0x2d')](db['ZendeskConfiguration'][_0x2010('0x42')]);_0x3b89de[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x5f4e98[_0x2010('0x2c')]);_0x3b89de[_0x2010('0x37')]=_[_0x2010('0x2e')](_0x3b89de[_0x2010('0x2f')],_0x3b89de[_0x2010('0x2c')]);_0x4694e7[_0x2010('0x31')]=_[_0x2010('0x2e')](_0x3b89de[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x30')]));_0x4694e7[_0x2010('0x31')]=_0x4694e7[_0x2010('0x31')][_0x2010('0x32')]?_0x4694e7[_0x2010('0x31')]:_0x3b89de[_0x2010('0x2f')];_0x4694e7[_0x2010('0x33')]=qs[_0x2010('0x34')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x34')]);_0x4694e7['where']=qs[_0x2010('0x37')](_['pick'](_0x5f4e98['query'],_0x3b89de[_0x2010('0x37')]));if(_0x5f4e98[_0x2010('0x2c')]['filter']){_0x4694e7[_0x2010('0x35')]=_[_0x2010('0x39')](_0x4694e7[_0x2010('0x35')],{'$or':_[_0x2010('0x29')](_0x4694e7['attributes'],function(_0x3c6484){var _0x44816e={};_0x44816e[_0x3c6484]={'$like':'%'+_0x5f4e98[_0x2010('0x2c')][_0x2010('0x38')]+'%'};return _0x44816e;})});}_0x4694e7=_['merge']({},_0x4694e7,_0x5f4e98[_0x2010('0x3b')]);return _0x38e596['getConfigurations'](_0x4694e7);}})[_0x2010('0x22')](function(_0x2bc708){if(_0x2bc708){_0x2d8164=_0x2bc708[_0x2010('0x32')];if(!_0x5f4e98[_0x2010('0x2c')]['hasOwnProperty']('nolimit')){_0x4694e7[_0x2010('0x1d')]=qs[_0x2010('0x1d')](_0x5f4e98['query']['limit']);_0x4694e7[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x1b')]);}return _0x38e596['getConfigurations'](_0x4694e7);}})[_0x2010('0x22')](function(_0x5a2c7e){if(_0x5a2c7e){return _0x5a2c7e?{'count':_0x2d8164,'rows':_0x5a2c7e}:null;}})[_0x2010('0x22')](respondWithResult(_0x3fca06,null))[_0x2010('0x45')](handleError(_0x3fca06,null));};exports[_0x2010('0x49')]=function(_0x1d81e1,_0x4bde43,_0x340882){if(_0x1d81e1[_0x2010('0x47')]['id']){delete _0x1d81e1['body']['id'];}return db[_0x2010('0x3c')][_0x2010('0x48')]({'where':{'id':_0x1d81e1[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x4bde43,null))[_0x2010('0x22')](function(_0x8df400){if(_0x8df400){_0x1d81e1[_0x2010('0x47')][_0x2010('0x4a')]=_0x8df400['id'];_0x1d81e1[_0x2010('0x47')][_0x2010('0x4b')]=integrations[_0x2010('0x4c')](_0x1d81e1[_0x2010('0x47')]['channel'],_0x1d81e1[_0x2010('0x47')][_0x2010('0x2a')]);_0x1d81e1[_0x2010('0x47')]['Descriptions']=integrations['getDescriptions'](_0x1d81e1[_0x2010('0x47')][_0x2010('0x4d')],_0x1d81e1[_0x2010('0x47')][_0x2010('0x2a')]);return db[_0x2010('0x4e')][_0x2010('0x46')](_0x1d81e1['body'],{'include':[{'model':db[_0x2010('0x4f')],'as':_0x2010('0x4b')},{'model':db[_0x2010('0x4f')],'as':'Descriptions'}]});}return null;})[_0x2010('0x22')](respondWithResult(_0x4bde43,null))[_0x2010('0x45')](handleError(_0x4bde43,null));};exports[_0x2010('0x50')]=function(_0x5182b2,_0x20dea1,_0x22f654){var _0x4adc1c='';return db['ZendeskAccount'][_0x2010('0x48')]({'where':{'id':_0x5182b2['params']['id']},'attributes':['id','username',_0x2010('0x51'),_0x2010('0x52'),_0x2010('0x53'),_0x2010('0x54')]})[_0x2010('0x22')](handleEntityNotFound(_0x20dea1,null))[_0x2010('0x22')](function(_0xdf6767){if(_0xdf6767){_0x4adc1c=_0xdf6767[_0x2010('0x54')];var _0xee7084=_0x4adc1c[_0x2010('0x55')](-0x1);if(_0xee7084==='/'){_0x4adc1c=_0x4adc1c['substring'](0x0,_0x4adc1c[_0x2010('0x56')](_0xee7084));}var _0x1c1373={'method':'GET','uri':util[_0x2010('0x57')](_0x2010('0x58'),_0x4adc1c,_0x2010('0x59')),'json':!![]};switch(_0xdf6767[_0x2010('0x53')]){case'password':_0x1c1373[_0x2010('0x5a')]={'Authorization':util[_0x2010('0x57')]('Basic\x20%s',new Buffer(util['format'](_0x2010('0x5b'),_0xdf6767['username'],_0xdf6767[_0x2010('0x51')]))[_0x2010('0x5c')](_0x2010('0x5d')))};break;case _0x2010('0x52'):_0x1c1373[_0x2010('0x5a')]={'Authorization':util[_0x2010('0x57')](_0x2010('0x5e'),new Buffer(util['format'](_0x2010('0x5f'),_0xdf6767[_0x2010('0x60')],_0xdf6767[_0x2010('0x52')]))['toString'](_0x2010('0x5d')))};break;default:throw new db[(_0x2010('0x61'))][(_0x2010('0x62'))](_0x2010('0x63'));}return rp(_0x1c1373);}})[_0x2010('0x22')](function(_0x41c3cc){if(_0x41c3cc){var _0x40885b=[_0x2010('0x64'),'description',_0x2010('0x65'),_0x2010('0x66')];_[_0x2010('0x67')](_0x41c3cc['ticket_fields'],function(_0xb6ba3f){return _0x40885b[_0x2010('0x68')](_0xb6ba3f['type']);});return{'count':_0x41c3cc[_0x2010('0x59')][_0x2010('0x32')],'rows':_[_0x2010('0x29')](_0x41c3cc[_0x2010('0x59')],function(_0x38e733){return{'id':_0x38e733['id'],'name':_0x38e733['position']>0x7?_0x38e733[_0x2010('0x69')]:_0x38e733[_0x2010('0x2a')],'custom':_0x38e733['position']>0x7?!![]:![],'options':_0x38e733[_0x2010('0x6a')]?_0x38e733[_0x2010('0x6a')]:_0x38e733['custom_field_options']?_0x38e733[_0x2010('0x6b')]:[]};})};}})['then'](respondWithResult(_0x20dea1,null))['catch'](function(_0x44e47e){var _0x17f7c5=_0x5182b2[_0x2010('0x2c')][_0x2010('0x6c')]?0x1f4:_0x44e47e[_0x2010('0x6d')]||0x1f4;logger[_0x2010('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x2010('0x50'),_0x17f7c5,JSON[_0x2010('0x6e')](_0x44e47e));delete _0x44e47e[_0x2010('0x26')];if(_0x17f7c5===0x191){_0x17f7c5=0x190;}_0x20dea1[_0x2010('0x19')](_0x17f7c5)['send'](_0x5182b2[_0x2010('0x2c')]['test']?{'message':_0x2010('0x6f'),'statusCode':_0x44e47e[_0x2010('0x6d')]}:_0x44e47e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c2d8a1e..38baaa0 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 _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 +var _0x4993=['../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x53d24c,_0x559ab7){var _0x30cd58=function(_0x1ef8d7){while(--_0x1ef8d7){_0x53d24c['push'](_0x53d24c['shift']());}};_0x30cd58(++_0x559ab7);}(_0x4993,0xf4));var _0x3499=function(_0x271ace,_0x2b1999){_0x271ace=_0x271ace-0x0;var _0x48e6af=_0x4993[_0x271ace];return _0x48e6af;};'use strict';var _=require(_0x3499('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3499('0x1'));var moment=require(_0x3499('0x2'));var BPromise=require('bluebird');var rp=require(_0x3499('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3499('0x4'));var config=require(_0x3499('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x3499('0x6'));module[_0x3499('0x7')]=function(_0x4cd59e,_0x30d07d){return _0x4cd59e['define'](_0x3499('0x8'),attributes,{'tableName':_0x3499('0x9'),'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 d064f9b..40ab163 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 _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 +var _0xf2c6=['error','code','message','info','catch','GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ZendeskAccount','find','ShowZendeskAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2c6,0x1e6));var _0x6f2c=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xf2c6[_0xea8947];return _0x2455e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f2c('0x0'));var BPromise=require(_0x6f2c('0x1'));var rs=require(_0x6f2c('0x2'));var fs=require('fs');var Redis=require(_0x6f2c('0x3'));var db=require(_0x6f2c('0x4'))['db'];var utils=require(_0x6f2c('0x5'));var logger=require(_0x6f2c('0x6'))(_0x6f2c('0x7'));var config=require(_0x6f2c('0x8'));var jayson=require(_0x6f2c('0x9'));var client=jayson['client'][_0x6f2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d994e,_0x27eb8a,_0x5674f8){return new BPromise(function(_0x4c43ca,_0xbeb40f){return client[_0x6f2c('0xb')](_0x5d994e,_0x5674f8)[_0x6f2c('0xc')](function(_0x22e617){logger['info'](_0x6f2c('0xd'),_0x27eb8a,_0x6f2c('0xe'));logger[_0x6f2c('0xf')](_0x6f2c('0x10'),_0x27eb8a,_0x6f2c('0xe'),JSON[_0x6f2c('0x11')](_0x22e617));if(_0x22e617[_0x6f2c('0x12')]){if(_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x13')]===0x1f4){logger['error'](_0x6f2c('0xd'),_0x27eb8a,_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x14')]);return _0xbeb40f(_0x22e617[_0x6f2c('0x12')]['message']);}logger[_0x6f2c('0x12')](_0x6f2c('0xd'),_0x27eb8a,_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x14')]);return _0x4c43ca(_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x14')]);}else{logger[_0x6f2c('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x27eb8a,'request\x20sent');_0x4c43ca(_0x22e617['result']['message']);}})[_0x6f2c('0x16')](function(_0x330239){logger[_0x6f2c('0x12')](_0x6f2c('0xd'),_0x27eb8a,_0x330239);_0xbeb40f(_0x330239);});});}exports[_0x6f2c('0x17')]=function(_0x36f731){var _0x27feff=this;return new Promise(function(_0x32b039,_0x4507fc){return db['ZendeskAccount'][_0x6f2c('0x18')]({'raw':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1a')]===undefined?!![]:![]:!![],'where':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1b')]||null:null,'attributes':_0x36f731[_0x6f2c('0x19')]?_0x36f731[_0x6f2c('0x19')][_0x6f2c('0x1c')]||null:null,'limit':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1d')]||null:null,'include':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1e')]?_[_0x6f2c('0x1f')](_0x36f731[_0x6f2c('0x19')][_0x6f2c('0x1e')],function(_0x51d881){return{'model':db[_0x51d881[_0x6f2c('0x20')]],'as':_0x51d881['as'],'attributes':_0x51d881[_0x6f2c('0x1c')],'include':_0x51d881[_0x6f2c('0x1e')]?_['map'](_0x51d881[_0x6f2c('0x1e')],function(_0x2b35e1){return{'model':db[_0x2b35e1[_0x6f2c('0x20')]],'as':_0x2b35e1['as'],'attributes':_0x2b35e1[_0x6f2c('0x1c')],'include':_0x2b35e1['include']?_[_0x6f2c('0x1f')](_0x2b35e1[_0x6f2c('0x1e')],function(_0x1dcda5){return{'model':db[_0x1dcda5[_0x6f2c('0x20')]],'as':_0x1dcda5['as'],'attributes':_0x1dcda5[_0x6f2c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6f2c('0xc')](function(_0x1b1efb){logger['info'](_0x6f2c('0x17'),_0x36f731);logger[_0x6f2c('0xf')](_0x6f2c('0x17'),_0x36f731,JSON[_0x6f2c('0x11')](_0x1b1efb));_0x32b039(_0x1b1efb);})['catch'](function(_0x15582b){logger[_0x6f2c('0x12')](_0x6f2c('0x17'),_0x15582b[_0x6f2c('0x14')],_0x36f731);_0x4507fc(_0x27feff['error'](0x1f4,_0x15582b[_0x6f2c('0x14')]));});});};exports['ShowZendeskAccount']=function(_0x3fec8f){var _0xe67305=this;return new Promise(function(_0x49459b,_0x568666){return db[_0x6f2c('0x21')][_0x6f2c('0x22')]({'raw':_0x3fec8f[_0x6f2c('0x19')]?_0x3fec8f[_0x6f2c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3fec8f[_0x6f2c('0x19')]?_0x3fec8f[_0x6f2c('0x19')][_0x6f2c('0x1b')]||null:null,'attributes':_0x3fec8f[_0x6f2c('0x19')]?_0x3fec8f['options']['attributes']||null:null,'include':_0x3fec8f[_0x6f2c('0x19')]?_0x3fec8f[_0x6f2c('0x19')][_0x6f2c('0x1e')]?_[_0x6f2c('0x1f')](_0x3fec8f[_0x6f2c('0x19')][_0x6f2c('0x1e')],function(_0x53adcf){return{'model':db[_0x53adcf[_0x6f2c('0x20')]],'as':_0x53adcf['as'],'attributes':_0x53adcf[_0x6f2c('0x1c')],'include':_0x53adcf[_0x6f2c('0x1e')]?_[_0x6f2c('0x1f')](_0x53adcf[_0x6f2c('0x1e')],function(_0x2bda87){return{'model':db[_0x2bda87[_0x6f2c('0x20')]],'as':_0x2bda87['as'],'attributes':_0x2bda87['attributes'],'include':_0x2bda87[_0x6f2c('0x1e')]?_['map'](_0x2bda87[_0x6f2c('0x1e')],function(_0x50af7f){return{'model':db[_0x50af7f[_0x6f2c('0x20')]],'as':_0x50af7f['as'],'attributes':_0x50af7f[_0x6f2c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6f2c('0xc')](function(_0x33fcd7){logger[_0x6f2c('0x15')]('ShowZendeskAccount',_0x3fec8f);logger['debug'](_0x6f2c('0x23'),_0x3fec8f,JSON['stringify'](_0x33fcd7));_0x49459b(_0x33fcd7);})[_0x6f2c('0x16')](function(_0xebaea6){logger['error']('ShowZendeskAccount',_0xebaea6[_0x6f2c('0x14')],_0x3fec8f);_0x568666(_0xe67305['error'](0x1f4,_0xebaea6[_0x6f2c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9eb80f6..93caf8b 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 _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 +var _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x2e650a,_0x1ba640){var _0x2fa00c=function(_0x421108){while(--_0x421108){_0x2e650a['push'](_0x2e650a['shift']());}};_0x2fa00c(++_0x1ba640);}(_0x4fc2,0x111));var _0x24fc=function(_0xeeca45,_0x5ce4af){_0xeeca45=_0xeeca45-0x0;var _0x366bcb=_0x4fc2[_0xeeca45];return _0x366bcb;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index aac38d4..d79eaec 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 _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 +var _0x1b8c=['exports','STRING','sequelize'];(function(_0x3ef9c1,_0x4f6406){var _0x5cb632=function(_0x5e5646){while(--_0x5e5646){_0x3ef9c1['push'](_0x3ef9c1['shift']());}};_0x5cb632(++_0x4f6406);}(_0x1b8c,0x1c4));var _0xc1b8=function(_0x2e4151,_0x57ab43){_0x2e4151=_0x2e4151-0x0;var _0x69760b=_0x1b8c[_0x2e4151];return _0x69760b;};'use strict';var Sequelize=require(_0xc1b8('0x0'));module[_0xc1b8('0x1')]={'name':{'type':Sequelize[_0xc1b8('0x2')]},'description':{'type':Sequelize[_0xc1b8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 7e2b84a..e6a1f72 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 _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 +var _0xa058=['includeAll','find','create','body','findOne','ZendeskField','rawAttributes','getFields','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','ZendeskConfiguration','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params'];(function(_0x11f893,_0x259935){var _0x400fa8=function(_0x25933b){while(--_0x25933b){_0x11f893['push'](_0x11f893['shift']());}};_0x400fa8(++_0x259935);}(_0xa058,0x67));var _0x8a05=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0xa058[_0x36de10];return _0x58100f;};'use strict';var emlformat=require(_0x8a05('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a05('0x1'));var jsonpatch=require(_0x8a05('0x2'));var rp=require(_0x8a05('0x3'));var moment=require(_0x8a05('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8a05('0x5'));var util=require(_0x8a05('0x6'));var path=require(_0x8a05('0x7'));var sox=require(_0x8a05('0x8'));var csv=require('to-csv');var ejs=require(_0x8a05('0x9'));var fs=require('fs');var fs_extra=require(_0x8a05('0xa'));var _=require(_0x8a05('0xb'));var squel=require(_0x8a05('0xc'));var crypto=require(_0x8a05('0xd'));var jsforce=require(_0x8a05('0xe'));var deskjs=require(_0x8a05('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8a05('0x10'));var Papa=require(_0x8a05('0x11'));var Redis=require(_0x8a05('0x12'));var authService=require(_0x8a05('0x13'));var qs=require(_0x8a05('0x14'));var as=require(_0x8a05('0x15'));var hardwareService=require(_0x8a05('0x16'));var logger=require(_0x8a05('0x17'))(_0x8a05('0x18'));var utils=require(_0x8a05('0x19'));var config=require(_0x8a05('0x1a'));var licenseUtil=require(_0x8a05('0x1b'));var db=require(_0x8a05('0x1c'))['db'];function respondWithStatusCode(_0x56d146,_0x20c400){_0x20c400=_0x20c400||0xcc;return function(_0x54f1b2){if(_0x54f1b2){return _0x56d146['sendStatus'](_0x20c400);}return _0x56d146['status'](_0x20c400)['end']();};}function respondWithResult(_0x14fda5,_0x37a346){_0x37a346=_0x37a346||0xc8;return function(_0x5c2448){if(_0x5c2448){return _0x14fda5[_0x8a05('0x1d')](_0x37a346)['json'](_0x5c2448);}};}function respondWithFilteredResult(_0x2237da,_0x80e4ba){return function(_0x46be07){if(_0x46be07){var _0x95b638=typeof _0x80e4ba[_0x8a05('0x1e')]==='undefined'&&typeof _0x80e4ba[_0x8a05('0x1f')]===_0x8a05('0x20');var _0x96dcf3=_0x46be07[_0x8a05('0x21')];var _0x17aac4=_0x95b638?0x0:_0x80e4ba[_0x8a05('0x1e')];var _0xf36045=_0x95b638?_0x46be07[_0x8a05('0x21')]:_0x80e4ba[_0x8a05('0x1e')]+_0x80e4ba['limit'];var _0x1982e5;if(_0xf36045>=_0x96dcf3){_0xf36045=_0x96dcf3;_0x1982e5=0xc8;}else{_0x1982e5=0xce;}_0x2237da[_0x8a05('0x1d')](_0x1982e5);return _0x2237da[_0x8a05('0x22')](_0x8a05('0x23'),_0x17aac4+'-'+_0xf36045+'/'+_0x96dcf3)[_0x8a05('0x24')](_0x46be07);}return null;};}function patchUpdates(_0x224f62){return function(_0x579142){try{jsonpatch[_0x8a05('0x25')](_0x579142,_0x224f62,!![]);}catch(_0x3fb6db){return BPromise[_0x8a05('0x26')](_0x3fb6db);}return _0x579142[_0x8a05('0x27')]();};}function saveUpdates(_0x10766d,_0x15f501){return function(_0x1a8fbc){if(_0x1a8fbc){return _0x1a8fbc[_0x8a05('0x28')](_0x10766d)[_0x8a05('0x29')](function(_0x4353e0){return _0x4353e0;});}return null;};}function removeEntity(_0x352d2c,_0x1f093c){return function(_0x6345ce){if(_0x6345ce){return _0x6345ce[_0x8a05('0x2a')]()[_0x8a05('0x29')](function(){_0x352d2c['status'](0xcc)[_0x8a05('0x2b')]();});}};}function handleEntityNotFound(_0x4e6557,_0x1ec7ea){return function(_0x2d0ff3){if(!_0x2d0ff3){_0x4e6557[_0x8a05('0x2c')](0x194);}return _0x2d0ff3;};}function handleError(_0x5a6353,_0x567026){_0x567026=_0x567026||0x1f4;return function(_0x32152e){logger[_0x8a05('0x2d')](_0x32152e['stack']);if(_0x32152e[_0x8a05('0x2e')]){delete _0x32152e[_0x8a05('0x2e')];}_0x5a6353['status'](_0x567026)[_0x8a05('0x2f')](_0x32152e);};}exports[_0x8a05('0x30')]=function(_0x5b77f7,_0x2d9c63){var _0x17a716={},_0x32bf42={},_0x132d11={'count':0x0,'rows':[]};var _0x285fac=_['map'](db[_0x8a05('0x31')]['rawAttributes'],function(_0x21076e){return{'name':_0x21076e['fieldName'],'type':_0x21076e[_0x8a05('0x32')][_0x8a05('0x33')]};});_0x32bf42['model']=_[_0x8a05('0x34')](_0x285fac,_0x8a05('0x2e'));_0x32bf42[_0x8a05('0x35')]=_[_0x8a05('0x36')](_0x5b77f7[_0x8a05('0x35')]);_0x32bf42[_0x8a05('0x37')]=_[_0x8a05('0x38')](_0x32bf42[_0x8a05('0x39')],_0x32bf42[_0x8a05('0x35')]);_0x17a716[_0x8a05('0x3a')]=_[_0x8a05('0x38')](_0x32bf42['model'],qs[_0x8a05('0x3b')](_0x5b77f7[_0x8a05('0x35')]['fields']));_0x17a716[_0x8a05('0x3a')]=_0x17a716[_0x8a05('0x3a')][_0x8a05('0x3c')]?_0x17a716[_0x8a05('0x3a')]:_0x32bf42[_0x8a05('0x39')];if(!_0x5b77f7[_0x8a05('0x35')][_0x8a05('0x3d')](_0x8a05('0x3e'))){_0x17a716[_0x8a05('0x1f')]=qs[_0x8a05('0x1f')](_0x5b77f7[_0x8a05('0x35')]['limit']);_0x17a716[_0x8a05('0x1e')]=qs[_0x8a05('0x1e')](_0x5b77f7['query'][_0x8a05('0x1e')]);}_0x17a716[_0x8a05('0x3f')]=qs[_0x8a05('0x40')](_0x5b77f7[_0x8a05('0x35')][_0x8a05('0x40')]);_0x17a716[_0x8a05('0x41')]=qs[_0x8a05('0x37')](_[_0x8a05('0x42')](_0x5b77f7[_0x8a05('0x35')],_0x32bf42[_0x8a05('0x37')]),_0x285fac);if(_0x5b77f7[_0x8a05('0x35')][_0x8a05('0x43')]){_0x17a716[_0x8a05('0x41')]=_[_0x8a05('0x44')](_0x17a716[_0x8a05('0x41')],{'$or':_['map'](_0x285fac,function(_0x1a5c89){if(_0x1a5c89['type']!==_0x8a05('0x45')){var _0x3abd54={};_0x3abd54[_0x1a5c89[_0x8a05('0x2e')]]={'$like':'%'+_0x5b77f7['query'][_0x8a05('0x43')]+'%'};return _0x3abd54;}})});}_0x17a716=_['merge']({},_0x17a716,_0x5b77f7[_0x8a05('0x46')]);var _0x37793a={'where':_0x17a716[_0x8a05('0x41')]};return db[_0x8a05('0x31')][_0x8a05('0x21')](_0x37793a)[_0x8a05('0x29')](function(_0x14199d){_0x132d11[_0x8a05('0x21')]=_0x14199d;if(_0x5b77f7['query']['includeAll']){_0x17a716[_0x8a05('0x47')]=[{'all':!![]}];}return db[_0x8a05('0x31')][_0x8a05('0x48')](_0x17a716);})[_0x8a05('0x29')](function(_0x5ffc82){_0x132d11[_0x8a05('0x49')]=_0x5ffc82;return _0x132d11;})['then'](respondWithFilteredResult(_0x2d9c63,_0x17a716))[_0x8a05('0x4a')](handleError(_0x2d9c63,null));};exports[_0x8a05('0x4b')]=function(_0x42cb4f,_0x335aec){var _0x2b0bad={'raw':![],'where':{'id':_0x42cb4f[_0x8a05('0x4c')]['id']}},_0x5d9e9a={};_0x5d9e9a[_0x8a05('0x39')]=_['keys'](db[_0x8a05('0x31')]['rawAttributes']);_0x5d9e9a[_0x8a05('0x35')]=_[_0x8a05('0x36')](_0x42cb4f[_0x8a05('0x35')]);_0x5d9e9a['filters']=_[_0x8a05('0x38')](_0x5d9e9a[_0x8a05('0x39')],_0x5d9e9a[_0x8a05('0x35')]);_0x2b0bad['attributes']=_[_0x8a05('0x38')](_0x5d9e9a[_0x8a05('0x39')],qs['fields'](_0x42cb4f[_0x8a05('0x35')][_0x8a05('0x3b')]));_0x2b0bad[_0x8a05('0x3a')]=_0x2b0bad[_0x8a05('0x3a')][_0x8a05('0x3c')]?_0x2b0bad[_0x8a05('0x3a')]:_0x5d9e9a[_0x8a05('0x39')];if(_0x42cb4f[_0x8a05('0x35')][_0x8a05('0x4d')]){_0x2b0bad[_0x8a05('0x47')]=[{'all':!![]}];}_0x2b0bad=_[_0x8a05('0x44')]({},_0x2b0bad,_0x42cb4f[_0x8a05('0x46')]);return db[_0x8a05('0x31')][_0x8a05('0x4e')](_0x2b0bad)['then'](handleEntityNotFound(_0x335aec,null))['then'](respondWithResult(_0x335aec,null))[_0x8a05('0x4a')](handleError(_0x335aec,null));};exports[_0x8a05('0x4f')]=function(_0x4302ab,_0x572074){return db[_0x8a05('0x31')]['create'](_0x4302ab['body'],{})[_0x8a05('0x29')](respondWithResult(_0x572074,0xc9))[_0x8a05('0x4a')](handleError(_0x572074,null));};exports['update']=function(_0x387ea9,_0x29a0fa){if(_0x387ea9[_0x8a05('0x50')]['id']){delete _0x387ea9[_0x8a05('0x50')]['id'];}return db[_0x8a05('0x31')][_0x8a05('0x4e')]({'where':{'id':_0x387ea9['params']['id']}})['then'](handleEntityNotFound(_0x29a0fa,null))[_0x8a05('0x29')](saveUpdates(_0x387ea9['body'],null))[_0x8a05('0x29')](respondWithResult(_0x29a0fa,null))[_0x8a05('0x4a')](handleError(_0x29a0fa,null));};exports[_0x8a05('0x2a')]=function(_0x1c195d,_0xdaf25c){return db[_0x8a05('0x31')][_0x8a05('0x4e')]({'where':{'id':_0x1c195d[_0x8a05('0x4c')]['id']}})[_0x8a05('0x29')](handleEntityNotFound(_0xdaf25c,null))[_0x8a05('0x29')](removeEntity(_0xdaf25c,null))[_0x8a05('0x4a')](handleError(_0xdaf25c,null));};exports['getFields']=function(_0x33463e,_0x31db09,_0x50004b){var _0x301ebe={};var _0x5d5641={};var _0x237061;var _0x270e6f;return db[_0x8a05('0x31')][_0x8a05('0x51')]({'where':{'id':_0x33463e[_0x8a05('0x4c')]['id']}})['then'](handleEntityNotFound(_0x31db09,null))['then'](function(_0x45e129){if(_0x45e129){_0x237061=_0x45e129;_0x5d5641[_0x8a05('0x39')]=_['keys'](db[_0x8a05('0x52')][_0x8a05('0x53')]);_0x5d5641['query']=_['keys'](_0x33463e[_0x8a05('0x35')]);_0x5d5641[_0x8a05('0x37')]=_['intersection'](_0x5d5641[_0x8a05('0x39')],_0x5d5641['query']);_0x301ebe[_0x8a05('0x3a')]=_[_0x8a05('0x38')](_0x5d5641[_0x8a05('0x39')],qs[_0x8a05('0x3b')](_0x33463e[_0x8a05('0x35')][_0x8a05('0x3b')]));_0x301ebe['attributes']=_0x301ebe[_0x8a05('0x3a')][_0x8a05('0x3c')]?_0x301ebe[_0x8a05('0x3a')]:_0x5d5641['model'];_0x301ebe['order']=qs[_0x8a05('0x40')](_0x33463e[_0x8a05('0x35')][_0x8a05('0x40')]);_0x301ebe[_0x8a05('0x41')]=qs['filters'](_[_0x8a05('0x42')](_0x33463e[_0x8a05('0x35')],_0x5d5641[_0x8a05('0x37')]));if(_0x33463e['query']['filter']){_0x301ebe['where']=_[_0x8a05('0x44')](_0x301ebe[_0x8a05('0x41')],{'$or':_[_0x8a05('0x34')](_0x301ebe[_0x8a05('0x3a')],function(_0x1b9ac4){var _0x399396={};_0x399396[_0x1b9ac4]={'$like':'%'+_0x33463e[_0x8a05('0x35')][_0x8a05('0x43')]+'%'};return _0x399396;})});}_0x301ebe=_[_0x8a05('0x44')]({},_0x301ebe,_0x33463e[_0x8a05('0x46')]);return _0x237061[_0x8a05('0x54')](_0x301ebe);}})[_0x8a05('0x29')](function(_0x50339e){if(_0x50339e){_0x270e6f=_0x50339e['length'];if(!_0x33463e[_0x8a05('0x35')][_0x8a05('0x3d')](_0x8a05('0x3e'))){_0x301ebe[_0x8a05('0x1f')]=qs['limit'](_0x33463e[_0x8a05('0x35')][_0x8a05('0x1f')]);_0x301ebe[_0x8a05('0x1e')]=qs['offset'](_0x33463e[_0x8a05('0x35')][_0x8a05('0x1e')]);}return _0x237061[_0x8a05('0x54')](_0x301ebe);}})[_0x8a05('0x29')](function(_0x13af7d){if(_0x13af7d){return _0x13af7d?{'count':_0x270e6f,'rows':_0x13af7d}:null;}})[_0x8a05('0x29')](respondWithResult(_0x31db09,null))[_0x8a05('0x4a')](handleError(_0x31db09,null));};exports[_0x8a05('0x55')]=function(_0x4213cd,_0x1b6f92,_0x4b1627){var _0x4fbd6a={};var _0x236a28={};var _0x331a01;var _0x47330c;return db[_0x8a05('0x31')]['findOne']({'where':{'id':_0x4213cd[_0x8a05('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b6f92,null))['then'](function(_0x2e16a8){if(_0x2e16a8){_0x331a01=_0x2e16a8;_0x236a28[_0x8a05('0x39')]=_[_0x8a05('0x36')](db[_0x8a05('0x52')][_0x8a05('0x53')]);_0x236a28[_0x8a05('0x35')]=_['keys'](_0x4213cd[_0x8a05('0x35')]);_0x236a28[_0x8a05('0x37')]=_[_0x8a05('0x38')](_0x236a28[_0x8a05('0x39')],_0x236a28[_0x8a05('0x35')]);_0x4fbd6a[_0x8a05('0x3a')]=_['intersection'](_0x236a28[_0x8a05('0x39')],qs[_0x8a05('0x3b')](_0x4213cd[_0x8a05('0x35')]['fields']));_0x4fbd6a[_0x8a05('0x3a')]=_0x4fbd6a[_0x8a05('0x3a')][_0x8a05('0x3c')]?_0x4fbd6a[_0x8a05('0x3a')]:_0x236a28[_0x8a05('0x39')];_0x4fbd6a[_0x8a05('0x3f')]=qs[_0x8a05('0x40')](_0x4213cd[_0x8a05('0x35')][_0x8a05('0x40')]);_0x4fbd6a[_0x8a05('0x41')]=qs[_0x8a05('0x37')](_['pick'](_0x4213cd[_0x8a05('0x35')],_0x236a28[_0x8a05('0x37')]));if(_0x4213cd[_0x8a05('0x35')][_0x8a05('0x43')]){_0x4fbd6a[_0x8a05('0x41')]=_[_0x8a05('0x44')](_0x4fbd6a[_0x8a05('0x41')],{'$or':_['map'](_0x4fbd6a[_0x8a05('0x3a')],function(_0x2ca13f){var _0x11f221={};_0x11f221[_0x2ca13f]={'$like':'%'+_0x4213cd[_0x8a05('0x35')][_0x8a05('0x43')]+'%'};return _0x11f221;})});}_0x4fbd6a=_[_0x8a05('0x44')]({},_0x4fbd6a,_0x4213cd[_0x8a05('0x46')]);return _0x331a01[_0x8a05('0x55')](_0x4fbd6a);}})[_0x8a05('0x29')](function(_0x18f058){if(_0x18f058){_0x47330c=_0x18f058['length'];if(!_0x4213cd[_0x8a05('0x35')]['hasOwnProperty'](_0x8a05('0x3e'))){_0x4fbd6a[_0x8a05('0x1f')]=qs[_0x8a05('0x1f')](_0x4213cd[_0x8a05('0x35')][_0x8a05('0x1f')]);_0x4fbd6a[_0x8a05('0x1e')]=qs[_0x8a05('0x1e')](_0x4213cd[_0x8a05('0x35')][_0x8a05('0x1e')]);}return _0x331a01[_0x8a05('0x55')](_0x4fbd6a);}})[_0x8a05('0x29')](function(_0x37ae4b){if(_0x37ae4b){return _0x37ae4b?{'count':_0x47330c,'rows':_0x37ae4b}:null;}})[_0x8a05('0x29')](respondWithResult(_0x1b6f92,null))['catch'](handleError(_0x1b6f92,null));};exports[_0x8a05('0x56')]=function(_0x2c0104,_0x1be4d9,_0xc60d11){var _0x2ac9e3={};var _0x66e18c={};var _0x4b8216;var _0x3befe1;return db[_0x8a05('0x31')][_0x8a05('0x51')]({'where':{'id':_0x2c0104[_0x8a05('0x4c')]['id']}})[_0x8a05('0x29')](handleEntityNotFound(_0x1be4d9,null))[_0x8a05('0x29')](function(_0xc3beaf){if(_0xc3beaf){_0x4b8216=_0xc3beaf;_0x66e18c[_0x8a05('0x39')]=_[_0x8a05('0x36')](db[_0x8a05('0x52')][_0x8a05('0x53')]);_0x66e18c[_0x8a05('0x35')]=_[_0x8a05('0x36')](_0x2c0104[_0x8a05('0x35')]);_0x66e18c[_0x8a05('0x37')]=_['intersection'](_0x66e18c[_0x8a05('0x39')],_0x66e18c[_0x8a05('0x35')]);_0x2ac9e3['attributes']=_['intersection'](_0x66e18c[_0x8a05('0x39')],qs[_0x8a05('0x3b')](_0x2c0104[_0x8a05('0x35')][_0x8a05('0x3b')]));_0x2ac9e3[_0x8a05('0x3a')]=_0x2ac9e3['attributes']['length']?_0x2ac9e3[_0x8a05('0x3a')]:_0x66e18c[_0x8a05('0x39')];_0x2ac9e3[_0x8a05('0x3f')]=qs['sort'](_0x2c0104['query']['sort']);_0x2ac9e3[_0x8a05('0x41')]=qs['filters'](_[_0x8a05('0x42')](_0x2c0104['query'],_0x66e18c['filters']));if(_0x2c0104[_0x8a05('0x35')][_0x8a05('0x43')]){_0x2ac9e3['where']=_[_0x8a05('0x44')](_0x2ac9e3[_0x8a05('0x41')],{'$or':_['map'](_0x2ac9e3[_0x8a05('0x3a')],function(_0x54125c){var _0x796293={};_0x796293[_0x54125c]={'$like':'%'+_0x2c0104[_0x8a05('0x35')][_0x8a05('0x43')]+'%'};return _0x796293;})});}_0x2ac9e3=_[_0x8a05('0x44')]({},_0x2ac9e3,_0x2c0104[_0x8a05('0x46')]);return _0x4b8216['getDescriptions'](_0x2ac9e3);}})['then'](function(_0x3dc156){if(_0x3dc156){_0x3befe1=_0x3dc156[_0x8a05('0x3c')];if(!_0x2c0104[_0x8a05('0x35')][_0x8a05('0x3d')](_0x8a05('0x3e'))){_0x2ac9e3[_0x8a05('0x1f')]=qs[_0x8a05('0x1f')](_0x2c0104[_0x8a05('0x35')][_0x8a05('0x1f')]);_0x2ac9e3[_0x8a05('0x1e')]=qs['offset'](_0x2c0104['query']['offset']);}return _0x4b8216[_0x8a05('0x56')](_0x2ac9e3);}})['then'](function(_0xf07d01){if(_0xf07d01){return _0xf07d01?{'count':_0x3befe1,'rows':_0xf07d01}:null;}})[_0x8a05('0x29')](respondWithResult(_0x1be4d9,null))[_0x8a05('0x4a')](handleError(_0x1be4d9,null));};exports[_0x8a05('0x57')]=function(_0x21a8a1,_0x2a4ade,_0x3e34f2){var _0x6cfeaf={};var _0x111fb1={};var _0x1833de;var _0xb83adb;return db[_0x8a05('0x31')][_0x8a05('0x51')]({'where':{'id':_0x21a8a1[_0x8a05('0x4c')]['id']}})[_0x8a05('0x29')](handleEntityNotFound(_0x2a4ade,null))[_0x8a05('0x29')](function(_0x2ccfe1){if(_0x2ccfe1){_0x1833de=_0x2ccfe1;_0x111fb1[_0x8a05('0x39')]=_[_0x8a05('0x36')](db['Tag'][_0x8a05('0x53')]);_0x111fb1[_0x8a05('0x35')]=_['keys'](_0x21a8a1[_0x8a05('0x35')]);_0x111fb1['filters']=_[_0x8a05('0x38')](_0x111fb1['model'],_0x111fb1[_0x8a05('0x35')]);_0x6cfeaf[_0x8a05('0x3a')]=_[_0x8a05('0x38')](_0x111fb1[_0x8a05('0x39')],qs[_0x8a05('0x3b')](_0x21a8a1[_0x8a05('0x35')][_0x8a05('0x3b')]));_0x6cfeaf[_0x8a05('0x3a')]=_0x6cfeaf[_0x8a05('0x3a')]['length']?_0x6cfeaf[_0x8a05('0x3a')]:_0x111fb1[_0x8a05('0x39')];_0x6cfeaf[_0x8a05('0x3f')]=qs['sort'](_0x21a8a1['query'][_0x8a05('0x40')]);_0x6cfeaf[_0x8a05('0x41')]=qs[_0x8a05('0x37')](_['pick'](_0x21a8a1[_0x8a05('0x35')],_0x111fb1[_0x8a05('0x37')]));if(_0x21a8a1[_0x8a05('0x35')][_0x8a05('0x43')]){_0x6cfeaf[_0x8a05('0x41')]=_[_0x8a05('0x44')](_0x6cfeaf[_0x8a05('0x41')],{'$or':_['map'](_0x6cfeaf[_0x8a05('0x3a')],function(_0x5f5a12){var _0x1eb8dd={};_0x1eb8dd[_0x5f5a12]={'$like':'%'+_0x21a8a1[_0x8a05('0x35')]['filter']+'%'};return _0x1eb8dd;})});}_0x6cfeaf=_[_0x8a05('0x44')]({},_0x6cfeaf,_0x21a8a1['options']);return _0x1833de[_0x8a05('0x57')](_0x6cfeaf);}})[_0x8a05('0x29')](function(_0x39bc55){if(_0x39bc55){_0xb83adb=_0x39bc55[_0x8a05('0x3c')];if(!_0x21a8a1[_0x8a05('0x35')][_0x8a05('0x3d')](_0x8a05('0x3e'))){_0x6cfeaf['limit']=qs[_0x8a05('0x1f')](_0x21a8a1[_0x8a05('0x35')][_0x8a05('0x1f')]);_0x6cfeaf['offset']=qs[_0x8a05('0x1e')](_0x21a8a1[_0x8a05('0x35')][_0x8a05('0x1e')]);}return _0x1833de[_0x8a05('0x57')](_0x6cfeaf);}})[_0x8a05('0x29')](function(_0x247461){if(_0x247461){return _0x247461?{'count':_0xb83adb,'rows':_0x247461}:null;}})['then'](respondWithResult(_0x2a4ade,null))[_0x8a05('0x4a')](handleError(_0x2a4ade,null));};exports[_0x8a05('0x58')]=function(_0x494f7a,_0x2ea9f8,_0x1bc21a){if(_0x494f7a[_0x8a05('0x50')]['id']){delete _0x494f7a[_0x8a05('0x50')]['id'];}return db[_0x8a05('0x31')][_0x8a05('0x51')]({'where':{'id':_0x494f7a[_0x8a05('0x4c')]['id']}})[_0x8a05('0x29')](handleEntityNotFound(_0x2ea9f8,null))[_0x8a05('0x29')](function(_0x11435e){if(_0x11435e){return _0x11435e[_0x8a05('0x58')](_0x494f7a[_0x8a05('0x50')][_0x8a05('0x59')]||[]);}return null;})[_0x8a05('0x29')](respondWithResult(_0x2ea9f8,null))['catch'](handleError(_0x2ea9f8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 76647a2..c4a28f7 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a95=['bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_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 +var _0xef0f=['moment','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','../../config/logger','api'];(function(_0x2fe3b9,_0x5de54e){var _0xec07e3=function(_0x2841f){while(--_0x2841f){_0x2fe3b9['push'](_0x2fe3b9['shift']());}};_0xec07e3(++_0x5de54e);}(_0xef0f,0x168));var _0xfef0=function(_0x448bf4,_0x25e2ee){_0x448bf4=_0x448bf4-0x0;var _0x3faba2=_0xef0f[_0x448bf4];return _0x3faba2;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require('bluebird');var rp=require(_0xfef0('0x4'));var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require('../../config/environment');var attributes=require(_0xfef0('0x7'));module[_0xfef0('0x8')]=function(_0x2697df,_0x315a8c){return _0x2697df[_0xfef0('0x9')](_0xfef0('0xa'),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 7c807ea..ec71fe9 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 _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 +var _0x9893=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3fc206,_0x1fae09){var _0x411af1=function(_0x380578){while(--_0x380578){_0x3fc206['push'](_0x3fc206['shift']());}};_0x411af1(++_0x1fae09);}(_0x9893,0x162));var _0x3989=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9893[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3989('0x0'));var moment=require(_0x3989('0x1'));var BPromise=require(_0x3989('0x2'));var rs=require(_0x3989('0x3'));var fs=require('fs');var Redis=require(_0x3989('0x4'));var db=require(_0x3989('0x5'))['db'];var utils=require(_0x3989('0x6'));var logger=require('../../config/logger')(_0x3989('0x7'));var config=require(_0x3989('0x8'));var jayson=require(_0x3989('0x9'));var client=jayson['client'][_0x3989('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b62a0,_0x89c63f,_0x333ef8){return new BPromise(function(_0x4dc9b7,_0x4e173f){return client[_0x3989('0xb')](_0x1b62a0,_0x333ef8)[_0x3989('0xc')](function(_0x4688d4){logger[_0x3989('0xd')](_0x3989('0xe'),_0x89c63f,_0x3989('0xf'));logger[_0x3989('0x10')](_0x3989('0x11'),_0x89c63f,_0x3989('0xf'),JSON[_0x3989('0x12')](_0x4688d4));if(_0x4688d4[_0x3989('0x13')]){if(_0x4688d4[_0x3989('0x13')][_0x3989('0x14')]===0x1f4){logger['error'](_0x3989('0xe'),_0x89c63f,_0x4688d4[_0x3989('0x13')]['message']);return _0x4e173f(_0x4688d4[_0x3989('0x13')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x89c63f,_0x4688d4[_0x3989('0x13')][_0x3989('0x15')]);return _0x4dc9b7(_0x4688d4[_0x3989('0x13')][_0x3989('0x15')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x89c63f,'request\x20sent');_0x4dc9b7(_0x4688d4[_0x3989('0x16')][_0x3989('0x15')]);}})[_0x3989('0x17')](function(_0x19b77c){logger[_0x3989('0x13')](_0x3989('0xe'),_0x89c63f,_0x19b77c);_0x4e173f(_0x19b77c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 331d63c..865d71a 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 _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 +var _0x4739=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','create','update','destroy','exports','multer','util','path'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x4739,0x18d));var _0x9473=function(_0x16a917,_0x4b31c5){_0x16a917=_0x16a917-0x0;var _0x35df6c=_0x4739[_0x16a917];return _0x35df6c;};'use strict';var multer=require(_0x9473('0x0'));var util=require(_0x9473('0x1'));var path=require(_0x9473('0x2'));var timeout=require(_0x9473('0x3'));var express=require(_0x9473('0x4'));var router=express[_0x9473('0x5')]();var fs_extra=require(_0x9473('0x6'));var auth=require(_0x9473('0x7'));var interaction=require(_0x9473('0x8'));var config=require(_0x9473('0x9'));var controller=require(_0x9473('0xa'));router['get']('/',auth[_0x9473('0xb')](),controller[_0x9473('0xc')]);router[_0x9473('0xd')](_0x9473('0xe'),auth[_0x9473('0xb')](),controller[_0x9473('0xf')]);router['post']('/',auth[_0x9473('0xb')](),controller[_0x9473('0x10')]);router['put']('/:id',auth[_0x9473('0xb')](),controller[_0x9473('0x11')]);router['delete'](_0x9473('0xe'),auth[_0x9473('0xb')](),controller[_0x9473('0x12')]);module[_0x9473('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0937411..9ff6034 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 _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 +var _0xca71=['customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable'];(function(_0x4a9ebe,_0x453c87){var _0x185310=function(_0x1bd7cd){while(--_0x1bd7cd){_0x4a9ebe['push'](_0x4a9ebe['shift']());}};_0x185310(++_0x453c87);}(_0xca71,0x179));var _0x1ca7=function(_0x1118eb,_0x476f0a){_0x1118eb=_0x1118eb-0x0;var _0x2dbcd0=_0xca71[_0x1118eb];return _0x2dbcd0;};'use strict';var Sequelize=require(_0x1ca7('0x0'));module[_0x1ca7('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1ca7('0x2'),_0x1ca7('0x3'),_0x1ca7('0x4'),_0x1ca7('0x5')),'defaultValue':_0x1ca7('0x6')},'content':{'type':Sequelize[_0x1ca7('0x7')]},'key':{'type':Sequelize[_0x1ca7('0x7')]},'keyType':{'type':Sequelize[_0x1ca7('0x8')](_0x1ca7('0x6'),_0x1ca7('0x2'),_0x1ca7('0x3'))},'keyContent':{'type':Sequelize[_0x1ca7('0x7')]},'idField':{'type':Sequelize[_0x1ca7('0x7')]},'nameField':{'type':Sequelize[_0x1ca7('0x7')]},'customField':{'type':Sequelize[_0x1ca7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ca7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index cff3ee7..fc2eb24 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 _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 +var _0xeca7=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','ZendeskField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0xeca7,0xba));var _0x7eca=function(_0x489250,_0x5e9468){_0x489250=_0x489250-0x0;var _0x1283e5=_0xeca7[_0x489250];return _0x1283e5;};'use strict';var emlformat=require(_0x7eca('0x0'));var rimraf=require(_0x7eca('0x1'));var zipdir=require(_0x7eca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7eca('0x3'));var moment=require(_0x7eca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7eca('0x5'));var util=require(_0x7eca('0x6'));var path=require('path');var sox=require(_0x7eca('0x7'));var csv=require(_0x7eca('0x8'));var ejs=require(_0x7eca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7eca('0xa'));var squel=require(_0x7eca('0xb'));var crypto=require(_0x7eca('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7eca('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7eca('0xe'));var Redis=require('ioredis');var authService=require(_0x7eca('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7eca('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7eca('0x11'));var utils=require(_0x7eca('0x12'));var config=require(_0x7eca('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7eca('0x14'))['db'];function respondWithStatusCode(_0x215e7b,_0x4ec732){_0x4ec732=_0x4ec732||0xcc;return function(_0x50376c){if(_0x50376c){return _0x215e7b[_0x7eca('0x15')](_0x4ec732);}return _0x215e7b[_0x7eca('0x16')](_0x4ec732)[_0x7eca('0x17')]();};}function respondWithResult(_0x4161ae,_0x3db83c){_0x3db83c=_0x3db83c||0xc8;return function(_0xe09302){if(_0xe09302){return _0x4161ae[_0x7eca('0x16')](_0x3db83c)['json'](_0xe09302);}};}function respondWithFilteredResult(_0x38b246,_0x7d640e){return function(_0x11aa7e){if(_0x11aa7e){var _0x3f70a2=typeof _0x7d640e[_0x7eca('0x18')]===_0x7eca('0x19')&&typeof _0x7d640e[_0x7eca('0x1a')]===_0x7eca('0x19');var _0x4ae0bc=_0x11aa7e['count'];var _0xc91f60=_0x3f70a2?0x0:_0x7d640e[_0x7eca('0x18')];var _0x499e44=_0x3f70a2?_0x11aa7e['count']:_0x7d640e[_0x7eca('0x18')]+_0x7d640e[_0x7eca('0x1a')];var _0x242dad;if(_0x499e44>=_0x4ae0bc){_0x499e44=_0x4ae0bc;_0x242dad=0xc8;}else{_0x242dad=0xce;}_0x38b246['status'](_0x242dad);return _0x38b246[_0x7eca('0x1b')](_0x7eca('0x1c'),_0xc91f60+'-'+_0x499e44+'/'+_0x4ae0bc)['json'](_0x11aa7e);}return null;};}function patchUpdates(_0x21a6e2){return function(_0x2b1c00){try{jsonpatch['apply'](_0x2b1c00,_0x21a6e2,!![]);}catch(_0x1b26ca){return BPromise[_0x7eca('0x1d')](_0x1b26ca);}return _0x2b1c00[_0x7eca('0x1e')]();};}function saveUpdates(_0x2ef737,_0x332d79){return function(_0x5a0970){if(_0x5a0970){return _0x5a0970[_0x7eca('0x1f')](_0x2ef737)[_0x7eca('0x20')](function(_0x42f31b){return _0x42f31b;});}return null;};}function removeEntity(_0x4de8c3,_0x1c1615){return function(_0x185021){if(_0x185021){return _0x185021[_0x7eca('0x21')]()['then'](function(){_0x4de8c3[_0x7eca('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bcd46,_0x1d0463){return function(_0x330e98){if(!_0x330e98){_0x5bcd46[_0x7eca('0x15')](0x194);}return _0x330e98;};}function handleError(_0x2171aa,_0x5df84e){_0x5df84e=_0x5df84e||0x1f4;return function(_0x4deec1){logger[_0x7eca('0x22')](_0x4deec1[_0x7eca('0x23')]);if(_0x4deec1['name']){delete _0x4deec1[_0x7eca('0x24')];}_0x2171aa['status'](_0x5df84e)[_0x7eca('0x25')](_0x4deec1);};}exports['index']=function(_0x13fdf1,_0x4019d9){var _0x32089c={},_0x1fc224={},_0x311341={'count':0x0,'rows':[]};var _0x349e0c=_[_0x7eca('0x26')](db[_0x7eca('0x27')]['rawAttributes'],function(_0x2bd8ef){return{'name':_0x2bd8ef[_0x7eca('0x28')],'type':_0x2bd8ef[_0x7eca('0x29')][_0x7eca('0x2a')]};});_0x1fc224[_0x7eca('0x2b')]=_[_0x7eca('0x26')](_0x349e0c,_0x7eca('0x24'));_0x1fc224[_0x7eca('0x2c')]=_[_0x7eca('0x2d')](_0x13fdf1[_0x7eca('0x2c')]);_0x1fc224[_0x7eca('0x2e')]=_[_0x7eca('0x2f')](_0x1fc224[_0x7eca('0x2b')],_0x1fc224[_0x7eca('0x2c')]);_0x32089c[_0x7eca('0x30')]=_['intersection'](_0x1fc224['model'],qs[_0x7eca('0x31')](_0x13fdf1[_0x7eca('0x2c')][_0x7eca('0x31')]));_0x32089c['attributes']=_0x32089c['attributes'][_0x7eca('0x32')]?_0x32089c[_0x7eca('0x30')]:_0x1fc224[_0x7eca('0x2b')];if(!_0x13fdf1[_0x7eca('0x2c')][_0x7eca('0x33')](_0x7eca('0x34'))){_0x32089c[_0x7eca('0x1a')]=qs[_0x7eca('0x1a')](_0x13fdf1['query']['limit']);_0x32089c['offset']=qs[_0x7eca('0x18')](_0x13fdf1[_0x7eca('0x2c')][_0x7eca('0x18')]);}_0x32089c[_0x7eca('0x35')]=qs['sort'](_0x13fdf1['query']['sort']);_0x32089c['where']=qs['filters'](_[_0x7eca('0x36')](_0x13fdf1[_0x7eca('0x2c')],_0x1fc224[_0x7eca('0x2e')]),_0x349e0c);if(_0x13fdf1[_0x7eca('0x2c')][_0x7eca('0x37')]){_0x32089c['where']=_['merge'](_0x32089c[_0x7eca('0x38')],{'$or':_['map'](_0x349e0c,function(_0x31805c){if(_0x31805c[_0x7eca('0x29')]!==_0x7eca('0x39')){var _0x1ec9e5={};_0x1ec9e5[_0x31805c[_0x7eca('0x24')]]={'$like':'%'+_0x13fdf1[_0x7eca('0x2c')]['filter']+'%'};return _0x1ec9e5;}})});}_0x32089c=_[_0x7eca('0x3a')]({},_0x32089c,_0x13fdf1[_0x7eca('0x3b')]);var _0x5deeb2={'where':_0x32089c['where']};return db[_0x7eca('0x27')][_0x7eca('0x3c')](_0x5deeb2)[_0x7eca('0x20')](function(_0x4c1fde){_0x311341['count']=_0x4c1fde;if(_0x13fdf1[_0x7eca('0x2c')][_0x7eca('0x3d')]){_0x32089c['include']=[{'all':!![]}];}return db['ZendeskField'][_0x7eca('0x3e')](_0x32089c);})[_0x7eca('0x20')](function(_0x20a9de){_0x311341[_0x7eca('0x3f')]=_0x20a9de;return _0x311341;})[_0x7eca('0x20')](respondWithFilteredResult(_0x4019d9,_0x32089c))[_0x7eca('0x40')](handleError(_0x4019d9,null));};exports[_0x7eca('0x41')]=function(_0xf61005,_0x3d2d7b){var _0x38b296={'raw':!![],'where':{'id':_0xf61005['params']['id']}},_0x53d0aa={};_0x53d0aa['model']=_['keys'](db[_0x7eca('0x27')][_0x7eca('0x42')]);_0x53d0aa[_0x7eca('0x2c')]=_[_0x7eca('0x2d')](_0xf61005[_0x7eca('0x2c')]);_0x53d0aa[_0x7eca('0x2e')]=_[_0x7eca('0x2f')](_0x53d0aa[_0x7eca('0x2b')],_0x53d0aa[_0x7eca('0x2c')]);_0x38b296[_0x7eca('0x30')]=_[_0x7eca('0x2f')](_0x53d0aa['model'],qs[_0x7eca('0x31')](_0xf61005[_0x7eca('0x2c')]['fields']));_0x38b296[_0x7eca('0x30')]=_0x38b296[_0x7eca('0x30')][_0x7eca('0x32')]?_0x38b296[_0x7eca('0x30')]:_0x53d0aa['model'];if(_0xf61005['query'][_0x7eca('0x3d')]){_0x38b296['include']=[{'all':!![]}];}_0x38b296=_['merge']({},_0x38b296,_0xf61005[_0x7eca('0x3b')]);return db[_0x7eca('0x27')][_0x7eca('0x43')](_0x38b296)[_0x7eca('0x20')](handleEntityNotFound(_0x3d2d7b,null))[_0x7eca('0x20')](respondWithResult(_0x3d2d7b,null))[_0x7eca('0x40')](handleError(_0x3d2d7b,null));};exports[_0x7eca('0x44')]=function(_0x61d8c0,_0x1b27d8){return db[_0x7eca('0x27')][_0x7eca('0x44')](_0x61d8c0['body'],{})[_0x7eca('0x20')](respondWithResult(_0x1b27d8,0xc9))['catch'](handleError(_0x1b27d8,null));};exports[_0x7eca('0x1f')]=function(_0x21359b,_0x4e834a){if(_0x21359b[_0x7eca('0x45')]['id']){delete _0x21359b[_0x7eca('0x45')]['id'];}return db[_0x7eca('0x27')][_0x7eca('0x43')]({'where':{'id':_0x21359b[_0x7eca('0x46')]['id']}})[_0x7eca('0x20')](handleEntityNotFound(_0x4e834a,null))[_0x7eca('0x20')](saveUpdates(_0x21359b['body'],null))[_0x7eca('0x20')](respondWithResult(_0x4e834a,null))[_0x7eca('0x40')](handleError(_0x4e834a,null));};exports['destroy']=function(_0x8a40bb,_0x59f81f){return db['ZendeskField'][_0x7eca('0x43')]({'where':{'id':_0x8a40bb[_0x7eca('0x46')]['id']}})['then'](handleEntityNotFound(_0x59f81f,null))['then'](removeEntity(_0x59f81f,null))['catch'](handleError(_0x59f81f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 623aba4..753dfb6 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 _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 +var _0x6b97=['exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b97,0x180));var _0x76b9=function(_0x1c50d3,_0x12c737){_0x1c50d3=_0x1c50d3-0x0;var _0x281903=_0x6b97[_0x1c50d3];return _0x281903;};'use strict';var _=require(_0x76b9('0x0'));var util=require('util');var logger=require(_0x76b9('0x1'))(_0x76b9('0x2'));var moment=require('moment');var BPromise=require(_0x76b9('0x3'));var rp=require(_0x76b9('0x4'));var fs=require('fs');var path=require(_0x76b9('0x5'));var rimraf=require('rimraf');var config=require(_0x76b9('0x6'));var attributes=require(_0x76b9('0x7'));module[_0x76b9('0x8')]=function(_0x1db558,_0x146caf){return _0x1db558[_0x76b9('0x9')](_0x76b9('0xa'),attributes,{'tableName':_0x76b9('0xb'),'paranoid':![],'indexes':[{'name':_0x76b9('0xc'),'fields':['idField',_0x76b9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index f904937..76c437c 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 _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 +var _0x0186=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','ZendeskField,\x20%s,\x20%s','error','message','result','lodash','util','ioredis'];(function(_0x43f338,_0x348510){var _0x3ad4c8=function(_0x3d9991){while(--_0x3d9991){_0x43f338['push'](_0x43f338['shift']());}};_0x3ad4c8(++_0x348510);}(_0x0186,0x166));var _0x6018=function(_0xdee293,_0x400066){_0xdee293=_0xdee293-0x0;var _0x266875=_0x0186[_0xdee293];return _0x266875;};'use strict';var _=require(_0x6018('0x0'));var util=require(_0x6018('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6018('0x2'));var db=require(_0x6018('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6018('0x4'))(_0x6018('0x5'));var config=require(_0x6018('0x6'));var jayson=require(_0x6018('0x7'));var client=jayson[_0x6018('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x261102,_0xe52380,_0x431675){return new BPromise(function(_0x213644,_0x5eb36e){return client[_0x6018('0x9')](_0x261102,_0x431675)['then'](function(_0x44c120){logger['info']('ZendeskField,\x20%s,\x20%s',_0xe52380,_0x6018('0xa'));logger[_0x6018('0xb')](_0x6018('0xc'),_0xe52380,_0x6018('0xa'),JSON[_0x6018('0xd')](_0x44c120));if(_0x44c120['error']){if(_0x44c120['error'][_0x6018('0xe')]===0x1f4){logger['error'](_0x6018('0xf'),_0xe52380,_0x44c120[_0x6018('0x10')][_0x6018('0x11')]);return _0x5eb36e(_0x44c120['error'][_0x6018('0x11')]);}logger[_0x6018('0x10')]('ZendeskField,\x20%s,\x20%s',_0xe52380,_0x44c120['error'][_0x6018('0x11')]);return _0x213644(_0x44c120[_0x6018('0x10')][_0x6018('0x11')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0xe52380,'request\x20sent');_0x213644(_0x44c120[_0x6018('0x12')][_0x6018('0x11')]);}})['catch'](function(_0x1eea80){logger[_0x6018('0x10')]('ZendeskField,\x20%s,\x20%s',_0xe52380,_0x1eea80);_0x5eb36e(_0x1eea80);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 401275c..7566bfa 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 _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 +var _0xe970=['getFields','create','post','/:id/configurations','update','destroy','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','/:id','show','/:id/fields'];(function(_0x2af504,_0x46a924){var _0x2abb2e=function(_0x53f705){while(--_0x53f705){_0x2af504['push'](_0x2af504['shift']());}};_0x2abb2e(++_0x46a924);}(_0xe970,0x15b));var _0x0e97=function(_0x2b78d9,_0x44cb44){_0x2b78d9=_0x2b78d9-0x0;var _0x502e43=_0xe970[_0x2b78d9];return _0x502e43;};'use strict';var multer=require(_0x0e97('0x0'));var util=require(_0x0e97('0x1'));var path=require(_0x0e97('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0e97('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0e97('0x4'));var config=require(_0x0e97('0x5'));var controller=require(_0x0e97('0x6'));router['get']('/',auth[_0x0e97('0x7')](),controller[_0x0e97('0x8')]);router[_0x0e97('0x9')](_0x0e97('0xa'),auth['isAuthenticated'](),controller[_0x0e97('0xb')]);router['get']('/:id/configurations',auth[_0x0e97('0x7')](),controller['getConfigurations']);router[_0x0e97('0x9')](_0x0e97('0xc'),auth['isAuthenticated'](),controller[_0x0e97('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e97('0xe')]);router[_0x0e97('0xf')](_0x0e97('0x10'),auth[_0x0e97('0x7')](),controller['addConfiguration']);router['put'](_0x0e97('0xa'),auth[_0x0e97('0x7')](),controller[_0x0e97('0x11')]);router['delete'](_0x0e97('0xa'),auth[_0x0e97('0x7')](),controller[_0x0e97('0x12')]);module[_0x0e97('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index c96ac2f..bcb10fc 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 _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 +var _0x4c4e=['sequelize','STRING'];(function(_0x53d402,_0x48e1fd){var _0x5b1a32=function(_0x2b89e8){while(--_0x2b89e8){_0x53d402['push'](_0x53d402['shift']());}};_0x5b1a32(++_0x48e1fd);}(_0x4c4e,0x152));var _0xe4c4=function(_0x8edcac,_0x27c54a){_0x8edcac=_0x8edcac-0x0;var _0x390e27=_0x4c4e[_0x8edcac];return _0x390e27;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4c4('0x1')]},'description':{'type':Sequelize[_0xe4c4('0x1')]},'host':{'type':Sequelize[_0xe4c4('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xe4c4('0x1')]},'clientSecret':{'type':Sequelize[_0xe4c4('0x1')]},'serverUrl':{'type':Sequelize[_0xe4c4('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xe4c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9792d0a..ec91971 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 _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 +var _0xbb0a=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','pick','filters','filter','where','merge','VIRTUAL','ZohoAccount','includeAll','findAll','rows','show','params','length','options','find','catch','create','body','destroy','findOne','keys','ZohoConfiguration','order','getConfigurations','AccountId','Subjects','getSubjects','channel','type','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','serverUrl','zoho.eu','slice','substring','lastIndexOf','GET','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','includes','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv'];(function(_0x58e32c,_0x309781){var _0x481e60=function(_0x5326ab){while(--_0x5326ab){_0x58e32c['push'](_0x58e32c['shift']());}};_0x481e60(++_0x309781);}(_0xbb0a,0x16c));var _0xabb0=function(_0x3c4a87,_0x1c03fe){_0x3c4a87=_0x3c4a87-0x0;var _0x21650a=_0xbb0a[_0x3c4a87];return _0x21650a;};'use strict';var emlformat=require(_0xabb0('0x0'));var rimraf=require(_0xabb0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xabb0('0x2'));var BPromise=require(_0xabb0('0x3'));var Mustache=require(_0xabb0('0x4'));var util=require('util');var path=require(_0xabb0('0x5'));var sox=require(_0xabb0('0x6'));var csv=require('to-csv');var ejs=require(_0xabb0('0x7'));var fs=require('fs');var fs_extra=require(_0xabb0('0x8'));var _=require(_0xabb0('0x9'));var squel=require(_0xabb0('0xa'));var crypto=require(_0xabb0('0xb'));var jsforce=require(_0xabb0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xabb0('0xd'));var querystring=require(_0xabb0('0xe'));var Papa=require('papaparse');var Redis=require(_0xabb0('0xf'));var authService=require(_0xabb0('0x10'));var qs=require(_0xabb0('0x11'));var as=require(_0xabb0('0x12'));var hardwareService=require(_0xabb0('0x13'));var logger=require(_0xabb0('0x14'))(_0xabb0('0x15'));var utils=require(_0xabb0('0x16'));var config=require(_0xabb0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xabb0('0x18'))['db'];var integrations=require(_0xabb0('0x19'));function respondWithStatusCode(_0x2bb7b6,_0x43cd63){_0x43cd63=_0x43cd63||0xcc;return function(_0xc01909){if(_0xc01909){return _0x2bb7b6[_0xabb0('0x1a')](_0x43cd63);}return _0x2bb7b6[_0xabb0('0x1b')](_0x43cd63)[_0xabb0('0x1c')]();};}function respondWithResult(_0x245d06,_0x1d1fc7){_0x1d1fc7=_0x1d1fc7||0xc8;return function(_0x5bb11b){if(_0x5bb11b){return _0x245d06[_0xabb0('0x1b')](_0x1d1fc7)[_0xabb0('0x1d')](_0x5bb11b);}};}function respondWithFilteredResult(_0x5e8eaa,_0x1961ac){return function(_0x52124d){if(_0x52124d){var _0x2de037=typeof _0x1961ac[_0xabb0('0x1e')]==='undefined'&&typeof _0x1961ac['limit']==='undefined';var _0x5d6f82=_0x52124d[_0xabb0('0x1f')];var _0x4b3505=_0x2de037?0x0:_0x1961ac[_0xabb0('0x1e')];var _0x3a7641=_0x2de037?_0x52124d[_0xabb0('0x1f')]:_0x1961ac['offset']+_0x1961ac['limit'];var _0x4bf0e4;if(_0x3a7641>=_0x5d6f82){_0x3a7641=_0x5d6f82;_0x4bf0e4=0xc8;}else{_0x4bf0e4=0xce;}_0x5e8eaa[_0xabb0('0x1b')](_0x4bf0e4);return _0x5e8eaa[_0xabb0('0x20')]('Content-Range',_0x4b3505+'-'+_0x3a7641+'/'+_0x5d6f82)[_0xabb0('0x1d')](_0x52124d);}return null;};}function patchUpdates(_0x33957d){return function(_0x176cab){try{jsonpatch[_0xabb0('0x21')](_0x176cab,_0x33957d,!![]);}catch(_0x3fd315){return BPromise[_0xabb0('0x22')](_0x3fd315);}return _0x176cab[_0xabb0('0x23')]();};}function saveUpdates(_0x185292,_0x296c67){return function(_0x168cf3){if(_0x168cf3){return _0x168cf3[_0xabb0('0x24')](_0x185292)[_0xabb0('0x25')](function(_0x1b491d){return _0x1b491d;});}return null;};}function removeEntity(_0x31bb15,_0x22a131){return function(_0x228c4a){if(_0x228c4a){return _0x228c4a['destroy']()[_0xabb0('0x25')](function(){_0x31bb15['status'](0xcc)[_0xabb0('0x1c')]();});}};}function handleEntityNotFound(_0x2863af,_0x26f2d0){return function(_0x56d296){if(!_0x56d296){_0x2863af[_0xabb0('0x1a')](0x194);}return _0x56d296;};}function handleError(_0x53feb3,_0x281d6e){_0x281d6e=_0x281d6e||0x1f4;return function(_0x54a5be){logger[_0xabb0('0x26')](_0x54a5be[_0xabb0('0x27')]);if(_0x54a5be[_0xabb0('0x28')]){delete _0x54a5be['name'];}_0x53feb3[_0xabb0('0x1b')](_0x281d6e)['send'](_0x54a5be);};}exports[_0xabb0('0x29')]=function(_0x42aedf,_0x4bf261){var _0x286232={},_0x4a0f96={},_0x1d9c5b={'count':0x0,'rows':[]};var _0x5412bf=_[_0xabb0('0x2a')](db['ZohoAccount'][_0xabb0('0x2b')],function(_0x5e12fa){return{'name':_0x5e12fa[_0xabb0('0x2c')],'type':_0x5e12fa['type']['key']};});_0x4a0f96[_0xabb0('0x2d')]=_[_0xabb0('0x2a')](_0x5412bf,_0xabb0('0x28'));_0x4a0f96[_0xabb0('0x2e')]=_['keys'](_0x42aedf[_0xabb0('0x2e')]);_0x4a0f96['filters']=_[_0xabb0('0x2f')](_0x4a0f96[_0xabb0('0x2d')],_0x4a0f96[_0xabb0('0x2e')]);_0x286232['attributes']=_[_0xabb0('0x2f')](_0x4a0f96[_0xabb0('0x2d')],qs[_0xabb0('0x30')](_0x42aedf[_0xabb0('0x2e')][_0xabb0('0x30')]));_0x286232[_0xabb0('0x31')]=_0x286232[_0xabb0('0x31')]['length']?_0x286232['attributes']:_0x4a0f96[_0xabb0('0x2d')];if(!_0x42aedf[_0xabb0('0x2e')][_0xabb0('0x32')](_0xabb0('0x33'))){_0x286232[_0xabb0('0x34')]=qs[_0xabb0('0x34')](_0x42aedf[_0xabb0('0x2e')][_0xabb0('0x34')]);_0x286232[_0xabb0('0x1e')]=qs[_0xabb0('0x1e')](_0x42aedf[_0xabb0('0x2e')]['offset']);}_0x286232['order']=qs[_0xabb0('0x35')](_0x42aedf[_0xabb0('0x2e')]['sort']);_0x286232['where']=qs['filters'](_[_0xabb0('0x36')](_0x42aedf[_0xabb0('0x2e')],_0x4a0f96[_0xabb0('0x37')]),_0x5412bf);if(_0x42aedf[_0xabb0('0x2e')][_0xabb0('0x38')]){_0x286232[_0xabb0('0x39')]=_[_0xabb0('0x3a')](_0x286232[_0xabb0('0x39')],{'$or':_[_0xabb0('0x2a')](_0x5412bf,function(_0x711105){if(_0x711105['type']!==_0xabb0('0x3b')){var _0x1c796f={};_0x1c796f[_0x711105['name']]={'$like':'%'+_0x42aedf['query'][_0xabb0('0x38')]+'%'};return _0x1c796f;}})});}_0x286232=_['merge']({},_0x286232,_0x42aedf['options']);var _0xa277d7={'where':_0x286232['where']};return db[_0xabb0('0x3c')]['count'](_0xa277d7)[_0xabb0('0x25')](function(_0x26a244){_0x1d9c5b[_0xabb0('0x1f')]=_0x26a244;if(_0x42aedf[_0xabb0('0x2e')][_0xabb0('0x3d')]){_0x286232['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xabb0('0x3e')](_0x286232);})[_0xabb0('0x25')](function(_0x128dc1){_0x1d9c5b[_0xabb0('0x3f')]=_0x128dc1;return _0x1d9c5b;})['then'](respondWithFilteredResult(_0x4bf261,_0x286232))['catch'](handleError(_0x4bf261,null));};exports[_0xabb0('0x40')]=function(_0x2da64d,_0x15861b){var _0x407534={'raw':![],'where':{'id':_0x2da64d[_0xabb0('0x41')]['id']}},_0x5892cb={};_0x5892cb[_0xabb0('0x2d')]=_['keys'](db[_0xabb0('0x3c')][_0xabb0('0x2b')]);_0x5892cb[_0xabb0('0x2e')]=_['keys'](_0x2da64d['query']);_0x5892cb['filters']=_[_0xabb0('0x2f')](_0x5892cb[_0xabb0('0x2d')],_0x5892cb['query']);_0x407534[_0xabb0('0x31')]=_[_0xabb0('0x2f')](_0x5892cb['model'],qs[_0xabb0('0x30')](_0x2da64d[_0xabb0('0x2e')]['fields']));_0x407534[_0xabb0('0x31')]=_0x407534[_0xabb0('0x31')][_0xabb0('0x42')]?_0x407534['attributes']:_0x5892cb[_0xabb0('0x2d')];if(_0x2da64d[_0xabb0('0x2e')][_0xabb0('0x3d')]){_0x407534['include']=[{'all':!![]}];}_0x407534=_['merge']({},_0x407534,_0x2da64d[_0xabb0('0x43')]);return db['ZohoAccount'][_0xabb0('0x44')](_0x407534)[_0xabb0('0x25')](handleEntityNotFound(_0x15861b,null))[_0xabb0('0x25')](respondWithResult(_0x15861b,null))[_0xabb0('0x45')](handleError(_0x15861b,null));};exports[_0xabb0('0x46')]=function(_0x2aa5e9,_0x36218b){return db[_0xabb0('0x3c')][_0xabb0('0x46')](_0x2aa5e9['body'],{})[_0xabb0('0x25')](respondWithResult(_0x36218b,0xc9))[_0xabb0('0x45')](handleError(_0x36218b,null));};exports[_0xabb0('0x24')]=function(_0x10739c,_0x7f8aed){if(_0x10739c[_0xabb0('0x47')]['id']){delete _0x10739c[_0xabb0('0x47')]['id'];}return db['ZohoAccount'][_0xabb0('0x44')]({'where':{'id':_0x10739c[_0xabb0('0x41')]['id']}})['then'](handleEntityNotFound(_0x7f8aed,null))[_0xabb0('0x25')](saveUpdates(_0x10739c[_0xabb0('0x47')],null))[_0xabb0('0x25')](respondWithResult(_0x7f8aed,null))[_0xabb0('0x45')](handleError(_0x7f8aed,null));};exports[_0xabb0('0x48')]=function(_0x4a3775,_0x105cc7){return db[_0xabb0('0x3c')]['find']({'where':{'id':_0x4a3775[_0xabb0('0x41')]['id']}})['then'](handleEntityNotFound(_0x105cc7,null))[_0xabb0('0x25')](removeEntity(_0x105cc7,null))[_0xabb0('0x45')](handleError(_0x105cc7,null));};exports['getConfigurations']=function(_0x3b1a6b,_0x2aaed6,_0x5cd986){var _0x407675={};var _0x2536e6={};var _0x479248;var _0x29c244;return db[_0xabb0('0x3c')][_0xabb0('0x49')]({'where':{'id':_0x3b1a6b[_0xabb0('0x41')]['id']}})[_0xabb0('0x25')](handleEntityNotFound(_0x2aaed6,null))[_0xabb0('0x25')](function(_0x7d0f24){if(_0x7d0f24){_0x479248=_0x7d0f24;_0x2536e6[_0xabb0('0x2d')]=_[_0xabb0('0x4a')](db[_0xabb0('0x4b')]['rawAttributes']);_0x2536e6[_0xabb0('0x2e')]=_[_0xabb0('0x4a')](_0x3b1a6b[_0xabb0('0x2e')]);_0x2536e6['filters']=_[_0xabb0('0x2f')](_0x2536e6[_0xabb0('0x2d')],_0x2536e6['query']);_0x407675[_0xabb0('0x31')]=_[_0xabb0('0x2f')](_0x2536e6[_0xabb0('0x2d')],qs['fields'](_0x3b1a6b[_0xabb0('0x2e')]['fields']));_0x407675[_0xabb0('0x31')]=_0x407675[_0xabb0('0x31')][_0xabb0('0x42')]?_0x407675[_0xabb0('0x31')]:_0x2536e6['model'];_0x407675[_0xabb0('0x4c')]=qs[_0xabb0('0x35')](_0x3b1a6b[_0xabb0('0x2e')][_0xabb0('0x35')]);_0x407675[_0xabb0('0x39')]=qs[_0xabb0('0x37')](_['pick'](_0x3b1a6b[_0xabb0('0x2e')],_0x2536e6[_0xabb0('0x37')]));if(_0x3b1a6b['query'][_0xabb0('0x38')]){_0x407675[_0xabb0('0x39')]=_[_0xabb0('0x3a')](_0x407675['where'],{'$or':_[_0xabb0('0x2a')](_0x407675['attributes'],function(_0x261802){var _0x3b0f4e={};_0x3b0f4e[_0x261802]={'$like':'%'+_0x3b1a6b['query'][_0xabb0('0x38')]+'%'};return _0x3b0f4e;})});}_0x407675=_['merge']({},_0x407675,_0x3b1a6b['options']);return _0x479248[_0xabb0('0x4d')](_0x407675);}})[_0xabb0('0x25')](function(_0x44f1d0){if(_0x44f1d0){_0x29c244=_0x44f1d0['length'];if(!_0x3b1a6b[_0xabb0('0x2e')][_0xabb0('0x32')](_0xabb0('0x33'))){_0x407675['limit']=qs[_0xabb0('0x34')](_0x3b1a6b[_0xabb0('0x2e')]['limit']);_0x407675[_0xabb0('0x1e')]=qs[_0xabb0('0x1e')](_0x3b1a6b[_0xabb0('0x2e')][_0xabb0('0x1e')]);}return _0x479248['getConfigurations'](_0x407675);}})[_0xabb0('0x25')](function(_0x3fc293){if(_0x3fc293){return _0x3fc293?{'count':_0x29c244,'rows':_0x3fc293}:null;}})[_0xabb0('0x25')](respondWithResult(_0x2aaed6,null))['catch'](handleError(_0x2aaed6,null));};exports['addConfiguration']=function(_0x1aaf94,_0x59d4fc,_0x498392){if(_0x1aaf94[_0xabb0('0x47')]['id']){delete _0x1aaf94[_0xabb0('0x47')]['id'];}return db[_0xabb0('0x3c')][_0xabb0('0x49')]({'where':{'id':_0x1aaf94[_0xabb0('0x41')]['id']}})[_0xabb0('0x25')](handleEntityNotFound(_0x59d4fc,null))['then'](function(_0x2d7dc9){if(_0x2d7dc9){_0x1aaf94[_0xabb0('0x47')][_0xabb0('0x4e')]=_0x2d7dc9['id'];_0x1aaf94[_0xabb0('0x47')][_0xabb0('0x4f')]=integrations[_0xabb0('0x50')](_0x1aaf94['body'][_0xabb0('0x51')],_0x1aaf94['body'][_0xabb0('0x52')]);_0x1aaf94[_0xabb0('0x47')][_0xabb0('0x53')]=integrations['getDescriptions'](_0x1aaf94[_0xabb0('0x47')][_0xabb0('0x51')],_0x1aaf94['body'][_0xabb0('0x52')]);return db[_0xabb0('0x4b')]['create'](_0x1aaf94[_0xabb0('0x47')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xabb0('0x54')],'as':_0xabb0('0x53')}]});}return null;})[_0xabb0('0x25')](respondWithResult(_0x59d4fc,null))[_0xabb0('0x45')](handleError(_0x59d4fc,null));};function getAccessToken(_0x522942){return new Promise(function(_0x2218c3,_0x530bfc){var _0x38d063;switch(_0x522942['zone']){case'US':_0x38d063=_0xabb0('0x55');break;case'AU':_0x38d063=_0xabb0('0x56');break;case'EU':_0x38d063=_0xabb0('0x57');break;case'IN':_0x38d063=_0xabb0('0x58');break;case'CN':_0x38d063=_0xabb0('0x59');break;default:_0x38d063=_0xabb0('0x57');break;}var _0x23591b={'method':_0xabb0('0x5a'),'uri':_0x38d063+_0xabb0('0x5b'),'qs':{'refresh_token':_0x522942[_0xabb0('0x5c')],'client_id':_0x522942[_0xabb0('0x5d')],'client_secret':_0x522942[_0xabb0('0x5e')],'grant_type':_0xabb0('0x5f')},'json':!![]};return rp(_0x23591b)['then'](function(_0x4f12a1){if(_0x4f12a1[_0xabb0('0x60')]){_0x2218c3(_0x4f12a1[_0xabb0('0x60')]);}else{_0x530bfc('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x39f3d5){_0x530bfc(_0x39f3d5);});});}exports[_0xabb0('0x61')]=function(_0x3753de,_0x335ae4,_0x1a6c13){var _0x274195,_0x524351,_0x5e2383,_0x480cf3,_0x486790;return db[_0xabb0('0x3c')]['findOne']({'where':{'id':_0x3753de[_0xabb0('0x41')]['id']},'attributes':['id',_0xabb0('0x62'),_0xabb0('0x63'),_0xabb0('0x5d'),_0xabb0('0x5e'),_0xabb0('0x64'),'code',_0xabb0('0x5c')]})[_0xabb0('0x25')](handleEntityNotFound(_0x335ae4,null))[_0xabb0('0x25')](function(_0x53d524){_0x486790=_0x53d524;_0x274195=_0x486790[_0xabb0('0x62')];_0x524351=_0x274195===_0xabb0('0x65')?'eu':'com';_0x5e2383=_0x486790[_0xabb0('0x64')];var _0x12b142=_0x5e2383[_0xabb0('0x66')](-0x1);if(_0x12b142==='/'||_0x12b142==='\x5c'||_0x12b142===':'){_0x5e2383=_0x5e2383[_0xabb0('0x67')](0x0,_0x5e2383[_0xabb0('0x68')](_0x12b142));}if(!_0x486790['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x486790);})[_0xabb0('0x25')](function(_0xd4cc89){if(_0xd4cc89){return rp({'method':_0xabb0('0x69'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x524351),'qs':{'module':'Calls'},'headers':{'Authorization':_0xabb0('0x6a')+_0xd4cc89},'json':!![]});}})['then'](function(_0xed756d){if(_0xed756d){if(_0xed756d['response']&&_0xed756d[_0xabb0('0x6b')][_0xabb0('0x26')]){throw new Error(_0xed756d[_0xabb0('0x6b')]['error'][_0xabb0('0x6c')]);}var _0x25731a=[];var _0x3db11a=[];var _0x5334da=[_0xabb0('0x6d'),_0xabb0('0x6e'),_0xabb0('0x6f'),_0xabb0('0x70'),_0xabb0('0x71'),_0xabb0('0x72'),'Call_Start_Time',_0xabb0('0x73')];_0x3db11a=_['remove'](_0xed756d['fields'],function(_0x3dbc65){return _0x5334da[_0xabb0('0x74')](_0x3dbc65['api_name']);});for(var _0x2b55a5=0x0;_0x2b55a5<_0x3db11a[_0xabb0('0x42')];_0x2b55a5++){if(_0x3db11a[_0x2b55a5]['system_mandatory']===![]){_0x25731a['push']({'id':_0x3db11a[_0x2b55a5]['id'],'name':_0x3db11a[_0x2b55a5]['display_label'],'custom':_0x3db11a[_0x2b55a5][_0xabb0('0x75')],'options':_0x3db11a[_0x2b55a5][_0xabb0('0x76')]===_0xabb0('0x77')&&_0x3db11a[_0x2b55a5][_0xabb0('0x78')][_0xabb0('0x42')]>-0x1?_[_0xabb0('0x2a')](_0x3db11a[_0x2b55a5]['pick_list_values'],function(_0x23e2a8){return{'name':_0x23e2a8,'value':_0x23e2a8};}):[]});}}return{'count':_0x25731a[_0xabb0('0x42')],'rows':_0x25731a};}else{return{'count':0x0,'rows':[]};}})[_0xabb0('0x25')](respondWithResult(_0x335ae4,null))['catch'](function(_0x4b568c){var _0x1c24a8=_0x3753de['query'][_0xabb0('0x79')]?0x1f4:_0x4b568c[_0xabb0('0x7a')]||0x1f4;logger[_0xabb0('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xabb0('0x61'),_0x1c24a8,JSON[_0xabb0('0x7b')](_0x4b568c));delete _0x4b568c['name'];if(_0x1c24a8===0x191){_0x1c24a8=0x190;}_0x335ae4[_0xabb0('0x1b')](_0x1c24a8)[_0xabb0('0x7c')](_0x3753de[_0xabb0('0x2e')][_0xabb0('0x79')]?{'message':_0xabb0('0x7d'),'statusCode':_0x4b568c['statusCode']}:_0x4b568c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 73036d1..4a2e93d 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 _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 +var _0xa773=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','https://accounts.zoho.com.au','https://accounts.zoho.eu','parse','refreshToken','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa773,0x113));var _0x3a77=function(_0x1dec82,_0x4c4f21){_0x1dec82=_0x1dec82-0x0;var _0x4dd819=_0xa773[_0x1dec82];return _0x4dd819;};'use strict';var _=require(_0x3a77('0x0'));var util=require(_0x3a77('0x1'));var logger=require(_0x3a77('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3a77('0x3'));var rp=require(_0x3a77('0x4'));var fs=require('fs');var path=require(_0x3a77('0x5'));var rimraf=require(_0x3a77('0x6'));var config=require(_0x3a77('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x3a77('0x8'));module[_0x3a77('0x9')]=function(_0x290540,_0x1d77af){return _0x290540[_0x3a77('0xa')](_0x3a77('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x407e2c,_0x7f9736,_0x2976c4){if(_0x407e2c[_0x3a77('0xc')](_0x3a77('0xd'))||_0x407e2c[_0x3a77('0xc')](_0x3a77('0xe'))||_0x407e2c[_0x3a77('0xc')](_0x3a77('0xf'))||_0x407e2c[_0x3a77('0xc')](_0x3a77('0x10'))||_0x407e2c[_0x3a77('0xc')](_0x3a77('0x11'))||_0x407e2c[_0x3a77('0xc')](_0x3a77('0x12'))){var _0x42516b,_0x505e5e;_0x42516b=_0x407e2c[_0x3a77('0xe')];var _0x2b99af=_0x42516b[_0x3a77('0x13')](-0x1);if(_0x2b99af==='/'||_0x2b99af==='\x5c'||_0x2b99af===':'){_0x42516b=_0x42516b[_0x3a77('0x14')](0x0,_0x42516b['lastIndexOf'](_0x2b99af));}switch(_0x407e2c[_0x3a77('0xd')]){case'US':_0x505e5e=_0x3a77('0x15');break;case'AU':_0x505e5e='https://accounts.zoho.com.au';break;case'IN':_0x505e5e=_0x3a77('0x16');break;case'CN':_0x505e5e=_0x3a77('0x17');break;default:_0x505e5e='https://accounts.zoho.eu';break;}var _0x599285={'method':_0x3a77('0x18'),'uri':_0x505e5e+_0x3a77('0x19'),'form':{'grant_type':_0x3a77('0x1a'),'client_id':_0x407e2c[_0x3a77('0xf')],'client_secret':_0x407e2c['clientSecret'],'redirect_uri':_0x407e2c[_0x3a77('0xe')],'code':_0x407e2c[_0x3a77('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x599285)[_0x3a77('0x1b')](function(_0x11dcf0){var _0x4060e4=JSON['parse'](_0x11dcf0);if(_0x4060e4['refresh_token']){_0x407e2c['refreshToken']=_0x4060e4[_0x3a77('0x1c')];logger[_0x3a77('0x1d')](util[_0x3a77('0x1e')](_0x3a77('0x1f'),_0x407e2c[_0x3a77('0x20')],_0x407e2c['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x407e2c['name'],_0x407e2c['id']),util['inspect'](_0x4060e4,{'showHidden':![],'depth':null}));}return _0x2976c4(null,_0x7f9736);})['catch'](function(_0x57f0b1){logger[_0x3a77('0x21')](util[_0x3a77('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x407e2c['name'],_0x407e2c['id']),util[_0x3a77('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x2976c4(_0x57f0b1);});}else{return _0x2976c4(null,_0x7f9736);}},'beforeUpdate':function(_0xb1f332,_0xfff316,_0x532bee){if(_0xb1f332[_0x3a77('0xc')](_0x3a77('0xd'))||_0xb1f332[_0x3a77('0xc')](_0x3a77('0xe'))||_0xb1f332[_0x3a77('0xc')](_0x3a77('0xf'))||_0xb1f332[_0x3a77('0xc')]('clientSecret')||_0xb1f332[_0x3a77('0xc')](_0x3a77('0x11'))||_0xb1f332['changed'](_0x3a77('0x12'))){var _0x5924b5,_0x369bd4;_0x5924b5=_0xb1f332['serverUrl'];var _0x3eaf7a=_0x5924b5[_0x3a77('0x13')](-0x1);if(_0x3eaf7a==='/'||_0x3eaf7a==='\x5c'||_0x3eaf7a===':'){_0x5924b5=_0x5924b5[_0x3a77('0x14')](0x0,_0x5924b5['lastIndexOf'](_0x3eaf7a));}switch(_0xb1f332[_0x3a77('0xd')]){case'US':_0x369bd4=_0x3a77('0x15');break;case'AU':_0x369bd4=_0x3a77('0x23');break;case'IN':_0x369bd4='https://accounts.zoho.in';break;case'CN':_0x369bd4=_0x3a77('0x17');break;default:_0x369bd4=_0x3a77('0x24');break;}var _0x355773={'method':_0x3a77('0x18'),'uri':_0x369bd4+_0x3a77('0x19'),'form':{'grant_type':_0x3a77('0x1a'),'client_id':_0xb1f332['clientId'],'client_secret':_0xb1f332[_0x3a77('0x10')],'redirect_uri':_0xb1f332['serverUrl'],'code':_0xb1f332[_0x3a77('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x355773)[_0x3a77('0x1b')](function(_0x489bde){var _0x368297=JSON[_0x3a77('0x25')](_0x489bde);if(_0x368297[_0x3a77('0x1c')]){_0xb1f332[_0x3a77('0x26')]=_0x368297[_0x3a77('0x1c')];logger[_0x3a77('0x1d')](util[_0x3a77('0x1e')](_0x3a77('0x1f'),_0xb1f332['name'],_0xb1f332['id']));}else{logger['error'](util[_0x3a77('0x1e')](_0x3a77('0x27'),_0xb1f332[_0x3a77('0x20')],_0xb1f332['id']),util[_0x3a77('0x22')](_0x368297,{'showHidden':![],'depth':null}));}return _0x532bee(null,_0xfff316);})['catch'](function(_0x4b580e){logger[_0x3a77('0x21')](util['format'](_0x3a77('0x27'),_0xb1f332['name'],_0xb1f332['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x532bee(_0x4b580e);});}else{return _0x532bee(null,_0xfff316);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index ac9b8f9..49263a5 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 _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 +var _0xc6ac=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','ShowZohoAccount','find','lodash','util','moment','bluebird'];(function(_0x132d12,_0x2c9799){var _0x1c3163=function(_0x7d9136){while(--_0x7d9136){_0x132d12['push'](_0x132d12['shift']());}};_0x1c3163(++_0x2c9799);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5f88c6,_0x14213d){_0x5f88c6=_0x5f88c6-0x0;var _0x5f1e2d=_0xc6ac[_0x5f88c6];return _0x5f1e2d;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});}exports[_0xcc6a('0x18')]=function(_0x33079c){var _0x12ef33=this;return new Promise(function(_0x2d9585,_0x412bc7){return db[_0xcc6a('0x19')][_0xcc6a('0x1a')]({'raw':_0x33079c[_0xcc6a('0x1b')]?_0x33079c['options'][_0xcc6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1d')]||null:null,'attributes':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1e')]||null:null,'limit':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1f')]||null:null,'include':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')]['include']?_[_0xcc6a('0x20')](_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x21')],function(_0x581aae){return{'model':db[_0x581aae[_0xcc6a('0x22')]],'as':_0x581aae['as'],'attributes':_0x581aae[_0xcc6a('0x1e')],'include':_0x581aae[_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x581aae[_0xcc6a('0x21')],function(_0x5fc697){return{'model':db[_0x5fc697['model']],'as':_0x5fc697['as'],'attributes':_0x5fc697[_0xcc6a('0x1e')],'include':_0x5fc697[_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x5fc697['include'],function(_0x3afb3a){return{'model':db[_0x3afb3a[_0xcc6a('0x22')]],'as':_0x3afb3a['as'],'attributes':_0x3afb3a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc6a('0xf')](function(_0x8b1b2b){logger[_0xcc6a('0x10')](_0xcc6a('0x18'),_0x33079c);logger['debug'](_0xcc6a('0x18'),_0x33079c,JSON[_0xcc6a('0x23')](_0x8b1b2b));_0x2d9585(_0x8b1b2b);})[_0xcc6a('0x24')](function(_0x4f176b){logger[_0xcc6a('0x15')]('GetZohoAccount',_0x4f176b['message'],_0x33079c);_0x412bc7(_0x12ef33[_0xcc6a('0x15')](0x1f4,_0x4f176b[_0xcc6a('0x17')]));});});};exports[_0xcc6a('0x25')]=function(_0x11b481){var _0x2b575d=this;return new Promise(function(_0x131138,_0x4e2de4){return db[_0xcc6a('0x19')][_0xcc6a('0x26')]({'raw':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1d')]||null:null,'attributes':_0x11b481['options']?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1e')]||null:null,'include':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x11b481[_0xcc6a('0x1b')]['include'],function(_0x5d2287){return{'model':db[_0x5d2287['model']],'as':_0x5d2287['as'],'attributes':_0x5d2287['attributes'],'include':_0x5d2287['include']?_[_0xcc6a('0x20')](_0x5d2287[_0xcc6a('0x21')],function(_0x1101ec){return{'model':db[_0x1101ec[_0xcc6a('0x22')]],'as':_0x1101ec['as'],'attributes':_0x1101ec[_0xcc6a('0x1e')],'include':_0x1101ec['include']?_['map'](_0x1101ec[_0xcc6a('0x21')],function(_0x11173a){return{'model':db[_0x11173a[_0xcc6a('0x22')]],'as':_0x11173a['as'],'attributes':_0x11173a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc6a('0xf')](function(_0x2207df){logger[_0xcc6a('0x10')](_0xcc6a('0x25'),_0x11b481);logger[_0xcc6a('0x12')](_0xcc6a('0x25'),_0x11b481,JSON[_0xcc6a('0x23')](_0x2207df));_0x131138(_0x2207df);})[_0xcc6a('0x24')](function(_0x2a1cd2){logger[_0xcc6a('0x15')](_0xcc6a('0x25'),_0x2a1cd2[_0xcc6a('0x17')],_0x11b481);_0x4e2de4(_0x2b575d[_0xcc6a('0x15')](0x1f4,_0x2a1cd2[_0xcc6a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 0a064ce..1ffff98 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 _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 +var _0xa768=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x4c7071,_0x2c707d){var _0x35e6a6=function(_0x2686f5){while(--_0x2686f5){_0x4c7071['push'](_0x4c7071['shift']());}};_0x35e6a6(++_0x2c707d);}(_0xa768,0x78));var _0x8a76=function(_0x3b447a,_0x1dc436){_0x3b447a=_0x3b447a-0x0;var _0x1189f9=_0xa768[_0x3b447a];return _0x1189f9;};'use strict';var multer=require('multer');var util=require(_0x8a76('0x0'));var path=require(_0x8a76('0x1'));var timeout=require(_0x8a76('0x2'));var express=require(_0x8a76('0x3'));var router=express['Router']();var fs_extra=require(_0x8a76('0x4'));var auth=require(_0x8a76('0x5'));var interaction=require(_0x8a76('0x6'));var config=require(_0x8a76('0x7'));var controller=require(_0x8a76('0x8'));router[_0x8a76('0x9')]('/',auth[_0x8a76('0xa')](),controller['index']);router[_0x8a76('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8a76('0xb')]);router['get'](_0x8a76('0xc'),auth[_0x8a76('0xa')](),controller[_0x8a76('0xd')]);router[_0x8a76('0x9')](_0x8a76('0xe'),auth[_0x8a76('0xa')](),controller[_0x8a76('0xf')]);router[_0x8a76('0x9')](_0x8a76('0x10'),auth[_0x8a76('0xa')](),controller[_0x8a76('0x11')]);router[_0x8a76('0x12')]('/',auth['isAuthenticated'](),controller[_0x8a76('0x13')]);router[_0x8a76('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8a76('0x15')]);router[_0x8a76('0x16')](_0x8a76('0x17'),auth[_0x8a76('0xa')](),controller[_0x8a76('0x18')]);module[_0x8a76('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 32d1604..437f79f 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 _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 +var _0xbfa4=['contact_lead','contact','sequelize','ENUM','lead'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xbfa4,0x106));var _0x4bfa=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0xbfa4[_0x57486e];return _0x5f110b;};'use strict';var Sequelize=require(_0x4bfa('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x4bfa('0x1')]('lead','contact','nothing'),'defaultValue':_0x4bfa('0x2')},'moduleSearch':{'type':Sequelize[_0x4bfa('0x1')](_0x4bfa('0x3'),_0x4bfa('0x4'),_0x4bfa('0x2')),'defaultValue':_0x4bfa('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index bf7a729..dcc6d6d 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 _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 +var _0x0b4a=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ZohoConfiguration','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','hasOwnProperty','getSubjects','findOne','ZohoField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x586381,_0x2afc35){var _0x9b423b=function(_0x3fc8e8){while(--_0x3fc8e8){_0x586381['push'](_0x586381['shift']());}};_0x9b423b(++_0x2afc35);}(_0x0b4a,0x18d));var _0xa0b4=function(_0x5c8c78,_0x19fe62){_0x5c8c78=_0x5c8c78-0x0;var _0x18e46b=_0x0b4a[_0x5c8c78];return _0x18e46b;};'use strict';var emlformat=require(_0xa0b4('0x0'));var rimraf=require(_0xa0b4('0x1'));var zipdir=require(_0xa0b4('0x2'));var jsonpatch=require(_0xa0b4('0x3'));var rp=require(_0xa0b4('0x4'));var moment=require('moment');var BPromise=require(_0xa0b4('0x5'));var Mustache=require(_0xa0b4('0x6'));var util=require(_0xa0b4('0x7'));var path=require(_0xa0b4('0x8'));var sox=require(_0xa0b4('0x9'));var csv=require(_0xa0b4('0xa'));var ejs=require(_0xa0b4('0xb'));var fs=require('fs');var fs_extra=require(_0xa0b4('0xc'));var _=require(_0xa0b4('0xd'));var squel=require(_0xa0b4('0xe'));var crypto=require(_0xa0b4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa0b4('0x10'));var toCsv=require(_0xa0b4('0xa'));var querystring=require(_0xa0b4('0x11'));var Papa=require('papaparse');var Redis=require(_0xa0b4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa0b4('0x13'));var as=require(_0xa0b4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0b4('0x15'))(_0xa0b4('0x16'));var utils=require('../../config/utils');var config=require(_0xa0b4('0x17'));var licenseUtil=require(_0xa0b4('0x18'));var db=require(_0xa0b4('0x19'))['db'];function respondWithStatusCode(_0x4b0093,_0x2cd0de){_0x2cd0de=_0x2cd0de||0xcc;return function(_0x353f4e){if(_0x353f4e){return _0x4b0093[_0xa0b4('0x1a')](_0x2cd0de);}return _0x4b0093[_0xa0b4('0x1b')](_0x2cd0de)[_0xa0b4('0x1c')]();};}function respondWithResult(_0x3828e8,_0x14271b){_0x14271b=_0x14271b||0xc8;return function(_0xa555e8){if(_0xa555e8){return _0x3828e8[_0xa0b4('0x1b')](_0x14271b)[_0xa0b4('0x1d')](_0xa555e8);}};}function respondWithFilteredResult(_0x3a688e,_0x38465a){return function(_0x11f7b5){if(_0x11f7b5){var _0x43caba=typeof _0x38465a[_0xa0b4('0x1e')]===_0xa0b4('0x1f')&&typeof _0x38465a[_0xa0b4('0x20')]===_0xa0b4('0x1f');var _0x5218c9=_0x11f7b5[_0xa0b4('0x21')];var _0x20b99b=_0x43caba?0x0:_0x38465a[_0xa0b4('0x1e')];var _0x2e11ee=_0x43caba?_0x11f7b5[_0xa0b4('0x21')]:_0x38465a[_0xa0b4('0x1e')]+_0x38465a[_0xa0b4('0x20')];var _0x51f2dd;if(_0x2e11ee>=_0x5218c9){_0x2e11ee=_0x5218c9;_0x51f2dd=0xc8;}else{_0x51f2dd=0xce;}_0x3a688e[_0xa0b4('0x1b')](_0x51f2dd);return _0x3a688e['set'](_0xa0b4('0x22'),_0x20b99b+'-'+_0x2e11ee+'/'+_0x5218c9)[_0xa0b4('0x1d')](_0x11f7b5);}return null;};}function patchUpdates(_0x422690){return function(_0xb5bec5){try{jsonpatch[_0xa0b4('0x23')](_0xb5bec5,_0x422690,!![]);}catch(_0xb6cbe3){return BPromise[_0xa0b4('0x24')](_0xb6cbe3);}return _0xb5bec5[_0xa0b4('0x25')]();};}function saveUpdates(_0x2af5da,_0x23cefa){return function(_0x2ceca6){if(_0x2ceca6){return _0x2ceca6[_0xa0b4('0x26')](_0x2af5da)[_0xa0b4('0x27')](function(_0x56686c){return _0x56686c;});}return null;};}function removeEntity(_0x57b105,_0x5ce884){return function(_0x382882){if(_0x382882){return _0x382882[_0xa0b4('0x28')]()[_0xa0b4('0x27')](function(){_0x57b105[_0xa0b4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd67071,_0x3acf95){return function(_0x2d605b){if(!_0x2d605b){_0xd67071[_0xa0b4('0x1a')](0x194);}return _0x2d605b;};}function handleError(_0x227f93,_0xbab618){_0xbab618=_0xbab618||0x1f4;return function(_0x1c7154){logger[_0xa0b4('0x29')](_0x1c7154['stack']);if(_0x1c7154[_0xa0b4('0x2a')]){delete _0x1c7154['name'];}_0x227f93[_0xa0b4('0x1b')](_0xbab618)[_0xa0b4('0x2b')](_0x1c7154);};}exports[_0xa0b4('0x2c')]=function(_0x4c6c15,_0x3e54b5){var _0x970cda={},_0x4421d2={},_0x5085e3={'count':0x0,'rows':[]};var _0x5c219f=_[_0xa0b4('0x2d')](db[_0xa0b4('0x2e')][_0xa0b4('0x2f')],function(_0x461060){return{'name':_0x461060['fieldName'],'type':_0x461060['type'][_0xa0b4('0x30')]};});_0x4421d2[_0xa0b4('0x31')]=_[_0xa0b4('0x2d')](_0x5c219f,'name');_0x4421d2['query']=_[_0xa0b4('0x32')](_0x4c6c15[_0xa0b4('0x33')]);_0x4421d2[_0xa0b4('0x34')]=_[_0xa0b4('0x35')](_0x4421d2[_0xa0b4('0x31')],_0x4421d2[_0xa0b4('0x33')]);_0x970cda[_0xa0b4('0x36')]=_[_0xa0b4('0x35')](_0x4421d2['model'],qs[_0xa0b4('0x37')](_0x4c6c15[_0xa0b4('0x33')][_0xa0b4('0x37')]));_0x970cda[_0xa0b4('0x36')]=_0x970cda[_0xa0b4('0x36')][_0xa0b4('0x38')]?_0x970cda[_0xa0b4('0x36')]:_0x4421d2['model'];if(!_0x4c6c15['query']['hasOwnProperty'](_0xa0b4('0x39'))){_0x970cda[_0xa0b4('0x20')]=qs[_0xa0b4('0x20')](_0x4c6c15[_0xa0b4('0x33')][_0xa0b4('0x20')]);_0x970cda[_0xa0b4('0x1e')]=qs[_0xa0b4('0x1e')](_0x4c6c15['query'][_0xa0b4('0x1e')]);}_0x970cda[_0xa0b4('0x3a')]=qs[_0xa0b4('0x3b')](_0x4c6c15['query']['sort']);_0x970cda['where']=qs[_0xa0b4('0x34')](_[_0xa0b4('0x3c')](_0x4c6c15['query'],_0x4421d2[_0xa0b4('0x34')]),_0x5c219f);if(_0x4c6c15[_0xa0b4('0x33')][_0xa0b4('0x3d')]){_0x970cda[_0xa0b4('0x3e')]=_['merge'](_0x970cda[_0xa0b4('0x3e')],{'$or':_['map'](_0x5c219f,function(_0x422ee9){if(_0x422ee9[_0xa0b4('0x3f')]!=='VIRTUAL'){var _0x3b1367={};_0x3b1367[_0x422ee9[_0xa0b4('0x2a')]]={'$like':'%'+_0x4c6c15[_0xa0b4('0x33')][_0xa0b4('0x3d')]+'%'};return _0x3b1367;}})});}_0x970cda=_[_0xa0b4('0x40')]({},_0x970cda,_0x4c6c15['options']);var _0x2ea275={'where':_0x970cda[_0xa0b4('0x3e')]};return db[_0xa0b4('0x2e')][_0xa0b4('0x21')](_0x2ea275)[_0xa0b4('0x27')](function(_0x5b4f46){_0x5085e3[_0xa0b4('0x21')]=_0x5b4f46;if(_0x4c6c15[_0xa0b4('0x33')][_0xa0b4('0x41')]){_0x970cda[_0xa0b4('0x42')]=[{'all':!![]}];}return db[_0xa0b4('0x2e')][_0xa0b4('0x43')](_0x970cda);})[_0xa0b4('0x27')](function(_0x2aa79d){_0x5085e3[_0xa0b4('0x44')]=_0x2aa79d;return _0x5085e3;})[_0xa0b4('0x27')](respondWithFilteredResult(_0x3e54b5,_0x970cda))[_0xa0b4('0x45')](handleError(_0x3e54b5,null));};exports[_0xa0b4('0x46')]=function(_0x48a6df,_0x3f1b32){var _0x55f2c8={'raw':![],'where':{'id':_0x48a6df[_0xa0b4('0x47')]['id']}},_0x6418f5={};_0x6418f5[_0xa0b4('0x31')]=_['keys'](db[_0xa0b4('0x2e')]['rawAttributes']);_0x6418f5[_0xa0b4('0x33')]=_[_0xa0b4('0x32')](_0x48a6df['query']);_0x6418f5[_0xa0b4('0x34')]=_[_0xa0b4('0x35')](_0x6418f5[_0xa0b4('0x31')],_0x6418f5[_0xa0b4('0x33')]);_0x55f2c8[_0xa0b4('0x36')]=_[_0xa0b4('0x35')](_0x6418f5['model'],qs['fields'](_0x48a6df[_0xa0b4('0x33')][_0xa0b4('0x37')]));_0x55f2c8['attributes']=_0x55f2c8['attributes'][_0xa0b4('0x38')]?_0x55f2c8['attributes']:_0x6418f5[_0xa0b4('0x31')];if(_0x48a6df[_0xa0b4('0x33')][_0xa0b4('0x41')]){_0x55f2c8['include']=[{'all':!![]}];}_0x55f2c8=_[_0xa0b4('0x40')]({},_0x55f2c8,_0x48a6df[_0xa0b4('0x48')]);return db[_0xa0b4('0x2e')][_0xa0b4('0x49')](_0x55f2c8)['then'](handleEntityNotFound(_0x3f1b32,null))[_0xa0b4('0x27')](respondWithResult(_0x3f1b32,null))['catch'](handleError(_0x3f1b32,null));};exports[_0xa0b4('0x4a')]=function(_0x4ca1bc,_0x3bf3b9){return db[_0xa0b4('0x2e')][_0xa0b4('0x4a')](_0x4ca1bc[_0xa0b4('0x4b')],{})[_0xa0b4('0x27')](respondWithResult(_0x3bf3b9,0xc9))['catch'](handleError(_0x3bf3b9,null));};exports[_0xa0b4('0x26')]=function(_0x339536,_0x272ac5){if(_0x339536[_0xa0b4('0x4b')]['id']){delete _0x339536['body']['id'];}return db[_0xa0b4('0x2e')][_0xa0b4('0x49')]({'where':{'id':_0x339536[_0xa0b4('0x47')]['id']}})[_0xa0b4('0x27')](handleEntityNotFound(_0x272ac5,null))[_0xa0b4('0x27')](saveUpdates(_0x339536[_0xa0b4('0x4b')],null))[_0xa0b4('0x27')](respondWithResult(_0x272ac5,null))['catch'](handleError(_0x272ac5,null));};exports['destroy']=function(_0x176c4c,_0x32f4cd){return db['ZohoConfiguration'][_0xa0b4('0x49')]({'where':{'id':_0x176c4c[_0xa0b4('0x47')]['id']}})[_0xa0b4('0x27')](handleEntityNotFound(_0x32f4cd,null))[_0xa0b4('0x27')](removeEntity(_0x32f4cd,null))[_0xa0b4('0x45')](handleError(_0x32f4cd,null));};exports[_0xa0b4('0x4c')]=function(_0x49dbf1,_0x3dc1b5,_0x15cf08){var _0xdc869b={};var _0xe82baa={};var _0x5f1229;var _0x31f71c;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x49dbf1[_0xa0b4('0x47')]['id']}})[_0xa0b4('0x27')](handleEntityNotFound(_0x3dc1b5,null))[_0xa0b4('0x27')](function(_0x195ff1){if(_0x195ff1){_0x5f1229=_0x195ff1;_0xe82baa['model']=_['keys'](db['ZohoField'][_0xa0b4('0x2f')]);_0xe82baa[_0xa0b4('0x33')]=_[_0xa0b4('0x32')](_0x49dbf1[_0xa0b4('0x33')]);_0xe82baa[_0xa0b4('0x34')]=_['intersection'](_0xe82baa['model'],_0xe82baa[_0xa0b4('0x33')]);_0xdc869b['attributes']=_['intersection'](_0xe82baa['model'],qs[_0xa0b4('0x37')](_0x49dbf1['query'][_0xa0b4('0x37')]));_0xdc869b[_0xa0b4('0x36')]=_0xdc869b[_0xa0b4('0x36')][_0xa0b4('0x38')]?_0xdc869b['attributes']:_0xe82baa[_0xa0b4('0x31')];_0xdc869b['order']=qs[_0xa0b4('0x3b')](_0x49dbf1[_0xa0b4('0x33')]['sort']);_0xdc869b[_0xa0b4('0x3e')]=qs[_0xa0b4('0x34')](_[_0xa0b4('0x3c')](_0x49dbf1[_0xa0b4('0x33')],_0xe82baa[_0xa0b4('0x34')]));if(_0x49dbf1[_0xa0b4('0x33')][_0xa0b4('0x3d')]){_0xdc869b['where']=_['merge'](_0xdc869b[_0xa0b4('0x3e')],{'$or':_[_0xa0b4('0x2d')](_0xdc869b['attributes'],function(_0xee2cb0){var _0x432a26={};_0x432a26[_0xee2cb0]={'$like':'%'+_0x49dbf1[_0xa0b4('0x33')][_0xa0b4('0x3d')]+'%'};return _0x432a26;})});}_0xdc869b=_['merge']({},_0xdc869b,_0x49dbf1[_0xa0b4('0x48')]);return _0x5f1229[_0xa0b4('0x4c')](_0xdc869b);}})['then'](function(_0x2a54aa){if(_0x2a54aa){_0x31f71c=_0x2a54aa['length'];if(!_0x49dbf1[_0xa0b4('0x33')][_0xa0b4('0x4d')](_0xa0b4('0x39'))){_0xdc869b[_0xa0b4('0x20')]=qs[_0xa0b4('0x20')](_0x49dbf1[_0xa0b4('0x33')][_0xa0b4('0x20')]);_0xdc869b['offset']=qs[_0xa0b4('0x1e')](_0x49dbf1[_0xa0b4('0x33')][_0xa0b4('0x1e')]);}return _0x5f1229[_0xa0b4('0x4c')](_0xdc869b);}})[_0xa0b4('0x27')](function(_0x28dd7c){if(_0x28dd7c){return _0x28dd7c?{'count':_0x31f71c,'rows':_0x28dd7c}:null;}})[_0xa0b4('0x27')](respondWithResult(_0x3dc1b5,null))[_0xa0b4('0x45')](handleError(_0x3dc1b5,null));};exports[_0xa0b4('0x4e')]=function(_0x3ad195,_0x3d106b,_0x1d7f0f){var _0x52e0ff={};var _0x3237bb={};var _0x1c9c11;var _0x52629b;return db[_0xa0b4('0x2e')][_0xa0b4('0x4f')]({'where':{'id':_0x3ad195[_0xa0b4('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d106b,null))[_0xa0b4('0x27')](function(_0x279479){if(_0x279479){_0x1c9c11=_0x279479;_0x3237bb['model']=_['keys'](db[_0xa0b4('0x50')][_0xa0b4('0x2f')]);_0x3237bb[_0xa0b4('0x33')]=_[_0xa0b4('0x32')](_0x3ad195[_0xa0b4('0x33')]);_0x3237bb[_0xa0b4('0x34')]=_[_0xa0b4('0x35')](_0x3237bb['model'],_0x3237bb['query']);_0x52e0ff[_0xa0b4('0x36')]=_[_0xa0b4('0x35')](_0x3237bb[_0xa0b4('0x31')],qs[_0xa0b4('0x37')](_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x37')]));_0x52e0ff[_0xa0b4('0x36')]=_0x52e0ff[_0xa0b4('0x36')][_0xa0b4('0x38')]?_0x52e0ff[_0xa0b4('0x36')]:_0x3237bb[_0xa0b4('0x31')];_0x52e0ff[_0xa0b4('0x3a')]=qs[_0xa0b4('0x3b')](_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x3b')]);_0x52e0ff['where']=qs['filters'](_[_0xa0b4('0x3c')](_0x3ad195[_0xa0b4('0x33')],_0x3237bb[_0xa0b4('0x34')]));if(_0x3ad195['query'][_0xa0b4('0x3d')]){_0x52e0ff['where']=_['merge'](_0x52e0ff['where'],{'$or':_[_0xa0b4('0x2d')](_0x52e0ff[_0xa0b4('0x36')],function(_0x350f37){var _0x50a12e={};_0x50a12e[_0x350f37]={'$like':'%'+_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x3d')]+'%'};return _0x50a12e;})});}_0x52e0ff=_[_0xa0b4('0x40')]({},_0x52e0ff,_0x3ad195['options']);return _0x1c9c11[_0xa0b4('0x4e')](_0x52e0ff);}})['then'](function(_0x5c59dd){if(_0x5c59dd){_0x52629b=_0x5c59dd['length'];if(!_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x4d')](_0xa0b4('0x39'))){_0x52e0ff['limit']=qs['limit'](_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x20')]);_0x52e0ff[_0xa0b4('0x1e')]=qs[_0xa0b4('0x1e')](_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x1e')]);}return _0x1c9c11[_0xa0b4('0x4e')](_0x52e0ff);}})[_0xa0b4('0x27')](function(_0x2c8a68){if(_0x2c8a68){return _0x2c8a68?{'count':_0x52629b,'rows':_0x2c8a68}:null;}})[_0xa0b4('0x27')](respondWithResult(_0x3d106b,null))[_0xa0b4('0x45')](handleError(_0x3d106b,null));};exports['getDescriptions']=function(_0x1439f6,_0x410cf2,_0x4ecbbb){var _0xe48a42={};var _0x452b89={};var _0x3914a3;var _0x7a13ae;return db['ZohoConfiguration'][_0xa0b4('0x4f')]({'where':{'id':_0x1439f6[_0xa0b4('0x47')]['id']}})[_0xa0b4('0x27')](handleEntityNotFound(_0x410cf2,null))[_0xa0b4('0x27')](function(_0x45a8f0){if(_0x45a8f0){_0x3914a3=_0x45a8f0;_0x452b89[_0xa0b4('0x31')]=_[_0xa0b4('0x32')](db[_0xa0b4('0x50')][_0xa0b4('0x2f')]);_0x452b89[_0xa0b4('0x33')]=_['keys'](_0x1439f6[_0xa0b4('0x33')]);_0x452b89['filters']=_[_0xa0b4('0x35')](_0x452b89[_0xa0b4('0x31')],_0x452b89['query']);_0xe48a42[_0xa0b4('0x36')]=_[_0xa0b4('0x35')](_0x452b89[_0xa0b4('0x31')],qs[_0xa0b4('0x37')](_0x1439f6[_0xa0b4('0x33')][_0xa0b4('0x37')]));_0xe48a42['attributes']=_0xe48a42[_0xa0b4('0x36')]['length']?_0xe48a42[_0xa0b4('0x36')]:_0x452b89['model'];_0xe48a42['order']=qs[_0xa0b4('0x3b')](_0x1439f6['query'][_0xa0b4('0x3b')]);_0xe48a42[_0xa0b4('0x3e')]=qs[_0xa0b4('0x34')](_['pick'](_0x1439f6['query'],_0x452b89[_0xa0b4('0x34')]));if(_0x1439f6[_0xa0b4('0x33')]['filter']){_0xe48a42[_0xa0b4('0x3e')]=_[_0xa0b4('0x40')](_0xe48a42['where'],{'$or':_[_0xa0b4('0x2d')](_0xe48a42['attributes'],function(_0x3552c5){var _0x59fc05={};_0x59fc05[_0x3552c5]={'$like':'%'+_0x1439f6[_0xa0b4('0x33')]['filter']+'%'};return _0x59fc05;})});}_0xe48a42=_[_0xa0b4('0x40')]({},_0xe48a42,_0x1439f6[_0xa0b4('0x48')]);return _0x3914a3['getDescriptions'](_0xe48a42);}})[_0xa0b4('0x27')](function(_0x4085f5){if(_0x4085f5){_0x7a13ae=_0x4085f5['length'];if(!_0x1439f6[_0xa0b4('0x33')]['hasOwnProperty'](_0xa0b4('0x39'))){_0xe48a42[_0xa0b4('0x20')]=qs['limit'](_0x1439f6[_0xa0b4('0x33')][_0xa0b4('0x20')]);_0xe48a42[_0xa0b4('0x1e')]=qs[_0xa0b4('0x1e')](_0x1439f6['query'][_0xa0b4('0x1e')]);}return _0x3914a3['getDescriptions'](_0xe48a42);}})['then'](function(_0x88bd7a){if(_0x88bd7a){return _0x88bd7a?{'count':_0x7a13ae,'rows':_0x88bd7a}:null;}})[_0xa0b4('0x27')](respondWithResult(_0x410cf2,null))['catch'](handleError(_0x410cf2,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 27f09e6..a8a74fa 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 _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 +var _0x0ead=['int_zoho_configurations','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','ZohoConfiguration'];(function(_0x2cc5cb,_0x4119c5){var _0x237d11=function(_0x362d07){while(--_0x362d07){_0x2cc5cb['push'](_0x2cc5cb['shift']());}};_0x237d11(++_0x4119c5);}(_0x0ead,0x1c3));var _0xd0ea=function(_0x41d9e3,_0xe5904b){_0x41d9e3=_0x41d9e3-0x0;var _0x47305d=_0x0ead[_0x41d9e3];return _0x47305d;};'use strict';var _=require('lodash');var util=require(_0xd0ea('0x0'));var logger=require(_0xd0ea('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd0ea('0x2'));var rp=require(_0xd0ea('0x3'));var fs=require('fs');var path=require(_0xd0ea('0x4'));var rimraf=require(_0xd0ea('0x5'));var config=require(_0xd0ea('0x6'));var attributes=require(_0xd0ea('0x7'));module['exports']=function(_0x47d25c,_0x110da1){return _0x47d25c['define'](_0xd0ea('0x8'),attributes,{'tableName':_0xd0ea('0x9'),'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 14bc2c8..caf87e4 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 _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 +var _0x94a1=['../../config/logger','../../config/environment','jayson/promise','client','request','info','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x94a1,0x177));var _0x194a=function(_0x304cfa,_0x264fc0){_0x304cfa=_0x304cfa-0x0;var _0x2389d0=_0x94a1[_0x304cfa];return _0x2389d0;};'use strict';var _=require(_0x194a('0x0'));var util=require('util');var moment=require(_0x194a('0x1'));var BPromise=require(_0x194a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x194a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x194a('0x4'));var logger=require(_0x194a('0x5'))('rpc');var config=require(_0x194a('0x6'));var jayson=require(_0x194a('0x7'));var client=jayson[_0x194a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1719b1,_0x2e4488,_0x1c41da){return new BPromise(function(_0x3e8af8,_0x5c0adc){return client[_0x194a('0x9')](_0x1719b1,_0x1c41da)['then'](function(_0x13ffe0){logger[_0x194a('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x2e4488,'request\x20sent');logger['debug'](_0x194a('0xb'),_0x2e4488,'request\x20sent',JSON[_0x194a('0xc')](_0x13ffe0));if(_0x13ffe0[_0x194a('0xd')]){if(_0x13ffe0[_0x194a('0xd')][_0x194a('0xe')]===0x1f4){logger[_0x194a('0xd')](_0x194a('0xf'),_0x2e4488,_0x13ffe0[_0x194a('0xd')][_0x194a('0x10')]);return _0x5c0adc(_0x13ffe0[_0x194a('0xd')]['message']);}logger[_0x194a('0xd')](_0x194a('0xf'),_0x2e4488,_0x13ffe0['error'][_0x194a('0x10')]);return _0x3e8af8(_0x13ffe0[_0x194a('0xd')][_0x194a('0x10')]);}else{logger[_0x194a('0xa')](_0x194a('0xf'),_0x2e4488,_0x194a('0x11'));_0x3e8af8(_0x13ffe0[_0x194a('0x12')][_0x194a('0x10')]);}})[_0x194a('0x13')](function(_0x1ca074){logger[_0x194a('0xd')](_0x194a('0xf'),_0x2e4488,_0x1ca074);_0x5c0adc(_0x1ca074);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 50369d4..1ce7326 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 _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 +var _0xc022=['multer','util','path','express','Router','../../components/interaction/service','./intZohoField.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x4054fe,_0x18f33e){var _0x4f9bee=function(_0x3c304d){while(--_0x3c304d){_0x4054fe['push'](_0x4054fe['shift']());}};_0x4f9bee(++_0x18f33e);}(_0xc022,0x168));var _0x2c02=function(_0x2a5bb7,_0x3a0bf3){_0x2a5bb7=_0x2a5bb7-0x0;var _0x503330=_0xc022[_0x2a5bb7];return _0x503330;};'use strict';var multer=require(_0x2c02('0x0'));var util=require(_0x2c02('0x1'));var path=require(_0x2c02('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c02('0x3'));var router=express[_0x2c02('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2c02('0x5'));var config=require('../../config/environment');var controller=require(_0x2c02('0x6'));router[_0x2c02('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2c02('0x8'),auth[_0x2c02('0x9')](),controller[_0x2c02('0xa')]);router[_0x2c02('0xb')]('/',auth['isAuthenticated'](),controller[_0x2c02('0xc')]);router[_0x2c02('0xd')](_0x2c02('0x8'),auth[_0x2c02('0x9')](),controller[_0x2c02('0xe')]);router[_0x2c02('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2c02('0x10')]);module[_0x2c02('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e6ee121..967cf73 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 _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 +var _0x466e=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x3eff21,_0x5bf36c){var _0x1945bb=function(_0x319a9e){while(--_0x319a9e){_0x3eff21['push'](_0x3eff21['shift']());}};_0x1945bb(++_0x5bf36c);}(_0x466e,0x1c5));var _0xe466=function(_0xdb2efd,_0x5b6bd0){_0xdb2efd=_0xdb2efd-0x0;var _0x117404=_0x466e[_0xdb2efd];return _0x117404;};'use strict';var Sequelize=require(_0xe466('0x0'));module[_0xe466('0x1')]={'type':{'type':Sequelize[_0xe466('0x2')](_0xe466('0x3'),'variable',_0xe466('0x4'),_0xe466('0x5'),_0xe466('0x6')),'defaultValue':_0xe466('0x3')},'content':{'type':Sequelize[_0xe466('0x7')]},'key':{'type':Sequelize[_0xe466('0x7')]},'keyType':{'type':Sequelize[_0xe466('0x2')](_0xe466('0x3'),_0xe466('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xe466('0x7')]},'idField':{'type':Sequelize[_0xe466('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe466('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 463d0c9..78ac736 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 _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 +var _0x722d=['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','stack','name','send','index','map','ZohoField','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3d4bd8,_0x57edb9){var _0x2e2c9c=function(_0x367690){while(--_0x367690){_0x3d4bd8['push'](_0x3d4bd8['shift']());}};_0x2e2c9c(++_0x57edb9);}(_0x722d,0x17e));var _0xd722=function(_0x9765f2,_0x4fe9c6){_0x9765f2=_0x9765f2-0x0;var _0x27c61c=_0x722d[_0x9765f2];return _0x27c61c;};'use strict';var emlformat=require(_0xd722('0x0'));var rimraf=require(_0xd722('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd722('0x2'));var rp=require(_0xd722('0x3'));var moment=require(_0xd722('0x4'));var BPromise=require(_0xd722('0x5'));var Mustache=require(_0xd722('0x6'));var util=require(_0xd722('0x7'));var path=require(_0xd722('0x8'));var sox=require(_0xd722('0x9'));var csv=require(_0xd722('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd722('0xb'));var _=require(_0xd722('0xc'));var squel=require('squel');var crypto=require(_0xd722('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd722('0xe'));var toCsv=require(_0xd722('0xa'));var querystring=require(_0xd722('0xf'));var Papa=require(_0xd722('0x10'));var Redis=require(_0xd722('0x11'));var authService=require(_0xd722('0x12'));var qs=require(_0xd722('0x13'));var as=require(_0xd722('0x14'));var hardwareService=require(_0xd722('0x15'));var logger=require(_0xd722('0x16'))(_0xd722('0x17'));var utils=require(_0xd722('0x18'));var config=require(_0xd722('0x19'));var licenseUtil=require(_0xd722('0x1a'));var db=require(_0xd722('0x1b'))['db'];function respondWithStatusCode(_0x18d336,_0xd5b61){_0xd5b61=_0xd5b61||0xcc;return function(_0x2693f6){if(_0x2693f6){return _0x18d336[_0xd722('0x1c')](_0xd5b61);}return _0x18d336[_0xd722('0x1d')](_0xd5b61)[_0xd722('0x1e')]();};}function respondWithResult(_0x385e07,_0x4ca0e8){_0x4ca0e8=_0x4ca0e8||0xc8;return function(_0x57b73c){if(_0x57b73c){return _0x385e07[_0xd722('0x1d')](_0x4ca0e8)[_0xd722('0x1f')](_0x57b73c);}};}function respondWithFilteredResult(_0x1d3c4f,_0x344a6d){return function(_0x225376){if(_0x225376){var _0x26446b=typeof _0x344a6d[_0xd722('0x20')]===_0xd722('0x21')&&typeof _0x344a6d[_0xd722('0x22')]===_0xd722('0x21');var _0xded0f=_0x225376[_0xd722('0x23')];var _0x1a185e=_0x26446b?0x0:_0x344a6d[_0xd722('0x20')];var _0x4b953e=_0x26446b?_0x225376[_0xd722('0x23')]:_0x344a6d[_0xd722('0x20')]+_0x344a6d[_0xd722('0x22')];var _0x18cef4;if(_0x4b953e>=_0xded0f){_0x4b953e=_0xded0f;_0x18cef4=0xc8;}else{_0x18cef4=0xce;}_0x1d3c4f['status'](_0x18cef4);return _0x1d3c4f[_0xd722('0x24')](_0xd722('0x25'),_0x1a185e+'-'+_0x4b953e+'/'+_0xded0f)[_0xd722('0x1f')](_0x225376);}return null;};}function patchUpdates(_0x27a97f){return function(_0xe6c111){try{jsonpatch[_0xd722('0x26')](_0xe6c111,_0x27a97f,!![]);}catch(_0x192c44){return BPromise[_0xd722('0x27')](_0x192c44);}return _0xe6c111[_0xd722('0x28')]();};}function saveUpdates(_0x53cf64,_0x485611){return function(_0x324955){if(_0x324955){return _0x324955[_0xd722('0x29')](_0x53cf64)[_0xd722('0x2a')](function(_0x4f1076){return _0x4f1076;});}return null;};}function removeEntity(_0x1bdc8e,_0x3238df){return function(_0x8c3350){if(_0x8c3350){return _0x8c3350[_0xd722('0x2b')]()[_0xd722('0x2a')](function(){_0x1bdc8e[_0xd722('0x1d')](0xcc)[_0xd722('0x1e')]();});}};}function handleEntityNotFound(_0x3bad89,_0x395c13){return function(_0x4c9bb2){if(!_0x4c9bb2){_0x3bad89[_0xd722('0x1c')](0x194);}return _0x4c9bb2;};}function handleError(_0x7b8da3,_0x3ec0ec){_0x3ec0ec=_0x3ec0ec||0x1f4;return function(_0x3a557b){logger['error'](_0x3a557b[_0xd722('0x2c')]);if(_0x3a557b[_0xd722('0x2d')]){delete _0x3a557b[_0xd722('0x2d')];}_0x7b8da3[_0xd722('0x1d')](_0x3ec0ec)[_0xd722('0x2e')](_0x3a557b);};}exports[_0xd722('0x2f')]=function(_0x4177bc,_0x2f8960){var _0x1de5a9={},_0x3977ca={},_0x5eb6dd={'count':0x0,'rows':[]};var _0x501e58=_[_0xd722('0x30')](db[_0xd722('0x31')]['rawAttributes'],function(_0x229f2e){return{'name':_0x229f2e[_0xd722('0x32')],'type':_0x229f2e[_0xd722('0x33')][_0xd722('0x34')]};});_0x3977ca[_0xd722('0x35')]=_[_0xd722('0x30')](_0x501e58,_0xd722('0x2d'));_0x3977ca[_0xd722('0x36')]=_['keys'](_0x4177bc[_0xd722('0x36')]);_0x3977ca['filters']=_[_0xd722('0x37')](_0x3977ca['model'],_0x3977ca[_0xd722('0x36')]);_0x1de5a9[_0xd722('0x38')]=_['intersection'](_0x3977ca['model'],qs['fields'](_0x4177bc['query'][_0xd722('0x39')]));_0x1de5a9[_0xd722('0x38')]=_0x1de5a9[_0xd722('0x38')][_0xd722('0x3a')]?_0x1de5a9[_0xd722('0x38')]:_0x3977ca[_0xd722('0x35')];if(!_0x4177bc[_0xd722('0x36')][_0xd722('0x3b')](_0xd722('0x3c'))){_0x1de5a9['limit']=qs[_0xd722('0x22')](_0x4177bc[_0xd722('0x36')][_0xd722('0x22')]);_0x1de5a9[_0xd722('0x20')]=qs[_0xd722('0x20')](_0x4177bc[_0xd722('0x36')][_0xd722('0x20')]);}_0x1de5a9['order']=qs[_0xd722('0x3d')](_0x4177bc[_0xd722('0x36')]['sort']);_0x1de5a9[_0xd722('0x3e')]=qs[_0xd722('0x3f')](_[_0xd722('0x40')](_0x4177bc[_0xd722('0x36')],_0x3977ca['filters']),_0x501e58);if(_0x4177bc['query']['filter']){_0x1de5a9[_0xd722('0x3e')]=_[_0xd722('0x41')](_0x1de5a9[_0xd722('0x3e')],{'$or':_[_0xd722('0x30')](_0x501e58,function(_0xb24f89){if(_0xb24f89[_0xd722('0x33')]!==_0xd722('0x42')){var _0x3444c5={};_0x3444c5[_0xb24f89[_0xd722('0x2d')]]={'$like':'%'+_0x4177bc['query'][_0xd722('0x43')]+'%'};return _0x3444c5;}})});}_0x1de5a9=_[_0xd722('0x41')]({},_0x1de5a9,_0x4177bc[_0xd722('0x44')]);var _0x48afeb={'where':_0x1de5a9['where']};return db[_0xd722('0x31')]['count'](_0x48afeb)['then'](function(_0xaf7de5){_0x5eb6dd['count']=_0xaf7de5;if(_0x4177bc[_0xd722('0x36')][_0xd722('0x45')]){_0x1de5a9[_0xd722('0x46')]=[{'all':!![]}];}return db['ZohoField'][_0xd722('0x47')](_0x1de5a9);})[_0xd722('0x2a')](function(_0x104c07){_0x5eb6dd[_0xd722('0x48')]=_0x104c07;return _0x5eb6dd;})[_0xd722('0x2a')](respondWithFilteredResult(_0x2f8960,_0x1de5a9))[_0xd722('0x49')](handleError(_0x2f8960,null));};exports[_0xd722('0x4a')]=function(_0x471b21,_0xfc163a){var _0xa44934={'raw':!![],'where':{'id':_0x471b21[_0xd722('0x4b')]['id']}},_0x3e728e={};_0x3e728e[_0xd722('0x35')]=_[_0xd722('0x4c')](db[_0xd722('0x31')][_0xd722('0x4d')]);_0x3e728e[_0xd722('0x36')]=_['keys'](_0x471b21['query']);_0x3e728e[_0xd722('0x3f')]=_[_0xd722('0x37')](_0x3e728e[_0xd722('0x35')],_0x3e728e[_0xd722('0x36')]);_0xa44934[_0xd722('0x38')]=_[_0xd722('0x37')](_0x3e728e['model'],qs[_0xd722('0x39')](_0x471b21[_0xd722('0x36')][_0xd722('0x39')]));_0xa44934[_0xd722('0x38')]=_0xa44934['attributes'][_0xd722('0x3a')]?_0xa44934[_0xd722('0x38')]:_0x3e728e['model'];if(_0x471b21[_0xd722('0x36')]['includeAll']){_0xa44934['include']=[{'all':!![]}];}_0xa44934=_['merge']({},_0xa44934,_0x471b21['options']);return db['ZohoField'][_0xd722('0x4e')](_0xa44934)[_0xd722('0x2a')](handleEntityNotFound(_0xfc163a,null))['then'](respondWithResult(_0xfc163a,null))['catch'](handleError(_0xfc163a,null));};exports[_0xd722('0x4f')]=function(_0x478b6b,_0x4d6807){return db[_0xd722('0x31')][_0xd722('0x4f')](_0x478b6b[_0xd722('0x50')],{})['then'](respondWithResult(_0x4d6807,0xc9))[_0xd722('0x49')](handleError(_0x4d6807,null));};exports[_0xd722('0x29')]=function(_0x13dbc8,_0x5acc28){if(_0x13dbc8['body']['id']){delete _0x13dbc8[_0xd722('0x50')]['id'];}return db[_0xd722('0x31')][_0xd722('0x4e')]({'where':{'id':_0x13dbc8[_0xd722('0x4b')]['id']}})[_0xd722('0x2a')](handleEntityNotFound(_0x5acc28,null))[_0xd722('0x2a')](saveUpdates(_0x13dbc8[_0xd722('0x50')],null))['then'](respondWithResult(_0x5acc28,null))[_0xd722('0x49')](handleError(_0x5acc28,null));};exports[_0xd722('0x2b')]=function(_0x1617ff,_0x257b10){return db[_0xd722('0x31')][_0xd722('0x4e')]({'where':{'id':_0x1617ff[_0xd722('0x4b')]['id']}})['then'](handleEntityNotFound(_0x257b10,null))['then'](removeEntity(_0x257b10,null))['catch'](handleError(_0x257b10,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 10cc147..346ad0b 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 _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 +var _0xadb5=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xadb5,0xad));var _0x5adb=function(_0x565a5e,_0x111ed1){_0x565a5e=_0x565a5e-0x0;var _0x4d233e=_0xadb5[_0x565a5e];return _0x4d233e;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intZohoField.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xc'),_0x5adb('0xd')],'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 04e1040..811db9c 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 _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 +var _0xf2cf=['../../config/logger','rpc','../../config/environment','client','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1f9edb,_0x120d6d){var _0x4074d9=function(_0xbf109){while(--_0xbf109){_0x1f9edb['push'](_0x1f9edb['shift']());}};_0x4074d9(++_0x120d6d);}(_0xf2cf,0x1b1));var _0xff2c=function(_0x46f5b0,_0x3cb96f){_0x46f5b0=_0x46f5b0-0x0;var _0x509db0=_0xf2cf[_0x46f5b0];return _0x509db0;};'use strict';var _=require(_0xff2c('0x0'));var util=require(_0xff2c('0x1'));var moment=require(_0xff2c('0x2'));var BPromise=require(_0xff2c('0x3'));var rs=require(_0xff2c('0x4'));var fs=require('fs');var Redis=require(_0xff2c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xff2c('0x6'));var logger=require(_0xff2c('0x7'))(_0xff2c('0x8'));var config=require(_0xff2c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff2c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x429f51,_0x2c6500,_0x36b59f){return new BPromise(function(_0xf5c572,_0x351571){return client[_0xff2c('0xb')](_0x429f51,_0x36b59f)[_0xff2c('0xc')](function(_0x2795c8){logger['info'](_0xff2c('0xd'),_0x2c6500,_0xff2c('0xe'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x2c6500,_0xff2c('0xe'),JSON[_0xff2c('0xf')](_0x2795c8));if(_0x2795c8[_0xff2c('0x10')]){if(_0x2795c8[_0xff2c('0x10')]['code']===0x1f4){logger['error'](_0xff2c('0xd'),_0x2c6500,_0x2795c8[_0xff2c('0x10')][_0xff2c('0x11')]);return _0x351571(_0x2795c8[_0xff2c('0x10')][_0xff2c('0x11')]);}logger[_0xff2c('0x10')](_0xff2c('0xd'),_0x2c6500,_0x2795c8[_0xff2c('0x10')][_0xff2c('0x11')]);return _0xf5c572(_0x2795c8['error'][_0xff2c('0x11')]);}else{logger[_0xff2c('0x12')](_0xff2c('0xd'),_0x2c6500,'request\x20sent');_0xf5c572(_0x2795c8[_0xff2c('0x13')][_0xff2c('0x11')]);}})['catch'](function(_0x59b485){logger[_0xff2c('0x10')](_0xff2c('0xd'),_0x2c6500,_0x59b485);_0x351571(_0x59b485);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 71258c3..2aab342 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_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 +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xefd363,_0x41b4d8){var _0x48e303=function(_0x31d981){while(--_0x31d981){_0xefd363['push'](_0xefd363['shift']());}};_0x48e303(++_0x41b4d8);}(_0xedd9,0xfc));var _0x9edd=function(_0x2934fb,_0x1c4dbf){_0x2934fb=_0x2934fb-0x0;var _0x13dc11=_0xedd9[_0x2934fb];return _0x13dc11;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9352390..6e456a4 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 _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 +var _0x2afc=['unique_name_and_version','app.js','BOOLEAN','sequelize','exports','STRING'];(function(_0x5cdf85,_0x4f5610){var _0x109a19=function(_0x97db52){while(--_0x97db52){_0x5cdf85['push'](_0x5cdf85['shift']());}};_0x109a19(++_0x4f5610);}(_0x2afc,0x87));var _0xc2af=function(_0x544072,_0xc41ee1){_0x544072=_0x544072-0x0;var _0x590bf6=_0x2afc[_0x544072];return _0x590bf6;};'use strict';var Sequelize=require(_0xc2af('0x0'));module[_0xc2af('0x1')]={'name':{'type':Sequelize[_0xc2af('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xc2af('0x2')],'allowNull':![],'unique':_0xc2af('0x3')},'main':{'type':Sequelize[_0xc2af('0x2')],'defaultValue':_0xc2af('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xc2af('0x2')]},'type':{'type':Sequelize[_0xc2af('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xc2af('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xc2af('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xc2af('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xc2af('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 294ff13..b102ed0 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 _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 +var _0x4975=['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','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','Integration','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x84ae77,_0x57aeda){var _0x1be8ae=function(_0x279c58){while(--_0x279c58){_0x84ae77['push'](_0x84ae77['shift']());}};_0x1be8ae(++_0x57aeda);}(_0x4975,0x86));var _0x5497=function(_0x1c671e,_0x4d2be0){_0x1c671e=_0x1c671e-0x0;var _0x22c1e0=_0x4975[_0x1c671e];return _0x22c1e0;};'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'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['Integration']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['Integration'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 27ab953..0f5a887 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 _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 +var _0x1f00=['moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','../../config/logger'];(function(_0x3b5e5,_0x37464a){var _0x550179=function(_0x5cf45b){while(--_0x5cf45b){_0x3b5e5['push'](_0x3b5e5['shift']());}};_0x550179(++_0x37464a);}(_0x1f00,0x8e));var _0x01f0=function(_0x31f91d,_0x336e57){_0x31f91d=_0x31f91d-0x0;var _0xa4916d=_0x1f00[_0x31f91d];return _0xa4916d;};'use strict';var _=require('lodash');var util=require(_0x01f0('0x0'));var logger=require(_0x01f0('0x1'))('api');var moment=require(_0x01f0('0x2'));var BPromise=require(_0x01f0('0x3'));var rp=require(_0x01f0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01f0('0x5'));var config=require(_0x01f0('0x6'));var attributes=require(_0x01f0('0x7'));module[_0x01f0('0x8')]=function(_0xa34afe,_0x12c797){return _0xa34afe[_0x01f0('0x9')](_0x01f0('0xa'),attributes,{'tableName':_0x01f0('0xb'),'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 6d2ffd3..832da4e 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 _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 +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4bbea6,_0x536897){var _0xe49e3a=function(_0x40b755){while(--_0x40b755){_0x4bbea6['push'](_0x4bbea6['shift']());}};_0xe49e3a(++_0x536897);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0x5f2f[_0x35b7ba];return _0x25ea5e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 4458c9d..1605c99 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 _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 +var _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xba34,0x119));var _0x4ba3=function(_0x116f72,_0x14c5e9){_0x116f72=_0x116f72-0x0;var _0x4c3f9e=_0xba34[_0x116f72];return _0x4c3f9e;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7a5779c..01165f3 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 _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 +var _0xf026=['STRING','INTEGER','DATE','BOOLEAN','TEXT','SENDING','RECEIVED'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0xf026,0x1ce));var _0x6f02=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0xf026[_0x1fcaf1];return _0x55f464;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x6f02('0x0')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x6f02('0x0')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x6f02('0x1')]},'contacts':{'type':Sequelize[_0x6f02('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6f02('0x0')]},'interface':{'type':Sequelize[_0x6f02('0x0')]},'membername':{'type':Sequelize[_0x6f02('0x0')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6f02('0x2')]},'holdtime':{'type':Sequelize[_0x6f02('0x1')]},'agentcomplete':{'type':Sequelize[_0x6f02('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6f02('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x6f02('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6f02('0x1')]},'reason':{'type':Sequelize[_0x6f02('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x6f02('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6f02('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6f02('0x2')]},'lastevent':{'type':Sequelize[_0x6f02('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6f02('0x0')]},'connectedlinenum':{'type':Sequelize[_0x6f02('0x0')]},'connectedlinename':{'type':Sequelize[_0x6f02('0x0')]},'language':{'type':Sequelize[_0x6f02('0x0')]},'accountcode':{'type':Sequelize[_0x6f02('0x0')]},'context':{'type':Sequelize[_0x6f02('0x0')]},'exten':{'type':Sequelize[_0x6f02('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x6f02('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x6f02('0x0')]},'destcalleridnum':{'type':Sequelize[_0x6f02('0x0')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6f02('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x6f02('0x0')]},'destcontext':{'type':Sequelize[_0x6f02('0x0')]},'destexten':{'type':Sequelize[_0x6f02('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x6f02('0x0')]},'inReplyTo':{'type':Sequelize[_0x6f02('0x0')]},'subject':{'type':Sequelize[_0x6f02('0x0')]},'from':{'type':Sequelize[_0x6f02('0x0')]},'to':{'type':Sequelize[_0x6f02('0x0')]},'cc':{'type':Sequelize[_0x6f02('0x0')]},'attachment':{'type':Sequelize[_0x6f02('0x4')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x6f02('0x4')]},'status':{'type':Sequelize['ENUM']('SENT',_0x6f02('0x5'),_0x6f02('0x6'),'FAILED')},'url':{'type':Sequelize[_0x6f02('0x0')]},'app':{'type':Sequelize[_0x6f02('0x0')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x6f02('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 4310bb5..f2341ff 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 _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 +var _0xf789=['update','then','destroy','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','IntegrationReport','include','findAll','rows','catch','show','includeAll','create','body','params','find','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xf789,0x162));var _0x9f78=function(_0x5ba6a7,_0x595d12){_0x5ba6a7=_0x5ba6a7-0x0;var _0xa133f=_0xf789[_0x5ba6a7];return _0xa133f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f78('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f78('0x1'));var rp=require(_0x9f78('0x2'));var moment=require(_0x9f78('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9f78('0x4'));var util=require(_0x9f78('0x5'));var path=require(_0x9f78('0x6'));var sox=require(_0x9f78('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f78('0x8'));var _=require(_0x9f78('0x9'));var squel=require(_0x9f78('0xa'));var crypto=require(_0x9f78('0xb'));var jsforce=require(_0x9f78('0xc'));var deskjs=require(_0x9f78('0xd'));var toCsv=require(_0x9f78('0xe'));var querystring=require(_0x9f78('0xf'));var Papa=require(_0x9f78('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9f78('0x11'));var as=require(_0x9f78('0x12'));var hardwareService=require(_0x9f78('0x13'));var logger=require('../../config/logger')(_0x9f78('0x14'));var utils=require(_0x9f78('0x15'));var config=require(_0x9f78('0x16'));var licenseUtil=require(_0x9f78('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45771b,_0x11dd83){_0x11dd83=_0x11dd83||0xcc;return function(_0x1f70a5){if(_0x1f70a5){return _0x45771b[_0x9f78('0x18')](_0x11dd83);}return _0x45771b[_0x9f78('0x19')](_0x11dd83)[_0x9f78('0x1a')]();};}function respondWithResult(_0x325d61,_0x32d33f){_0x32d33f=_0x32d33f||0xc8;return function(_0xdab3de){if(_0xdab3de){return _0x325d61[_0x9f78('0x19')](_0x32d33f)[_0x9f78('0x1b')](_0xdab3de);}};}function respondWithFilteredResult(_0x34297c,_0x2caf6e){return function(_0x5793cc){if(_0x5793cc){var _0x31ba6b=typeof _0x2caf6e[_0x9f78('0x1c')]===_0x9f78('0x1d')&&typeof _0x2caf6e['limit']===_0x9f78('0x1d');var _0x504ff3=_0x5793cc['count'];var _0x2c8820=_0x31ba6b?0x0:_0x2caf6e['offset'];var _0x42c658=_0x31ba6b?_0x5793cc[_0x9f78('0x1e')]:_0x2caf6e['offset']+_0x2caf6e['limit'];var _0x47ac6e;if(_0x42c658>=_0x504ff3){_0x42c658=_0x504ff3;_0x47ac6e=0xc8;}else{_0x47ac6e=0xce;}_0x34297c[_0x9f78('0x19')](_0x47ac6e);return _0x34297c[_0x9f78('0x1f')](_0x9f78('0x20'),_0x2c8820+'-'+_0x42c658+'/'+_0x504ff3)[_0x9f78('0x1b')](_0x5793cc);}return null;};}function patchUpdates(_0x12b3f4){return function(_0x43d3f9){try{jsonpatch[_0x9f78('0x21')](_0x43d3f9,_0x12b3f4,!![]);}catch(_0x3b0748){return BPromise[_0x9f78('0x22')](_0x3b0748);}return _0x43d3f9[_0x9f78('0x23')]();};}function saveUpdates(_0x3bc884,_0x84a02e){return function(_0x446305){if(_0x446305){return _0x446305[_0x9f78('0x24')](_0x3bc884)[_0x9f78('0x25')](function(_0x10e246){return _0x10e246;});}return null;};}function removeEntity(_0x51d248,_0x5e095a){return function(_0x10afe9){if(_0x10afe9){return _0x10afe9[_0x9f78('0x26')]()['then'](function(){_0x51d248[_0x9f78('0x19')](0xcc)[_0x9f78('0x1a')]();});}};}function handleEntityNotFound(_0x1ecf06,_0x14973a){return function(_0x42c434){if(!_0x42c434){_0x1ecf06[_0x9f78('0x18')](0x194);}return _0x42c434;};}function handleError(_0xf17eca,_0x5146b4){_0x5146b4=_0x5146b4||0x1f4;return function(_0x534716){logger['error'](_0x534716['stack']);if(_0x534716['name']){delete _0x534716['name'];}_0xf17eca['status'](_0x5146b4)[_0x9f78('0x27')](_0x534716);};}exports[_0x9f78('0x28')]=function(_0x5aaf9c,_0x10bdeb){var _0x4b31e5={},_0x1fe6c0={},_0x5e6796={'count':0x0,'rows':[]};var _0x10c0df=_[_0x9f78('0x29')](db['IntegrationReport'][_0x9f78('0x2a')],function(_0x33299c){return{'name':_0x33299c[_0x9f78('0x2b')],'type':_0x33299c[_0x9f78('0x2c')][_0x9f78('0x2d')]};});_0x1fe6c0[_0x9f78('0x2e')]=_['map'](_0x10c0df,_0x9f78('0x2f'));_0x1fe6c0[_0x9f78('0x30')]=_[_0x9f78('0x31')](_0x5aaf9c[_0x9f78('0x30')]);_0x1fe6c0[_0x9f78('0x32')]=_['intersection'](_0x1fe6c0[_0x9f78('0x2e')],_0x1fe6c0[_0x9f78('0x30')]);_0x4b31e5[_0x9f78('0x33')]=_[_0x9f78('0x34')](_0x1fe6c0[_0x9f78('0x2e')],qs[_0x9f78('0x35')](_0x5aaf9c[_0x9f78('0x30')][_0x9f78('0x35')]));_0x4b31e5[_0x9f78('0x33')]=_0x4b31e5[_0x9f78('0x33')][_0x9f78('0x36')]?_0x4b31e5[_0x9f78('0x33')]:_0x1fe6c0[_0x9f78('0x2e')];if(!_0x5aaf9c[_0x9f78('0x30')][_0x9f78('0x37')](_0x9f78('0x38'))){_0x4b31e5[_0x9f78('0x39')]=qs[_0x9f78('0x39')](_0x5aaf9c[_0x9f78('0x30')][_0x9f78('0x39')]);_0x4b31e5[_0x9f78('0x1c')]=qs[_0x9f78('0x1c')](_0x5aaf9c['query']['offset']);}_0x4b31e5[_0x9f78('0x3a')]=qs['sort'](_0x5aaf9c[_0x9f78('0x30')][_0x9f78('0x3b')]);_0x4b31e5[_0x9f78('0x3c')]=qs['filters'](_[_0x9f78('0x3d')](_0x5aaf9c[_0x9f78('0x30')],_0x1fe6c0[_0x9f78('0x32')]),_0x10c0df);if(_0x5aaf9c['query']['filter']){_0x4b31e5[_0x9f78('0x3c')]=_['merge'](_0x4b31e5[_0x9f78('0x3c')],{'$or':_['map'](_0x10c0df,function(_0x25f10d){if(_0x25f10d[_0x9f78('0x2c')]!==_0x9f78('0x3e')){var _0x124152={};_0x124152[_0x25f10d[_0x9f78('0x2f')]]={'$like':'%'+_0x5aaf9c[_0x9f78('0x30')][_0x9f78('0x3f')]+'%'};return _0x124152;}})});}_0x4b31e5=_[_0x9f78('0x40')]({},_0x4b31e5,_0x5aaf9c[_0x9f78('0x41')]);var _0x14cf5d={'where':_0x4b31e5[_0x9f78('0x3c')]};return db[_0x9f78('0x42')][_0x9f78('0x1e')](_0x14cf5d)[_0x9f78('0x25')](function(_0x1b1b79){_0x5e6796[_0x9f78('0x1e')]=_0x1b1b79;if(_0x5aaf9c[_0x9f78('0x30')]['includeAll']){_0x4b31e5[_0x9f78('0x43')]=[{'all':!![]}];}return db[_0x9f78('0x42')][_0x9f78('0x44')](_0x4b31e5);})[_0x9f78('0x25')](function(_0x517a48){_0x5e6796[_0x9f78('0x45')]=_0x517a48;return _0x5e6796;})[_0x9f78('0x25')](respondWithFilteredResult(_0x10bdeb,_0x4b31e5))[_0x9f78('0x46')](handleError(_0x10bdeb,null));};exports[_0x9f78('0x47')]=function(_0x339c2e,_0x12639e){var _0x4b1cff={'raw':![],'where':{'id':_0x339c2e['params']['id']}},_0x53b39b={};_0x53b39b[_0x9f78('0x2e')]=_[_0x9f78('0x31')](db[_0x9f78('0x42')][_0x9f78('0x2a')]);_0x53b39b['query']=_[_0x9f78('0x31')](_0x339c2e['query']);_0x53b39b['filters']=_[_0x9f78('0x34')](_0x53b39b[_0x9f78('0x2e')],_0x53b39b[_0x9f78('0x30')]);_0x4b1cff[_0x9f78('0x33')]=_[_0x9f78('0x34')](_0x53b39b[_0x9f78('0x2e')],qs[_0x9f78('0x35')](_0x339c2e[_0x9f78('0x30')]['fields']));_0x4b1cff['attributes']=_0x4b1cff[_0x9f78('0x33')][_0x9f78('0x36')]?_0x4b1cff[_0x9f78('0x33')]:_0x53b39b['model'];if(_0x339c2e[_0x9f78('0x30')][_0x9f78('0x48')]){_0x4b1cff[_0x9f78('0x43')]=[{'all':!![]}];}_0x4b1cff=_[_0x9f78('0x40')]({},_0x4b1cff,_0x339c2e[_0x9f78('0x41')]);return db['IntegrationReport']['find'](_0x4b1cff)[_0x9f78('0x25')](handleEntityNotFound(_0x12639e,null))[_0x9f78('0x25')](respondWithResult(_0x12639e,null))[_0x9f78('0x46')](handleError(_0x12639e,null));};exports[_0x9f78('0x49')]=function(_0x2ac317,_0x3d10b1){return db[_0x9f78('0x42')][_0x9f78('0x49')](_0x2ac317[_0x9f78('0x4a')],{})[_0x9f78('0x25')](respondWithResult(_0x3d10b1,0xc9))['catch'](handleError(_0x3d10b1,null));};exports[_0x9f78('0x24')]=function(_0x161a67,_0x479e99){if(_0x161a67['body']['id']){delete _0x161a67['body']['id'];}return db[_0x9f78('0x42')]['find']({'where':{'id':_0x161a67[_0x9f78('0x4b')]['id']}})['then'](handleEntityNotFound(_0x479e99,null))[_0x9f78('0x25')](saveUpdates(_0x161a67[_0x9f78('0x4a')],null))[_0x9f78('0x25')](respondWithResult(_0x479e99,null))['catch'](handleError(_0x479e99,null));};exports[_0x9f78('0x26')]=function(_0x2cea60,_0x32afc8){return db[_0x9f78('0x42')][_0x9f78('0x4c')]({'where':{'id':_0x2cea60[_0x9f78('0x4b')]['id']}})['then'](handleEntityNotFound(_0x32afc8,null))[_0x9f78('0x25')](removeEntity(_0x32afc8,null))[_0x9f78('0x46')](handleError(_0x32afc8,null));};exports[_0x9f78('0x4d')]=function(_0x42c30a,_0x16e058){return db[_0x9f78('0x42')][_0x9f78('0x4d')]()['then'](respondWithResult(_0x16e058,null))[_0x9f78('0x46')](handleError(_0x16e058,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 2abde74..c66a49e 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 _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 +var _0x011f=['rimraf','../../config/environment','./integrationReport.attributes','report_integration','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x011f,0x130));var _0xf011=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0x011f[_0x46e523];return _0x5da0ee;};'use strict';var _=require('lodash');var util=require(_0xf011('0x0'));var logger=require(_0xf011('0x1'))('api');var moment=require(_0xf011('0x2'));var BPromise=require(_0xf011('0x3'));var rp=require(_0xf011('0x4'));var fs=require('fs');var path=require(_0xf011('0x5'));var rimraf=require(_0xf011('0x6'));var config=require(_0xf011('0x7'));var attributes=require(_0xf011('0x8'));module['exports']=function(_0x3035dc,_0x23f119){return _0x3035dc['define']('IntegrationReport',attributes,{'tableName':_0xf011('0x9'),'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 bd9dcfd..3ae8de5 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 _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 +var _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb698c2,_0x465b07){var _0x69f6e5=function(_0x253d23){while(--_0x253d23){_0xb698c2['push'](_0xb698c2['shift']());}};_0x69f6e5(++_0x465b07);}(_0xda19,0xd5));var _0x9da1=function(_0xc301f4,_0x45f3f0){_0xc301f4=_0xc301f4-0x0;var _0x2eb61b=_0xda19[_0xc301f4];return _0x2eb61b;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 11fb279..b766430 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 _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 +var _0x7ee1=['exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','isAuthenticated','/:id/sub_intervals','create','addInterval','post','put','/:id','update','delete','destroy'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0x7ee1,0x8d));var _0x17ee=function(_0x1d0869,_0x406960){_0x1d0869=_0x1d0869-0x0;var _0x2f706e=_0x7ee1[_0x1d0869];return _0x2f706e;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/:id',auth[_0x17ee('0x9')](),controller['show']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['getIntervals']);router['post']('/',auth['isAuthenticated'](),controller[_0x17ee('0xb')]);router['post'](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xc')]);router[_0x17ee('0xd')]('/:id/sub_intervals/create_many',auth[_0x17ee('0x9')](),controller['addIntervals']);router[_0x17ee('0xe')](_0x17ee('0xf'),auth[_0x17ee('0x9')](),controller[_0x17ee('0x10')]);router[_0x17ee('0x11')](_0x17ee('0xf'),auth[_0x17ee('0x9')](),controller[_0x17ee('0x12')]);module[_0x17ee('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index a93ec65..ef020f8 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 _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 +var _0xa18f=['sequelize','STRING'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa18f,0x12e));var _0xfa18=function(_0x48f778,_0x466b43){_0x48f778=_0x48f778-0x0;var _0x51bdd6=_0xa18f[_0x48f778];return _0x51bdd6;};'use strict';var Sequelize=require(_0xfa18('0x0'));module['exports']={'name':{'type':Sequelize[_0xfa18('0x1')]},'description':{'type':Sequelize[_0xfa18('0x1')]},'interval':{'type':Sequelize[_0xfa18('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 47a422f..3236248 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 _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 +var _0x64a8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','getIntervals','findOne','order','hasOwnProperty','nolimit','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv'];(function(_0x4f48ff,_0x16b4ec){var _0x227dc6=function(_0x584a1e){while(--_0x584a1e){_0x4f48ff['push'](_0x4f48ff['shift']());}};_0x227dc6(++_0x16b4ec);}(_0x64a8,0xa9));var _0x864a=function(_0x192448,_0x93327c){_0x192448=_0x192448-0x0;var _0x50d759=_0x64a8[_0x192448];return _0x50d759;};'use strict';var emlformat=require(_0x864a('0x0'));var rimraf=require(_0x864a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x864a('0x2'));var rp=require(_0x864a('0x3'));var moment=require(_0x864a('0x4'));var BPromise=require(_0x864a('0x5'));var Mustache=require(_0x864a('0x6'));var util=require(_0x864a('0x7'));var path=require('path');var sox=require(_0x864a('0x8'));var csv=require('to-csv');var ejs=require(_0x864a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x864a('0xa'));var squel=require(_0x864a('0xb'));var crypto=require(_0x864a('0xc'));var jsforce=require(_0x864a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x864a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x864a('0xf'));var as=require(_0x864a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x864a('0x11'))(_0x864a('0x12'));var utils=require(_0x864a('0x13'));var config=require(_0x864a('0x14'));var licenseUtil=require(_0x864a('0x15'));var db=require(_0x864a('0x16'))['db'];var extensions=require(_0x864a('0x17'));function respondWithStatusCode(_0x2acea3,_0x4ff217){_0x4ff217=_0x4ff217||0xcc;return function(_0xe081ff){if(_0xe081ff){return _0x2acea3[_0x864a('0x18')](_0x4ff217);}return _0x2acea3[_0x864a('0x19')](_0x4ff217)[_0x864a('0x1a')]();};}function respondWithResult(_0x453788,_0x23cd91){_0x23cd91=_0x23cd91||0xc8;return function(_0x172baf){if(_0x172baf){return _0x453788[_0x864a('0x19')](_0x23cd91)[_0x864a('0x1b')](_0x172baf);}};}function respondWithFilteredResult(_0x1cb3c0,_0x15f2ef){return function(_0x247e53){if(_0x247e53){var _0x4e42e7=typeof _0x15f2ef['offset']==='undefined'&&typeof _0x15f2ef[_0x864a('0x1c')]===_0x864a('0x1d');var _0x39ffba=_0x247e53[_0x864a('0x1e')];var _0x282c30=_0x4e42e7?0x0:_0x15f2ef[_0x864a('0x1f')];var _0x58941b=_0x4e42e7?_0x247e53['count']:_0x15f2ef[_0x864a('0x1f')]+_0x15f2ef[_0x864a('0x1c')];var _0x38e7ea;if(_0x58941b>=_0x39ffba){_0x58941b=_0x39ffba;_0x38e7ea=0xc8;}else{_0x38e7ea=0xce;}_0x1cb3c0['status'](_0x38e7ea);return _0x1cb3c0['set'](_0x864a('0x20'),_0x282c30+'-'+_0x58941b+'/'+_0x39ffba)['json'](_0x247e53);}return null;};}function patchUpdates(_0x26c759){return function(_0x429d37){try{jsonpatch[_0x864a('0x21')](_0x429d37,_0x26c759,!![]);}catch(_0x14f364){return BPromise[_0x864a('0x22')](_0x14f364);}return _0x429d37[_0x864a('0x23')]();};}function saveUpdates(_0x43a4fd,_0xee19d4){return function(_0x296f7e){if(_0x296f7e){return _0x296f7e['update'](_0x43a4fd)[_0x864a('0x24')](function(_0x3086c1){return _0x3086c1;});}return null;};}function removeEntity(_0x4213c3,_0x57ffb6){return function(_0xa64b70){if(_0xa64b70){return _0xa64b70[_0x864a('0x25')]()[_0x864a('0x24')](function(){var _0x153fb3=_0xa64b70[_0x864a('0x26')]({'plain':!![]});var _0x1dc7e6=_0x864a('0x27');return db[_0x864a('0x28')][_0x864a('0x25')]({'where':{'type':_0x1dc7e6,'resourceId':_0x153fb3['id']}})[_0x864a('0x24')](function(){return _0xa64b70;});})['then'](function(){_0x4213c3[_0x864a('0x19')](0xcc)[_0x864a('0x1a')]();});}};}function handleEntityNotFound(_0x10945a,_0xa08ca6){return function(_0x4350d8){if(!_0x4350d8){_0x10945a['sendStatus'](0x194);}return _0x4350d8;};}function handleError(_0x146156,_0x1902b1){_0x1902b1=_0x1902b1||0x1f4;return function(_0x3d2d0f){logger['error'](_0x3d2d0f[_0x864a('0x29')]);if(_0x3d2d0f[_0x864a('0x2a')]){delete _0x3d2d0f[_0x864a('0x2a')];}_0x146156[_0x864a('0x19')](_0x1902b1)[_0x864a('0x2b')](_0x3d2d0f);};}exports['index']=function(_0x58e649,_0x2dc63c){var _0x566912={},_0x1d4b00={},_0x48b3ae={'count':0x0,'rows':[]};var _0x4c3f19=_[_0x864a('0x2c')](db[_0x864a('0x2d')][_0x864a('0x2e')],function(_0x2bdd27){return{'name':_0x2bdd27[_0x864a('0x2f')],'type':_0x2bdd27[_0x864a('0x30')][_0x864a('0x31')]};});_0x1d4b00['model']=_['map'](_0x4c3f19,_0x864a('0x2a'));_0x1d4b00['query']=_['keys'](_0x58e649[_0x864a('0x32')]);_0x1d4b00['filters']=_['intersection'](_0x1d4b00['model'],_0x1d4b00[_0x864a('0x32')]);_0x566912['attributes']=_[_0x864a('0x33')](_0x1d4b00[_0x864a('0x34')],qs[_0x864a('0x35')](_0x58e649[_0x864a('0x32')][_0x864a('0x35')]));_0x566912[_0x864a('0x36')]=_0x566912['attributes'][_0x864a('0x37')]?_0x566912[_0x864a('0x36')]:_0x1d4b00[_0x864a('0x34')];if(!_0x58e649[_0x864a('0x32')]['hasOwnProperty']('nolimit')){_0x566912[_0x864a('0x1c')]=qs[_0x864a('0x1c')](_0x58e649[_0x864a('0x32')][_0x864a('0x1c')]);_0x566912[_0x864a('0x1f')]=qs[_0x864a('0x1f')](_0x58e649[_0x864a('0x32')][_0x864a('0x1f')]);}_0x566912['order']=qs[_0x864a('0x38')](_0x58e649[_0x864a('0x32')][_0x864a('0x38')]);_0x566912[_0x864a('0x39')]=qs[_0x864a('0x3a')](_[_0x864a('0x3b')](_0x58e649[_0x864a('0x32')],_0x1d4b00[_0x864a('0x3a')]),_0x4c3f19);if(_0x58e649[_0x864a('0x32')]['filter']){_0x566912[_0x864a('0x39')]=_[_0x864a('0x3c')](_0x566912[_0x864a('0x39')],{'$or':_['map'](_0x4c3f19,function(_0x45def2){if(_0x45def2['type']!==_0x864a('0x3d')){var _0x4bd95a={};_0x4bd95a[_0x45def2[_0x864a('0x2a')]]={'$like':'%'+_0x58e649[_0x864a('0x32')][_0x864a('0x3e')]+'%'};return _0x4bd95a;}})});}_0x566912=_[_0x864a('0x3c')]({},_0x566912,_0x58e649[_0x864a('0x3f')]);var _0x282756={'where':_0x566912[_0x864a('0x39')]};return db[_0x864a('0x2d')][_0x864a('0x1e')](_0x282756)[_0x864a('0x24')](function(_0x20ec08){_0x48b3ae['count']=_0x20ec08;if(_0x58e649[_0x864a('0x32')][_0x864a('0x40')]){_0x566912[_0x864a('0x41')]=[{'all':!![]}];}return db[_0x864a('0x2d')][_0x864a('0x42')](_0x566912);})[_0x864a('0x24')](function(_0x451d26){_0x48b3ae['rows']=_0x451d26;return _0x48b3ae;})[_0x864a('0x24')](respondWithFilteredResult(_0x2dc63c,_0x566912))[_0x864a('0x43')](handleError(_0x2dc63c,null));};exports[_0x864a('0x44')]=function(_0xafea4b,_0x2abe65){var _0x3191b9={'raw':!![],'where':{'id':_0xafea4b[_0x864a('0x45')]['id']}},_0x58c245={};_0x58c245['model']=_[_0x864a('0x46')](db['Interval']['rawAttributes']);_0x58c245[_0x864a('0x32')]=_[_0x864a('0x46')](_0xafea4b[_0x864a('0x32')]);_0x58c245[_0x864a('0x3a')]=_[_0x864a('0x33')](_0x58c245[_0x864a('0x34')],_0x58c245[_0x864a('0x32')]);_0x3191b9[_0x864a('0x36')]=_[_0x864a('0x33')](_0x58c245[_0x864a('0x34')],qs[_0x864a('0x35')](_0xafea4b[_0x864a('0x32')]['fields']));_0x3191b9[_0x864a('0x36')]=_0x3191b9[_0x864a('0x36')][_0x864a('0x37')]?_0x3191b9[_0x864a('0x36')]:_0x58c245[_0x864a('0x34')];if(_0xafea4b[_0x864a('0x32')][_0x864a('0x40')]){_0x3191b9['include']=[{'all':!![]}];}_0x3191b9=_['merge']({},_0x3191b9,_0xafea4b['options']);return db[_0x864a('0x2d')][_0x864a('0x47')](_0x3191b9)[_0x864a('0x24')](handleEntityNotFound(_0x2abe65,null))['then'](respondWithResult(_0x2abe65,null))[_0x864a('0x43')](handleError(_0x2abe65,null));};exports[_0x864a('0x48')]=function(_0x5854c1,_0x163bf5){return db[_0x864a('0x2d')][_0x864a('0x48')](_0x5854c1[_0x864a('0x49')],{})[_0x864a('0x24')](function(_0x2ef7e4){var _0x491017=_0x5854c1[_0x864a('0x4a')][_0x864a('0x26')]({'plain':!![]});if(!_0x491017)throw new Error(_0x864a('0x4b'));if(_0x491017[_0x864a('0x4c')]===_0x864a('0x4a')){var _0x428bec=_0x2ef7e4[_0x864a('0x26')]({'plain':!![]});var _0x503096=_0x864a('0x27');return db['UserProfileSection'][_0x864a('0x47')]({'where':{'name':_0x503096,'userProfileId':_0x491017[_0x864a('0x4d')]},'raw':!![]})[_0x864a('0x24')](function(_0x10287f){if(_0x10287f&&_0x10287f[_0x864a('0x4e')]===0x0){return db[_0x864a('0x28')][_0x864a('0x48')]({'name':_0x428bec[_0x864a('0x2a')],'resourceId':_0x428bec['id'],'type':_0x10287f[_0x864a('0x2a')],'sectionId':_0x10287f['id']},{})[_0x864a('0x24')](function(){return _0x2ef7e4;});}else{return _0x2ef7e4;}})[_0x864a('0x43')](function(_0x5d381f){logger[_0x864a('0x4f')](_0x864a('0x50'),_0x5d381f);throw _0x5d381f;});}return _0x2ef7e4;})[_0x864a('0x24')](respondWithResult(_0x163bf5,0xc9))[_0x864a('0x43')](handleError(_0x163bf5,null));};exports[_0x864a('0x51')]=function(_0x338a13,_0x45be7f){if(_0x338a13[_0x864a('0x49')]['id']){delete _0x338a13['body']['id'];}return db[_0x864a('0x2d')][_0x864a('0x47')]({'where':{'id':_0x338a13[_0x864a('0x45')]['id']}})[_0x864a('0x24')](handleEntityNotFound(_0x45be7f,null))[_0x864a('0x24')](saveUpdates(_0x338a13[_0x864a('0x49')],null))[_0x864a('0x24')](respondWithResult(_0x45be7f,null))['catch'](handleError(_0x45be7f,null));};exports[_0x864a('0x25')]=function(_0x243682,_0x56eb11){return db['Interval'][_0x864a('0x47')]({'where':{'id':_0x243682[_0x864a('0x45')]['id']}})[_0x864a('0x24')](handleEntityNotFound(_0x56eb11,null))[_0x864a('0x24')](removeEntity(_0x56eb11,null))[_0x864a('0x43')](handleError(_0x56eb11,null));};exports[_0x864a('0x52')]=function(_0x50f668,_0x4af47a,_0x23677c){if(_0x50f668[_0x864a('0x49')]['id']){delete _0x50f668['body']['id'];}return db[_0x864a('0x2d')][_0x864a('0x47')]({'where':{'id':_0x50f668[_0x864a('0x45')]['id']}})[_0x864a('0x24')](handleEntityNotFound(_0x4af47a,null))['then'](function(_0x36d0fb){if(_0x36d0fb){_0x50f668['body']['IntervalId']=_0x36d0fb['id'];return db[_0x864a('0x2d')][_0x864a('0x48')](_0x50f668['body']);}})['then'](respondWithResult(_0x4af47a,null))[_0x864a('0x43')](handleError(_0x4af47a,null));};exports[_0x864a('0x53')]=function(_0x3afa6e,_0x891041,_0x23b059){var _0x433c0c={};var _0x4afb8d={};var _0x479355;var _0x9a776;return db[_0x864a('0x2d')][_0x864a('0x54')]({'where':{'id':_0x3afa6e['params']['id']}})[_0x864a('0x24')](handleEntityNotFound(_0x891041,null))[_0x864a('0x24')](function(_0x2b7d07){if(_0x2b7d07){_0x479355=_0x2b7d07;_0x4afb8d[_0x864a('0x34')]=_[_0x864a('0x46')](db[_0x864a('0x2d')][_0x864a('0x2e')]);_0x4afb8d['query']=_[_0x864a('0x46')](_0x3afa6e['query']);_0x4afb8d[_0x864a('0x3a')]=_['intersection'](_0x4afb8d[_0x864a('0x34')],_0x4afb8d[_0x864a('0x32')]);_0x433c0c[_0x864a('0x36')]=_[_0x864a('0x33')](_0x4afb8d[_0x864a('0x34')],qs[_0x864a('0x35')](_0x3afa6e[_0x864a('0x32')][_0x864a('0x35')]));_0x433c0c[_0x864a('0x36')]=_0x433c0c[_0x864a('0x36')]['length']?_0x433c0c[_0x864a('0x36')]:_0x4afb8d[_0x864a('0x34')];_0x433c0c[_0x864a('0x55')]=qs[_0x864a('0x38')](_0x3afa6e['query'][_0x864a('0x38')]);_0x433c0c['where']=qs[_0x864a('0x3a')](_[_0x864a('0x3b')](_0x3afa6e[_0x864a('0x32')],_0x4afb8d[_0x864a('0x3a')]));if(_0x3afa6e['query'][_0x864a('0x3e')]){_0x433c0c[_0x864a('0x39')]=_['merge'](_0x433c0c[_0x864a('0x39')],{'$or':_['map'](_0x433c0c['attributes'],function(_0x313ab6){var _0x220710={};_0x220710[_0x313ab6]={'$like':'%'+_0x3afa6e['query'][_0x864a('0x3e')]+'%'};return _0x220710;})});}_0x433c0c=_[_0x864a('0x3c')]({},_0x433c0c,_0x3afa6e[_0x864a('0x3f')]);return _0x479355[_0x864a('0x53')](_0x433c0c);}})[_0x864a('0x24')](function(_0x17c81c){if(_0x17c81c){_0x9a776=_0x17c81c[_0x864a('0x37')];if(!_0x3afa6e[_0x864a('0x32')][_0x864a('0x56')](_0x864a('0x57'))){_0x433c0c[_0x864a('0x1c')]=qs[_0x864a('0x1c')](_0x3afa6e[_0x864a('0x32')][_0x864a('0x1c')]);_0x433c0c['offset']=qs[_0x864a('0x1f')](_0x3afa6e[_0x864a('0x32')][_0x864a('0x1f')]);}return _0x479355['getIntervals'](_0x433c0c);}})['then'](function(_0x4ad033){if(_0x4ad033){return _0x4ad033?{'count':_0x9a776,'rows':_0x4ad033}:null;}})[_0x864a('0x24')](respondWithResult(_0x891041,null))[_0x864a('0x43')](handleError(_0x891041,null));};exports['addIntervals']=function(_0x434e8e,_0x2465b7,_0x3e233e){return db[_0x864a('0x2d')][_0x864a('0x54')]({'where':{'id':_0x434e8e[_0x864a('0x45')]['id']}})[_0x864a('0x24')](handleEntityNotFound(_0x2465b7,null))[_0x864a('0x24')](function(_0x741fdd){if(_0x741fdd){return db[_0x864a('0x58')][_0x864a('0x59')](function(_0x4b27c4){return db[_0x864a('0x2d')][_0x864a('0x25')]({'where':{'IntervalId':_0x434e8e[_0x864a('0x45')]['id']},'transaction':_0x4b27c4})[_0x864a('0x24')](function(_0x36de09){var _0x33d585=_[_0x864a('0x2c')](_0x434e8e['body'],function(_0x412881){delete _0x412881['id'];_0x412881[_0x864a('0x5a')]=_0x434e8e['params']['id'];return _0x412881;});return db[_0x864a('0x2d')][_0x864a('0x5b')](_0x33d585,{'transaction':_0x4b27c4});});})['then'](function(){return db[_0x864a('0x2d')][_0x864a('0x42')]({'where':{'IntervalId':_0x434e8e[_0x864a('0x45')]['id']}});});}})['then'](respondWithResult(_0x2465b7,null))[_0x864a('0x43')](handleError(_0x2465b7,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 55d18af..7e423ee 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 _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 +var _0x9c99=['all','map','ifTime','reduce','./interval.attributes','../../utils/iftime','iftime','Interval','tools_intervals','rewrite','interval','string','getIntervals'];(function(_0x5581c9,_0x3792da){var _0x1a2ef7=function(_0x47ca00){while(--_0x47ca00){_0x5581c9['push'](_0x5581c9['shift']());}};_0x1a2ef7(++_0x3792da);}(_0x9c99,0xa0));var _0x99c9=function(_0x5c27b6,_0x4a3c28){_0x5c27b6=_0x5c27b6-0x0;var _0x284ce4=_0x9c99[_0x5c27b6];return _0x284ce4;};'use strict';var attributes=require(_0x99c9('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x99c9('0x1'))[_0x99c9('0x2')];module['exports']=function(_0x2f76dd){return _0x2f76dd['define'](_0x99c9('0x3'),attributes,{'tableName':_0x99c9('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ebdd8){extensions[_0x99c9('0x5')](_0x2f76dd,_0x5ebdd8);},'afterBulkCreate':function(_0x3328f2,_0x5d741c,_0x2962b4){_0x2962b4();extensions[_0x99c9('0x5')](_0x2f76dd,_0x3328f2[0x0]);},'afterUpdate':function(_0x517d09){extensions[_0x99c9('0x5')](_0x2f76dd,_0x517d09);},'afterDestroy':function(_0x2f84d4){extensions[_0x99c9('0x5')](_0x2f76dd,_0x2f84d4);}},'instanceMethods':{'ifTime':function(_0x3663d4=undefined,_0x22b793=new Date()){if(typeof this[_0x99c9('0x6')]===_0x99c9('0x7')){return iftime(this[_0x99c9('0x6')],_0x3663d4,_0x22b793);}else{return this[_0x99c9('0x8')]()['then'](function(_0x1698a0){return Promise[_0x99c9('0x9')](_0x1698a0[_0x99c9('0xa')](function(_0x2f1887){return _0x2f1887[_0x99c9('0xb')](_0x3663d4,_0x22b793);}));})['then'](function(_0x3aac34){return _0x3aac34[_0x99c9('0xc')](function(_0x42dca1,_0x4d2e16){return _0x42dca1||_0x4d2e16;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 23a7560..92d5492 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 _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 +var _0xdeed=['Iftime','silly','reduce','IntervalIftime','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','findAll','options','where','attributes','include','map','model','then','info','debug','stringify','error','message','ShowInterval','raw','catch','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdeed,0x14c));var _0xddee=function(_0x3d6055,_0x248662){_0x3d6055=_0x3d6055-0x0;var _0x51d9e2=_0xdeed[_0x3d6055];return _0x51d9e2;};'use strict';var _=require('lodash');var util=require(_0xddee('0x0'));var db=require(_0xddee('0x1'))['db'];var iftime=require(_0xddee('0x2'))[_0xddee('0x3')];var logger=require(_0xddee('0x4'))('rpc');exports[_0xddee('0x5')]=function(_0x1ced31){var _0x385b10=this;return new Promise(function(_0x2309d2,_0x5959fb){return db[_0xddee('0x6')][_0xddee('0x7')]({'raw':_0x1ced31[_0xddee('0x8')]?_0x1ced31[_0xddee('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x1ced31[_0xddee('0x8')]?_0x1ced31[_0xddee('0x8')][_0xddee('0x9')]||null:null,'attributes':_0x1ced31[_0xddee('0x8')]?_0x1ced31[_0xddee('0x8')][_0xddee('0xa')]||null:null,'limit':_0x1ced31[_0xddee('0x8')]?_0x1ced31[_0xddee('0x8')]['limit']||null:null,'include':_0x1ced31['options']?_0x1ced31[_0xddee('0x8')][_0xddee('0xb')]?_[_0xddee('0xc')](_0x1ced31[_0xddee('0x8')][_0xddee('0xb')],function(_0x5a14bc){return{'model':db[_0x5a14bc[_0xddee('0xd')]],'as':_0x5a14bc['as'],'attributes':_0x5a14bc['attributes'],'include':_0x5a14bc['include']?_[_0xddee('0xc')](_0x5a14bc[_0xddee('0xb')],function(_0x16aea4){return{'model':db[_0x16aea4[_0xddee('0xd')]],'as':_0x16aea4['as'],'attributes':_0x16aea4[_0xddee('0xa')],'include':_0x16aea4['include']?_[_0xddee('0xc')](_0x16aea4[_0xddee('0xb')],function(_0x4f2400){return{'model':db[_0x4f2400[_0xddee('0xd')]],'as':_0x4f2400['as'],'attributes':_0x4f2400['attributes']};}):[]};}):[]};}):[]:[]})[_0xddee('0xe')](function(_0x564b54){logger[_0xddee('0xf')](_0xddee('0x5'),_0x1ced31);logger[_0xddee('0x10')]('GetInterval',_0x1ced31,JSON[_0xddee('0x11')](_0x564b54));_0x2309d2(_0x564b54);})['catch'](function(_0x3eae45){logger[_0xddee('0x12')]('GetInterval',_0x3eae45[_0xddee('0x13')],_0x1ced31);_0x5959fb(_0x385b10['error'](0x1f4,_0x3eae45[_0xddee('0x13')]));});});};exports[_0xddee('0x14')]=function(_0x14741e){var _0x511779=this;return new Promise(function(_0xe6c1cc,_0x4527da){return db['Interval']['find']({'raw':_0x14741e[_0xddee('0x8')]?_0x14741e[_0xddee('0x8')][_0xddee('0x15')]===undefined?!![]:![]:!![],'where':_0x14741e['options']?_0x14741e['options']['where']||null:null,'attributes':_0x14741e['options']?_0x14741e['options'][_0xddee('0xa')]||null:null,'include':_0x14741e[_0xddee('0x8')]?_0x14741e['options'][_0xddee('0xb')]?_[_0xddee('0xc')](_0x14741e[_0xddee('0x8')][_0xddee('0xb')],function(_0x176ef5){return{'model':db[_0x176ef5[_0xddee('0xd')]],'as':_0x176ef5['as'],'attributes':_0x176ef5['attributes'],'include':_0x176ef5[_0xddee('0xb')]?_[_0xddee('0xc')](_0x176ef5[_0xddee('0xb')],function(_0x1e9a94){return{'model':db[_0x1e9a94['model']],'as':_0x1e9a94['as'],'attributes':_0x1e9a94[_0xddee('0xa')],'include':_0x1e9a94[_0xddee('0xb')]?_[_0xddee('0xc')](_0x1e9a94[_0xddee('0xb')],function(_0x3a7b71){return{'model':db[_0x3a7b71[_0xddee('0xd')]],'as':_0x3a7b71['as'],'attributes':_0x3a7b71[_0xddee('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4163){logger[_0xddee('0xf')](_0xddee('0x14'),_0x14741e);logger[_0xddee('0x10')](_0xddee('0x14'),_0x14741e,JSON[_0xddee('0x11')](_0x1b4163));_0xe6c1cc(_0x1b4163);})[_0xddee('0x16')](function(_0x4b294a){logger[_0xddee('0x12')](_0xddee('0x14'),_0x4b294a[_0xddee('0x13')],_0x14741e);_0x4527da(_0x511779[_0xddee('0x12')](0x1f4,_0x4b294a[_0xddee('0x13')]));});});};function checkArrayOfIntervals(_0x2df8e5,_0x47eaa0){var _0x2bf8da=[];return db[_0xddee('0x6')]['findAll']({'where':{'id':_0x2df8e5}})[_0xddee('0xe')](function(_0x47c582){_0x2bf8da=_0x47c582;return Promise[_0xddee('0x17')](_0x2bf8da['map'](function(_0x3fafa1){return _0x3fafa1[_0xddee('0x18')](_0x47eaa0);}));})[_0xddee('0xe')](function(_0xe07188){var _0x3f5cce=_0xe07188['reduce'](function(_0x3ad52e,_0x22284b){return _0x3ad52e||_0x22284b;},![]);logger[_0xddee('0xf')](util[_0xddee('0x19')](_0xddee('0x1a'),_0x2bf8da[_0xddee('0xc')](function(_0x1420f1){return _0x1420f1[_0xddee('0x1b')];})[_0xddee('0x1c')](',\x20'),_0x2bf8da['map'](function(_0x5cf996){return _0x5cf996['id'];})[_0xddee('0x1c')](',\x20')));return _0x3f5cce;});}function checkSingleInterval(_0x34c639,_0x1d1397){return db['Interval'][_0xddee('0x1d')](_0x34c639)['then'](function(_0x1c5dfd){if(_0x1c5dfd){logger[_0xddee('0xf')](util['format'](_0xddee('0x1e'),_0x1c5dfd['name'],_0x1c5dfd['id']));return _0x1c5dfd[_0xddee('0x18')](_0x1d1397);}});}exports['IntervalIftime']=function(_0x1516a0){var _0x26e972=_0x1516a0[_0xddee('0x1f')];var _0x4ab959=Array[_0xddee('0x20')](_0x1516a0[_0xddee('0x21')])?_0x1516a0[_0xddee('0x21')]:typeof _0x1516a0[_0xddee('0x21')]===_0xddee('0x22')?[_0x1516a0['intervals']]:[];var _0x59d123=_0x1516a0['timezone']||undefined;var _0x37786a=![];if(_0x4ab959[_0xddee('0x23')]){logger[_0xddee('0xf')](util['format'](_0xddee('0x24'),_0x4ab959[_0xddee('0x1c')](';\x20')));}if(_0x59d123){logger[_0xddee('0xf')](util[_0xddee('0x19')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x59d123));}logger[_0xddee('0x10')](_0xddee('0x25'),_0x37786a);logger[_0xddee('0x26')]('IntervalIftime',_0x1516a0);return Promise['resolve']()[_0xddee('0xe')](function(){if(Array[_0xddee('0x20')](_0x26e972)){return checkArrayOfIntervals(_0x26e972,_0x59d123);}else if(_0x26e972){return checkSingleInterval(_0x26e972,_0x59d123);}})['then'](function(_0x703e38){var _0x332f78=_0x4ab959[_0xddee('0x27')](function(_0x2d955d,_0x33d19d){return _0x2d955d||iftime(_0x33d19d,_0x59d123);},![]);_0x37786a=_0x703e38||_0x332f78;return _0x37786a;})[_0xddee('0x16')](function(_0x3fcfec){logger['error'](_0xddee('0x28'),_0x1516a0,_0x3fcfec);throw this[_0xddee('0x12')](0x1f4,_0x3fcfec[_0xddee('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6b9dad3..78d030c 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_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 +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0x0b0e[_0x1f5887];return _0x21774b;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 6f69c4d..8cae4fa 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 _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 +var _0x6444=['POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','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','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x4cb095,_0x58da07){var _0x2b565d=function(_0x4d41b3){while(--_0x4d41b3){_0x4cb095['push'](_0x4cb095['shift']());}};_0x2b565d(++_0x58da07);}(_0x6444,0x10e));var _0x4644=function(_0x6efb33,_0x6a6f5f){_0x6efb33=_0x6efb33-0x0;var _0x30a263=_0x6444[_0x6efb33];return _0x30a263;};'use strict';var BPromise=require(_0x4644('0x0'));var https=require(_0x4644('0x1'));var logger=require(_0x4644('0x2'))(_0x4644('0x3'));var USERNAME=_0x4644('0x4');var PASSWORD=_0x4644('0x5');function openIssue(_0x2c348c,_0x4f2192){var _0x3dafcd={'fields':{'project':{'key':_0x2c348c[_0x4644('0x6')]||'MOTGUI'},'summary':(_0x2c348c[_0x4644('0x7')]||_0x4644('0x8'))+_0x4644('0x9')+_0x2c348c['ip'],'description':_0x2c348c['description']||JSON[_0x4644('0xa')](_0x2c348c),'issuetype':{'name':_0x2c348c[_0x4644('0xb')]||_0x4644('0xc')}}};_0x3dafcd[_0x4644('0xd')][_0x4644('0xe')]=_0x2c348c['email'];_0x3dafcd['fields'][_0x4644('0xf')]=_0x2c348c['oldToken'];_0x3dafcd['fields'][_0x4644('0x10')]=_0x2c348c['newToken'];_0x3dafcd[_0x4644('0xd')][_0x4644('0x11')]=_0x2c348c[_0x4644('0x12')];_0x3dafcd['fields'][_0x4644('0x13')]=_0x2c348c[_0x4644('0x14')];_0x3dafcd[_0x4644('0xd')][_0x4644('0x15')]=_0x2c348c['ip'];var _0xa73369={'host':_0x4644('0x16'),'port':0x1bb,'path':_0x4644('0x17'),'method':_0x4644('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x4644('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x4644('0x1a')](_0x4644('0x1b'))}};var _0x575820=JSON[_0x4644('0xa')](_0x3dafcd);var _0x5844cb=https[_0x4644('0x1c')](_0xa73369,function(_0x4c2919){_0x4c2919[_0x4644('0x1d')](_0x4644('0x1e'));var _0x5e71c1='';_0x4c2919['on'](_0x4644('0x1f'),function(_0x3dc775){_0x5e71c1+=_0x3dc775;});_0x4c2919['on'](_0x4644('0x20'),function(){if(_0x4f2192){return _0x4f2192[_0x4644('0x21')](_0x4c2919[_0x4644('0x22')])[_0x4644('0x23')](JSON[_0x4644('0x24')](_0x5e71c1));}});});_0x5844cb['on'](_0x4644('0x25'),function(_0x1aaf83){if(_0x4f2192){return _0x4f2192['status'](0x1f4)[_0x4644('0x23')]({'errors':[{'message':_0x4644('0x26'),'type':_0x4644('0x27')}]});}});_0x5844cb[_0x4644('0x28')](_0x575820);_0x5844cb['end']();}exports[_0x4644('0x29')]=openIssue;exports[_0x4644('0x2a')]=function(_0x3f4296,_0x1689a2){_0x3f4296[_0x4644('0x2b')]['ip']=_0x3f4296[_0x4644('0x2c')][_0x4644('0x2d')]||_0x3f4296['connection'][_0x4644('0x2e')]||_0x3f4296[_0x4644('0x2f')][_0x4644('0x2e')]||_0x3f4296[_0x4644('0x30')]['socket'][_0x4644('0x2e')];return openIssue(_0x3f4296[_0x4644('0x2b')],_0x1689a2);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 23d7f9e..4fc2302 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 _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 +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','show','post'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 64645bb..f185cfe 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(_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 +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x2236d4,_0x1c6511){_0x2236d4=_0x2236d4-0x0;var _0x1a1892=_0x7a54[_0x2236d4];return _0x1a1892;};'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 c0fc985..504dd95 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 _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 +var _0xa566=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','reject','update','then','destroy','error','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x374821,_0x36db41){var _0x2778aa=function(_0x2ceea8){while(--_0x2ceea8){_0x374821['push'](_0x374821['shift']());}};_0x2778aa(++_0x36db41);}(_0xa566,0x1c1));var _0x6a56=function(_0x2fc731,_0x52ca00){_0x2fc731=_0x2fc731-0x0;var _0xd2114b=_0xa566[_0x2fc731];return _0xd2114b;};'use strict';var emlformat=require(_0x6a56('0x0'));var rimraf=require(_0x6a56('0x1'));var zipdir=require(_0x6a56('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a56('0x3'));var moment=require(_0x6a56('0x4'));var BPromise=require(_0x6a56('0x5'));var Mustache=require(_0x6a56('0x6'));var util=require('util');var path=require(_0x6a56('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a56('0x8'));var squel=require('squel');var crypto=require(_0x6a56('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6a56('0xa'));var toCsv=require(_0x6a56('0xb'));var querystring=require('querystring');var Papa=require(_0x6a56('0xc'));var Redis=require(_0x6a56('0xd'));var authService=require(_0x6a56('0xe'));var qs=require(_0x6a56('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a56('0x10'));var logger=require(_0x6a56('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x6a56('0x12'));var licenseUtil=require(_0x6a56('0x13'));var db=require(_0x6a56('0x14'))['db'];function respondWithStatusCode(_0x26f443,_0x3e9389){_0x3e9389=_0x3e9389||0xcc;return function(_0x10f894){if(_0x10f894){return _0x26f443[_0x6a56('0x15')](_0x3e9389);}return _0x26f443['status'](_0x3e9389)[_0x6a56('0x16')]();};}function respondWithResult(_0x14237e,_0x46fbaa){_0x46fbaa=_0x46fbaa||0xc8;return function(_0x10fd64){if(_0x10fd64){return _0x14237e[_0x6a56('0x17')](_0x46fbaa)['json'](_0x10fd64);}};}function respondWithFilteredResult(_0x232176,_0xc0e603){return function(_0x28bb4e){if(_0x28bb4e){var _0xc5f78d=typeof _0xc0e603[_0x6a56('0x18')]==='undefined'&&typeof _0xc0e603['limit']===_0x6a56('0x19');var _0x2288b1=_0x28bb4e['count'];var _0x162c52=_0xc5f78d?0x0:_0xc0e603[_0x6a56('0x18')];var _0x4c2f9c=_0xc5f78d?_0x28bb4e[_0x6a56('0x1a')]:_0xc0e603[_0x6a56('0x18')]+_0xc0e603['limit'];var _0x26b33e;if(_0x4c2f9c>=_0x2288b1){_0x4c2f9c=_0x2288b1;_0x26b33e=0xc8;}else{_0x26b33e=0xce;}_0x232176['status'](_0x26b33e);return _0x232176[_0x6a56('0x1b')]('Content-Range',_0x162c52+'-'+_0x4c2f9c+'/'+_0x2288b1)[_0x6a56('0x1c')](_0x28bb4e);}return null;};}function patchUpdates(_0x2239ff){return function(_0x11e479){try{jsonpatch[_0x6a56('0x1d')](_0x11e479,_0x2239ff,!![]);}catch(_0x32118b){return BPromise[_0x6a56('0x1e')](_0x32118b);}return _0x11e479['save']();};}function saveUpdates(_0x2e217a,_0x148548){return function(_0x4845aa){if(_0x4845aa){return _0x4845aa[_0x6a56('0x1f')](_0x2e217a)[_0x6a56('0x20')](function(_0x3cf1b3){return _0x3cf1b3;});}return null;};}function removeEntity(_0x5a0986,_0x2a6ece){return function(_0x3e0aab){if(_0x3e0aab){return _0x3e0aab[_0x6a56('0x21')]()[_0x6a56('0x20')](function(){_0x5a0986[_0x6a56('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d23a,_0x5ce125){return function(_0x302316){if(!_0x302316){_0x51d23a[_0x6a56('0x15')](0x194);}return _0x302316;};}function handleError(_0x2bd80f,_0x55e714){_0x55e714=_0x55e714||0x1f4;return function(_0x1df843){logger[_0x6a56('0x22')](_0x1df843['stack']);if(_0x1df843[_0x6a56('0x23')]){delete _0x1df843[_0x6a56('0x23')];}_0x2bd80f[_0x6a56('0x17')](_0x55e714)['send'](_0x1df843);};}exports[_0x6a56('0x24')]=function(_0x27bcd0,_0x151537){var _0xe26d09={},_0x10b1cb={},_0x51534d={'count':0x0,'rows':[]};var _0x3f0fe7=_[_0x6a56('0x25')](db[_0x6a56('0x26')][_0x6a56('0x27')],function(_0x576778){return{'name':_0x576778[_0x6a56('0x28')],'type':_0x576778[_0x6a56('0x29')][_0x6a56('0x2a')]};});_0x10b1cb['model']=_[_0x6a56('0x25')](_0x3f0fe7,'name');_0x10b1cb[_0x6a56('0x2b')]=_[_0x6a56('0x2c')](_0x27bcd0[_0x6a56('0x2b')]);_0x10b1cb[_0x6a56('0x2d')]=_[_0x6a56('0x2e')](_0x10b1cb[_0x6a56('0x2f')],_0x10b1cb[_0x6a56('0x2b')]);_0xe26d09[_0x6a56('0x30')]=_[_0x6a56('0x2e')](_0x10b1cb[_0x6a56('0x2f')],qs[_0x6a56('0x31')](_0x27bcd0['query'][_0x6a56('0x31')]));_0xe26d09[_0x6a56('0x30')]=_0xe26d09[_0x6a56('0x30')][_0x6a56('0x32')]?_0xe26d09['attributes']:_0x10b1cb[_0x6a56('0x2f')];if(!_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x33')](_0x6a56('0x34'))){_0xe26d09['limit']=qs[_0x6a56('0x35')](_0x27bcd0[_0x6a56('0x2b')]['limit']);_0xe26d09[_0x6a56('0x18')]=qs['offset'](_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x18')]);}_0xe26d09[_0x6a56('0x36')]=qs[_0x6a56('0x37')](_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x37')]);_0xe26d09[_0x6a56('0x38')]=qs['filters'](_[_0x6a56('0x39')](_0x27bcd0[_0x6a56('0x2b')],_0x10b1cb[_0x6a56('0x2d')]),_0x3f0fe7);if(_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3a')]){_0xe26d09[_0x6a56('0x38')]=_[_0x6a56('0x3b')](_0xe26d09[_0x6a56('0x38')],{'$or':_[_0x6a56('0x25')](_0x3f0fe7,function(_0x4b1f65){if(_0x4b1f65[_0x6a56('0x29')]!==_0x6a56('0x3c')){var _0x10aca9={};_0x10aca9[_0x4b1f65[_0x6a56('0x23')]]={'$like':'%'+_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3a')]+'%'};return _0x10aca9;}})});}_0xe26d09=_[_0x6a56('0x3b')]({},_0xe26d09,_0x27bcd0[_0x6a56('0x3d')]);var _0x4a75c2={'where':_0xe26d09[_0x6a56('0x38')]};return db[_0x6a56('0x26')][_0x6a56('0x1a')](_0x4a75c2)[_0x6a56('0x20')](function(_0x2af96d){_0x51534d['count']=_0x2af96d;if(_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3e')]){_0xe26d09[_0x6a56('0x3f')]=[{'all':!![]}];}return db[_0x6a56('0x26')][_0x6a56('0x40')](_0xe26d09);})['then'](function(_0x2e13b1){_0x51534d['rows']=_0x2e13b1;return _0x51534d;})[_0x6a56('0x20')](respondWithFilteredResult(_0x151537,_0xe26d09))[_0x6a56('0x41')](handleError(_0x151537,null));};exports[_0x6a56('0x42')]=function(_0x4e69fd,_0x10ced2){var _0x4ae655={'raw':!![],'where':{'id':_0x4e69fd[_0x6a56('0x43')]['id']}},_0x5a6999={};_0x5a6999[_0x6a56('0x2f')]=_[_0x6a56('0x2c')](db[_0x6a56('0x26')]['rawAttributes']);_0x5a6999['query']=_[_0x6a56('0x2c')](_0x4e69fd[_0x6a56('0x2b')]);_0x5a6999[_0x6a56('0x2d')]=_[_0x6a56('0x2e')](_0x5a6999[_0x6a56('0x2f')],_0x5a6999[_0x6a56('0x2b')]);_0x4ae655['attributes']=_[_0x6a56('0x2e')](_0x5a6999['model'],qs[_0x6a56('0x31')](_0x4e69fd[_0x6a56('0x2b')][_0x6a56('0x31')]));_0x4ae655[_0x6a56('0x30')]=_0x4ae655[_0x6a56('0x30')][_0x6a56('0x32')]?_0x4ae655[_0x6a56('0x30')]:_0x5a6999[_0x6a56('0x2f')];if(_0x4e69fd[_0x6a56('0x2b')]['includeAll']){_0x4ae655[_0x6a56('0x3f')]=[{'all':!![]}];}_0x4ae655=_['merge']({},_0x4ae655,_0x4e69fd['options']);return db['JscriptyAnswerReport'][_0x6a56('0x44')](_0x4ae655)[_0x6a56('0x20')](handleEntityNotFound(_0x10ced2,null))[_0x6a56('0x20')](respondWithResult(_0x10ced2,null))[_0x6a56('0x41')](handleError(_0x10ced2,null));};exports[_0x6a56('0x45')]=function(_0x5cef6c,_0x794424){return db[_0x6a56('0x26')][_0x6a56('0x45')](_0x5cef6c[_0x6a56('0x46')],{})['then'](respondWithResult(_0x794424,0xc9))[_0x6a56('0x41')](handleError(_0x794424,null));};exports[_0x6a56('0x1f')]=function(_0x659936,_0x371b8e){if(_0x659936['body']['id']){delete _0x659936[_0x6a56('0x46')]['id'];}return db[_0x6a56('0x26')][_0x6a56('0x44')]({'where':{'id':_0x659936['params']['id']}})[_0x6a56('0x20')](handleEntityNotFound(_0x371b8e,null))[_0x6a56('0x20')](saveUpdates(_0x659936[_0x6a56('0x46')],null))[_0x6a56('0x20')](respondWithResult(_0x371b8e,null))['catch'](handleError(_0x371b8e,null));};exports[_0x6a56('0x21')]=function(_0x56406b,_0x2487cb){return db[_0x6a56('0x26')]['find']({'where':{'id':_0x56406b[_0x6a56('0x43')]['id']}})[_0x6a56('0x20')](handleEntityNotFound(_0x2487cb,null))[_0x6a56('0x20')](removeEntity(_0x2487cb,null))[_0x6a56('0x41')](handleError(_0x2487cb,null));};exports[_0x6a56('0x47')]=function(_0x14be34,_0x175383){return db[_0x6a56('0x26')][_0x6a56('0x47')]()['then'](respondWithResult(_0x175383,null))['catch'](handleError(_0x175383,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 5ce8f96..1ca3567 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 _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 +var _0x022e=['bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api'];(function(_0x38bda1,_0x5472be){var _0x57dc98=function(_0x574cad){while(--_0x574cad){_0x38bda1['push'](_0x38bda1['shift']());}};_0x57dc98(++_0x5472be);}(_0x022e,0x11a));var _0xe022=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x022e[_0x4c6d6f];return _0x2d4478;};'use strict';var _=require(_0xe022('0x0'));var util=require(_0xe022('0x1'));var logger=require(_0xe022('0x2'))(_0xe022('0x3'));var moment=require('moment');var BPromise=require(_0xe022('0x4'));var rp=require(_0xe022('0x5'));var fs=require('fs');var path=require(_0xe022('0x6'));var rimraf=require(_0xe022('0x7'));var config=require('../../config/environment');var attributes=require(_0xe022('0x8'));module[_0xe022('0x9')]=function(_0x2be152,_0x2141e0){return _0x2be152[_0xe022('0xa')](_0xe022('0xb'),attributes,{'tableName':_0xe022('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 8accb06..57153a1 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 _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 +var _0xef94=['../../mysqldb','rpc','../../config/environment','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef94,0x103));var _0x4ef9=function(_0x4bb94b,_0x50628a){_0x4bb94b=_0x4bb94b-0x0;var _0x36dcc6=_0xef94[_0x4bb94b];return _0x36dcc6;};'use strict';var _=require(_0x4ef9('0x0'));var util=require(_0x4ef9('0x1'));var moment=require(_0x4ef9('0x2'));var BPromise=require(_0x4ef9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ef9('0x4'));var db=require(_0x4ef9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4ef9('0x6'));var config=require(_0x4ef9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4ef9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58504f,_0xec9e8,_0x2f787e){return new BPromise(function(_0x1ea9c4,_0x22f73a){return client[_0x4ef9('0x9')](_0x58504f,_0x2f787e)[_0x4ef9('0xa')](function(_0x1ee3a8){logger[_0x4ef9('0xb')](_0x4ef9('0xc'),_0xec9e8,_0x4ef9('0xd'));logger[_0x4ef9('0xe')](_0x4ef9('0xf'),_0xec9e8,_0x4ef9('0xd'),JSON[_0x4ef9('0x10')](_0x1ee3a8));if(_0x1ee3a8[_0x4ef9('0x11')]){if(_0x1ee3a8[_0x4ef9('0x11')][_0x4ef9('0x12')]===0x1f4){logger[_0x4ef9('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xec9e8,_0x1ee3a8['error'][_0x4ef9('0x13')]);return _0x22f73a(_0x1ee3a8[_0x4ef9('0x11')][_0x4ef9('0x13')]);}logger[_0x4ef9('0x11')](_0x4ef9('0xc'),_0xec9e8,_0x1ee3a8[_0x4ef9('0x11')][_0x4ef9('0x13')]);return _0x1ea9c4(_0x1ee3a8[_0x4ef9('0x11')][_0x4ef9('0x13')]);}else{logger[_0x4ef9('0xb')](_0x4ef9('0xc'),_0xec9e8,_0x4ef9('0xd'));_0x1ea9c4(_0x1ee3a8[_0x4ef9('0x14')][_0x4ef9('0x13')]);}})[_0x4ef9('0x15')](function(_0x2fb020){logger[_0x4ef9('0x11')](_0x4ef9('0xc'),_0xec9e8,_0x2fb020);_0x22f73a(_0x2fb020);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 7019e26..02b0115 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 _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 +var _0x8195=['index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','clone','put','/:id','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated'];(function(_0x123da7,_0x1da803){var _0x48b201=function(_0x1ccda1){while(--_0x1ccda1){_0x123da7['push'](_0x123da7['shift']());}};_0x48b201(++_0x1da803);}(_0x8195,0x123));var _0x5819=function(_0xbeeecd,_0x29d9b7){_0xbeeecd=_0xbeeecd-0x0;var _0x16f54c=_0x8195[_0xbeeecd];return _0x16f54c;};'use strict';var multer=require(_0x5819('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5819('0x1'));var express=require(_0x5819('0x2'));var router=express['Router']();var fs_extra=require(_0x5819('0x3'));var auth=require(_0x5819('0x4'));var interaction=require(_0x5819('0x5'));var config=require('../../config/environment');var controller=require(_0x5819('0x6'));router[_0x5819('0x7')]('/',auth[_0x5819('0x8')](),controller[_0x5819('0x9')]);router[_0x5819('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5819('0xa')]);router[_0x5819('0x7')](_0x5819('0xb'),auth[_0x5819('0x8')](),controller[_0x5819('0xc')]);router[_0x5819('0x7')](_0x5819('0xd'),auth[_0x5819('0x8')](),controller[_0x5819('0xe')]);router['get'](_0x5819('0xf'),auth[_0x5819('0x8')](),timeout(_0x5819('0x10')),controller['getSummary']);router[_0x5819('0x11')]('/',auth[_0x5819('0x8')](),controller[_0x5819('0x12')]);router[_0x5819('0x11')]('/:id/clone',auth[_0x5819('0x8')](),controller[_0x5819('0x13')]);router[_0x5819('0x14')](_0x5819('0x15'),auth[_0x5819('0x8')](),controller['update']);router[_0x5819('0x16')](_0x5819('0x15'),auth[_0x5819('0x8')](),controller[_0x5819('0x17')]);module[_0x5819('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9bc21f0..13c4eef 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 _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 +var _0x3c61=['getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x1e6659,_0x1f860c){var _0x4d16e4=function(_0x21c05a){while(--_0x21c05a){_0x1e6659['push'](_0x1e6659['shift']());}};_0x4d16e4(++_0x1f860c);}(_0x3c61,0x15c));var _0x13c6=function(_0x1de321,_0x255db6){_0x1de321=_0x1de321-0x0;var _0x210e4f=_0x3c61[_0x1de321];return _0x210e4f;};'use strict';var Sequelize=require(_0x13c6('0x0'));var _=require('lodash');var util=require(_0x13c6('0x1'));module[_0x13c6('0x2')]={'name':{'type':Sequelize[_0x13c6('0x3')],'unique':_0x13c6('0x4')},'description':{'type':Sequelize[_0x13c6('0x3')]},'formData':{'type':Sequelize[_0x13c6('0x5')](_0x13c6('0x6')),'set':function(_0x40c620){if(_[_0x13c6('0x7')](_0x40c620)){this[_0x13c6('0x8')]('formData',JSON['stringify'](_0x40c620));}else if(_['isString'](_0x40c620)){this[_0x13c6('0x8')]('formData',_0x40c620);}else{this['setDataValue'](_0x13c6('0x9'),util[_0x13c6('0xa')](_0x13c6('0xb'),this[_0x13c6('0xc')](_0x13c6('0x4'))||'',this[_0x13c6('0xc')](_0x13c6('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x13c6('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c66fbd0..c5b566d 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 _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 +var _0x5227=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','then','get','destroy','error','stack','name','send','index','map','JscriptyProject','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','userProfileId','update','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','toString','indexOf','getSummary','starttime','parse','startTime','hasOwnProperty','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x5227,0x1d1));var _0x7522=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x5227[_0x1ad926];return _0x1b81dc;};'use strict';var emlformat=require(_0x7522('0x0'));var rimraf=require(_0x7522('0x1'));var zipdir=require(_0x7522('0x2'));var jsonpatch=require(_0x7522('0x3'));var rp=require(_0x7522('0x4'));var moment=require(_0x7522('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7522('0x6'));var util=require(_0x7522('0x7'));var path=require(_0x7522('0x8'));var sox=require(_0x7522('0x9'));var csv=require('to-csv');var ejs=require(_0x7522('0xa'));var fs=require('fs');var fs_extra=require(_0x7522('0xb'));var _=require(_0x7522('0xc'));var squel=require(_0x7522('0xd'));var crypto=require(_0x7522('0xe'));var jsforce=require(_0x7522('0xf'));var deskjs=require(_0x7522('0x10'));var toCsv=require(_0x7522('0x11'));var querystring=require(_0x7522('0x12'));var Papa=require(_0x7522('0x13'));var Redis=require(_0x7522('0x14'));var authService=require(_0x7522('0x15'));var qs=require(_0x7522('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7522('0x17'));var logger=require(_0x7522('0x18'))(_0x7522('0x19'));var utils=require(_0x7522('0x1a'));var config=require(_0x7522('0x1b'));var licenseUtil=require(_0x7522('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x424df5,_0x400da7){_0x400da7=_0x400da7||0xcc;return function(_0x293d1a){if(_0x293d1a){return _0x424df5[_0x7522('0x1d')](_0x400da7);}return _0x424df5[_0x7522('0x1e')](_0x400da7)[_0x7522('0x1f')]();};}function respondWithResult(_0x3b9e15,_0xd695d0){_0xd695d0=_0xd695d0||0xc8;return function(_0x387ed4){if(_0x387ed4){return _0x3b9e15[_0x7522('0x1e')](_0xd695d0)['json'](_0x387ed4);}};}function respondWithFilteredResult(_0x54ce48,_0x30952b){return function(_0x5ec046){if(_0x5ec046){var _0x1aa84c=typeof _0x30952b[_0x7522('0x20')]===_0x7522('0x21')&&typeof _0x30952b[_0x7522('0x22')]===_0x7522('0x21');var _0x189ef6=_0x5ec046['count'];var _0x305db6=_0x1aa84c?0x0:_0x30952b[_0x7522('0x20')];var _0x3311e7=_0x1aa84c?_0x5ec046['count']:_0x30952b[_0x7522('0x20')]+_0x30952b[_0x7522('0x22')];var _0x415a53;if(_0x3311e7>=_0x189ef6){_0x3311e7=_0x189ef6;_0x415a53=0xc8;}else{_0x415a53=0xce;}_0x54ce48[_0x7522('0x1e')](_0x415a53);return _0x54ce48[_0x7522('0x23')](_0x7522('0x24'),_0x305db6+'-'+_0x3311e7+'/'+_0x189ef6)[_0x7522('0x25')](_0x5ec046);}return null;};}function patchUpdates(_0x27e4f0){return function(_0x18c2a9){try{jsonpatch[_0x7522('0x26')](_0x18c2a9,_0x27e4f0,!![]);}catch(_0x519d83){return BPromise[_0x7522('0x27')](_0x519d83);}return _0x18c2a9[_0x7522('0x28')]();};}function saveUpdates(_0x2a895e,_0xb3f596){return function(_0x2adde2){if(_0x2adde2){return _0x2adde2['update'](_0x2a895e)[_0x7522('0x29')](function(_0x16c348){return _0x16c348;});}return null;};}function removeEntity(_0x119e59,_0x47b7d3){return function(_0x5c60e6){if(_0x5c60e6){return _0x5c60e6['destroy']()['then'](function(){var _0x306b29=_0x5c60e6[_0x7522('0x2a')]({'plain':!![]});var _0x4e39f8='Projects';return db['UserProfileResource'][_0x7522('0x2b')]({'where':{'type':_0x4e39f8,'resourceId':_0x306b29['id']}})[_0x7522('0x29')](function(){return _0x5c60e6;});})[_0x7522('0x29')](function(){_0x119e59[_0x7522('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cec09,_0xfb1361){return function(_0x48e300){if(!_0x48e300){_0x5cec09[_0x7522('0x1d')](0x194);}return _0x48e300;};}function handleError(_0x3b10d3,_0x17fd78){_0x17fd78=_0x17fd78||0x1f4;return function(_0x427e43){logger[_0x7522('0x2c')](_0x427e43[_0x7522('0x2d')]);if(_0x427e43[_0x7522('0x2e')]){delete _0x427e43[_0x7522('0x2e')];}_0x3b10d3[_0x7522('0x1e')](_0x17fd78)[_0x7522('0x2f')](_0x427e43);};}exports[_0x7522('0x30')]=function(_0x15844c,_0x45d541){var _0x4c80dd={},_0x43b067={},_0x2d5351={'count':0x0,'rows':[]};var _0x48bf4c=_[_0x7522('0x31')](db[_0x7522('0x32')]['rawAttributes'],function(_0xe0b104){return{'name':_0xe0b104[_0x7522('0x33')],'type':_0xe0b104[_0x7522('0x34')][_0x7522('0x35')]};});_0x43b067['model']=_[_0x7522('0x31')](_0x48bf4c,_0x7522('0x2e'));_0x43b067[_0x7522('0x36')]=_[_0x7522('0x37')](_0x15844c[_0x7522('0x36')]);_0x43b067[_0x7522('0x38')]=_[_0x7522('0x39')](_0x43b067[_0x7522('0x3a')],_0x43b067[_0x7522('0x36')]);_0x4c80dd[_0x7522('0x3b')]=_[_0x7522('0x39')](_0x43b067[_0x7522('0x3a')],qs['fields'](_0x15844c['query'][_0x7522('0x3c')]));_0x4c80dd['attributes']=_0x4c80dd[_0x7522('0x3b')]['length']?_0x4c80dd['attributes']:_0x43b067['model'];if(!_0x15844c[_0x7522('0x36')]['hasOwnProperty'](_0x7522('0x3d'))){_0x4c80dd['limit']=qs[_0x7522('0x22')](_0x15844c[_0x7522('0x36')][_0x7522('0x22')]);_0x4c80dd[_0x7522('0x20')]=qs[_0x7522('0x20')](_0x15844c[_0x7522('0x36')][_0x7522('0x20')]);}_0x4c80dd[_0x7522('0x3e')]=qs[_0x7522('0x3f')](_0x15844c[_0x7522('0x36')][_0x7522('0x3f')]);_0x4c80dd[_0x7522('0x40')]=qs[_0x7522('0x38')](_[_0x7522('0x41')](_0x15844c['query'],_0x43b067[_0x7522('0x38')]),_0x48bf4c);if(_0x15844c[_0x7522('0x36')]['filter']){_0x4c80dd[_0x7522('0x40')]=_[_0x7522('0x42')](_0x4c80dd[_0x7522('0x40')],{'$or':_['map'](_0x48bf4c,function(_0x3b2c76){if(_0x3b2c76[_0x7522('0x34')]!=='VIRTUAL'){var _0x38fb47={};_0x38fb47[_0x3b2c76['name']]={'$like':'%'+_0x15844c['query'][_0x7522('0x43')]+'%'};return _0x38fb47;}})});}_0x4c80dd=_[_0x7522('0x42')]({},_0x4c80dd,_0x15844c[_0x7522('0x44')]);var _0xfe76bb={'where':_0x4c80dd['where']};return db[_0x7522('0x32')][_0x7522('0x45')](_0xfe76bb)['then'](function(_0x2e9f9f){_0x2d5351[_0x7522('0x45')]=_0x2e9f9f;if(_0x15844c[_0x7522('0x36')][_0x7522('0x46')]){_0x4c80dd[_0x7522('0x47')]=[{'all':!![]}];}return db[_0x7522('0x32')][_0x7522('0x48')](_0x4c80dd);})[_0x7522('0x29')](function(_0x4b689d){_0x2d5351[_0x7522('0x49')]=_0x4b689d;return _0x2d5351;})[_0x7522('0x29')](respondWithFilteredResult(_0x45d541,_0x4c80dd))[_0x7522('0x4a')](handleError(_0x45d541,null));};exports['show']=function(_0x484ab8,_0x1da718){var _0x44413a={'raw':![],'where':{'id':_0x484ab8[_0x7522('0x4b')]['id']}},_0x441f83={};_0x441f83[_0x7522('0x3a')]=_['keys'](db[_0x7522('0x32')][_0x7522('0x4c')]);_0x441f83[_0x7522('0x36')]=_['keys'](_0x484ab8[_0x7522('0x36')]);_0x441f83['filters']=_[_0x7522('0x39')](_0x441f83[_0x7522('0x3a')],_0x441f83[_0x7522('0x36')]);_0x44413a['attributes']=_['intersection'](_0x441f83[_0x7522('0x3a')],qs[_0x7522('0x3c')](_0x484ab8[_0x7522('0x36')][_0x7522('0x3c')]));_0x44413a[_0x7522('0x3b')]=_0x44413a[_0x7522('0x3b')][_0x7522('0x4d')]?_0x44413a[_0x7522('0x3b')]:_0x441f83[_0x7522('0x3a')];if(_0x484ab8['query']['includeAll']){_0x44413a[_0x7522('0x47')]=[{'all':!![]}];}_0x44413a=_[_0x7522('0x42')]({},_0x44413a,_0x484ab8[_0x7522('0x44')]);return db[_0x7522('0x32')]['find'](_0x44413a)[_0x7522('0x29')](handleEntityNotFound(_0x1da718,null))['then'](respondWithResult(_0x1da718,null))[_0x7522('0x4a')](handleError(_0x1da718,null));};exports[_0x7522('0x4e')]=function(_0x31646f,_0x38a1c8){return db[_0x7522('0x32')][_0x7522('0x4e')](_0x31646f[_0x7522('0x4f')],{})[_0x7522('0x29')](function(_0x2e77ca){var _0x34eaf8=_0x31646f[_0x7522('0x50')][_0x7522('0x2a')]({'plain':!![]});if(!_0x34eaf8)throw new Error(_0x7522('0x51'));if(_0x34eaf8[_0x7522('0x52')]===_0x7522('0x50')){var _0x4e8e4a=_0x2e77ca[_0x7522('0x2a')]({'plain':!![]});var _0x2edbe8=_0x7522('0x53');return db[_0x7522('0x54')][_0x7522('0x55')]({'where':{'name':_0x2edbe8,'userProfileId':_0x34eaf8['userProfileId']},'raw':!![]})[_0x7522('0x29')](function(_0x577fc1){if(_0x577fc1&&_0x577fc1[_0x7522('0x56')]===0x0){return db['UserProfileResource'][_0x7522('0x4e')]({'name':_0x4e8e4a[_0x7522('0x2e')],'resourceId':_0x4e8e4a['id'],'type':_0x577fc1['name'],'sectionId':_0x577fc1['id']},{})[_0x7522('0x29')](function(){return _0x2e77ca;});}else{return _0x2e77ca;}})[_0x7522('0x4a')](function(_0x3308d6){logger[_0x7522('0x2c')](_0x7522('0x57'),_0x3308d6);throw _0x3308d6;});}return _0x2e77ca;})[_0x7522('0x29')](respondWithResult(_0x38a1c8,0xc9))[_0x7522('0x4a')](handleError(_0x38a1c8,null));};exports['clone']=function(_0x4d4895,_0x276148){var _0x354a39={'where':{'id':_0x4d4895[_0x7522('0x4b')]['id']}},_0x2e8737={};_0x2e8737[_0x7522('0x3a')]=_[_0x7522('0x37')](db[_0x7522('0x32')][_0x7522('0x4c')]);_0x354a39[_0x7522('0x3b')]=_['intersection'](_0x2e8737['model'],qs[_0x7522('0x3c')](_0x4d4895['query'][_0x7522('0x3c')]));_0x354a39[_0x7522('0x3b')]=_0x354a39[_0x7522('0x3b')][_0x7522('0x4d')]?_0x354a39[_0x7522('0x3b')]:_0x2e8737[_0x7522('0x3a')];if(_0x4d4895['query']['includeAll']){_0x354a39[_0x7522('0x47')]=[{'all':!![]}];}_0x354a39=_[_0x7522('0x42')]({},_0x354a39,_0x4d4895[_0x7522('0x44')]);return db['JscriptyProject'][_0x7522('0x55')](_0x354a39)[_0x7522('0x29')](handleEntityNotFound(_0x276148,null))[_0x7522('0x29')](function(_0x2b5176){if(_0x2b5176){var _0x245875=_0x2b5176[_0x7522('0x2a')]({'plain':!![]});_0x245875=qs['omit'](_0x245875,['id',_0x7522('0x58'),_0x7522('0x59')]);_0x4d4895[_0x7522('0x4f')]=_['omit'](_0x4d4895[_0x7522('0x4f')],['id',_0x7522('0x58'),_0x7522('0x59')]);return db['JscriptyProject']['create'](_['merge'](_0x245875,_0x4d4895[_0x7522('0x4f')]),{'include':_0x4d4895['query'][_0x7522('0x46')]?[{'all':!![]}]:undefined})[_0x7522('0x29')](function(_0x3dd925){var _0x16b9f4=_0x4d4895[_0x7522('0x50')]['get']({'plain':!![]});if(!_0x16b9f4)throw new Error(_0x7522('0x51'));if(_0x16b9f4['role']===_0x7522('0x50')){var _0x5b406e=_0x3dd925[_0x7522('0x2a')]({'plain':!![]});var _0x49d93a=_0x7522('0x53');return db[_0x7522('0x54')][_0x7522('0x55')]({'where':{'name':_0x49d93a,'userProfileId':_0x16b9f4[_0x7522('0x5a')]},'raw':!![]})[_0x7522('0x29')](function(_0x329f4a){if(_0x329f4a&&_0x329f4a[_0x7522('0x56')]===0x0){return db['UserProfileResource'][_0x7522('0x4e')]({'name':_0x5b406e[_0x7522('0x2e')],'resourceId':_0x5b406e['id'],'type':_0x329f4a['name'],'sectionId':_0x329f4a['id']},{})['then'](function(){return _0x3dd925;});}else{return _0x3dd925;}})[_0x7522('0x4a')](function(_0x4d4ea2){logger[_0x7522('0x2c')](_0x7522('0x57'),_0x4d4ea2);throw _0x4d4ea2;});}return _0x3dd925;});}})[_0x7522('0x29')](respondWithResult(_0x276148,0xc9))[_0x7522('0x4a')](handleError(_0x276148,null));};exports[_0x7522('0x5b')]=function(_0x5b1ed9,_0x2be254){if(_0x5b1ed9[_0x7522('0x4f')]['id']){delete _0x5b1ed9['body']['id'];}return db['JscriptyProject'][_0x7522('0x55')]({'where':{'id':_0x5b1ed9[_0x7522('0x4b')]['id']}})[_0x7522('0x29')](handleEntityNotFound(_0x2be254,null))['then'](saveUpdates(_0x5b1ed9['body'],null))['then'](respondWithResult(_0x2be254,null))[_0x7522('0x4a')](handleError(_0x2be254,null));};exports['destroy']=function(_0x18e5b5,_0x1d731b){return db[_0x7522('0x32')]['find']({'where':{'id':_0x18e5b5[_0x7522('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d731b,null))[_0x7522('0x29')](removeEntity(_0x1d731b,null))[_0x7522('0x4a')](handleError(_0x1d731b,null));};exports[_0x7522('0x5c')]=function(_0x4129cf,_0x21115e,_0xac983){var _0x2860de={'raw':!![],'where':{}};var _0x210ba8={};var _0x39974a={'count':0x0,'rows':[]};return db[_0x7522('0x32')][_0x7522('0x5d')]({'where':{'id':_0x4129cf[_0x7522('0x4b')]['id']}})[_0x7522('0x29')](handleEntityNotFound(_0x21115e,null))[_0x7522('0x29')](function(_0x24ff94){if(_0x24ff94){_0x210ba8['model']=_['keys'](db[_0x7522('0x5e')][_0x7522('0x4c')]);_0x210ba8[_0x7522('0x36')]=_[_0x7522('0x37')](_0x4129cf[_0x7522('0x36')]);_0x210ba8[_0x7522('0x38')]=_[_0x7522('0x39')](_0x210ba8[_0x7522('0x3a')],_0x210ba8['query']);_0x2860de[_0x7522('0x3b')]=_[_0x7522('0x39')](_0x210ba8['model'],qs[_0x7522('0x3c')](_0x4129cf[_0x7522('0x36')][_0x7522('0x3c')]));_0x2860de[_0x7522('0x3b')]=_0x2860de[_0x7522('0x3b')]['length']?_0x2860de[_0x7522('0x3b')]:_0x210ba8[_0x7522('0x3a')];if(!_0x4129cf[_0x7522('0x36')]['hasOwnProperty'](_0x7522('0x3d'))){_0x2860de[_0x7522('0x22')]=qs[_0x7522('0x22')](_0x4129cf[_0x7522('0x36')]['limit']);_0x2860de[_0x7522('0x20')]=qs[_0x7522('0x20')](_0x4129cf[_0x7522('0x36')]['offset']);}_0x2860de['order']=qs[_0x7522('0x3f')](_0x4129cf[_0x7522('0x36')][_0x7522('0x3f')]);_0x2860de['where']=qs[_0x7522('0x38')](_[_0x7522('0x41')](_0x4129cf[_0x7522('0x36')],_0x210ba8[_0x7522('0x38')]));_0x2860de[_0x7522('0x40')][_0x7522('0x5f')]=_0x24ff94['id'];if(_0x4129cf[_0x7522('0x36')][_0x7522('0x43')]){_0x2860de[_0x7522('0x40')]=_[_0x7522('0x42')](_0x2860de[_0x7522('0x40')],{'$or':_[_0x7522('0x31')](_0x2860de['attributes'],function(_0x4ea441){var _0x578010={};_0x578010[_0x4ea441]={'$like':'%'+_0x4129cf[_0x7522('0x36')][_0x7522('0x43')]+'%'};return _0x578010;})});}_0x2860de=_[_0x7522('0x42')]({},_0x2860de,_0x4129cf[_0x7522('0x44')]);return db[_0x7522('0x5e')]['count']({'where':_0x2860de['where']})[_0x7522('0x29')](function(_0x249c3b){_0x39974a['count']=_0x249c3b;if(_0x4129cf[_0x7522('0x36')][_0x7522('0x46')]){_0x2860de[_0x7522('0x47')]=[{'all':!![]}];}return db[_0x7522('0x5e')][_0x7522('0x48')](_0x2860de);})[_0x7522('0x29')](function(_0x11f9cd){_0x39974a['rows']=_0x11f9cd;return _0x39974a;});}})[_0x7522('0x29')](respondWithFilteredResult(_0x21115e,_0x2860de))[_0x7522('0x4a')](handleError(_0x21115e,null));};exports[_0x7522('0x60')]=function(_0x198291,_0x51a643,_0x536a04){var _0x324987={'raw':!![],'where':{}};var _0x47b595={};var _0x1346a1={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x198291['params']['id']}})[_0x7522('0x29')](handleEntityNotFound(_0x51a643,null))['then'](function(_0x2c8519){if(_0x2c8519){_0x47b595['model']=_[_0x7522('0x37')](db[_0x7522('0x61')]['rawAttributes']);_0x47b595[_0x7522('0x36')]=_[_0x7522('0x37')](_0x198291[_0x7522('0x36')]);_0x47b595['filters']=_['intersection'](_0x47b595[_0x7522('0x3a')],_0x47b595[_0x7522('0x36')]);_0x324987[_0x7522('0x3b')]=_[_0x7522('0x39')](_0x47b595[_0x7522('0x3a')],qs[_0x7522('0x3c')](_0x198291[_0x7522('0x36')]['fields']));_0x324987[_0x7522('0x3b')]=_0x324987['attributes'][_0x7522('0x4d')]?_0x324987[_0x7522('0x3b')]:_0x47b595[_0x7522('0x3a')];if(!_0x198291[_0x7522('0x36')]['hasOwnProperty'](_0x7522('0x3d'))){_0x324987[_0x7522('0x22')]=qs['limit'](_0x198291['query'][_0x7522('0x22')]);_0x324987[_0x7522('0x20')]=qs[_0x7522('0x20')](_0x198291['query'][_0x7522('0x20')]);}_0x324987[_0x7522('0x3e')]=qs[_0x7522('0x3f')](_0x198291[_0x7522('0x36')][_0x7522('0x3f')]);_0x324987['where']=qs[_0x7522('0x38')](_[_0x7522('0x41')](_0x198291['query'],_0x47b595[_0x7522('0x38')]));_0x324987[_0x7522('0x40')][_0x7522('0x5f')]=_0x2c8519['id'];if(_0x198291[_0x7522('0x36')][_0x7522('0x43')]){_0x324987['where']=_[_0x7522('0x42')](_0x324987[_0x7522('0x40')],{'$or':_[_0x7522('0x31')](_0x324987['attributes'],function(_0x388f94){var _0x1b15ed={};_0x1b15ed[_0x388f94]={'$like':'%'+_0x198291[_0x7522('0x36')][_0x7522('0x43')]+'%'};return _0x1b15ed;})});}_0x324987=_[_0x7522('0x42')]({},_0x324987,_0x198291[_0x7522('0x44')]);return db[_0x7522('0x61')][_0x7522('0x45')]({'where':_0x324987[_0x7522('0x40')]})['then'](function(_0x1a00d8){_0x1346a1[_0x7522('0x45')]=_0x1a00d8;if(_0x198291[_0x7522('0x36')][_0x7522('0x46')]){_0x324987['include']=[{'all':!![]}];}return db[_0x7522('0x61')]['findAll'](_0x324987);})[_0x7522('0x29')](function(_0x143b2){_0x1346a1[_0x7522('0x49')]=_0x143b2;return _0x1346a1;});}})[_0x7522('0x29')](respondWithFilteredResult(_0x51a643,_0x324987))[_0x7522('0x4a')](handleError(_0x51a643,null));};function char(_0x1500fe){return _0x7522('0x62')===typeof _0x1500fe?String['fromCharCode'][_0x7522('0x26')](null,arguments):_0x1500fe;}function needsEncapsulation(_0x29758a){return!!_0x29758a&&(_0x29758a[_0x7522('0x63')]()[_0x7522('0x64')](char(0xd))>=0x0||_0x29758a[_0x7522('0x63')]()[_0x7522('0x64')](char(0xa))>=0x0||_0x29758a[_0x7522('0x63')]()[_0x7522('0x64')](char(0x2c))>=0x0||_0x29758a[_0x7522('0x63')]()[_0x7522('0x64')](char(0x22))>=0x0);}function encapsulate(_0x1f1c9a){var _0x271d35=char(0x22),_0x4c44cc='\x5c'+char(0x22),_0x5de98b=_0x1f1c9a[_0x7522('0x63')]()['replace'](new RegExp(_0x271d35,'g'),_0x4c44cc);return _0x271d35+_0x5de98b+_0x271d35;}exports[_0x7522('0x65')]=function(_0x58f7db,_0x2f7983,_0x29137a){var _0xd413ab,_0x312946;var _0x1a653e={'where':{'ProjectId':_0x58f7db[_0x7522('0x4b')]['id']}};if(_0x58f7db[_0x7522('0x36')]['startTime']){_0x1a653e['where'][_0x7522('0x66')]=JSON[_0x7522('0x67')](_0x58f7db[_0x7522('0x36')][_0x7522('0x68')]);}return db['JscriptySessionReport'][_0x7522('0x48')](_0x1a653e)[_0x7522('0x29')](handleEntityNotFound(_0x2f7983,null))['then'](function(_0x3235f0){if(_0x3235f0){_0xd413ab=_0x3235f0;return db['JscriptyQuestionReport'][_0x7522('0x48')]({'where':{'SessionId':{'$in':_['map'](_0xd413ab,'id')},'ProjectId':_0x58f7db[_0x7522('0x4b')]['id']},'order':'-createdAt'});}})[_0x7522('0x29')](handleEntityNotFound(_0x2f7983,null))['then'](function(_0x5ed585){if(_0x5ed585){_0x312946=_0x5ed585;var _0x5e8476={};for(var _0x24d169=0x0,_0x178969=_0x312946[_0x7522('0x4d')];_0x24d169<_0x178969;_0x24d169++){if(!_0x5e8476[_0x7522('0x69')](_0x312946[_0x24d169][_0x7522('0x6a')])){_0x5e8476[_0x312946[_0x24d169]['questionId']]=needsEncapsulation(_0x312946[_0x24d169][_0x7522('0x6b')])?encapsulate(_0x312946[_0x24d169]['question']):_0x312946[_0x24d169]['question'];}}var _0x22d872=[],_0xf03b78={};for(var _0x500665=0x0,_0x54d5d7=_0xd413ab['length'];_0x500665<_0x54d5d7;_0x500665++){_0xf03b78={'ProjectId':_0x58f7db['params']['id'],'SessionId':_0xd413ab[_0x500665]['id'],'StartTime':moment(_0xd413ab[_0x500665][_0x7522('0x66')])[_0x7522('0x6c')](_0x7522('0x6d'))};for(var _0x49e115=0x0,_0x205c7a=_0x312946[_0x7522('0x4d')];_0x49e115<_0x205c7a;_0x49e115++){if(_0x312946[_0x49e115][_0x7522('0x6e')]==_0xd413ab[_0x500665]['id']&&_0x5e8476[_0x7522('0x69')](_0x312946[_0x49e115][_0x7522('0x6a')])){_0xf03b78[_0x5e8476[_0x312946[_0x49e115][_0x7522('0x6a')]]]=_0x312946[_0x49e115][_0x7522('0x6f')];}}for(var _0xe24c7e in _0x5e8476){if(!_0xf03b78[_0x7522('0x69')](_0x5e8476[_0xe24c7e])){_0xf03b78[_0x5e8476[_0xe24c7e]]=null;}}_0x22d872[_0x7522('0x70')](_0xf03b78);}return _0x22d872;}})['then'](function(_0x46f72c){if(!_[_0x7522('0x71')](_0x46f72c)){var _0x5e39cf=toCsv(_0x46f72c);var _0x5d876e=Date['now']();fs[_0x7522('0x72')](util[_0x7522('0x6c')](_0x7522('0x73'),_0x58f7db[_0x7522('0x4b')]['id'],_0x5d876e),_0x5e39cf);_0x2f7983[_0x7522('0x74')](_0x7522('0x75'),_0x7522('0x76')+util['format'](_0x7522('0x77'),_0x58f7db[_0x7522('0x4b')]['id'],_0x5d876e));_0x2f7983[_0x7522('0x74')](_0x7522('0x78'),'text/csv');return _0x2f7983[_0x7522('0x79')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x58f7db[_0x7522('0x4b')]['id'],_0x5d876e));}else{return _0x2f7983[_0x7522('0x1d')](0xcc);}})[_0x7522('0x4a')](handleError(_0x2f7983,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index d7ac412..356fc78 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 _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 +var _0xc73a=['exports','define','JscriptyProject','jscripty_projects','util','../../config/logger','api','request-promise','path','rimraf','./jscriptyProject.attributes'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0xc73a,0x72));var _0xac73=function(_0x932f59,_0x26519d){_0x932f59=_0x932f59-0x0;var _0x434f2e=_0xc73a[_0x932f59];return _0x434f2e;};'use strict';var _=require('lodash');var util=require(_0xac73('0x0'));var logger=require(_0xac73('0x1'))(_0xac73('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac73('0x3'));var fs=require('fs');var path=require(_0xac73('0x4'));var rimraf=require(_0xac73('0x5'));var config=require('../../config/environment');var attributes=require(_0xac73('0x6'));module[_0xac73('0x7')]=function(_0x23fa68,_0x57992a){return _0x23fa68[_0xac73('0x8')](_0xac73('0x9'),attributes,{'tableName':_0xac73('0xa'),'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 028c254..a4545d1 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_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 +var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x4511c4,_0x2da7ae){var _0x4cdc75=function(_0x3a5118){while(--_0x3a5118){_0x4511c4['push'](_0x4511c4['shift']());}};_0x4cdc75(++_0x2da7ae);}(_0x54ef,0x112));var _0xf54e=function(_0x176fb7,_0xec9697){_0x176fb7=_0x176fb7-0x0;var _0xb3cf11=_0x54ef[_0x176fb7];return _0xb3cf11;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e4f41ec..e3ba99d 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 _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 +var _0xdad7=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3d09e3,_0x47abfc){var _0x3257d4=function(_0x236230){while(--_0x236230){_0x3d09e3['push'](_0x3d09e3['shift']());}};_0x3257d4(++_0x47abfc);}(_0xdad7,0x1e3));var _0x7dad=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xdad7[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x7dad('0x0'));var util=require(_0x7dad('0x1'));var path=require(_0x7dad('0x2'));var timeout=require(_0x7dad('0x3'));var express=require(_0x7dad('0x4'));var router=express[_0x7dad('0x5')]();var fs_extra=require(_0x7dad('0x6'));var auth=require(_0x7dad('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7dad('0x8'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x7dad('0x9')](),controller[_0x7dad('0xa')]);router[_0x7dad('0xb')]('/describe',auth[_0x7dad('0x9')](),controller[_0x7dad('0xc')]);router[_0x7dad('0xb')](_0x7dad('0xd'),auth[_0x7dad('0x9')](),controller[_0x7dad('0xe')]);router[_0x7dad('0xf')]('/',auth['isAuthenticated'](),controller[_0x7dad('0x10')]);router[_0x7dad('0x11')](_0x7dad('0xd'),auth[_0x7dad('0x9')](),controller[_0x7dad('0x12')]);router[_0x7dad('0x13')]('/:id',auth[_0x7dad('0x9')](),controller[_0x7dad('0x14')]);module[_0x7dad('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index e2e0af5..86f5f39 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(_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 +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(_0x2279ef,_0x3a08db){_0x2279ef=_0x2279ef-0x0;var _0x4b7e97=_0x7a54[_0x2279ef];return _0x4b7e97;};'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 1da6298..bc645b0 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 _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 +var _0x1f2c=['stack','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filters','where','VIRTUAL','merge','options','then','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','status','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f2c,0x6d));var _0xc1f2=function(_0x104e50,_0x54ac83){_0x104e50=_0x104e50-0x0;var _0x5a680d=_0x1f2c[_0x104e50];return _0x5a680d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1f2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1f2('0x1'));var rp=require(_0xc1f2('0x2'));var moment=require(_0xc1f2('0x3'));var BPromise=require(_0xc1f2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc1f2('0x5'));var csv=require(_0xc1f2('0x6'));var ejs=require(_0xc1f2('0x7'));var fs=require('fs');var fs_extra=require(_0xc1f2('0x8'));var _=require('lodash');var squel=require(_0xc1f2('0x9'));var crypto=require(_0xc1f2('0xa'));var jsforce=require(_0xc1f2('0xb'));var deskjs=require(_0xc1f2('0xc'));var toCsv=require(_0xc1f2('0x6'));var querystring=require(_0xc1f2('0xd'));var Papa=require(_0xc1f2('0xe'));var Redis=require(_0xc1f2('0xf'));var authService=require(_0xc1f2('0x10'));var qs=require(_0xc1f2('0x11'));var as=require(_0xc1f2('0x12'));var hardwareService=require(_0xc1f2('0x13'));var logger=require(_0xc1f2('0x14'))(_0xc1f2('0x15'));var utils=require('../../config/utils');var config=require(_0xc1f2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1f2('0x17'))['db'];function respondWithStatusCode(_0x34365f,_0x5941f6){_0x5941f6=_0x5941f6||0xcc;return function(_0x94e248){if(_0x94e248){return _0x34365f[_0xc1f2('0x18')](_0x5941f6);}return _0x34365f['status'](_0x5941f6)[_0xc1f2('0x19')]();};}function respondWithResult(_0x49711b,_0x230c4f){_0x230c4f=_0x230c4f||0xc8;return function(_0x290575){if(_0x290575){return _0x49711b['status'](_0x230c4f)[_0xc1f2('0x1a')](_0x290575);}};}function respondWithFilteredResult(_0x2a2de0,_0x524601){return function(_0x359758){if(_0x359758){var _0x2c7326=typeof _0x524601[_0xc1f2('0x1b')]==='undefined'&&typeof _0x524601['limit']===_0xc1f2('0x1c');var _0x232204=_0x359758[_0xc1f2('0x1d')];var _0x42722f=_0x2c7326?0x0:_0x524601[_0xc1f2('0x1b')];var _0x169a35=_0x2c7326?_0x359758[_0xc1f2('0x1d')]:_0x524601[_0xc1f2('0x1b')]+_0x524601[_0xc1f2('0x1e')];var _0x48e8c5;if(_0x169a35>=_0x232204){_0x169a35=_0x232204;_0x48e8c5=0xc8;}else{_0x48e8c5=0xce;}_0x2a2de0['status'](_0x48e8c5);return _0x2a2de0[_0xc1f2('0x1f')](_0xc1f2('0x20'),_0x42722f+'-'+_0x169a35+'/'+_0x232204)[_0xc1f2('0x1a')](_0x359758);}return null;};}function patchUpdates(_0x3b7f12){return function(_0x159557){try{jsonpatch[_0xc1f2('0x21')](_0x159557,_0x3b7f12,!![]);}catch(_0x58b592){return BPromise['reject'](_0x58b592);}return _0x159557[_0xc1f2('0x22')]();};}function saveUpdates(_0x383307,_0xb93158){return function(_0x9f45f7){if(_0x9f45f7){return _0x9f45f7[_0xc1f2('0x23')](_0x383307)['then'](function(_0x1544ed){return _0x1544ed;});}return null;};}function removeEntity(_0x382f01,_0x36aba7){return function(_0x275adf){if(_0x275adf){return _0x275adf[_0xc1f2('0x24')]()['then'](function(){_0x382f01[_0xc1f2('0x25')](0xcc)[_0xc1f2('0x19')]();});}};}function handleEntityNotFound(_0x50e9ef,_0x1d3f11){return function(_0x10d01f){if(!_0x10d01f){_0x50e9ef['sendStatus'](0x194);}return _0x10d01f;};}function handleError(_0xa1e8bc,_0x2564c0){_0x2564c0=_0x2564c0||0x1f4;return function(_0xe3f02e){logger[_0xc1f2('0x26')](_0xe3f02e[_0xc1f2('0x27')]);if(_0xe3f02e['name']){delete _0xe3f02e['name'];}_0xa1e8bc['status'](_0x2564c0)[_0xc1f2('0x28')](_0xe3f02e);};}exports[_0xc1f2('0x29')]=function(_0xa19cde,_0x29729c){var _0x2cbe3b={},_0x51fd70={},_0x23034e={'count':0x0,'rows':[]};var _0x3c44fd=_[_0xc1f2('0x2a')](db[_0xc1f2('0x2b')][_0xc1f2('0x2c')],function(_0xe33c26){return{'name':_0xe33c26[_0xc1f2('0x2d')],'type':_0xe33c26[_0xc1f2('0x2e')][_0xc1f2('0x2f')]};});_0x51fd70[_0xc1f2('0x30')]=_[_0xc1f2('0x2a')](_0x3c44fd,'name');_0x51fd70[_0xc1f2('0x31')]=_['keys'](_0xa19cde[_0xc1f2('0x31')]);_0x51fd70['filters']=_[_0xc1f2('0x32')](_0x51fd70['model'],_0x51fd70['query']);_0x2cbe3b['attributes']=_[_0xc1f2('0x32')](_0x51fd70[_0xc1f2('0x30')],qs['fields'](_0xa19cde[_0xc1f2('0x31')][_0xc1f2('0x33')]));_0x2cbe3b[_0xc1f2('0x34')]=_0x2cbe3b[_0xc1f2('0x34')][_0xc1f2('0x35')]?_0x2cbe3b['attributes']:_0x51fd70['model'];if(!_0xa19cde[_0xc1f2('0x31')][_0xc1f2('0x36')]('nolimit')){_0x2cbe3b[_0xc1f2('0x1e')]=qs[_0xc1f2('0x1e')](_0xa19cde[_0xc1f2('0x31')][_0xc1f2('0x1e')]);_0x2cbe3b[_0xc1f2('0x1b')]=qs[_0xc1f2('0x1b')](_0xa19cde[_0xc1f2('0x31')]['offset']);}_0x2cbe3b['order']=qs[_0xc1f2('0x37')](_0xa19cde[_0xc1f2('0x31')][_0xc1f2('0x37')]);_0x2cbe3b['where']=qs['filters'](_[_0xc1f2('0x38')](_0xa19cde['query'],_0x51fd70[_0xc1f2('0x39')]),_0x3c44fd);if(_0xa19cde[_0xc1f2('0x31')]['filter']){_0x2cbe3b[_0xc1f2('0x3a')]=_['merge'](_0x2cbe3b['where'],{'$or':_[_0xc1f2('0x2a')](_0x3c44fd,function(_0x53a832){if(_0x53a832[_0xc1f2('0x2e')]!==_0xc1f2('0x3b')){var _0x2d7ed8={};_0x2d7ed8[_0x53a832['name']]={'$like':'%'+_0xa19cde[_0xc1f2('0x31')]['filter']+'%'};return _0x2d7ed8;}})});}_0x2cbe3b=_[_0xc1f2('0x3c')]({},_0x2cbe3b,_0xa19cde[_0xc1f2('0x3d')]);var _0x44ae86={'where':_0x2cbe3b[_0xc1f2('0x3a')]};return db[_0xc1f2('0x2b')]['count'](_0x44ae86)[_0xc1f2('0x3e')](function(_0x2abcd4){_0x23034e[_0xc1f2('0x1d')]=_0x2abcd4;if(_0xa19cde['query']['includeAll']){_0x2cbe3b[_0xc1f2('0x3f')]=[{'all':!![]}];}return db[_0xc1f2('0x2b')]['findAll'](_0x2cbe3b);})[_0xc1f2('0x3e')](function(_0x19bef3){_0x23034e[_0xc1f2('0x40')]=_0x19bef3;return _0x23034e;})['then'](respondWithFilteredResult(_0x29729c,_0x2cbe3b))[_0xc1f2('0x41')](handleError(_0x29729c,null));};exports[_0xc1f2('0x42')]=function(_0x56c8c0,_0x383d33){var _0x2a0d26={'raw':!![],'where':{'id':_0x56c8c0[_0xc1f2('0x43')]['id']}},_0x211ff9={};_0x211ff9[_0xc1f2('0x30')]=_[_0xc1f2('0x44')](db['JscriptyQuestionReport'][_0xc1f2('0x2c')]);_0x211ff9['query']=_[_0xc1f2('0x44')](_0x56c8c0[_0xc1f2('0x31')]);_0x211ff9['filters']=_[_0xc1f2('0x32')](_0x211ff9[_0xc1f2('0x30')],_0x211ff9[_0xc1f2('0x31')]);_0x2a0d26[_0xc1f2('0x34')]=_[_0xc1f2('0x32')](_0x211ff9[_0xc1f2('0x30')],qs[_0xc1f2('0x33')](_0x56c8c0['query'][_0xc1f2('0x33')]));_0x2a0d26[_0xc1f2('0x34')]=_0x2a0d26[_0xc1f2('0x34')][_0xc1f2('0x35')]?_0x2a0d26[_0xc1f2('0x34')]:_0x211ff9[_0xc1f2('0x30')];if(_0x56c8c0['query'][_0xc1f2('0x45')]){_0x2a0d26['include']=[{'all':!![]}];}_0x2a0d26=_[_0xc1f2('0x3c')]({},_0x2a0d26,_0x56c8c0[_0xc1f2('0x3d')]);return db['JscriptyQuestionReport'][_0xc1f2('0x46')](_0x2a0d26)[_0xc1f2('0x3e')](handleEntityNotFound(_0x383d33,null))[_0xc1f2('0x3e')](respondWithResult(_0x383d33,null))[_0xc1f2('0x41')](handleError(_0x383d33,null));};exports['create']=function(_0xf4640,_0x30a7c3){return db[_0xc1f2('0x2b')][_0xc1f2('0x47')](_0xf4640[_0xc1f2('0x48')],{})[_0xc1f2('0x3e')](respondWithResult(_0x30a7c3,0xc9))[_0xc1f2('0x41')](handleError(_0x30a7c3,null));};exports['update']=function(_0x25c7de,_0x73e501){if(_0x25c7de[_0xc1f2('0x48')]['id']){delete _0x25c7de['body']['id'];}return db[_0xc1f2('0x2b')][_0xc1f2('0x46')]({'where':{'id':_0x25c7de['params']['id']}})[_0xc1f2('0x3e')](handleEntityNotFound(_0x73e501,null))[_0xc1f2('0x3e')](saveUpdates(_0x25c7de['body'],null))['then'](respondWithResult(_0x73e501,null))[_0xc1f2('0x41')](handleError(_0x73e501,null));};exports[_0xc1f2('0x24')]=function(_0x20d69c,_0x34e6bc){return db[_0xc1f2('0x2b')][_0xc1f2('0x46')]({'where':{'id':_0x20d69c['params']['id']}})['then'](handleEntityNotFound(_0x34e6bc,null))[_0xc1f2('0x3e')](removeEntity(_0x34e6bc,null))[_0xc1f2('0x41')](handleError(_0x34e6bc,null));};exports['describe']=function(_0x419a26,_0xd844f2){return db[_0xc1f2('0x2b')][_0xc1f2('0x49')]()[_0xc1f2('0x3e')](respondWithResult(_0xd844f2,null))[_0xc1f2('0x41')](handleError(_0xd844f2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 265822a..830f835 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 _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 +var _0x1eef=['rimraf','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','util','path'];(function(_0x4e888a,_0x5d76f6){var _0x5c9c8c=function(_0x2a3a29){while(--_0x2a3a29){_0x4e888a['push'](_0x4e888a['shift']());}};_0x5c9c8c(++_0x5d76f6);}(_0x1eef,0x17f));var _0xf1ee=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0x1eef[_0x46f3f8];return _0xbc57cd;};'use strict';var _=require('lodash');var util=require(_0xf1ee('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1ee('0x1'));var rimraf=require(_0xf1ee('0x2'));var config=require('../../config/environment');var attributes=require(_0xf1ee('0x3'));module[_0xf1ee('0x4')]=function(_0x3d2a75,_0x444179){return _0x3d2a75['define'](_0xf1ee('0x5'),attributes,{'tableName':_0xf1ee('0x6'),'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 83616f0..754091b 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 _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 +var _0x4f99=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x177ecd,_0x237b49){var _0x39c5da=function(_0x507d22){while(--_0x507d22){_0x177ecd['push'](_0x177ecd['shift']());}};_0x39c5da(++_0x237b49);}(_0x4f99,0x13f));var _0x94f9=function(_0x5b086e,_0x5eb6c0){_0x5b086e=_0x5b086e-0x0;var _0x3e2c2c=_0x4f99[_0x5b086e];return _0x3e2c2c;};'use strict';var _=require(_0x94f9('0x0'));var util=require(_0x94f9('0x1'));var moment=require(_0x94f9('0x2'));var BPromise=require('bluebird');var rs=require(_0x94f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94f9('0x4'))['db'];var utils=require(_0x94f9('0x5'));var logger=require(_0x94f9('0x6'))(_0x94f9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x94f9('0x8')][_0x94f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9c1d81,_0x211b60,_0x1735ab){return new BPromise(function(_0x1596cd,_0x52785d){return client['request'](_0x9c1d81,_0x1735ab)['then'](function(_0x481c52){logger[_0x94f9('0xa')](_0x94f9('0xb'),_0x211b60,_0x94f9('0xc'));logger[_0x94f9('0xd')](_0x94f9('0xe'),_0x211b60,_0x94f9('0xc'),JSON[_0x94f9('0xf')](_0x481c52));if(_0x481c52[_0x94f9('0x10')]){if(_0x481c52[_0x94f9('0x10')][_0x94f9('0x11')]===0x1f4){logger[_0x94f9('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x211b60,_0x481c52[_0x94f9('0x10')]['message']);return _0x52785d(_0x481c52['error'][_0x94f9('0x12')]);}logger['error'](_0x94f9('0xb'),_0x211b60,_0x481c52[_0x94f9('0x10')][_0x94f9('0x12')]);return _0x1596cd(_0x481c52[_0x94f9('0x10')][_0x94f9('0x12')]);}else{logger[_0x94f9('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x211b60,_0x94f9('0xc'));_0x1596cd(_0x481c52[_0x94f9('0x13')][_0x94f9('0x12')]);}})[_0x94f9('0x14')](function(_0x4e6dc3){logger['error'](_0x94f9('0xb'),_0x211b60,_0x4e6dc3);_0x52785d(_0x4e6dc3);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 6b0ad2a..ce54036 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 _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 +var _0x95e8=['exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','post','create','put','delete','/:id'];(function(_0x4aa7a9,_0xaed7f9){var _0x426bb8=function(_0x2ed029){while(--_0x2ed029){_0x4aa7a9['push'](_0x4aa7a9['shift']());}};_0x426bb8(++_0xaed7f9);}(_0x95e8,0x1ba));var _0x895e=function(_0x4dd83f,_0x4de8d9){_0x4dd83f=_0x4dd83f-0x0;var _0x3b22b0=_0x95e8[_0x4dd83f];return _0x3b22b0;};'use strict';var multer=require(_0x895e('0x0'));var util=require(_0x895e('0x1'));var path=require(_0x895e('0x2'));var timeout=require('connect-timeout');var express=require(_0x895e('0x3'));var router=express['Router']();var fs_extra=require(_0x895e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x895e('0x5'));var config=require(_0x895e('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x895e('0x7')]('/',auth[_0x895e('0x8')](),controller[_0x895e('0x9')]);router[_0x895e('0x7')](_0x895e('0xa'),auth['isAuthenticated'](),controller[_0x895e('0xb')]);router[_0x895e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x895e('0xc')]);router[_0x895e('0x7')](_0x895e('0xd'),auth[_0x895e('0x8')](),controller[_0x895e('0xe')]);router[_0x895e('0xf')]('/',auth[_0x895e('0x8')](),controller[_0x895e('0x10')]);router[_0x895e('0x11')]('/:id',auth[_0x895e('0x8')](),controller['update']);router[_0x895e('0x12')](_0x895e('0x13'),auth[_0x895e('0x8')](),controller['destroy']);module[_0x895e('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 2614351..bf38d02 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 _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 +var _0xd86a=['DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2a0db0,_0x4b7061){var _0x533972=function(_0x1e257a){while(--_0x1e257a){_0x2a0db0['push'](_0x2a0db0['shift']());}};_0x533972(++_0x4b7061);}(_0xd86a,0xf3));var _0xad86=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0xd86a[_0x3e21f4];return _0x40fc49;};'use strict';var moment=require(_0xad86('0x0'));var Sequelize=require(_0xad86('0x1'));module[_0xad86('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5b9bff){this[_0xad86('0x3')](_0xad86('0x4'),_0x5b9bff);this['setDataValue']('endtime',moment()[_0xad86('0x5')](_0xad86('0x6')));}},'endtime':{'type':Sequelize[_0xad86('0x7')]},'membername':{'type':Sequelize[_0xad86('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xad86('0x8')]},'calleridnum':{'type':Sequelize[_0xad86('0x8')]},'completed':{'type':Sequelize[_0xad86('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 84f0b49..bc531d4 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 _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 +var _0x47d5=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','merge','VIRTUAL','JscriptySessionReport','includeAll','include','rows','catch','show','options','find','create','body','update','params','describe','getQuestions','nolimit','pick','filter','JscriptyQuestionReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x4e8b5c,_0x4ecd48){var _0x17a710=function(_0x1f1c89){while(--_0x1f1c89){_0x4e8b5c['push'](_0x4e8b5c['shift']());}};_0x17a710(++_0x4ecd48);}(_0x47d5,0x12b));var _0x547d=function(_0x3747b4,_0x5c18e5){_0x3747b4=_0x3747b4-0x0;var _0x31f1e1=_0x47d5[_0x3747b4];return _0x31f1e1;};'use strict';var emlformat=require(_0x547d('0x0'));var rimraf=require(_0x547d('0x1'));var zipdir=require(_0x547d('0x2'));var jsonpatch=require(_0x547d('0x3'));var rp=require(_0x547d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x547d('0x5'));var util=require(_0x547d('0x6'));var path=require('path');var sox=require(_0x547d('0x7'));var csv=require(_0x547d('0x8'));var ejs=require(_0x547d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x547d('0xa'));var crypto=require(_0x547d('0xb'));var jsforce=require(_0x547d('0xc'));var deskjs=require(_0x547d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x547d('0xe'));var Papa=require(_0x547d('0xf'));var Redis=require(_0x547d('0x10'));var authService=require(_0x547d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x547d('0x12'));var hardwareService=require(_0x547d('0x13'));var logger=require(_0x547d('0x14'))(_0x547d('0x15'));var utils=require('../../config/utils');var config=require(_0x547d('0x16'));var licenseUtil=require(_0x547d('0x17'));var db=require(_0x547d('0x18'))['db'];function respondWithStatusCode(_0x14bf5e,_0x527a5f){_0x527a5f=_0x527a5f||0xcc;return function(_0x3e815c){if(_0x3e815c){return _0x14bf5e[_0x547d('0x19')](_0x527a5f);}return _0x14bf5e[_0x547d('0x1a')](_0x527a5f)[_0x547d('0x1b')]();};}function respondWithResult(_0x55e58f,_0x355976){_0x355976=_0x355976||0xc8;return function(_0x22499e){if(_0x22499e){return _0x55e58f[_0x547d('0x1a')](_0x355976)[_0x547d('0x1c')](_0x22499e);}};}function respondWithFilteredResult(_0x1da2d4,_0xbee398){return function(_0x315203){if(_0x315203){var _0x1b0051=typeof _0xbee398['offset']===_0x547d('0x1d')&&typeof _0xbee398['limit']===_0x547d('0x1d');var _0x59456c=_0x315203[_0x547d('0x1e')];var _0x282f52=_0x1b0051?0x0:_0xbee398[_0x547d('0x1f')];var _0x4cd164=_0x1b0051?_0x315203[_0x547d('0x1e')]:_0xbee398[_0x547d('0x1f')]+_0xbee398[_0x547d('0x20')];var _0x4a1e43;if(_0x4cd164>=_0x59456c){_0x4cd164=_0x59456c;_0x4a1e43=0xc8;}else{_0x4a1e43=0xce;}_0x1da2d4['status'](_0x4a1e43);return _0x1da2d4[_0x547d('0x21')]('Content-Range',_0x282f52+'-'+_0x4cd164+'/'+_0x59456c)[_0x547d('0x1c')](_0x315203);}return null;};}function patchUpdates(_0x533842){return function(_0x127e68){try{jsonpatch[_0x547d('0x22')](_0x127e68,_0x533842,!![]);}catch(_0x303dd8){return BPromise[_0x547d('0x23')](_0x303dd8);}return _0x127e68[_0x547d('0x24')]();};}function saveUpdates(_0x3395ca,_0x1e5494){return function(_0x1fdc45){if(_0x1fdc45){return _0x1fdc45['update'](_0x3395ca)[_0x547d('0x25')](function(_0x5cc265){return _0x5cc265;});}return null;};}function removeEntity(_0x1afd83,_0x2706b6){return function(_0x250dc8){if(_0x250dc8){return _0x250dc8[_0x547d('0x26')]()[_0x547d('0x25')](function(){_0x1afd83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12fb1e,_0x50fd32){return function(_0x283f63){if(!_0x283f63){_0x12fb1e[_0x547d('0x19')](0x194);}return _0x283f63;};}function handleError(_0x5937ca,_0x4f4ca3){_0x4f4ca3=_0x4f4ca3||0x1f4;return function(_0x5f0a8a){logger[_0x547d('0x27')](_0x5f0a8a[_0x547d('0x28')]);if(_0x5f0a8a[_0x547d('0x29')]){delete _0x5f0a8a[_0x547d('0x29')];}_0x5937ca[_0x547d('0x1a')](_0x4f4ca3)[_0x547d('0x2a')](_0x5f0a8a);};}exports[_0x547d('0x2b')]=function(_0x57f087,_0x1181aa){var _0xf84790={},_0x385aa1={},_0x558223={'count':0x0,'rows':[]};var _0x306173=_['map'](db['JscriptySessionReport'][_0x547d('0x2c')],function(_0x113b6a){return{'name':_0x113b6a['fieldName'],'type':_0x113b6a['type']['key']};});_0x385aa1[_0x547d('0x2d')]=_[_0x547d('0x2e')](_0x306173,_0x547d('0x29'));_0x385aa1[_0x547d('0x2f')]=_[_0x547d('0x30')](_0x57f087[_0x547d('0x2f')]);_0x385aa1['filters']=_['intersection'](_0x385aa1['model'],_0x385aa1[_0x547d('0x2f')]);_0xf84790[_0x547d('0x31')]=_[_0x547d('0x32')](_0x385aa1[_0x547d('0x2d')],qs[_0x547d('0x33')](_0x57f087['query'][_0x547d('0x33')]));_0xf84790['attributes']=_0xf84790['attributes'][_0x547d('0x34')]?_0xf84790[_0x547d('0x31')]:_0x385aa1[_0x547d('0x2d')];if(!_0x57f087[_0x547d('0x2f')][_0x547d('0x35')]('nolimit')){_0xf84790['limit']=qs['limit'](_0x57f087['query'][_0x547d('0x20')]);_0xf84790['offset']=qs['offset'](_0x57f087['query'][_0x547d('0x1f')]);}_0xf84790['order']=qs[_0x547d('0x36')](_0x57f087[_0x547d('0x2f')][_0x547d('0x36')]);_0xf84790[_0x547d('0x37')]=qs['filters'](_['pick'](_0x57f087[_0x547d('0x2f')],_0x385aa1[_0x547d('0x38')]),_0x306173);if(_0x57f087['query']['filter']){_0xf84790[_0x547d('0x37')]=_[_0x547d('0x39')](_0xf84790[_0x547d('0x37')],{'$or':_[_0x547d('0x2e')](_0x306173,function(_0x7b524f){if(_0x7b524f['type']!==_0x547d('0x3a')){var _0x5f35e1={};_0x5f35e1[_0x7b524f['name']]={'$like':'%'+_0x57f087[_0x547d('0x2f')]['filter']+'%'};return _0x5f35e1;}})});}_0xf84790=_[_0x547d('0x39')]({},_0xf84790,_0x57f087['options']);var _0x48d44b={'where':_0xf84790[_0x547d('0x37')]};return db[_0x547d('0x3b')][_0x547d('0x1e')](_0x48d44b)[_0x547d('0x25')](function(_0x6a5e2f){_0x558223[_0x547d('0x1e')]=_0x6a5e2f;if(_0x57f087['query'][_0x547d('0x3c')]){_0xf84790[_0x547d('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xf84790);})['then'](function(_0x6edf09){_0x558223[_0x547d('0x3e')]=_0x6edf09;return _0x558223;})[_0x547d('0x25')](respondWithFilteredResult(_0x1181aa,_0xf84790))[_0x547d('0x3f')](handleError(_0x1181aa,null));};exports[_0x547d('0x40')]=function(_0x3ce809,_0x24a83b){var _0x534810={'raw':!![],'where':{'id':_0x3ce809['params']['id']}},_0x228448={};_0x228448[_0x547d('0x2d')]=_['keys'](db[_0x547d('0x3b')]['rawAttributes']);_0x228448[_0x547d('0x2f')]=_[_0x547d('0x30')](_0x3ce809[_0x547d('0x2f')]);_0x228448[_0x547d('0x38')]=_[_0x547d('0x32')](_0x228448[_0x547d('0x2d')],_0x228448[_0x547d('0x2f')]);_0x534810[_0x547d('0x31')]=_['intersection'](_0x228448['model'],qs[_0x547d('0x33')](_0x3ce809[_0x547d('0x2f')]['fields']));_0x534810['attributes']=_0x534810[_0x547d('0x31')][_0x547d('0x34')]?_0x534810['attributes']:_0x228448[_0x547d('0x2d')];if(_0x3ce809[_0x547d('0x2f')][_0x547d('0x3c')]){_0x534810[_0x547d('0x3d')]=[{'all':!![]}];}_0x534810=_[_0x547d('0x39')]({},_0x534810,_0x3ce809[_0x547d('0x41')]);return db[_0x547d('0x3b')][_0x547d('0x42')](_0x534810)[_0x547d('0x25')](handleEntityNotFound(_0x24a83b,null))[_0x547d('0x25')](respondWithResult(_0x24a83b,null))[_0x547d('0x3f')](handleError(_0x24a83b,null));};exports[_0x547d('0x43')]=function(_0x23068d,_0x5d2d2f){return db[_0x547d('0x3b')][_0x547d('0x43')](_0x23068d[_0x547d('0x44')],{})[_0x547d('0x25')](respondWithResult(_0x5d2d2f,0xc9))[_0x547d('0x3f')](handleError(_0x5d2d2f,null));};exports[_0x547d('0x45')]=function(_0xa9197c,_0x15e519){if(_0xa9197c[_0x547d('0x44')]['id']){delete _0xa9197c[_0x547d('0x44')]['id'];}return db[_0x547d('0x3b')][_0x547d('0x42')]({'where':{'id':_0xa9197c[_0x547d('0x46')]['id']}})[_0x547d('0x25')](handleEntityNotFound(_0x15e519,null))[_0x547d('0x25')](saveUpdates(_0xa9197c['body'],null))[_0x547d('0x25')](respondWithResult(_0x15e519,null))[_0x547d('0x3f')](handleError(_0x15e519,null));};exports[_0x547d('0x26')]=function(_0x368faf,_0x4993fb){return db[_0x547d('0x3b')][_0x547d('0x42')]({'where':{'id':_0x368faf[_0x547d('0x46')]['id']}})['then'](handleEntityNotFound(_0x4993fb,null))[_0x547d('0x25')](removeEntity(_0x4993fb,null))['catch'](handleError(_0x4993fb,null));};exports[_0x547d('0x47')]=function(_0x33aef4,_0x4ec2cf){return db[_0x547d('0x3b')][_0x547d('0x47')]()['then'](respondWithResult(_0x4ec2cf,null))[_0x547d('0x3f')](handleError(_0x4ec2cf,null));};exports[_0x547d('0x48')]=function(_0x2c5952,_0x147f23,_0x3cf710){var _0x512d40={'raw':!![],'where':{}};var _0x38f8be={};var _0x31bbe1={'count':0x0,'rows':[]};return db[_0x547d('0x3b')]['findOne']({'where':{'id':_0x2c5952[_0x547d('0x46')]['id']}})[_0x547d('0x25')](handleEntityNotFound(_0x147f23,null))[_0x547d('0x25')](function(_0x4f6fbf){if(_0x4f6fbf){_0x38f8be[_0x547d('0x2d')]=_['keys'](db['JscriptyQuestionReport']['rawAttributes']);_0x38f8be['query']=_[_0x547d('0x30')](_0x2c5952['query']);_0x38f8be[_0x547d('0x38')]=_[_0x547d('0x32')](_0x38f8be['model'],_0x38f8be[_0x547d('0x2f')]);_0x512d40[_0x547d('0x31')]=_[_0x547d('0x32')](_0x38f8be[_0x547d('0x2d')],qs[_0x547d('0x33')](_0x2c5952[_0x547d('0x2f')][_0x547d('0x33')]));_0x512d40[_0x547d('0x31')]=_0x512d40[_0x547d('0x31')]['length']?_0x512d40['attributes']:_0x38f8be['model'];if(!_0x2c5952[_0x547d('0x2f')][_0x547d('0x35')](_0x547d('0x49'))){_0x512d40[_0x547d('0x20')]=qs['limit'](_0x2c5952['query'][_0x547d('0x20')]);_0x512d40[_0x547d('0x1f')]=qs[_0x547d('0x1f')](_0x2c5952['query'][_0x547d('0x1f')]);}_0x512d40['order']=qs[_0x547d('0x36')](_0x2c5952[_0x547d('0x2f')][_0x547d('0x36')]);_0x512d40['where']=qs[_0x547d('0x38')](_[_0x547d('0x4a')](_0x2c5952[_0x547d('0x2f')],_0x38f8be[_0x547d('0x38')]));_0x512d40['where']['SessionId']=_0x4f6fbf['id'];if(_0x2c5952[_0x547d('0x2f')][_0x547d('0x4b')]){_0x512d40[_0x547d('0x37')]=_[_0x547d('0x39')](_0x512d40[_0x547d('0x37')],{'$or':_[_0x547d('0x2e')](_0x512d40[_0x547d('0x31')],function(_0x1cbcca){var _0x4615b3={};_0x4615b3[_0x1cbcca]={'$like':'%'+_0x2c5952[_0x547d('0x2f')][_0x547d('0x4b')]+'%'};return _0x4615b3;})});}_0x512d40=_[_0x547d('0x39')]({},_0x512d40,_0x2c5952[_0x547d('0x41')]);return db[_0x547d('0x4c')][_0x547d('0x1e')]({'where':_0x512d40[_0x547d('0x37')]})[_0x547d('0x25')](function(_0x1c6537){_0x31bbe1[_0x547d('0x1e')]=_0x1c6537;if(_0x2c5952[_0x547d('0x2f')][_0x547d('0x3c')]){_0x512d40['include']=[{'all':!![]}];}return db[_0x547d('0x4c')][_0x547d('0x4d')](_0x512d40);})[_0x547d('0x25')](function(_0x14e550){_0x31bbe1[_0x547d('0x3e')]=_0x14e550;return _0x31bbe1;});}})[_0x547d('0x25')](respondWithFilteredResult(_0x147f23,_0x512d40))[_0x547d('0x3f')](handleError(_0x147f23,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 743ed86..37747cb 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 _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 +var _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0xd2f345,_0x595854){var _0x308e74=function(_0x297b79){while(--_0x297b79){_0xd2f345['push'](_0xd2f345['shift']());}};_0x308e74(++_0x595854);}(_0x4745,0x1e7));var _0x5474=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x4745[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('JscriptySessionReport',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index df4601d..2afd9ca 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 _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 +var _0x4325=['http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\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(_0xa26726,_0x866dec){var _0x113d77=function(_0xd9ed8){while(--_0xd9ed8){_0xa26726['push'](_0xa26726['shift']());}};_0x113d77(++_0x866dec);}(_0x4325,0x1da));var _0x5432=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4325[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var 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')]('JscriptySessionReport,\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/license/index.js b/server/api/license/index.js index 847edfa..5d7149e 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 _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 +var _0x4d92=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','put','/:id','update','get','/download_log_file','isAuthenticated','downloadLogFile','exports','util','connect-timeout'];(function(_0x2f5e13,_0xc51a47){var _0x3072a3=function(_0x338a31){while(--_0x338a31){_0x2f5e13['push'](_0x2f5e13['shift']());}};_0x3072a3(++_0xc51a47);}(_0x4d92,0x1eb));var _0x24d9=function(_0x5de8bf,_0x24e115){_0x5de8bf=_0x5de8bf-0x0;var _0x2be3e3=_0x4d92[_0x5de8bf];return _0x2be3e3;};'use strict';var multer=require('multer');var util=require(_0x24d9('0x0'));var path=require('path');var timeout=require(_0x24d9('0x1'));var express=require(_0x24d9('0x2'));var router=express[_0x24d9('0x3')]();var fs_extra=require(_0x24d9('0x4'));var auth=require(_0x24d9('0x5'));var interaction=require(_0x24d9('0x6'));var config=require(_0x24d9('0x7'));var controller=require(_0x24d9('0x8'));router['get']('/',controller['index']);router[_0x24d9('0x9')](_0x24d9('0xa'),auth['isAuthenticated'](),controller[_0x24d9('0xb')]);router[_0x24d9('0xc')](_0x24d9('0xd'),auth[_0x24d9('0xe')](),controller[_0x24d9('0xf')]);module[_0x24d9('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index b054f72..7564183 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 _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 +var _0x20be=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x20be,0x8f));var _0xe20b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x20be[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xe20b('0x0'));module[_0xe20b('0x1')]={'license':{'type':Sequelize[_0xe20b('0x2')]},'data1':{'type':Sequelize[_0xe20b('0x3')]},'data2':{'type':Sequelize[_0xe20b('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xe20b('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 e1f38c9..91461e6 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 _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 +var _0xf2b8=['License','find','get','body','key','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','model','keys','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf2b8,0x1f2));var _0x8f2b=function(_0x822fb9,_0x3fc565){_0x822fb9=_0x822fb9-0x0;var _0x13f715=_0xf2b8[_0x822fb9];return _0x13f715;};'use strict';var emlformat=require(_0x8f2b('0x0'));var rimraf=require(_0x8f2b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f2b('0x2'));var rp=require(_0x8f2b('0x3'));var moment=require('moment');var BPromise=require(_0x8f2b('0x4'));var Mustache=require(_0x8f2b('0x5'));var util=require(_0x8f2b('0x6'));var path=require('path');var sox=require(_0x8f2b('0x7'));var csv=require(_0x8f2b('0x8'));var ejs=require(_0x8f2b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f2b('0xa'));var squel=require(_0x8f2b('0xb'));var crypto=require(_0x8f2b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8f2b('0x8'));var querystring=require(_0x8f2b('0xd'));var Papa=require(_0x8f2b('0xe'));var Redis=require(_0x8f2b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8f2b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f2b('0x11'));var logger=require(_0x8f2b('0x12'))(_0x8f2b('0x13'));var utils=require(_0x8f2b('0x14'));var config=require(_0x8f2b('0x15'));var licenseUtil=require(_0x8f2b('0x16'));var db=require(_0x8f2b('0x17'))['db'];function respondWithStatusCode(_0x13ec7f,_0x3340ac){_0x3340ac=_0x3340ac||0xcc;return function(_0x2d6843){if(_0x2d6843){return _0x13ec7f[_0x8f2b('0x18')](_0x3340ac);}return _0x13ec7f[_0x8f2b('0x19')](_0x3340ac)[_0x8f2b('0x1a')]();};}function respondWithResult(_0x4e897f,_0x5cb97f){_0x5cb97f=_0x5cb97f||0xc8;return function(_0x1a4cca){if(_0x1a4cca){return _0x4e897f[_0x8f2b('0x19')](_0x5cb97f)[_0x8f2b('0x1b')](_0x1a4cca);}};}function respondWithFilteredResult(_0x397f01,_0x2ecceb){return function(_0x4358fe){if(_0x4358fe){var _0x4a33ca=typeof _0x2ecceb[_0x8f2b('0x1c')]==='undefined'&&typeof _0x2ecceb[_0x8f2b('0x1d')]===_0x8f2b('0x1e');var _0x2363bb=_0x4358fe['count'];var _0x3dd63a=_0x4a33ca?0x0:_0x2ecceb[_0x8f2b('0x1c')];var _0x53cd19=_0x4a33ca?_0x4358fe['count']:_0x2ecceb['offset']+_0x2ecceb[_0x8f2b('0x1d')];var _0x1c98e1;if(_0x53cd19>=_0x2363bb){_0x53cd19=_0x2363bb;_0x1c98e1=0xc8;}else{_0x1c98e1=0xce;}_0x397f01[_0x8f2b('0x19')](_0x1c98e1);return _0x397f01[_0x8f2b('0x1f')](_0x8f2b('0x20'),_0x3dd63a+'-'+_0x53cd19+'/'+_0x2363bb)['json'](_0x4358fe);}return null;};}function patchUpdates(_0x14fa30){return function(_0x1f0239){try{jsonpatch[_0x8f2b('0x21')](_0x1f0239,_0x14fa30,!![]);}catch(_0x2e5fd0){return BPromise['reject'](_0x2e5fd0);}return _0x1f0239[_0x8f2b('0x22')]();};}function saveUpdates(_0x8849ce,_0x411616){return function(_0x57c239){if(_0x57c239){return _0x57c239[_0x8f2b('0x23')](_0x8849ce)['then'](function(_0x984892){return _0x984892;});}return null;};}function removeEntity(_0x55eba4,_0x50100b){return function(_0x5bf2a5){if(_0x5bf2a5){return _0x5bf2a5[_0x8f2b('0x24')]()[_0x8f2b('0x25')](function(){_0x55eba4[_0x8f2b('0x19')](0xcc)[_0x8f2b('0x1a')]();});}};}function handleEntityNotFound(_0x39f513,_0x12b042){return function(_0x25bf00){if(!_0x25bf00){_0x39f513['sendStatus'](0x194);}return _0x25bf00;};}function handleError(_0x1d5aa3,_0x54cf2f){_0x54cf2f=_0x54cf2f||0x1f4;return function(_0x5982dd){logger[_0x8f2b('0x26')](_0x5982dd['stack']);if(_0x5982dd[_0x8f2b('0x27')]){delete _0x5982dd[_0x8f2b('0x27')];}_0x1d5aa3[_0x8f2b('0x19')](_0x54cf2f)[_0x8f2b('0x28')](_0x5982dd);};}var utilLicense=require(_0x8f2b('0x16'));exports[_0x8f2b('0x29')]=function(_0x2d4504,_0xbe26ab){var _0x4e41fb={'raw':!![],'where':{'id':0x1}},_0x476d5e={};_0x476d5e[_0x8f2b('0x2a')]=_[_0x8f2b('0x2b')](db['License']['rawAttributes']);_0x476d5e[_0x8f2b('0x2c')]=_[_0x8f2b('0x2b')](_0x2d4504[_0x8f2b('0x2c')]);_0x476d5e[_0x8f2b('0x2d')]=_[_0x8f2b('0x2e')](_0x476d5e[_0x8f2b('0x2a')],_0x476d5e['query']);_0x4e41fb[_0x8f2b('0x2f')]=_[_0x8f2b('0x2e')](_0x476d5e['model'],qs[_0x8f2b('0x30')](_0x2d4504['query'][_0x8f2b('0x30')]));_0x4e41fb[_0x8f2b('0x2f')]=_0x4e41fb[_0x8f2b('0x2f')][_0x8f2b('0x31')]?_0x4e41fb[_0x8f2b('0x2f')]:_0x476d5e[_0x8f2b('0x2a')];_0x4e41fb=_[_0x8f2b('0x32')]({},_0x4e41fb,_0x2d4504[_0x8f2b('0x33')]);return utilLicense[_0x8f2b('0x34')](_0x4e41fb)[_0x8f2b('0x25')](respondWithResult(_0xbe26ab,null))[_0x8f2b('0x35')](handleError(_0xbe26ab,null));};exports[_0x8f2b('0x23')]=function(_0x399439,_0x3bccd7){if(_0x399439['body']['id']){delete _0x399439['body']['id'];}return db[_0x8f2b('0x36')][_0x8f2b('0x37')]({'where':{'id':_0x399439['params']['id']}})[_0x8f2b('0x25')](handleEntityNotFound(_0x3bccd7,null))[_0x8f2b('0x25')](function(_0x189fcf){var _0x3faf58=_0x189fcf[_0x8f2b('0x38')]({'plain':!![]});return utilLicense['checkLicense'](_0x3faf58,_0x399439[_0x8f2b('0x39')][_0x8f2b('0x3a')]);})[_0x8f2b('0x25')](function(_0x3898da){if(!_0x3898da[_0x8f2b('0x3b')]){return saveUpdates(_0x399439[_0x8f2b('0x39')],null);}return _0x3898da;})[_0x8f2b('0x25')](respondWithResult(_0x3bccd7,null))[_0x8f2b('0x35')](handleError(_0x3bccd7,null));};exports[_0x8f2b('0x3c')]=function(_0x4462b8,_0x53e3e5){var _0x2a55cf=_0x8f2b('0x3d');var _0x1e4019=path[_0x8f2b('0x3e')](_0x8f2b('0x3f'),'log',_0x8f2b('0x40'),_0x2a55cf);_0x53e3e5[_0x8f2b('0x41')]('Content-disposition','attachment;\x20filename='+_0x2a55cf);_0x53e3e5[_0x8f2b('0x1f')](_0x8f2b('0x42'),_0x8f2b('0x43'));_0x53e3e5[_0x8f2b('0x44')](_0x1e4019);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ff9fc35..73fc6b3 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 _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 +var _0x072c=['util','../../config/logger','api','moment','path','rimraf','exports','define','License','license','lodash'];(function(_0x43986b,_0x30ac18){var _0x5da67f=function(_0x4949ca){while(--_0x4949ca){_0x43986b['push'](_0x43986b['shift']());}};_0x5da67f(++_0x30ac18);}(_0x072c,0x18b));var _0xc072=function(_0x4cb01a,_0xe444be){_0x4cb01a=_0x4cb01a-0x0;var _0x102f6c=_0x072c[_0x4cb01a];return _0x102f6c;};'use strict';var _=require(_0xc072('0x0'));var util=require(_0xc072('0x1'));var logger=require(_0xc072('0x2'))(_0xc072('0x3'));var moment=require(_0xc072('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc072('0x5'));var rimraf=require(_0xc072('0x6'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0xc072('0x7')]=function(_0xe0fe1d,_0x1d385e){return _0xe0fe1d[_0xc072('0x8')](_0xc072('0x9'),attributes,{'tableName':_0xc072('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 cc7fe84..94a6480 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 _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 +var _0x8a9b=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','License,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3b8d57,_0x23d21f){var _0x43a2ef=function(_0x3714e5){while(--_0x3714e5){_0x3b8d57['push'](_0x3b8d57['shift']());}};_0x43a2ef(++_0x23d21f);}(_0x8a9b,0x17e));var _0xb8a9=function(_0x1bedb3,_0xaf2b8d){_0x1bedb3=_0x1bedb3-0x0;var _0x64bc19=_0x8a9b[_0x1bedb3];return _0x64bc19;};'use strict';var _=require('lodash');var util=require(_0xb8a9('0x0'));var moment=require(_0xb8a9('0x1'));var BPromise=require(_0xb8a9('0x2'));var rs=require(_0xb8a9('0x3'));var fs=require('fs');var Redis=require(_0xb8a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8a9('0x5'));var logger=require(_0xb8a9('0x6'))('rpc');var config=require(_0xb8a9('0x7'));var jayson=require(_0xb8a9('0x8'));var client=jayson[_0xb8a9('0x9')][_0xb8a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5022e1,_0x44fc9c,_0x3a5216){return new BPromise(function(_0xd03148,_0x410903){return client[_0xb8a9('0xb')](_0x5022e1,_0x3a5216)[_0xb8a9('0xc')](function(_0x48c34b){logger[_0xb8a9('0xd')]('License,\x20%s,\x20%s',_0x44fc9c,_0xb8a9('0xe'));logger[_0xb8a9('0xf')](_0xb8a9('0x10'),_0x44fc9c,_0xb8a9('0xe'),JSON['stringify'](_0x48c34b));if(_0x48c34b[_0xb8a9('0x11')]){if(_0x48c34b[_0xb8a9('0x11')][_0xb8a9('0x12')]===0x1f4){logger[_0xb8a9('0x11')](_0xb8a9('0x13'),_0x44fc9c,_0x48c34b[_0xb8a9('0x11')]['message']);return _0x410903(_0x48c34b[_0xb8a9('0x11')][_0xb8a9('0x14')]);}logger[_0xb8a9('0x11')](_0xb8a9('0x13'),_0x44fc9c,_0x48c34b[_0xb8a9('0x11')]['message']);return _0xd03148(_0x48c34b['error'][_0xb8a9('0x14')]);}else{logger[_0xb8a9('0xd')](_0xb8a9('0x13'),_0x44fc9c,_0xb8a9('0xe'));_0xd03148(_0x48c34b[_0xb8a9('0x15')]['message']);}})['catch'](function(_0x38debf){logger[_0xb8a9('0x11')](_0xb8a9('0x13'),_0x44fc9c,_0x38debf);_0x410903(_0x38debf);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f1d04e2..6469d62 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 _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 +var _0xcaa7=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports'];(function(_0x2a190f,_0x301e4b){var _0x427d0c=function(_0x4a4c6f){while(--_0x4a4c6f){_0x2a190f['push'](_0x2a190f['shift']());}};_0x427d0c(++_0x301e4b);}(_0xcaa7,0xc4));var _0x7caa=function(_0x5c1834,_0x3a0961){_0x5c1834=_0x5c1834-0x0;var _0x21294c=_0xcaa7[_0x5c1834];return _0x21294c;};'use strict';var multer=require(_0x7caa('0x0'));var util=require(_0x7caa('0x1'));var path=require(_0x7caa('0x2'));var timeout=require(_0x7caa('0x3'));var express=require(_0x7caa('0x4'));var router=express[_0x7caa('0x5')]();var fs_extra=require(_0x7caa('0x6'));var auth=require(_0x7caa('0x7'));var interaction=require(_0x7caa('0x8'));var config=require(_0x7caa('0x9'));var controller=require(_0x7caa('0xa'));router[_0x7caa('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7caa('0xb')](_0x7caa('0xc'),auth[_0x7caa('0xd')](),controller[_0x7caa('0xe')]);router['get'](_0x7caa('0xf'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x10')]);router[_0x7caa('0xb')](_0x7caa('0x11'),auth[_0x7caa('0xd')](),controller['getDispositions']);router[_0x7caa('0xb')](_0x7caa('0x12'),auth['isAuthenticated'](),controller[_0x7caa('0x13')]);router[_0x7caa('0xb')](_0x7caa('0x14'),auth['isAuthenticated'](),controller[_0x7caa('0x15')]);router[_0x7caa('0xb')](_0x7caa('0x16'),auth['isAuthenticated'](),controller[_0x7caa('0x17')]);router[_0x7caa('0xb')]('/:id/interactions',auth[_0x7caa('0xd')](),controller[_0x7caa('0x18')]);router[_0x7caa('0xb')](_0x7caa('0x19'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x1a')]);router['get']('/:id/messages',auth[_0x7caa('0xd')](),controller[_0x7caa('0x1b')]);router[_0x7caa('0xb')](_0x7caa('0x1c'),auth['isAuthenticated'](),controller[_0x7caa('0x1d')]);router[_0x7caa('0xb')](_0x7caa('0x1e'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x1f')]);router[_0x7caa('0x20')](_0x7caa('0x11'),auth[_0x7caa('0xd')](),controller['addDisposition']);router[_0x7caa('0x20')]('/:id/canned_answers',auth[_0x7caa('0xd')](),controller['addAnswer']);router[_0x7caa('0x20')]('/',auth[_0x7caa('0xd')](),controller[_0x7caa('0x21')]);router[_0x7caa('0x20')]('/:id/in_servers',auth[_0x7caa('0xd')](),controller[_0x7caa('0x22')]);router['post'](_0x7caa('0x16'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x23')]);router[_0x7caa('0x20')](_0x7caa('0x24'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x25')]);router['post']('/:id/applications',auth[_0x7caa('0xd')](),controller[_0x7caa('0x26')]);router[_0x7caa('0x20')](_0x7caa('0x27'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x28')]);router[_0x7caa('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0x7caa('0x29')]);router[_0x7caa('0x2a')](_0x7caa('0xf'),auth[_0x7caa('0xd')](),controller['update']);router[_0x7caa('0x2b')]('/:id/dispositions',auth[_0x7caa('0xd')](),controller['removeDispositions']);router[_0x7caa('0x2b')]('/:id/canned_answers',auth[_0x7caa('0xd')](),controller[_0x7caa('0x2c')]);router[_0x7caa('0x2b')](_0x7caa('0x14'),auth[_0x7caa('0xd')](),controller['removeImap']);router[_0x7caa('0x2b')](_0x7caa('0x16'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x2d')]);router[_0x7caa('0x2b')](_0x7caa('0xf'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x2e')]);router[_0x7caa('0x2b')](_0x7caa('0x1e'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x2f')]);module[_0x7caa('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4edd21a..f59a781 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 _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 +var _0x8f38=['INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT'];(function(_0x4d2a96,_0x17e3ca){var _0x3dcb7c=function(_0x157956){while(--_0x157956){_0x4d2a96['push'](_0x4d2a96['shift']());}};_0x3dcb7c(++_0x17e3ca);}(_0x8f38,0x10c));var _0x88f3=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0x8f38[_0x10b48a];return _0x2c4533;};'use strict';var Sequelize=require(_0x88f3('0x0'));module['exports']={'description':{'type':Sequelize[_0x88f3('0x1')]},'name':{'type':Sequelize[_0x88f3('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x88f3('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x88f3('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x88f3('0x3')]},'markAsUnread':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x88f3('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x88f3('0x3')],'defaultValue':function(){return _0x88f3('0x5');}},'notificationSound':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x88f3('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x88f3('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':![],'comment':_0x88f3('0x6'),'set':function(_0x24db75){if(!_0x24db75)this[_0x88f3('0x7')]('mandatoryDispositionPauseId',null);this[_0x88f3('0x7')](_0x88f3('0x8'),_0x24db75);}},'provider':{'type':Sequelize['ENUM'](_0x88f3('0x9'),_0x88f3('0xa'),_0x88f3('0xb'),_0x88f3('0xc')),'defaultValue':null,'get':function(){if(!this[_0x88f3('0xd')](_0x88f3('0xe')))return _0x88f3('0xf');return this[_0x88f3('0xd')](_0x88f3('0xe'));},'set':function(_0x12b7d6){if(_0x12b7d6==='custom')_0x12b7d6=null;return this[_0x88f3('0x7')](_0x88f3('0xe'),_0x12b7d6);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0206020..6775d7b 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 _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 +var _0x432a=['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','api','../../mysqldb','redis','./mailAccount.socket','jayson/promise','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','index','MailServerIn','Pause','map','MailAccount','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','MailServerOut','Smtp','mandatoryDispositionPause','rawAttributes','includeAll','body','provider','find','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','pick','removeDispositions','addAnswer','getAnswers','CannedAnswer','hasOwnProperty','removeAnswers','custom','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','ids','MailInteraction','CmContact','User','Owner','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','MailApplication','priority','finally','getApplications','getMessages','MailMessage','$gte','format','inlineCss','true','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','email','attachments','join','root','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','messageId','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize'];(function(_0x1b506e,_0x1f9720){var _0x391a5e=function(_0x376f6b){while(--_0x376f6b){_0x1b506e['push'](_0x1b506e['shift']());}};_0x391a5e(++_0x1f9720);}(_0x432a,0x18f));var _0xa432=function(_0x48040f,_0x364690){_0x48040f=_0x48040f-0x0;var _0x5dfad0=_0x432a[_0x48040f];return _0x5dfad0;};'use strict';var moment=require(_0xa432('0x0'));var BPromise=require(_0xa432('0x1'));var util=require(_0xa432('0x2'));var path=require(_0xa432('0x3'));var _=require(_0xa432('0x4'));var juice=require(_0xa432('0x5'));var Redis=require(_0xa432('0x6'));var qs=require(_0xa432('0x7'));var logger=require(_0xa432('0x8'))(_0xa432('0x9'));var config=require('../../config/environment');var db=require(_0xa432('0xa'))['db'];config[_0xa432('0xb')]=_['defaults'](config[_0xa432('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa432('0xb')]));require(_0xa432('0xc'))['register'](socket);var jayson=require(_0xa432('0xd'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x1bf845,_0x3ee712,_0x44af9f,_0x521227){return new BPromise(function(_0x4ebb03,_0xfb5c5a){var _0x7d84e3=_0x521227||client;return _0x7d84e3['request'](_0x1bf845,_0x44af9f)[_0xa432('0xe')](function(_0x426da8){logger[_0xa432('0xf')](_0xa432('0x10'),_0x3ee712,_0xa432('0x11'));logger[_0xa432('0x12')](_0xa432('0x13'),_0x3ee712,_0xa432('0x11'),JSON[_0xa432('0x14')](_0x426da8));if(_0x426da8['error']){if(_0x426da8[_0xa432('0x15')]['code']===0x1f4){logger['error'](_0xa432('0x10'),_0x3ee712,_0x426da8[_0xa432('0x15')]['message']);return _0xfb5c5a(_0x426da8[_0xa432('0x15')][_0xa432('0x16')]);}logger[_0xa432('0x15')](_0xa432('0x10'),_0x3ee712,_0x426da8[_0xa432('0x15')][_0xa432('0x16')]);return _0x4ebb03(_0x426da8[_0xa432('0x15')][_0xa432('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x3ee712,_0xa432('0x11'));_0x4ebb03(_0x426da8['result']['message']);}})[_0xa432('0x17')](function(_0x4ccf01){logger['error']('MailAccount,\x20%s,\x20%s',_0x3ee712,_0x4ccf01);_0xfb5c5a(_0x4ccf01);});});}function respondWithStatusCode(_0x1a6d1b,_0x3aa242){_0x3aa242=_0x3aa242||0xcc;return function(_0x3e6a42){if(_0x3e6a42){return _0x1a6d1b['sendStatus'](_0x3aa242);}return _0x1a6d1b[_0xa432('0x18')](_0x3aa242)['end']();};}function respondWithResult(_0x34813c,_0x29313f){_0x29313f=_0x29313f||0xc8;return function(_0x23dcad){if(_0x23dcad){return _0x34813c[_0xa432('0x18')](_0x29313f)[_0xa432('0x19')](_0x23dcad);}};}function respondWithFilteredResult(_0x395b50,_0x2367d5){return function(_0x21015d){if(_0x21015d){var _0x4209fd=typeof _0x2367d5[_0xa432('0x1a')]===_0xa432('0x1b')&&typeof _0x2367d5[_0xa432('0x1c')]==='undefined';var _0x1ce203=_0x21015d[_0xa432('0x1d')];var _0x58eb62=_0x4209fd?0x0:_0x2367d5[_0xa432('0x1a')];var _0x349576=_0x4209fd?_0x21015d[_0xa432('0x1d')]:_0x2367d5[_0xa432('0x1a')]+_0x2367d5['limit'];var _0x5b8fc6;if(_0x349576>=_0x1ce203){_0x349576=_0x1ce203;_0x5b8fc6=0xc8;}else{_0x5b8fc6=0xce;}_0x395b50[_0xa432('0x18')](_0x5b8fc6);return _0x395b50[_0xa432('0x1e')](_0xa432('0x1f'),_0x58eb62+'-'+_0x349576+'/'+_0x1ce203)[_0xa432('0x19')](_0x21015d);}return null;};}function saveUpdates(_0x262158){return function(_0xb8c588){if(_0xb8c588){return _0xb8c588[_0xa432('0x20')](_0x262158)[_0xa432('0xe')](function(_0x16b71a){return _0x16b71a;});}return null;};}function removeEntity(_0xfcd2b7){return function(_0x5b26fa){if(_0x5b26fa){return _0x5b26fa[_0xa432('0x21')]()[_0xa432('0xe')](function(){var _0x51744d=_0x5b26fa[_0xa432('0x22')]({'plain':!![]});var _0x442ef8=_0xa432('0x23');return db[_0xa432('0x24')]['destroy']({'where':{'type':_0x442ef8,'resourceId':_0x51744d['id']}})[_0xa432('0xe')](function(){return _0x5b26fa;});})[_0xa432('0xe')](function(){_0xfcd2b7[_0xa432('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xea7da3){return function(_0x1978b7){if(!_0x1978b7){_0xea7da3[_0xa432('0x25')](0x194);}return _0x1978b7;};}function handleError(_0x4681b0,_0x3529e3){_0x3529e3=_0x3529e3||0x1f4;return function(_0x1a0d23){logger[_0xa432('0x15')](_0x1a0d23[_0xa432('0x26')]);if(_0x1a0d23[_0xa432('0x27')]){delete _0x1a0d23['name'];}_0x4681b0[_0xa432('0x18')](_0x3529e3)[_0xa432('0x28')](_0x1a0d23);};}function getImapHost(_0x54dc47){switch(_0x54dc47){case _0xa432('0x29'):return _0xa432('0x2a');case _0xa432('0x2b'):return _0xa432('0x2c');case _0xa432('0x2d'):return _0xa432('0x2e');case _0xa432('0x2f'):return _0xa432('0x30');}throw new Error(_0xa432('0x31'),_0x54dc47);}function getSmtpHost(_0x5f2137){switch(_0x5f2137){case _0xa432('0x29'):return _0xa432('0x32');case _0xa432('0x2b'):return _0xa432('0x33');case _0xa432('0x2d'):return _0xa432('0x34');case _0xa432('0x2f'):return _0xa432('0x35');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5f2137);}function getAuthenticationOptions(_0x4dc989,_0x2a4f10){var _0x789eef={};var _0x533ac6={};if(_0x4dc989){_0x789eef[_0xa432('0x36')]=_0x533ac6['user']=_0x2a4f10['username'];_0x789eef[_0xa432('0x37')]=_0x533ac6[_0xa432('0x38')]=_0x2a4f10[_0xa432('0x37')];if(_0x2a4f10[_0xa432('0x39')]){_0x789eef['modernAuthentication']=_0x533ac6[_0xa432('0x39')]=!![];_0x789eef[_0xa432('0x3a')]=_0x533ac6[_0xa432('0x3a')]=_0x2a4f10[_0xa432('0x3a')];_0x789eef[_0xa432('0x37')]=_0x533ac6['pass']=null;}else{_0x789eef['CloudProviderId']=_0x533ac6[_0xa432('0x3a')]=null;}_0x789eef[_0xa432('0x3b')]=getImapHost(_0x4dc989);_0x789eef[_0xa432('0x3c')]=0x3e1;_0x533ac6[_0xa432('0x3b')]=getSmtpHost(_0x4dc989);_0x533ac6[_0xa432('0x3c')]=0x24b;_0x533ac6[_0xa432('0x3d')]=![];_0x789eef[_0xa432('0x3e')]=_0x533ac6['service']=null;}else{if(_0x2a4f10[_0xa432('0x3f')]){_0x789eef['user']=_0x533ac6[_0xa432('0x36')]=_0x2a4f10[_0xa432('0x40')];_0x789eef[_0xa432('0x37')]=_0x533ac6['pass']=_0x2a4f10[_0xa432('0x37')];}else{_0x789eef[_0xa432('0x3f')]=_0x533ac6[_0xa432('0x3f')]=![];_0x789eef[_0xa432('0x36')]=_0x533ac6['user']=null;_0x789eef[_0xa432('0x37')]=_0x533ac6[_0xa432('0x38')]=null;}_0x789eef[_0xa432('0x3b')]=_0x2a4f10[_0xa432('0x41')][_0xa432('0x3b')];_0x789eef[_0xa432('0x3c')]=_0x2a4f10[_0xa432('0x41')][_0xa432('0x3c')];_0x533ac6['host']=_0x2a4f10['Smtp'][_0xa432('0x3b')];_0x533ac6['port']=_0x2a4f10['Smtp'][_0xa432('0x3c')];}return{'Imap':_0x789eef,'Smtp':_0x533ac6};}exports[_0xa432('0x42')]=function(_0x1ed05b,_0x553383){var _0x559ddd={'include':[{'model':db[_0xa432('0x43')],'as':_0xa432('0x41')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xa432('0x44')],'as':'mandatoryDispositionPause'}]},_0x76876c={},_0x1b44db={'count':0x0,'rows':[]};var _0x2d4680=_[_0xa432('0x45')](db[_0xa432('0x46')]['rawAttributes'],function(_0x147ca6){return{'name':_0x147ca6[_0xa432('0x47')],'type':_0x147ca6[_0xa432('0x48')][_0xa432('0x49')]};});_0x76876c['model']=_[_0xa432('0x45')](_0x2d4680,_0xa432('0x27'));_0x76876c[_0xa432('0x4a')]=_[_0xa432('0x4b')](_0x1ed05b[_0xa432('0x4a')]);_0x76876c[_0xa432('0x4c')]=_[_0xa432('0x4d')](_0x76876c[_0xa432('0x4e')],_0x76876c['query']);_0x559ddd['attributes']=_['intersection'](_0x76876c[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x1ed05b[_0xa432('0x4a')]['fields']));_0x559ddd[_0xa432('0x50')]=_0x559ddd[_0xa432('0x50')][_0xa432('0x51')]?_0x559ddd['attributes']:_0x76876c[_0xa432('0x4e')];if(!_0x1ed05b[_0xa432('0x4a')]['hasOwnProperty']('nolimit')){_0x559ddd[_0xa432('0x1c')]=qs[_0xa432('0x1c')](_0x1ed05b[_0xa432('0x4a')][_0xa432('0x1c')]);_0x559ddd['offset']=qs[_0xa432('0x1a')](_0x1ed05b['query'][_0xa432('0x1a')]);}_0x559ddd[_0xa432('0x52')]=qs[_0xa432('0x53')](_0x1ed05b[_0xa432('0x4a')]['sort']);_0x559ddd['where']=qs[_0xa432('0x4c')](_['pick'](_0x1ed05b[_0xa432('0x4a')],_0x76876c[_0xa432('0x4c')]),_0x2d4680);if(_0x1ed05b[_0xa432('0x4a')]['filter']){_0x559ddd[_0xa432('0x54')]=_['merge'](_0x559ddd[_0xa432('0x54')],{'$or':_['map'](_0x2d4680,function(_0xf9bcba){if(_0xf9bcba['type']!==_0xa432('0x55')){var _0x16758d={};_0x16758d[_0xf9bcba[_0xa432('0x27')]]={'$like':'%'+_0x1ed05b[_0xa432('0x4a')][_0xa432('0x56')]+'%'};return _0x16758d;}})});}_0x559ddd=_[_0xa432('0x57')]({},_0x559ddd,_0x1ed05b[_0xa432('0x58')]);var _0x40924f={'where':_0x559ddd[_0xa432('0x54')]};return db[_0xa432('0x46')][_0xa432('0x1d')](_0x40924f)[_0xa432('0xe')](function(_0x571e2a){_0x1b44db['count']=_0x571e2a;if(_0x1ed05b['query']['includeAll']){_0x559ddd[_0xa432('0x59')]=[{'all':!![]}];}return db[_0xa432('0x46')][_0xa432('0x5a')](_0x559ddd);})[_0xa432('0xe')](function(_0xa5ae58){_0x1b44db[_0xa432('0x5b')]=_0xa5ae58;return _0x1b44db;})[_0xa432('0xe')](respondWithFilteredResult(_0x553383,_0x559ddd))[_0xa432('0x17')](handleError(_0x553383,null));};exports[_0xa432('0x5c')]=function(_0x443920,_0x194bbb){var _0x266655={'raw':![],'where':{'id':_0x443920[_0xa432('0x5d')]['id']},'include':[{'model':db[_0xa432('0x43')],'as':_0xa432('0x41')},{'model':db[_0xa432('0x5e')],'as':_0xa432('0x5f')},{'model':db[_0xa432('0x44')],'as':_0xa432('0x60')}]},_0x437a3b={};_0x437a3b[_0xa432('0x4e')]=_[_0xa432('0x4b')](db['MailAccount'][_0xa432('0x61')]);_0x437a3b[_0xa432('0x4a')]=_[_0xa432('0x4b')](_0x443920[_0xa432('0x4a')]);_0x437a3b['filters']=_['intersection'](_0x437a3b[_0xa432('0x4e')],_0x437a3b['query']);_0x266655[_0xa432('0x50')]=_['intersection'](_0x437a3b[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x443920[_0xa432('0x4a')][_0xa432('0x4f')]));_0x266655[_0xa432('0x50')]=_0x266655['attributes'][_0xa432('0x51')]?_0x266655[_0xa432('0x50')]:_0x437a3b[_0xa432('0x4e')];if(_0x443920[_0xa432('0x4a')][_0xa432('0x62')]){_0x266655[_0xa432('0x59')]=[{'all':!![]}];}_0x266655=_['merge']({},_0x266655,_0x443920[_0xa432('0x58')]);return db[_0xa432('0x46')]['find'](_0x266655)[_0xa432('0xe')](handleEntityNotFound(_0x194bbb,null))[_0xa432('0xe')](respondWithResult(_0x194bbb,null))[_0xa432('0x17')](handleError(_0x194bbb,null));};exports[_0xa432('0x20')]=function(_0x281142,_0x381399){if(_0x281142[_0xa432('0x63')]['id']){delete _0x281142['body']['id'];}var _0x25447a=_0x281142[_0xa432('0x63')][_0xa432('0x64')]==='custom'?null:_0x281142[_0xa432('0x63')]['provider'];var _0x20fcec=_0x281142['body'][_0xa432('0x41')]||{};var _0x5a0f42=_0x281142[_0xa432('0x63')]['Smtp']||{};if(_0x25447a){_0x20fcec['host']=getImapHost(_0x25447a);_0x20fcec['port']=0x3e1;_0x5a0f42[_0xa432('0x3b')]=getSmtpHost(_0x25447a);_0x5a0f42[_0xa432('0x3c')]=0x24b;_0x5a0f42[_0xa432('0x3d')]=![];}if(_0x5a0f42[_0xa432('0x39')]){_0x5a0f42['secure']=![];}else{_0x5a0f42['CloudProviderId']=null;}if(!_0x20fcec[_0xa432('0x39')])_0x20fcec['CloudProviderId']=null;_0x281142[_0xa432('0x63')][_0xa432('0x41')]=_0x20fcec;_0x281142[_0xa432('0x63')][_0xa432('0x5f')]=_0x5a0f42;return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x281142['params']['id']},'include':[{'model':db[_0xa432('0x43')],'as':'Imap'},{'model':db[_0xa432('0x5e')],'as':_0xa432('0x5f')},{'model':db[_0xa432('0x44')],'as':_0xa432('0x60')}]})['then'](handleEntityNotFound(_0x381399,null))['then'](function(_0x118a84){if(!_0x118a84)throw new Error(_0xa432('0x66'));if(_0x118a84['service'])delete _0x281142[_0xa432('0x63')][_0xa432('0x41')];return _0x118a84;})['then'](saveUpdates(_0x281142[_0xa432('0x63')],null))[_0xa432('0xe')](function(_0x50973b){if(!_0x281142[_0xa432('0x63')][_0xa432('0x41')])return _0x50973b;return db[_0xa432('0x43')][_0xa432('0x20')](_0x281142[_0xa432('0x63')][_0xa432('0x41')],{'where':{'MailAccountId':_0x50973b['id']}})[_0xa432('0xe')](function(){return _0x50973b;});})[_0xa432('0xe')](function(_0x12836d){if(!_0x281142['body']['Smtp'])return _0x12836d;return db[_0xa432('0x5e')][_0xa432('0x20')](_0x281142[_0xa432('0x63')][_0xa432('0x5f')],{'where':{'MailAccountId':_0x12836d['id']}})[_0xa432('0xe')](function(){return _0x12836d;});})['then'](respondWithResult(_0x381399,null))[_0xa432('0x17')](handleError(_0x381399,null));};exports['describe']=function(_0x41c862,_0x179f98){return db[_0xa432('0x46')][_0xa432('0x67')]()[_0xa432('0xe')](respondWithResult(_0x179f98,null))[_0xa432('0x17')](handleError(_0x179f98,null));};exports[_0xa432('0x68')]=function(_0x466dcb,_0x2985ff){if(_0x466dcb['body']['id']){delete _0x466dcb[_0xa432('0x63')]['id'];}return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x466dcb[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x2985ff,null))[_0xa432('0xe')](function(_0x1f18a5){if(_0x1f18a5){_0x466dcb[_0xa432('0x63')][_0xa432('0x69')]=_0x1f18a5['id'];return db[_0xa432('0x6a')][_0xa432('0x6b')](_0x466dcb[_0xa432('0x63')]);}})[_0xa432('0xe')](respondWithResult(_0x2985ff,null))['catch'](handleError(_0x2985ff,null));};exports[_0xa432('0x6c')]=function(_0x357a9d,_0x568d89){var _0x2d7a86={'raw':![],'where':{}};var _0x302263={};var _0x2e6a65={'count':0x0,'rows':[]};return db['MailAccount'][_0xa432('0x6d')]({'where':{'id':_0x357a9d[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x568d89,null))[_0xa432('0xe')](function(_0xd040ae){if(_0xd040ae){_0x302263['model']=_[_0xa432('0x4b')](db[_0xa432('0x6a')][_0xa432('0x61')]);_0x302263['query']=_['keys'](_0x357a9d[_0xa432('0x4a')]);_0x302263[_0xa432('0x4c')]=_['intersection'](_0x302263['model'],_0x302263['query']);_0x2d7a86[_0xa432('0x50')]=_[_0xa432('0x4d')](_0x302263[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x357a9d[_0xa432('0x4a')][_0xa432('0x4f')]));_0x2d7a86['attributes']=_0x2d7a86['attributes'][_0xa432('0x51')]?_0x2d7a86[_0xa432('0x50')]:_0x302263[_0xa432('0x4e')];if(!_0x357a9d[_0xa432('0x4a')]['hasOwnProperty'](_0xa432('0x6e'))){_0x2d7a86[_0xa432('0x1c')]=qs['limit'](_0x357a9d[_0xa432('0x4a')][_0xa432('0x1c')]);_0x2d7a86['offset']=qs[_0xa432('0x1a')](_0x357a9d[_0xa432('0x4a')]['offset']);}_0x2d7a86[_0xa432('0x52')]=qs[_0xa432('0x53')](_0x357a9d[_0xa432('0x4a')][_0xa432('0x53')]);_0x2d7a86[_0xa432('0x54')]=qs[_0xa432('0x4c')](_[_0xa432('0x6f')](_0x357a9d[_0xa432('0x4a')],_0x302263[_0xa432('0x4c')]));_0x2d7a86[_0xa432('0x54')][_0xa432('0x69')]=_0xd040ae['id'];if(_0x357a9d[_0xa432('0x4a')][_0xa432('0x56')]){_0x2d7a86[_0xa432('0x54')]=_['merge'](_0x2d7a86['where'],{'$or':_['map'](_0x2d7a86['attributes'],function(_0x181a84){var _0x45c1ba={};_0x45c1ba[_0x181a84]={'$like':'%'+_0x357a9d['query'][_0xa432('0x56')]+'%'};return _0x45c1ba;})});}_0x2d7a86=_['merge']({},_0x2d7a86,_0x357a9d[_0xa432('0x58')]);return db[_0xa432('0x6a')][_0xa432('0x1d')]({'where':_0x2d7a86[_0xa432('0x54')]})[_0xa432('0xe')](function(_0x6bc9e8){_0x2e6a65[_0xa432('0x1d')]=_0x6bc9e8;if(_0x357a9d[_0xa432('0x4a')]['includeAll']){_0x2d7a86['include']=[{'all':!![]}];}return db[_0xa432('0x6a')]['findAll'](_0x2d7a86);})[_0xa432('0xe')](function(_0x395160){_0x2e6a65[_0xa432('0x5b')]=_0x395160;return _0x2e6a65;});}})[_0xa432('0xe')](respondWithFilteredResult(_0x568d89,_0x2d7a86))[_0xa432('0x17')](handleError(_0x568d89,null));};exports[_0xa432('0x70')]=function(_0x21537d,_0x4f09ca){return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x21537d['params']['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x4f09ca,null))['then'](function(_0x49c176){if(_0x49c176){return _0x49c176[_0xa432('0x70')](_0x21537d['query']['ids']);}})['then'](respondWithStatusCode(_0x4f09ca,null))[_0xa432('0x17')](handleError(_0x4f09ca,null));};exports[_0xa432('0x71')]=function(_0x307e47,_0x2b4018){if(_0x307e47['body']['id']){delete _0x307e47[_0xa432('0x63')]['id'];}return db['MailAccount'][_0xa432('0x65')]({'where':{'id':_0x307e47[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x2b4018,null))[_0xa432('0xe')](function(_0x3a9c73){if(_0x3a9c73){_0x307e47[_0xa432('0x63')]['MailAccountId']=_0x3a9c73['id'];return db['CannedAnswer'][_0xa432('0x6b')](_0x307e47[_0xa432('0x63')]);}})[_0xa432('0xe')](respondWithResult(_0x2b4018,null))[_0xa432('0x17')](handleError(_0x2b4018,null));};exports[_0xa432('0x72')]=function(_0x51a27c,_0x487190){var _0x4988ff={'raw':![],'where':{}};var _0x39fe54={};var _0x331790={'count':0x0,'rows':[]};return db[_0xa432('0x46')][_0xa432('0x6d')]({'where':{'id':_0x51a27c[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x487190,null))[_0xa432('0xe')](function(_0x3ae03e){if(_0x3ae03e){_0x39fe54[_0xa432('0x4e')]=_['keys'](db[_0xa432('0x73')][_0xa432('0x61')]);_0x39fe54[_0xa432('0x4a')]=_[_0xa432('0x4b')](_0x51a27c[_0xa432('0x4a')]);_0x39fe54[_0xa432('0x4c')]=_['intersection'](_0x39fe54[_0xa432('0x4e')],_0x39fe54[_0xa432('0x4a')]);_0x4988ff[_0xa432('0x50')]=_[_0xa432('0x4d')](_0x39fe54['model'],qs['fields'](_0x51a27c[_0xa432('0x4a')][_0xa432('0x4f')]));_0x4988ff[_0xa432('0x50')]=_0x4988ff[_0xa432('0x50')][_0xa432('0x51')]?_0x4988ff['attributes']:_0x39fe54[_0xa432('0x4e')];if(!_0x51a27c[_0xa432('0x4a')][_0xa432('0x74')]('nolimit')){_0x4988ff[_0xa432('0x1c')]=qs['limit'](_0x51a27c[_0xa432('0x4a')][_0xa432('0x1c')]);_0x4988ff[_0xa432('0x1a')]=qs[_0xa432('0x1a')](_0x51a27c['query'][_0xa432('0x1a')]);}_0x4988ff[_0xa432('0x52')]=qs[_0xa432('0x53')](_0x51a27c[_0xa432('0x4a')][_0xa432('0x53')]);_0x4988ff[_0xa432('0x54')]=qs[_0xa432('0x4c')](_[_0xa432('0x6f')](_0x51a27c[_0xa432('0x4a')],_0x39fe54[_0xa432('0x4c')]));_0x4988ff[_0xa432('0x54')][_0xa432('0x69')]=_0x3ae03e['id'];if(_0x51a27c['query'][_0xa432('0x56')]){_0x4988ff[_0xa432('0x54')]=_[_0xa432('0x57')](_0x4988ff[_0xa432('0x54')],{'$or':_[_0xa432('0x45')](_0x4988ff[_0xa432('0x50')],function(_0x4d2dee){var _0x352174={};_0x352174[_0x4d2dee]={'$like':'%'+_0x51a27c[_0xa432('0x4a')][_0xa432('0x56')]+'%'};return _0x352174;})});}_0x4988ff=_[_0xa432('0x57')]({},_0x4988ff,_0x51a27c[_0xa432('0x58')]);return db[_0xa432('0x73')][_0xa432('0x1d')]({'where':_0x4988ff[_0xa432('0x54')]})[_0xa432('0xe')](function(_0x3633ca){_0x331790[_0xa432('0x1d')]=_0x3633ca;if(_0x51a27c[_0xa432('0x4a')][_0xa432('0x62')]){_0x4988ff[_0xa432('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa432('0x5a')](_0x4988ff);})[_0xa432('0xe')](function(_0x1341b1){_0x331790[_0xa432('0x5b')]=_0x1341b1;return _0x331790;});}})[_0xa432('0xe')](respondWithFilteredResult(_0x487190,_0x4988ff))[_0xa432('0x17')](handleError(_0x487190,null));};exports[_0xa432('0x75')]=function(_0x374d75,_0xcb22bc){return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x374d75['params']['id']}})[_0xa432('0xe')](handleEntityNotFound(_0xcb22bc,null))[_0xa432('0xe')](function(_0x4b1911){if(_0x4b1911){return _0x4b1911[_0xa432('0x75')](_0x374d75[_0xa432('0x4a')]['ids']);}})[_0xa432('0xe')](respondWithStatusCode(_0xcb22bc,null))[_0xa432('0x17')](handleError(_0xcb22bc,null));};exports[_0xa432('0x6b')]=function(_0x166f0e,_0x34a83d){var _0x558c01={'name':_0x166f0e[_0xa432('0x63')][_0xa432('0x27')],'key':_0x166f0e[_0xa432('0x63')][_0xa432('0x49')],'provider':_0x166f0e[_0xa432('0x63')][_0xa432('0x64')]===_0xa432('0x76')?null:_0x166f0e[_0xa432('0x63')][_0xa432('0x64')],'email':_0x166f0e[_0xa432('0x63')]['email'],'ListId':_0x166f0e[_0xa432('0x63')][_0xa432('0x77')],'active':!_[_0xa432('0x78')](_0x166f0e[_0xa432('0x63')][_0xa432('0x79')])?_0x166f0e[_0xa432('0x63')][_0xa432('0x79')]:!![],'description':_0x166f0e[_0xa432('0x63')][_0xa432('0x7a')]||null};var _0x2dcb4f=getAuthenticationOptions(_0x558c01[_0xa432('0x64')],_0x166f0e[_0xa432('0x63')]);_0x558c01[_0xa432('0x41')]=_0x2dcb4f[_0xa432('0x41')];_0x558c01['Smtp']=_0x2dcb4f[_0xa432('0x5f')];return db[_0xa432('0x46')][_0xa432('0x6b')](_0x558c01,{'include':[{'model':db[_0xa432('0x5e')],'as':_0xa432('0x5f')},{'model':db['MailServerIn'],'as':_0xa432('0x41')}]})['then'](function(_0x5a5249){var _0xee999a=_0x166f0e[_0xa432('0x36')][_0xa432('0x22')]({'plain':!![]});if(!_0xee999a)throw new Error(_0xa432('0x7b'));if(_0xee999a[_0xa432('0x7c')]===_0xa432('0x36')){var _0x421a87=_0x5a5249['get']({'plain':!![]});return db[_0xa432('0x7d')][_0xa432('0x65')]({'where':{'name':'MailAccounts','userProfileId':_0xee999a['userProfileId']},'raw':!![]})[_0xa432('0xe')](function(_0x2df20c){if(_0x2df20c&&_0x2df20c[_0xa432('0x7e')]===0x0){return db[_0xa432('0x24')]['create']({'name':_0x421a87[_0xa432('0x27')],'resourceId':_0x421a87['id'],'type':_0x2df20c['name'],'sectionId':_0x2df20c['id']},{})[_0xa432('0xe')](function(){return _0x5a5249;});}else{return _0x5a5249;}})[_0xa432('0x17')](function(_0x1ffb3b){logger[_0xa432('0x15')](_0xa432('0x7f'),_0x1ffb3b);throw _0x1ffb3b;});}return _0x5a5249;})[_0xa432('0xe')](respondWithResult(_0x34a83d,0xc9))[_0xa432('0x17')](handleError(_0x34a83d,null));};exports[_0xa432('0x80')]=function(_0x4ce041,_0x15c630){return db[_0xa432('0x46')]['findOne']({'where':{'id':_0x4ce041[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x15c630,null))[_0xa432('0xe')](function(_0x3fe5e4){if(_0x3fe5e4){return _0x3fe5e4[_0xa432('0x80')]();}return null;})[_0xa432('0xe')](respondWithResult(_0x15c630,null))['catch'](handleError(_0x15c630,null));};exports[_0xa432('0x81')]=function(_0x32cfb5,_0x2f870e){if(_0x32cfb5[_0xa432('0x63')]['id']){delete _0x32cfb5['body']['id'];}return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x32cfb5[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x2f870e,null))['then'](function(_0x198a59){if(_0x198a59){_0x32cfb5[_0xa432('0x63')][_0xa432('0x69')]=_0x198a59['id'];return db[_0xa432('0x43')]['create'](_0x32cfb5[_0xa432('0x63')]);}})[_0xa432('0xe')](respondWithResult(_0x2f870e,null))[_0xa432('0x17')](handleError(_0x2f870e,null));};exports[_0xa432('0x82')]=function(_0x6e8f99,_0xd8d3b1){return db[_0xa432('0x46')][_0xa432('0x6d')]({'where':{'id':_0x6e8f99[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0xd8d3b1,null))[_0xa432('0xe')](function(_0x2212b9){if(_0x2212b9){return _0x2212b9[_0xa432('0x83')](null);}return null;})[_0xa432('0xe')](respondWithStatusCode(_0xd8d3b1,null))['catch'](handleError(_0xd8d3b1,null));};exports[_0xa432('0x84')]=function(_0x2dbff,_0x34cca8){return db[_0xa432('0x46')][_0xa432('0x6d')]({'where':{'id':_0x2dbff['params']['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x34cca8,null))[_0xa432('0xe')](function(_0x2ce501){if(_0x2ce501){return _0x2ce501[_0xa432('0x84')]();}return null;})[_0xa432('0xe')](respondWithResult(_0x34cca8,null))[_0xa432('0x17')](handleError(_0x34cca8,null));};exports[_0xa432('0x85')]=function(_0x21c18c,_0xbc0360){if(_0x21c18c['body']['id']){delete _0x21c18c[_0xa432('0x63')]['id'];}return db['MailAccount'][_0xa432('0x65')]({'where':{'id':_0x21c18c[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0xbc0360,null))['then'](function(_0x556e0c){if(_0x556e0c){_0x21c18c['body'][_0xa432('0x69')]=_0x556e0c['id'];return db[_0xa432('0x5e')]['create'](_0x21c18c[_0xa432('0x63')]);}})[_0xa432('0xe')](respondWithResult(_0xbc0360,null))['catch'](handleError(_0xbc0360,null));};exports['removeSmtp']=function(_0x1d2a44,_0xe71824){return db[_0xa432('0x46')]['findOne']({'where':{'id':_0x1d2a44[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0xe71824,null))[_0xa432('0xe')](function(_0x5930ce){if(_0x5930ce){return _0x5930ce[_0xa432('0x86')](null);}return null;})[_0xa432('0xe')](respondWithStatusCode(_0xe71824,null))[_0xa432('0x17')](handleError(_0xe71824,null));};exports[_0xa432('0x87')]=function(_0x138c55,_0x3cbb5f){return db['MailInteraction'][_0xa432('0x65')]({'where':{'id':_0x138c55[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x3cbb5f,null))[_0xa432('0xe')](function(_0x339367){if(_0x339367){return _0x339367[_0xa432('0x87')](_0x138c55['body']['ids'],_[_0xa432('0x88')](_0x138c55['body'],[_0xa432('0x89'),'id'])||{});}})['then'](respondWithResult(_0x3cbb5f,null))['catch'](handleError(_0x3cbb5f,null));};exports['getInteractions']=function(_0x900ec6,_0x150e59){var _0x11a894={'raw':![],'where':{}};var _0x1e8ce5={};var _0x5481eb={'count':0x0,'rows':[]};return db[_0xa432('0x46')]['findOne']({'where':{'id':_0x900ec6[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x150e59,null))[_0xa432('0xe')](function(_0x48c783){if(_0x48c783){_0x1e8ce5['model']=_[_0xa432('0x4b')](db['MailInteraction'][_0xa432('0x61')]);_0x1e8ce5['query']=_[_0xa432('0x4b')](_0x900ec6[_0xa432('0x4a')]);_0x1e8ce5[_0xa432('0x4c')]=_[_0xa432('0x4d')](_0x1e8ce5[_0xa432('0x4e')],_0x1e8ce5[_0xa432('0x4a')]);_0x11a894[_0xa432('0x50')]=_[_0xa432('0x4d')](_0x1e8ce5[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x900ec6[_0xa432('0x4a')][_0xa432('0x4f')]));_0x11a894['attributes']=_0x11a894[_0xa432('0x50')]['length']?_0x11a894[_0xa432('0x50')]:_0x1e8ce5[_0xa432('0x4e')];if(!_0x900ec6[_0xa432('0x4a')][_0xa432('0x74')](_0xa432('0x6e'))){_0x11a894[_0xa432('0x1c')]=qs[_0xa432('0x1c')](_0x900ec6[_0xa432('0x4a')][_0xa432('0x1c')]);_0x11a894[_0xa432('0x1a')]=qs['offset'](_0x900ec6[_0xa432('0x4a')][_0xa432('0x1a')]);}_0x11a894[_0xa432('0x52')]=qs['sort'](_0x900ec6[_0xa432('0x4a')][_0xa432('0x53')]);_0x11a894[_0xa432('0x54')]=qs['filters'](_['pick'](_0x900ec6[_0xa432('0x4a')],_0x1e8ce5['filters']));_0x11a894['where']['MailAccountId']=_0x48c783['id'];if(_0x900ec6[_0xa432('0x4a')]['filter']){_0x11a894[_0xa432('0x54')]=_[_0xa432('0x57')](_0x11a894[_0xa432('0x54')],{'$or':_[_0xa432('0x45')](_0x11a894[_0xa432('0x50')],function(_0x3ad386){var _0x72e26d={};_0x72e26d[_0x3ad386]={'$like':'%'+_0x900ec6[_0xa432('0x4a')]['filter']+'%'};return _0x72e26d;})});}_0x11a894=_['merge']({},_0x11a894,_0x900ec6['options']);return db[_0xa432('0x8a')][_0xa432('0x1d')]({'where':_0x11a894[_0xa432('0x54')]})[_0xa432('0xe')](function(_0x46bd4e){_0x5481eb[_0xa432('0x1d')]=_0x46bd4e;if(_0x900ec6[_0xa432('0x4a')]['includeAll']){_0x11a894[_0xa432('0x59')]=[{'model':db[_0xa432('0x8b')],'as':'Contact','required':![]},{'model':db[_0xa432('0x8c')],'as':_0xa432('0x8d'),'attributes':[_0xa432('0x27'),'fullname','internal'],'required':![]},{'model':db[_0xa432('0x8e')],'as':_0xa432('0x8f'),'attributes':['id','name','color'],'where':_0x900ec6[_0xa432('0x4a')]['tag']?{'id':_0x900ec6[_0xa432('0x4a')][_0xa432('0x90')]}:undefined,'required':_0x900ec6[_0xa432('0x4a')][_0xa432('0x90')]?!![]:![]}];}return db[_0xa432('0x8a')][_0xa432('0x5a')](_0x11a894);})[_0xa432('0xe')](function(_0x4be26c){_0x5481eb['rows']=_0x4be26c;return _0x5481eb;});}})[_0xa432('0xe')](respondWithFilteredResult(_0x150e59,_0x11a894))[_0xa432('0x17')](handleError(_0x150e59,null));};exports[_0xa432('0x91')]=function addApplications(_0x3aad0d,_0x3766c6){var _0x16f502=_0x3aad0d['params']['id'];var _0x5c48c5=_0x3aad0d['body'];var _0xcb315a=0xc8;var _0x31dadb=null;return db[_0xa432('0x92')][_0xa432('0x93')]({'isolationLevel':db[_0xa432('0x92')][_0xa432('0x94')][_0xa432('0x95')]['READ_COMMITTED']},function(_0x3249b5){return db[_0xa432('0x46')][_0xa432('0x6d')]({'where':{'id':_0x16f502},'transaction':_0x3249b5})[_0xa432('0xe')](function(_0x52a128){if(_0x52a128){return db['MailApplication'][_0xa432('0x21')]({'where':{'MailAccountId':_0x16f502},'transaction':_0x3249b5})[_0xa432('0xe')](function(){var _0x52218c=_[_0xa432('0x45')](_0x5c48c5,function(_0x129da7){_0x129da7['MailAccountId']=_0x16f502;return _0x129da7;});return db['MailApplication'][_0xa432('0x96')](_0x52218c,{'transaction':_0x3249b5});});}else{_0xcb315a=0x194;_0x31dadb=[];}});})[_0xa432('0xe')](function(){if(_0xcb315a!==0x194){return db[_0xa432('0x97')]['findAndCountAll']({'where':{'MailAccountId':_0x16f502},'order':_0xa432('0x98')})[_0xa432('0xe')](function(_0x286806){_0x31dadb=_0x286806;});}})[_0xa432('0x17')](function(_0x1e13cc){_0xcb315a=0x1f4;logger['error'](_0x1e13cc[_0xa432('0x26')]);if(_0x1e13cc[_0xa432('0x27')]){delete _0x1e13cc['name'];}_0x31dadb=_0x1e13cc;})[_0xa432('0x99')](function(){if(_0x31dadb===null){_0x3766c6[_0xa432('0x25')](_0xcb315a);}else{if(_0xcb315a===0x1f4){_0x3766c6[_0xa432('0x18')](_0xcb315a)['send'](_0x31dadb);}else{_0x3766c6[_0xa432('0x18')](_0xcb315a)[_0xa432('0x19')](_0x31dadb);}}});};exports['getApplications']=function(_0x7c33c4,_0x289de8){var _0x3c1231={};var _0x122121={};var _0x5c29dc;var _0xda8041;return db['MailAccount'][_0xa432('0x6d')]({'where':{'id':_0x7c33c4[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x289de8,null))[_0xa432('0xe')](function(_0x1b1d22){if(_0x1b1d22){_0x5c29dc=_0x1b1d22;_0x122121['model']=_[_0xa432('0x4b')](db[_0xa432('0x97')][_0xa432('0x61')]);_0x122121[_0xa432('0x4a')]=_[_0xa432('0x4b')](_0x7c33c4[_0xa432('0x4a')]);_0x122121[_0xa432('0x4c')]=_['intersection'](_0x122121[_0xa432('0x4e')],_0x122121['query']);_0x3c1231[_0xa432('0x50')]=_[_0xa432('0x4d')](_0x122121[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x7c33c4['query'][_0xa432('0x4f')]));_0x3c1231[_0xa432('0x50')]=_0x3c1231['attributes'][_0xa432('0x51')]?_0x3c1231[_0xa432('0x50')]:_0x122121['model'];_0x3c1231[_0xa432('0x52')]=qs[_0xa432('0x53')](_0x7c33c4[_0xa432('0x4a')][_0xa432('0x53')]);_0x3c1231[_0xa432('0x54')]=qs[_0xa432('0x4c')](_[_0xa432('0x6f')](_0x7c33c4[_0xa432('0x4a')],_0x122121[_0xa432('0x4c')]));if(_0x7c33c4[_0xa432('0x4a')][_0xa432('0x56')]){_0x3c1231[_0xa432('0x54')]=_[_0xa432('0x57')](_0x3c1231[_0xa432('0x54')],{'$or':_['map'](_0x3c1231['attributes'],function(_0x933a3b){var _0x869492={};_0x869492[_0x933a3b]={'$like':'%'+_0x7c33c4['query'][_0xa432('0x56')]+'%'};return _0x869492;})});}_0x3c1231=_['merge']({},_0x3c1231,_0x7c33c4[_0xa432('0x58')]);return _0x5c29dc[_0xa432('0x9a')](_0x3c1231);}})[_0xa432('0xe')](function(_0x45d944){if(_0x45d944){_0xda8041=_0x45d944[_0xa432('0x51')];if(!_0x7c33c4['query']['hasOwnProperty'](_0xa432('0x6e'))){_0x3c1231[_0xa432('0x1c')]=qs[_0xa432('0x1c')](_0x7c33c4['query']['limit']);_0x3c1231['offset']=qs[_0xa432('0x1a')](_0x7c33c4[_0xa432('0x4a')][_0xa432('0x1a')]);}return _0x5c29dc[_0xa432('0x9a')](_0x3c1231);}})['then'](function(_0xd1a1d3){if(_0xd1a1d3){return _0xd1a1d3?{'count':_0xda8041,'rows':_0xd1a1d3}:null;}})[_0xa432('0xe')](respondWithResult(_0x289de8,null))[_0xa432('0x17')](handleError(_0x289de8,null));};exports[_0xa432('0x9b')]=function(_0x11a85d,_0x17da16){var _0x18651b={'raw':!![],'where':{}};var _0x2cc97b={};var _0x2757b8={'count':0x0,'rows':[]};return db[_0xa432('0x46')]['findOne']({'where':{'id':_0x11a85d[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x17da16,null))[_0xa432('0xe')](function(_0x5a6b8f){if(_0x5a6b8f){_0x2cc97b[_0xa432('0x4e')]=_['keys'](db[_0xa432('0x9c')]['rawAttributes']);_0x2cc97b[_0xa432('0x4a')]=_[_0xa432('0x4b')](_0x11a85d['query']);_0x2cc97b['filters']=_[_0xa432('0x4d')](_0x2cc97b[_0xa432('0x4e')],_0x2cc97b[_0xa432('0x4a')]);_0x18651b['attributes']=_['intersection'](_0x2cc97b[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x11a85d[_0xa432('0x4a')]['fields']));_0x18651b[_0xa432('0x50')]=_0x18651b[_0xa432('0x50')][_0xa432('0x51')]?_0x18651b[_0xa432('0x50')]:_0x2cc97b[_0xa432('0x4e')];if(!_0x11a85d[_0xa432('0x4a')][_0xa432('0x74')]('nolimit')){_0x18651b[_0xa432('0x1c')]=qs[_0xa432('0x1c')](_0x11a85d[_0xa432('0x4a')][_0xa432('0x1c')]);_0x18651b[_0xa432('0x1a')]=qs[_0xa432('0x1a')](_0x11a85d['query'][_0xa432('0x1a')]);}_0x18651b[_0xa432('0x52')]=qs[_0xa432('0x53')](_0x11a85d[_0xa432('0x4a')][_0xa432('0x53')]);_0x18651b[_0xa432('0x54')]=qs['filters'](_[_0xa432('0x6f')](_0x11a85d[_0xa432('0x4a')],_0x2cc97b['filters']));_0x18651b[_0xa432('0x54')][_0xa432('0x69')]=_0x5a6b8f['id'];if(_0x11a85d[_0xa432('0x4a')]['filter']){_0x18651b[_0xa432('0x54')]=_[_0xa432('0x57')](_0x18651b[_0xa432('0x54')],{'$or':_[_0xa432('0x45')](_0x18651b[_0xa432('0x50')],function(_0x3f70fc){var _0x17988f={};_0x17988f[_0x3f70fc]={'$like':'%'+_0x11a85d[_0xa432('0x4a')]['filter']+'%'};return _0x17988f;})});}if(_0x11a85d['query'][_0xa432('0x9d')]){var _0x3d2046=_0x11a85d['query'][_0xa432('0x9d')]['split'](',');var _0x3c292d={};_0x3c292d[_0x3d2046[0x0]]={'$gte':moment(_0x3d2046[0x1])[_0xa432('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x18651b[_0xa432('0x54')]=_[_0xa432('0x57')](_0x18651b[_0xa432('0x54')],_0x3c292d);}_0x18651b=_[_0xa432('0x57')]({},_0x18651b,_0x11a85d['options']);return db['MailMessage'][_0xa432('0x1d')]({'where':_0x18651b['where']})[_0xa432('0xe')](function(_0x35cf3a){_0x2757b8[_0xa432('0x1d')]=_0x35cf3a;if(_0x11a85d[_0xa432('0x4a')]['includeAll']){_0x18651b['include']=[{'all':!![]}];}return db[_0xa432('0x9c')][_0xa432('0x5a')](_0x18651b);})[_0xa432('0xe')](function(_0x1b3000){if(_0x11a85d[_0xa432('0x4a')][_0xa432('0x9f')]===_0xa432('0xa0')){for(var _0x44f0f1=0x0;_0x44f0f1<_0x1b3000[_0xa432('0x51')];_0x44f0f1++){_0x1b3000[_0x44f0f1][_0xa432('0x63')]=juice(_0x1b3000[_0x44f0f1][_0xa432('0x63')]);}}_0x2757b8['rows']=_0x1b3000;return _0x2757b8;});}})[_0xa432('0xe')](respondWithFilteredResult(_0x17da16,_0x18651b))[_0xa432('0x17')](handleError(_0x17da16,null));};exports[_0xa432('0x28')]=function(_0x2bbba1,_0x5a9124){var _0x2188a0,_0x169d6d={},_0x2a2e2f;if(_0x2bbba1[_0xa432('0x63')]['to']){_0x2a2e2f=_0x2bbba1[_0xa432('0x63')]['to'][_0xa432('0xa1')](',')[0x0];}return db[_0xa432('0x46')]['find']({'where':{'id':_0x2bbba1[_0xa432('0x5d')]['id']},'include':[{'model':db[_0xa432('0xa2')],'as':_0xa432('0xa3'),'include':[{'model':db[_0xa432('0x8b')],'as':_0xa432('0xa4'),'where':{'email':_0x2a2e2f},'limit':0x1,'order':[[_0xa432('0xa5'),_0xa432('0xa6')]]}]},{'model':db[_0xa432('0x5e')],'as':_0xa432('0x5f'),'raw':!![],'include':[{'model':db[_0xa432('0xa7')],'as':_0xa432('0xa7'),'raw':!![]}]}]})[_0xa432('0xe')](handleEntityNotFound(_0x5a9124,null))[_0xa432('0xe')](function(_0x156ed4){if(!_0x156ed4)return;_0x2188a0=_0x156ed4;if(!_0x156ed4[_0xa432('0x5f')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xa432('0x78')](_0x2bbba1[_0xa432('0x63')]['from'])){_0x2bbba1['body'][_0xa432('0xa8')]=util[_0xa432('0x9e')]('%s\x20<%s>',_0x156ed4[_0xa432('0x27')],_0x156ed4[_0xa432('0xa9')]||_0x156ed4['Smtp'][_0xa432('0x36')]);}if(_0x2bbba1[_0xa432('0x63')][_0xa432('0xaa')]&&_0x2bbba1[_0xa432('0x63')][_0xa432('0xaa')]['length']){for(var _0x335e39=0x0;_0x335e39<_0x2bbba1[_0xa432('0x63')][_0xa432('0xaa')][_0xa432('0x51')];_0x335e39+=0x1){_0x2bbba1['body'][_0xa432('0xaa')][_0x335e39]={'filename':_0x2bbba1[_0xa432('0x63')][_0xa432('0xaa')][_0x335e39][_0xa432('0x27')],'path':path[_0xa432('0xab')](config[_0xa432('0xac')],'server/files/attachments',_0x2bbba1[_0xa432('0x63')][_0xa432('0xaa')][_0x335e39]['basename'])};}}var _0x1d3976=_0x156ed4[_0xa432('0xad')]();return respondWithRpcPromise(_0xa432('0xae'),_0xa432('0xaf'),{'account':_0x1d3976,'message':_0x2bbba1[_0xa432('0x63')]});})[_0xa432('0xe')](function(_0x1da3e9){if(!_0x1da3e9)return;_0x169d6d=_0x1da3e9;if(!_0x2188a0[_0xa432('0xa3')])throw new Error(_0xa432('0xb0'));if(_0x2188a0[_0xa432('0xa3')]['Contacts']['length'])return _0x2188a0[_0xa432('0xa3')][_0xa432('0xa4')][0x0];return db['CmContact']['create'](_[_0xa432('0xb1')](_0x2bbba1[_0xa432('0x63')],{'firstName':_0x2bbba1['body']['to'],'email':_0x2bbba1[_0xa432('0x63')]['to'],'phone':_0x2bbba1['body']['to'],'ListId':_0x2188a0[_0xa432('0x77')]}));})[_0xa432('0xe')](function(_0x317576){if(!_0x317576)return;var _0x21769c={'UserId':_0x2bbba1[_0xa432('0x36')]['id'],'ContactId':_0x317576['id'],'MailAccountId':_0x2188a0['id'],'inReplyTo':_0x169d6d[_0xa432('0xb2')],'to':_0x2bbba1['body']['from'],'cc':_0x2bbba1[_0xa432('0x63')]['cc'],'subject':_0x2bbba1[_0xa432('0x63')]['subject'],'attach':_0x2bbba1['body']['attach'],'firstMsgDirection':_0xa432('0xb3'),'lastMsgAt':moment()['format'](_0xa432('0xb4')),'lastMsgDirection':_0xa432('0xb3'),'Messages':[_['merge'](_0x2bbba1[_0xa432('0x63')],{'messageId':_0x169d6d[_0xa432('0xb2')],'sentAt':moment()[_0xa432('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2188a0['id'],'UserId':_0x2bbba1[_0xa432('0x36')]['id'],'ContactId':_0x317576['id']})]};if(_0x2bbba1['body'][_0xa432('0xb5')]){_0x21769c=_['merge'](_0x21769c,_0x2bbba1[_0xa432('0x63')][_0xa432('0xb5')]);}return db[_0xa432('0x8a')][_0xa432('0x6b')](_0x21769c,{'include':[{'model':db['MailMessage'],'as':_0xa432('0xb6')}]});})[_0xa432('0xe')](respondWithResult(_0x5a9124,null))['catch'](handleError(_0x5a9124,null));};exports[_0xa432('0xb7')]=function(_0x1f7d69,_0x4b1ad1){return db['MailAccount'][_0xa432('0x65')]({'where':{'id':_0x1f7d69[_0xa432('0x5d')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xa432('0x5f'),'raw':!![],'include':[{'model':db[_0xa432('0xa7')],'as':_0xa432('0xa7'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4b1ad1,null))[_0xa432('0xe')](function(_0x130a6a){if(!_0x130a6a[_0xa432('0x5f')])return;var _0x56abe6=_0x130a6a[_0xa432('0xad')]();return respondWithRpcPromise(_0xa432('0xb8'),_0xa432('0xb7'),{'account':_0x56abe6});})[_0xa432('0xe')](respondWithResult(_0x4b1ad1,null))['catch'](handleError(_0x4b1ad1,null));};exports[_0xa432('0x21')]=function(_0x320533,_0x375080){return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x320533[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x375080,null))['then'](function(_0x27b7dd){if(_0x27b7dd&&_0x27b7dd[_0xa432('0x3e')]){throw new db[(_0xa432('0xb9'))]['ValidationError'](_0xa432('0xba'));}return _0x27b7dd;})[_0xa432('0xe')](removeEntity(_0x375080,null))[_0xa432('0x17')](handleError(_0x375080,null));};exports[_0xa432('0xbb')]=function(_0x3686af,_0x342230){return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x3686af[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x342230,null))['then'](function(_0xb4ce76){if(_0xb4ce76){return _0xb4ce76[_0xa432('0xbb')](_0x3686af[_0xa432('0x63')][_0xa432('0x89')],_[_0xa432('0x88')](_0x3686af['body'],[_0xa432('0x89'),'id'])||{})[_0xa432('0xbc')](function(_0x522424){for(var _0x12e619=0x0;_0x12e619<_0x3686af[_0xa432('0x63')][_0xa432('0x89')][_0xa432('0x51')];_0x12e619+=0x1){socket[_0xa432('0xbd')](_0xa432('0xbe'),{'UserId':Number(_0x3686af['body'][_0xa432('0x89')][_0x12e619]),'MailAccountId':Number(_0x3686af[_0xa432('0x5d')]['id'])});}return _0x522424;});}})[_0xa432('0xe')](respondWithResult(_0x342230,null))[_0xa432('0x17')](handleError(_0x342230,null));};exports[_0xa432('0xbf')]=function(_0x55c11f,_0x4abf36){return db['MailAccount'][_0xa432('0x65')]({'where':{'id':_0x55c11f[_0xa432('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4abf36,null))['then'](function(_0x10148c){if(_0x10148c){return _0x10148c[_0xa432('0xbf')](_0x55c11f[_0xa432('0x4a')][_0xa432('0x89')])['then'](function(){if(_[_0xa432('0xc0')](_0x55c11f['query'][_0xa432('0x89')])){for(var _0x4980d4=0x0;_0x4980d4<_0x55c11f[_0xa432('0x4a')][_0xa432('0x89')][_0xa432('0x51')];_0x4980d4+=0x1){socket['emit'](_0xa432('0xc1'),{'UserId':Number(_0x55c11f[_0xa432('0x4a')][_0xa432('0x89')][_0x4980d4]),'MailAccountId':Number(_0x55c11f[_0xa432('0x5d')]['id'])});}}else{socket['emit'](_0xa432('0xc1'),{'UserId':Number(_0x55c11f[_0xa432('0x4a')][_0xa432('0x89')]),'MailAccountId':Number(_0x55c11f[_0xa432('0x5d')]['id'])});}});}})[_0xa432('0xe')](respondWithStatusCode(_0x4abf36,null))[_0xa432('0x17')](handleError(_0x4abf36,null));};exports[_0xa432('0xc2')]=function(_0xc04acb,_0x2ac657){var _0x3c4815={};var _0xc98608={};var _0x299d01;var _0x491d8f;return db[_0xa432('0x46')][_0xa432('0x6d')]({'where':{'id':_0xc04acb[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x2ac657,null))[_0xa432('0xe')](function(_0x4f0f18){if(_0x4f0f18){_0x299d01=_0x4f0f18;_0xc98608['model']=_['keys'](db['User'][_0xa432('0x61')]);_0xc98608['query']=_['keys'](_0xc04acb[_0xa432('0x4a')]);_0xc98608[_0xa432('0x4c')]=_[_0xa432('0x4d')](_0xc98608[_0xa432('0x4e')],_0xc98608[_0xa432('0x4a')]);_0x3c4815['attributes']=_[_0xa432('0x4d')](_0xc98608['model'],qs['fields'](_0xc04acb[_0xa432('0x4a')]['fields']));_0x3c4815['attributes']=_0x3c4815[_0xa432('0x50')]['length']?_0x3c4815[_0xa432('0x50')]:_0xc98608[_0xa432('0x4e')];_0x3c4815[_0xa432('0x52')]=qs['sort'](_0xc04acb[_0xa432('0x4a')][_0xa432('0x53')]);_0x3c4815[_0xa432('0x54')]=qs[_0xa432('0x4c')](_['pick'](_0xc04acb[_0xa432('0x4a')],_0xc98608[_0xa432('0x4c')]));if(_0xc04acb[_0xa432('0x4a')][_0xa432('0x56')]){_0x3c4815[_0xa432('0x54')]=_['merge'](_0x3c4815['where'],{'$or':_['map'](_0x3c4815[_0xa432('0x50')],function(_0x37ffea){var _0x140843={};_0x140843[_0x37ffea]={'$like':'%'+_0xc04acb[_0xa432('0x4a')][_0xa432('0x56')]+'%'};return _0x140843;})});}_0x3c4815=_[_0xa432('0x57')]({},_0x3c4815,_0xc04acb[_0xa432('0x58')]);return _0x299d01['getAgents'](_0x3c4815);}})[_0xa432('0xe')](function(_0x5ebeb6){if(_0x5ebeb6){_0x491d8f=_0x5ebeb6['length'];if(!_0xc04acb[_0xa432('0x4a')][_0xa432('0x74')](_0xa432('0x6e'))){_0x3c4815[_0xa432('0x1c')]=qs['limit'](_0xc04acb[_0xa432('0x4a')][_0xa432('0x1c')]);_0x3c4815[_0xa432('0x1a')]=qs[_0xa432('0x1a')](_0xc04acb[_0xa432('0x4a')][_0xa432('0x1a')]);}return _0x299d01['getAgents'](_0x3c4815);}})[_0xa432('0xe')](function(_0x5527e5){if(_0x5527e5){return _0x5527e5?{'count':_0x491d8f,'rows':_0x5527e5}:null;}})['then'](respondWithResult(_0x2ac657,null))[_0xa432('0x17')](handleError(_0x2ac657,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index f15dab1..1398093 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 _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 +var _0xf7f7=['hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners','remove','emit'];(function(_0x11a62d,_0x5c35eb){var _0x1f320e=function(_0x1cc7b3){while(--_0x1cc7b3){_0x11a62d['push'](_0x11a62d['shift']());}};_0x1f320e(++_0x5c35eb);}(_0xf7f7,0x192));var _0x7f7f=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xf7f7[_0x9cd4c3];return _0x4c9025;};'use strict';var EventEmitter=require(_0x7f7f('0x0'));var MailAccount=require(_0x7f7f('0x1'))['db'][_0x7f7f('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7f7f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7f7f('0x4')};function emitEvent(_0x309eac){return function(_0x5cc4bf,_0x452c5f,_0x5d01b9){MailAccountEvents[_0x7f7f('0x5')](_0x309eac+':'+_0x5cc4bf['id'],_0x5cc4bf);MailAccountEvents[_0x7f7f('0x5')](_0x309eac,_0x5cc4bf);_0x5d01b9(null);};}for(var e in events){if(events[_0x7f7f('0x6')](e)){var event=events[e];MailAccount[_0x7f7f('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 92778ef..fd52833 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 _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 +var _0x5573=['secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','CloudProvider','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','service','provider','host','port','Smtp'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0x5573,0xa1));var _0x3557=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x5573[_0x580b15];return _0x1adb1b;};'use strict';var attributes=require(_0x3557('0x0'));module[_0x3557('0x1')]=function(_0x4ace85){return _0x4ace85['define'](_0x3557('0x2'),attributes,{'tableName':_0x3557('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1e1f9b=this;var _0x513660={'id':_0x1e1f9b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1e1f9b['provider']!=='custom'){_0x513660[_0x3557('0x4')]=_0x1e1f9b[_0x3557('0x5')];}else{_0x513660[_0x3557('0x6')]=_0x1e1f9b['Smtp'][_0x3557('0x6')];_0x513660[_0x3557('0x7')]=_0x1e1f9b[_0x3557('0x8')][_0x3557('0x7')];_0x513660[_0x3557('0x9')]=_0x1e1f9b[_0x3557('0x8')][_0x3557('0x9')];}if(_0x1e1f9b[_0x3557('0x8')][_0x3557('0xa')]){if(_0x1e1f9b[_0x3557('0x8')][_0x3557('0xb')]){if(!_0x1e1f9b[_0x3557('0x8')]['CloudProvider'])throw new Error(_0x3557('0xc'));_0x513660[_0x3557('0xd')]={'type':_0x3557('0xe'),'user':_0x1e1f9b['Smtp']['user'],'accessToken':_0x1e1f9b[_0x3557('0x8')][_0x3557('0xf')]['data5']};}else{_0x513660[_0x3557('0xd')]={'user':_0x1e1f9b[_0x3557('0x8')]['user'],'pass':_0x1e1f9b['Smtp'][_0x3557('0x10')]};}}return _0x513660;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 267138a..4a3b1e3 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 _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 +var _0x31f0=['map','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','CloudProvider','orderBy','applications','asc','autoclose','push','length','close','*,*,*,*','defaults','ListId','create','List\x20not\x20found','contact','messageId','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','update','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','attachments','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','MailQueue','queueId','unshift','queue','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','include'];(function(_0x27d106,_0x1226fb){var _0x3f10c7=function(_0x129b68){while(--_0x129b68){_0x27d106['push'](_0x27d106['shift']());}};_0x3f10c7(++_0x1226fb);}(_0x31f0,0xb7));var _0x031f=function(_0x34cb2f,_0x4744fe){_0x34cb2f=_0x34cb2f-0x0;var _0x5b84c5=_0x31f0[_0x34cb2f];return _0x5b84c5;};'use strict';var _=require(_0x031f('0x0'));var moment=require('moment');var BPromise=require(_0x031f('0x1'));var rs=require('randomstring');var Redis=require(_0x031f('0x2'));var db=require(_0x031f('0x3'))['db'];var logger=require(_0x031f('0x4'))(_0x031f('0x5'));var config=require('../../config/environment');var jayson=require(_0x031f('0x6'));var client=jayson[_0x031f('0x7')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x031f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x031f('0x9'))(new Redis(config[_0x031f('0x8')]));require(_0x031f('0xa'))[_0x031f('0xb')](socket);function respondWithRpcPromise(_0x4d47c5,_0x2e5624,_0x24145f){return new BPromise(function(_0x327f11,_0x439940){return client[_0x031f('0xc')](_0x4d47c5,_0x24145f)[_0x031f('0xd')](function(_0x2202dc){logger[_0x031f('0xe')]('MailAccount,\x20%s,\x20%s',_0x2e5624,_0x031f('0xf'));logger[_0x031f('0x10')](_0x031f('0x11'),_0x2e5624,_0x031f('0xf'),JSON[_0x031f('0x12')](_0x2202dc));if(_0x2202dc[_0x031f('0x13')]){if(_0x2202dc[_0x031f('0x13')]['code']===0x1f4){logger[_0x031f('0x13')](_0x031f('0x14'),_0x2e5624,_0x2202dc[_0x031f('0x13')][_0x031f('0x15')]);return _0x439940(_0x2202dc[_0x031f('0x13')]['message']);}logger['error'](_0x031f('0x14'),_0x2e5624,_0x2202dc[_0x031f('0x13')][_0x031f('0x15')]);return _0x327f11(_0x2202dc[_0x031f('0x13')]['message']);}else{logger[_0x031f('0xe')](_0x031f('0x14'),_0x2e5624,'request\x20sent');_0x327f11(_0x2202dc[_0x031f('0x16')]['message']);}})[_0x031f('0x17')](function(_0x5f2199){logger[_0x031f('0x13')](_0x031f('0x14'),_0x2e5624,_0x5f2199);_0x439940(_0x5f2199);});});}exports[_0x031f('0x18')]=function(_0x26cb5e){var _0x1b76d6=this;return new Promise(function(_0x2825ef,_0xf76f1b){return db[_0x031f('0x19')][_0x031f('0x1a')]({'raw':_0x26cb5e['options']?_0x26cb5e[_0x031f('0x1b')][_0x031f('0x1c')]===undefined?!![]:![]:!![],'where':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e['options']['where']||null:null,'attributes':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e['options'][_0x031f('0x1d')]||null:null,'limit':_0x26cb5e['options']?_0x26cb5e['options']['limit']||null:null,'include':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e[_0x031f('0x1b')][_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x26cb5e['options'][_0x031f('0x1e')],function(_0x5a64c0){return{'model':db[_0x5a64c0[_0x031f('0x20')]],'as':_0x5a64c0['as'],'attributes':_0x5a64c0[_0x031f('0x1d')],'include':_0x5a64c0[_0x031f('0x1e')]?_['map'](_0x5a64c0[_0x031f('0x1e')],function(_0x3b2a51){return{'model':db[_0x3b2a51['model']],'as':_0x3b2a51['as'],'attributes':_0x3b2a51[_0x031f('0x1d')],'include':_0x3b2a51[_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x3b2a51['include'],function(_0xa308b){return{'model':db[_0xa308b[_0x031f('0x20')]],'as':_0xa308b['as'],'attributes':_0xa308b[_0x031f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x031f('0xd')](function(_0xfaa36){logger[_0x031f('0xe')]('GetMailAccount',_0x26cb5e);logger[_0x031f('0x10')](_0x031f('0x18'),_0x26cb5e,JSON[_0x031f('0x12')](_0xfaa36));_0x2825ef(_0xfaa36);})[_0x031f('0x17')](function(_0x428ec4){logger[_0x031f('0x13')](_0x031f('0x18'),_0x428ec4[_0x031f('0x15')],_0x26cb5e);_0xf76f1b(_0x1b76d6[_0x031f('0x13')](0x1f4,_0x428ec4[_0x031f('0x15')]));});});};exports[_0x031f('0x21')]=function(_0x5ec564){var _0xced6ff=this;return new Promise(function(_0xe5f11c,_0xb3a6bd){return db[_0x031f('0x19')][_0x031f('0x22')]({'raw':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')][_0x031f('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')][_0x031f('0x23')]||null:null,'attributes':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')]['attributes']||null:null,'include':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')]['include']?_[_0x031f('0x1f')](_0x5ec564[_0x031f('0x1b')]['include'],function(_0x17b93c){return{'model':db[_0x17b93c[_0x031f('0x20')]],'as':_0x17b93c['as'],'attributes':_0x17b93c[_0x031f('0x1d')],'include':_0x17b93c[_0x031f('0x1e')]?_['map'](_0x17b93c['include'],function(_0x36ab13){return{'model':db[_0x36ab13['model']],'as':_0x36ab13['as'],'attributes':_0x36ab13[_0x031f('0x1d')],'include':_0x36ab13[_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x36ab13['include'],function(_0x5c33c5){return{'model':db[_0x5c33c5[_0x031f('0x20')]],'as':_0x5c33c5['as'],'attributes':_0x5c33c5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d489a){if(_0x5ec564[_0x031f('0x1b')][_0x031f('0x24')]===!![])_0x2d489a[_0x031f('0x25')](_0x031f('0x26'),_0x2d489a[_0x031f('0x27')]());logger[_0x031f('0xe')]('ShowMailAccount',_0x5ec564);logger[_0x031f('0x10')](_0x031f('0x21'),_0x5ec564,JSON[_0x031f('0x12')](_0x2d489a));_0xe5f11c(_0x2d489a);})[_0x031f('0x17')](function(_0x58daa2){logger[_0x031f('0x13')](_0x031f('0x21'),_0x58daa2[_0x031f('0x15')],_0x5ec564);_0xb3a6bd(_0xced6ff['error'](0x1f4,_0x58daa2[_0x031f('0x15')]));});});};exports[_0x031f('0x28')]=function(_0x5d6826){var _0x36bafa=this;return new Promise(function(_0x268dc7,_0x56a8f3){var _0x4c50b2={'body':_0x5d6826[_0x031f('0x29')],'channel':_0x031f('0x2a')};var _0x9efbc4=_[_0x031f('0x2b')](_[_0x031f('0x2c')](db[_0x031f('0x2d')][_0x031f('0x2e')]),['createdAt',_0x031f('0x2f'),_0x031f('0x30'),'ListId']);var _0x12279a=![];if(_0x5d6826['body']['id']){delete _0x5d6826[_0x031f('0x29')]['id'];}if(_[_0x031f('0x31')](_0x5d6826['body'][_0x031f('0x32')])){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x33')));}if(_['isNil'](_0x5d6826[_0x031f('0x29')][_0x031f('0x29')])||_0x5d6826[_0x031f('0x29')][_0x031f('0x29')]===''){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x34')));}if(_[_0x031f('0x31')](_0x5d6826[_0x031f('0x29')][_0x031f('0x35')])){return _0x56a8f3(_0x36bafa['error'](0x1f4,_0x031f('0x36')+_0x9efbc4));}if(!_[_0x031f('0x37')](_0x9efbc4,_0x5d6826[_0x031f('0x29')][_0x031f('0x35')])){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x38')+_0x9efbc4));}var _0x2111c5={};_0x2111c5[_0x5d6826[_0x031f('0x29')][_0x031f('0x35')]]=_0x5d6826['body'][_0x031f('0x32')];return db['MailAccount']['find']({'where':{'id':_0x5d6826[_0x031f('0x39')]['id']},'include':[{'model':db[_0x031f('0x3a')],'as':_0x031f('0x3b'),'include':[{'model':db[_0x031f('0x2d')],'as':_0x031f('0x3c'),'where':_0x2111c5,'limit':0x1,'order':[['updatedAt',_0x031f('0x3d')]]}]},{'model':db[_0x031f('0x3e')],'as':_0x031f('0x3f')},{'model':db['MailServerOut'],'as':_0x031f('0x40'),'include':[{'model':db[_0x031f('0x41')],'as':_0x031f('0x41')}]}]})[_0x031f('0xd')](function(_0x2c93ea){if(_0x2c93ea&&_0x2c93ea[_0x031f('0x3b')]){var _0x5caeb5=_0x2c93ea['get']({'plain':!![]});_0x4c50b2[_0x031f('0x39')]=_['omit'](_0x5caeb5,[_0x031f('0x3f'),_0x031f('0x3b')]);_0x4c50b2['account'][_0x031f('0x26')]=_0x2c93ea['getSmtpOptions']();_0x4c50b2['applications']=_0x5caeb5[_0x031f('0x3f')];_0x4c50b2['list']=_0x5caeb5[_0x031f('0x3b')];_0x4c50b2['applications']=_[_0x031f('0x42')](_0x4c50b2[_0x031f('0x43')],['priority'],[_0x031f('0x44')]);if(_0x4c50b2[_0x031f('0x39')]&&_0x4c50b2['account'][_0x031f('0x45')]){_0x4c50b2['applications'][_0x031f('0x46')]({'id':0x0,'priority':_0x4c50b2['applications'][_0x031f('0x47')]+0x1,'app':_0x031f('0x48'),'appdata':_0x031f('0x45'),'interval':_0x031f('0x49')});}if(_0x4c50b2[_0x031f('0x39')]['Applications']){delete _0x4c50b2[_0x031f('0x39')]['Applications'];}if(_0x4c50b2[_0x031f('0x39')][_0x031f('0x3b')]){delete _0x4c50b2['account'][_0x031f('0x3b')];}if(_0x5caeb5[_0x031f('0x3b')]['Contacts'][_0x031f('0x47')]){return _0x5caeb5[_0x031f('0x3b')][_0x031f('0x3c')][0x0];}var _0x55b9cf=_[_0x031f('0x4a')](_0x5d6826['body'],{'firstName':_0x5d6826[_0x031f('0x29')]['from'],'ListId':_0x5caeb5[_0x031f('0x4b')]});_0x55b9cf[_0x5d6826['body'][_0x031f('0x35')]]=_0x5d6826[_0x031f('0x29')]['from'];return db['CmContact'][_0x031f('0x4c')](_0x55b9cf);}else{throw new Error(_0x031f('0x4d'));}})['then'](function(_0x434c0f){_0x4c50b2[_0x031f('0x4e')]=_0x434c0f;if(_0x434c0f){if(!_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')]){_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')]=rs['generate']()+'\x20'+_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x32')];}var _0x5db3c7={'ContactId':_0x434c0f['id'],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id'],'inReplyTo':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x4f')],'to':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x32')],'cc':_0x5d6826['body']['message']['cc'],'subject':_0x5d6826['body']['message'][_0x031f('0x50')],'attach':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x51')],'lastMsgAt':moment()[_0x031f('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x031f('0x53')][_0x031f('0x22')]({'where':{'closed':![],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id']},'include':[{'model':db[_0x031f('0x54')],'as':_0x031f('0x55'),'attributes':[_0x031f('0x4f')],'where':{'messageId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x56')]}}]})['then'](function(_0x138e0d){if(_0x138e0d){return[_0x138e0d,![]];}return db['MailInteraction'][_0x031f('0x4c')](_0x5db3c7)[_0x031f('0xd')](function(_0x3d27d6){return[_0x3d27d6,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0xdb3d45,_0x46af33){if(_0xdb3d45){_0x12279a=_0x46af33;if(!_0x46af33){return _0xdb3d45[_0x031f('0x57')]({'inReplyTo':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x4f')],'to':_0x5d6826['body']['message'][_0x031f('0x32')],'cc':_0x5d6826['body']['message']['cc'],'subject':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x50')],'attach':_0xdb3d45[_0x031f('0x51')]?_0xdb3d45[_0x031f('0x51')]:_0x5d6826['body']['message'][_0x031f('0x51')],'substatus':null,'substatusAt':moment()['format'](_0x031f('0x58')),'lastMsgAt':moment()[_0x031f('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0xdb3d45;}}})[_0x031f('0xd')](function(_0xee136c){_0x4c50b2[_0x031f('0x59')]=_0xee136c[_0x031f('0x5a')]({'plain':!![]});_0x4c50b2[_0x031f('0x59')][_0x031f('0x5b')]=_0x12279a;return db['MailMessage']['create']({'body':_0x5d6826[_0x031f('0x29')][_0x031f('0x29')],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id'],'MailInteractionId':_0xee136c['id'],'direction':'in','ContactId':_0x4c50b2[_0x031f('0x4e')]['id'],'messageId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')],'from':_0x5d6826['body']['message']['from'],'to':_0x5d6826['body'][_0x031f('0x15')]['to'],'cc':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['cc'],'subject':_0x5d6826['body'][_0x031f('0x15')][_0x031f('0x50')],'attach':_0x5d6826['body'][_0x031f('0x15')][_0x031f('0x51')],'Attachments':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x5c')],'originTo':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['originTo'],'originCc':_0x5d6826['body'][_0x031f('0x15')]['originCc'],'bcc':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x5d')],'ChatWebsiteId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['ChatWebsiteId']||null,'originChannel':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x5e')]||_0x031f('0x5f'),'ChatOfflineMessageId':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x60')]||null},{'include':[{'model':db[_0x031f('0x61')],'as':_0x031f('0x62')}]});})[_0x031f('0xd')](function(_0x45330f){_0x4c50b2['message']=_0x45330f;if(!_0x4c50b2['interaction'][_0x031f('0x63')]){return;}return db[_0x031f('0x64')]['find']({'attributes':['id',_0x031f('0x65')],'where':{'id':_0x4c50b2['interaction'][_0x031f('0x63')]}});})[_0x031f('0xd')](function(_0x142310){if(_0x142310){_0x4c50b2[_0x031f('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x031f('0x66'),'appdata':_0x142310[_0x031f('0x65')]+','+(_0x4c50b2[_0x031f('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0x031f('0x49')});}if(!_0x4c50b2[_0x031f('0x59')]['queueId']){return;}return db[_0x031f('0x67')][_0x031f('0x22')]({'attributes':['id',_0x031f('0x65')],'where':{'id':_0x4c50b2[_0x031f('0x59')][_0x031f('0x68')]}});})[_0x031f('0xd')](function(_0x3f3582){if(_0x3f3582){_0x4c50b2['applications'][_0x031f('0x69')]({'id':0x0,'priority':0x1,'app':_0x031f('0x6a'),'appdata':_0x3f3582[_0x031f('0x65')]+','+(_0x4c50b2['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x031f('0x49')});}return respondWithRpcPromise('Start','startRouting',_0x4c50b2);})[_0x031f('0xd')](function(_0x184bbd){_0x268dc7(_0x184bbd);})[_0x031f('0x17')](function(_0x1d6aca){_0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x1d6aca[_0x031f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 72971c6..82f3e97 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 _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 +var _0x243b=['emit','removeListener','register','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0x243b,0x9c));var _0xb243=function(_0x2bfc93,_0x7cdb79){_0x2bfc93=_0x2bfc93-0x0;var _0x22ae6c=_0x243b[_0x2bfc93];return _0x22ae6c;};'use strict';var MailAccountEvents=require(_0xb243('0x0'));var events=[_0xb243('0x1'),_0xb243('0x2'),_0xb243('0x3')];function createListener(_0xc389c1,_0x38e1cd){return function(_0x48ceca){_0x38e1cd[_0xb243('0x4')](_0xc389c1,_0x48ceca);};}function removeListener(_0x53d2e2,_0x42e226){return function(){MailAccountEvents[_0xb243('0x5')](_0x53d2e2,_0x42e226);};}exports[_0xb243('0x6')]=function(_0x1e9d7d){for(var _0x121054=0x0,_0x8c8cc=events['length'];_0x121054<_0x8c8cc;_0x121054++){var _0x3e794c=events[_0x121054];var _0x4b196c=createListener(_0xb243('0x7')+_0x3e794c,_0x1e9d7d);MailAccountEvents['on'](_0x3e794c,_0x4b196c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5db3b7b..9ff24dc 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 _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 +var _0xb478=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','delete','exports'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0xb478,0x96));var _0x8b47=function(_0x33c797,_0x430c30){_0x33c797=_0x33c797-0x0;var _0x514ff7=_0xb478[_0x33c797];return _0x514ff7;};'use strict';var multer=require(_0x8b47('0x0'));var util=require(_0x8b47('0x1'));var path=require(_0x8b47('0x2'));var timeout=require(_0x8b47('0x3'));var express=require('express');var router=express[_0x8b47('0x4')]();var fs_extra=require(_0x8b47('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b47('0x6'));var config=require(_0x8b47('0x7'));var controller=require('./mailApplication.controller');router[_0x8b47('0x8')](_0x8b47('0x9'),auth[_0x8b47('0xa')](),controller[_0x8b47('0xb')]);router[_0x8b47('0xc')](_0x8b47('0x9'),auth[_0x8b47('0xa')](),controller['update']);router[_0x8b47('0xd')]('/:id',auth[_0x8b47('0xa')](),controller['destroy']);module[_0x8b47('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 28c0c2c..0870228 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 _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 +var _0xef7a=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0xef7a,0x1dc));var _0xaef7=function(_0x593885,_0x2bda25){_0x593885=_0x593885-0x0;var _0x547ee0=_0xef7a[_0x593885];return _0x547ee0;};'use strict';var Sequelize=require(_0xaef7('0x0'));module[_0xaef7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xaef7('0x2')],'allowNull':![],'defaultValue':_0xaef7('0x3')},'appdata':{'type':Sequelize[_0xaef7('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xaef7('0x2')],'defaultValue':_0xaef7('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 0a793b8..aaa2e18 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 _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 +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x464e1f,_0x2aa86f){var _0x1c1ce2=function(_0x543c79){while(--_0x543c79){_0x464e1f['push'](_0x464e1f['shift']());}};_0x1c1ce2(++_0x2aa86f);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 42ffc6d..9a4f89d 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 _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 +var _0x7f95=['./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x1a8a79,_0x57182d){var _0x436f4c=function(_0x4cc5c2){while(--_0x4cc5c2){_0x1a8a79['push'](_0x1a8a79['shift']());}};_0x436f4c(++_0x57182d);}(_0x7f95,0x1d5));var _0x57f9=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x7f95[_0x279d37];return _0x530173;};'use strict';var _=require(_0x57f9('0x0'));var util=require(_0x57f9('0x1'));var logger=require(_0x57f9('0x2'))(_0x57f9('0x3'));var moment=require('moment');var BPromise=require(_0x57f9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x57f9('0x5'));var config=require(_0x57f9('0x6'));var attributes=require(_0x57f9('0x7'));module[_0x57f9('0x8')]=function(_0x211975,_0x5ddc23){return _0x211975[_0x57f9('0x9')](_0x57f9('0xa'),attributes,{'tableName':_0x57f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x57f9('0xc'),'collate':_0x57f9('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 2219a0e..acf05c4 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 _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 +var _0xa2cf=['MailApplication,\x20%s,\x20%s','message','info','MailApplication','update','body','options','where','attributes','limit','debug','UpdateMailApplication','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code'];(function(_0x473046,_0x32fb02){var _0x31d10e=function(_0x178ea4){while(--_0x178ea4){_0x473046['push'](_0x473046['shift']());}};_0x31d10e(++_0x32fb02);}(_0xa2cf,0xbb));var _0xfa2c=function(_0x9bd1ca,_0x1060a0){_0x9bd1ca=_0x9bd1ca-0x0;var _0x198bbd=_0xa2cf[_0x9bd1ca];return _0x198bbd;};'use strict';var _=require('lodash');var util=require(_0xfa2c('0x0'));var moment=require(_0xfa2c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa2c('0x2'))['db'];var utils=require(_0xfa2c('0x3'));var logger=require(_0xfa2c('0x4'))(_0xfa2c('0x5'));var config=require(_0xfa2c('0x6'));var jayson=require(_0xfa2c('0x7'));var client=jayson[_0xfa2c('0x8')][_0xfa2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24433f,_0x195ea0,_0x33a030){return new BPromise(function(_0x1dd06e,_0xfb1dcb){return client[_0xfa2c('0xa')](_0x24433f,_0x33a030)[_0xfa2c('0xb')](function(_0x4491db){logger['info']('MailApplication,\x20%s,\x20%s',_0x195ea0,_0xfa2c('0xc'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x195ea0,_0xfa2c('0xc'),JSON[_0xfa2c('0xd')](_0x4491db));if(_0x4491db[_0xfa2c('0xe')]){if(_0x4491db[_0xfa2c('0xe')][_0xfa2c('0xf')]===0x1f4){logger[_0xfa2c('0xe')](_0xfa2c('0x10'),_0x195ea0,_0x4491db[_0xfa2c('0xe')][_0xfa2c('0x11')]);return _0xfb1dcb(_0x4491db['error'][_0xfa2c('0x11')]);}logger[_0xfa2c('0xe')](_0xfa2c('0x10'),_0x195ea0,_0x4491db[_0xfa2c('0xe')][_0xfa2c('0x11')]);return _0x1dd06e(_0x4491db['error'][_0xfa2c('0x11')]);}else{logger[_0xfa2c('0x12')](_0xfa2c('0x10'),_0x195ea0,_0xfa2c('0xc'));_0x1dd06e(_0x4491db['result'][_0xfa2c('0x11')]);}})['catch'](function(_0x30d205){logger[_0xfa2c('0xe')](_0xfa2c('0x10'),_0x195ea0,_0x30d205);_0xfb1dcb(_0x30d205);});});}exports['UpdateMailApplication']=function(_0x1d692d){var _0x439602=this;return new Promise(function(_0x43b7df,_0xa74140){return db[_0xfa2c('0x13')][_0xfa2c('0x14')](_0x1d692d[_0xfa2c('0x15')],{'raw':_0x1d692d[_0xfa2c('0x16')]?_0x1d692d[_0xfa2c('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d692d[_0xfa2c('0x16')]?_0x1d692d[_0xfa2c('0x16')][_0xfa2c('0x17')]||null:null,'attributes':_0x1d692d['options']?_0x1d692d['options'][_0xfa2c('0x18')]||null:null,'limit':_0x1d692d[_0xfa2c('0x16')]?_0x1d692d[_0xfa2c('0x16')][_0xfa2c('0x19')]||null:null})[_0xfa2c('0xb')](function(_0x513ef2){logger[_0xfa2c('0x12')]('UpdateMailApplication',_0x1d692d);logger[_0xfa2c('0x1a')](_0xfa2c('0x1b'),_0x1d692d,JSON[_0xfa2c('0xd')](_0x513ef2));_0x43b7df(_0x513ef2);})[_0xfa2c('0x1c')](function(_0x46ff6b){logger[_0xfa2c('0xe')](_0xfa2c('0x1b'),_0x46ff6b[_0xfa2c('0x11')],_0x1d692d);_0xa74140(_0x439602[_0xfa2c('0xe')](0x1f4,_0x46ff6b[_0xfa2c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index bb4eb97..3464df8 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 _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 +var _0x0c28=['update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','describe','/:id','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x0c28,0x17a));var _0x80c2=function(_0x5f2156,_0xb141e2){_0x5f2156=_0x5f2156-0x0;var _0x315d72=_0x0c28[_0x5f2156];return _0x315d72;};'use strict';var express=require(_0x80c2('0x0'));var router=express[_0x80c2('0x1')]();var auth=require(_0x80c2('0x2'));var interaction=require(_0x80c2('0x3'));var controller=require(_0x80c2('0x4'));router[_0x80c2('0x5')]('/',auth['isAuthenticated'](),controller[_0x80c2('0x6')]);router[_0x80c2('0x5')](_0x80c2('0x7'),auth['isAuthenticated'](),controller[_0x80c2('0x8')]);router['get'](_0x80c2('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x80c2('0xa'),auth[_0x80c2('0xb')](),controller[_0x80c2('0xc')]);router[_0x80c2('0x5')](_0x80c2('0xd'),auth[_0x80c2('0xb')](),controller[_0x80c2('0xe')]);router[_0x80c2('0xf')]('/',auth[_0x80c2('0xb')](),controller[_0x80c2('0x10')]);router[_0x80c2('0xf')](_0x80c2('0xa'),auth[_0x80c2('0xb')](),controller[_0x80c2('0x11')]);router[_0x80c2('0xf')](_0x80c2('0x12'),auth[_0x80c2('0xb')](),interaction[_0x80c2('0x13')](_0x80c2('0x14'),_0x80c2('0x15')),controller[_0x80c2('0x16')]);router[_0x80c2('0x17')](_0x80c2('0x9'),auth['isAuthenticated'](),interaction[_0x80c2('0x13')](_0x80c2('0x14'),_0x80c2('0x18')),controller[_0x80c2('0x19')]);router[_0x80c2('0x1a')](_0x80c2('0x9'),auth['isAuthenticated'](),interaction[_0x80c2('0x13')](_0x80c2('0x14'),_0x80c2('0x1b')),controller[_0x80c2('0x1c')]);router[_0x80c2('0x1a')]('/:id/tags',auth[_0x80c2('0xb')](),controller[_0x80c2('0x1d')]);module[_0x80c2('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index f895901..87532cf 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 _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 +var _0xc8fd=['TEXT','ENUM','out','INTEGER','sequelize','iconv','BOOLEAN','DATE','STRING'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xc8fd,0x1ab));var _0xdc8f=function(_0x23d3ba,_0x32fada){_0x23d3ba=_0x23d3ba-0x0;var _0x2afe1b=_0xc8fd[_0x23d3ba];return _0x2afe1b;};'use strict';var Sequelize=require(_0xdc8f('0x0'));var iconv=require(_0xdc8f('0x1'));module['exports']={'closed':{'type':Sequelize[_0xdc8f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdc8f('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xdc8f('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdc8f('0x4')]},'note':{'type':Sequelize[_0xdc8f('0x4')]},'inReplyTo':{'type':Sequelize[_0xdc8f('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xdc8f('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xdc8f('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xdc8f('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xdc8f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdc8f('0x6')]('in',_0xdc8f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdc8f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdc8f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdc8f('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d805a6f..079600a 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 _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 +var _0x4965=['readFileSync','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird','path','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','error','stack','name','send','index','map','MailInteraction','fieldName','type','key','getOptions','findAll','mail','show','params','keys','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','merge','catch','create','update','body','find','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','true','rows','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','subject','get','each','missing.recipient@your.company.com','createdAt','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync'];(function(_0x1e5f76,_0x38b1c1){var _0xb5b961=function(_0x159ce9){while(--_0x159ce9){_0x1e5f76['push'](_0x1e5f76['shift']());}};_0xb5b961(++_0x38b1c1);}(_0x4965,0x163));var _0x5496=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x4965[_0x506172];return _0x2723c0;};'use strict';var emlformat=require(_0x5496('0x0'));var rimraf=require(_0x5496('0x1'));var zipdir=require(_0x5496('0x2'));var moment=require(_0x5496('0x3'));var BPromise=require(_0x5496('0x4'));var util=require('util');var path=require(_0x5496('0x5'));var fs=require('fs');var _=require('lodash');var juice=require(_0x5496('0x6'));var Redis=require('ioredis');var interaction=require(_0x5496('0x7'));var qs=require(_0x5496('0x8'));var logger=require(_0x5496('0x9'))(_0x5496('0xa'));var config=require('../../config/environment');var db=require(_0x5496('0xb'))['db'];var htmlEntities=require(_0x5496('0xc'));config[_0x5496('0xd')]=_[_0x5496('0xe')](config[_0x5496('0xd')],{'host':_0x5496('0xf'),'port':0x18eb});var socket=require(_0x5496('0x10'))(new Redis(config[_0x5496('0xd')]));require(_0x5496('0x11'))[_0x5496('0x12')](socket);function respondWithStatusCode(_0x5d5d1e,_0x2deaab){_0x2deaab=_0x2deaab||0xcc;return function(_0x365acf){if(_0x365acf){return _0x5d5d1e[_0x5496('0x13')](_0x2deaab);}return _0x5d5d1e[_0x5496('0x14')](_0x2deaab)[_0x5496('0x15')]();};}function respondWithResult(_0x56859a,_0x44e98d){_0x44e98d=_0x44e98d||0xc8;return function(_0x5b9cdf){if(_0x5b9cdf){return _0x56859a[_0x5496('0x14')](_0x44e98d)[_0x5496('0x16')](_0x5b9cdf);}};}function respondWithFilteredResult(_0x53eb8f,_0xbf5d54){return function(_0x3cafae){if(_0x3cafae){var _0x33e98f=typeof _0xbf5d54[_0x5496('0x17')]==='undefined'&&typeof _0xbf5d54[_0x5496('0x18')]===_0x5496('0x19');var _0x56f3ec=_0x3cafae[_0x5496('0x1a')];var _0x2041b2=_0x33e98f?0x0:_0xbf5d54['offset'];var _0xcadb44=_0x33e98f?_0x3cafae[_0x5496('0x1a')]:_0xbf5d54['offset']+_0xbf5d54['limit'];var _0x713942;if(_0xcadb44>=_0x56f3ec){_0xcadb44=_0x56f3ec;_0x713942=0xc8;}else{_0x713942=0xce;}_0x53eb8f[_0x5496('0x14')](_0x713942);return _0x53eb8f[_0x5496('0x1b')](_0x5496('0x1c'),_0x2041b2+'-'+_0xcadb44+'/'+_0x56f3ec)['json'](_0x3cafae);}return null;};}function saveUpdates(_0x393a67){return function(_0x45bdb9){if(_0x45bdb9){return _0x45bdb9['update'](_0x393a67)[_0x5496('0x1d')](function(_0x268d7d){return _0x268d7d;});}return null;};}function removeEntity(_0xefd4){return function(_0xd6a7a2){if(_0xd6a7a2){return _0xd6a7a2['destroy']()[_0x5496('0x1d')](function(){_0xefd4[_0x5496('0x14')](0xcc)[_0x5496('0x15')]();});}};}function handleEntityNotFound(_0x1944ea){return function(_0x5e48a2){if(!_0x5e48a2){_0x1944ea[_0x5496('0x13')](0x194);}return _0x5e48a2;};}function handleError(_0xb7df09,_0x3e1e18){_0x3e1e18=_0x3e1e18||0x1f4;return function(_0xa8ed30){logger[_0x5496('0x1e')](_0xa8ed30[_0x5496('0x1f')]);if(_0xa8ed30[_0x5496('0x20')]){delete _0xa8ed30[_0x5496('0x20')];}_0xb7df09[_0x5496('0x14')](_0x3e1e18)[_0x5496('0x21')](_0xa8ed30);};}exports[_0x5496('0x22')]=function(_0x4b4df2,_0x65a547){var _0x9df44d={};var _0x43f60f=_[_0x5496('0x23')](db[_0x5496('0x24')]['rawAttributes'],function(_0x1eb91d){return{'name':_0x1eb91d[_0x5496('0x25')],'type':_0x1eb91d[_0x5496('0x26')][_0x5496('0x27')]};});_0x9df44d=qs[_0x5496('0x28')](_0x43f60f,_0x4b4df2);return interaction[_0x5496('0x29')](_0x5496('0x2a'),_0x4b4df2['query'],_0x4b4df2['user'],_0x9df44d,_0x43f60f)[_0x5496('0x1d')](respondWithFilteredResult(_0x65a547,_0x9df44d))['catch'](handleError(_0x65a547,null));};exports[_0x5496('0x2b')]=function(_0x3ccec0,_0x3a6f8a){var _0x445bb8={'raw':![],'where':{'id':_0x3ccec0[_0x5496('0x2c')]['id']}},_0x51ae14={};_0x51ae14['model']=_[_0x5496('0x2d')](db[_0x5496('0x24')][_0x5496('0x2e')]);_0x51ae14[_0x5496('0x2f')]=_[_0x5496('0x2d')](_0x3ccec0['query']);_0x51ae14['filters']=_[_0x5496('0x30')](_0x51ae14[_0x5496('0x31')],_0x51ae14[_0x5496('0x2f')]);_0x445bb8[_0x5496('0x32')]=_['intersection'](_0x51ae14[_0x5496('0x31')],qs[_0x5496('0x33')](_0x3ccec0[_0x5496('0x2f')][_0x5496('0x33')]));_0x445bb8[_0x5496('0x32')]=_0x445bb8[_0x5496('0x32')][_0x5496('0x34')]?_0x445bb8[_0x5496('0x32')]:_0x51ae14[_0x5496('0x31')];if(_0x3ccec0[_0x5496('0x2f')][_0x5496('0x35')]){_0x445bb8['include']=[{'all':!![]}];}_0x445bb8=_[_0x5496('0x36')]({},_0x445bb8,_0x3ccec0['options']);return db['MailInteraction']['find'](_0x445bb8)[_0x5496('0x1d')](handleEntityNotFound(_0x3a6f8a,null))[_0x5496('0x1d')](respondWithResult(_0x3a6f8a,null))[_0x5496('0x37')](handleError(_0x3a6f8a,null));};exports[_0x5496('0x38')]=function(_0x1be6fa,_0x27d778){return db[_0x5496('0x24')][_0x5496('0x38')](_0x1be6fa['body'],{})[_0x5496('0x1d')](respondWithResult(_0x27d778,0xc9))[_0x5496('0x37')](handleError(_0x27d778,null));};exports[_0x5496('0x39')]=function(_0x4dbd97,_0x5682f9){if(_0x4dbd97[_0x5496('0x3a')]['id']){delete _0x4dbd97[_0x5496('0x3a')]['id'];}return db[_0x5496('0x24')]['find']({'where':{'id':_0x4dbd97[_0x5496('0x2c')]['id']}})[_0x5496('0x1d')](handleEntityNotFound(_0x5682f9,null))[_0x5496('0x1d')](saveUpdates(_0x4dbd97['body'],null))[_0x5496('0x1d')](respondWithResult(_0x5682f9,null))[_0x5496('0x37')](handleError(_0x5682f9,null));};exports['destroy']=function(_0x86f1b4,_0x2c0020){return db[_0x5496('0x24')][_0x5496('0x3b')]({'where':{'id':_0x86f1b4[_0x5496('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2c0020,null))[_0x5496('0x1d')](removeEntity(_0x2c0020,null))['catch'](handleError(_0x2c0020,null));};exports['describe']=function(_0x32aef9,_0x371e99){return db[_0x5496('0x24')][_0x5496('0x3c')]()[_0x5496('0x1d')](respondWithResult(_0x371e99,null))['catch'](handleError(_0x371e99,null));};exports[_0x5496('0x3d')]=function(_0x5391ce,_0x1dacb5){return db[_0x5496('0x3e')][_0x5496('0x3b')]({'where':{'id':_0x5391ce['params']['id']}})[_0x5496('0x1d')](handleEntityNotFound(_0x1dacb5,null))['then'](function(_0x16f183){if(_0x16f183){return _0x16f183['addMessage'](_0x5391ce[_0x5496('0x3a')][_0x5496('0x3f')],_[_0x5496('0x40')](_0x5391ce[_0x5496('0x3a')],[_0x5496('0x3f'),'id'])||{});}})[_0x5496('0x1d')](respondWithResult(_0x1dacb5,null))[_0x5496('0x37')](handleError(_0x1dacb5,null));};exports[_0x5496('0x41')]=function(_0x4e75c2,_0x5cf87f){var _0x2dd4b5={'raw':![],'where':{}};var _0x2cec4f={};var _0x4db470={'count':0x0,'rows':[]};return db[_0x5496('0x24')][_0x5496('0x42')]({'where':{'id':_0x4e75c2['params']['id']}})[_0x5496('0x1d')](handleEntityNotFound(_0x5cf87f,null))[_0x5496('0x1d')](function(_0xaec6be){if(_0xaec6be){_0x2cec4f[_0x5496('0x31')]=_['keys'](db[_0x5496('0x3e')][_0x5496('0x2e')]);_0x2cec4f['query']=_['keys'](_0x4e75c2[_0x5496('0x2f')]);_0x2cec4f[_0x5496('0x43')]=_[_0x5496('0x30')](_0x2cec4f[_0x5496('0x31')],_0x2cec4f[_0x5496('0x2f')]);_0x2dd4b5[_0x5496('0x32')]=_[_0x5496('0x30')](_0x2cec4f['model'],qs[_0x5496('0x33')](_0x4e75c2[_0x5496('0x2f')][_0x5496('0x33')]));_0x2dd4b5[_0x5496('0x32')]=_0x2dd4b5['attributes'][_0x5496('0x34')]?_0x2dd4b5[_0x5496('0x32')]:_0x2cec4f[_0x5496('0x31')];if(!_0x4e75c2[_0x5496('0x2f')][_0x5496('0x44')]('nolimit')){_0x2dd4b5[_0x5496('0x18')]=qs['limit'](_0x4e75c2[_0x5496('0x2f')][_0x5496('0x18')]);_0x2dd4b5['offset']=qs[_0x5496('0x17')](_0x4e75c2['query']['offset']);}_0x2dd4b5['order']=qs[_0x5496('0x45')](_0x4e75c2[_0x5496('0x2f')][_0x5496('0x45')]);_0x2dd4b5[_0x5496('0x46')]=qs[_0x5496('0x43')](_[_0x5496('0x47')](_0x4e75c2['query'],_0x2cec4f[_0x5496('0x43')]));_0x2dd4b5['where']['MailInteractionId']=_0xaec6be['id'];if(_0x4e75c2[_0x5496('0x2f')][_0x5496('0x48')]){_0x2dd4b5[_0x5496('0x46')]=_[_0x5496('0x36')](_0x2dd4b5[_0x5496('0x46')],{'$or':_[_0x5496('0x23')](_0x2dd4b5['attributes'],function(_0x17cd8b){var _0x3e0138={};_0x3e0138[_0x17cd8b]={'$like':'%'+_0x4e75c2['query'][_0x5496('0x48')]+'%'};return _0x3e0138;})});}if(_0x4e75c2[_0x5496('0x2f')][_0x5496('0x49')]){var _0x35e6f5=_0x4e75c2[_0x5496('0x2f')][_0x5496('0x49')][_0x5496('0x4a')](',');var _0x3be0fb={};_0x3be0fb[_0x35e6f5[0x0]]={'$gte':moment(_0x35e6f5[0x1])['format'](_0x5496('0x4b'))};_0x2dd4b5[_0x5496('0x46')]=_['merge'](_0x2dd4b5[_0x5496('0x46')],_0x3be0fb);}_0x2dd4b5=_[_0x5496('0x36')]({},_0x2dd4b5,_0x4e75c2['options']);return db[_0x5496('0x3e')][_0x5496('0x1a')]({'where':_0x2dd4b5[_0x5496('0x46')]})[_0x5496('0x1d')](function(_0x27e730){_0x4db470[_0x5496('0x1a')]=_0x27e730;if(_0x4e75c2[_0x5496('0x2f')][_0x5496('0x35')]){_0x2dd4b5[_0x5496('0x4c')]=[{'all':!![]}];}return db['MailMessage'][_0x5496('0x29')](_0x2dd4b5);})['then'](function(_0x1f8f53){if(_0x4e75c2[_0x5496('0x2f')]['inlineCss']===_0x5496('0x4d')){for(var _0x333a6e=0x0;_0x333a6e<_0x1f8f53[_0x5496('0x34')];_0x333a6e++){_0x1f8f53[_0x333a6e][_0x5496('0x3a')]=juice(_0x1f8f53[_0x333a6e][_0x5496('0x3a')]);}}_0x4db470[_0x5496('0x4e')]=_0x1f8f53;return _0x4db470;});}})[_0x5496('0x1d')](respondWithFilteredResult(_0x5cf87f,_0x2dd4b5))['catch'](handleError(_0x5cf87f,null));};exports[_0x5496('0x4f')]=function(_0x53fb31,_0x3cceb7){return db[_0x5496('0x24')]['find']({'where':{'id':_0x53fb31['params']['id']}})[_0x5496('0x1d')](handleEntityNotFound(_0x3cceb7,null))['then'](function(_0x334dbc){if(_0x334dbc){return _0x334dbc[_0x5496('0x50')](_0x53fb31['body'][_0x5496('0x3f')],_[_0x5496('0x40')](_0x53fb31[_0x5496('0x3a')],['ids','id'])||{})['spread'](function(){return db[_0x5496('0x51')][_0x5496('0x29')]({'attributes':['id',_0x5496('0x20'),_0x5496('0x52')],'where':{'id':_0x53fb31[_0x5496('0x3a')][_0x5496('0x3f')]}});})[_0x5496('0x1d')](function(_0xd85b47){socket[_0x5496('0x53')](_0x5496('0x54'),{'id':Number(_0x53fb31['params']['id']),'tags':_0xd85b47||[]});return{'id':Number(_0x53fb31[_0x5496('0x2c')]['id']),'tags':_0xd85b47||[]};});}})['then'](respondWithResult(_0x3cceb7,null))[_0x5496('0x37')](handleError(_0x3cceb7,null));};exports[_0x5496('0x55')]=function(_0x31a13f,_0x2f6b02){return db[_0x5496('0x24')][_0x5496('0x3b')]({'where':{'id':_0x31a13f[_0x5496('0x2c')]['id']}})[_0x5496('0x1d')](handleEntityNotFound(_0x2f6b02,null))['then'](function(_0x2f0ffc){if(_0x2f0ffc){return _0x2f0ffc[_0x5496('0x55')](_0x31a13f[_0x5496('0x2f')][_0x5496('0x3f')]);}})[_0x5496('0x1d')](respondWithStatusCode(_0x2f6b02,null))[_0x5496('0x37')](handleError(_0x2f6b02,null));};exports[_0x5496('0x56')]=function(_0x3b6c27,_0x298cef){var _0x24cf90=moment()[_0x5496('0x57')]()[_0x5496('0x58')]();var _0x5536d4=path[_0x5496('0x59')](config[_0x5496('0x5a')],_0x5496('0x5b'),_0x5496('0x5c'),_0x5496('0x5d'));var _0x10787b=path[_0x5496('0x59')](config[_0x5496('0x5a')],'server','files',_0x5496('0x5e'));var _0x169b71=path[_0x5496('0x59')](_0x5536d4,_0x24cf90);var _0x28c96c=util['format'](_0x5496('0x5f'),_0x3b6c27[_0x5496('0x2c')]['id'],_0x24cf90);var _0x3ef212=path[_0x5496('0x59')](_0x5536d4,_0x28c96c);var _0x557c00=[];if(_0x3b6c27[_0x5496('0x2f')][_0x5496('0x5e')]){_0x557c00[_0x5496('0x60')]({'model':db[_0x5496('0x61')],'as':_0x5496('0x62'),'raw':!![]});}var _0x1705bf=[{'model':db[_0x5496('0x3e')],'as':_0x5496('0x63'),'attributes':['id',_0x5496('0x3a'),_0x5496('0x64'),'to','cc','bcc',_0x5496('0x65'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x557c00}];return db[_0x5496('0x24')][_0x5496('0x3b')]({'where':{'id':_0x3b6c27['params']['id']},'include':_0x1705bf})[_0x5496('0x1d')](handleEntityNotFound(_0x298cef,null))[_0x5496('0x1d')](function(_0x4a3992){if(_0x4a3992&&_0x4a3992['Messages']){var _0x1217be=_0x4a3992[_0x5496('0x66')]({'plain':!![]});fs['mkdirSync'](_0x169b71);return BPromise[_0x5496('0x67')](_0x1217be[_0x5496('0x63')],function(_0xbb0baf,_0x4b8f18){var _0x1e3131={'from':_0xbb0baf['from'],'to':_0xbb0baf['to']||_0x5496('0x68'),'subject':_0xbb0baf[_0x5496('0x65')],'html':htmlEntities['decode'](_0xbb0baf[_0x5496('0x3a')]),'headers':{'Date':moment(_0xbb0baf[_0x5496('0x69')])[_0x5496('0x6a')](_0x5496('0x6b'))},'attachments':[]};if(_0xbb0baf['cc']){_0x1e3131[_0x5496('0x6c')]['Cc']=_0xbb0baf['cc'];}if(_0xbb0baf[_0x5496('0x6d')]){_0x1e3131['headers'][_0x5496('0x6e')]=_0xbb0baf[_0x5496('0x6d')];}return new BPromise(function(_0x151da3,_0x3cd80b){if(_0xbb0baf[_0x5496('0x62')]){for(var _0x295761=0x0;_0x295761<_0xbb0baf[_0x5496('0x62')]['length'];_0x295761++){var _0x29771d=_0xbb0baf[_0x5496('0x62')][_0x295761];var _0x1bc680=path[_0x5496('0x59')](_0x10787b,_0x29771d[_0x5496('0x6f')]);if(fs[_0x5496('0x70')](_0x1bc680)){_0x1e3131[_0x5496('0x5e')][_0x5496('0x60')]({'name':_0x29771d[_0x5496('0x20')],'contentType':_0x29771d['type'],'data':fs[_0x5496('0x71')](_0x1bc680)});}}}emlformat[_0x5496('0x72')](_0x1e3131,function(_0x597314,_0x417d36){if(_0x597314)return _0x3cd80b(_0x597314);fs[_0x5496('0x73')](path['join'](_0x169b71,util['format'](_0x5496('0x74'),_0x4b8f18)),_0x417d36);return _0x151da3(_0x417d36);});});})[_0x5496('0x1d')](function(){return new BPromise(function(_0x32fb9e,_0x1705c8){zipdir(_0x169b71,{'saveTo':_0x3ef212},function(_0x223ae1,_0x382e38){if(_0x223ae1)return _0x1705c8(_0x223ae1);return _0x32fb9e(_0x382e38);});})['then'](function(){return new BPromise(function(_0x594a59,_0x520e33){rimraf(_0x169b71,function(_0x2a6f4b){if(_0x2a6f4b)_0x520e33(_0x2a6f4b);return _0x594a59();});});})[_0x5496('0x1d')](function(){return _0x298cef[_0x5496('0x56')](_0x3ef212,_0x28c96c,function(_0x4acb09){if(!_0x4acb09)fs['unlinkSync'](_0x3ef212);});});});}else{return _0x298cef['sendStatus'](0xc8);}})[_0x5496('0x37')](handleError(_0x298cef,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b48a196..4e214a8 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 _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 +var _0x15f3=['MailMessage','save','update','setDataValue','then','unreadMessages','catch','hook','exports','events','../../mysqldb'];(function(_0x3fbbf2,_0x436a2f){var _0x427e5c=function(_0x1a12be){while(--_0x1a12be){_0x3fbbf2['push'](_0x3fbbf2['shift']());}};_0x427e5c(++_0x436a2f);}(_0x15f3,0x1e2));var _0x315f=function(_0x5706c4,_0x5bb0cd){_0x5706c4=_0x5706c4-0x0;var _0x4be9eb=_0x15f3[_0x5706c4];return _0x4be9eb;};'use strict';var EventEmitter=require(_0x315f('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x315f('0x1'))['db'][_0x315f('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x315f('0x3'),'afterUpdate':_0x315f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x373102){return function(_0x318ad4,_0x4f23c0,_0x71d727){_0x318ad4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x408cd7){_0x318ad4[_0x315f('0x5')]('Users',_0x408cd7['map'](function(_0x7e65ef){return{'id':_0x7e65ef['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x318ad4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x315f('0x6')](function(_0x251bc6){_0x318ad4[_0x315f('0x5')](_0x315f('0x7'),_0x251bc6['length']);MailInteractionEvents['emit'](_0x373102+':'+_0x318ad4['id'],_0x318ad4);MailInteractionEvents['emit'](_0x373102,_0x318ad4);_0x71d727(null);})[_0x315f('0x8')](_0x71d727(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x315f('0x9')](e,emitEvent(event));}}module[_0x315f('0xa')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 5672189..389d7de 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 _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 +var _0x3533=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','format','models','MailMessage','update'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x3533,0xbf));var _0x3353=function(_0x3dd29c,_0x35c9bb){_0x3dd29c=_0x3dd29c-0x0;var _0x21c9e7=_0x3533[_0x3dd29c];return _0x21c9e7;};'use strict';var _=require(_0x3353('0x0'));var util=require(_0x3353('0x1'));var logger=require(_0x3353('0x2'))('api');var moment=require(_0x3353('0x3'));var BPromise=require(_0x3353('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3353('0x5'));var rimraf=require(_0x3353('0x6'));var config=require('../../config/environment');var attributes=require(_0x3353('0x7'));module[_0x3353('0x8')]=function(_0xbca700,_0x5cc249){return _0xbca700[_0x3353('0x9')](_0x3353('0xa'),attributes,{'tableName':_0x3353('0xb'),'paranoid':![],'indexes':[{'name':_0x3353('0xc'),'fields':[_0x3353('0xd'),'to'],'type':_0x3353('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xee3296,_0x5c6dcc,_0x1df6af){if(_0xee3296[_0x3353('0xf')]){_0xee3296['substatusAt']=moment()['format'](_0x3353('0x10'));}if(_0xee3296[_0x3353('0x11')]){_0xee3296[_0x3353('0x12')]=moment()['format'](_0x3353('0x10'));}_0x1df6af(null,_0x5c6dcc);},'beforeUpdate':function(_0x354182,_0x3341e3,_0x2a54fc){if(_0x354182[_0x3353('0x13')](_0x3353('0xf'))){_0x354182[_0x3353('0x14')]=_0x354182['substatus']?moment()[_0x3353('0x15')](_0x3353('0x10')):null;}if(_0x354182[_0x3353('0x13')]('closed')){_0x354182['closedAt']=moment()[_0x3353('0x15')](_0x3353('0x10'));_0x354182[_0x3353('0xf')]=null;_0x354182['substatusAt']=null;}_0x2a54fc(null,_0x354182);},'afterUpdate':function(_0x3f6552,_0x164320,_0x44118d){var _0x3df942=_0xbca700[_0x3353('0x16')];var _0x338d88=_0x3f6552['get']({'plain':!![]});if(_0x338d88[_0x3353('0x11')]){return _0x3df942[_0x3353('0x17')][_0x3353('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x338d88['id']}})['then'](function(){_0x44118d();})['catch'](function(_0x2c394a){_0x44118d(_0x2c394a);});}else{_0x44118d();}}},'charset':_0x3353('0x19'),'collate':_0x3353('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b6c4164..cf68162 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 _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 +var _0x7676=['then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','update','options','raw','where','attributes','limit','UpdateMailInteraction','debug','catch','AddTagsToMailInteraction','MailInteraction','find','body','ids','spread','AddTags','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x7676,0xb8));var _0x6767=function(_0x256f53,_0x382d25){_0x256f53=_0x256f53-0x0;var _0x4a0a3b=_0x7676[_0x256f53];return _0x4a0a3b;};'use strict';var _=require(_0x6767('0x0'));var util=require(_0x6767('0x1'));var moment=require(_0x6767('0x2'));var BPromise=require('bluebird');var rs=require(_0x6767('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6767('0x4'));var logger=require('../../config/logger')(_0x6767('0x5'));var config=require(_0x6767('0x6'));var jayson=require(_0x6767('0x7'));var client=jayson['client'][_0x6767('0x8')]({'port':0x232a});config[_0x6767('0x9')]=_[_0x6767('0xa')](config['redis'],{'host':_0x6767('0xb'),'port':0x18eb});var socket=require(_0x6767('0xc'))(new Redis(config[_0x6767('0x9')]));require(_0x6767('0xd'))[_0x6767('0xe')](socket);function respondWithRpcPromise(_0x336315,_0x2d5260,_0x94cf0d){return new BPromise(function(_0x36b8bb,_0x10a98f){return client[_0x6767('0xf')](_0x336315,_0x94cf0d)[_0x6767('0x10')](function(_0x47b7a4){logger[_0x6767('0x11')](_0x6767('0x12'),_0x2d5260,_0x6767('0x13'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2d5260,_0x6767('0x13'),JSON[_0x6767('0x14')](_0x47b7a4));if(_0x47b7a4['error']){if(_0x47b7a4[_0x6767('0x15')][_0x6767('0x16')]===0x1f4){logger['error'](_0x6767('0x12'),_0x2d5260,_0x47b7a4[_0x6767('0x15')][_0x6767('0x17')]);return _0x10a98f(_0x47b7a4[_0x6767('0x15')]['message']);}logger[_0x6767('0x15')]('MailInteraction,\x20%s,\x20%s',_0x2d5260,_0x47b7a4[_0x6767('0x15')][_0x6767('0x17')]);return _0x36b8bb(_0x47b7a4[_0x6767('0x15')]['message']);}else{logger[_0x6767('0x11')]('MailInteraction,\x20%s,\x20%s',_0x2d5260,_0x6767('0x13'));_0x36b8bb(_0x47b7a4['result'][_0x6767('0x17')]);}})['catch'](function(_0x47e032){logger[_0x6767('0x15')](_0x6767('0x12'),_0x2d5260,_0x47e032);_0x10a98f(_0x47e032);});});}exports['UpdateMailInteraction']=function(_0x1287c3){var _0x234676=this;return new Promise(function(_0x58a483,_0x2f5350){return db['MailInteraction'][_0x6767('0x18')](_0x1287c3['body'],{'raw':_0x1287c3['options']?_0x1287c3[_0x6767('0x19')][_0x6767('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1287c3[_0x6767('0x19')]?_0x1287c3['options'][_0x6767('0x1b')]||null:null,'attributes':_0x1287c3[_0x6767('0x19')]?_0x1287c3[_0x6767('0x19')][_0x6767('0x1c')]||null:null,'limit':_0x1287c3[_0x6767('0x19')]?_0x1287c3[_0x6767('0x19')][_0x6767('0x1d')]||null:null})[_0x6767('0x10')](function(_0x136122){logger[_0x6767('0x11')](_0x6767('0x1e'),_0x1287c3);logger[_0x6767('0x1f')]('UpdateMailInteraction',_0x1287c3,JSON[_0x6767('0x14')](_0x136122));_0x58a483(_0x136122);})[_0x6767('0x20')](function(_0xc06b4e){logger['error'](_0x6767('0x1e'),_0xc06b4e[_0x6767('0x17')],_0x1287c3);_0x2f5350(_0x234676['error'](0x1f4,_0xc06b4e[_0x6767('0x17')]));});});};exports[_0x6767('0x21')]=function(_0x40f691){return new Promise(function(_0x5885ac,_0x373da7){return db[_0x6767('0x22')][_0x6767('0x23')]({'where':_0x40f691[_0x6767('0x19')]?_0x40f691['options'][_0x6767('0x1b')]||null:null})[_0x6767('0x10')](function(_0x163b46){if(_0x163b46){return _0x163b46['addTags'](_0x40f691[_0x6767('0x24')][_0x6767('0x25')],_['omit'](_0x40f691[_0x6767('0x24')],['ids','id'])||{});}})[_0x6767('0x26')](function(_0x40bb22){logger[_0x6767('0x11')]('AddTags',_0x40f691);logger[_0x6767('0x1f')](_0x6767('0x27'),_0x40f691,JSON[_0x6767('0x14')](_0x40bb22));_0x5885ac(_0x40bb22);})[_0x6767('0x20')](function(_0x470c84){logger[_0x6767('0x15')](_0x6767('0x27'),_0x470c84[_0x6767('0x17')],_0x40f691);_0x373da7(_this[_0x6767('0x15')](0x1f4,_0x470c84['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c7f70ff..089996c 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 _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 +var _0xe2c4=['./mailInteraction.events','save','remove','update','removeListener','register','length','mailInteraction:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2c4,0x88));var _0x4e2c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe2c4[_0x59ee6f];return _0x4c0979;};'use strict';var MailInteractionEvents=require(_0x4e2c('0x0'));var events=[_0x4e2c('0x1'),_0x4e2c('0x2'),_0x4e2c('0x3')];function createListener(_0x2c90f8,_0x56f91e){return function(_0x47b6bd){_0x56f91e['emit'](_0x2c90f8,_0x47b6bd);};}function removeListener(_0x404223,_0x7adfad){return function(){MailInteractionEvents[_0x4e2c('0x4')](_0x404223,_0x7adfad);};}exports[_0x4e2c('0x5')]=function(_0x33dabf){for(var _0x4f8624=0x0,_0x3c563f=events[_0x4e2c('0x6')];_0x4f8624<_0x3c563f;_0x4f8624++){var _0x77a629=events[_0x4f8624];var _0x116aa9=createListener(_0x4e2c('0x7')+_0x77a629,_0x33dabf);MailInteractionEvents['on'](_0x77a629,_0x116aa9);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 2e946fb..0c95efc 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 _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 +var _0xc263=['get','/describe','describe','show','/:id/download','download','post','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0xd53918,_0x44cf40){var _0x32e15a=function(_0x3e4606){while(--_0x3e4606){_0xd53918['push'](_0xd53918['shift']());}};_0x32e15a(++_0x44cf40);}(_0xc263,0x171));var _0x3c26=function(_0x18b686,_0xa4e0f3){_0x18b686=_0x18b686-0x0;var _0x2f23d8=_0xc263[_0x18b686];return _0x2f23d8;};'use strict';var multer=require(_0x3c26('0x0'));var util=require('util');var path=require(_0x3c26('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c26('0x2'));var router=express[_0x3c26('0x3')]();var fs_extra=require(_0x3c26('0x4'));var auth=require(_0x3c26('0x5'));var interaction=require(_0x3c26('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router['get']('/',auth[_0x3c26('0x7')](),controller[_0x3c26('0x8')]);router[_0x3c26('0x9')](_0x3c26('0xa'),auth[_0x3c26('0x7')](),controller[_0x3c26('0xb')]);router[_0x3c26('0x9')]('/:id',auth[_0x3c26('0x7')](),controller[_0x3c26('0xc')]);router[_0x3c26('0x9')](_0x3c26('0xd'),auth[_0x3c26('0x7')](),controller[_0x3c26('0xe')]);router[_0x3c26('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x3c26('0x10'),_0x3c26('0x11')),controller[_0x3c26('0x12')]);router[_0x3c26('0x13')](_0x3c26('0x14'),auth[_0x3c26('0x7')](),controller[_0x3c26('0x15')]);router[_0x3c26('0x13')](_0x3c26('0x16'),auth[_0x3c26('0x7')](),controller[_0x3c26('0x17')]);router[_0x3c26('0x13')]('/:id/reject',auth[_0x3c26('0x7')](),controller[_0x3c26('0x18')]);router['delete'](_0x3c26('0x14'),auth['isAuthenticated'](),controller[_0x3c26('0x19')]);module[_0x3c26('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 91b71bd..1fc58ad 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 _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 +var _0x9238=['BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email','lodash','TEXT','long'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9238,0x11f));var _0x8923=function(_0x1a1412,_0x58c658){_0x1a1412=_0x1a1412-0x0;var _0x51c2a1=_0x9238[_0x1a1412];return _0x51c2a1;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8923('0x0'));module['exports']={'body':{'type':Sequelize[_0x8923('0x1')](_0x8923('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8923('0x1')]('medium')},'read':{'type':Sequelize[_0x8923('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8923('0x4')]('in',_0x8923('0x5')),'defaultValue':_0x8923('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x8923('0x6')]},'to':{'type':Sequelize[_0x8923('0x1')](_0x8923('0x2'))},'cc':{'type':Sequelize[_0x8923('0x1')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x8923('0x2'))},'subject':{'type':Sequelize[_0x8923('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x8923('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x8923('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8923('0x8')]},'originTo':{'type':Sequelize[_0x8923('0x1')](_0x8923('0x2'))},'originCc':{'type':Sequelize[_0x8923('0x1')](_0x8923('0x2'))},'originChannel':{'type':Sequelize[_0x8923('0x4')](_0x8923('0x9'),'Chat'),'defaultValue':_0x8923('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 d657da2..f37bc9f 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 _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 +var _0x551e=['join','root','server/files/attachments','basename','Contacts','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','read','readAt','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','event','accept','fromString','EventManager','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','channel','motionChannel','download','unix','toString','server','tmp','from','bcc','subject','createdAt','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','build','writeFileSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined','limit','offset','count','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','body','describe','create','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments'];(function(_0x346df3,_0x5b978e){var _0x352f88=function(_0x6bf70c){while(--_0x6bf70c){_0x346df3['push'](_0x346df3['shift']());}};_0x352f88(++_0x5b978e);}(_0x551e,0x188));var _0xe551=function(_0x5a5959,_0x524912){_0x5a5959=_0x5a5959-0x0;var _0x18e650=_0x551e[_0x5a5959];return _0x18e650;};'use strict';var emlformat=require(_0xe551('0x0'));var moment=require(_0xe551('0x1'));var BPromise=require(_0xe551('0x2'));var util=require(_0xe551('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xe551('0x4'));var Redis=require(_0xe551('0x5'));var htmlToText=require(_0xe551('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xe551('0x7'))(_0xe551('0x8'));var interaction_log=require(_0xe551('0x7'))(_0xe551('0x9'));var config=require(_0xe551('0xa'));var db=require('../../mysqldb')['db'];config[_0xe551('0xb')]=_[_0xe551('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0xe551('0xd'));require(_0xe551('0xe'))[_0xe551('0xf')](socket);var jayson=require(_0xe551('0x10'));var client=jayson[_0xe551('0x11')][_0xe551('0x12')]({'port':0x232c});var client9003=jayson[_0xe551('0x11')][_0xe551('0x12')]({'port':0x232b});var client9002=jayson[_0xe551('0x11')][_0xe551('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x2cd63e,_0x5b4cc6,_0x4e78b0,_0x55f508){return new BPromise(function(_0x46fb77,_0x2b4c7e){var _0x39adfb=_0x55f508||client;return _0x39adfb['request'](_0x2cd63e,_0x4e78b0)[_0xe551('0x13')](function(_0x5e7bf7){logger['info'](_0xe551('0x14'),_0x5b4cc6,_0xe551('0x15'));logger[_0xe551('0x16')](_0xe551('0x17'),_0x5b4cc6,_0xe551('0x15'),JSON[_0xe551('0x18')](_0x5e7bf7));if(_0x5e7bf7[_0xe551('0x19')]){if(_0x5e7bf7[_0xe551('0x19')][_0xe551('0x1a')]===0x1f4){logger[_0xe551('0x19')](_0xe551('0x14'),_0x5b4cc6,_0x5e7bf7['error'][_0xe551('0x1b')]);return _0x2b4c7e(_0x5e7bf7[_0xe551('0x19')][_0xe551('0x1b')]);}logger[_0xe551('0x19')](_0xe551('0x14'),_0x5b4cc6,_0x5e7bf7[_0xe551('0x19')]['message']);return _0x46fb77(_0x5e7bf7[_0xe551('0x19')][_0xe551('0x1b')]);}else{logger['info'](_0xe551('0x14'),_0x5b4cc6,'request\x20sent');_0x46fb77(_0x5e7bf7[_0xe551('0x1c')][_0xe551('0x1b')]);}})[_0xe551('0x1d')](function(_0x36fc84){logger['error'](_0xe551('0x14'),_0x5b4cc6,_0x36fc84);_0x2b4c7e(_0x36fc84);});});}function respondWithResult(_0x58858f,_0x25d9b1){_0x25d9b1=_0x25d9b1||0xc8;return function(_0x31fdae){if(_0x31fdae){return _0x58858f[_0xe551('0x1e')](_0x25d9b1)[_0xe551('0x1f')](_0x31fdae);}};}function respondWithFilteredResult(_0x20c0ad,_0x329469){return function(_0x1c7fb4){if(_0x1c7fb4){var _0x595d2d=typeof _0x329469['offset']===_0xe551('0x20')&&typeof _0x329469[_0xe551('0x21')]==='undefined';var _0x4c99ff=_0x1c7fb4['count'];var _0x5f364b=_0x595d2d?0x0:_0x329469[_0xe551('0x22')];var _0x2662ad=_0x595d2d?_0x1c7fb4[_0xe551('0x23')]:_0x329469[_0xe551('0x22')]+_0x329469[_0xe551('0x21')];var _0x2bc0c9;if(_0x2662ad>=_0x4c99ff){_0x2662ad=_0x4c99ff;_0x2bc0c9=0xc8;}else{_0x2bc0c9=0xce;}_0x20c0ad[_0xe551('0x1e')](_0x2bc0c9);return _0x20c0ad['set'](_0xe551('0x24'),_0x5f364b+'-'+_0x2662ad+'/'+_0x4c99ff)[_0xe551('0x1f')](_0x1c7fb4);}return null;};}function saveUpdates(_0x3adb71){return function(_0x2aba46){if(_0x2aba46){return _0x2aba46[_0xe551('0x25')](_0x3adb71)['then'](function(_0x56ec6c){return _0x56ec6c;});}return null;};}function removeEntity(_0x15724a){return function(_0x2f4d8e){if(_0x2f4d8e){return _0x2f4d8e[_0xe551('0x26')]()[_0xe551('0x13')](function(){_0x15724a[_0xe551('0x1e')](0xcc)[_0xe551('0x27')]();});}};}function handleEntityNotFound(_0x2e51a5){return function(_0x5119ed){if(!_0x5119ed){_0x2e51a5[_0xe551('0x28')](0x194);}return _0x5119ed;};}function handleError(_0x3f443d,_0x209397){_0x209397=_0x209397||0x1f4;return function(_0x3d3c2c){logger[_0xe551('0x19')](_0x3d3c2c[_0xe551('0x29')]);if(_0x3d3c2c[_0xe551('0x2a')]){delete _0x3d3c2c[_0xe551('0x2a')];}_0x3f443d[_0xe551('0x1e')](_0x209397)[_0xe551('0x2b')](_0x3d3c2c);};}exports[_0xe551('0x2c')]=function(_0x4b6b04,_0x54df31){var _0x21c597={},_0x4ac6bd={},_0x10154d={'count':0x0,'rows':[]};var _0x3cee14=_['map'](db[_0xe551('0x2d')][_0xe551('0x2e')],function(_0x17cfbd){return{'name':_0x17cfbd[_0xe551('0x2f')],'type':_0x17cfbd[_0xe551('0x30')][_0xe551('0x31')]};});_0x4ac6bd[_0xe551('0x32')]=_[_0xe551('0x33')](_0x3cee14,_0xe551('0x2a'));_0x4ac6bd[_0xe551('0x34')]=_['keys'](_0x4b6b04[_0xe551('0x34')]);_0x4ac6bd[_0xe551('0x35')]=_['intersection'](_0x4ac6bd[_0xe551('0x32')],_0x4ac6bd[_0xe551('0x34')]);_0x21c597[_0xe551('0x36')]=_[_0xe551('0x37')](_0x4ac6bd[_0xe551('0x32')],qs[_0xe551('0x38')](_0x4b6b04[_0xe551('0x34')][_0xe551('0x38')]));_0x21c597[_0xe551('0x36')]=_0x21c597['attributes'][_0xe551('0x39')]?_0x21c597['attributes']:_0x4ac6bd['model'];if(!_0x4b6b04['query'][_0xe551('0x3a')](_0xe551('0x3b'))){_0x21c597['limit']=qs[_0xe551('0x21')](_0x4b6b04[_0xe551('0x34')]['limit']);_0x21c597['offset']=qs[_0xe551('0x22')](_0x4b6b04['query']['offset']);}_0x21c597[_0xe551('0x3c')]=qs['sort'](_0x4b6b04[_0xe551('0x34')]['sort']);_0x21c597[_0xe551('0x3d')]=qs[_0xe551('0x35')](_[_0xe551('0x3e')](_0x4b6b04[_0xe551('0x34')],_0x4ac6bd[_0xe551('0x35')]),_0x3cee14);if(_0x4b6b04[_0xe551('0x34')][_0xe551('0x3f')]){_0x21c597['where']=_[_0xe551('0x40')](_0x21c597[_0xe551('0x3d')],{'$or':_[_0xe551('0x33')](_0x3cee14,function(_0x3a9b63){if(_0x3a9b63[_0xe551('0x30')]!=='VIRTUAL'){var _0x26df30={};_0x26df30[_0x3a9b63['name']]={'$like':'%'+_0x4b6b04[_0xe551('0x34')][_0xe551('0x3f')]+'%'};return _0x26df30;}})});}_0x21c597=_[_0xe551('0x40')]({},_0x21c597,_0x4b6b04[_0xe551('0x41')]);var _0x55a01e={'where':_0x21c597['where']};return db[_0xe551('0x2d')][_0xe551('0x23')](_0x55a01e)['then'](function(_0x25690d){_0x10154d['count']=_0x25690d;if(_0x4b6b04[_0xe551('0x34')][_0xe551('0x42')]){_0x21c597[_0xe551('0x43')]=[{'all':!![]}];}return db[_0xe551('0x2d')][_0xe551('0x44')](_0x21c597);})['then'](function(_0x40f54d){_0x10154d[_0xe551('0x45')]=_0x40f54d;return _0x10154d;})[_0xe551('0x13')](respondWithFilteredResult(_0x54df31,_0x21c597))['catch'](handleError(_0x54df31,null));};exports[_0xe551('0x46')]=function(_0x109bd3,_0x37d192){var _0x3956ca={'raw':!![],'where':{'id':_0x109bd3[_0xe551('0x47')]['id']}},_0x4309d5={};_0x4309d5[_0xe551('0x32')]=_[_0xe551('0x48')](db[_0xe551('0x2d')][_0xe551('0x2e')]);_0x4309d5[_0xe551('0x34')]=_[_0xe551('0x48')](_0x109bd3[_0xe551('0x34')]);_0x4309d5[_0xe551('0x35')]=_['intersection'](_0x4309d5['model'],_0x4309d5['query']);_0x3956ca['attributes']=_[_0xe551('0x37')](_0x4309d5[_0xe551('0x32')],qs[_0xe551('0x38')](_0x109bd3[_0xe551('0x34')][_0xe551('0x38')]));_0x3956ca['attributes']=_0x3956ca['attributes'][_0xe551('0x39')]?_0x3956ca[_0xe551('0x36')]:_0x4309d5[_0xe551('0x32')];if(_0x109bd3[_0xe551('0x34')][_0xe551('0x42')]){_0x3956ca[_0xe551('0x43')]=[{'all':!![]}];}_0x3956ca=_[_0xe551('0x40')]({},_0x3956ca,_0x109bd3[_0xe551('0x41')]);return db[_0xe551('0x2d')][_0xe551('0x49')](_0x3956ca)[_0xe551('0x13')](handleEntityNotFound(_0x37d192,null))[_0xe551('0x13')](respondWithResult(_0x37d192,null))[_0xe551('0x1d')](handleError(_0x37d192,null));};exports[_0xe551('0x25')]=function(_0x1305d5,_0x32dcc0){if(_0x1305d5[_0xe551('0x4a')]['id']){delete _0x1305d5[_0xe551('0x4a')]['id'];}return db[_0xe551('0x2d')][_0xe551('0x49')]({'where':{'id':_0x1305d5[_0xe551('0x47')]['id']}})[_0xe551('0x13')](handleEntityNotFound(_0x32dcc0,null))[_0xe551('0x13')](saveUpdates(_0x1305d5['body'],null))[_0xe551('0x13')](respondWithResult(_0x32dcc0,null))[_0xe551('0x1d')](handleError(_0x32dcc0,null));};exports['destroy']=function(_0x56e467,_0x4b4e8e){return db[_0xe551('0x2d')][_0xe551('0x49')]({'where':{'id':_0x56e467[_0xe551('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b4e8e,null))['then'](removeEntity(_0x4b4e8e,null))[_0xe551('0x1d')](handleError(_0x4b4e8e,null));};exports[_0xe551('0x4b')]=function(_0x2088df,_0x943d38){return db['MailMessage'][_0xe551('0x4b')]()[_0xe551('0x13')](respondWithResult(_0x943d38,null))[_0xe551('0x1d')](handleError(_0x943d38,null));};exports[_0xe551('0x4c')]=function(_0x167af3,_0x15b40d){return db[_0xe551('0x2d')]['create'](_0x167af3[_0xe551('0x4a')])[_0xe551('0x13')](function(_0x4d599f){if(_0x4d599f){if(_0x4d599f['direction']===_0xe551('0x4d')&&!_0x4d599f[_0xe551('0x4e')]){var _0x4becdf,_0x86703e,_0x511e88;if(_0x167af3[_0xe551('0x4a')]['to']){_0x86703e=_0x167af3[_0xe551('0x4a')]['to'][_0xe551('0x4f')](',')[0x0];}return db[_0xe551('0x50')]['findOne']({'where':{'id':_0x4d599f[_0xe551('0x51')]},'include':[{'model':db[_0xe551('0x52')],'as':_0xe551('0x53'),'include':[{'model':db[_0xe551('0x54')],'as':'Contacts','where':{'email':_0x86703e},'limit':0x1,'order':[[_0xe551('0x55'),_0xe551('0x56')]]}]},{'model':db[_0xe551('0x57')],'as':_0xe551('0x58'),'raw':!![],'include':[{'model':db[_0xe551('0x59')],'as':'CloudProvider','raw':!![]}]}]})[_0xe551('0x13')](function(_0x508567){_0x4becdf=_0x508567;if(!_0x4becdf||!_0x4becdf['Smtp'])return;var _0x28d6cd=_0x4becdf['getSmtpOptions']();if(_0x167af3[_0xe551('0x4a')][_0xe551('0x5a')]&&_0x167af3[_0xe551('0x4a')][_0xe551('0x5a')]['length']){for(var _0x2ba225=0x0;_0x2ba225<_0x167af3['body']['attachments'][_0xe551('0x39')];_0x2ba225+=0x1){_0x167af3[_0xe551('0x4a')][_0xe551('0x5a')][_0x2ba225]={'filename':_0x167af3[_0xe551('0x4a')]['attachments'][_0x2ba225][_0xe551('0x2a')],'path':path[_0xe551('0x5b')](config[_0xe551('0x5c')],_0xe551('0x5d'),_0x167af3['body'][_0xe551('0x5a')][_0x2ba225][_0xe551('0x5e')])};}}_0x511e88={'account':_0x28d6cd,'message':_0x167af3[_0xe551('0x4a')]};return;})[_0xe551('0x13')](function(){if(_0x4becdf[_0xe551('0x53')]){if(_0x4becdf[_0xe551('0x53')][_0xe551('0x5f')][_0xe551('0x39')]){return _0x4becdf[_0xe551('0x53')][_0xe551('0x5f')][0x0];}else{return db[_0xe551('0x54')][_0xe551('0x4c')](_[_0xe551('0xc')](_0x167af3[_0xe551('0x4a')],{'firstName':_0x167af3[_0xe551('0x4a')]['to'],'email':_0x167af3['body']['to'],'phone':_0x167af3[_0xe551('0x4a')]['to'],'ListId':_0x4becdf[_0xe551('0x60')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xe551('0x13')](function(){if(_0x511e88){return respondWithRpcPromise(_0xe551('0x61'),_0xe551('0x62'),_0x511e88,client9003)['then'](function(_0x127116){return _0x4d599f[_0xe551('0x25')]({'read':!![],'messageId':_0x127116[_0xe551('0x63')],'sentAt':moment()['format'](_0xe551('0x64'))});})[_0xe551('0x1d')](function(_0x53fa9a){logger[_0xe551('0x19')]('%s',JSON['stringify'](_0x53fa9a));return _0x4d599f;});}return _0x4d599f;});}return _0x4d599f;}})[_0xe551('0x13')](respondWithResult(_0x15b40d,0xc9))[_0xe551('0x1d')](handleError(_0x15b40d,null));};exports['accept']=function(_0x43d456,_0x11a96a){var _0x374cf8={'agent':{},'channel':'mail'};if(_0x43d456['body']['id']){delete _0x43d456[_0xe551('0x4a')]['id'];}_0x43d456[_0xe551('0x4a')][_0xe551('0x65')]=!![];_0x43d456['body'][_0xe551('0x66')]=moment()[_0xe551('0x67')](_0xe551('0x64'));_0x43d456[_0xe551('0x4a')][_0xe551('0x68')]=_0x43d456['body']['UserId']||_0x43d456[_0xe551('0x69')]['id'];_0x374cf8[_0xe551('0x6a')]['id']=_0x43d456[_0xe551('0x4a')][_0xe551('0x68')];return db[_0xe551('0x2d')]['find']({'where':{'id':_0x43d456[_0xe551('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x11a96a,null))[_0xe551('0x13')](saveUpdates(_0x43d456['body'],null))[_0xe551('0x13')](function(_0x22ac86){if(_0x22ac86){_0x374cf8[_0xe551('0x1b')]=_0x22ac86[_0xe551('0x6b')]({'plain':!![]});return db[_0xe551('0x6c')][_0xe551('0x49')]({'where':{'id':_0x22ac86[_0xe551('0x6d')]}});}return null;})[_0xe551('0x13')](handleEntityNotFound(_0x11a96a,null))[_0xe551('0x13')](function(_0x4ec7cf){if(_0x4ec7cf){return _0x4ec7cf[_0xe551('0x25')]({'UserId':_0x43d456['body']['UserId'],'read1stAt':_[_0xe551('0x6e')](_0x4ec7cf[_0xe551('0x6f')])?moment()[_0xe551('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe551('0x13')](function(_0x5e6898){if(_0x5e6898){_0x374cf8[_0xe551('0x70')]=_0x5e6898[_0xe551('0x6b')]({'plain':!![]});interaction_log[_0xe551('0x71')](_0xe551('0x72'),_0x43d456[_0xe551('0x69')]['id'],_0x43d456[_0xe551('0x69')][_0xe551('0x2a')],_0x43d456[_0xe551('0x69')][_0xe551('0x73')],_0x374cf8[_0xe551('0x70')]['id'],_0x43d456[_0xe551('0x4a')]?JSON['stringify'](_0x43d456['body']):_0xe551('0x74'));return respondWithRpcPromise(_0xe551('0x75'),_0xe551('0x76'),_0x374cf8);}return null;})[_0xe551('0x13')](function(_0x3db257){var _0x11b327=_0xe551('0x77')+_0x3db257[_0xe551('0x1b')][_0xe551('0x78')];return db[_0xe551('0x79')][_0xe551('0x34')](_0x11b327,{'type':db[_0xe551('0x7a')][_0xe551('0x7b')][_0xe551('0x7c')],'raw':!![]})[_0xe551('0x13')](function(_0x417f6f){return _0x417f6f;});})[_0xe551('0x13')](function(_0x539c0e){if(_0x539c0e){_0x374cf8[_0xe551('0x1b')][_0xe551('0x7d')]=_0x539c0e[0x0];if(!_0x43d456[_0xe551('0x4a')][_0xe551('0x68')])return;return db[_0xe551('0x7e')][_0xe551('0x49')]({'where':{'id':_0x43d456[_0xe551('0x4a')][_0xe551('0x68')],'role':'agent'},'attributes':['id',_0xe551('0x2a'),'fullname',_0xe551('0x7f'),'internal'],'raw':!![]});}return null;})[_0xe551('0x13')](function(_0x553003){if(!_0x553003)return null;_0x374cf8[_0xe551('0x1b')]['agent']=_0x553003;return _0x374cf8;})[_0xe551('0x13')](function(_0x4c21e2){if(_0x4c21e2){if(_0x43d456[_0xe551('0x4a')][_0xe551('0x80')]){_0x374cf8[_0xe551('0x1b')][_0xe551('0x81')]=util[_0xe551('0x67')](_0xe551('0x82'),_0x43d456[_0xe551('0x69')]['name']);_0x374cf8[_0xe551('0x1b')]['channel']=_0x374cf8['channel'];_0x374cf8['message']['motionChannel']=_0x374cf8['channel'];_0x374cf8[_0xe551('0x1b')][_0xe551('0x83')]=_0xe551('0x84');_0x374cf8[_0xe551('0x1b')][_0xe551('0x4a')]=htmlToText[_0xe551('0x85')](_0x374cf8['message'][_0xe551('0x4a')]);return respondWithRpcPromise(_0xe551('0x86'),'EventManager',{'event':'acceptmessage','message':_0x374cf8[_0xe551('0x1b')]},client9002)[_0xe551('0x13')](function(){return _0x374cf8;});}return _0x374cf8;}return null;})[_0xe551('0x13')](respondWithResult(_0x11a96a,null))[_0xe551('0x1d')](handleError(_0x11a96a,null));};exports[_0xe551('0x87')]=function(_0x24b2ed,_0x16869c){var _0x545727={'agent':{},'channel':_0xe551('0x88')};if(_0x24b2ed[_0xe551('0x4a')]['id']){delete _0x24b2ed[_0xe551('0x4a')]['id'];}_0x24b2ed['body']['UserId']=_0x24b2ed[_0xe551('0x4a')]['UserId']||_0x24b2ed[_0xe551('0x69')]['id'];_0x545727[_0xe551('0x6a')]['id']=_0x24b2ed[_0xe551('0x4a')][_0xe551('0x68')];return db[_0xe551('0x2d')][_0xe551('0x49')]({'where':{'id':_0x24b2ed['params']['id'],'UserId':null}})[_0xe551('0x13')](handleEntityNotFound(_0x16869c,null))[_0xe551('0x13')](function(_0x3f002d){if(_0x3f002d){_0x545727['message']=_0x3f002d[_0xe551('0x6b')]({'plain':!![]});return db[_0xe551('0x6c')]['find']({'where':{'id':_0x3f002d['MailInteractionId']}});}return null;})[_0xe551('0x13')](handleEntityNotFound(_0x16869c,null))['then'](function(_0x50046a){if(_0x50046a){_0x545727['interaction']=_0x50046a[_0xe551('0x6b')]({'plain':!![]});interaction_log[_0xe551('0x71')](_0xe551('0x89'),_0x24b2ed[_0xe551('0x69')]['id'],_0x24b2ed[_0xe551('0x69')][_0xe551('0x2a')],_0x24b2ed['user']['role'],_0x545727[_0xe551('0x70')]['id'],_0x24b2ed[_0xe551('0x4a')]?JSON[_0xe551('0x18')](_0x24b2ed[_0xe551('0x4a')]):_0xe551('0x74'));return respondWithRpcPromise(_0xe551('0x8a'),_0xe551('0x8b'),_0x545727);}return null;})['then'](function(_0x117d3d){var _0x52512a=_0xe551('0x77')+_0x117d3d[_0xe551('0x1b')][_0xe551('0x78')];return db[_0xe551('0x79')]['query'](_0x52512a,{'type':db['Sequelize'][_0xe551('0x7b')][_0xe551('0x7c')],'raw':!![]})[_0xe551('0x13')](function(_0x2c37a9){return _0x2c37a9;});})['then'](function(_0x1f6888){if(_0x1f6888){_0x545727[_0xe551('0x1b')][_0xe551('0x7d')]=_0x1f6888[0x0];if(!_0x24b2ed[_0xe551('0x4a')][_0xe551('0x68')])return;return db[_0xe551('0x7e')][_0xe551('0x49')]({'where':{'id':_0x24b2ed[_0xe551('0x4a')]['UserId'],'role':_0xe551('0x6a')},'attributes':['id',_0xe551('0x2a'),_0xe551('0x8c'),_0xe551('0x7f'),'internal'],'raw':!![]});}return null;})[_0xe551('0x13')](function(_0x2c793b){if(!_0x2c793b)return null;_0x545727['message'][_0xe551('0x6a')]=_0x2c793b;return _0x545727;})[_0xe551('0x13')](function(_0x3203ed){if(_0x3203ed){_0x3203ed['message'][_0xe551('0x81')]=util['format'](_0xe551('0x82'),_0x24b2ed[_0xe551('0x69')][_0xe551('0x2a')]);_0x3203ed[_0xe551('0x1b')][_0xe551('0x8d')]=_0x545727[_0xe551('0x8d')];_0x3203ed[_0xe551('0x1b')][_0xe551('0x8e')]=_0x545727['channel'];_0x3203ed[_0xe551('0x1b')]['event']='reject';_0x3203ed[_0xe551('0x1b')]['body']=htmlToText[_0xe551('0x85')](_0x545727[_0xe551('0x1b')]['body']);respondWithRpcPromise('EventManager',_0xe551('0x86'),{'event':'rejectmessage','message':_0x3203ed['message']},client9002);return _0x545727;}return null;})[_0xe551('0x13')](respondWithResult(_0x16869c,null))[_0xe551('0x1d')](handleError(_0x16869c,null));};exports[_0xe551('0x8f')]=function(_0x195095,_0x56c888){var _0x5a2c83=moment()[_0xe551('0x90')]()[_0xe551('0x91')]();var _0x2bb3fd=path['join'](config['root'],_0xe551('0x92'),'files',_0xe551('0x93'));var _0x1d8168=path[_0xe551('0x5b')](config['root'],_0xe551('0x92'),'files',_0xe551('0x5a'));var _0xde90c=util[_0xe551('0x67')]('message-%s.eml',_0x5a2c83);return db[_0xe551('0x2d')][_0xe551('0x49')]({'where':{'id':_0x195095['params']['id']},'attributes':['id',_0xe551('0x4a'),_0xe551('0x94'),'to','cc',_0xe551('0x95'),_0xe551('0x96'),_0xe551('0x97')],'include':_0x195095[_0xe551('0x34')][_0xe551('0x5a')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0xe551('0x13')](handleEntityNotFound(_0x56c888,null))[_0xe551('0x13')](function(_0x28e108){if(_0x28e108){var _0x556fce=_0x28e108;var _0x171f85={'from':_0x556fce[_0xe551('0x94')],'to':_0x556fce['to'],'subject':_0x556fce[_0xe551('0x96')],'html':htmlEntities[_0xe551('0x98')](_0x556fce['body']),'headers':{'Date':moment(_0x556fce[_0xe551('0x97')])[_0xe551('0x67')](_0xe551('0x99'))},'attachments':[]};if(_0x28e108['cc']){_0x171f85['headers']['Cc']=_0x28e108['cc'];}if(_0x28e108['bcc']){_0x171f85[_0xe551('0x9a')][_0xe551('0x9b')]=_0x28e108['bcc'];}return new BPromise(function(_0x15ac2a,_0x5b123e){if(_0x28e108[_0xe551('0x9c')]){for(var _0x2ed947=0x0;_0x2ed947<_0x28e108[_0xe551('0x9c')][_0xe551('0x39')];_0x2ed947++){var _0x3f91bb=_0x28e108[_0xe551('0x9c')][_0x2ed947];var _0x371f3a=path[_0xe551('0x5b')](_0x1d8168,_0x3f91bb[_0xe551('0x5e')]);if(fs[_0xe551('0x9d')](_0x371f3a)){_0x171f85[_0xe551('0x5a')][_0xe551('0x9e')]({'name':_0x3f91bb['name'],'contentType':_0x3f91bb['type'],'data':fs['readFileSync'](_0x371f3a)});}}}emlformat[_0xe551('0x9f')](_0x171f85,function(_0x1e0a98,_0xea3a92){if(_0x1e0a98)return _0x5b123e(_0x1e0a98);fs[_0xe551('0xa0')](path['join'](_0x2bb3fd,_0xde90c),_0xea3a92);return _0x15ac2a(_0xea3a92);});});}})['then'](function(_0x3c7ef4){if(_0x3c7ef4){return _0x56c888[_0xe551('0x8f')](path[_0xe551('0x5b')](_0x2bb3fd,_0xde90c),_0xde90c,function(_0x1731f0){if(!_0x1731f0)fs['unlinkSync'](path[_0xe551('0x5b')](_0x2bb3fd,_0xde90c));});}})['catch'](handleError(_0x56c888,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 8ecc39c..e12241d 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 _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 +var _0x9a46=['remove','emit','hook','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x9a46,0x96));var _0x69a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9a46[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x69a4('0x0'))['db'][_0x69a4('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x69a4('0x2')](0x0);var events={'afterCreate':_0x69a4('0x3'),'afterUpdate':'update','afterDestroy':_0x69a4('0x4')};function emitEvent(_0x8d071f){return function(_0xa4dbb3,_0x3cd7fa,_0x1b157e){MailMessageEvents[_0x69a4('0x5')](_0x8d071f+':'+_0xa4dbb3['id'],_0xa4dbb3);MailMessageEvents[_0x69a4('0x5')](_0x8d071f,_0xa4dbb3);_0x1b157e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x69a4('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 3e80cc3..8752077 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 _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 +var _0x30b6=['api','moment','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger'];(function(_0x270379,_0x9447a6){var _0x27c093=function(_0x45afbf){while(--_0x45afbf){_0x270379['push'](_0x270379['shift']());}};_0x27c093(++_0x9447a6);}(_0x30b6,0x15d));var _0x630b=function(_0x573ace,_0x5f5c56){_0x573ace=_0x573ace-0x0;var _0x6059c1=_0x30b6[_0x573ace];return _0x6059c1;};'use strict';var _=require(_0x630b('0x0'));var util=require(_0x630b('0x1'));var logger=require(_0x630b('0x2'))(_0x630b('0x3'));var moment=require(_0x630b('0x4'));var BPromise=require('bluebird');var rp=require(_0x630b('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x630b('0x6'));var rimraf=require('rimraf');var config=require(_0x630b('0x7'));var attributes=require(_0x630b('0x8'));module[_0x630b('0x9')]=function(_0x29a465,_0x5eef57){return _0x29a465[_0x630b('0xa')](_0x630b('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x630b('0xc'),'fields':['messageId']},{'name':_0x630b('0xd'),'fields':['plainBody','subject'],'type':_0x630b('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x184922,_0x431e32,_0x2f9bb7){if(_0x184922[_0x630b('0xf')]){_0x184922['plainBody']=htmlToText[_0x630b('0x10')](_0x184922['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2f9bb7(null,_0x431e32);},'afterCreate':function(_0x109c3c,_0x47cac1,_0x4f611f){var _0x5426fd=_0x29a465[_0x630b('0x11')];var _0x3b5181=_0x109c3c[_0x630b('0x12')]({'plain':!![]});if(_0x3b5181['direction']['toLowerCase']()==='in'||_0x3b5181[_0x630b('0x13')][_0x630b('0x14')]()===_0x630b('0x15')&&!_0x3b5181[_0x630b('0x16')]&&!_[_0x630b('0x17')](_0x3b5181[_0x630b('0x18')])){_0x5426fd[_0x630b('0x19')]['findOne']({'where':{'id':_0x3b5181[_0x630b('0x1a')]}})[_0x630b('0x1b')](function(_0x2e8596){if(_0x2e8596){_0x2e8596['update']({'lastMsgAt':_0x3b5181[_0x630b('0x1c')],'lastMsgDirection':_0x3b5181[_0x630b('0x13')]['toLowerCase']()});}})[_0x630b('0x1d')](function(_0x494e22){console[_0x630b('0x1e')](_0x494e22);});}_0x4f611f();}},'charset':_0x630b('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 2bd2dc9..ccee61f 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 _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 +var _0xc900=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','MailMessage','body','options','raw','debug','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xc900,0xb3));var _0x0c90=function(_0x1cde46,_0x33ea78){_0x1cde46=_0x1cde46-0x0;var _0x2e8466=_0xc900[_0x1cde46];return _0x2e8466;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});config[_0x0c90('0xa')]=_['defaults'](config[_0x0c90('0xa')],{'host':_0x0c90('0xb'),'port':0x18eb});var socket=require(_0x0c90('0xc'))(new Redis(config[_0x0c90('0xa')]));require(_0x0c90('0xd'))[_0x0c90('0xe')](socket);function respondWithRpcPromise(_0x313ce9,_0x18d9fd,_0x3e0df6){return new BPromise(function(_0x34456e,_0x10daeb){return client[_0x0c90('0xf')](_0x313ce9,_0x3e0df6)[_0x0c90('0x10')](function(_0x57917b){logger[_0x0c90('0x11')]('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x0c90('0x12'));logger['debug'](_0x0c90('0x13'),_0x18d9fd,_0x0c90('0x12'),JSON[_0x0c90('0x14')](_0x57917b));if(_0x57917b[_0x0c90('0x15')]){if(_0x57917b[_0x0c90('0x15')]['code']===0x1f4){logger[_0x0c90('0x15')](_0x0c90('0x16'),_0x18d9fd,_0x57917b['error'][_0x0c90('0x17')]);return _0x10daeb(_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);return _0x34456e(_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);}else{logger[_0x0c90('0x11')](_0x0c90('0x16'),_0x18d9fd,_0x0c90('0x12'));_0x34456e(_0x57917b['result'][_0x0c90('0x17')]);}})[_0x0c90('0x18')](function(_0x462d49){logger[_0x0c90('0x15')]('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x462d49);_0x10daeb(_0x462d49);});});}exports[_0x0c90('0x19')]=function(_0xd129ca){var _0x143047=this;return new Promise(function(_0x1241a9,_0x315932){return db[_0x0c90('0x1a')]['create'](_0xd129ca[_0x0c90('0x1b')],{'raw':_0xd129ca['options']?_0xd129ca[_0x0c90('0x1c')][_0x0c90('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2a053a){logger[_0x0c90('0x11')](_0x0c90('0x19'),_0xd129ca);logger[_0x0c90('0x1e')](_0x0c90('0x19'),_0xd129ca,JSON[_0x0c90('0x14')](_0x2a053a));_0x1241a9(_0x2a053a);})['catch'](function(_0x26f0a3){logger[_0x0c90('0x15')]('CreateMailMessage',_0x26f0a3['message'],_0xd129ca);_0x315932(_0x143047[_0x0c90('0x15')](0x1f4,_0x26f0a3[_0x0c90('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 8f9f879..31abb3a 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 _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 +var _0x4ecf=['update','emit','removeListener','length','mailMessage:','./mailMessage.events','save'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x4ecf,0x186));var _0xf4ec=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x4ecf[_0x11005e];return _0x29338f;};'use strict';var MailMessageEvents=require(_0xf4ec('0x0'));var events=[_0xf4ec('0x1'),'remove',_0xf4ec('0x2')];function createListener(_0x5466d7,_0x4f2642){return function(_0x3d18ef){_0x4f2642[_0xf4ec('0x3')](_0x5466d7,_0x3d18ef);};}function removeListener(_0x544e14,_0x1da580){return function(){MailMessageEvents[_0xf4ec('0x4')](_0x544e14,_0x1da580);};}exports['register']=function(_0x124633){for(var _0x50aa86=0x0,_0x2a8988=events[_0xf4ec('0x5')];_0x50aa86<_0x2a8988;_0x50aa86++){var _0x213f0a=events[_0x50aa86];var _0x313c1e=createListener(_0xf4ec('0x6')+_0x213f0a,_0x124633);MailMessageEvents['on'](_0x213f0a,_0x313c1e);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a8a03db..9e5bef1 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 _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 +var _0xd154=['index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated'];(function(_0x1f3218,_0x565766){var _0x1970fd=function(_0x4b873f){while(--_0x4b873f){_0x1f3218['push'](_0x1f3218['shift']());}};_0x1970fd(++_0x565766);}(_0xd154,0x1d6));var _0x4d15=function(_0xefb7bc,_0x561d9e){_0xefb7bc=_0xefb7bc-0x0;var _0x1abb1e=_0xd154[_0xefb7bc];return _0x1abb1e;};'use strict';var multer=require(_0x4d15('0x0'));var util=require('util');var path=require(_0x4d15('0x1'));var timeout=require(_0x4d15('0x2'));var express=require(_0x4d15('0x3'));var router=express[_0x4d15('0x4')]();var fs_extra=require(_0x4d15('0x5'));var auth=require(_0x4d15('0x6'));var interaction=require(_0x4d15('0x7'));var config=require('../../config/environment');var controller=require(_0x4d15('0x8'));router['get']('/',auth[_0x4d15('0x9')](),controller[_0x4d15('0xa')]);router[_0x4d15('0xb')](_0x4d15('0xc'),auth[_0x4d15('0x9')](),controller[_0x4d15('0xd')]);router[_0x4d15('0xb')](_0x4d15('0xe'),auth[_0x4d15('0x9')](),controller[_0x4d15('0xf')]);router['get'](_0x4d15('0x10'),auth['isAuthenticated'](),controller[_0x4d15('0x11')]);router[_0x4d15('0xb')](_0x4d15('0x12'),auth['isAuthenticated'](),controller[_0x4d15('0x13')]);router[_0x4d15('0xb')](_0x4d15('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4d15('0x15')]('/',auth[_0x4d15('0x9')](),controller[_0x4d15('0x16')]);router['post'](_0x4d15('0x12'),auth[_0x4d15('0x9')](),controller[_0x4d15('0x17')]);router[_0x4d15('0x15')](_0x4d15('0x14'),auth[_0x4d15('0x9')](),controller[_0x4d15('0x18')]);router[_0x4d15('0x19')](_0x4d15('0xe'),auth[_0x4d15('0x9')](),controller[_0x4d15('0x1a')]);router[_0x4d15('0x1b')](_0x4d15('0xe'),auth[_0x4d15('0x9')](),controller[_0x4d15('0x1c')]);router[_0x4d15('0x1b')](_0x4d15('0x12'),auth[_0x4d15('0x9')](),controller[_0x4d15('0x1d')]);router[_0x4d15('0x1b')](_0x4d15('0x14'),auth[_0x4d15('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6431873..7e72194 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 _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 +var _0x5f9e=['ENUM','rrmemory','sequelize','exports','STRING','name','INTEGER'];(function(_0x5d1e86,_0x171397){var _0x3c9c68=function(_0x5eabde){while(--_0x5eabde){_0x5d1e86['push'](_0x5d1e86['shift']());}};_0x3c9c68(++_0x171397);}(_0x5f9e,0xaa));var _0xe5f9=function(_0x295a92,_0x7d70dc){_0x295a92=_0x295a92-0x0;var _0x3f5dac=_0x5f9e[_0x295a92];return _0x3f5dac;};'use strict';var Sequelize=require(_0xe5f9('0x0'));module[_0xe5f9('0x1')]={'name':{'type':Sequelize[_0xe5f9('0x2')],'unique':_0xe5f9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe5f9('0x2')]},'timeout':{'type':Sequelize[_0xe5f9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe5f9('0x5')](_0xe5f9('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7a3ef06..3ed03d8 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 _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 +var _0x9bbc=['sort','pick','MailQueueId','filter','options','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','addTeams','ids','Team','Agents','online','interface','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','UserProfileResource','end','error','name','send','map','MailQueue','rawAttributes','type','key','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','user','get','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','nolimit','order'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bbc,0x19d));var _0xc9bb=function(_0x145cdb,_0x5ecbe9){_0x145cdb=_0x145cdb-0x0;var _0x8ecb0b=_0x9bbc[_0x145cdb];return _0x8ecb0b;};'use strict';var BPromise=require('bluebird');var util=require(_0xc9bb('0x0'));var _=require(_0xc9bb('0x1'));var squel=require(_0xc9bb('0x2'));var Redis=require(_0xc9bb('0x3'));var qs=require(_0xc9bb('0x4'));var logger=require(_0xc9bb('0x5'))(_0xc9bb('0x6'));var config=require(_0xc9bb('0x7'));var db=require(_0xc9bb('0x8'))['db'];config['redis']=_[_0xc9bb('0x9')](config[_0xc9bb('0xa')],{'host':_0xc9bb('0xb'),'port':0x18eb});var socket=require(_0xc9bb('0xc'))(new Redis(config[_0xc9bb('0xa')]));require(_0xc9bb('0xd'))[_0xc9bb('0xe')](socket);function respondWithStatusCode(_0x34a868,_0x43ff07){_0x43ff07=_0x43ff07||0xcc;return function(_0x546c63){if(_0x546c63){return _0x34a868[_0xc9bb('0xf')](_0x43ff07);}return _0x34a868[_0xc9bb('0x10')](_0x43ff07)['end']();};}function respondWithResult(_0x1ebcbe,_0x4ac979){_0x4ac979=_0x4ac979||0xc8;return function(_0x250618){if(_0x250618){return _0x1ebcbe[_0xc9bb('0x10')](_0x4ac979)[_0xc9bb('0x11')](_0x250618);}};}function respondWithFilteredResult(_0xf33d9b,_0x52eff6){return function(_0x3ba670){if(_0x3ba670){var _0x160008=typeof _0x52eff6['offset']==='undefined'&&typeof _0x52eff6[_0xc9bb('0x12')]===_0xc9bb('0x13');var _0x3adf84=_0x3ba670[_0xc9bb('0x14')];var _0x8e5d02=_0x160008?0x0:_0x52eff6[_0xc9bb('0x15')];var _0x3c0eda=_0x160008?_0x3ba670['count']:_0x52eff6[_0xc9bb('0x15')]+_0x52eff6[_0xc9bb('0x12')];var _0x2b088d;if(_0x3c0eda>=_0x3adf84){_0x3c0eda=_0x3adf84;_0x2b088d=0xc8;}else{_0x2b088d=0xce;}_0xf33d9b[_0xc9bb('0x10')](_0x2b088d);return _0xf33d9b[_0xc9bb('0x16')](_0xc9bb('0x17'),_0x8e5d02+'-'+_0x3c0eda+'/'+_0x3adf84)[_0xc9bb('0x11')](_0x3ba670);}return null;};}function saveUpdates(_0x18e0fb){return function(_0x493ad9){if(_0x493ad9){return _0x493ad9[_0xc9bb('0x18')](_0x18e0fb)[_0xc9bb('0x19')](function(_0x4fd1c7){return _0x4fd1c7;});}return null;};}function removeEntity(_0x237332){return function(_0x306aad){if(_0x306aad){return _0x306aad[_0xc9bb('0x1a')]()[_0xc9bb('0x19')](function(){var _0x1a64e6=_0x306aad['get']({'plain':!![]});var _0x42ccfd='MailQueues';return db[_0xc9bb('0x1b')][_0xc9bb('0x1a')]({'where':{'type':_0x42ccfd,'resourceId':_0x1a64e6['id']}})[_0xc9bb('0x19')](function(){return _0x306aad;});})[_0xc9bb('0x19')](function(){_0x237332[_0xc9bb('0x10')](0xcc)[_0xc9bb('0x1c')]();});}};}function handleEntityNotFound(_0x2948a4){return function(_0x4fed30){if(!_0x4fed30){_0x2948a4[_0xc9bb('0xf')](0x194);}return _0x4fed30;};}function handleError(_0x4c8b95,_0x36d47d){_0x36d47d=_0x36d47d||0x1f4;return function(_0x41f3a3){logger[_0xc9bb('0x1d')](_0x41f3a3['stack']);if(_0x41f3a3['name']){delete _0x41f3a3[_0xc9bb('0x1e')];}_0x4c8b95[_0xc9bb('0x10')](_0x36d47d)[_0xc9bb('0x1f')](_0x41f3a3);};}exports['index']=function(_0x594459,_0x47aefc){var _0x36531b={};var _0x22d279={'count':0x0,'rows':[]};var _0x4dea71=_[_0xc9bb('0x20')](db[_0xc9bb('0x21')][_0xc9bb('0x22')],function(_0x5c8792){return{'name':_0x5c8792['fieldName'],'type':_0x5c8792[_0xc9bb('0x23')][_0xc9bb('0x24')]};});_0x36531b=qs['getOptions'](_0x4dea71,_0x594459);var _0x38c850={'where':_0x36531b[_0xc9bb('0x25')]};return db[_0xc9bb('0x21')]['count'](_0x38c850)['then'](function(_0x9a4d29){_0x22d279[_0xc9bb('0x14')]=_0x9a4d29;_0x36531b['include']=qs[_0xc9bb('0x26')](_0x594459[_0xc9bb('0x27')]);return db[_0xc9bb('0x21')][_0xc9bb('0x28')](_0x36531b);})[_0xc9bb('0x19')](function(_0x17d481){_0x22d279[_0xc9bb('0x29')]=_0x17d481;return _0x22d279;})['then'](respondWithFilteredResult(_0x47aefc,_0x36531b))[_0xc9bb('0x2a')](handleError(_0x47aefc,null));};exports[_0xc9bb('0x2b')]=function(_0x851256,_0x81a376){var _0x52aae9={'raw':!![],'where':{'id':_0x851256[_0xc9bb('0x2c')]['id']}},_0x4f6f16={};_0x4f6f16[_0xc9bb('0x2d')]=_[_0xc9bb('0x2e')](db['MailQueue'][_0xc9bb('0x22')]);_0x4f6f16['query']=_[_0xc9bb('0x2e')](_0x851256[_0xc9bb('0x27')]);_0x4f6f16[_0xc9bb('0x2f')]=_[_0xc9bb('0x30')](_0x4f6f16[_0xc9bb('0x2d')],_0x4f6f16[_0xc9bb('0x27')]);_0x52aae9[_0xc9bb('0x31')]=_[_0xc9bb('0x30')](_0x4f6f16['model'],qs['fields'](_0x851256[_0xc9bb('0x27')][_0xc9bb('0x32')]));_0x52aae9[_0xc9bb('0x31')]=_0x52aae9[_0xc9bb('0x31')][_0xc9bb('0x33')]?_0x52aae9[_0xc9bb('0x31')]:_0x4f6f16['model'];if(_0x851256[_0xc9bb('0x27')][_0xc9bb('0x34')]){_0x52aae9[_0xc9bb('0x26')]=[{'all':!![]}];}_0x52aae9=_[_0xc9bb('0x35')]({},_0x52aae9,_0x851256['options']);return db[_0xc9bb('0x21')][_0xc9bb('0x36')](_0x52aae9)[_0xc9bb('0x19')](handleEntityNotFound(_0x81a376,null))[_0xc9bb('0x19')](respondWithResult(_0x81a376,null))[_0xc9bb('0x2a')](handleError(_0x81a376,null));};exports[_0xc9bb('0x37')]=function(_0x4eb9b9,_0xdc37ee){return db['MailQueue'][_0xc9bb('0x37')](_0x4eb9b9[_0xc9bb('0x38')],{})[_0xc9bb('0x19')](function(_0x2e44bd){var _0x496042=_0x4eb9b9[_0xc9bb('0x39')][_0xc9bb('0x3a')]({'plain':!![]});if(!_0x496042)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x496042[_0xc9bb('0x3b')]===_0xc9bb('0x39')){var _0x47ce76=_0x2e44bd[_0xc9bb('0x3a')]({'plain':!![]});var _0x5d02ec=_0xc9bb('0x3c');return db[_0xc9bb('0x3d')][_0xc9bb('0x36')]({'where':{'name':_0x5d02ec,'userProfileId':_0x496042[_0xc9bb('0x3e')]},'raw':!![]})[_0xc9bb('0x19')](function(_0x58fccf){if(_0x58fccf&&_0x58fccf[_0xc9bb('0x3f')]===0x0){return db[_0xc9bb('0x1b')][_0xc9bb('0x37')]({'name':_0x47ce76[_0xc9bb('0x1e')],'resourceId':_0x47ce76['id'],'type':_0x58fccf[_0xc9bb('0x1e')],'sectionId':_0x58fccf['id']},{})[_0xc9bb('0x19')](function(){return _0x2e44bd;});}else{return _0x2e44bd;}})[_0xc9bb('0x2a')](function(_0xe92073){logger[_0xc9bb('0x1d')](_0xc9bb('0x40'),_0xe92073);throw _0xe92073;});}return _0x2e44bd;})[_0xc9bb('0x19')](respondWithResult(_0xdc37ee,0xc9))[_0xc9bb('0x2a')](handleError(_0xdc37ee,null));};exports['update']=function(_0x3cff06,_0x3ca141){if(_0x3cff06[_0xc9bb('0x38')]['id']){delete _0x3cff06['body']['id'];}return db[_0xc9bb('0x21')][_0xc9bb('0x36')]({'where':{'id':_0x3cff06[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x3ca141,null))[_0xc9bb('0x19')](saveUpdates(_0x3cff06[_0xc9bb('0x38')],null))[_0xc9bb('0x19')](respondWithResult(_0x3ca141,null))['catch'](handleError(_0x3ca141,null));};exports[_0xc9bb('0x1a')]=function(_0x416587,_0x41b4a1){return db[_0xc9bb('0x21')]['find']({'where':{'id':_0x416587[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x41b4a1,null))[_0xc9bb('0x19')](removeEntity(_0x41b4a1,null))[_0xc9bb('0x2a')](handleError(_0x41b4a1,null));};exports[_0xc9bb('0x41')]=function(_0x54f170,_0x147b41){return db[_0xc9bb('0x21')][_0xc9bb('0x41')]()['then'](respondWithResult(_0x147b41,null))[_0xc9bb('0x2a')](handleError(_0x147b41,null));};exports[_0xc9bb('0x42')]=function(_0x3ef9bb,_0x17c050){var _0xe97116={'raw':!![],'where':{}},_0x1e06fc={},_0x216020;return db[_0xc9bb('0x21')][_0xc9bb('0x43')]({'where':{'id':_0x3ef9bb[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x17c050,null))['then'](function(_0x55e247){if(_0x55e247){_0x216020=_0x55e247[_0xc9bb('0x3a')]({'plain':!![]});_0x1e06fc[_0xc9bb('0x2d')]=_[_0xc9bb('0x2e')](db[_0xc9bb('0x44')]['rawAttributes']);_0x1e06fc[_0xc9bb('0x27')]=_[_0xc9bb('0x2e')](_0x3ef9bb[_0xc9bb('0x27')]);_0x1e06fc[_0xc9bb('0x2f')]=_[_0xc9bb('0x30')](_0x1e06fc[_0xc9bb('0x2d')],_0x1e06fc[_0xc9bb('0x27')]);_0xe97116['attributes']=_[_0xc9bb('0x30')](_0x1e06fc['model'],qs['fields'](_0x3ef9bb[_0xc9bb('0x27')]['fields']));_0xe97116[_0xc9bb('0x31')]=_0xe97116[_0xc9bb('0x31')][_0xc9bb('0x33')]?_0xe97116['attributes']:_0x1e06fc['model'];if(!_0x3ef9bb[_0xc9bb('0x27')]['hasOwnProperty'](_0xc9bb('0x45'))){_0xe97116[_0xc9bb('0x12')]=qs['limit'](_0x3ef9bb[_0xc9bb('0x27')][_0xc9bb('0x12')]);_0xe97116['offset']=qs[_0xc9bb('0x15')](_0x3ef9bb[_0xc9bb('0x27')][_0xc9bb('0x15')]);}_0xe97116[_0xc9bb('0x46')]=qs[_0xc9bb('0x47')](_0x3ef9bb[_0xc9bb('0x27')][_0xc9bb('0x47')]);_0xe97116[_0xc9bb('0x25')]=qs['filters'](_[_0xc9bb('0x48')](_0x3ef9bb['query'],_0x1e06fc['filters']));_0xe97116[_0xc9bb('0x25')][_0xc9bb('0x49')]=_0x55e247['id'];if(_0x3ef9bb[_0xc9bb('0x27')]['filter']){_0xe97116[_0xc9bb('0x25')]=_[_0xc9bb('0x35')](_0xe97116['where'],{'$or':_[_0xc9bb('0x20')](_0xe97116[_0xc9bb('0x31')],function(_0x58e11f){var _0x482bce={};_0x482bce[_0x58e11f]={'$like':'%'+_0x3ef9bb[_0xc9bb('0x27')][_0xc9bb('0x4a')]+'%'};return _0x482bce;})});}_0xe97116=_[_0xc9bb('0x35')]({},_0xe97116,_0x3ef9bb[_0xc9bb('0x4b')]);return db[_0xc9bb('0x44')][_0xc9bb('0x28')](_0xe97116);}})['then'](function(_0x30021d){if(_0x30021d){return db[_0xc9bb('0x4c')][_0xc9bb('0x4d')]({'where':{'id':_[_0xc9bb('0x20')](_0x30021d,_0xc9bb('0x4e')),'role':'agent'},'attributes':['id',_0xc9bb('0x1e'),_0xc9bb('0x4f'),_0xc9bb('0x50'),_0xc9bb('0x51')]});}})['then'](function(_0x15ff7c){if(_0x15ff7c){return{'count':_0x15ff7c[_0xc9bb('0x14')],'rows':_[_0xc9bb('0x20')](_0x15ff7c[_0xc9bb('0x29')],function(_0x20c3cf){return{'membername':_0x20c3cf[_0xc9bb('0x1e')],'UserId':_0x20c3cf['id'],'queue_name':_0x216020['name'],'MailQueueId':_0x216020['id'],'interface':util[_0xc9bb('0x52')]('%s/%s',_0xc9bb('0x53'),_0x20c3cf[_0xc9bb('0x1e')]),'penalty':0x0,'paused':_0x20c3cf[_0xc9bb('0x4f')],'createdAt':_0x20c3cf[_0xc9bb('0x51')],'updatedAt':_0x20c3cf['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc9bb('0x19')](respondWithFilteredResult(_0x17c050,_0xe97116))[_0xc9bb('0x2a')](handleError(_0x17c050,null));};exports['getTeams']=function(_0x2e7eef,_0x14afc7){var _0x904ee3={};var _0x3458b9={};var _0x5caac8;var _0x2c14c2;return db['MailQueue'][_0xc9bb('0x43')]({'where':{'id':_0x2e7eef[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x14afc7,null))[_0xc9bb('0x19')](function(_0x5b98e4){if(_0x5b98e4){_0x5caac8=_0x5b98e4;_0x3458b9[_0xc9bb('0x2d')]=_[_0xc9bb('0x2e')](db['Team'][_0xc9bb('0x22')]);_0x3458b9['query']=_['keys'](_0x2e7eef[_0xc9bb('0x27')]);_0x3458b9[_0xc9bb('0x2f')]=_['intersection'](_0x3458b9[_0xc9bb('0x2d')],_0x3458b9['query']);_0x904ee3[_0xc9bb('0x31')]=_['intersection'](_0x3458b9[_0xc9bb('0x2d')],qs[_0xc9bb('0x32')](_0x2e7eef[_0xc9bb('0x27')][_0xc9bb('0x32')]));_0x904ee3['attributes']=_0x904ee3[_0xc9bb('0x31')][_0xc9bb('0x33')]?_0x904ee3[_0xc9bb('0x31')]:_0x3458b9[_0xc9bb('0x2d')];_0x904ee3[_0xc9bb('0x46')]=qs['sort'](_0x2e7eef[_0xc9bb('0x27')][_0xc9bb('0x47')]);_0x904ee3[_0xc9bb('0x25')]=qs['filters'](_[_0xc9bb('0x48')](_0x2e7eef[_0xc9bb('0x27')],_0x3458b9[_0xc9bb('0x2f')]));if(_0x2e7eef[_0xc9bb('0x27')]['filter']){_0x904ee3[_0xc9bb('0x25')]=_['merge'](_0x904ee3[_0xc9bb('0x25')],{'$or':_['map'](_0x904ee3[_0xc9bb('0x31')],function(_0x15056f){var _0x52917f={};_0x52917f[_0x15056f]={'$like':'%'+_0x2e7eef['query']['filter']+'%'};return _0x52917f;})});}_0x904ee3=_[_0xc9bb('0x35')]({},_0x904ee3,_0x2e7eef['options']);return _0x5caac8['getTeams'](_0x904ee3);}})[_0xc9bb('0x19')](function(_0x584c21){if(_0x584c21){_0x2c14c2=_0x584c21['length'];if(!_0x2e7eef[_0xc9bb('0x27')]['hasOwnProperty']('nolimit')){_0x904ee3['limit']=qs['limit'](_0x2e7eef[_0xc9bb('0x27')][_0xc9bb('0x12')]);_0x904ee3[_0xc9bb('0x15')]=qs[_0xc9bb('0x15')](_0x2e7eef[_0xc9bb('0x27')][_0xc9bb('0x15')]);}return _0x5caac8['getTeams'](_0x904ee3);}})[_0xc9bb('0x19')](function(_0xd81297){if(_0xd81297){return _0xd81297?{'count':_0x2c14c2,'rows':_0xd81297}:null;}})[_0xc9bb('0x19')](respondWithResult(_0x14afc7,null))['catch'](handleError(_0x14afc7,null));};exports[_0xc9bb('0x54')]=function(_0x360e88,_0x135c49){var _0x3d6752=_0x360e88[_0xc9bb('0x38')][_0xc9bb('0x55')];return db[_0xc9bb('0x56')][_0xc9bb('0x28')]({'where':{'id':_0x3d6752},'attributes':['id'],'include':[{'model':db[_0xc9bb('0x4c')],'as':_0xc9bb('0x57'),'attributes':['id',_0xc9bb('0x1e'),_0xc9bb('0x58'),'voicePause',_0xc9bb('0x59')],'raw':!![]}]})[_0xc9bb('0x19')](function(_0x4ecc95){if(_0x4ecc95){var _0x43ce3b=_['flatMap'](_0x4ecc95,function(_0x4d803d){var _0x21edd6=_0x4d803d[_0xc9bb('0x3a')]({'plain':!![]});return _0x21edd6['Agents'];});return db[_0xc9bb('0x21')][_0xc9bb('0x36')]({'where':{'id':_0x360e88['params']['id']}})[_0xc9bb('0x19')](function(_0x514bd2){return db[_0xc9bb('0x5a')][_0xc9bb('0x5b')](function(_0x14f4b5){return _0x514bd2[_0xc9bb('0x54')](_0x3d6752,{'transaction':_0x14f4b5})['then'](function(){return BPromise['each'](_0x43ce3b,function(_0x4654d6){return db[_0xc9bb('0x44')][_0xc9bb('0x5c')]({'where':{'UserId':_0x4654d6['id'],'MailQueueId':_0x360e88['params']['id']},'transaction':_0x14f4b5});});})['then'](function(){_0x43ce3b[_0xc9bb('0x5d')](function(_0x506af2){socket[_0xc9bb('0x5e')](_0xc9bb('0x5f'),{'UserId':_0x506af2['id'],'MailQueueId':_0x514bd2['id']});});});});});}})[_0xc9bb('0x19')](respondWithStatusCode(_0x135c49,null))[_0xc9bb('0x2a')](handleError(_0x135c49,null));};exports[_0xc9bb('0x60')]=function(_0x59fb4c,_0x37855b){return db[_0xc9bb('0x56')][_0xc9bb('0x28')]({'where':{'id':_0x59fb4c[_0xc9bb('0x27')][_0xc9bb('0x55')]},'attributes':['id'],'include':[{'model':db[_0xc9bb('0x4c')],'as':_0xc9bb('0x57'),'attributes':['id'],'raw':!![]}]})[_0xc9bb('0x19')](handleEntityNotFound(_0x37855b,null))[_0xc9bb('0x19')](function(_0x4a362e){var _0x56863a=_['map'](_0x4a362e,'id');var _0x198d54=[];var _0x2d81be=[];var _0x5bcc79=squel['select']();_0x5bcc79[_0xc9bb('0x61')]('tq.TeamId')[_0xc9bb('0x62')](_0xc9bb('0x63'),'tq')[_0xc9bb('0x64')](_0xc9bb('0x65'),'ut',_0xc9bb('0x66'))[_0xc9bb('0x25')](_0xc9bb('0x67'),_0x59fb4c['params']['id']);for(var _0x388756=0x0;_0x388756<_0x4a362e['length'];_0x388756+=0x1){let _0x46eb51=_0x4a362e[_0x388756];for(var _0xfd5d37=0x0;_0xfd5d37<_0x46eb51[_0xc9bb('0x57')][_0xc9bb('0x33')];_0xfd5d37+=0x1){let _0x2257ab=_0x46eb51[_0xc9bb('0x57')][_0xfd5d37];var _0xd93236=_0x5bcc79['clone']();_0xd93236[_0xc9bb('0x25')](_0xc9bb('0x68'),_0x2257ab['id']);_0x2d81be[_0xc9bb('0x69')](db[_0xc9bb('0x5a')][_0xc9bb('0x27')](_0xd93236[_0xc9bb('0x6a')](),{'type':db[_0xc9bb('0x5a')][_0xc9bb('0x6b')][_0xc9bb('0x6c')]})['then'](function(_0x3d4075){if(_0x3d4075['length']===0x1){return _0x2257ab['id'];}else{var _0x4ed7bb=_[_0xc9bb('0x6d')](_['map'](_0x3d4075,_0xc9bb('0x6e')),function(_0x27b539){return _[_0xc9bb('0x6f')](_0x56863a,_0x27b539);});if(_0x4ed7bb){return _0x2257ab['id'];}}}));}}return BPromise['all'](_0x2d81be)[_0xc9bb('0x19')](function(_0x3f104d){_0x198d54=_(_0x198d54)['union'](_0x3f104d)[_0xc9bb('0x70')]()[_0xc9bb('0x71')]();return db[_0xc9bb('0x21')][_0xc9bb('0x36')]({'where':{'id':_0x59fb4c[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](function(_0x4a7a07){return db[_0xc9bb('0x5a')][_0xc9bb('0x5b')](function(_0x282993){return _0x4a7a07[_0xc9bb('0x60')](_0x59fb4c['query']['ids'],{'transaction':_0x282993})['then'](function(){if(!_[_0xc9bb('0x72')](_0x198d54)){return _0x4a7a07[_0xc9bb('0x73')](_0x198d54,{'transaction':_0x282993});}})[_0xc9bb('0x19')](function(){_0x198d54[_0xc9bb('0x5d')](function(_0x4ecdbd){socket[_0xc9bb('0x5e')](_0xc9bb('0x74'),{'UserId':_0x4ecdbd,'MailQueueId':_0x4a7a07['id']});});});});});});})[_0xc9bb('0x19')](respondWithStatusCode(_0x37855b,null))['catch'](handleError(_0x37855b,null));};exports[_0xc9bb('0x75')]=function(_0x3a7c9e,_0x1da6f3){return db['MailQueue'][_0xc9bb('0x36')]({'where':{'id':_0x3a7c9e[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x1da6f3,null))[_0xc9bb('0x19')](function(_0x118416){if(_0x118416){return _0x118416[_0xc9bb('0x75')](_0x3a7c9e[_0xc9bb('0x38')][_0xc9bb('0x55')],_['omit'](_0x3a7c9e[_0xc9bb('0x38')],['ids','id'])||{})[_0xc9bb('0x76')](function(_0x3531f1){for(var _0x1fc5a1=0x0;_0x1fc5a1<_0x3a7c9e[_0xc9bb('0x38')][_0xc9bb('0x55')][_0xc9bb('0x33')];_0x1fc5a1+=0x1){socket[_0xc9bb('0x5e')](_0xc9bb('0x5f'),{'UserId':Number(_0x3a7c9e['body'][_0xc9bb('0x55')][_0x1fc5a1]),'MailQueueId':Number(_0x3a7c9e[_0xc9bb('0x2c')]['id'])});}return _0x3531f1;});}})['then'](respondWithResult(_0x1da6f3,null))[_0xc9bb('0x2a')](handleError(_0x1da6f3,null));};exports[_0xc9bb('0x73')]=function(_0x32d47e,_0xd54973){return db['MailQueue'][_0xc9bb('0x36')]({'where':{'id':_0x32d47e[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0xd54973,null))[_0xc9bb('0x19')](function(_0x58a996){if(_0x58a996){return _0x58a996[_0xc9bb('0x73')](_0x32d47e[_0xc9bb('0x27')][_0xc9bb('0x55')])[_0xc9bb('0x19')](function(){if(_[_0xc9bb('0x77')](_0x32d47e[_0xc9bb('0x27')][_0xc9bb('0x55')])){for(var _0x2ead35=0x0;_0x2ead35<_0x32d47e[_0xc9bb('0x27')][_0xc9bb('0x55')][_0xc9bb('0x33')];_0x2ead35+=0x1){socket[_0xc9bb('0x5e')]('userMailQueue:remove',{'UserId':Number(_0x32d47e[_0xc9bb('0x27')][_0xc9bb('0x55')][_0x2ead35]),'MailQueueId':Number(_0x32d47e['params']['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x32d47e[_0xc9bb('0x27')][_0xc9bb('0x55')]),'MailQueueId':Number(_0x32d47e[_0xc9bb('0x2c')]['id'])});}});}})[_0xc9bb('0x19')](respondWithStatusCode(_0xd54973,null))['catch'](handleError(_0xd54973,null));};exports[_0xc9bb('0x78')]=function(_0xb7c3f0,_0x55fea4){var _0xb9c28b={};var _0x44c0ff={};var _0x57c090;var _0x57800e;return db['MailQueue'][_0xc9bb('0x43')]({'where':{'id':_0xb7c3f0['params']['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x55fea4,null))[_0xc9bb('0x19')](function(_0x330e08){if(_0x330e08){_0x57c090=_0x330e08;_0x44c0ff['model']=_['keys'](db[_0xc9bb('0x4c')][_0xc9bb('0x22')]);_0x44c0ff['query']=_[_0xc9bb('0x2e')](_0xb7c3f0[_0xc9bb('0x27')]);_0x44c0ff[_0xc9bb('0x2f')]=_[_0xc9bb('0x30')](_0x44c0ff['model'],_0x44c0ff[_0xc9bb('0x27')]);_0xb9c28b[_0xc9bb('0x31')]=_[_0xc9bb('0x30')](_0x44c0ff[_0xc9bb('0x2d')],qs[_0xc9bb('0x32')](_0xb7c3f0[_0xc9bb('0x27')]['fields']));_0xb9c28b[_0xc9bb('0x31')]=_0xb9c28b[_0xc9bb('0x31')][_0xc9bb('0x33')]?_0xb9c28b['attributes']:_0x44c0ff[_0xc9bb('0x2d')];_0xb9c28b[_0xc9bb('0x46')]=qs[_0xc9bb('0x47')](_0xb7c3f0['query'][_0xc9bb('0x47')]);_0xb9c28b['where']=qs[_0xc9bb('0x2f')](_[_0xc9bb('0x48')](_0xb7c3f0[_0xc9bb('0x27')],_0x44c0ff['filters']));if(_0xb7c3f0[_0xc9bb('0x27')][_0xc9bb('0x4a')]){_0xb9c28b[_0xc9bb('0x25')]=_[_0xc9bb('0x35')](_0xb9c28b[_0xc9bb('0x25')],{'$or':_['map'](_0xb9c28b[_0xc9bb('0x31')],function(_0x473912){var _0x5c269a={};_0x5c269a[_0x473912]={'$like':'%'+_0xb7c3f0['query']['filter']+'%'};return _0x5c269a;})});}_0xb9c28b=_[_0xc9bb('0x35')]({},_0xb9c28b,_0xb7c3f0[_0xc9bb('0x4b')]);return _0x57c090[_0xc9bb('0x78')](_0xb9c28b);}})['then'](function(_0x133aa1){if(_0x133aa1){_0x57800e=_0x133aa1[_0xc9bb('0x33')];if(!_0xb7c3f0[_0xc9bb('0x27')]['hasOwnProperty'](_0xc9bb('0x45'))){_0xb9c28b['limit']=qs[_0xc9bb('0x12')](_0xb7c3f0[_0xc9bb('0x27')]['limit']);_0xb9c28b[_0xc9bb('0x15')]=qs['offset'](_0xb7c3f0[_0xc9bb('0x27')][_0xc9bb('0x15')]);}return _0x57c090['getAgents'](_0xb9c28b);}})[_0xc9bb('0x19')](function(_0x33fddf){if(_0x33fddf){return _0x33fddf?{'count':_0x57800e,'rows':_0x33fddf}:null;}})['then'](respondWithResult(_0x55fea4,null))[_0xc9bb('0x2a')](handleError(_0x55fea4,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5030b5e..41a6cea 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 _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 +var _0xf616=['remove','emit','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x136c6f,_0xc147b0){var _0x2ec4b1=function(_0x1b5024){while(--_0x1b5024){_0x136c6f['push'](_0x136c6f['shift']());}};_0x2ec4b1(++_0xc147b0);}(_0xf616,0xd6));var _0x6f61=function(_0xdd90ef,_0x361c65){_0xdd90ef=_0xdd90ef-0x0;var _0x2f4143=_0xf616[_0xdd90ef];return _0x2f4143;};'use strict';var EventEmitter=require(_0x6f61('0x0'));var MailQueue=require(_0x6f61('0x1'))['db'][_0x6f61('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6f61('0x3')](0x0);var events={'afterCreate':_0x6f61('0x4'),'afterUpdate':_0x6f61('0x5'),'afterDestroy':_0x6f61('0x6')};function emitEvent(_0x784bd8){return function(_0x58b799,_0x231d7a,_0x1f0fe8){MailQueueEvents[_0x6f61('0x7')](_0x784bd8+':'+_0x58b799['id'],_0x58b799);MailQueueEvents['emit'](_0x784bd8,_0x58b799);_0x1f0fe8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x6f61('0x8')](e,emitEvent(event));}}module[_0x6f61('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8a38ab7..d1ddd1b 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 _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 +var _0x6fd2=['exports','define','MailQueue','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0xfd5a9c,_0x1b081e){var _0x2b88b9=function(_0x450f61){while(--_0x450f61){_0xfd5a9c['push'](_0xfd5a9c['shift']());}};_0x2b88b9(++_0x1b081e);}(_0x6fd2,0x66));var _0x26fd=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x6fd2[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x26fd('0x0'));var util=require('util');var logger=require(_0x26fd('0x1'))(_0x26fd('0x2'));var moment=require('moment');var BPromise=require(_0x26fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26fd('0x4'));var rimraf=require(_0x26fd('0x5'));var config=require(_0x26fd('0x6'));var attributes=require(_0x26fd('0x7'));module[_0x26fd('0x8')]=function(_0x1dad71,_0x48822f){return _0x1dad71[_0x26fd('0x9')](_0x26fd('0xa'),attributes,{'tableName':'mail_queues','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 94f9910..113a53f 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 _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 +var _0x9f29=['ShowMailQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','options','attributes','limit','include','map','model','then'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x9f29,0x1b1));var _0x99f2=function(_0x1f4eca,_0x204969){_0x1f4eca=_0x1f4eca-0x0;var _0x25c7d1=_0x9f29[_0x1f4eca];return _0x25c7d1;};'use strict';var _=require(_0x99f2('0x0'));var util=require('util');var moment=require(_0x99f2('0x1'));var BPromise=require(_0x99f2('0x2'));var rs=require(_0x99f2('0x3'));var fs=require('fs');var Redis=require(_0x99f2('0x4'));var db=require(_0x99f2('0x5'))['db'];var utils=require(_0x99f2('0x6'));var logger=require(_0x99f2('0x7'))(_0x99f2('0x8'));var config=require(_0x99f2('0x9'));var jayson=require(_0x99f2('0xa'));var client=jayson[_0x99f2('0xb')][_0x99f2('0xc')]({'port':0x232a});config[_0x99f2('0xd')]=_[_0x99f2('0xe')](config['redis'],{'host':_0x99f2('0xf'),'port':0x18eb});var socket=require(_0x99f2('0x10'))(new Redis(config[_0x99f2('0xd')]));require(_0x99f2('0x11'))[_0x99f2('0x12')](socket);function respondWithRpcPromise(_0xf1ae9e,_0x482bb7,_0x2d4d29){return new BPromise(function(_0x43f8bf,_0x26c244){return client[_0x99f2('0x13')](_0xf1ae9e,_0x2d4d29)['then'](function(_0x3a9d49){logger[_0x99f2('0x14')](_0x99f2('0x15'),_0x482bb7,'request\x20sent');logger[_0x99f2('0x16')](_0x99f2('0x17'),_0x482bb7,_0x99f2('0x18'),JSON[_0x99f2('0x19')](_0x3a9d49));if(_0x3a9d49[_0x99f2('0x1a')]){if(_0x3a9d49[_0x99f2('0x1a')][_0x99f2('0x1b')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x482bb7,_0x3a9d49[_0x99f2('0x1a')][_0x99f2('0x1c')]);return _0x26c244(_0x3a9d49[_0x99f2('0x1a')][_0x99f2('0x1c')]);}logger[_0x99f2('0x1a')](_0x99f2('0x15'),_0x482bb7,_0x3a9d49[_0x99f2('0x1a')][_0x99f2('0x1c')]);return _0x43f8bf(_0x3a9d49['error'][_0x99f2('0x1c')]);}else{logger[_0x99f2('0x14')](_0x99f2('0x15'),_0x482bb7,_0x99f2('0x18'));_0x43f8bf(_0x3a9d49[_0x99f2('0x1d')]['message']);}})[_0x99f2('0x1e')](function(_0x513612){logger[_0x99f2('0x1a')]('MailQueue,\x20%s,\x20%s',_0x482bb7,_0x513612);_0x26c244(_0x513612);});});}exports[_0x99f2('0x1f')]=function(_0x720d65){var _0x222d55=this;return new Promise(function(_0x2fced3,_0x3103c1){return db[_0x99f2('0x20')]['findAll']({'raw':_0x720d65[_0x99f2('0x21')]?_0x720d65[_0x99f2('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x720d65[_0x99f2('0x21')]?_0x720d65[_0x99f2('0x21')]['where']||null:null,'attributes':_0x720d65[_0x99f2('0x21')]?_0x720d65[_0x99f2('0x21')][_0x99f2('0x22')]||null:null,'limit':_0x720d65[_0x99f2('0x21')]?_0x720d65[_0x99f2('0x21')][_0x99f2('0x23')]||null:null,'include':_0x720d65['options']?_0x720d65[_0x99f2('0x21')][_0x99f2('0x24')]?_[_0x99f2('0x25')](_0x720d65[_0x99f2('0x21')][_0x99f2('0x24')],function(_0x44afe0){return{'model':db[_0x44afe0[_0x99f2('0x26')]],'as':_0x44afe0['as'],'attributes':_0x44afe0[_0x99f2('0x22')],'include':_0x44afe0[_0x99f2('0x24')]?_[_0x99f2('0x25')](_0x44afe0[_0x99f2('0x24')],function(_0x325362){return{'model':db[_0x325362[_0x99f2('0x26')]],'as':_0x325362['as'],'attributes':_0x325362['attributes'],'include':_0x325362[_0x99f2('0x24')]?_[_0x99f2('0x25')](_0x325362['include'],function(_0x1021b5){return{'model':db[_0x1021b5[_0x99f2('0x26')]],'as':_0x1021b5['as'],'attributes':_0x1021b5[_0x99f2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x99f2('0x27')](function(_0x434eea){logger[_0x99f2('0x14')]('GetMailQueue',_0x720d65);logger[_0x99f2('0x16')]('GetMailQueue',_0x720d65,JSON['stringify'](_0x434eea));_0x2fced3(_0x434eea);})[_0x99f2('0x1e')](function(_0x303349){logger[_0x99f2('0x1a')](_0x99f2('0x1f'),_0x303349[_0x99f2('0x1c')],_0x720d65);_0x3103c1(_0x222d55[_0x99f2('0x1a')](0x1f4,_0x303349[_0x99f2('0x1c')]));});});};exports[_0x99f2('0x28')]=function(_0x2d6c2e){var _0x1b673a=this;return new Promise(function(_0x176d2c,_0x32790b){return db['MailQueue'][_0x99f2('0x29')]({'raw':_0x2d6c2e[_0x99f2('0x21')]?_0x2d6c2e[_0x99f2('0x21')][_0x99f2('0x2a')]===undefined?!![]:![]:!![],'where':_0x2d6c2e[_0x99f2('0x21')]?_0x2d6c2e['options']['where']||null:null,'attributes':_0x2d6c2e[_0x99f2('0x21')]?_0x2d6c2e[_0x99f2('0x21')][_0x99f2('0x22')]||null:null,'include':_0x2d6c2e[_0x99f2('0x21')]?_0x2d6c2e[_0x99f2('0x21')][_0x99f2('0x24')]?_['map'](_0x2d6c2e[_0x99f2('0x21')]['include'],function(_0x36b4c2){return{'model':db[_0x36b4c2[_0x99f2('0x26')]],'as':_0x36b4c2['as'],'attributes':_0x36b4c2['attributes'],'include':_0x36b4c2[_0x99f2('0x24')]?_['map'](_0x36b4c2[_0x99f2('0x24')],function(_0x1d3faf){return{'model':db[_0x1d3faf['model']],'as':_0x1d3faf['as'],'attributes':_0x1d3faf[_0x99f2('0x22')],'include':_0x1d3faf[_0x99f2('0x24')]?_[_0x99f2('0x25')](_0x1d3faf[_0x99f2('0x24')],function(_0x1b3e98){return{'model':db[_0x1b3e98[_0x99f2('0x26')]],'as':_0x1b3e98['as'],'attributes':_0x1b3e98[_0x99f2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x99f2('0x27')](function(_0x4cde5c){logger[_0x99f2('0x14')](_0x99f2('0x28'),_0x2d6c2e);logger[_0x99f2('0x16')](_0x99f2('0x28'),_0x2d6c2e,JSON[_0x99f2('0x19')](_0x4cde5c));_0x176d2c(_0x4cde5c);})[_0x99f2('0x1e')](function(_0x11ffc9){logger[_0x99f2('0x1a')](_0x99f2('0x28'),_0x11ffc9[_0x99f2('0x1c')],_0x2d6c2e);_0x32790b(_0x1b673a[_0x99f2('0x1a')](0x1f4,_0x11ffc9[_0x99f2('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index edcfd5b..aab5f7f 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 _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 +var _0xf17b=['./mailQueue.events','update','emit','register','length','mailQueue:'];(function(_0x5e5e86,_0x3b74a5){var _0x3eae90=function(_0x119f84){while(--_0x119f84){_0x5e5e86['push'](_0x5e5e86['shift']());}};_0x3eae90(++_0x3b74a5);}(_0xf17b,0x13e));var _0xbf17=function(_0xd365a8,_0x36b21b){_0xd365a8=_0xd365a8-0x0;var _0x57234a=_0xf17b[_0xd365a8];return _0x57234a;};'use strict';var MailQueueEvents=require(_0xbf17('0x0'));var events=['save','remove',_0xbf17('0x1')];function createListener(_0x3d6aa4,_0x4955d5){return function(_0x4726cf){_0x4955d5[_0xbf17('0x2')](_0x3d6aa4,_0x4726cf);};}function removeListener(_0x3fe926,_0x52e318){return function(){MailQueueEvents['removeListener'](_0x3fe926,_0x52e318);};}exports[_0xbf17('0x3')]=function(_0x2dccf5){for(var _0x280b6d=0x0,_0x26b75c=events[_0xbf17('0x4')];_0x280b6d<_0x26b75c;_0x280b6d++){var _0x3e484a=events[_0x280b6d];var _0x59ac90=createListener(_0xbf17('0x5')+_0x3e484a,_0x2dccf5);MailQueueEvents['on'](_0x3e484a,_0x59ac90);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d3573d8..0029879 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 _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 +var _0x5c30=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x4bf373,_0x28e2da){var _0x5c8717=function(_0x5e2634){while(--_0x5e2634){_0x4bf373['push'](_0x4bf373['shift']());}};_0x5c8717(++_0x28e2da);}(_0x5c30,0x93));var _0x05c3=function(_0x2899bf,_0xcb834b){_0x2899bf=_0x2899bf-0x0;var _0x4dbade=_0x5c30[_0x2899bf];return _0x4dbade;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x05c3('0x0'));var timeout=require(_0x05c3('0x1'));var express=require(_0x05c3('0x2'));var router=express[_0x05c3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x05c3('0x4'));var interaction=require(_0x05c3('0x5'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x05c3('0x6')]);router[_0x05c3('0x7')]('/describe',auth[_0x05c3('0x8')](),controller[_0x05c3('0x9')]);router['get'](_0x05c3('0xa'),auth['isAuthenticated'](),controller[_0x05c3('0xb')]);router[_0x05c3('0xc')]('/',auth[_0x05c3('0x8')](),controller['create']);router[_0x05c3('0xd')](_0x05c3('0xa'),auth[_0x05c3('0x8')](),controller[_0x05c3('0xe')]);router[_0x05c3('0xf')](_0x05c3('0xa'),auth['isAuthenticated'](),controller[_0x05c3('0x10')]);module[_0x05c3('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a398de4..d854118 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 _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 +var _0x0b7a=['DATE','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b7a,0x141));var _0xa0b7=function(_0x2bdb7e,_0x1b48a5){_0x2bdb7e=_0x2bdb7e-0x0;var _0x13cbd6=_0x0b7a[_0x2bdb7e];return _0x13cbd6;};'use strict';var moment=require('moment');var Sequelize=require(_0xa0b7('0x0'));module[_0xa0b7('0x1')]={'uniqueid':{'type':Sequelize[_0xa0b7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa0b7('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa0b7('0x3')]},'exitAt':{'type':Sequelize[_0xa0b7('0x3')]},'reason':{'type':Sequelize[_0xa0b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 3fe0541..510c415 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 _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 +var _0xcaf2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x307d80,_0x2b74e7){var _0x47b263=function(_0x3a0986){while(--_0x3a0986){_0x307d80['push'](_0x307d80['shift']());}};_0x47b263(++_0x2b74e7);}(_0xcaf2,0x8a));var _0x2caf=function(_0x12a0a3,_0x2652d1){_0x12a0a3=_0x12a0a3-0x0;var _0x1c47c4=_0xcaf2[_0x12a0a3];return _0x1c47c4;};'use strict';var emlformat=require(_0x2caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2caf('0x1'));var jsonpatch=require(_0x2caf('0x2'));var rp=require('request-promise');var moment=require(_0x2caf('0x3'));var BPromise=require(_0x2caf('0x4'));var Mustache=require('mustache');var util=require(_0x2caf('0x5'));var path=require('path');var sox=require(_0x2caf('0x6'));var csv=require(_0x2caf('0x7'));var ejs=require(_0x2caf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2caf('0x9'));var squel=require(_0x2caf('0xa'));var crypto=require(_0x2caf('0xb'));var jsforce=require(_0x2caf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2caf('0x7'));var querystring=require(_0x2caf('0xd'));var Papa=require(_0x2caf('0xe'));var Redis=require(_0x2caf('0xf'));var authService=require(_0x2caf('0x10'));var qs=require(_0x2caf('0x11'));var as=require(_0x2caf('0x12'));var hardwareService=require(_0x2caf('0x13'));var logger=require(_0x2caf('0x14'))('api');var utils=require(_0x2caf('0x15'));var config=require(_0x2caf('0x16'));var licenseUtil=require(_0x2caf('0x17'));var db=require(_0x2caf('0x18'))['db'];function respondWithStatusCode(_0x1dda08,_0x31c0e7){_0x31c0e7=_0x31c0e7||0xcc;return function(_0x252147){if(_0x252147){return _0x1dda08[_0x2caf('0x19')](_0x31c0e7);}return _0x1dda08['status'](_0x31c0e7)[_0x2caf('0x1a')]();};}function respondWithResult(_0xec8192,_0x502033){_0x502033=_0x502033||0xc8;return function(_0x4c47b8){if(_0x4c47b8){return _0xec8192['status'](_0x502033)[_0x2caf('0x1b')](_0x4c47b8);}};}function respondWithFilteredResult(_0x4da5ba,_0x388e05){return function(_0xa75896){if(_0xa75896){var _0x3b8b67=typeof _0x388e05[_0x2caf('0x1c')]==='undefined'&&typeof _0x388e05[_0x2caf('0x1d')]==='undefined';var _0x2d5b64=_0xa75896['count'];var _0x4a33fc=_0x3b8b67?0x0:_0x388e05[_0x2caf('0x1c')];var _0x58047b=_0x3b8b67?_0xa75896[_0x2caf('0x1e')]:_0x388e05[_0x2caf('0x1c')]+_0x388e05['limit'];var _0x12624b;if(_0x58047b>=_0x2d5b64){_0x58047b=_0x2d5b64;_0x12624b=0xc8;}else{_0x12624b=0xce;}_0x4da5ba[_0x2caf('0x1f')](_0x12624b);return _0x4da5ba[_0x2caf('0x20')](_0x2caf('0x21'),_0x4a33fc+'-'+_0x58047b+'/'+_0x2d5b64)[_0x2caf('0x1b')](_0xa75896);}return null;};}function patchUpdates(_0x595f2f){return function(_0xfa426f){try{jsonpatch[_0x2caf('0x22')](_0xfa426f,_0x595f2f,!![]);}catch(_0x2b4d16){return BPromise[_0x2caf('0x23')](_0x2b4d16);}return _0xfa426f[_0x2caf('0x24')]();};}function saveUpdates(_0x9d6bae,_0x4092ba){return function(_0x256cc4){if(_0x256cc4){return _0x256cc4[_0x2caf('0x25')](_0x9d6bae)[_0x2caf('0x26')](function(_0x6814bc){return _0x6814bc;});}return null;};}function removeEntity(_0x5231fc,_0x296305){return function(_0x14bfd2){if(_0x14bfd2){return _0x14bfd2[_0x2caf('0x27')]()[_0x2caf('0x26')](function(){_0x5231fc[_0x2caf('0x1f')](0xcc)[_0x2caf('0x1a')]();});}};}function handleEntityNotFound(_0x392196,_0x164da){return function(_0x2e0a75){if(!_0x2e0a75){_0x392196[_0x2caf('0x19')](0x194);}return _0x2e0a75;};}function handleError(_0x5ad211,_0x6a32ac){_0x6a32ac=_0x6a32ac||0x1f4;return function(_0x325eda){logger[_0x2caf('0x28')](_0x325eda[_0x2caf('0x29')]);if(_0x325eda[_0x2caf('0x2a')]){delete _0x325eda[_0x2caf('0x2a')];}_0x5ad211[_0x2caf('0x1f')](_0x6a32ac)[_0x2caf('0x2b')](_0x325eda);};}exports[_0x2caf('0x2c')]=function(_0x2304f1,_0x30da75){var _0x1f477={},_0x158d60={},_0x48b5f7={'count':0x0,'rows':[]};var _0xb944cc=_[_0x2caf('0x2d')](db[_0x2caf('0x2e')][_0x2caf('0x2f')],function(_0xa8523b){return{'name':_0xa8523b[_0x2caf('0x30')],'type':_0xa8523b[_0x2caf('0x31')]['key']};});_0x158d60[_0x2caf('0x32')]=_[_0x2caf('0x2d')](_0xb944cc,'name');_0x158d60[_0x2caf('0x33')]=_[_0x2caf('0x34')](_0x2304f1[_0x2caf('0x33')]);_0x158d60['filters']=_[_0x2caf('0x35')](_0x158d60['model'],_0x158d60['query']);_0x1f477[_0x2caf('0x36')]=_[_0x2caf('0x35')](_0x158d60[_0x2caf('0x32')],qs[_0x2caf('0x37')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x37')]));_0x1f477[_0x2caf('0x36')]=_0x1f477[_0x2caf('0x36')][_0x2caf('0x38')]?_0x1f477['attributes']:_0x158d60[_0x2caf('0x32')];if(!_0x2304f1[_0x2caf('0x33')][_0x2caf('0x39')](_0x2caf('0x3a'))){_0x1f477[_0x2caf('0x1d')]=qs[_0x2caf('0x1d')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x1d')]);_0x1f477[_0x2caf('0x1c')]=qs[_0x2caf('0x1c')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x1c')]);}_0x1f477['order']=qs['sort'](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3b')]);_0x1f477[_0x2caf('0x3c')]=qs[_0x2caf('0x3d')](_['pick'](_0x2304f1[_0x2caf('0x33')],_0x158d60[_0x2caf('0x3d')]),_0xb944cc);if(_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3e')]){_0x1f477[_0x2caf('0x3c')]=_[_0x2caf('0x3f')](_0x1f477[_0x2caf('0x3c')],{'$or':_[_0x2caf('0x2d')](_0xb944cc,function(_0x5c133c){if(_0x5c133c['type']!==_0x2caf('0x40')){var _0x863fca={};_0x863fca[_0x5c133c[_0x2caf('0x2a')]]={'$like':'%'+_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3e')]+'%'};return _0x863fca;}})});}_0x1f477=_[_0x2caf('0x3f')]({},_0x1f477,_0x2304f1[_0x2caf('0x41')]);var _0xf93228={'where':_0x1f477[_0x2caf('0x3c')]};return db[_0x2caf('0x2e')][_0x2caf('0x1e')](_0xf93228)['then'](function(_0x35ad7f){_0x48b5f7[_0x2caf('0x1e')]=_0x35ad7f;if(_0x2304f1[_0x2caf('0x33')]['includeAll']){_0x1f477[_0x2caf('0x42')]=[{'all':!![]}];}return db[_0x2caf('0x2e')][_0x2caf('0x43')](_0x1f477);})['then'](function(_0x40cb18){_0x48b5f7[_0x2caf('0x44')]=_0x40cb18;return _0x48b5f7;})['then'](respondWithFilteredResult(_0x30da75,_0x1f477))[_0x2caf('0x45')](handleError(_0x30da75,null));};exports[_0x2caf('0x46')]=function(_0x4e57b0,_0xe5fcbf){var _0x1348d8={'raw':!![],'where':{'id':_0x4e57b0[_0x2caf('0x47')]['id']}},_0x2e4126={};_0x2e4126[_0x2caf('0x32')]=_[_0x2caf('0x34')](db[_0x2caf('0x2e')][_0x2caf('0x2f')]);_0x2e4126['query']=_[_0x2caf('0x34')](_0x4e57b0['query']);_0x2e4126[_0x2caf('0x3d')]=_[_0x2caf('0x35')](_0x2e4126[_0x2caf('0x32')],_0x2e4126['query']);_0x1348d8['attributes']=_[_0x2caf('0x35')](_0x2e4126['model'],qs[_0x2caf('0x37')](_0x4e57b0[_0x2caf('0x33')][_0x2caf('0x37')]));_0x1348d8[_0x2caf('0x36')]=_0x1348d8[_0x2caf('0x36')][_0x2caf('0x38')]?_0x1348d8[_0x2caf('0x36')]:_0x2e4126[_0x2caf('0x32')];if(_0x4e57b0[_0x2caf('0x33')][_0x2caf('0x48')]){_0x1348d8[_0x2caf('0x42')]=[{'all':!![]}];}_0x1348d8=_[_0x2caf('0x3f')]({},_0x1348d8,_0x4e57b0[_0x2caf('0x41')]);return db[_0x2caf('0x2e')][_0x2caf('0x49')](_0x1348d8)[_0x2caf('0x26')](handleEntityNotFound(_0xe5fcbf,null))[_0x2caf('0x26')](respondWithResult(_0xe5fcbf,null))[_0x2caf('0x45')](handleError(_0xe5fcbf,null));};exports[_0x2caf('0x4a')]=function(_0x3a598b,_0x136dc9){return db['MailQueueReport'][_0x2caf('0x4a')](_0x3a598b[_0x2caf('0x4b')],{})['then'](respondWithResult(_0x136dc9,0xc9))['catch'](handleError(_0x136dc9,null));};exports[_0x2caf('0x25')]=function(_0x6f0a2a,_0x5a822d){if(_0x6f0a2a[_0x2caf('0x4b')]['id']){delete _0x6f0a2a[_0x2caf('0x4b')]['id'];}return db[_0x2caf('0x2e')][_0x2caf('0x49')]({'where':{'id':_0x6f0a2a[_0x2caf('0x47')]['id']}})[_0x2caf('0x26')](handleEntityNotFound(_0x5a822d,null))[_0x2caf('0x26')](saveUpdates(_0x6f0a2a[_0x2caf('0x4b')],null))[_0x2caf('0x26')](respondWithResult(_0x5a822d,null))[_0x2caf('0x45')](handleError(_0x5a822d,null));};exports[_0x2caf('0x27')]=function(_0x2b318a,_0x41b7b2){return db['MailQueueReport'][_0x2caf('0x49')]({'where':{'id':_0x2b318a[_0x2caf('0x47')]['id']}})[_0x2caf('0x26')](handleEntityNotFound(_0x41b7b2,null))['then'](removeEntity(_0x41b7b2,null))[_0x2caf('0x45')](handleError(_0x41b7b2,null));};exports[_0x2caf('0x4c')]=function(_0x28d8bd,_0x20bf52){return db[_0x2caf('0x2e')][_0x2caf('0x4c')]()[_0x2caf('0x26')](respondWithResult(_0x20bf52,null))[_0x2caf('0x45')](handleError(_0x20bf52,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d17745c..a02fd58 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 _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 +var _0x4bc7=['MailQueueReport','report_mail_queue','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define'];(function(_0x108a76,_0x3b93b4){var _0x2bd802=function(_0x53b84e){while(--_0x53b84e){_0x108a76['push'](_0x108a76['shift']());}};_0x2bd802(++_0x3b93b4);}(_0x4bc7,0x188));var _0x74bc=function(_0x4f8cba,_0x51d42b){_0x4f8cba=_0x4f8cba-0x0;var _0xe240a6=_0x4bc7[_0x4f8cba];return _0xe240a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x74bc('0x0'))(_0x74bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74bc('0x2'));var fs=require('fs');var path=require(_0x74bc('0x3'));var rimraf=require(_0x74bc('0x4'));var config=require(_0x74bc('0x5'));var attributes=require(_0x74bc('0x6'));module['exports']=function(_0x340e2f,_0x59fbe1){return _0x340e2f[_0x74bc('0x7')](_0x74bc('0x8'),attributes,{'tableName':_0x74bc('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index e5f43ca..804153a 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 _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 +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x2c9101,_0x5ba7e6){var _0x3e64bf=function(_0x4caa3b){while(--_0x4caa3b){_0x2c9101['push'](_0x2c9101['shift']());}};_0x3e64bf(++_0x5ba7e6);}(_0x7a54,0x106));var _0x47a5=function(_0x5b3ffe,_0x50c128){_0x5b3ffe=_0x5b3ffe-0x0;var _0x4fd215=_0x7a54[_0x5b3ffe];return _0x4fd215;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f845fcd..0c38c99 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(_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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xad1145,_0x211d99){var _0x4a5998=function(_0x5bff2c){while(--_0x5bff2c){_0xad1145['push'](_0xad1145['shift']());}};_0x4a5998(++_0x211d99);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0xcb91[_0x4164f2];return _0x2575c7;};'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 226fc14..5e300f7 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 _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 +var _0x5b3d=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x5b3d,0xbf));var _0xd5b3=function(_0x2d604b,_0x4f1748){_0x2d604b=_0x2d604b-0x0;var _0x504857=_0x5b3d[_0x2d604b];return _0x504857;};'use strict';var Sequelize=require(_0xd5b3('0x0'));module[_0xd5b3('0x1')]={'description':{'type':Sequelize[_0xd5b3('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xd5b3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd5b3('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd5b3('0x4')]},'tls':{'type':Sequelize[_0xd5b3('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd5b3('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xd5b3('0x2')]},'modernAuthentication':{'type':Sequelize[_0xd5b3('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 8a1d47a..5af5053 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 _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 +var _0x3b3c=['moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger'];(function(_0x2049fa,_0x1234ed){var _0x506e96=function(_0x4cd4ee){while(--_0x4cd4ee){_0x2049fa['push'](_0x2049fa['shift']());}};_0x506e96(++_0x1234ed);}(_0x3b3c,0x17e));var _0xc3b3=function(_0xd2dfeb,_0x51aa27){_0xd2dfeb=_0xd2dfeb-0x0;var _0x313172=_0x3b3c[_0xd2dfeb];return _0x313172;};'use strict';var _=require(_0xc3b3('0x0'));var util=require('util');var logger=require(_0xc3b3('0x1'))('api');var moment=require(_0xc3b3('0x2'));var BPromise=require(_0xc3b3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3b3('0x4'));var rimraf=require(_0xc3b3('0x5'));var config=require(_0xc3b3('0x6'));var attributes=require(_0xc3b3('0x7'));module[_0xc3b3('0x8')]=function(_0x1a4cb0,_0x29f4a1){return _0x1a4cb0[_0xc3b3('0x9')](_0xc3b3('0xa'),attributes,{'tableName':_0xc3b3('0xb'),'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 717df6a..23c95d4 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 _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 +var _0x4e4d=['result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2cfa8b,_0x10830c){var _0x5b1032=function(_0x223f9f){while(--_0x223f9f){_0x2cfa8b['push'](_0x2cfa8b['shift']());}};_0x5b1032(++_0x10830c);}(_0x4e4d,0xd7));var _0xd4e4=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x4e4d[_0x163040];return _0x364667;};'use strict';var _=require(_0xd4e4('0x0'));var util=require(_0xd4e4('0x1'));var moment=require(_0xd4e4('0x2'));var BPromise=require(_0xd4e4('0x3'));var rs=require(_0xd4e4('0x4'));var fs=require('fs');var Redis=require(_0xd4e4('0x5'));var db=require(_0xd4e4('0x6'))['db'];var utils=require(_0xd4e4('0x7'));var logger=require(_0xd4e4('0x8'))(_0xd4e4('0x9'));var config=require(_0xd4e4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd4e4('0xb')][_0xd4e4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c35bd,_0x536990,_0x2e73c2){return new BPromise(function(_0x418698,_0x56bf24){return client['request'](_0x5c35bd,_0x2e73c2)[_0xd4e4('0xd')](function(_0x159faa){logger[_0xd4e4('0xe')](_0xd4e4('0xf'),_0x536990,_0xd4e4('0x10'));logger[_0xd4e4('0x11')](_0xd4e4('0x12'),_0x536990,_0xd4e4('0x10'),JSON[_0xd4e4('0x13')](_0x159faa));if(_0x159faa[_0xd4e4('0x14')]){if(_0x159faa['error'][_0xd4e4('0x15')]===0x1f4){logger[_0xd4e4('0x14')](_0xd4e4('0xf'),_0x536990,_0x159faa[_0xd4e4('0x14')]['message']);return _0x56bf24(_0x159faa['error'][_0xd4e4('0x16')]);}logger[_0xd4e4('0x14')]('MailServerIn,\x20%s,\x20%s',_0x536990,_0x159faa['error']['message']);return _0x418698(_0x159faa[_0xd4e4('0x14')][_0xd4e4('0x16')]);}else{logger[_0xd4e4('0xe')](_0xd4e4('0xf'),_0x536990,_0xd4e4('0x10'));_0x418698(_0x159faa[_0xd4e4('0x17')][_0xd4e4('0x16')]);}})[_0xd4e4('0x18')](function(_0x497e00){logger[_0xd4e4('0x14')]('MailServerIn,\x20%s,\x20%s',_0x536990,_0x497e00);_0x56bf24(_0x497e00);});});}exports[_0xd4e4('0x19')]=function(_0x4ed0e4){var _0x45ff82=this;return new Promise(function(_0x1413fc,_0x1da896){return db[_0xd4e4('0x1a')][_0xd4e4('0x1b')]({'raw':_0x4ed0e4['options']?_0x4ed0e4[_0xd4e4('0x1c')][_0xd4e4('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ed0e4[_0xd4e4('0x1c')]?_0x4ed0e4[_0xd4e4('0x1c')][_0xd4e4('0x1e')]||null:null,'attributes':_0x4ed0e4['options']?_0x4ed0e4[_0xd4e4('0x1c')][_0xd4e4('0x1f')]||null:null,'limit':_0x4ed0e4[_0xd4e4('0x1c')]?_0x4ed0e4[_0xd4e4('0x1c')]['limit']||null:null,'include':_0x4ed0e4[_0xd4e4('0x1c')]?_0x4ed0e4[_0xd4e4('0x1c')][_0xd4e4('0x20')]?_[_0xd4e4('0x21')](_0x4ed0e4['options'][_0xd4e4('0x20')],function(_0x2ecaf9){return{'model':db[_0x2ecaf9['model']],'as':_0x2ecaf9['as'],'attributes':_0x2ecaf9[_0xd4e4('0x1f')],'include':_0x2ecaf9[_0xd4e4('0x20')]?_[_0xd4e4('0x21')](_0x2ecaf9[_0xd4e4('0x20')],function(_0x436d20){return{'model':db[_0x436d20['model']],'as':_0x436d20['as'],'attributes':_0x436d20[_0xd4e4('0x1f')],'include':_0x436d20[_0xd4e4('0x20')]?_[_0xd4e4('0x21')](_0x436d20[_0xd4e4('0x20')],function(_0x31cca7){return{'model':db[_0x31cca7['model']],'as':_0x31cca7['as'],'attributes':_0x31cca7[_0xd4e4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x432186){logger[_0xd4e4('0xe')](_0xd4e4('0x19'),_0x4ed0e4);logger[_0xd4e4('0x11')](_0xd4e4('0x19'),_0x4ed0e4,JSON[_0xd4e4('0x13')](_0x432186));_0x1413fc(_0x432186);})[_0xd4e4('0x18')](function(_0x318f0b){logger[_0xd4e4('0x14')]('GetMailServerIn',_0x318f0b[_0xd4e4('0x16')],_0x4ed0e4);_0x1da896(_0x45ff82['error'](0x1f4,_0x318f0b[_0xd4e4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 9f05079..daa0db6 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 _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 +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(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a54,0x106));var _0x47a5=function(_0x447d98,_0x2b7c25){_0x447d98=_0x447d98-0x0;var _0x4b1ace=_0x7a54[_0x447d98];return _0x4b1ace;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index ef059ae..240944c 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 _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 +var _0x8f59=['BOOLEAN','sequelize','exports','STRING'];(function(_0x23e207,_0x34850b){var _0x2e25fa=function(_0x41bf81){while(--_0x41bf81){_0x23e207['push'](_0x23e207['shift']());}};_0x2e25fa(++_0x34850b);}(_0x8f59,0x11d));var _0x98f5=function(_0x3770c8,_0x4c3e51){_0x3770c8=_0x3770c8-0x0;var _0x33d6ff=_0x8f59[_0x3770c8];return _0x33d6ff;};'use strict';var Sequelize=require(_0x98f5('0x0'));module[_0x98f5('0x1')]={'description':{'type':Sequelize[_0x98f5('0x2')]},'host':{'type':Sequelize[_0x98f5('0x2')]},'user':{'type':Sequelize[_0x98f5('0x2')]},'pass':{'type':Sequelize[_0x98f5('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x98f5('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x98f5('0x2')]},'authentication':{'type':Sequelize[_0x98f5('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x98f5('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 5b97188..083ff45 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 _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 +var _0xeba8=['MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','name','send','index','map'];(function(_0x29ba3c,_0x2e5f88){var _0x4018c8=function(_0x289c0c){while(--_0x289c0c){_0x29ba3c['push'](_0x29ba3c['shift']());}};_0x4018c8(++_0x2e5f88);}(_0xeba8,0x1a0));var _0x8eba=function(_0x56e32e,_0x9eb2f6){_0x56e32e=_0x56e32e-0x0;var _0x2a757b=_0xeba8[_0x56e32e];return _0x2a757b;};'use strict';var emlformat=require(_0x8eba('0x0'));var rimraf=require(_0x8eba('0x1'));var zipdir=require(_0x8eba('0x2'));var jsonpatch=require(_0x8eba('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8eba('0x4'));var Mustache=require('mustache');var util=require(_0x8eba('0x5'));var path=require(_0x8eba('0x6'));var sox=require(_0x8eba('0x7'));var csv=require(_0x8eba('0x8'));var ejs=require(_0x8eba('0x9'));var fs=require('fs');var fs_extra=require(_0x8eba('0xa'));var _=require(_0x8eba('0xb'));var squel=require(_0x8eba('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eba('0xd'));var deskjs=require(_0x8eba('0xe'));var toCsv=require(_0x8eba('0x8'));var querystring=require(_0x8eba('0xf'));var Papa=require('papaparse');var Redis=require(_0x8eba('0x10'));var authService=require(_0x8eba('0x11'));var qs=require(_0x8eba('0x12'));var as=require(_0x8eba('0x13'));var hardwareService=require(_0x8eba('0x14'));var logger=require(_0x8eba('0x15'))(_0x8eba('0x16'));var utils=require('../../config/utils');var config=require(_0x8eba('0x17'));var licenseUtil=require(_0x8eba('0x18'));var db=require(_0x8eba('0x19'))['db'];function respondWithStatusCode(_0x55d590,_0x225d82){_0x225d82=_0x225d82||0xcc;return function(_0xe0cccb){if(_0xe0cccb){return _0x55d590[_0x8eba('0x1a')](_0x225d82);}return _0x55d590[_0x8eba('0x1b')](_0x225d82)['end']();};}function respondWithResult(_0x280219,_0x57afc7){_0x57afc7=_0x57afc7||0xc8;return function(_0x306c09){if(_0x306c09){return _0x280219['status'](_0x57afc7)['json'](_0x306c09);}};}function respondWithFilteredResult(_0x68201c,_0xbbacc){return function(_0x1e5b21){if(_0x1e5b21){var _0x39a2c9=typeof _0xbbacc[_0x8eba('0x1c')]===_0x8eba('0x1d')&&typeof _0xbbacc[_0x8eba('0x1e')]===_0x8eba('0x1d');var _0xd1ae8b=_0x1e5b21[_0x8eba('0x1f')];var _0xd61d1e=_0x39a2c9?0x0:_0xbbacc['offset'];var _0x552b1d=_0x39a2c9?_0x1e5b21[_0x8eba('0x1f')]:_0xbbacc[_0x8eba('0x1c')]+_0xbbacc[_0x8eba('0x1e')];var _0x745925;if(_0x552b1d>=_0xd1ae8b){_0x552b1d=_0xd1ae8b;_0x745925=0xc8;}else{_0x745925=0xce;}_0x68201c[_0x8eba('0x1b')](_0x745925);return _0x68201c[_0x8eba('0x20')](_0x8eba('0x21'),_0xd61d1e+'-'+_0x552b1d+'/'+_0xd1ae8b)[_0x8eba('0x22')](_0x1e5b21);}return null;};}function patchUpdates(_0x3c8319){return function(_0x4b765d){try{jsonpatch[_0x8eba('0x23')](_0x4b765d,_0x3c8319,!![]);}catch(_0x6cc440){return BPromise[_0x8eba('0x24')](_0x6cc440);}return _0x4b765d[_0x8eba('0x25')]();};}function saveUpdates(_0x165670,_0x424616){return function(_0x3c8126){if(_0x3c8126){return _0x3c8126[_0x8eba('0x26')](_0x165670)['then'](function(_0x3f1af7){return _0x3f1af7;});}return null;};}function removeEntity(_0x212169,_0x57e63b){return function(_0x2b8c87){if(_0x2b8c87){return _0x2b8c87[_0x8eba('0x27')]()[_0x8eba('0x28')](function(){_0x212169[_0x8eba('0x1b')](0xcc)[_0x8eba('0x29')]();});}};}function handleEntityNotFound(_0xeadf0b,_0x161dea){return function(_0x4f158c){if(!_0x4f158c){_0xeadf0b[_0x8eba('0x1a')](0x194);}return _0x4f158c;};}function handleError(_0x3e7f54,_0x572234){_0x572234=_0x572234||0x1f4;return function(_0x47f3a5){logger['error'](_0x47f3a5['stack']);if(_0x47f3a5[_0x8eba('0x2a')]){delete _0x47f3a5['name'];}_0x3e7f54[_0x8eba('0x1b')](_0x572234)[_0x8eba('0x2b')](_0x47f3a5);};}exports[_0x8eba('0x2c')]=function(_0x461433,_0x5537f6){var _0x28ed2a={},_0x5eaa92={},_0x48717b={'count':0x0,'rows':[]};var _0x40ddd8=_[_0x8eba('0x2d')](db[_0x8eba('0x2e')][_0x8eba('0x2f')],function(_0x264fa2){return{'name':_0x264fa2[_0x8eba('0x30')],'type':_0x264fa2[_0x8eba('0x31')][_0x8eba('0x32')]};});_0x5eaa92['model']=_['map'](_0x40ddd8,_0x8eba('0x2a'));_0x5eaa92[_0x8eba('0x33')]=_[_0x8eba('0x34')](_0x461433[_0x8eba('0x33')]);_0x5eaa92[_0x8eba('0x35')]=_['intersection'](_0x5eaa92[_0x8eba('0x36')],_0x5eaa92[_0x8eba('0x33')]);_0x28ed2a[_0x8eba('0x37')]=_[_0x8eba('0x38')](_0x5eaa92[_0x8eba('0x36')],qs[_0x8eba('0x39')](_0x461433[_0x8eba('0x33')][_0x8eba('0x39')]));_0x28ed2a[_0x8eba('0x37')]=_0x28ed2a['attributes'][_0x8eba('0x3a')]?_0x28ed2a['attributes']:_0x5eaa92[_0x8eba('0x36')];if(!_0x461433['query'][_0x8eba('0x3b')]('nolimit')){_0x28ed2a[_0x8eba('0x1e')]=qs['limit'](_0x461433['query']['limit']);_0x28ed2a[_0x8eba('0x1c')]=qs[_0x8eba('0x1c')](_0x461433['query']['offset']);}_0x28ed2a[_0x8eba('0x3c')]=qs[_0x8eba('0x3d')](_0x461433[_0x8eba('0x33')][_0x8eba('0x3d')]);_0x28ed2a['where']=qs[_0x8eba('0x35')](_[_0x8eba('0x3e')](_0x461433['query'],_0x5eaa92[_0x8eba('0x35')]),_0x40ddd8);if(_0x461433[_0x8eba('0x33')][_0x8eba('0x3f')]){_0x28ed2a[_0x8eba('0x40')]=_[_0x8eba('0x41')](_0x28ed2a[_0x8eba('0x40')],{'$or':_['map'](_0x40ddd8,function(_0x3843f5){if(_0x3843f5[_0x8eba('0x31')]!==_0x8eba('0x42')){var _0x108534={};_0x108534[_0x3843f5[_0x8eba('0x2a')]]={'$like':'%'+_0x461433['query']['filter']+'%'};return _0x108534;}})});}_0x28ed2a=_[_0x8eba('0x41')]({},_0x28ed2a,_0x461433[_0x8eba('0x43')]);var _0x5c0f29={'where':_0x28ed2a[_0x8eba('0x40')]};return db[_0x8eba('0x2e')][_0x8eba('0x1f')](_0x5c0f29)[_0x8eba('0x28')](function(_0x4f7be2){_0x48717b[_0x8eba('0x1f')]=_0x4f7be2;if(_0x461433['query'][_0x8eba('0x44')]){_0x28ed2a[_0x8eba('0x45')]=[{'all':!![]}];}return db[_0x8eba('0x2e')]['findAll'](_0x28ed2a);})[_0x8eba('0x28')](function(_0x49dce3){_0x48717b[_0x8eba('0x46')]=_0x49dce3;return _0x48717b;})['then'](respondWithFilteredResult(_0x5537f6,_0x28ed2a))[_0x8eba('0x47')](handleError(_0x5537f6,null));};exports[_0x8eba('0x48')]=function(_0x2e5591,_0x407fff){var _0x258210={'raw':!![],'where':{'id':_0x2e5591[_0x8eba('0x49')]['id']}},_0xbe6e11={};_0xbe6e11[_0x8eba('0x36')]=_[_0x8eba('0x34')](db[_0x8eba('0x2e')][_0x8eba('0x2f')]);_0xbe6e11[_0x8eba('0x33')]=_['keys'](_0x2e5591['query']);_0xbe6e11[_0x8eba('0x35')]=_[_0x8eba('0x38')](_0xbe6e11[_0x8eba('0x36')],_0xbe6e11['query']);_0x258210[_0x8eba('0x37')]=_[_0x8eba('0x38')](_0xbe6e11[_0x8eba('0x36')],qs[_0x8eba('0x39')](_0x2e5591[_0x8eba('0x33')][_0x8eba('0x39')]));_0x258210['attributes']=_0x258210[_0x8eba('0x37')][_0x8eba('0x3a')]?_0x258210[_0x8eba('0x37')]:_0xbe6e11[_0x8eba('0x36')];if(_0x2e5591[_0x8eba('0x33')][_0x8eba('0x44')]){_0x258210[_0x8eba('0x45')]=[{'all':!![]}];}_0x258210=_[_0x8eba('0x41')]({},_0x258210,_0x2e5591[_0x8eba('0x43')]);return db[_0x8eba('0x2e')][_0x8eba('0x4a')](_0x258210)[_0x8eba('0x28')](handleEntityNotFound(_0x407fff,null))[_0x8eba('0x28')](respondWithResult(_0x407fff,null))[_0x8eba('0x47')](handleError(_0x407fff,null));};exports[_0x8eba('0x4b')]=function(_0x38f626,_0x2ef15a){return db[_0x8eba('0x2e')][_0x8eba('0x4b')](_0x38f626['body'],{})[_0x8eba('0x28')](respondWithResult(_0x2ef15a,0xc9))['catch'](handleError(_0x2ef15a,null));};exports[_0x8eba('0x26')]=function(_0x2a50c7,_0x5b8575){if(_0x2a50c7[_0x8eba('0x4c')]['id']){delete _0x2a50c7[_0x8eba('0x4c')]['id'];}return db[_0x8eba('0x2e')][_0x8eba('0x4a')]({'where':{'id':_0x2a50c7[_0x8eba('0x49')]['id']}})[_0x8eba('0x28')](handleEntityNotFound(_0x5b8575,null))['then'](saveUpdates(_0x2a50c7[_0x8eba('0x4c')],null))[_0x8eba('0x28')](respondWithResult(_0x5b8575,null))['catch'](handleError(_0x5b8575,null));};exports['destroy']=function(_0x244874,_0x1c8c8f){return db['MailServerOut'][_0x8eba('0x4a')]({'where':{'id':_0x244874[_0x8eba('0x49')]['id']}})[_0x8eba('0x28')](handleEntityNotFound(_0x1c8c8f,null))[_0x8eba('0x28')](removeEntity(_0x1c8c8f,null))[_0x8eba('0x47')](handleError(_0x1c8c8f,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 6ba7336..688b7b5 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 _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 +var _0x96f7=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','mail_servers_out','lodash'];(function(_0x4af2ef,_0x575f31){var _0x230332=function(_0x29793d){while(--_0x29793d){_0x4af2ef['push'](_0x4af2ef['shift']());}};_0x230332(++_0x575f31);}(_0x96f7,0x180));var _0x796f=function(_0x399131,_0x2db855){_0x399131=_0x399131-0x0;var _0xce76e2=_0x96f7[_0x399131];return _0xce76e2;};'use strict';var _=require(_0x796f('0x0'));var util=require(_0x796f('0x1'));var logger=require(_0x796f('0x2'))(_0x796f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x796f('0x4'));var fs=require('fs');var path=require(_0x796f('0x5'));var rimraf=require(_0x796f('0x6'));var config=require(_0x796f('0x7'));var attributes=require(_0x796f('0x8'));module[_0x796f('0x9')]=function(_0x31c635,_0x1311a5){return _0x31c635['define']('MailServerOut',attributes,{'tableName':_0x796f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index e617db6..6b3cdef 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_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 +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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x5d4ee7,_0x43961b){_0x5d4ee7=_0x5d4ee7-0x0;var _0x501cbb=_0x7a54[_0x5d4ee7];return _0x501cbb;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a523404..ffbdab5 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 _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 +var _0x8e47=['describe','/:id','show','post','create','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe'];(function(_0x20ba62,_0x539a35){var _0x4cf2d0=function(_0x4686db){while(--_0x4686db){_0x20ba62['push'](_0x20ba62['shift']());}};_0x4cf2d0(++_0x539a35);}(_0x8e47,0x1b8));var _0x78e4=function(_0x21c09f,_0x6ce866){_0x21c09f=_0x21c09f-0x0;var _0x164d58=_0x8e47[_0x21c09f];return _0x164d58;};'use strict';var multer=require(_0x78e4('0x0'));var util=require('util');var path=require(_0x78e4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78e4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x78e4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x78e4('0x4'));var controller=require(_0x78e4('0x5'));router['get']('/',auth[_0x78e4('0x6')](),controller[_0x78e4('0x7')]);router[_0x78e4('0x8')](_0x78e4('0x9'),auth[_0x78e4('0x6')](),controller[_0x78e4('0xa')]);router['get'](_0x78e4('0xb'),auth[_0x78e4('0x6')](),controller[_0x78e4('0xc')]);router[_0x78e4('0xd')]('/',auth[_0x78e4('0x6')](),controller[_0x78e4('0xe')]);router['put']('/:id',auth[_0x78e4('0x6')](),controller['update']);router[_0x78e4('0xf')](_0x78e4('0xb'),auth[_0x78e4('0x6')](),controller[_0x78e4('0x10')]);module[_0x78e4('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 52ef6cb..1a8fd64 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 _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 +var _0xef17=['STRING','name','sequelize','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xef17,0x136));var _0x7ef1=function(_0x17a98d,_0x124be4){_0x17a98d=_0x17a98d-0x0;var _0x4c2c6c=_0xef17[_0x17a98d];return _0x4c2c6c;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module[_0x7ef1('0x1')]={'name':{'type':Sequelize[_0x7ef1('0x2')],'unique':_0x7ef1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7ef1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a283bae..a1f5859 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 _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 +var _0xe915=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','map','rawAttributes','fieldName','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','type','options','MailSubstatus','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2dedfa,_0x1fb9d6){var _0x10c65d=function(_0x23bb50){while(--_0x23bb50){_0x2dedfa['push'](_0x2dedfa['shift']());}};_0x10c65d(++_0x1fb9d6);}(_0xe915,0x1c6));var _0x5e91=function(_0x5ab9da,_0x572d7d){_0x5ab9da=_0x5ab9da-0x0;var _0x1aa487=_0xe915[_0x5ab9da];return _0x1aa487;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e91('0x0'));var zipdir=require(_0x5e91('0x1'));var jsonpatch=require(_0x5e91('0x2'));var rp=require(_0x5e91('0x3'));var moment=require(_0x5e91('0x4'));var BPromise=require(_0x5e91('0x5'));var Mustache=require(_0x5e91('0x6'));var util=require(_0x5e91('0x7'));var path=require('path');var sox=require(_0x5e91('0x8'));var csv=require('to-csv');var ejs=require(_0x5e91('0x9'));var fs=require('fs');var fs_extra=require(_0x5e91('0xa'));var _=require(_0x5e91('0xb'));var squel=require(_0x5e91('0xc'));var crypto=require(_0x5e91('0xd'));var jsforce=require(_0x5e91('0xe'));var deskjs=require(_0x5e91('0xf'));var toCsv=require(_0x5e91('0x10'));var querystring=require(_0x5e91('0x11'));var Papa=require('papaparse');var Redis=require(_0x5e91('0x12'));var authService=require(_0x5e91('0x13'));var qs=require(_0x5e91('0x14'));var as=require(_0x5e91('0x15'));var hardwareService=require(_0x5e91('0x16'));var logger=require(_0x5e91('0x17'))(_0x5e91('0x18'));var utils=require(_0x5e91('0x19'));var config=require(_0x5e91('0x1a'));var licenseUtil=require(_0x5e91('0x1b'));var db=require(_0x5e91('0x1c'))['db'];function respondWithStatusCode(_0x326a06,_0x4c271a){_0x4c271a=_0x4c271a||0xcc;return function(_0x1a8f63){if(_0x1a8f63){return _0x326a06['sendStatus'](_0x4c271a);}return _0x326a06[_0x5e91('0x1d')](_0x4c271a)[_0x5e91('0x1e')]();};}function respondWithResult(_0x58c6ec,_0x4f0aa4){_0x4f0aa4=_0x4f0aa4||0xc8;return function(_0x67449d){if(_0x67449d){return _0x58c6ec[_0x5e91('0x1d')](_0x4f0aa4)[_0x5e91('0x1f')](_0x67449d);}};}function respondWithFilteredResult(_0x5e6a07,_0x4b802e){return function(_0x4564e6){if(_0x4564e6){var _0x1b2f23=typeof _0x4b802e[_0x5e91('0x20')]===_0x5e91('0x21')&&typeof _0x4b802e[_0x5e91('0x22')]==='undefined';var _0x13cd5f=_0x4564e6['count'];var _0x14bdb6=_0x1b2f23?0x0:_0x4b802e[_0x5e91('0x20')];var _0x20dece=_0x1b2f23?_0x4564e6[_0x5e91('0x23')]:_0x4b802e['offset']+_0x4b802e[_0x5e91('0x22')];var _0x427400;if(_0x20dece>=_0x13cd5f){_0x20dece=_0x13cd5f;_0x427400=0xc8;}else{_0x427400=0xce;}_0x5e6a07[_0x5e91('0x1d')](_0x427400);return _0x5e6a07[_0x5e91('0x24')]('Content-Range',_0x14bdb6+'-'+_0x20dece+'/'+_0x13cd5f)[_0x5e91('0x1f')](_0x4564e6);}return null;};}function patchUpdates(_0x950d76){return function(_0x474679){try{jsonpatch[_0x5e91('0x25')](_0x474679,_0x950d76,!![]);}catch(_0x425e86){return BPromise[_0x5e91('0x26')](_0x425e86);}return _0x474679[_0x5e91('0x27')]();};}function saveUpdates(_0x403112,_0x210676){return function(_0x3e6c6d){if(_0x3e6c6d){return _0x3e6c6d[_0x5e91('0x28')](_0x403112)[_0x5e91('0x29')](function(_0x1f2258){return _0x1f2258;});}return null;};}function removeEntity(_0x4208ad,_0xc069b1){return function(_0xb67307){if(_0xb67307){return _0xb67307['destroy']()[_0x5e91('0x29')](function(){_0x4208ad[_0x5e91('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x528cba,_0x1fbcb3){return function(_0x57c0ea){if(!_0x57c0ea){_0x528cba['sendStatus'](0x194);}return _0x57c0ea;};}function handleError(_0x5c0803,_0x3c79a0){_0x3c79a0=_0x3c79a0||0x1f4;return function(_0x2a6f0a){logger[_0x5e91('0x2a')](_0x2a6f0a[_0x5e91('0x2b')]);if(_0x2a6f0a[_0x5e91('0x2c')]){delete _0x2a6f0a[_0x5e91('0x2c')];}_0x5c0803['status'](_0x3c79a0)['send'](_0x2a6f0a);};}exports['index']=function(_0x3c2be6,_0x97526){var _0x673d41={},_0x349d94={},_0x415af4={'count':0x0,'rows':[]};var _0x4c15fc=_[_0x5e91('0x2d')](db['MailSubstatus'][_0x5e91('0x2e')],function(_0x5073b9){return{'name':_0x5073b9[_0x5e91('0x2f')],'type':_0x5073b9['type']['key']};});_0x349d94[_0x5e91('0x30')]=_['map'](_0x4c15fc,_0x5e91('0x2c'));_0x349d94['query']=_[_0x5e91('0x31')](_0x3c2be6['query']);_0x349d94['filters']=_['intersection'](_0x349d94[_0x5e91('0x30')],_0x349d94[_0x5e91('0x32')]);_0x673d41['attributes']=_[_0x5e91('0x33')](_0x349d94[_0x5e91('0x30')],qs[_0x5e91('0x34')](_0x3c2be6['query'][_0x5e91('0x34')]));_0x673d41[_0x5e91('0x35')]=_0x673d41[_0x5e91('0x35')][_0x5e91('0x36')]?_0x673d41[_0x5e91('0x35')]:_0x349d94[_0x5e91('0x30')];if(!_0x3c2be6[_0x5e91('0x32')]['hasOwnProperty'](_0x5e91('0x37'))){_0x673d41[_0x5e91('0x22')]=qs['limit'](_0x3c2be6[_0x5e91('0x32')][_0x5e91('0x22')]);_0x673d41[_0x5e91('0x20')]=qs[_0x5e91('0x20')](_0x3c2be6[_0x5e91('0x32')][_0x5e91('0x20')]);}_0x673d41[_0x5e91('0x38')]=qs['sort'](_0x3c2be6[_0x5e91('0x32')][_0x5e91('0x39')]);_0x673d41['where']=qs[_0x5e91('0x3a')](_[_0x5e91('0x3b')](_0x3c2be6[_0x5e91('0x32')],_0x349d94[_0x5e91('0x3a')]),_0x4c15fc);if(_0x3c2be6[_0x5e91('0x32')][_0x5e91('0x3c')]){_0x673d41[_0x5e91('0x3d')]=_[_0x5e91('0x3e')](_0x673d41[_0x5e91('0x3d')],{'$or':_[_0x5e91('0x2d')](_0x4c15fc,function(_0x5785cf){if(_0x5785cf[_0x5e91('0x3f')]!=='VIRTUAL'){var _0x566b9c={};_0x566b9c[_0x5785cf[_0x5e91('0x2c')]]={'$like':'%'+_0x3c2be6[_0x5e91('0x32')][_0x5e91('0x3c')]+'%'};return _0x566b9c;}})});}_0x673d41=_[_0x5e91('0x3e')]({},_0x673d41,_0x3c2be6[_0x5e91('0x40')]);var _0x364be7={'where':_0x673d41[_0x5e91('0x3d')]};return db[_0x5e91('0x41')][_0x5e91('0x23')](_0x364be7)[_0x5e91('0x29')](function(_0x35a470){_0x415af4[_0x5e91('0x23')]=_0x35a470;if(_0x3c2be6['query'][_0x5e91('0x42')]){_0x673d41[_0x5e91('0x43')]=[{'all':!![]}];}return db[_0x5e91('0x41')][_0x5e91('0x44')](_0x673d41);})[_0x5e91('0x29')](function(_0x59582f){_0x415af4[_0x5e91('0x45')]=_0x59582f;return _0x415af4;})[_0x5e91('0x29')](respondWithFilteredResult(_0x97526,_0x673d41))[_0x5e91('0x46')](handleError(_0x97526,null));};exports[_0x5e91('0x47')]=function(_0x31d059,_0x20d4a3){var _0x18855e={'raw':!![],'where':{'id':_0x31d059[_0x5e91('0x48')]['id']}},_0x50ba9a={};_0x50ba9a[_0x5e91('0x30')]=_[_0x5e91('0x31')](db[_0x5e91('0x41')][_0x5e91('0x2e')]);_0x50ba9a[_0x5e91('0x32')]=_[_0x5e91('0x31')](_0x31d059[_0x5e91('0x32')]);_0x50ba9a[_0x5e91('0x3a')]=_[_0x5e91('0x33')](_0x50ba9a[_0x5e91('0x30')],_0x50ba9a[_0x5e91('0x32')]);_0x18855e['attributes']=_[_0x5e91('0x33')](_0x50ba9a[_0x5e91('0x30')],qs[_0x5e91('0x34')](_0x31d059['query']['fields']));_0x18855e['attributes']=_0x18855e['attributes']['length']?_0x18855e[_0x5e91('0x35')]:_0x50ba9a[_0x5e91('0x30')];if(_0x31d059[_0x5e91('0x32')]['includeAll']){_0x18855e['include']=[{'all':!![]}];}_0x18855e=_[_0x5e91('0x3e')]({},_0x18855e,_0x31d059[_0x5e91('0x40')]);return db[_0x5e91('0x41')]['find'](_0x18855e)[_0x5e91('0x29')](handleEntityNotFound(_0x20d4a3,null))[_0x5e91('0x29')](respondWithResult(_0x20d4a3,null))[_0x5e91('0x46')](handleError(_0x20d4a3,null));};exports['create']=function(_0x749ed4,_0x3bfe33){return db[_0x5e91('0x41')][_0x5e91('0x49')](_0x749ed4['body'],{})[_0x5e91('0x29')](respondWithResult(_0x3bfe33,0xc9))[_0x5e91('0x46')](handleError(_0x3bfe33,null));};exports[_0x5e91('0x28')]=function(_0x160138,_0x2845b2){if(_0x160138[_0x5e91('0x4a')]['id']){delete _0x160138['body']['id'];}return db['MailSubstatus'][_0x5e91('0x4b')]({'where':{'id':_0x160138['params']['id']}})[_0x5e91('0x29')](handleEntityNotFound(_0x2845b2,null))[_0x5e91('0x29')](saveUpdates(_0x160138[_0x5e91('0x4a')],null))['then'](respondWithResult(_0x2845b2,null))[_0x5e91('0x46')](handleError(_0x2845b2,null));};exports['destroy']=function(_0x2d4e33,_0x22b7d8){return db[_0x5e91('0x41')][_0x5e91('0x4b')]({'where':{'id':_0x2d4e33[_0x5e91('0x48')]['id']}})[_0x5e91('0x29')](handleEntityNotFound(_0x22b7d8,null))['then'](removeEntity(_0x22b7d8,null))[_0x5e91('0x46')](handleError(_0x22b7d8,null));};exports[_0x5e91('0x4c')]=function(_0x41f553,_0x9cf299){return db[_0x5e91('0x41')][_0x5e91('0x4c')]()['then'](respondWithResult(_0x9cf299,null))[_0x5e91('0x46')](handleError(_0x9cf299,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 14092ee..627714c 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 _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 +var _0x36bb=['hasOwnProperty','hook','events','update','emit'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x36bb,0x70));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb36b('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xb36b('0x1')};function emitEvent(_0x338152){return function(_0x4ff8c6,_0x3fe00e,_0x11d241){MailSubstatusEvents[_0xb36b('0x2')](_0x338152+':'+_0x4ff8c6['id'],_0x4ff8c6);MailSubstatusEvents[_0xb36b('0x2')](_0x338152,_0x4ff8c6);_0x11d241(null);};}for(var e in events){if(events[_0xb36b('0x3')](e)){var event=events[e];MailSubstatus[_0xb36b('0x4')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index a11535e..f02d1c9 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 _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 +var _0x9ccd=['name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','MailSubstatus','Condition','update'];(function(_0x13c304,_0x4791de){var _0x12696e=function(_0x2070d4){while(--_0x2070d4){_0x13c304['push'](_0x13c304['shift']());}};_0x12696e(++_0x4791de);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xd9cc('0x0'));module['exports']=function(_0x29ce42){var _0x3ad6c4=_0x29ce42['models'];return _0x29ce42['define'](_0xd9cc('0x1'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xe2426f,_0x296228,_0x425ab8){return _0x3ad6c4[_0xd9cc('0x2')][_0xd9cc('0x3')]({'value':_0xe2426f[_0xd9cc('0x4')]},{'where':{'field':_0xd9cc('0x5'),'value':_0xe2426f[_0xd9cc('0x6')][_0xd9cc('0x4')]}})[_0xd9cc('0x7')](function(){_0x425ab8();})[_0xd9cc('0x8')](function(_0x25b38e){_0x425ab8(_0x25b38e);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 9673a11..47aa786 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 _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 +var _0x7502=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x369c69,_0x1fc38c){var _0x193bd8=function(_0x5ec181){while(--_0x5ec181){_0x369c69['push'](_0x369c69['shift']());}};_0x193bd8(++_0x1fc38c);}(_0x7502,0x128));var _0x2750=function(_0x19365e,_0x5f440d){_0x19365e=_0x19365e-0x0;var _0x31302a=_0x7502[_0x19365e];return _0x31302a;};'use strict';var _=require(_0x2750('0x0'));var util=require(_0x2750('0x1'));var moment=require(_0x2750('0x2'));var BPromise=require(_0x2750('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2750('0x4'));var db=require(_0x2750('0x5'))['db'];var utils=require(_0x2750('0x6'));var logger=require(_0x2750('0x7'))(_0x2750('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2750('0x9')][_0x2750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53f520,_0x25aefd,_0x3dec11){return new BPromise(function(_0x45870d,_0x556d74){return client[_0x2750('0xb')](_0x53f520,_0x3dec11)['then'](function(_0x1f98de){logger[_0x2750('0xc')](_0x2750('0xd'),_0x25aefd,_0x2750('0xe'));logger[_0x2750('0xf')](_0x2750('0x10'),_0x25aefd,'request\x20sent',JSON['stringify'](_0x1f98de));if(_0x1f98de[_0x2750('0x11')]){if(_0x1f98de[_0x2750('0x11')][_0x2750('0x12')]===0x1f4){logger[_0x2750('0x11')](_0x2750('0xd'),_0x25aefd,_0x1f98de[_0x2750('0x11')][_0x2750('0x13')]);return _0x556d74(_0x1f98de['error'][_0x2750('0x13')]);}logger[_0x2750('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x25aefd,_0x1f98de[_0x2750('0x11')][_0x2750('0x13')]);return _0x45870d(_0x1f98de[_0x2750('0x11')][_0x2750('0x13')]);}else{logger[_0x2750('0xc')](_0x2750('0xd'),_0x25aefd,_0x2750('0xe'));_0x45870d(_0x1f98de[_0x2750('0x14')]['message']);}})[_0x2750('0x15')](function(_0x38fc88){logger[_0x2750('0x11')](_0x2750('0xd'),_0x25aefd,_0x38fc88);_0x556d74(_0x38fc88);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 4a8292d..384e2de 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 _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 +var _0x3a88=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x532a32,_0x54eff1){var _0x3535cc=function(_0x4af8ff){while(--_0x4af8ff){_0x532a32['push'](_0x532a32['shift']());}};_0x3535cc(++_0x54eff1);}(_0x3a88,0x1bc));var _0x83a8=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x3a88[_0x1e172a];return _0x96338b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x83a8('0x0'));var timeout=require(_0x83a8('0x1'));var express=require(_0x83a8('0x2'));var router=express[_0x83a8('0x3')]();var fs_extra=require(_0x83a8('0x4'));var auth=require(_0x83a8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x83a8('0x6'));var controller=require('./mailTransferReport.controller');router[_0x83a8('0x7')]('/',auth[_0x83a8('0x8')](),controller[_0x83a8('0x9')]);router['get'](_0x83a8('0xa'),auth[_0x83a8('0x8')](),controller['describe']);router['get'](_0x83a8('0xb'),auth[_0x83a8('0x8')](),controller[_0x83a8('0xc')]);router['post']('/',auth[_0x83a8('0x8')](),controller[_0x83a8('0xd')]);router[_0x83a8('0xe')](_0x83a8('0xb'),auth[_0x83a8('0x8')](),controller[_0x83a8('0xf')]);router['delete']('/:id',auth[_0x83a8('0x8')](),controller[_0x83a8('0x10')]);module[_0x83a8('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f6f7664..444aa5c 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 _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 +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x10a557,_0x409d8d){var _0xc64f73=function(_0x56e137){while(--_0x56e137){_0x10a557['push'](_0x10a557['shift']());}};_0xc64f73(++_0x409d8d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x00bb[_0x1e7b16];return _0x37fadc;};'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 diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index f39d6a8..07db85d 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 _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 +var _0xe60d=['fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','then','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes'];(function(_0x220e84,_0x58a759){var _0x3dfbed=function(_0x1ef06b){while(--_0x1ef06b){_0x220e84['push'](_0x220e84['shift']());}};_0x3dfbed(++_0x58a759);}(_0xe60d,0x1e4));var _0xde60=function(_0x54177e,_0x44595e){_0x54177e=_0x54177e-0x0;var _0x4e6f9d=_0xe60d[_0x54177e];return _0x4e6f9d;};'use strict';var emlformat=require(_0xde60('0x0'));var rimraf=require(_0xde60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde60('0x2'));var rp=require('request-promise');var moment=require(_0xde60('0x3'));var BPromise=require(_0xde60('0x4'));var Mustache=require('mustache');var util=require(_0xde60('0x5'));var path=require(_0xde60('0x6'));var sox=require(_0xde60('0x7'));var csv=require('to-csv');var ejs=require(_0xde60('0x8'));var fs=require('fs');var fs_extra=require(_0xde60('0x9'));var _=require(_0xde60('0xa'));var squel=require(_0xde60('0xb'));var crypto=require(_0xde60('0xc'));var jsforce=require(_0xde60('0xd'));var deskjs=require(_0xde60('0xe'));var toCsv=require(_0xde60('0xf'));var querystring=require(_0xde60('0x10'));var Papa=require(_0xde60('0x11'));var Redis=require('ioredis');var authService=require(_0xde60('0x12'));var qs=require(_0xde60('0x13'));var as=require(_0xde60('0x14'));var hardwareService=require(_0xde60('0x15'));var logger=require('../../config/logger')(_0xde60('0x16'));var utils=require(_0xde60('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2064f5,_0x4ce4a1){_0x4ce4a1=_0x4ce4a1||0xcc;return function(_0x61b50){if(_0x61b50){return _0x2064f5[_0xde60('0x19')](_0x4ce4a1);}return _0x2064f5[_0xde60('0x1a')](_0x4ce4a1)[_0xde60('0x1b')]();};}function respondWithResult(_0x4cea97,_0xd86875){_0xd86875=_0xd86875||0xc8;return function(_0x3a576d){if(_0x3a576d){return _0x4cea97[_0xde60('0x1a')](_0xd86875)['json'](_0x3a576d);}};}function respondWithFilteredResult(_0x27c2a4,_0x5e7a3b){return function(_0x543585){if(_0x543585){var _0x384cf1=typeof _0x5e7a3b['offset']===_0xde60('0x1c')&&typeof _0x5e7a3b[_0xde60('0x1d')]===_0xde60('0x1c');var _0x245cb6=_0x543585[_0xde60('0x1e')];var _0x47c299=_0x384cf1?0x0:_0x5e7a3b[_0xde60('0x1f')];var _0x1df2ab=_0x384cf1?_0x543585[_0xde60('0x1e')]:_0x5e7a3b['offset']+_0x5e7a3b[_0xde60('0x1d')];var _0x59f97d;if(_0x1df2ab>=_0x245cb6){_0x1df2ab=_0x245cb6;_0x59f97d=0xc8;}else{_0x59f97d=0xce;}_0x27c2a4[_0xde60('0x1a')](_0x59f97d);return _0x27c2a4[_0xde60('0x20')](_0xde60('0x21'),_0x47c299+'-'+_0x1df2ab+'/'+_0x245cb6)[_0xde60('0x22')](_0x543585);}return null;};}function patchUpdates(_0x185e4c){return function(_0x348ec7){try{jsonpatch[_0xde60('0x23')](_0x348ec7,_0x185e4c,!![]);}catch(_0x32f5cc){return BPromise[_0xde60('0x24')](_0x32f5cc);}return _0x348ec7[_0xde60('0x25')]();};}function saveUpdates(_0x147dd6,_0x175b4e){return function(_0xb08bf7){if(_0xb08bf7){return _0xb08bf7[_0xde60('0x26')](_0x147dd6)['then'](function(_0x304d9c){return _0x304d9c;});}return null;};}function removeEntity(_0x143cec,_0x3909cb){return function(_0x3460d2){if(_0x3460d2){return _0x3460d2[_0xde60('0x27')]()['then'](function(){_0x143cec[_0xde60('0x1a')](0xcc)[_0xde60('0x1b')]();});}};}function handleEntityNotFound(_0xe69dbb,_0x49d355){return function(_0x2595e4){if(!_0x2595e4){_0xe69dbb['sendStatus'](0x194);}return _0x2595e4;};}function handleError(_0x52d8a,_0x31f674){_0x31f674=_0x31f674||0x1f4;return function(_0x4c6643){logger[_0xde60('0x28')](_0x4c6643[_0xde60('0x29')]);if(_0x4c6643[_0xde60('0x2a')]){delete _0x4c6643[_0xde60('0x2a')];}_0x52d8a[_0xde60('0x1a')](_0x31f674)[_0xde60('0x2b')](_0x4c6643);};}exports[_0xde60('0x2c')]=function(_0x3193cb,_0x2de8c1){var _0x5780bf={},_0x18bcff={},_0x5efe7e={'count':0x0,'rows':[]};var _0x55e82e=_[_0xde60('0x2d')](db[_0xde60('0x2e')][_0xde60('0x2f')],function(_0x2c9224){return{'name':_0x2c9224[_0xde60('0x30')],'type':_0x2c9224['type']['key']};});_0x18bcff[_0xde60('0x31')]=_[_0xde60('0x2d')](_0x55e82e,'name');_0x18bcff[_0xde60('0x32')]=_[_0xde60('0x33')](_0x3193cb[_0xde60('0x32')]);_0x18bcff[_0xde60('0x34')]=_[_0xde60('0x35')](_0x18bcff[_0xde60('0x31')],_0x18bcff[_0xde60('0x32')]);_0x5780bf[_0xde60('0x36')]=_[_0xde60('0x35')](_0x18bcff[_0xde60('0x31')],qs['fields'](_0x3193cb[_0xde60('0x32')][_0xde60('0x37')]));_0x5780bf[_0xde60('0x36')]=_0x5780bf[_0xde60('0x36')][_0xde60('0x38')]?_0x5780bf['attributes']:_0x18bcff[_0xde60('0x31')];if(!_0x3193cb[_0xde60('0x32')][_0xde60('0x39')](_0xde60('0x3a'))){_0x5780bf[_0xde60('0x1d')]=qs[_0xde60('0x1d')](_0x3193cb['query']['limit']);_0x5780bf[_0xde60('0x1f')]=qs['offset'](_0x3193cb[_0xde60('0x32')][_0xde60('0x1f')]);}_0x5780bf[_0xde60('0x3b')]=qs[_0xde60('0x3c')](_0x3193cb[_0xde60('0x32')][_0xde60('0x3c')]);_0x5780bf[_0xde60('0x3d')]=qs[_0xde60('0x34')](_['pick'](_0x3193cb['query'],_0x18bcff['filters']),_0x55e82e);if(_0x3193cb[_0xde60('0x32')]['filter']){_0x5780bf[_0xde60('0x3d')]=_[_0xde60('0x3e')](_0x5780bf['where'],{'$or':_[_0xde60('0x2d')](_0x55e82e,function(_0x23b5c6){if(_0x23b5c6[_0xde60('0x3f')]!==_0xde60('0x40')){var _0x4fa78d={};_0x4fa78d[_0x23b5c6['name']]={'$like':'%'+_0x3193cb[_0xde60('0x32')]['filter']+'%'};return _0x4fa78d;}})});}_0x5780bf=_[_0xde60('0x3e')]({},_0x5780bf,_0x3193cb['options']);var _0x4021e5={'where':_0x5780bf[_0xde60('0x3d')]};return db['MailTransferReport'][_0xde60('0x1e')](_0x4021e5)[_0xde60('0x41')](function(_0x1fe92d){_0x5efe7e[_0xde60('0x1e')]=_0x1fe92d;if(_0x3193cb[_0xde60('0x32')][_0xde60('0x42')]){_0x5780bf[_0xde60('0x43')]=[{'all':!![]}];}return db['MailTransferReport'][_0xde60('0x44')](_0x5780bf);})[_0xde60('0x41')](function(_0x4f8186){_0x5efe7e[_0xde60('0x45')]=_0x4f8186;return _0x5efe7e;})[_0xde60('0x41')](respondWithFilteredResult(_0x2de8c1,_0x5780bf))[_0xde60('0x46')](handleError(_0x2de8c1,null));};exports['show']=function(_0x3d9a9f,_0xe01a3a){var _0x349e04={'raw':!![],'where':{'id':_0x3d9a9f['params']['id']}},_0x48d9f6={};_0x48d9f6[_0xde60('0x31')]=_[_0xde60('0x33')](db[_0xde60('0x2e')][_0xde60('0x2f')]);_0x48d9f6[_0xde60('0x32')]=_['keys'](_0x3d9a9f['query']);_0x48d9f6[_0xde60('0x34')]=_[_0xde60('0x35')](_0x48d9f6[_0xde60('0x31')],_0x48d9f6[_0xde60('0x32')]);_0x349e04[_0xde60('0x36')]=_[_0xde60('0x35')](_0x48d9f6[_0xde60('0x31')],qs['fields'](_0x3d9a9f[_0xde60('0x32')][_0xde60('0x37')]));_0x349e04[_0xde60('0x36')]=_0x349e04[_0xde60('0x36')][_0xde60('0x38')]?_0x349e04[_0xde60('0x36')]:_0x48d9f6[_0xde60('0x31')];if(_0x3d9a9f[_0xde60('0x32')]['includeAll']){_0x349e04[_0xde60('0x43')]=[{'all':!![]}];}_0x349e04=_['merge']({},_0x349e04,_0x3d9a9f['options']);return db[_0xde60('0x2e')][_0xde60('0x47')](_0x349e04)[_0xde60('0x41')](handleEntityNotFound(_0xe01a3a,null))[_0xde60('0x41')](respondWithResult(_0xe01a3a,null))[_0xde60('0x46')](handleError(_0xe01a3a,null));};exports['create']=function(_0x5b92a4,_0x31e13d){return db[_0xde60('0x2e')][_0xde60('0x48')](_0x5b92a4[_0xde60('0x49')],{})[_0xde60('0x41')](respondWithResult(_0x31e13d,0xc9))[_0xde60('0x46')](handleError(_0x31e13d,null));};exports[_0xde60('0x26')]=function(_0x43cc33,_0x4f68f8){if(_0x43cc33[_0xde60('0x49')]['id']){delete _0x43cc33[_0xde60('0x49')]['id'];}return db[_0xde60('0x2e')]['find']({'where':{'id':_0x43cc33[_0xde60('0x4a')]['id']}})[_0xde60('0x41')](handleEntityNotFound(_0x4f68f8,null))[_0xde60('0x41')](saveUpdates(_0x43cc33[_0xde60('0x49')],null))[_0xde60('0x41')](respondWithResult(_0x4f68f8,null))[_0xde60('0x46')](handleError(_0x4f68f8,null));};exports[_0xde60('0x27')]=function(_0x42e52b,_0x5b3a1a){return db[_0xde60('0x2e')][_0xde60('0x47')]({'where':{'id':_0x42e52b[_0xde60('0x4a')]['id']}})[_0xde60('0x41')](handleEntityNotFound(_0x5b3a1a,null))[_0xde60('0x41')](removeEntity(_0x5b3a1a,null))[_0xde60('0x46')](handleError(_0x5b3a1a,null));};exports[_0xde60('0x4b')]=function(_0x117a72,_0x15f526){return db[_0xde60('0x2e')][_0xde60('0x4b')]()[_0xde60('0x41')](respondWithResult(_0x15f526,null))['catch'](handleError(_0x15f526,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b0f8a14..d108294 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 _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 +var _0x82f5=['uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82f5,0x15d));var _0x582f=function(_0x244832,_0x417374){_0x244832=_0x244832-0x0;var _0x284be4=_0x82f5[_0x244832];return _0x284be4;};'use strict';var _=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var logger=require(_0x582f('0x2'))(_0x582f('0x3'));var moment=require(_0x582f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x582f('0x5'));var rimraf=require(_0x582f('0x6'));var config=require(_0x582f('0x7'));var attributes=require(_0x582f('0x8'));module[_0x582f('0x9')]=function(_0x15d332,_0x459755){return _0x15d332['define'](_0x582f('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x582f('0xb'),'fields':[_0x582f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 65ad821..7ac11a6 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 _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 +var _0x1bb6=['request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','MailTransferReport,\x20%s,\x20%s'];(function(_0x49cb92,_0x3c31a6){var _0x16ee5a=function(_0x48e0c6){while(--_0x48e0c6){_0x49cb92['push'](_0x49cb92['shift']());}};_0x16ee5a(++_0x3c31a6);}(_0x1bb6,0xcd));var _0x61bb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1bb6[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x61bb('0x0'));var util=require(_0x61bb('0x1'));var moment=require('moment');var BPromise=require(_0x61bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61bb('0x3'));var db=require(_0x61bb('0x4'))['db'];var utils=require(_0x61bb('0x5'));var logger=require(_0x61bb('0x6'))('rpc');var config=require(_0x61bb('0x7'));var jayson=require(_0x61bb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5015,_0x1bef4f,_0x3bf3f1){return new BPromise(function(_0x5bdbdb,_0x20d3b9){return client[_0x61bb('0x9')](_0x4d5015,_0x3bf3f1)['then'](function(_0x36a19d){logger['info'](_0x61bb('0xa'),_0x1bef4f,_0x61bb('0xb'));logger['debug'](_0x61bb('0xc'),_0x1bef4f,_0x61bb('0xb'),JSON[_0x61bb('0xd')](_0x36a19d));if(_0x36a19d['error']){if(_0x36a19d[_0x61bb('0xe')][_0x61bb('0xf')]===0x1f4){logger[_0x61bb('0xe')](_0x61bb('0xa'),_0x1bef4f,_0x36a19d['error']['message']);return _0x20d3b9(_0x36a19d[_0x61bb('0xe')][_0x61bb('0x10')]);}logger[_0x61bb('0xe')](_0x61bb('0xa'),_0x1bef4f,_0x36a19d[_0x61bb('0xe')]['message']);return _0x5bdbdb(_0x36a19d[_0x61bb('0xe')][_0x61bb('0x10')]);}else{logger['info'](_0x61bb('0xa'),_0x1bef4f,_0x61bb('0xb'));_0x5bdbdb(_0x36a19d['result'][_0x61bb('0x10')]);}})[_0x61bb('0x11')](function(_0x411ea8){logger[_0x61bb('0xe')](_0x61bb('0xa'),_0x1bef4f,_0x411ea8);_0x20d3b9(_0x411ea8);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 9ba4c37..500e583 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 _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 +var _0x41df=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x41df,0xbc));var _0xf41d=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x41df[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0xf41d('0x0'));var util=require(_0xf41d('0x1'));var path=require(_0xf41d('0x2'));var timeout=require(_0xf41d('0x3'));var express=require('express');var router=express[_0xf41d('0x4')]();var fs_extra=require(_0xf41d('0x5'));var auth=require(_0xf41d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf41d('0x7'));var controller=require(_0xf41d('0x8'));router[_0xf41d('0x9')]('/',auth[_0xf41d('0xa')](),controller[_0xf41d('0xb')]);router[_0xf41d('0x9')](_0xf41d('0xc'),auth[_0xf41d('0xa')](),controller[_0xf41d('0xd')]);router[_0xf41d('0x9')](_0xf41d('0xe'),auth[_0xf41d('0xa')](),controller[_0xf41d('0xf')]);router[_0xf41d('0x10')]('/',auth['isAuthenticated'](),controller[_0xf41d('0x11')]);router[_0xf41d('0x12')](_0xf41d('0xe'),auth['isAuthenticated'](),controller[_0xf41d('0x13')]);router[_0xf41d('0x14')]('/:id',auth[_0xf41d('0xa')](),controller[_0xf41d('0x15')]);module[_0xf41d('0x16')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9a66b81..d704329 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 _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 +var _0x7802=['INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x344d08,_0x1bad64){var _0x2270c1=function(_0x3ecffa){while(--_0x3ecffa){_0x344d08['push'](_0x344d08['shift']());}};_0x2270c1(++_0x1bad64);}(_0x7802,0x105));var _0x2780=function(_0x2ac84e,_0x3d8931){_0x2ac84e=_0x2ac84e-0x0;var _0x481a04=_0x7802[_0x2ac84e];return _0x481a04;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2780('0x0'));module[_0x2780('0x1')]={'channel':{'type':Sequelize[_0x2780('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2780('0x2')]},'type':{'type':Sequelize[_0x2780('0x2')],'defaultValue':_0x2780('0x3'),'comment':_0x2780('0x4')},'duration':{'type':Sequelize[_0x2780('0x5')]},'enterAt':{'type':Sequelize[_0x2780('0x6')]},'exitAt':{'type':Sequelize[_0x2780('0x6')],'set':function(_0xb0e30e){var _0x2c2665=moment(_0xb0e30e);var _0x5b9f0a=moment(this[_0x2780('0x7')](_0x2780('0x8')));var _0x4b786c=_0x2c2665[_0x2780('0x9')](_0x5b9f0a,_0x2780('0xa'));this[_0x2780('0xb')](_0x2780('0xc'),_0xb0e30e);this[_0x2780('0xb')](_0x2780('0xd'),_0x4b786c>=0x0?_0x4b786c:null);}},'data1':{'type':Sequelize[_0x2780('0x2')],'comment':_0x2780('0xe')},'data2':{'type':Sequelize[_0x2780('0x2')],'comment':_0x2780('0xf')},'data3':{'type':Sequelize[_0x2780('0x2')],'comment':_0x2780('0x10')},'data4':{'type':Sequelize['STRING'],'comment':_0x2780('0x11')},'data5':{'type':Sequelize[_0x2780('0x2')],'comment':_0x2780('0x12')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x2780('0x5')]},'uniqueid':{'type':Sequelize[_0x2780('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 13383ea..97c3732 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 _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 +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x34e8,0x12c));var _0x834e=function(_0x28214e,_0x54f40c){_0x28214e=_0x28214e-0x0;var _0x158317=_0x34e8[_0x28214e];return _0x158317;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index ec3d9be..68b939d 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 _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 +var _0x2f78=['api','moment','path','rimraf','../../config/environment','./memberReport.attributes','report_member','membername','lodash','../../config/logger'];(function(_0xae272d,_0x1f0b3b){var _0x2ce089=function(_0x52f4ff){while(--_0x52f4ff){_0xae272d['push'](_0xae272d['shift']());}};_0x2ce089(++_0x1f0b3b);}(_0x2f78,0xa8));var _0x82f7=function(_0x460ec1,_0x509a70){_0x460ec1=_0x460ec1-0x0;var _0x311e94=_0x2f78[_0x460ec1];return _0x311e94;};'use strict';var _=require(_0x82f7('0x0'));var util=require('util');var logger=require(_0x82f7('0x1'))(_0x82f7('0x2'));var moment=require(_0x82f7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x82f7('0x4'));var rimraf=require(_0x82f7('0x5'));var config=require(_0x82f7('0x6'));var attributes=require(_0x82f7('0x7'));module['exports']=function(_0x375b6d,_0x28c04){return _0x375b6d['define']('MemberReport',attributes,{'tableName':_0x82f7('0x8'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x82f7('0x9'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 66f8ecb..336d3e0 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 _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 +var _0x5d59=['raw','attributes','limit','include','map','model','catch','CreateMemberReport','create','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options'];(function(_0x247a5e,_0x40b75d){var _0x16e004=function(_0x4e38c7){while(--_0x4e38c7){_0x247a5e['push'](_0x247a5e['shift']());}};_0x16e004(++_0x40b75d);}(_0x5d59,0x15f));var _0x95d5=function(_0x40b7fc,_0x51c685){_0x40b7fc=_0x40b7fc-0x0;var _0xe7387a=_0x5d59[_0x40b7fc];return _0xe7387a;};'use strict';var _=require('lodash');var util=require(_0x95d5('0x0'));var moment=require(_0x95d5('0x1'));var BPromise=require(_0x95d5('0x2'));var rs=require(_0x95d5('0x3'));var fs=require('fs');var Redis=require(_0x95d5('0x4'));var db=require(_0x95d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95d5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x95d5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfe94c,_0x11b2d4,_0x121537){return new BPromise(function(_0x489fab,_0x179d43){return client['request'](_0xfe94c,_0x121537)[_0x95d5('0x8')](function(_0x55249d){logger[_0x95d5('0x9')](_0x95d5('0xa'),_0x11b2d4,_0x95d5('0xb'));logger[_0x95d5('0xc')](_0x95d5('0xd'),_0x11b2d4,_0x95d5('0xb'),JSON[_0x95d5('0xe')](_0x55249d));if(_0x55249d[_0x95d5('0xf')]){if(_0x55249d['error'][_0x95d5('0x10')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x11b2d4,_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);return _0x179d43(_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);}logger['error'](_0x95d5('0xa'),_0x11b2d4,_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);return _0x489fab(_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);}else{logger[_0x95d5('0x9')](_0x95d5('0xa'),_0x11b2d4,_0x95d5('0xb'));_0x489fab(_0x55249d[_0x95d5('0x12')]['message']);}})['catch'](function(_0x1747f2){logger['error'](_0x95d5('0xa'),_0x11b2d4,_0x1747f2);_0x179d43(_0x1747f2);});});}exports[_0x95d5('0x13')]=function(_0x5bdf14){var _0x1fe609=this;return new Promise(function(_0x3793eb,_0x233a32){return db[_0x95d5('0x14')][_0x95d5('0x15')]({'raw':_0x5bdf14[_0x95d5('0x16')]?_0x5bdf14['options'][_0x95d5('0x17')]===undefined?!![]:![]:!![],'where':_0x5bdf14[_0x95d5('0x16')]?_0x5bdf14[_0x95d5('0x16')]['where']||null:null,'attributes':_0x5bdf14['options']?_0x5bdf14[_0x95d5('0x16')][_0x95d5('0x18')]||null:null,'limit':_0x5bdf14['options']?_0x5bdf14[_0x95d5('0x16')][_0x95d5('0x19')]||null:null,'include':_0x5bdf14[_0x95d5('0x16')]?_0x5bdf14['options'][_0x95d5('0x1a')]?_['map'](_0x5bdf14['options']['include'],function(_0x554f4d){return{'model':db[_0x554f4d['model']],'as':_0x554f4d['as'],'attributes':_0x554f4d['attributes'],'include':_0x554f4d[_0x95d5('0x1a')]?_[_0x95d5('0x1b')](_0x554f4d[_0x95d5('0x1a')],function(_0x260582){return{'model':db[_0x260582['model']],'as':_0x260582['as'],'attributes':_0x260582[_0x95d5('0x18')],'include':_0x260582[_0x95d5('0x1a')]?_[_0x95d5('0x1b')](_0x260582[_0x95d5('0x1a')],function(_0xe12a95){return{'model':db[_0xe12a95[_0x95d5('0x1c')]],'as':_0xe12a95['as'],'attributes':_0xe12a95[_0x95d5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x95d5('0x8')](function(_0x3fde81){logger[_0x95d5('0x9')]('GetMemberReport',_0x5bdf14);logger['debug'](_0x95d5('0x13'),_0x5bdf14,JSON[_0x95d5('0xe')](_0x3fde81));_0x3793eb(_0x3fde81);})[_0x95d5('0x1d')](function(_0x5dfe00){logger[_0x95d5('0xf')]('GetMemberReport',_0x5dfe00[_0x95d5('0x11')],_0x5bdf14);_0x233a32(_0x1fe609['error'](0x1f4,_0x5dfe00[_0x95d5('0x11')]));});});};exports[_0x95d5('0x1e')]=function(_0x333459){var _0x21d4ff=this;return new Promise(function(_0x44d803,_0x362b8){return db[_0x95d5('0x14')][_0x95d5('0x1f')](_0x333459['body'],{'raw':_0x333459['options']?_0x333459['options'][_0x95d5('0x17')]===undefined?!![]:![]:!![]})[_0x95d5('0x8')](function(_0x243210){logger[_0x95d5('0x9')](_0x95d5('0x1e'),_0x333459);logger[_0x95d5('0xc')]('CreateMemberReport',_0x333459,JSON[_0x95d5('0xe')](_0x243210));_0x44d803(_0x243210);})[_0x95d5('0x1d')](function(_0x37c8c4){logger[_0x95d5('0xf')](_0x95d5('0x1e'),_0x37c8c4[_0x95d5('0x11')],_0x333459);_0x362b8(_0x21d4ff[_0x95d5('0xf')](0x1f4,_0x37c8c4[_0x95d5('0x11')]));});});};exports[_0x95d5('0x20')]=function(_0x47d034){var _0x5031cd=this;return new Promise(function(_0x294314,_0x3201dc){return db[_0x95d5('0x14')][_0x95d5('0x21')](_0x47d034['body'],{'raw':_0x47d034[_0x95d5('0x16')]?_0x47d034['options'][_0x95d5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47d034[_0x95d5('0x16')]?_0x47d034[_0x95d5('0x16')]['where']||null:null,'attributes':_0x47d034[_0x95d5('0x16')]?_0x47d034[_0x95d5('0x16')][_0x95d5('0x18')]||null:null,'limit':_0x47d034[_0x95d5('0x16')]?_0x47d034[_0x95d5('0x16')][_0x95d5('0x19')]||null:null})['then'](function(_0x1b1b0e){logger[_0x95d5('0x9')](_0x95d5('0x20'),_0x47d034);logger[_0x95d5('0xc')](_0x95d5('0x20'),_0x47d034,JSON[_0x95d5('0xe')](_0x1b1b0e));_0x294314(_0x1b1b0e);})[_0x95d5('0x1d')](function(_0x459059){logger[_0x95d5('0xf')](_0x95d5('0x20'),_0x459059['message'],_0x47d034);_0x3201dc(_0x5031cd['error'](0x1f4,_0x459059[_0x95d5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index bce897d..ee0e5ce 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 _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 +var _0x8169=['../../components/auth/service','./migration.controller','get','exports','multer','path','Router','fs-extra'];(function(_0x36dc1d,_0x248a85){var _0x1541b5=function(_0x2b92b1){while(--_0x2b92b1){_0x36dc1d['push'](_0x36dc1d['shift']());}};_0x1541b5(++_0x248a85);}(_0x8169,0xd4));var _0x9816=function(_0x30d568,_0x3c9f9b){_0x30d568=_0x30d568-0x0;var _0x10e8ff=_0x8169[_0x30d568];return _0x10e8ff;};'use strict';var multer=require(_0x9816('0x0'));var util=require('util');var path=require(_0x9816('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9816('0x2')]();var fs_extra=require(_0x9816('0x3'));var auth=require(_0x9816('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9816('0x5'));router[_0x9816('0x6')]('/',controller['index']);module[_0x9816('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9f40fd0..a8ab491 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 _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 +var _0xe1ba=['sequelize','exports','STRING','version'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xe1ba,0x1b0));var _0xae1b=function(_0x2a1ff7,_0x4e44cb){_0x2a1ff7=_0x2a1ff7-0x0;var _0x168537=_0xe1ba[_0x2a1ff7];return _0x168537;};'use strict';var Sequelize=require(_0xae1b('0x0'));module[_0xae1b('0x1')]={'version':{'type':Sequelize[_0xae1b('0x2')],'unique':_0xae1b('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 16434a1..6673232 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 _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 +var _0xdc6f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xdc6f,0x8c));var _0xfdc6=function(_0x9c5512,_0x5651f1){_0x9c5512=_0x9c5512-0x0;var _0x5c4f5d=_0xdc6f[_0x9c5512];return _0x5c4f5d;};'use strict';var emlformat=require(_0xfdc6('0x0'));var rimraf=require(_0xfdc6('0x1'));var zipdir=require(_0xfdc6('0x2'));var jsonpatch=require(_0xfdc6('0x3'));var rp=require(_0xfdc6('0x4'));var moment=require(_0xfdc6('0x5'));var BPromise=require(_0xfdc6('0x6'));var Mustache=require(_0xfdc6('0x7'));var util=require(_0xfdc6('0x8'));var path=require(_0xfdc6('0x9'));var sox=require(_0xfdc6('0xa'));var csv=require(_0xfdc6('0xb'));var ejs=require(_0xfdc6('0xc'));var fs=require('fs');var fs_extra=require(_0xfdc6('0xd'));var _=require('lodash');var squel=require(_0xfdc6('0xe'));var crypto=require(_0xfdc6('0xf'));var jsforce=require(_0xfdc6('0x10'));var deskjs=require(_0xfdc6('0x11'));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('../../components/parsers/qs');var as=require(_0xfdc6('0x12'));var hardwareService=require(_0xfdc6('0x13'));var logger=require(_0xfdc6('0x14'))(_0xfdc6('0x15'));var utils=require(_0xfdc6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfdc6('0x17'));var db=require(_0xfdc6('0x18'))['db'];function respondWithStatusCode(_0x3142f2,_0x202330){_0x202330=_0x202330||0xcc;return function(_0x3be1d4){if(_0x3be1d4){return _0x3142f2[_0xfdc6('0x19')](_0x202330);}return _0x3142f2[_0xfdc6('0x1a')](_0x202330)['end']();};}function respondWithResult(_0x3c9774,_0x489c6e){_0x489c6e=_0x489c6e||0xc8;return function(_0x743a44){if(_0x743a44){return _0x3c9774[_0xfdc6('0x1a')](_0x489c6e)['json'](_0x743a44);}};}function respondWithFilteredResult(_0x39d7ed,_0x46ad4b){return function(_0x67735e){if(_0x67735e){var _0x528d83=typeof _0x46ad4b[_0xfdc6('0x1b')]===_0xfdc6('0x1c')&&typeof _0x46ad4b[_0xfdc6('0x1d')]===_0xfdc6('0x1c');var _0xedeed5=_0x67735e[_0xfdc6('0x1e')];var _0x5ed3f9=_0x528d83?0x0:_0x46ad4b[_0xfdc6('0x1b')];var _0x29b8f0=_0x528d83?_0x67735e[_0xfdc6('0x1e')]:_0x46ad4b[_0xfdc6('0x1b')]+_0x46ad4b[_0xfdc6('0x1d')];var _0x1915eb;if(_0x29b8f0>=_0xedeed5){_0x29b8f0=_0xedeed5;_0x1915eb=0xc8;}else{_0x1915eb=0xce;}_0x39d7ed[_0xfdc6('0x1a')](_0x1915eb);return _0x39d7ed[_0xfdc6('0x1f')](_0xfdc6('0x20'),_0x5ed3f9+'-'+_0x29b8f0+'/'+_0xedeed5)[_0xfdc6('0x21')](_0x67735e);}return null;};}function patchUpdates(_0x4058c3){return function(_0x3d2f57){try{jsonpatch[_0xfdc6('0x22')](_0x3d2f57,_0x4058c3,!![]);}catch(_0x2cbd5c){return BPromise['reject'](_0x2cbd5c);}return _0x3d2f57[_0xfdc6('0x23')]();};}function saveUpdates(_0x13c630,_0x3828b4){return function(_0x17b55c){if(_0x17b55c){return _0x17b55c[_0xfdc6('0x24')](_0x13c630)[_0xfdc6('0x25')](function(_0x214a8d){return _0x214a8d;});}return null;};}function removeEntity(_0x25086d,_0x576916){return function(_0x2f1713){if(_0x2f1713){return _0x2f1713[_0xfdc6('0x26')]()['then'](function(){_0x25086d[_0xfdc6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbf46d9,_0x37ed25){return function(_0x42257c){if(!_0x42257c){_0xbf46d9[_0xfdc6('0x19')](0x194);}return _0x42257c;};}function handleError(_0x5bf0ff,_0x2a9156){_0x2a9156=_0x2a9156||0x1f4;return function(_0x2a2c26){logger['error'](_0x2a2c26[_0xfdc6('0x27')]);if(_0x2a2c26[_0xfdc6('0x28')]){delete _0x2a2c26[_0xfdc6('0x28')];}_0x5bf0ff[_0xfdc6('0x1a')](_0x2a9156)[_0xfdc6('0x29')](_0x2a2c26);};}exports[_0xfdc6('0x2a')]=function(_0x2a7c69,_0x48ad97){var _0x18a398={},_0x4f5991={},_0x1b55ee={'count':0x0,'rows':[]};var _0x234639=_[_0xfdc6('0x2b')](db[_0xfdc6('0x2c')][_0xfdc6('0x2d')],function(_0x2166bb){return{'name':_0x2166bb[_0xfdc6('0x2e')],'type':_0x2166bb[_0xfdc6('0x2f')][_0xfdc6('0x30')]};});_0x4f5991[_0xfdc6('0x31')]=_[_0xfdc6('0x2b')](_0x234639,_0xfdc6('0x28'));_0x4f5991[_0xfdc6('0x32')]=_[_0xfdc6('0x33')](_0x2a7c69[_0xfdc6('0x32')]);_0x4f5991[_0xfdc6('0x34')]=_[_0xfdc6('0x35')](_0x4f5991['model'],_0x4f5991[_0xfdc6('0x32')]);_0x18a398[_0xfdc6('0x36')]=_['intersection'](_0x4f5991['model'],qs[_0xfdc6('0x37')](_0x2a7c69[_0xfdc6('0x32')][_0xfdc6('0x37')]));_0x18a398['attributes']=_0x18a398[_0xfdc6('0x36')]['length']?_0x18a398[_0xfdc6('0x36')]:_0x4f5991['model'];if(!_0x2a7c69[_0xfdc6('0x32')][_0xfdc6('0x38')]('nolimit')){_0x18a398[_0xfdc6('0x1d')]=qs[_0xfdc6('0x1d')](_0x2a7c69[_0xfdc6('0x32')]['limit']);_0x18a398[_0xfdc6('0x1b')]=qs['offset'](_0x2a7c69[_0xfdc6('0x32')][_0xfdc6('0x1b')]);}_0x18a398[_0xfdc6('0x39')]=qs[_0xfdc6('0x3a')](_0x2a7c69[_0xfdc6('0x32')][_0xfdc6('0x3a')]);_0x18a398[_0xfdc6('0x3b')]=qs[_0xfdc6('0x34')](_[_0xfdc6('0x3c')](_0x2a7c69[_0xfdc6('0x32')],_0x4f5991['filters']),_0x234639);if(_0x2a7c69[_0xfdc6('0x32')]['filter']){_0x18a398['where']=_[_0xfdc6('0x3d')](_0x18a398[_0xfdc6('0x3b')],{'$or':_['map'](_0x234639,function(_0x183231){if(_0x183231[_0xfdc6('0x2f')]!==_0xfdc6('0x3e')){var _0x79bb0d={};_0x79bb0d[_0x183231[_0xfdc6('0x28')]]={'$like':'%'+_0x2a7c69[_0xfdc6('0x32')][_0xfdc6('0x3f')]+'%'};return _0x79bb0d;}})});}_0x18a398=_[_0xfdc6('0x3d')]({},_0x18a398,_0x2a7c69[_0xfdc6('0x40')]);var _0xb58fdc={'where':_0x18a398[_0xfdc6('0x3b')]};return db['Migration'][_0xfdc6('0x1e')](_0xb58fdc)[_0xfdc6('0x25')](function(_0x49c52e){_0x1b55ee['count']=_0x49c52e;if(_0x2a7c69['query'][_0xfdc6('0x41')]){_0x18a398[_0xfdc6('0x42')]=[{'all':!![]}];}return db[_0xfdc6('0x2c')][_0xfdc6('0x43')](_0x18a398);})['then'](function(_0x5c57a9){_0x1b55ee[_0xfdc6('0x44')]=_0x5c57a9;return _0x1b55ee;})['then'](respondWithFilteredResult(_0x48ad97,_0x18a398))[_0xfdc6('0x45')](handleError(_0x48ad97,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 82d0c26..21b1b78 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 _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 +var _0xe918=['../../config/logger','moment','bluebird','rimraf','./migration.attributes','exports','migrations','lodash','util'];(function(_0x465c18,_0x5c2a07){var _0x4907df=function(_0x5d2217){while(--_0x5d2217){_0x465c18['push'](_0x465c18['shift']());}};_0x4907df(++_0x5c2a07);}(_0xe918,0x1c0));var _0x8e91=function(_0x310870,_0x5d4149){_0x310870=_0x310870-0x0;var _0x5f2b2a=_0xe918[_0x310870];return _0x5f2b2a;};'use strict';var _=require(_0x8e91('0x0'));var util=require(_0x8e91('0x1'));var logger=require(_0x8e91('0x2'))('api');var moment=require(_0x8e91('0x3'));var BPromise=require(_0x8e91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8e91('0x5'));var config=require('../../config/environment');var attributes=require(_0x8e91('0x6'));module[_0x8e91('0x7')]=function(_0x495e38,_0x1f98f2){return _0x495e38['define']('Migration',attributes,{'tableName':_0x8e91('0x8'),'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 1780dfb..d88b1af 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 _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 +var _0x1339=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x101d87,_0x2c2297){var _0x391e89=function(_0xe41c85){while(--_0xe41c85){_0x101d87['push'](_0x101d87['shift']());}};_0x391e89(++_0x2c2297);}(_0x1339,0x1bf));var _0x9133=function(_0x155e20,_0x5b2b32){_0x155e20=_0x155e20-0x0;var _0x306192=_0x1339[_0x155e20];return _0x306192;};'use strict';var _=require(_0x9133('0x0'));var util=require(_0x9133('0x1'));var moment=require('moment');var BPromise=require(_0x9133('0x2'));var rs=require(_0x9133('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9133('0x4'));var logger=require(_0x9133('0x5'))('rpc');var config=require(_0x9133('0x6'));var jayson=require(_0x9133('0x7'));var client=jayson[_0x9133('0x8')][_0x9133('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x81460c,_0x524719,_0x4c7852){return new BPromise(function(_0x2c37ce,_0x5762bc){return client[_0x9133('0xa')](_0x81460c,_0x4c7852)['then'](function(_0x41af31){logger['info'](_0x9133('0xb'),_0x524719,_0x9133('0xc'));logger[_0x9133('0xd')](_0x9133('0xe'),_0x524719,'request\x20sent',JSON['stringify'](_0x41af31));if(_0x41af31['error']){if(_0x41af31[_0x9133('0xf')][_0x9133('0x10')]===0x1f4){logger[_0x9133('0xf')]('Migration,\x20%s,\x20%s',_0x524719,_0x41af31[_0x9133('0xf')][_0x9133('0x11')]);return _0x5762bc(_0x41af31[_0x9133('0xf')][_0x9133('0x11')]);}logger[_0x9133('0xf')](_0x9133('0xb'),_0x524719,_0x41af31[_0x9133('0xf')][_0x9133('0x11')]);return _0x2c37ce(_0x41af31[_0x9133('0xf')]['message']);}else{logger[_0x9133('0x12')]('Migration,\x20%s,\x20%s',_0x524719,'request\x20sent');_0x2c37ce(_0x41af31[_0x9133('0x13')][_0x9133('0x11')]);}})[_0x9133('0x14')](function(_0x34432e){logger[_0x9133('0xf')](_0x9133('0xb'),_0x524719,_0x34432e);_0x5762bc(_0x34432e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 150e6f0..79703c3 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 _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 +var _0x1fa9=['put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','post','create'];(function(_0x5e9e76,_0x26fd08){var _0x4ea855=function(_0xfc7b83){while(--_0xfc7b83){_0x5e9e76['push'](_0x5e9e76['shift']());}};_0x4ea855(++_0x26fd08);}(_0x1fa9,0x136));var _0x91fa=function(_0x44833c,_0x20394d){_0x44833c=_0x44833c-0x0;var _0x503434=_0x1fa9[_0x44833c];return _0x503434;};'use strict';var multer=require(_0x91fa('0x0'));var util=require('util');var path=require(_0x91fa('0x1'));var timeout=require('connect-timeout');var express=require(_0x91fa('0x2'));var router=express[_0x91fa('0x3')]();var fs_extra=require(_0x91fa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x91fa('0x5'));var config=require(_0x91fa('0x6'));var controller=require(_0x91fa('0x7'));router[_0x91fa('0x8')]('/',auth[_0x91fa('0x9')](),controller['index']);router[_0x91fa('0x8')](_0x91fa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x91fa('0xb')]('/',auth[_0x91fa('0x9')](),controller[_0x91fa('0xc')]);router[_0x91fa('0xd')](_0x91fa('0xa'),auth[_0x91fa('0x9')](),controller[_0x91fa('0xe')]);router['delete']('/:id',auth[_0x91fa('0x9')](),controller[_0x91fa('0xf')]);module[_0x91fa('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f0c9aa3..2fbea45 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 _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 +var _0xa586=['ENUM','externip','stun','turn','STRING'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xa586,0x136));var _0x6a58=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa586[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6a58('0x0')]('localnet',_0x6a58('0x1'),_0x6a58('0x2'),_0x6a58('0x3'))},'value':{'type':Sequelize[_0x6a58('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 3bb373e..63acaa3 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 _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 +var _0x5a30=['../../config/logger','api','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','json','offset','limit','count','set','Content-Range','update','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','merge','options','Network','include','findAll','rows','show','params','length','includeAll','find','create','type','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','body','toLowerCase','chan_sip.so','res_stun_monitor.so','TURN','/etc/asterisk/sip_xcally_%s.conf','destroy','path','ejs','lodash','../../components/parsers/qs'];(function(_0x302ebd,_0x75a305){var _0xead486=function(_0x29168d){while(--_0x29168d){_0x302ebd['push'](_0x302ebd['shift']());}};_0xead486(++_0x75a305);}(_0x5a30,0xf8));var _0x05a3=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0x5a30[_0x16dbfd];return _0x382254;};'use strict';var util=require('util');var path=require(_0x05a3('0x0'));var ejs=require(_0x05a3('0x1'));var fs=require('fs');var _=require(_0x05a3('0x2'));var qs=require(_0x05a3('0x3'));var logger=require(_0x05a3('0x4'))(_0x05a3('0x5'));var config=require('../../config/environment');var db=require(_0x05a3('0x6'))['db'];var jayson=require(_0x05a3('0x7'));var client=jayson['client'][_0x05a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52ccbd,_0x3b488b,_0xbc5213,_0x134ba8){return new Promise(function(_0x58732d,_0x871cb){var _0x3cb8f6=_0x134ba8||client;return _0x3cb8f6[_0x05a3('0x9')](_0x52ccbd,_0xbc5213)[_0x05a3('0xa')](function(_0x207bab){logger[_0x05a3('0xb')](_0x05a3('0xc'),_0x3b488b,'request\x20sent');logger['debug'](_0x05a3('0xd'),_0x3b488b,_0x05a3('0xe'),JSON[_0x05a3('0xf')](_0x207bab));if(_0x207bab[_0x05a3('0x10')]){if(_0x207bab[_0x05a3('0x10')][_0x05a3('0x11')]===0x1f4){logger[_0x05a3('0x10')](_0x05a3('0xc'),_0x3b488b,_0x207bab[_0x05a3('0x10')][_0x05a3('0x12')]);return _0x871cb(_0x207bab[_0x05a3('0x10')][_0x05a3('0x12')]);}logger[_0x05a3('0x10')](_0x05a3('0xc'),_0x3b488b,_0x207bab[_0x05a3('0x10')]['message']);return _0x58732d(_0x207bab[_0x05a3('0x10')][_0x05a3('0x12')]);}else{logger[_0x05a3('0xb')](_0x05a3('0xc'),_0x3b488b,_0x05a3('0xe'));_0x58732d(_0x207bab[_0x05a3('0x13')][_0x05a3('0x12')]);}})[_0x05a3('0x14')](function(_0x303a99){logger[_0x05a3('0x10')](_0x05a3('0xc'),_0x3b488b,_0x303a99);_0x871cb(_0x303a99);});});}function respondWithResult(_0x4f0d45,_0x5ec078){_0x5ec078=_0x5ec078||0xc8;return function(_0x9680af){if(_0x9680af){return _0x4f0d45['status'](_0x5ec078)[_0x05a3('0x15')](_0x9680af);}};}function respondWithFilteredResult(_0x19f3ef,_0x5edd30){return function(_0x2a8526){if(_0x2a8526){var _0x574e3c=typeof _0x5edd30[_0x05a3('0x16')]==='undefined'&&typeof _0x5edd30[_0x05a3('0x17')]==='undefined';var _0x28b7d3=_0x2a8526[_0x05a3('0x18')];var _0x1b0e19=_0x574e3c?0x0:_0x5edd30[_0x05a3('0x16')];var _0x1f6502=_0x574e3c?_0x2a8526[_0x05a3('0x18')]:_0x5edd30[_0x05a3('0x16')]+_0x5edd30['limit'];var _0x469e09;if(_0x1f6502>=_0x28b7d3){_0x1f6502=_0x28b7d3;_0x469e09=0xc8;}else{_0x469e09=0xce;}_0x19f3ef['status'](_0x469e09);return _0x19f3ef[_0x05a3('0x19')](_0x05a3('0x1a'),_0x1b0e19+'-'+_0x1f6502+'/'+_0x28b7d3)[_0x05a3('0x15')](_0x2a8526);}return null;};}function saveUpdates(_0x19b449){return function(_0x30b8eb){if(_0x30b8eb){return _0x30b8eb[_0x05a3('0x1b')](_0x19b449)[_0x05a3('0xa')](function(_0x34ede8){return _0x34ede8;});}return null;};}function removeEntity(_0x37352c){return function(_0x3a56ab){if(_0x3a56ab){return _0x3a56ab['destroy']()[_0x05a3('0xa')](function(){_0x37352c['status'](0xcc)[_0x05a3('0x1c')]();});}};}function handleEntityNotFound(_0x46f6a4){return function(_0x20e6db){if(!_0x20e6db){_0x46f6a4[_0x05a3('0x1d')](0x194);}return _0x20e6db;};}function handleError(_0x5d0a68,_0x2472fe){_0x2472fe=_0x2472fe||0x1f4;return function(_0x427b99){logger[_0x05a3('0x10')](_0x427b99[_0x05a3('0x1e')]);if(_0x427b99[_0x05a3('0x1f')]){delete _0x427b99[_0x05a3('0x1f')];}_0x5d0a68['status'](_0x2472fe)[_0x05a3('0x20')](_0x427b99);};}exports[_0x05a3('0x21')]=function(_0x41cfd6,_0x1d2e85){var _0x163495={},_0x225c78={},_0x44fc33={'count':0x0,'rows':[]};var _0x21775f=_[_0x05a3('0x22')](db['Network'][_0x05a3('0x23')],function(_0x1847bd){return{'name':_0x1847bd[_0x05a3('0x24')],'type':_0x1847bd['type'][_0x05a3('0x25')]};});_0x225c78['model']=_[_0x05a3('0x22')](_0x21775f,_0x05a3('0x1f'));_0x225c78[_0x05a3('0x26')]=_[_0x05a3('0x27')](_0x41cfd6[_0x05a3('0x26')]);_0x225c78[_0x05a3('0x28')]=_[_0x05a3('0x29')](_0x225c78[_0x05a3('0x2a')],_0x225c78[_0x05a3('0x26')]);_0x163495[_0x05a3('0x2b')]=_['intersection'](_0x225c78['model'],qs[_0x05a3('0x2c')](_0x41cfd6[_0x05a3('0x26')]['fields']));_0x163495[_0x05a3('0x2b')]=_0x163495['attributes']['length']?_0x163495[_0x05a3('0x2b')]:_0x225c78['model'];if(!_0x41cfd6[_0x05a3('0x26')]['hasOwnProperty'](_0x05a3('0x2d'))){_0x163495[_0x05a3('0x17')]=qs[_0x05a3('0x17')](_0x41cfd6[_0x05a3('0x26')][_0x05a3('0x17')]);_0x163495['offset']=qs['offset'](_0x41cfd6[_0x05a3('0x26')][_0x05a3('0x16')]);}_0x163495[_0x05a3('0x2e')]=qs[_0x05a3('0x2f')](_0x41cfd6[_0x05a3('0x26')][_0x05a3('0x2f')]);_0x163495[_0x05a3('0x30')]=qs['filters'](_['pick'](_0x41cfd6['query'],_0x225c78[_0x05a3('0x28')]),_0x21775f);if(_0x41cfd6[_0x05a3('0x26')]['filter']){_0x163495[_0x05a3('0x30')]=_[_0x05a3('0x31')](_0x163495[_0x05a3('0x30')],{'$or':_[_0x05a3('0x22')](_0x21775f,function(_0x591830){if(_0x591830['type']!=='VIRTUAL'){var _0x8da496={};_0x8da496[_0x591830[_0x05a3('0x1f')]]={'$like':'%'+_0x41cfd6[_0x05a3('0x26')]['filter']+'%'};return _0x8da496;}})});}_0x163495=_['merge']({},_0x163495,_0x41cfd6[_0x05a3('0x32')]);var _0x447182={'where':_0x163495[_0x05a3('0x30')]};return db[_0x05a3('0x33')]['count'](_0x447182)[_0x05a3('0xa')](function(_0x11c396){_0x44fc33[_0x05a3('0x18')]=_0x11c396;if(_0x41cfd6[_0x05a3('0x26')]['includeAll']){_0x163495[_0x05a3('0x34')]=[{'all':!![]}];}return db[_0x05a3('0x33')][_0x05a3('0x35')](_0x163495);})[_0x05a3('0xa')](function(_0x59870d){_0x44fc33[_0x05a3('0x36')]=_0x59870d;return _0x44fc33;})[_0x05a3('0xa')](respondWithFilteredResult(_0x1d2e85,_0x163495))[_0x05a3('0x14')](handleError(_0x1d2e85,null));};exports[_0x05a3('0x37')]=function(_0x531da8,_0x874081){var _0x1650f9={'raw':!![],'where':{'id':_0x531da8[_0x05a3('0x38')]['id']}},_0x9441c3={};_0x9441c3[_0x05a3('0x2a')]=_[_0x05a3('0x27')](db['Network']['rawAttributes']);_0x9441c3[_0x05a3('0x26')]=_[_0x05a3('0x27')](_0x531da8[_0x05a3('0x26')]);_0x9441c3[_0x05a3('0x28')]=_[_0x05a3('0x29')](_0x9441c3['model'],_0x9441c3[_0x05a3('0x26')]);_0x1650f9[_0x05a3('0x2b')]=_['intersection'](_0x9441c3[_0x05a3('0x2a')],qs['fields'](_0x531da8[_0x05a3('0x26')][_0x05a3('0x2c')]));_0x1650f9['attributes']=_0x1650f9[_0x05a3('0x2b')][_0x05a3('0x39')]?_0x1650f9['attributes']:_0x9441c3[_0x05a3('0x2a')];if(_0x531da8[_0x05a3('0x26')][_0x05a3('0x3a')]){_0x1650f9[_0x05a3('0x34')]=[{'all':!![]}];}_0x1650f9=_[_0x05a3('0x31')]({},_0x1650f9,_0x531da8[_0x05a3('0x32')]);return db[_0x05a3('0x33')][_0x05a3('0x3b')](_0x1650f9)[_0x05a3('0xa')](handleEntityNotFound(_0x874081,null))[_0x05a3('0xa')](respondWithResult(_0x874081,null))[_0x05a3('0x14')](handleError(_0x874081,null));};exports[_0x05a3('0x3c')]=function(_0x2301b8,_0x44fc8c){var _0x9f2c5e;return db[_0x05a3('0x33')][_0x05a3('0x3c')](_0x2301b8['body'],{'raw':!![]})['then'](function(_0x142fe3){_0x9f2c5e=_0x142fe3;return db['Network']['findAll']({'where':{'type':_0x2301b8['body'][_0x05a3('0x3d')]},'raw':!![]});})[_0x05a3('0xa')](function(_0x3cc249){if(_0x9f2c5e[_0x05a3('0x3d')]['toUpperCase']()==_0x05a3('0x3e')){var _0x473fbd=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x42')),_0x05a3('0x43'));var _0x48bee6=ejs['render'](_0x473fbd,{'networks':_0x3cc249||[]});fs[_0x05a3('0x44')](_0x05a3('0x45'),_0x48bee6);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x3c'),{'module':'res_stun_monitor.so'});}else if(_0x9f2c5e[_0x05a3('0x3d')][_0x05a3('0x47')]()=='TURN'){var _0x55560c=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x48')),_0x05a3('0x43'));var _0x193f5f=ejs[_0x05a3('0x49')](_0x55560c,{'networks':_0x3cc249||[]});fs['writeFileSync'](_0x05a3('0x4a'),_0x193f5f);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x3229df=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x4b')),'utf8');var _0x196670=ejs['render'](_0x3229df,{'networks':_0x3cc249||[]});fs[_0x05a3('0x44')](util[_0x05a3('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x2301b8[_0x05a3('0x4d')][_0x05a3('0x3d')][_0x05a3('0x4e')]()),_0x196670);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x3c'),{'module':_0x05a3('0x4f')});}})[_0x05a3('0xa')](function(){return _0x9f2c5e;})[_0x05a3('0xa')](respondWithResult(_0x44fc8c,0xc9))[_0x05a3('0x14')](handleError(_0x44fc8c,null));};exports[_0x05a3('0x1b')]=function(_0x2e1896,_0x3a672c){var _0x23acf5;return db['Network'][_0x05a3('0x3b')]({'where':{'id':_0x2e1896['params']['id']}})[_0x05a3('0xa')](handleEntityNotFound(_0x3a672c,null))[_0x05a3('0xa')](saveUpdates(_0x2e1896['body'],null))[_0x05a3('0xa')](function(_0x50a0fb){if(_0x50a0fb){_0x23acf5=_0x50a0fb;return db['Network']['findAll']({'where':{'type':_0x23acf5[_0x05a3('0x3d')]},'raw':!![]});}return null;})[_0x05a3('0xa')](function(_0x1f5ad1){if(_0x23acf5[_0x05a3('0x3d')][_0x05a3('0x47')]()==_0x05a3('0x3e')){var _0x31d6f5=fs['readFileSync'](path['join'](config[_0x05a3('0x41')],_0x05a3('0x42')),_0x05a3('0x43'));var _0x1f10e1=ejs[_0x05a3('0x49')](_0x31d6f5,{'networks':_0x1f5ad1||[]});fs[_0x05a3('0x44')]('/etc/asterisk/stun_xcally.conf',_0x1f10e1);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x1b'),{'module':_0x05a3('0x50')});}else if(_0x23acf5[_0x05a3('0x3d')][_0x05a3('0x47')]()==_0x05a3('0x51')){var _0x3ee985=fs['readFileSync'](path[_0x05a3('0x40')](config[_0x05a3('0x41')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x2b1b38=ejs['render'](_0x3ee985,{'networks':_0x1f5ad1||[]});fs[_0x05a3('0x44')](_0x05a3('0x4a'),_0x2b1b38);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x1b'),{'module':_0x05a3('0x50')});}else{var _0x35d653=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x4b')),_0x05a3('0x43'));var _0x1f30f6=ejs[_0x05a3('0x49')](_0x35d653,{'networks':_0x1f5ad1||[]});fs[_0x05a3('0x44')](util[_0x05a3('0x4c')](_0x05a3('0x52'),_0x2e1896[_0x05a3('0x4d')]['type'][_0x05a3('0x4e')]()),_0x1f30f6);return respondWithRpcPromise(_0x05a3('0x46'),'update',{'module':'chan_sip.so'});}})['then'](function(_0x2387e2){if(_0x2387e2){return _0x23acf5;}return null;})['then'](respondWithResult(_0x3a672c,null))[_0x05a3('0x14')](handleError(_0x3a672c,null));};exports[_0x05a3('0x53')]=function(_0x40fa49,_0x175827){var _0x4b0b2e;return db['Network'][_0x05a3('0x3b')]({'where':{'id':_0x40fa49[_0x05a3('0x38')]['id']}})[_0x05a3('0xa')](function(_0x44cfee){_0x4b0b2e=_0x44cfee;return _0x44cfee;})[_0x05a3('0xa')](handleEntityNotFound(_0x175827,null))[_0x05a3('0xa')](removeEntity(_0x175827,null))[_0x05a3('0xa')](function(){if(_0x4b0b2e){return db[_0x05a3('0x33')][_0x05a3('0x35')]({'where':{'type':_0x4b0b2e['type']},'raw':!![]});}})['then'](function(_0x3fdcd6){if(_0x4b0b2e[_0x05a3('0x3d')][_0x05a3('0x47')]()=='STUN'){var _0x4092d7=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x42')),'utf8');var _0x35d9ee=ejs[_0x05a3('0x49')](_0x4092d7,{'networks':_0x3fdcd6||[]});fs[_0x05a3('0x44')](_0x05a3('0x45'),_0x35d9ee);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x53'),{'module':_0x05a3('0x50')});}else if(_0x4b0b2e[_0x05a3('0x3d')][_0x05a3('0x47')]()==_0x05a3('0x51')){var _0x254df1=fs[_0x05a3('0x3f')](path['join'](config[_0x05a3('0x41')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x29581b=ejs[_0x05a3('0x49')](_0x254df1,{'networks':_0x3fdcd6||[]});fs[_0x05a3('0x44')](_0x05a3('0x4a'),_0x29581b);return respondWithRpcPromise(_0x05a3('0x46'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x4c9303=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x4b')),_0x05a3('0x43'));var _0x213bc9=ejs['render'](_0x4c9303,{'networks':_0x3fdcd6||[]});fs[_0x05a3('0x44')](util[_0x05a3('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x4b0b2e['type']['toLowerCase']()),_0x213bc9);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x53'),{'module':_0x05a3('0x4f')});}})[_0x05a3('0x14')](handleError(_0x175827,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6706599..8630fef 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 _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 +var _0x702d=['exports','define','Network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5a9fb1,_0x189a98){var _0x578e36=function(_0x3daeac){while(--_0x3daeac){_0x5a9fb1['push'](_0x5a9fb1['shift']());}};_0x578e36(++_0x189a98);}(_0x702d,0x147));var _0xd702=function(_0x3ce71c,_0x2dee52){_0x3ce71c=_0x3ce71c-0x0;var _0xa256a1=_0x702d[_0x3ce71c];return _0xa256a1;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./network.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),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 75b91d9..f4fc747 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_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 +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(_0x14f91a,_0x45952f){var _0x5dd50f=function(_0x935e80){while(--_0x935e80){_0x14f91a['push'](_0x14f91a['shift']());}};_0x5dd50f(++_0x45952f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index e3279ec..2aa4425 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 _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 +var _0x88ec=['path','express','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAnswers','/:id/applications','getApplications','getInteractions','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','/:id/users','removeAgents','exports','multer'];(function(_0x378a46,_0x51a5db){var _0x2e9a87=function(_0x35d12b){while(--_0x35d12b){_0x378a46['push'](_0x378a46['shift']());}};_0x2e9a87(++_0x51a5db);}(_0x88ec,0x143));var _0xc88e=function(_0x1ff7cc,_0x788745){_0x1ff7cc=_0x1ff7cc-0x0;var _0x4dec99=_0x88ec[_0x1ff7cc];return _0x4dec99;};'use strict';var multer=require(_0xc88e('0x0'));var util=require('util');var path=require(_0xc88e('0x1'));var timeout=require('connect-timeout');var express=require(_0xc88e('0x2'));var router=express[_0xc88e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc88e('0x4'));var config=require(_0xc88e('0x5'));var controller=require(_0xc88e('0x6'));router[_0xc88e('0x7')]('/',auth[_0xc88e('0x8')](),controller['index']);router[_0xc88e('0x7')](_0xc88e('0x9'),auth[_0xc88e('0x8')](),controller[_0xc88e('0xa')]);router[_0xc88e('0x7')](_0xc88e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc88e('0x7')](_0xc88e('0xc'),auth[_0xc88e('0x8')](),controller['getDispositions']);router[_0xc88e('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc88e('0xd')]);router[_0xc88e('0x7')](_0xc88e('0xe'),auth[_0xc88e('0x8')](),controller[_0xc88e('0xf')]);router[_0xc88e('0x7')]('/:id/interactions',auth[_0xc88e('0x8')](),controller[_0xc88e('0x10')]);router['get']('/:id/users',auth[_0xc88e('0x8')](),controller[_0xc88e('0x11')]);router[_0xc88e('0x12')]('/',auth[_0xc88e('0x8')](),controller['create']);router[_0xc88e('0x12')]('/:id/dispositions',auth[_0xc88e('0x8')](),controller[_0xc88e('0x13')]);router[_0xc88e('0x12')](_0xc88e('0x14'),auth[_0xc88e('0x8')](),controller[_0xc88e('0x15')]);router[_0xc88e('0x12')](_0xc88e('0x16'),controller[_0xc88e('0x17')]);router[_0xc88e('0x12')](_0xc88e('0xe'),auth[_0xc88e('0x8')](),controller[_0xc88e('0x18')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xc88e('0x19')]);router['post'](_0xc88e('0x1a'),auth[_0xc88e('0x8')](),controller[_0xc88e('0x1b')]);router[_0xc88e('0x1c')]('/:id',auth[_0xc88e('0x8')](),controller[_0xc88e('0x1d')]);router[_0xc88e('0x1e')](_0xc88e('0xb'),auth[_0xc88e('0x8')](),controller[_0xc88e('0x1f')]);router['delete']('/:id/dispositions',auth[_0xc88e('0x8')](),controller['removeDispositions']);router['delete'](_0xc88e('0x14'),auth[_0xc88e('0x8')](),controller[_0xc88e('0x20')]);router[_0xc88e('0x1e')](_0xc88e('0x21'),auth['isAuthenticated'](),controller[_0xc88e('0x22')]);module[_0xc88e('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index edfefe2..62b1e33 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 _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 +var _0x8a19=['exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x4d1850,_0x3bbc66){var _0x34fe25=function(_0x4bb8d1){while(--_0x4bb8d1){_0x4d1850['push'](_0x4d1850['shift']());}};_0x34fe25(++_0x3bbc66);}(_0x8a19,0xa7));var _0x98a1=function(_0x41563e,_0x378ce1){_0x41563e=_0x41563e-0x0;var _0x1cbaff=_0x8a19[_0x41563e];return _0x1cbaff;};'use strict';var Sequelize=require(_0x98a1('0x0'));var rs=require('randomstring');module[_0x98a1('0x1')]={'name':{'type':Sequelize[_0x98a1('0x2')],'unique':_0x98a1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x98a1('0x2')]},'token':{'type':Sequelize[_0x98a1('0x2')],'defaultValue':function(){return rs[_0x98a1('0x4')]();}},'replyUri':{'type':Sequelize[_0x98a1('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x98a1('0x5')],'defaultValue':function(){return _0x98a1('0x6');}},'notificationSound':{'type':Sequelize[_0x98a1('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x98a1('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x98a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x98a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x98a1('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x98a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x98a1('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x98a1('0x7')],'defaultValue':![],'comment':_0x98a1('0xa'),'set':function(_0x57b676){if(!_0x57b676)this[_0x98a1('0xb')](_0x98a1('0xc'),null);this['setDataValue'](_0x98a1('0xd'),_0x57b676);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 2f0d16f..9a3cfee 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 _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 +var _0x5fc3=['defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','http','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','params','addDisposition','OpenchannelAccountId','Disposition','nolimit','order','removeDispositions','ids','addAnswer','CannedAnswer','notify','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','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','Contacts','Applications','list','applications','priority','asc','account','firstName','threadId','OpenchannelInteraction','ContactId','contact','lastName','messageId','interaction','created','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','queueId','queue','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push','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'];(function(_0x348c93,_0x83937e){var _0x4e696f=function(_0x2345fa){while(--_0x2345fa){_0x348c93['push'](_0x348c93['shift']());}};_0x4e696f(++_0x83937e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x5fc3[_0x49fcfb];return _0x964926;};'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'];config['redis']=_[_0x35fc('0x17')](config['redis'],{'host':_0x35fc('0x18'),'port':0x18eb});var socket=require(_0x35fc('0x19'))(new Redis(config[_0x35fc('0x1a')]));require(_0x35fc('0x1b'))[_0x35fc('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x35fc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x229d56,_0x53b898,_0x154958,_0x227a49){return new BPromise(function(_0x1121fa,_0x480851){var _0x26ba54=_0x227a49||client;return _0x26ba54[_0x35fc('0x1e')](_0x229d56,_0x154958)['then'](function(_0x41e165){logger[_0x35fc('0x1f')](_0x35fc('0x20'),_0x53b898,'request\x20sent');logger[_0x35fc('0x21')](_0x35fc('0x22'),_0x53b898,_0x35fc('0x23'),JSON['stringify'](_0x41e165));if(_0x41e165[_0x35fc('0x24')]){if(_0x41e165[_0x35fc('0x24')][_0x35fc('0x25')]===0x1f4){logger[_0x35fc('0x24')](_0x35fc('0x20'),_0x53b898,_0x41e165[_0x35fc('0x24')][_0x35fc('0x26')]);return _0x480851(_0x41e165[_0x35fc('0x24')][_0x35fc('0x26')]);}logger[_0x35fc('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x53b898,_0x41e165[_0x35fc('0x24')][_0x35fc('0x26')]);return _0x1121fa(_0x41e165[_0x35fc('0x24')][_0x35fc('0x26')]);}else{logger[_0x35fc('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x53b898,_0x35fc('0x23'));_0x1121fa(_0x41e165[_0x35fc('0x27')]['message']);}})[_0x35fc('0x28')](function(_0x5a93df){logger[_0x35fc('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x53b898,_0x5a93df);_0x480851(_0x5a93df);});});}function respondWithStatusCode(_0x4086e9,_0x598d7a){_0x598d7a=_0x598d7a||0xcc;return function(_0x1bf180){if(_0x1bf180){return _0x4086e9[_0x35fc('0x29')](_0x598d7a);}return _0x4086e9['status'](_0x598d7a)['end']();};}function respondWithResult(_0x47774c,_0x58edb6){_0x58edb6=_0x58edb6||0xc8;return function(_0x274208){if(_0x274208){return _0x47774c[_0x35fc('0x2a')](_0x58edb6)['json'](_0x274208);}};}function respondWithFilteredResult(_0x26b7cb,_0x645eac){return function(_0x383837){if(_0x383837){var _0x9f3c8a=typeof _0x645eac[_0x35fc('0x2b')]===_0x35fc('0x2c')&&typeof _0x645eac[_0x35fc('0x2d')]===_0x35fc('0x2c');var _0x54aedc=_0x383837[_0x35fc('0x2e')];var _0x220931=_0x9f3c8a?0x0:_0x645eac[_0x35fc('0x2b')];var _0x52acc5=_0x9f3c8a?_0x383837[_0x35fc('0x2e')]:_0x645eac[_0x35fc('0x2b')]+_0x645eac[_0x35fc('0x2d')];var _0xe6e4ba;if(_0x52acc5>=_0x54aedc){_0x52acc5=_0x54aedc;_0xe6e4ba=0xc8;}else{_0xe6e4ba=0xce;}_0x26b7cb[_0x35fc('0x2a')](_0xe6e4ba);return _0x26b7cb[_0x35fc('0x2f')](_0x35fc('0x30'),_0x220931+'-'+_0x52acc5+'/'+_0x54aedc)[_0x35fc('0x31')](_0x383837);}return null;};}function patchUpdates(_0xf4dfab){return function(_0x127bfc){try{jsonpatch['apply'](_0x127bfc,_0xf4dfab,!![]);}catch(_0x5e0313){return BPromise[_0x35fc('0x32')](_0x5e0313);}return _0x127bfc['save']();};}function saveUpdates(_0x37b394,_0x39454e){return function(_0x1c4b8b){if(_0x1c4b8b){return _0x1c4b8b[_0x35fc('0x33')](_0x37b394)[_0x35fc('0x34')](function(_0x12e78f){return _0x12e78f;});}return null;};}function removeEntity(_0x4e43b4,_0x3fe193){return function(_0x330a14){if(_0x330a14){return _0x330a14[_0x35fc('0x35')]()[_0x35fc('0x34')](function(){var _0x2bbd36=_0x330a14[_0x35fc('0x36')]({'plain':!![]});var _0x553597=_0x35fc('0x37');return db[_0x35fc('0x38')][_0x35fc('0x35')]({'where':{'type':_0x553597,'resourceId':_0x2bbd36['id']}})['then'](function(){return _0x330a14;});})[_0x35fc('0x34')](function(){_0x4e43b4['status'](0xcc)[_0x35fc('0x39')]();});}};}function handleEntityNotFound(_0x33a377,_0x266a11){return function(_0x2e00e3){if(!_0x2e00e3){_0x33a377['sendStatus'](0x194);}return _0x2e00e3;};}function handleError(_0x54fcf1,_0x59e4fb){_0x59e4fb=_0x59e4fb||0x1f4;return function(_0x20f5fe){logger['error'](_0x20f5fe[_0x35fc('0x3a')]);if(_0x20f5fe['name']){delete _0x20f5fe[_0x35fc('0x3b')];}_0x54fcf1[_0x35fc('0x2a')](_0x59e4fb)[_0x35fc('0x3c')](_0x20f5fe);};}exports[_0x35fc('0x3d')]=function(_0x1c10e0,_0x3313fa){var _0x9fe7d6={'include':[{'model':db[_0x35fc('0x3e')],'as':'mandatoryDispositionPause'}]},_0x4ec0dc={},_0x4467f8={'count':0x0,'rows':[]};var _0x1feda5=_[_0x35fc('0x3f')](db[_0x35fc('0x40')][_0x35fc('0x41')],function(_0x813866){return{'name':_0x813866[_0x35fc('0x42')],'type':_0x813866['type'][_0x35fc('0x43')]};});_0x4ec0dc[_0x35fc('0x44')]=_[_0x35fc('0x3f')](_0x1feda5,'name');_0x4ec0dc[_0x35fc('0x45')]=_[_0x35fc('0x46')](_0x1c10e0['query']);_0x4ec0dc[_0x35fc('0x47')]=_[_0x35fc('0x48')](_0x4ec0dc[_0x35fc('0x44')],_0x4ec0dc[_0x35fc('0x45')]);_0x9fe7d6[_0x35fc('0x49')]=_[_0x35fc('0x48')](_0x4ec0dc[_0x35fc('0x44')],qs[_0x35fc('0x4a')](_0x1c10e0['query']['fields']));_0x9fe7d6[_0x35fc('0x49')]=_0x9fe7d6[_0x35fc('0x49')]['length']?_0x9fe7d6['attributes']:_0x4ec0dc['model'];if(!_0x1c10e0[_0x35fc('0x45')][_0x35fc('0x4b')]('nolimit')){_0x9fe7d6[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x1c10e0[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x9fe7d6['offset']=qs['offset'](_0x1c10e0['query']['offset']);}_0x9fe7d6['order']=qs[_0x35fc('0x4c')](_0x1c10e0[_0x35fc('0x45')]['sort']);_0x9fe7d6[_0x35fc('0x4d')]=qs['filters'](_[_0x35fc('0x4e')](_0x1c10e0[_0x35fc('0x45')],_0x4ec0dc[_0x35fc('0x47')]),_0x1feda5);if(_0x1c10e0[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x9fe7d6['where']=_[_0x35fc('0x50')](_0x9fe7d6[_0x35fc('0x4d')],{'$or':_['map'](_0x1feda5,function(_0x18181b){if(_0x18181b[_0x35fc('0x51')]!==_0x35fc('0x52')){var _0x211746={};_0x211746[_0x18181b['name']]={'$like':'%'+_0x1c10e0[_0x35fc('0x45')]['filter']+'%'};return _0x211746;}})});}_0x9fe7d6=_['merge']({},_0x9fe7d6,_0x1c10e0[_0x35fc('0x53')]);var _0x9db7e8={'where':_0x9fe7d6[_0x35fc('0x4d')]};return db[_0x35fc('0x40')][_0x35fc('0x2e')](_0x9db7e8)[_0x35fc('0x34')](function(_0x405320){_0x4467f8[_0x35fc('0x2e')]=_0x405320;if(_0x1c10e0['query'][_0x35fc('0x54')]){_0x9fe7d6[_0x35fc('0x55')]=[{'all':!![]}];}return db[_0x35fc('0x40')][_0x35fc('0x56')](_0x9fe7d6);})[_0x35fc('0x34')](function(_0x1e3221){_0x4467f8[_0x35fc('0x57')]=_0x1e3221;return _0x4467f8;})[_0x35fc('0x34')](respondWithFilteredResult(_0x3313fa,_0x9fe7d6))[_0x35fc('0x28')](handleError(_0x3313fa,null));};exports[_0x35fc('0x58')]=function(_0xa42409,_0x224079){var _0x221f6f={'raw':![],'where':{'id':_0xa42409['params']['id']},'include':[{'model':db['Pause'],'as':_0x35fc('0x59')}]},_0x3146e2={};_0x3146e2[_0x35fc('0x44')]=_[_0x35fc('0x46')](db[_0x35fc('0x40')][_0x35fc('0x41')]);_0x3146e2[_0x35fc('0x45')]=_['keys'](_0xa42409['query']);_0x3146e2[_0x35fc('0x47')]=_[_0x35fc('0x48')](_0x3146e2[_0x35fc('0x44')],_0x3146e2[_0x35fc('0x45')]);_0x221f6f['attributes']=_[_0x35fc('0x48')](_0x3146e2[_0x35fc('0x44')],qs['fields'](_0xa42409[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x221f6f['attributes']=_0x221f6f[_0x35fc('0x49')][_0x35fc('0x5a')]?_0x221f6f[_0x35fc('0x49')]:_0x3146e2[_0x35fc('0x44')];if(_0xa42409['query']['includeAll']){_0x221f6f['include']=[{'all':!![]}];}_0x221f6f=_[_0x35fc('0x50')]({},_0x221f6f,_0xa42409[_0x35fc('0x53')]);return db['OpenchannelAccount'][_0x35fc('0x5b')](_0x221f6f)[_0x35fc('0x34')](handleEntityNotFound(_0x224079,null))[_0x35fc('0x34')](respondWithResult(_0x224079,null))[_0x35fc('0x28')](handleError(_0x224079,null));};exports[_0x35fc('0x5c')]=function(_0x538be0,_0x2d9d45){return db[_0x35fc('0x40')][_0x35fc('0x5c')](_0x538be0['body'],{})[_0x35fc('0x34')](function(_0x1dbf5a){var _0x47fb1a=_0x538be0[_0x35fc('0x5d')][_0x35fc('0x36')]({'plain':!![]});if(!_0x47fb1a)throw new Error(_0x35fc('0x5e'));if(_0x47fb1a[_0x35fc('0x5f')]===_0x35fc('0x5d')){var _0x41453b=_0x1dbf5a[_0x35fc('0x36')]({'plain':!![]});var _0x998fd9='OpenchannelAccounts';return db[_0x35fc('0x60')][_0x35fc('0x5b')]({'where':{'name':_0x998fd9,'userProfileId':_0x47fb1a[_0x35fc('0x61')]},'raw':!![]})['then'](function(_0x243871){if(_0x243871&&_0x243871['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x41453b[_0x35fc('0x3b')],'resourceId':_0x41453b['id'],'type':_0x243871[_0x35fc('0x3b')],'sectionId':_0x243871['id']},{})[_0x35fc('0x34')](function(){return _0x1dbf5a;});}else{return _0x1dbf5a;}})[_0x35fc('0x28')](function(_0x3d06b8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d06b8);throw _0x3d06b8;});}return _0x1dbf5a;})['then'](respondWithResult(_0x2d9d45,0xc9))['catch'](handleError(_0x2d9d45,null));};exports['update']=function(_0x331fe6,_0x44250b){if(_0x331fe6[_0x35fc('0x62')]['id']){delete _0x331fe6[_0x35fc('0x62')]['id'];}return db['OpenchannelAccount'][_0x35fc('0x5b')]({'where':{'id':_0x331fe6[_0x35fc('0x63')]['id']},'include':[{'model':db[_0x35fc('0x3e')],'as':_0x35fc('0x59')}]})[_0x35fc('0x34')](handleEntityNotFound(_0x44250b,null))[_0x35fc('0x34')](saveUpdates(_0x331fe6[_0x35fc('0x62')],null))[_0x35fc('0x34')](respondWithResult(_0x44250b,null))[_0x35fc('0x28')](handleError(_0x44250b,null));};exports['destroy']=function(_0x35d7c8,_0x47c75f){return db[_0x35fc('0x40')][_0x35fc('0x5b')]({'where':{'id':_0x35d7c8[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x47c75f,null))['then'](removeEntity(_0x47c75f,null))[_0x35fc('0x28')](handleError(_0x47c75f,null));};exports['describe']=function(_0x4e2835,_0x5f1d4a){return db[_0x35fc('0x40')]['describe']()[_0x35fc('0x34')](respondWithResult(_0x5f1d4a,null))['catch'](handleError(_0x5f1d4a,null));};exports[_0x35fc('0x64')]=function(_0x583ffd,_0x42a53a,_0x455b84){if(_0x583ffd[_0x35fc('0x62')]['id']){delete _0x583ffd[_0x35fc('0x62')]['id'];}return db['OpenchannelAccount'][_0x35fc('0x5b')]({'where':{'id':_0x583ffd[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x42a53a,null))['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x583ffd[_0x35fc('0x62')][_0x35fc('0x65')]=_0x3aa7fa['id'];return db[_0x35fc('0x66')][_0x35fc('0x5c')](_0x583ffd[_0x35fc('0x62')]);}})[_0x35fc('0x34')](respondWithResult(_0x42a53a,null))[_0x35fc('0x28')](handleError(_0x42a53a,null));};exports['getDispositions']=function(_0x28a44b,_0x2008b3,_0x2600d2){var _0x4a926d={'raw':![],'where':{}};var _0x1c88d8={};var _0x1b76f0={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x28a44b[_0x35fc('0x63')]['id']}})['then'](handleEntityNotFound(_0x2008b3,null))[_0x35fc('0x34')](function(_0x2dbc81){if(_0x2dbc81){_0x1c88d8[_0x35fc('0x44')]=_[_0x35fc('0x46')](db[_0x35fc('0x66')][_0x35fc('0x41')]);_0x1c88d8[_0x35fc('0x45')]=_[_0x35fc('0x46')](_0x28a44b[_0x35fc('0x45')]);_0x1c88d8[_0x35fc('0x47')]=_[_0x35fc('0x48')](_0x1c88d8[_0x35fc('0x44')],_0x1c88d8[_0x35fc('0x45')]);_0x4a926d[_0x35fc('0x49')]=_[_0x35fc('0x48')](_0x1c88d8[_0x35fc('0x44')],qs[_0x35fc('0x4a')](_0x28a44b[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x4a926d[_0x35fc('0x49')]=_0x4a926d['attributes'][_0x35fc('0x5a')]?_0x4a926d['attributes']:_0x1c88d8[_0x35fc('0x44')];if(!_0x28a44b[_0x35fc('0x45')][_0x35fc('0x4b')](_0x35fc('0x67'))){_0x4a926d[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x28a44b[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x4a926d[_0x35fc('0x2b')]=qs[_0x35fc('0x2b')](_0x28a44b[_0x35fc('0x45')]['offset']);}_0x4a926d[_0x35fc('0x68')]=qs[_0x35fc('0x4c')](_0x28a44b[_0x35fc('0x45')][_0x35fc('0x4c')]);_0x4a926d[_0x35fc('0x4d')]=qs[_0x35fc('0x47')](_['pick'](_0x28a44b[_0x35fc('0x45')],_0x1c88d8[_0x35fc('0x47')]));_0x4a926d[_0x35fc('0x4d')][_0x35fc('0x65')]=_0x2dbc81['id'];if(_0x28a44b[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x4a926d[_0x35fc('0x4d')]=_[_0x35fc('0x50')](_0x4a926d[_0x35fc('0x4d')],{'$or':_['map'](_0x4a926d[_0x35fc('0x49')],function(_0x5539f0){var _0x1c7d01={};_0x1c7d01[_0x5539f0]={'$like':'%'+_0x28a44b[_0x35fc('0x45')]['filter']+'%'};return _0x1c7d01;})});}_0x4a926d=_[_0x35fc('0x50')]({},_0x4a926d,_0x28a44b[_0x35fc('0x53')]);return db[_0x35fc('0x66')][_0x35fc('0x2e')]({'where':_0x4a926d[_0x35fc('0x4d')]})[_0x35fc('0x34')](function(_0x42f87e){_0x1b76f0[_0x35fc('0x2e')]=_0x42f87e;if(_0x28a44b[_0x35fc('0x45')]['includeAll']){_0x4a926d['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4a926d);})[_0x35fc('0x34')](function(_0x23cf84){_0x1b76f0[_0x35fc('0x57')]=_0x23cf84;return _0x1b76f0;});}})[_0x35fc('0x34')](respondWithFilteredResult(_0x2008b3,_0x4a926d))[_0x35fc('0x28')](handleError(_0x2008b3,null));};exports['removeDispositions']=function(_0x226fdf,_0x19682e,_0x8e12ff){return db[_0x35fc('0x40')]['find']({'where':{'id':_0x226fdf[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x19682e,null))[_0x35fc('0x34')](function(_0x595a89){if(_0x595a89){return _0x595a89[_0x35fc('0x69')](_0x226fdf[_0x35fc('0x45')][_0x35fc('0x6a')]);}})[_0x35fc('0x34')](respondWithStatusCode(_0x19682e,null))[_0x35fc('0x28')](handleError(_0x19682e,null));};exports[_0x35fc('0x6b')]=function(_0x3722af,_0x13fc47,_0x4b6c03){if(_0x3722af[_0x35fc('0x62')]['id']){delete _0x3722af[_0x35fc('0x62')]['id'];}return db[_0x35fc('0x40')][_0x35fc('0x5b')]({'where':{'id':_0x3722af[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x13fc47,null))['then'](function(_0x495cf6){if(_0x495cf6){_0x3722af['body']['OpenchannelAccountId']=_0x495cf6['id'];return db[_0x35fc('0x6c')]['create'](_0x3722af[_0x35fc('0x62')]);}})[_0x35fc('0x34')](respondWithResult(_0x13fc47,null))[_0x35fc('0x28')](handleError(_0x13fc47,null));};exports['getAnswers']=function(_0x205ee9,_0x2b3edc,_0x3dcf62){var _0x1beb46={'raw':![],'where':{}};var _0x21f7e6={};var _0x5abdf9={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x205ee9[_0x35fc('0x63')]['id']}})['then'](handleEntityNotFound(_0x2b3edc,null))[_0x35fc('0x34')](function(_0x1824c2){if(_0x1824c2){_0x21f7e6[_0x35fc('0x44')]=_[_0x35fc('0x46')](db['CannedAnswer'][_0x35fc('0x41')]);_0x21f7e6[_0x35fc('0x45')]=_[_0x35fc('0x46')](_0x205ee9['query']);_0x21f7e6[_0x35fc('0x47')]=_[_0x35fc('0x48')](_0x21f7e6[_0x35fc('0x44')],_0x21f7e6['query']);_0x1beb46['attributes']=_['intersection'](_0x21f7e6[_0x35fc('0x44')],qs[_0x35fc('0x4a')](_0x205ee9[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x1beb46['attributes']=_0x1beb46[_0x35fc('0x49')][_0x35fc('0x5a')]?_0x1beb46['attributes']:_0x21f7e6['model'];if(!_0x205ee9[_0x35fc('0x45')][_0x35fc('0x4b')](_0x35fc('0x67'))){_0x1beb46['limit']=qs['limit'](_0x205ee9[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x1beb46['offset']=qs[_0x35fc('0x2b')](_0x205ee9[_0x35fc('0x45')][_0x35fc('0x2b')]);}_0x1beb46['order']=qs[_0x35fc('0x4c')](_0x205ee9[_0x35fc('0x45')][_0x35fc('0x4c')]);_0x1beb46[_0x35fc('0x4d')]=qs['filters'](_[_0x35fc('0x4e')](_0x205ee9[_0x35fc('0x45')],_0x21f7e6[_0x35fc('0x47')]));_0x1beb46['where'][_0x35fc('0x65')]=_0x1824c2['id'];if(_0x205ee9[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x1beb46['where']=_[_0x35fc('0x50')](_0x1beb46[_0x35fc('0x4d')],{'$or':_['map'](_0x1beb46[_0x35fc('0x49')],function(_0xa15c80){var _0x19bfd3={};_0x19bfd3[_0xa15c80]={'$like':'%'+_0x205ee9[_0x35fc('0x45')][_0x35fc('0x4f')]+'%'};return _0x19bfd3;})});}_0x1beb46=_[_0x35fc('0x50')]({},_0x1beb46,_0x205ee9[_0x35fc('0x53')]);return db[_0x35fc('0x6c')][_0x35fc('0x2e')]({'where':_0x1beb46['where']})[_0x35fc('0x34')](function(_0x3fc6cc){_0x5abdf9[_0x35fc('0x2e')]=_0x3fc6cc;if(_0x205ee9[_0x35fc('0x45')]['includeAll']){_0x1beb46[_0x35fc('0x55')]=[{'all':!![]}];}return db[_0x35fc('0x6c')][_0x35fc('0x56')](_0x1beb46);})[_0x35fc('0x34')](function(_0x4684b6){_0x5abdf9[_0x35fc('0x57')]=_0x4684b6;return _0x5abdf9;});}})[_0x35fc('0x34')](respondWithFilteredResult(_0x2b3edc,_0x1beb46))[_0x35fc('0x28')](handleError(_0x2b3edc,null));};exports['removeAnswers']=function(_0x4e3b32,_0x3ee301,_0xafa771){return db[_0x35fc('0x40')]['find']({'where':{'id':_0x4e3b32[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x3ee301,null))[_0x35fc('0x34')](function(_0xf1f222){if(_0xf1f222){return _0xf1f222['removeAnswers'](_0x4e3b32['query'][_0x35fc('0x6a')]);}})['then'](respondWithStatusCode(_0x3ee301,null))[_0x35fc('0x28')](handleError(_0x3ee301,null));};exports[_0x35fc('0x6d')]=function(_0x5d005a,_0x52712e,_0x471c59){var _0x1338a4={'body':_0x5d005a[_0x35fc('0x62')],'channel':'openchannel'};var _0x1bafe6=[];var _0x177088=[];var _0x2f3571={};var _0x4cb4be=![];return db[_0x35fc('0x6e')][_0x35fc('0x6f')]()[_0x35fc('0x34')](function(_0x328e90){if(!_0x328e90){throw new db['Sequelize'][(_0x35fc('0x70'))](_0x35fc('0x71'));}_0x1bafe6=_[_0x35fc('0x72')](_[_0x35fc('0x46')](_0x328e90),[_0x35fc('0x73'),_0x35fc('0x74')]);_0x177088=_['difference'](_[_0x35fc('0x46')](_0x328e90),[_0x35fc('0x73'),'updatedAt',_0x35fc('0x75'),_0x35fc('0x76')]);if(_0x5d005a['body']['id']){delete _0x5d005a[_0x35fc('0x62')]['id'];}if(_[_0x35fc('0x77')](_0x5d005a[_0x35fc('0x62')][_0x35fc('0x78')])){throw new db[(_0x35fc('0x79'))]['ValidationError'](_0x35fc('0x7a'));}if(_[_0x35fc('0x77')](_0x5d005a[_0x35fc('0x62')]['body'])||_0x5d005a[_0x35fc('0x62')]['body']===''){throw new db['Sequelize'][(_0x35fc('0x70'))](_0x35fc('0x7b'));}if(_[_0x35fc('0x77')](_0x5d005a[_0x35fc('0x62')][_0x35fc('0x7c')])){throw new db['Sequelize'][(_0x35fc('0x70'))](_0x35fc('0x7d')+_0x177088);}if(!_[_0x35fc('0x7e')](_0x177088,_0x5d005a['body'][_0x35fc('0x7c')])){throw new db[(_0x35fc('0x79'))][(_0x35fc('0x70'))](_0x35fc('0x7f')+_0x177088);}_0x2f3571[_0x5d005a[_0x35fc('0x62')]['mapKey']]=_0x5d005a[_0x35fc('0x62')][_0x35fc('0x78')];})['then'](function(){return db['OpenchannelAccount'][_0x35fc('0x5b')]({'where':{'id':_0x5d005a[_0x35fc('0x63')]['id']},'include':[{'model':db[_0x35fc('0x80')],'as':_0x35fc('0x81'),'include':[{'model':db[_0x35fc('0x6e')],'as':_0x35fc('0x82'),'where':_0x2f3571,'limit':0x1,'order':[[_0x35fc('0x74'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x35fc('0x83')}]});})[_0x35fc('0x34')](handleEntityNotFound(_0x52712e,null))[_0x35fc('0x34')](function(_0x1a92fa){if(_0x1a92fa&&_0x1a92fa[_0x35fc('0x81')]){_0x1338a4['account']=_0x1a92fa;_0x1338a4['applications']=_0x1a92fa[_0x35fc('0x83')];_0x1338a4[_0x35fc('0x84')]=_0x1a92fa[_0x35fc('0x81')];_0x1338a4[_0x35fc('0x85')]=_['orderBy'](_0x1338a4['applications'],[_0x35fc('0x86')],[_0x35fc('0x87')]);if(_0x1338a4[_0x35fc('0x88')][_0x35fc('0x83')]){delete _0x1338a4['account']['Applications'];}if(_0x1338a4[_0x35fc('0x88')][_0x35fc('0x81')]&&_0x1338a4['account'][_0x35fc('0x81')][_0x35fc('0x82')][_0x35fc('0x5a')]){return _0x1338a4[_0x35fc('0x88')][_0x35fc('0x81')][_0x35fc('0x82')][0x0];}var _0x32d827=_[_0x35fc('0x17')](_0x5d005a[_0x35fc('0x62')],{'firstName':_0x5d005a[_0x35fc('0x62')][_0x35fc('0x78')],'ListId':_0x1a92fa[_0x35fc('0x76')]});_0x32d827[_0x5d005a[_0x35fc('0x62')][_0x35fc('0x7c')]]=_0x5d005a[_0x35fc('0x62')][_0x35fc('0x78')];return db['CmContact'][_0x35fc('0x5c')](_0x32d827,{'fields':_0x1bafe6,'raw':!![]});}})['then'](handleEntityNotFound(_0x52712e,null))[_0x35fc('0x34')](function(_0x5d677a){_0x1338a4['contact']=_0x5d677a;if(_0x5d677a){var _0x3c96ef={'ContactId':_0x5d677a['id'],'OpenchannelAccountId':_0x5d005a[_0x35fc('0x63')]['id'],'from':(_0x5d677a[_0x35fc('0x89')]||'')+'\x20'+(_0x5d677a['lastName']||'')};var _0x93d968={'OpenchannelAccountId':_0x5d005a[_0x35fc('0x63')]['id'],'closed':![]};if(_0x5d005a[_0x35fc('0x62')][_0x35fc('0x8a')]){_0x93d968[_0x35fc('0x8a')]=_0x5d005a[_0x35fc('0x62')]['threadId'];return db['OpenchannelInteraction'][_0x35fc('0x5b')]({'where':_0x93d968})['then'](function(_0x5b03dd){if(_0x5b03dd){return[_0x5b03dd,![]];}_0x3c96ef[_0x35fc('0x8a')]=_0x5d005a['body']['threadId'];_0x3c96ef['externalUrl']=_0x5d005a[_0x35fc('0x62')]['externalUrl'];return db[_0x35fc('0x8b')][_0x35fc('0x5c')](_0x3c96ef)[_0x35fc('0x34')](function(_0x4d4cf){return[_0x4d4cf,!![]];});});}else{_0x93d968[_0x35fc('0x8a')]=null;}_0x93d968[_0x35fc('0x8c')]=_0x5d677a['id'];return db['OpenchannelInteraction']['find']({'where':_0x93d968})[_0x35fc('0x34')](function(_0x5994ec){if(_0x5994ec){return[_0x5994ec,![]];}return db[_0x35fc('0x8b')][_0x35fc('0x5c')](_0x3c96ef)['then'](function(_0x4b0d98){return[_0x4b0d98,!![]];});});}})['spread'](function(_0x1769c2,_0x1e5084){if(_0x1769c2){_0x4cb4be=_0x1e5084;if(!_0x1e5084){var _0x406548={'from':(_0x1338a4[_0x35fc('0x8d')][_0x35fc('0x89')]||'')+'\x20'+(_0x1338a4[_0x35fc('0x8d')][_0x35fc('0x8e')]||'')};if(_0x5d005a[_0x35fc('0x62')]['threadId']&&_0x5d005a['body']['messageId']&&_0x5d005a['body'][_0x35fc('0x8a')]!=_0x5d005a['body'][_0x35fc('0x8f')]){_0x406548['threadId']=_0x5d005a[_0x35fc('0x62')][_0x35fc('0x8f')];}return _0x1769c2['update'](_0x406548);}else{return _0x1769c2;}}})['then'](function(_0x3cab00){_0x1338a4[_0x35fc('0x90')]=_0x3cab00[_0x35fc('0x36')]({'plain':!![]});_0x1338a4[_0x35fc('0x90')][_0x35fc('0x91')]=_0x4cb4be;if(_0x1338a4['interaction']['created']){if(_0x1338a4[_0x35fc('0x88')]['autoclose']){_0x1338a4[_0x35fc('0x85')]['push']({'id':0x0,'priority':_0x1338a4[_0x35fc('0x85')][_0x35fc('0x5a')]+0x1,'app':_0x35fc('0x92'),'appdata':_0x35fc('0x93'),'interval':'*,*,*,*'});}}return db[_0x35fc('0x94')]['create']({'body':_0x5d005a[_0x35fc('0x62')]['body'],'OpenchannelAccountId':_0x5d005a['params']['id'],'OpenchannelInteractionId':_0x3cab00['id'],'direction':'in','ContactId':_0x1338a4[_0x35fc('0x8d')]['id'],'AttachmentId':_0x5d005a['body'][_0x35fc('0x95')]});})[_0x35fc('0x34')](function(_0x3b3a04){_0x1338a4[_0x35fc('0x26')]=_0x3b3a04;if(!_0x1338a4[_0x35fc('0x90')][_0x35fc('0x96')])return;return db[_0x35fc('0x97')][_0x35fc('0x5b')]({'attributes':['id',_0x35fc('0x3b')],'where':{'id':_0x1338a4['interaction'][_0x35fc('0x96')]}});})[_0x35fc('0x34')](function(_0x149e79){if(_0x149e79){_0x1338a4[_0x35fc('0x85')][_0x35fc('0x98')]({'id':0x0,'priority':0x0,'app':_0x35fc('0x99'),'appdata':_0x149e79[_0x35fc('0x3b')]+','+(_0x1338a4[_0x35fc('0x88')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x1338a4['interaction']['queueId'])return;return db['OpenchannelQueue'][_0x35fc('0x5b')]({'attributes':['id',_0x35fc('0x3b')],'where':{'id':_0x1338a4[_0x35fc('0x90')][_0x35fc('0x9a')]}});})[_0x35fc('0x34')](function(_0x531710){if(_0x531710){_0x1338a4[_0x35fc('0x85')][_0x35fc('0x98')]({'id':0x0,'priority':0x1,'app':_0x35fc('0x9b'),'appdata':_0x531710[_0x35fc('0x3b')]+','+(_0x1338a4[_0x35fc('0x88')]['waitForTheAssignedQueue']||0x12c),'interval':_0x35fc('0x9c')});}return respondWithRpcPromise(_0x35fc('0x9d'),_0x35fc('0x9e'),_0x1338a4);})['then'](function(_0x471711){respondWithRpcPromise(_0x35fc('0x9f'),_0x35fc('0x9f'),{'event':_0x35fc('0x6d'),'message':_0x471711},client9002);return _0x471711;})[_0x35fc('0x34')](respondWithResult(_0x52712e,null))[_0x35fc('0x28')](handleError(_0x52712e,null));};exports[_0x35fc('0xa0')]=function(_0x45df88,_0x1eaab6){var _0x2f53e0=_0x45df88[_0x35fc('0x63')]['id'];var _0x7b98b0=_0x45df88[_0x35fc('0x62')];var _0x206f0b=0xc8;var _0x3e7663=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x35fc('0xa1')][_0x35fc('0xa2')][_0x35fc('0xa3')][_0x35fc('0xa4')]},function(_0x219be6){return db[_0x35fc('0x40')][_0x35fc('0xa5')]({'where':{'id':_0x2f53e0},'transaction':_0x219be6})[_0x35fc('0x34')](function(_0x295121){if(_0x295121){return db[_0x35fc('0xa6')][_0x35fc('0x35')]({'where':{'OpenchannelAccountId':_0x2f53e0},'transaction':_0x219be6})[_0x35fc('0x34')](function(){var _0x3148f3=_[_0x35fc('0x3f')](_0x7b98b0,function(_0x253ec2){_0x253ec2['OpenchannelAccountId']=_0x2f53e0;return _0x253ec2;});return db[_0x35fc('0xa6')][_0x35fc('0xa7')](_0x3148f3,{'transaction':_0x219be6});});}else{_0x206f0b=0x194;_0x3e7663=[];}});})[_0x35fc('0x34')](function(){if(_0x206f0b!==0x194){return db[_0x35fc('0xa6')][_0x35fc('0xa8')]({'where':{'OpenchannelAccountId':_0x2f53e0},'order':_0x35fc('0x86')})[_0x35fc('0x34')](function(_0xa4c51a){_0x3e7663=_0xa4c51a;});}})['catch'](function(_0x4964d7){_0x206f0b=0x1f4;logger[_0x35fc('0x24')](_0x4964d7[_0x35fc('0x3a')]);if(_0x4964d7['name']){delete _0x4964d7[_0x35fc('0x3b')];}_0x3e7663=_0x4964d7;})[_0x35fc('0xa9')](function(){if(_0x3e7663===null){_0x1eaab6[_0x35fc('0x29')](_0x206f0b);}else{if(_0x206f0b===0x1f4){_0x1eaab6[_0x35fc('0x2a')](_0x206f0b)['send'](_0x3e7663);}else{_0x1eaab6[_0x35fc('0x2a')](_0x206f0b)[_0x35fc('0x31')](_0x3e7663);}}});};exports[_0x35fc('0xaa')]=function(_0x295a64,_0x54f353,_0x49ed6b){var _0x2ff4ba={};var _0x4bf9a5={};var _0x25c92e;var _0x3a1a0e;return db[_0x35fc('0x40')]['findOne']({'where':{'id':_0x295a64[_0x35fc('0x63')]['id']}})['then'](handleEntityNotFound(_0x54f353,null))[_0x35fc('0x34')](function(_0xe25a3a){if(_0xe25a3a){_0x25c92e=_0xe25a3a;_0x4bf9a5['model']=_[_0x35fc('0x46')](db[_0x35fc('0xa6')][_0x35fc('0x41')]);_0x4bf9a5[_0x35fc('0x45')]=_[_0x35fc('0x46')](_0x295a64[_0x35fc('0x45')]);_0x4bf9a5[_0x35fc('0x47')]=_['intersection'](_0x4bf9a5['model'],_0x4bf9a5[_0x35fc('0x45')]);_0x2ff4ba[_0x35fc('0x49')]=_[_0x35fc('0x48')](_0x4bf9a5[_0x35fc('0x44')],qs[_0x35fc('0x4a')](_0x295a64[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x2ff4ba['attributes']=_0x2ff4ba[_0x35fc('0x49')][_0x35fc('0x5a')]?_0x2ff4ba[_0x35fc('0x49')]:_0x4bf9a5['model'];_0x2ff4ba[_0x35fc('0x68')]=qs[_0x35fc('0x4c')](_0x295a64[_0x35fc('0x45')][_0x35fc('0x4c')]);_0x2ff4ba[_0x35fc('0x4d')]=qs[_0x35fc('0x47')](_[_0x35fc('0x4e')](_0x295a64[_0x35fc('0x45')],_0x4bf9a5[_0x35fc('0x47')]));if(_0x295a64[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x2ff4ba[_0x35fc('0x4d')]=_[_0x35fc('0x50')](_0x2ff4ba[_0x35fc('0x4d')],{'$or':_[_0x35fc('0x3f')](_0x2ff4ba[_0x35fc('0x49')],function(_0x26987e){var _0x18ffc2={};_0x18ffc2[_0x26987e]={'$like':'%'+_0x295a64[_0x35fc('0x45')]['filter']+'%'};return _0x18ffc2;})});}_0x2ff4ba=_[_0x35fc('0x50')]({},_0x2ff4ba,_0x295a64['options']);return _0x25c92e[_0x35fc('0xaa')](_0x2ff4ba);}})[_0x35fc('0x34')](function(_0x4dd4a2){if(_0x4dd4a2){_0x3a1a0e=_0x4dd4a2[_0x35fc('0x5a')];if(!_0x295a64[_0x35fc('0x45')][_0x35fc('0x4b')](_0x35fc('0x67'))){_0x2ff4ba[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x295a64[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x2ff4ba['offset']=qs[_0x35fc('0x2b')](_0x295a64[_0x35fc('0x45')][_0x35fc('0x2b')]);}return _0x25c92e[_0x35fc('0xaa')](_0x2ff4ba);}})['then'](function(_0x4dc276){if(_0x4dc276){return _0x4dc276?{'count':_0x3a1a0e,'rows':_0x4dc276}:null;}})['then'](respondWithResult(_0x54f353,null))['catch'](handleError(_0x54f353,null));};exports[_0x35fc('0xab')]=function(_0x572d83,_0xcbabdf,_0x2475d6){var _0x3909bf={'raw':![],'where':{}};var _0x1cccd8={};var _0x1b9e94={'count':0x0,'rows':[]};return db[_0x35fc('0x40')][_0x35fc('0xa5')]({'where':{'id':_0x572d83[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0xcbabdf,null))[_0x35fc('0x34')](function(_0x5bfd4d){if(_0x5bfd4d){_0x1cccd8[_0x35fc('0x44')]=_[_0x35fc('0x46')](db['OpenchannelInteraction'][_0x35fc('0x41')]);_0x1cccd8[_0x35fc('0x45')]=_[_0x35fc('0x46')](_0x572d83[_0x35fc('0x45')]);_0x1cccd8['filters']=_[_0x35fc('0x48')](_0x1cccd8[_0x35fc('0x44')],_0x1cccd8[_0x35fc('0x45')]);_0x3909bf[_0x35fc('0x49')]=_[_0x35fc('0x48')](_0x1cccd8[_0x35fc('0x44')],qs[_0x35fc('0x4a')](_0x572d83[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x3909bf[_0x35fc('0x49')]=_0x3909bf[_0x35fc('0x49')][_0x35fc('0x5a')]?_0x3909bf[_0x35fc('0x49')]:_0x1cccd8[_0x35fc('0x44')];if(!_0x572d83[_0x35fc('0x45')][_0x35fc('0x4b')](_0x35fc('0x67'))){_0x3909bf[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x572d83[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x3909bf[_0x35fc('0x2b')]=qs['offset'](_0x572d83[_0x35fc('0x45')][_0x35fc('0x2b')]);}_0x3909bf[_0x35fc('0x68')]=qs[_0x35fc('0x4c')](_0x572d83[_0x35fc('0x45')]['sort']);_0x3909bf[_0x35fc('0x4d')]=qs['filters'](_[_0x35fc('0x4e')](_0x572d83[_0x35fc('0x45')],_0x1cccd8[_0x35fc('0x47')]));_0x3909bf[_0x35fc('0x4d')][_0x35fc('0x65')]=_0x5bfd4d['id'];if(_0x572d83[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x3909bf[_0x35fc('0x4d')]=_[_0x35fc('0x50')](_0x3909bf[_0x35fc('0x4d')],{'$or':_[_0x35fc('0x3f')](_0x3909bf[_0x35fc('0x49')],function(_0x26d42e){var _0x201c0e={};_0x201c0e[_0x26d42e]={'$like':'%'+_0x572d83[_0x35fc('0x45')][_0x35fc('0x4f')]+'%'};return _0x201c0e;})});}_0x3909bf=_[_0x35fc('0x50')]({},_0x3909bf,_0x572d83[_0x35fc('0x53')]);return db[_0x35fc('0x8b')][_0x35fc('0x2e')]({'where':_0x3909bf['where']})[_0x35fc('0x34')](function(_0xb3afed){_0x1b9e94[_0x35fc('0x2e')]=_0xb3afed;if(_0x572d83['query'][_0x35fc('0x54')]){_0x3909bf[_0x35fc('0x55')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x35fc('0xac'),'attributes':[_0x35fc('0x3b'),'fullname',_0x35fc('0xad')],'required':![]},{'model':db[_0x35fc('0xae')],'as':_0x35fc('0xaf'),'attributes':['id',_0x35fc('0x3b'),_0x35fc('0xb0')],'where':_0x572d83[_0x35fc('0x45')]['tag']?{'id':_0x572d83[_0x35fc('0x45')][_0x35fc('0xb1')]}:undefined,'required':_0x572d83[_0x35fc('0x45')][_0x35fc('0xb1')]?!![]:![]}];}return db[_0x35fc('0x8b')]['findAll'](_0x3909bf);})[_0x35fc('0x34')](function(_0x387417){_0x1b9e94['rows']=_0x387417;return _0x1b9e94;});}})[_0x35fc('0x34')](respondWithFilteredResult(_0xcbabdf,_0x3909bf))[_0x35fc('0x28')](handleError(_0xcbabdf,null));};exports[_0x35fc('0xb2')]=function(_0x2e3674,_0x158e72,_0xb0ba1e){return db[_0x35fc('0x40')][_0x35fc('0x5b')]({'where':{'id':_0x2e3674[_0x35fc('0x63')]['id']}})['then'](handleEntityNotFound(_0x158e72,null))[_0x35fc('0x34')](function(_0x371e7d){if(_0x371e7d){return _0x371e7d['addAgents'](_0x2e3674[_0x35fc('0x62')]['ids'],_[_0x35fc('0xb3')](_0x2e3674[_0x35fc('0x62')],[_0x35fc('0x6a'),'id'])||{})[_0x35fc('0xb4')](function(_0x536837){for(var _0x3cfbd4=0x0;_0x3cfbd4<_0x2e3674[_0x35fc('0x62')][_0x35fc('0x6a')]['length'];_0x3cfbd4+=0x1){socket[_0x35fc('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x2e3674[_0x35fc('0x62')][_0x35fc('0x6a')][_0x3cfbd4]),'OpenchannelAccountId':Number(_0x2e3674[_0x35fc('0x63')]['id'])});}return _0x536837;});}})[_0x35fc('0x34')](respondWithResult(_0x158e72,null))[_0x35fc('0x28')](handleError(_0x158e72,null));};exports[_0x35fc('0xb6')]=function(_0x38b8e8,_0x2c0010,_0x37be5b){return db[_0x35fc('0x40')][_0x35fc('0x5b')]({'where':{'id':_0x38b8e8[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x2c0010,null))[_0x35fc('0x34')](function(_0x324c56){if(_0x324c56){return _0x324c56['removeAgents'](_0x38b8e8[_0x35fc('0x45')][_0x35fc('0x6a')])[_0x35fc('0x34')](function(){if(_[_0x35fc('0xb7')](_0x38b8e8[_0x35fc('0x45')][_0x35fc('0x6a')])){for(var _0x2138f4=0x0;_0x2138f4<_0x38b8e8['query']['ids']['length'];_0x2138f4+=0x1){socket['emit'](_0x35fc('0xb8'),{'UserId':Number(_0x38b8e8['query'][_0x35fc('0x6a')][_0x2138f4]),'OpenchannelAccountId':Number(_0x38b8e8[_0x35fc('0x63')]['id'])});}}else{socket[_0x35fc('0xb5')](_0x35fc('0xb8'),{'UserId':Number(_0x38b8e8[_0x35fc('0x45')][_0x35fc('0x6a')]),'OpenchannelAccountId':Number(_0x38b8e8['params']['id'])});}});}})[_0x35fc('0x34')](respondWithStatusCode(_0x2c0010,null))['catch'](handleError(_0x2c0010,null));};exports[_0x35fc('0xb9')]=function(_0x4cd30d,_0x5e680a,_0x132d58){var _0x472e13={};var _0x2d0512={};var _0x4f837c;var _0x54a183;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4cd30d[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x5e680a,null))[_0x35fc('0x34')](function(_0x546a61){if(_0x546a61){_0x4f837c=_0x546a61;_0x2d0512[_0x35fc('0x44')]=_[_0x35fc('0x46')](db[_0x35fc('0x97')][_0x35fc('0x41')]);_0x2d0512[_0x35fc('0x45')]=_['keys'](_0x4cd30d['query']);_0x2d0512[_0x35fc('0x47')]=_[_0x35fc('0x48')](_0x2d0512[_0x35fc('0x44')],_0x2d0512[_0x35fc('0x45')]);_0x472e13[_0x35fc('0x49')]=_[_0x35fc('0x48')](_0x2d0512['model'],qs[_0x35fc('0x4a')](_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x472e13['attributes']=_0x472e13['attributes'][_0x35fc('0x5a')]?_0x472e13[_0x35fc('0x49')]:_0x2d0512[_0x35fc('0x44')];_0x472e13['order']=qs[_0x35fc('0x4c')](_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x4c')]);_0x472e13['where']=qs[_0x35fc('0x47')](_['pick'](_0x4cd30d[_0x35fc('0x45')],_0x2d0512['filters']));if(_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x472e13['where']=_[_0x35fc('0x50')](_0x472e13[_0x35fc('0x4d')],{'$or':_['map'](_0x472e13[_0x35fc('0x49')],function(_0x102fc6){var _0x4420fb={};_0x4420fb[_0x102fc6]={'$like':'%'+_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x4f')]+'%'};return _0x4420fb;})});}_0x472e13=_[_0x35fc('0x50')]({},_0x472e13,_0x4cd30d['options']);return _0x4f837c[_0x35fc('0xb9')](_0x472e13);}})[_0x35fc('0x34')](function(_0x168427){if(_0x168427){_0x54a183=_0x168427[_0x35fc('0x5a')];if(!_0x4cd30d[_0x35fc('0x45')]['hasOwnProperty'](_0x35fc('0x67'))){_0x472e13[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x472e13[_0x35fc('0x2b')]=qs[_0x35fc('0x2b')](_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x2b')]);}return _0x4f837c['getAgents'](_0x472e13);}})[_0x35fc('0x34')](function(_0x465314){if(_0x465314){return _0x465314?{'count':_0x54a183,'rows':_0x465314}:null;}})[_0x35fc('0x34')](respondWithResult(_0x5e680a,null))['catch'](handleError(_0x5e680a,null));};exports[_0x35fc('0x3c')]=function(_0x4b6115,_0x2ceac9,_0x413a4b){var _0x599121,_0x311670,_0x10eb08;if(_[_0x35fc('0x77')](_0x4b6115[_0x35fc('0x62')][_0x35fc('0x62')])||_0x4b6115[_0x35fc('0x62')][_0x35fc('0x62')]===''){throw new db['Sequelize'][(_0x35fc('0x70'))](_0x35fc('0x7b'));}if(_[_0x35fc('0x77')](_0x4b6115['body']['to'])){}_0x599121=_0x4b6115['body']['to'];return db[_0x35fc('0x40')][_0x35fc('0xa5')]({'where':{'id':_0x4b6115[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x2ceac9,null))[_0x35fc('0x34')](function(_0x76e209){if(_0x76e209){return db[_0x35fc('0x40')][_0x35fc('0x5b')]({'where':{'id':_0x76e209['id']},'include':[{'model':db[_0x35fc('0x80')],'as':_0x35fc('0x81'),'include':[{'model':db[_0x35fc('0x6e')],'as':_0x35fc('0x82'),'where':{[_0x76e209[_0x35fc('0x7c')]]:_0x599121},'limit':0x1,'order':[[_0x35fc('0x74'),_0x35fc('0xba')]]}]}]})[_0x35fc('0x34')](handleEntityNotFound(_0x2ceac9,null))[_0x35fc('0x34')](function(_0x605f3b){if(_0x605f3b&&_0x605f3b[_0x35fc('0x81')]){_0x311670=_0x605f3b['get']({'plain':!![]});if(_0x311670[_0x35fc('0x81')]&&_0x311670['List']['Contacts'][_0x35fc('0x5a')]){return _0x311670[_0x35fc('0x81')][_0x35fc('0x82')][0x0];}return db[_0x35fc('0x6e')][_0x35fc('0x5c')](_[_0x35fc('0x17')](_0x4b6115[_0x35fc('0x62')],{'firstName':_0x599121,[_0x605f3b[_0x35fc('0x7c')]]:_0x599121,'phone':_0x599121,'ListId':_0x311670[_0x35fc('0x76')]}));}})[_0x35fc('0x34')](handleEntityNotFound(_0x2ceac9,null))[_0x35fc('0x34')](function(_0x3033a0){if(_0x3033a0){_0x10eb08=_0x3033a0;return db[_0x35fc('0x8b')][_0x35fc('0x5b')]({'where':{'ContactId':_0x10eb08['id'],'closed':![],'OpenchannelAccountId':_0x311670['id']}})[_0x35fc('0x34')](function(_0x3155a6){if(_0x3155a6){return[_0x3155a6,![]];}return db[_0x35fc('0x8b')][_0x35fc('0x5c')]({'UserId':_0x4b6115[_0x35fc('0x5d')]['id'],'ContactId':_0x10eb08['id'],'OpenchannelAccountId':_0x311670['id'],'lastMsgDirection':_0x35fc('0xbb'),'firstMsgDirection':'out','Messages':[_[_0x35fc('0x50')](_0x4b6115[_0x35fc('0x62')],{'read':![],'body':_0x4b6115[_0x35fc('0x62')]['body'],'OpenchannelAccountId':_0x311670['id'],'UserId':_0x4b6115[_0x35fc('0x5d')]['id'],'ContactId':_0x10eb08['id']})]},{'include':[{'model':db[_0x35fc('0x94')],'as':_0x35fc('0xbc')}]})['then'](function(_0x103046){return[_0x103046,!![]];});});}})[_0x35fc('0xb4')](function(_0x24ce43,_0x5318f5){if(_0x5318f5){return _0x24ce43;}return db[_0x35fc('0x94')][_0x35fc('0x5c')](_['merge'](_0x4b6115[_0x35fc('0x62')],{'read':![],'body':_0x4b6115[_0x35fc('0x62')][_0x35fc('0x62')],'OpenchannelAccountId':_0x311670['id'],'OpenchannelInteractionId':_0x24ce43['id'],'UserId':_0x4b6115[_0x35fc('0x5d')]['id'],'ContactId':_0x10eb08['id']}))['then'](function(_0x59faad){_0x24ce43['dataValues'][_0x35fc('0xbc')]=[];_0x24ce43[_0x35fc('0xbd')]['Messages'][_0x35fc('0xbe')](_0x59faad[_0x35fc('0xbd')]);return _0x24ce43;});});}})[_0x35fc('0x34')](respondWithResult(_0x2ceac9,null))[_0x35fc('0x28')](handleError(_0x2ceac9,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 00caa80..479383b 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 _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 +var _0xb821=['OpenchannelAccount','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x569b7a,_0x377a61){var _0x39d00a=function(_0x1ee0bc){while(--_0x1ee0bc){_0x569b7a['push'](_0x569b7a['shift']());}};_0x39d00a(++_0x377a61);}(_0xb821,0xa7));var _0x1b82=function(_0xb5d594,_0x3a3e65){_0xb5d594=_0xb5d594-0x0;var _0x20344e=_0xb821[_0xb5d594];return _0x20344e;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x1b82('0x0'))['db'][_0x1b82('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b82('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b1809){return function(_0x3b1d14,_0x1403ab,_0x3fadf0){OpenchannelAccountEvents[_0x1b82('0x3')](_0x4b1809+':'+_0x3b1d14['id'],_0x3b1d14);OpenchannelAccountEvents['emit'](_0x4b1809,_0x3b1d14);_0x3fadf0(null);};}for(var e in events){if(events[_0x1b82('0x4')](e)){var event=events[e];OpenchannelAccount[_0x1b82('0x5')](e,emitEvent(event));}}module[_0x1b82('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 1fb97c4..898d31c 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(_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 +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5298a0,_0x3a6696){var _0x3b359e=function(_0x52ea75){while(--_0x52ea75){_0x5298a0['push'](_0x5298a0['shift']());}};_0x3b359e(++_0x3a6696);}(_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 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 d18d3ea..8172c21 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 _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 +var _0xa902=['client','http','redis','./openchannelAccount.socket','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x5d4cb5,_0x22025e){var _0x25561e=function(_0x4d792a){while(--_0x4d792a){_0x5d4cb5['push'](_0x5d4cb5['shift']());}};_0x25561e(++_0x22025e);}(_0xa902,0x8d));var _0x2a90=function(_0x520b59,_0x46ba85){_0x520b59=_0x520b59-0x0;var _0x4491dc=_0xa902[_0x520b59];return _0x4491dc;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});config[_0x2a90('0xb')]=_['defaults'](config[_0x2a90('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a90('0xb')]));require(_0x2a90('0xc'))[_0x2a90('0xd')](socket);function respondWithRpcPromise(_0x2b0a20,_0x18a60e,_0x56550f){return new BPromise(function(_0x361571,_0x3dadc2){return client[_0x2a90('0xe')](_0x2b0a20,_0x56550f)[_0x2a90('0xf')](function(_0x541e22){logger[_0x2a90('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x18a60e,_0x2a90('0x11'));logger['debug'](_0x2a90('0x12'),_0x18a60e,'request\x20sent',JSON[_0x2a90('0x13')](_0x541e22));if(_0x541e22[_0x2a90('0x14')]){if(_0x541e22[_0x2a90('0x14')]['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x18a60e,_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);return _0x3dadc2(_0x541e22['error'][_0x2a90('0x15')]);}logger[_0x2a90('0x14')](_0x2a90('0x16'),_0x18a60e,_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);return _0x361571(_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);}else{logger[_0x2a90('0x10')](_0x2a90('0x16'),_0x18a60e,'request\x20sent');_0x361571(_0x541e22[_0x2a90('0x17')][_0x2a90('0x15')]);}})[_0x2a90('0x18')](function(_0x52622c){logger[_0x2a90('0x14')](_0x2a90('0x16'),_0x18a60e,_0x52622c);_0x3dadc2(_0x52622c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0988b09..2ed4600 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 _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 +var _0xe706=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','emit','removeListener'];(function(_0x4ab4a2,_0x41b416){var _0x57f331=function(_0xa67444){while(--_0xa67444){_0x4ab4a2['push'](_0x4ab4a2['shift']());}};_0x57f331(++_0x41b416);}(_0xe706,0xa3));var _0x6e70=function(_0x3a1972,_0x194511){_0x3a1972=_0x3a1972-0x0;var _0xc7e0b5=_0xe706[_0x3a1972];return _0xc7e0b5;};'use strict';var OpenchannelAccountEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelAccountEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelAccountEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 7026d8b..dd8cbd3 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 _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 +var _0xc066=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','create','put','/:id','destroy','exports','multer','util'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xc066,0x12a));var _0x6c06=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc066[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x6c06('0x0'));var util=require(_0x6c06('0x1'));var path=require(_0x6c06('0x2'));var timeout=require(_0x6c06('0x3'));var express=require(_0x6c06('0x4'));var router=express[_0x6c06('0x5')]();var fs_extra=require(_0x6c06('0x6'));var auth=require(_0x6c06('0x7'));var interaction=require(_0x6c06('0x8'));var config=require(_0x6c06('0x9'));var controller=require(_0x6c06('0xa'));router[_0x6c06('0xb')]('/',auth[_0x6c06('0xc')](),controller[_0x6c06('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6c06('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6c06('0xf')]);router[_0x6c06('0x10')](_0x6c06('0x11'),auth[_0x6c06('0xc')](),controller['update']);router['delete'](_0x6c06('0x11'),auth[_0x6c06('0xc')](),controller[_0x6c06('0x12')]);module[_0x6c06('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index d632d05..9cb7ab1 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 _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 +var _0xc64d=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x4a1d7e,_0xf9ec90){var _0x5ef508=function(_0x567e96){while(--_0x567e96){_0x4a1d7e['push'](_0x4a1d7e['shift']());}};_0x5ef508(++_0xf9ec90);}(_0xc64d,0x6f));var _0xdc64=function(_0x3b5d1b,_0x1e2707){_0x3b5d1b=_0x3b5d1b-0x0;var _0x26c2a4=_0xc64d[_0x3b5d1b];return _0x26c2a4;};'use strict';var Sequelize=require(_0xdc64('0x0'));module['exports']={'priority':{'type':Sequelize[_0xdc64('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdc64('0x2')],'allowNull':![],'defaultValue':_0xdc64('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xdc64('0x2')]},'interval':{'type':Sequelize[_0xdc64('0x2')],'defaultValue':_0xdc64('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index de34864..f799948 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 _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 +var _0x0d72=['update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body'];(function(_0xf37274,_0x4fc7b1){var _0x49d199=function(_0x2ace04){while(--_0x2ace04){_0xf37274['push'](_0xf37274['shift']());}};_0x49d199(++_0x4fc7b1);}(_0x0d72,0x1ac));var _0x20d7=function(_0x399af3,_0x49100b){_0x399af3=_0x399af3-0x0;var _0x4cfdb4=_0x0d72[_0x399af3];return _0x4cfdb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20d7('0x0'));var zipdir=require(_0x20d7('0x1'));var jsonpatch=require(_0x20d7('0x2'));var rp=require(_0x20d7('0x3'));var moment=require(_0x20d7('0x4'));var BPromise=require(_0x20d7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x20d7('0x6'));var sox=require('sox');var csv=require(_0x20d7('0x7'));var ejs=require(_0x20d7('0x8'));var fs=require('fs');var fs_extra=require(_0x20d7('0x9'));var _=require(_0x20d7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x20d7('0xb'));var deskjs=require(_0x20d7('0xc'));var toCsv=require(_0x20d7('0x7'));var querystring=require(_0x20d7('0xd'));var Papa=require('papaparse');var Redis=require(_0x20d7('0xe'));var authService=require(_0x20d7('0xf'));var qs=require(_0x20d7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20d7('0x11'));var logger=require(_0x20d7('0x12'))(_0x20d7('0x13'));var utils=require('../../config/utils');var config=require(_0x20d7('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bebb8,_0x184c50){_0x184c50=_0x184c50||0xcc;return function(_0x45ccdb){if(_0x45ccdb){return _0x1bebb8['sendStatus'](_0x184c50);}return _0x1bebb8[_0x20d7('0x15')](_0x184c50)['end']();};}function respondWithResult(_0x4fba4b,_0x506bdb){_0x506bdb=_0x506bdb||0xc8;return function(_0x3499a8){if(_0x3499a8){return _0x4fba4b['status'](_0x506bdb)['json'](_0x3499a8);}};}function respondWithFilteredResult(_0x11a829,_0x5cb968){return function(_0x1931eb){if(_0x1931eb){var _0x5061a5=typeof _0x5cb968['offset']===_0x20d7('0x16')&&typeof _0x5cb968[_0x20d7('0x17')]==='undefined';var _0x3e18ff=_0x1931eb[_0x20d7('0x18')];var _0x286215=_0x5061a5?0x0:_0x5cb968[_0x20d7('0x19')];var _0x1ee105=_0x5061a5?_0x1931eb[_0x20d7('0x18')]:_0x5cb968[_0x20d7('0x19')]+_0x5cb968['limit'];var _0x1c9170;if(_0x1ee105>=_0x3e18ff){_0x1ee105=_0x3e18ff;_0x1c9170=0xc8;}else{_0x1c9170=0xce;}_0x11a829[_0x20d7('0x15')](_0x1c9170);return _0x11a829['set'](_0x20d7('0x1a'),_0x286215+'-'+_0x1ee105+'/'+_0x3e18ff)[_0x20d7('0x1b')](_0x1931eb);}return null;};}function patchUpdates(_0x59ff90){return function(_0x2b573f){try{jsonpatch[_0x20d7('0x1c')](_0x2b573f,_0x59ff90,!![]);}catch(_0x16d97e){return BPromise[_0x20d7('0x1d')](_0x16d97e);}return _0x2b573f[_0x20d7('0x1e')]();};}function saveUpdates(_0x1ff1f9,_0xb81d0d){return function(_0x1dfe3a){if(_0x1dfe3a){return _0x1dfe3a['update'](_0x1ff1f9)[_0x20d7('0x1f')](function(_0x133fbe){return _0x133fbe;});}return null;};}function removeEntity(_0x3af1f9,_0x5b0a94){return function(_0x47bb53){if(_0x47bb53){return _0x47bb53['destroy']()['then'](function(){_0x3af1f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e76bd,_0x19671b){return function(_0x100195){if(!_0x100195){_0x2e76bd[_0x20d7('0x20')](0x194);}return _0x100195;};}function handleError(_0x31a6b5,_0xcdb01d){_0xcdb01d=_0xcdb01d||0x1f4;return function(_0x30ee8c){logger[_0x20d7('0x21')](_0x30ee8c[_0x20d7('0x22')]);if(_0x30ee8c[_0x20d7('0x23')]){delete _0x30ee8c['name'];}_0x31a6b5[_0x20d7('0x15')](_0xcdb01d)[_0x20d7('0x24')](_0x30ee8c);};}exports['index']=function(_0x1368e8,_0x217181){var _0x2eb5a1={},_0x246ab1={},_0x1fa4c3={'count':0x0,'rows':[]};var _0xc86b56=_[_0x20d7('0x25')](db[_0x20d7('0x26')][_0x20d7('0x27')],function(_0x1f8afa){return{'name':_0x1f8afa[_0x20d7('0x28')],'type':_0x1f8afa[_0x20d7('0x29')][_0x20d7('0x2a')]};});_0x246ab1[_0x20d7('0x2b')]=_[_0x20d7('0x25')](_0xc86b56,'name');_0x246ab1[_0x20d7('0x2c')]=_[_0x20d7('0x2d')](_0x1368e8[_0x20d7('0x2c')]);_0x246ab1[_0x20d7('0x2e')]=_[_0x20d7('0x2f')](_0x246ab1[_0x20d7('0x2b')],_0x246ab1[_0x20d7('0x2c')]);_0x2eb5a1[_0x20d7('0x30')]=_[_0x20d7('0x2f')](_0x246ab1[_0x20d7('0x2b')],qs[_0x20d7('0x31')](_0x1368e8[_0x20d7('0x2c')]['fields']));_0x2eb5a1[_0x20d7('0x30')]=_0x2eb5a1['attributes'][_0x20d7('0x32')]?_0x2eb5a1[_0x20d7('0x30')]:_0x246ab1['model'];if(!_0x1368e8[_0x20d7('0x2c')]['hasOwnProperty'](_0x20d7('0x33'))){_0x2eb5a1[_0x20d7('0x17')]=qs['limit'](_0x1368e8[_0x20d7('0x2c')][_0x20d7('0x17')]);_0x2eb5a1[_0x20d7('0x19')]=qs[_0x20d7('0x19')](_0x1368e8['query'][_0x20d7('0x19')]);}_0x2eb5a1[_0x20d7('0x34')]=qs[_0x20d7('0x35')](_0x1368e8[_0x20d7('0x2c')]['sort']);_0x2eb5a1[_0x20d7('0x36')]=qs[_0x20d7('0x2e')](_[_0x20d7('0x37')](_0x1368e8[_0x20d7('0x2c')],_0x246ab1[_0x20d7('0x2e')]),_0xc86b56);if(_0x1368e8[_0x20d7('0x2c')][_0x20d7('0x38')]){_0x2eb5a1[_0x20d7('0x36')]=_[_0x20d7('0x39')](_0x2eb5a1[_0x20d7('0x36')],{'$or':_[_0x20d7('0x25')](_0xc86b56,function(_0x240205){if(_0x240205['type']!=='VIRTUAL'){var _0x3fc289={};_0x3fc289[_0x240205['name']]={'$like':'%'+_0x1368e8['query'][_0x20d7('0x38')]+'%'};return _0x3fc289;}})});}_0x2eb5a1=_['merge']({},_0x2eb5a1,_0x1368e8[_0x20d7('0x3a')]);var _0x2eb6f9={'where':_0x2eb5a1[_0x20d7('0x36')]};return db['OpenchannelApplication'][_0x20d7('0x18')](_0x2eb6f9)[_0x20d7('0x1f')](function(_0x4bd7f7){_0x1fa4c3['count']=_0x4bd7f7;if(_0x1368e8[_0x20d7('0x2c')][_0x20d7('0x3b')]){_0x2eb5a1['include']=[{'all':!![]}];}return db[_0x20d7('0x26')][_0x20d7('0x3c')](_0x2eb5a1);})[_0x20d7('0x1f')](function(_0x2f7e84){_0x1fa4c3[_0x20d7('0x3d')]=_0x2f7e84;return _0x1fa4c3;})['then'](respondWithFilteredResult(_0x217181,_0x2eb5a1))[_0x20d7('0x3e')](handleError(_0x217181,null));};exports[_0x20d7('0x3f')]=function(_0xec060c,_0x386dc8){var _0x39b1d3={'raw':!![],'where':{'id':_0xec060c[_0x20d7('0x40')]['id']}},_0x5d5c31={};_0x5d5c31[_0x20d7('0x2b')]=_[_0x20d7('0x2d')](db[_0x20d7('0x26')][_0x20d7('0x27')]);_0x5d5c31[_0x20d7('0x2c')]=_[_0x20d7('0x2d')](_0xec060c[_0x20d7('0x2c')]);_0x5d5c31['filters']=_['intersection'](_0x5d5c31[_0x20d7('0x2b')],_0x5d5c31[_0x20d7('0x2c')]);_0x39b1d3['attributes']=_[_0x20d7('0x2f')](_0x5d5c31[_0x20d7('0x2b')],qs['fields'](_0xec060c[_0x20d7('0x2c')]['fields']));_0x39b1d3[_0x20d7('0x30')]=_0x39b1d3[_0x20d7('0x30')][_0x20d7('0x32')]?_0x39b1d3[_0x20d7('0x30')]:_0x5d5c31['model'];if(_0xec060c[_0x20d7('0x2c')][_0x20d7('0x3b')]){_0x39b1d3[_0x20d7('0x41')]=[{'all':!![]}];}_0x39b1d3=_[_0x20d7('0x39')]({},_0x39b1d3,_0xec060c[_0x20d7('0x3a')]);return db[_0x20d7('0x26')][_0x20d7('0x42')](_0x39b1d3)[_0x20d7('0x1f')](handleEntityNotFound(_0x386dc8,null))[_0x20d7('0x1f')](respondWithResult(_0x386dc8,null))['catch'](handleError(_0x386dc8,null));};exports['create']=function(_0x1260fb,_0xf57f11){return db['OpenchannelApplication'][_0x20d7('0x43')](_0x1260fb[_0x20d7('0x44')],{})[_0x20d7('0x1f')](respondWithResult(_0xf57f11,0xc9))[_0x20d7('0x3e')](handleError(_0xf57f11,null));};exports[_0x20d7('0x45')]=function(_0x547184,_0x278467){if(_0x547184[_0x20d7('0x44')]['id']){delete _0x547184['body']['id'];}return db[_0x20d7('0x26')][_0x20d7('0x42')]({'where':{'id':_0x547184[_0x20d7('0x40')]['id']}})[_0x20d7('0x1f')](handleEntityNotFound(_0x278467,null))[_0x20d7('0x1f')](saveUpdates(_0x547184[_0x20d7('0x44')],null))[_0x20d7('0x1f')](respondWithResult(_0x278467,null))[_0x20d7('0x3e')](handleError(_0x278467,null));};exports[_0x20d7('0x46')]=function(_0x2871f4,_0x426c0e){return db['OpenchannelApplication']['find']({'where':{'id':_0x2871f4['params']['id']}})[_0x20d7('0x1f')](handleEntityNotFound(_0x426c0e,null))[_0x20d7('0x1f')](removeEntity(_0x426c0e,null))[_0x20d7('0x3e')](handleError(_0x426c0e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8a34863..e1f5ecd 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 _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 +var _0xbf46=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci'];(function(_0x1b4003,_0x3a009f){var _0x4762fc=function(_0x4939e5){while(--_0x4939e5){_0x1b4003['push'](_0x1b4003['shift']());}};_0x4762fc(++_0x3a009f);}(_0xbf46,0x1a4));var _0x6bf4=function(_0x1fa290,_0x2ff3e4){_0x1fa290=_0x1fa290-0x0;var _0x3cdd42=_0xbf46[_0x1fa290];return _0x3cdd42;};'use strict';var _=require('lodash');var util=require(_0x6bf4('0x0'));var logger=require(_0x6bf4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6bf4('0x2'));var rp=require(_0x6bf4('0x3'));var fs=require('fs');var path=require(_0x6bf4('0x4'));var rimraf=require(_0x6bf4('0x5'));var config=require(_0x6bf4('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0x6bf4('0x7')]=function(_0x39613c,_0xef1967){return _0x39613c[_0x6bf4('0x8')](_0x6bf4('0x9'),attributes,{'tableName':_0x6bf4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6bf4('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 38ed53d..57865fc 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 _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 +var _0x35c1=['raw','where','attributes','limit','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options'];(function(_0x5acf1d,_0x17f4d3){var _0x380572=function(_0x887ebe){while(--_0x887ebe){_0x5acf1d['push'](_0x5acf1d['shift']());}};_0x380572(++_0x17f4d3);}(_0x35c1,0x7d));var _0x135c=function(_0x477f1a,_0x4999d3){_0x477f1a=_0x477f1a-0x0;var _0x1cf352=_0x35c1[_0x477f1a];return _0x1cf352;};'use strict';var _=require(_0x135c('0x0'));var util=require(_0x135c('0x1'));var moment=require('moment');var BPromise=require(_0x135c('0x2'));var rs=require(_0x135c('0x3'));var fs=require('fs');var Redis=require(_0x135c('0x4'));var db=require(_0x135c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x135c('0x6'));var config=require(_0x135c('0x7'));var jayson=require(_0x135c('0x8'));var client=jayson['client'][_0x135c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d5387,_0x560cec,_0x2565fb){return new BPromise(function(_0x4b03df,_0x259cd0){return client['request'](_0x5d5387,_0x2565fb)[_0x135c('0xa')](function(_0xcbb5eb){logger[_0x135c('0xb')](_0x135c('0xc'),_0x560cec,_0x135c('0xd'));logger['debug'](_0x135c('0xe'),_0x560cec,_0x135c('0xd'),JSON[_0x135c('0xf')](_0xcbb5eb));if(_0xcbb5eb[_0x135c('0x10')]){if(_0xcbb5eb[_0x135c('0x10')][_0x135c('0x11')]===0x1f4){logger[_0x135c('0x10')](_0x135c('0xc'),_0x560cec,_0xcbb5eb['error'][_0x135c('0x12')]);return _0x259cd0(_0xcbb5eb[_0x135c('0x10')]['message']);}logger[_0x135c('0x10')](_0x135c('0xc'),_0x560cec,_0xcbb5eb[_0x135c('0x10')]['message']);return _0x4b03df(_0xcbb5eb[_0x135c('0x10')]['message']);}else{logger[_0x135c('0xb')](_0x135c('0xc'),_0x560cec,_0x135c('0xd'));_0x4b03df(_0xcbb5eb['result']['message']);}})[_0x135c('0x13')](function(_0x2c962c){logger[_0x135c('0x10')](_0x135c('0xc'),_0x560cec,_0x2c962c);_0x259cd0(_0x2c962c);});});}exports[_0x135c('0x14')]=function(_0x152168){var _0x3e71e6=this;return new Promise(function(_0x12378a,_0xf59ec6){return db[_0x135c('0x15')][_0x135c('0x16')](_0x152168[_0x135c('0x17')],{'raw':_0x152168[_0x135c('0x18')]?_0x152168[_0x135c('0x18')][_0x135c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152168[_0x135c('0x18')]?_0x152168[_0x135c('0x18')][_0x135c('0x1a')]||null:null,'attributes':_0x152168[_0x135c('0x18')]?_0x152168['options'][_0x135c('0x1b')]||null:null,'limit':_0x152168[_0x135c('0x18')]?_0x152168[_0x135c('0x18')][_0x135c('0x1c')]||null:null})[_0x135c('0xa')](function(_0x51e3b8){logger[_0x135c('0xb')](_0x135c('0x14'),_0x152168);logger[_0x135c('0x1d')](_0x135c('0x14'),_0x152168,JSON[_0x135c('0xf')](_0x51e3b8));_0x12378a(_0x51e3b8);})[_0x135c('0x13')](function(_0xaaa87b){logger[_0x135c('0x10')](_0x135c('0x14'),_0xaaa87b[_0x135c('0x12')],_0x152168);_0xf59ec6(_0x3e71e6[_0x135c('0x10')](0x1f4,_0xaaa87b[_0x135c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 7096d30..2cfc883 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 _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 +var _0x3488=['Router','fs-extra','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','util','path','express'];(function(_0x190fb4,_0x39cb47){var _0x2245fd=function(_0x56d55a){while(--_0x56d55a){_0x190fb4['push'](_0x190fb4['shift']());}};_0x2245fd(++_0x39cb47);}(_0x3488,0xd6));var _0x8348=function(_0x2f6413,_0x9a71cc){_0x2f6413=_0x2f6413-0x0;var _0x2b03a5=_0x3488[_0x2f6413];return _0x2b03a5;};'use strict';var multer=require('multer');var util=require(_0x8348('0x0'));var path=require(_0x8348('0x1'));var timeout=require('connect-timeout');var express=require(_0x8348('0x2'));var router=express[_0x8348('0x3')]();var fs_extra=require(_0x8348('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8348('0x5'));var config=require('../../config/environment');var controller=require(_0x8348('0x6'));router[_0x8348('0x7')]('/',auth[_0x8348('0x8')](),controller[_0x8348('0x9')]);router[_0x8348('0x7')]('/describe',auth[_0x8348('0x8')](),controller[_0x8348('0xa')]);router['get'](_0x8348('0xb'),auth[_0x8348('0x8')](),controller[_0x8348('0xc')]);router['get'](_0x8348('0xd'),auth['isAuthenticated'](),controller[_0x8348('0xe')]);router[_0x8348('0x7')](_0x8348('0xf'),auth[_0x8348('0x8')](),controller['download']);router['post']('/',auth[_0x8348('0x8')](),controller[_0x8348('0x10')]);router[_0x8348('0x11')](_0x8348('0xd'),auth['isAuthenticated'](),controller[_0x8348('0x12')]);router[_0x8348('0x11')](_0x8348('0x13'),auth['isAuthenticated'](),interaction[_0x8348('0x14')]('openchannel',_0x8348('0x15')),controller[_0x8348('0x16')]);router[_0x8348('0x17')](_0x8348('0xb'),auth[_0x8348('0x8')](),interaction['tracked'](_0x8348('0x18'),_0x8348('0x19')),controller[_0x8348('0x1a')]);router[_0x8348('0x1b')](_0x8348('0xb'),auth[_0x8348('0x8')](),interaction[_0x8348('0x14')](_0x8348('0x18'),_0x8348('0x1c')),controller[_0x8348('0x1d')]);router[_0x8348('0x1b')](_0x8348('0x13'),auth[_0x8348('0x8')](),controller[_0x8348('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d2c61db..d4ee04d 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 _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 +var _0x86f5=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x451659,_0xbe141d){var _0x5565ef=function(_0xcd388c){while(--_0xcd388c){_0x451659['push'](_0x451659['shift']());}};_0x5565ef(++_0xbe141d);}(_0x86f5,0x178));var _0x586f=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x86f5[_0x5c6244];return _0x5800ce;};'use strict';var Sequelize=require(_0x586f('0x0'));module['exports']={'closed':{'type':Sequelize[_0x586f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x586f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x586f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x586f('0x3')]},'note':{'type':Sequelize[_0x586f('0x3')]},'read1stAt':{'type':Sequelize[_0x586f('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x586f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x586f('0x4')]('in',_0x586f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x586f('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x586f('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x586f('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d4d076e..6a90562 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 _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 +var _0xbf89=['rimraf','moment','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','error','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','query','user','catch','show','from','params','model','keys','filters','attributes','fields','length','include','options','find','create','body','describe','addMessage','ids','OpenchannelMessage','intersection','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','$gte','split','format','includeAll','findAll','rows','addTags','omit','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','attachments','transcript-%d-%s.zip','join','User','fullname','push','CmContact','Contact','Attachment','createdAt','read','OpenchannelAccount','get','mkdirSync','Openchannel','Account','Owner','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','toString','disposition','Private','Messages','existsSync','createReadStream','pipe','basename','direction','out','System','firstName','lastName','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file'];(function(_0x12eb0b,_0x1b7c44){var _0x801aa1=function(_0x6785e3){while(--_0x6785e3){_0x12eb0b['push'](_0x12eb0b['shift']());}};_0x801aa1(++_0x1b7c44);}(_0xbf89,0xfc));var _0x9bf8=function(_0x3cec45,_0x37d817){_0x3cec45=_0x3cec45-0x0;var _0x51d691=_0xbf89[_0x3cec45];return _0x51d691;};'use strict';var rimraf=require(_0x9bf8('0x0'));var zipdir=require('zip-dir');var moment=require(_0x9bf8('0x1'));var util=require('util');var path=require(_0x9bf8('0x2'));var ejs=require(_0x9bf8('0x3'));var fs=require('fs');var _=require(_0x9bf8('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x9bf8('0x5'));var pdf=require(_0x9bf8('0x6'));var logger=require(_0x9bf8('0x7'))(_0x9bf8('0x8'));var config=require(_0x9bf8('0x9'));var db=require(_0x9bf8('0xa'))['db'];config[_0x9bf8('0xb')]=_[_0x9bf8('0xc')](config[_0x9bf8('0xb')],{'host':_0x9bf8('0xd'),'port':0x18eb});var socket=require(_0x9bf8('0xe'))(new Redis(config[_0x9bf8('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3bd25f,_0x591d9d){_0x591d9d=_0x591d9d||0xcc;return function(_0x437372){if(_0x437372){return _0x3bd25f[_0x9bf8('0xf')](_0x591d9d);}return _0x3bd25f[_0x9bf8('0x10')](_0x591d9d)[_0x9bf8('0x11')]();};}function respondWithResult(_0x2ca1fe,_0x243650){_0x243650=_0x243650||0xc8;return function(_0x5c0ea9){if(_0x5c0ea9){return _0x2ca1fe[_0x9bf8('0x10')](_0x243650)['json'](_0x5c0ea9);}};}function respondWithFilteredResult(_0x5d7b40,_0x5d1ce3){return function(_0x43f95c){if(_0x43f95c){var _0x36b639=typeof _0x5d1ce3[_0x9bf8('0x12')]===_0x9bf8('0x13')&&typeof _0x5d1ce3[_0x9bf8('0x14')]===_0x9bf8('0x13');var _0x264fcd=_0x43f95c[_0x9bf8('0x15')];var _0x24d8a8=_0x36b639?0x0:_0x5d1ce3[_0x9bf8('0x12')];var _0x4eb5a4=_0x36b639?_0x43f95c[_0x9bf8('0x15')]:_0x5d1ce3[_0x9bf8('0x12')]+_0x5d1ce3[_0x9bf8('0x14')];var _0x14e9ac;if(_0x4eb5a4>=_0x264fcd){_0x4eb5a4=_0x264fcd;_0x14e9ac=0xc8;}else{_0x14e9ac=0xce;}_0x5d7b40[_0x9bf8('0x10')](_0x14e9ac);return _0x5d7b40[_0x9bf8('0x16')](_0x9bf8('0x17'),_0x24d8a8+'-'+_0x4eb5a4+'/'+_0x264fcd)[_0x9bf8('0x18')](_0x43f95c);}return null;};}function saveUpdates(_0x18d27d){return function(_0x3cad90){if(_0x3cad90){return _0x3cad90[_0x9bf8('0x19')](_0x18d27d)['then'](function(_0x4af3bb){return _0x4af3bb;});}return null;};}function removeEntity(_0x23dcd5){return function(_0x41b9df){if(_0x41b9df){return _0x41b9df[_0x9bf8('0x1a')]()[_0x9bf8('0x1b')](function(){_0x23dcd5['status'](0xcc)[_0x9bf8('0x11')]();});}};}function handleEntityNotFound(_0x5d17f4){return function(_0x1dc404){if(!_0x1dc404){_0x5d17f4[_0x9bf8('0xf')](0x194);}return _0x1dc404;};}function handleError(_0x5ca959,_0x4737b4){_0x4737b4=_0x4737b4||0x1f4;return function(_0x572401){logger[_0x9bf8('0x1c')](_0x572401['stack']);if(_0x572401['name']){delete _0x572401[_0x9bf8('0x1d')];}_0x5ca959['status'](_0x4737b4)[_0x9bf8('0x1e')](_0x572401);};}exports[_0x9bf8('0x1f')]=function(_0x40dece,_0x4f6e41){var _0x4a8e21={};var _0xc73487=_[_0x9bf8('0x20')](db[_0x9bf8('0x21')][_0x9bf8('0x22')],function(_0x3703bf){return{'name':_0x3703bf[_0x9bf8('0x23')],'type':_0x3703bf[_0x9bf8('0x24')][_0x9bf8('0x25')]};});_0x4a8e21=qs[_0x9bf8('0x26')](_0xc73487,_0x40dece);return interaction['findAll']('openchannel',_0x40dece[_0x9bf8('0x27')],_0x40dece[_0x9bf8('0x28')],_0x4a8e21,_0xc73487)[_0x9bf8('0x1b')](respondWithFilteredResult(_0x4f6e41,_0x4a8e21))[_0x9bf8('0x29')](handleError(_0x4f6e41,null));};exports[_0x9bf8('0x2a')]=function(_0x12f05f,_0x3aa99f){var _0x1532cf={};if(_0x12f05f['query'][_0x9bf8('0x24')]&&_0x12f05f[_0x9bf8('0x27')][_0x9bf8('0x24')]===_0x9bf8('0x2b')){_0x1532cf['from']=_0x12f05f[_0x9bf8('0x2c')]['id'];}else{_0x1532cf['id']=_0x12f05f[_0x9bf8('0x2c')]['id'];}var _0x3f5fb4={'raw':![],'where':_0x1532cf},_0x27c7cb={};_0x27c7cb[_0x9bf8('0x2d')]=_[_0x9bf8('0x2e')](db[_0x9bf8('0x21')][_0x9bf8('0x22')]);_0x27c7cb[_0x9bf8('0x27')]=_[_0x9bf8('0x2e')](_0x12f05f[_0x9bf8('0x27')]);_0x27c7cb[_0x9bf8('0x2f')]=_['intersection'](_0x27c7cb[_0x9bf8('0x2d')],_0x27c7cb['query']);_0x3f5fb4[_0x9bf8('0x30')]=_['intersection'](_0x27c7cb[_0x9bf8('0x2d')],qs[_0x9bf8('0x31')](_0x12f05f[_0x9bf8('0x27')][_0x9bf8('0x31')]));_0x3f5fb4[_0x9bf8('0x30')]=_0x3f5fb4[_0x9bf8('0x30')][_0x9bf8('0x32')]?_0x3f5fb4[_0x9bf8('0x30')]:_0x27c7cb[_0x9bf8('0x2d')];if(_0x12f05f['query']['includeAll']){_0x3f5fb4[_0x9bf8('0x33')]=[{'all':!![]}];}_0x3f5fb4=_['merge']({},_0x3f5fb4,_0x12f05f[_0x9bf8('0x34')]);return db[_0x9bf8('0x21')][_0x9bf8('0x35')](_0x3f5fb4)[_0x9bf8('0x1b')](handleEntityNotFound(_0x3aa99f,null))[_0x9bf8('0x1b')](respondWithResult(_0x3aa99f,null))[_0x9bf8('0x29')](handleError(_0x3aa99f,null));};exports[_0x9bf8('0x36')]=function(_0xbb451,_0xf4f791){return db['OpenchannelInteraction']['create'](_0xbb451[_0x9bf8('0x37')],{})[_0x9bf8('0x1b')](respondWithResult(_0xf4f791,0xc9))[_0x9bf8('0x29')](handleError(_0xf4f791,null));};exports[_0x9bf8('0x19')]=function(_0x5747cc,_0x339bbd){if(_0x5747cc[_0x9bf8('0x37')]['id']){delete _0x5747cc[_0x9bf8('0x37')]['id'];}return db[_0x9bf8('0x21')][_0x9bf8('0x35')]({'where':{'id':_0x5747cc[_0x9bf8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x339bbd,null))['then'](saveUpdates(_0x5747cc[_0x9bf8('0x37')],null))[_0x9bf8('0x1b')](respondWithResult(_0x339bbd,null))[_0x9bf8('0x29')](handleError(_0x339bbd,null));};exports['destroy']=function(_0x3cd163,_0x30b3ea){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3cd163[_0x9bf8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x30b3ea,null))[_0x9bf8('0x1b')](removeEntity(_0x30b3ea,null))[_0x9bf8('0x29')](handleError(_0x30b3ea,null));};exports[_0x9bf8('0x38')]=function(_0x1cc403,_0x2d4198){return db[_0x9bf8('0x21')]['describe']()['then'](respondWithResult(_0x2d4198,null))[_0x9bf8('0x29')](handleError(_0x2d4198,null));};exports[_0x9bf8('0x39')]=function(_0x1e5cb9,_0x59668d){return db['OpenchannelMessage'][_0x9bf8('0x35')]({'where':{'id':_0x1e5cb9[_0x9bf8('0x2c')]['id']}})[_0x9bf8('0x1b')](handleEntityNotFound(_0x59668d,null))[_0x9bf8('0x1b')](function(_0x1965e7){if(_0x1965e7){return _0x1965e7[_0x9bf8('0x39')](_0x1e5cb9[_0x9bf8('0x37')]['ids'],_['omit'](_0x1e5cb9[_0x9bf8('0x37')],[_0x9bf8('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x59668d,null))[_0x9bf8('0x29')](handleError(_0x59668d,null));};exports['getMessages']=function(_0x4fc18a,_0x4576db){var _0x183e8c={'raw':![],'where':{}};var _0x5b9975={};var _0x3d92dc={'count':0x0,'rows':[]};return db[_0x9bf8('0x21')]['findOne']({'where':{'id':_0x4fc18a[_0x9bf8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4576db,null))[_0x9bf8('0x1b')](function(_0x2ec63e){if(_0x2ec63e){_0x5b9975[_0x9bf8('0x2d')]=_[_0x9bf8('0x2e')](db[_0x9bf8('0x3b')][_0x9bf8('0x22')]);_0x5b9975[_0x9bf8('0x27')]=_[_0x9bf8('0x2e')](_0x4fc18a['query']);_0x5b9975[_0x9bf8('0x2f')]=_[_0x9bf8('0x3c')](_0x5b9975[_0x9bf8('0x2d')],_0x5b9975[_0x9bf8('0x27')]);_0x183e8c[_0x9bf8('0x30')]=_[_0x9bf8('0x3c')](_0x5b9975[_0x9bf8('0x2d')],qs[_0x9bf8('0x31')](_0x4fc18a[_0x9bf8('0x27')][_0x9bf8('0x31')]));_0x183e8c['attributes']=_0x183e8c[_0x9bf8('0x30')][_0x9bf8('0x32')]?_0x183e8c['attributes']:_0x5b9975[_0x9bf8('0x2d')];if(!_0x4fc18a['query'][_0x9bf8('0x3d')](_0x9bf8('0x3e'))){_0x183e8c[_0x9bf8('0x14')]=qs[_0x9bf8('0x14')](_0x4fc18a[_0x9bf8('0x27')][_0x9bf8('0x14')]);_0x183e8c[_0x9bf8('0x12')]=qs[_0x9bf8('0x12')](_0x4fc18a['query']['offset']);}_0x183e8c[_0x9bf8('0x3f')]=qs[_0x9bf8('0x40')](_0x4fc18a[_0x9bf8('0x27')][_0x9bf8('0x40')]);_0x183e8c[_0x9bf8('0x41')]=qs[_0x9bf8('0x2f')](_[_0x9bf8('0x42')](_0x4fc18a['query'],_0x5b9975[_0x9bf8('0x2f')]));_0x183e8c['where']['OpenchannelInteractionId']=_0x2ec63e['id'];if(_0x4fc18a[_0x9bf8('0x27')]['filter']){_0x183e8c[_0x9bf8('0x41')]=_[_0x9bf8('0x43')](_0x183e8c['where'],{'$or':_['map'](_0x183e8c[_0x9bf8('0x30')],function(_0x4dabef){var _0x5b0667={};_0x5b0667[_0x4dabef]={'$like':'%'+_0x4fc18a[_0x9bf8('0x27')][_0x9bf8('0x44')]+'%'};return _0x5b0667;})});}if(_0x4fc18a['query']['$gte']){var _0x33599f=_0x4fc18a[_0x9bf8('0x27')][_0x9bf8('0x45')][_0x9bf8('0x46')](',');var _0x616be={};_0x616be[_0x33599f[0x0]]={'$gte':moment(_0x33599f[0x1])[_0x9bf8('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x183e8c['where']=_['merge'](_0x183e8c[_0x9bf8('0x41')],_0x616be);}_0x183e8c=_[_0x9bf8('0x43')]({},_0x183e8c,_0x4fc18a[_0x9bf8('0x34')]);return db[_0x9bf8('0x3b')]['count']({'where':_0x183e8c[_0x9bf8('0x41')]})[_0x9bf8('0x1b')](function(_0x5bdf51){_0x3d92dc['count']=_0x5bdf51;if(_0x4fc18a['query'][_0x9bf8('0x48')]){_0x183e8c[_0x9bf8('0x33')]=[{'all':!![]}];}return db[_0x9bf8('0x3b')][_0x9bf8('0x49')](_0x183e8c);})[_0x9bf8('0x1b')](function(_0x3d536c){_0x3d92dc[_0x9bf8('0x4a')]=_0x3d536c;return _0x3d92dc;});}})[_0x9bf8('0x1b')](respondWithFilteredResult(_0x4576db,_0x183e8c))[_0x9bf8('0x29')](handleError(_0x4576db,null));};exports[_0x9bf8('0x4b')]=function(_0x2fd646,_0x7737a6){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2fd646[_0x9bf8('0x2c')]['id']}})[_0x9bf8('0x1b')](handleEntityNotFound(_0x7737a6,null))[_0x9bf8('0x1b')](function(_0x524656){if(_0x524656){return _0x524656['setTags'](_0x2fd646[_0x9bf8('0x37')][_0x9bf8('0x3a')],_[_0x9bf8('0x4c')](_0x2fd646[_0x9bf8('0x37')],[_0x9bf8('0x3a'),'id'])||{})[_0x9bf8('0x4d')](function(){return db['Tag'][_0x9bf8('0x49')]({'attributes':['id',_0x9bf8('0x1d'),_0x9bf8('0x4e')],'where':{'id':_0x2fd646[_0x9bf8('0x37')][_0x9bf8('0x3a')]}});})[_0x9bf8('0x1b')](function(_0x52af5f){socket[_0x9bf8('0x4f')](_0x9bf8('0x50'),{'id':Number(_0x2fd646['params']['id']),'tags':_0x52af5f||[]});return{'id':Number(_0x2fd646[_0x9bf8('0x2c')]['id']),'tags':_0x52af5f||[]};});}})[_0x9bf8('0x1b')](respondWithResult(_0x7737a6,null))['catch'](handleError(_0x7737a6,null));};exports['removeTags']=function(_0x174d2a,_0x37bbc3){return db[_0x9bf8('0x21')]['find']({'where':{'id':_0x174d2a[_0x9bf8('0x2c')]['id']}})[_0x9bf8('0x1b')](handleEntityNotFound(_0x37bbc3,null))[_0x9bf8('0x1b')](function(_0x5c6f94){if(_0x5c6f94){return _0x5c6f94[_0x9bf8('0x51')](_0x174d2a[_0x9bf8('0x27')][_0x9bf8('0x3a')]);}})['then'](respondWithStatusCode(_0x37bbc3,null))['catch'](handleError(_0x37bbc3,null));};exports[_0x9bf8('0x52')]=function(_0x30a230,_0x251b8f){var _0x42f8dc=moment()[_0x9bf8('0x53')]()['toString']();var _0x3945fb=path['join'](config[_0x9bf8('0x54')],_0x9bf8('0x55'),'files','tmp');var _0x266533=path['join'](config[_0x9bf8('0x54')],_0x9bf8('0x55'),'files',_0x9bf8('0x56'));var _0x14087e=path['join'](_0x3945fb,_0x42f8dc);var _0x373134=util[_0x9bf8('0x47')](_0x9bf8('0x57'),_0x30a230[_0x9bf8('0x2c')]['id'],_0x42f8dc);var _0x3082a9=path[_0x9bf8('0x58')](_0x3945fb,_0x373134);var _0x4102b0=[];_0x4102b0['push']({'model':db[_0x9bf8('0x59')],'as':_0x9bf8('0x59'),'attributes':['id',_0x9bf8('0x5a')],'raw':!![]});_0x4102b0[_0x9bf8('0x5b')]({'model':db[_0x9bf8('0x5c')],'as':_0x9bf8('0x5d'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x30a230['query']['attachments']){_0x4102b0[_0x9bf8('0x5b')]({'model':db[_0x9bf8('0x5e')],'as':_0x9bf8('0x5e'),'raw':!![]});}var _0x513527=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x9bf8('0x37'),_0x9bf8('0x5f'),'direction','secret',_0x9bf8('0x60')],'include':_0x4102b0}];_0x513527['push']({'model':db[_0x9bf8('0x61')],'as':'Account','attributes':['id',_0x9bf8('0x1d')]});_0x513527[_0x9bf8('0x5b')]({'model':db[_0x9bf8('0x59')],'as':'Owner','attributes':['id','fullname']});return db['OpenchannelInteraction']['find']({'where':{'id':_0x30a230[_0x9bf8('0x2c')]['id']},'include':_0x513527})['then'](handleEntityNotFound(_0x251b8f,null))['then'](function(_0x2a0747){if(_0x2a0747){var _0x1293c5=_0x2a0747[_0x9bf8('0x62')]({'plain':!![]});fs[_0x9bf8('0x63')](_0x14087e);var _0x57f1bc={'channel':_0x9bf8('0x64'),'account':_0x1293c5[_0x9bf8('0x65')][_0x9bf8('0x1d')],'agent':_0x1293c5['Owner']?_0x1293c5[_0x9bf8('0x66')][_0x9bf8('0x5a')]:_0x9bf8('0x67'),'createdAt':moment(_0x1293c5['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1293c5[_0x9bf8('0x68')]?moment(_0x1293c5[_0x9bf8('0x69')])[_0x9bf8('0x47')](_0x9bf8('0x6a'))[_0x9bf8('0x6b')]():'','disposition':_0x1293c5[_0x9bf8('0x6c')],'visibility':_0x1293c5['threadId']?'Public':_0x9bf8('0x6d'),'messages':_(_0x1293c5[_0x9bf8('0x6e')])[_0x9bf8('0x44')]({'secret':![]})['map'](function(_0x3cf7ee){if(_0x3cf7ee['Attachment']){var _0x20aa9d=path[_0x9bf8('0x58')](_0x266533,_0x3cf7ee[_0x9bf8('0x5e')]['basename']);if(fs[_0x9bf8('0x6f')](_0x20aa9d)){fs[_0x9bf8('0x70')](_0x20aa9d)[_0x9bf8('0x71')](fs['createWriteStream'](path[_0x9bf8('0x58')](_0x14087e,_0x3cf7ee[_0x9bf8('0x5e')][_0x9bf8('0x72')])));}}return{'date':moment(_0x3cf7ee[_0x9bf8('0x5f')])[_0x9bf8('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9bf8('0x6b')](),'sender':_0x3cf7ee[_0x9bf8('0x73')]===_0x9bf8('0x74')?_0x3cf7ee['User']?_0x3cf7ee[_0x9bf8('0x59')][_0x9bf8('0x5a')]:_0x9bf8('0x75'):_0x3cf7ee[_0x9bf8('0x5d')][_0x9bf8('0x76')]+(_0x3cf7ee['Contact'][_0x9bf8('0x77')]?'\x20'+_0x3cf7ee[_0x9bf8('0x5d')][_0x9bf8('0x77')]:''),'body':_0x3cf7ee['Attachment']?_0x3cf7ee[_0x9bf8('0x5e')][_0x9bf8('0x72')]:_0x3cf7ee[_0x9bf8('0x37')],'direction':_0x3cf7ee[_0x9bf8('0x73')]==='out'?'A':'C','secret':_0x3cf7ee['secret'],'read':_0x3cf7ee['read'],'attachment':_0x3cf7ee['Attachment']};})[_0x9bf8('0x78')]()};return ejs['renderFile'](path['join'](config[_0x9bf8('0x54')],_0x9bf8('0x55'),_0x9bf8('0x79'),_0x9bf8('0x7a')),{'interaction':_0x57f1bc})[_0x9bf8('0x1b')](function(_0x3a516d){var _0x588731=path[_0x9bf8('0x58')](_0x14087e,_0x9bf8('0x7b')+_0x1293c5['id']+'-'+_0x42f8dc+'.pdf');var _0x53ad0e={'path':_0x588731,'channel':_0x9bf8('0x64'),'interactionId':_0x1293c5['id']};return pdf[_0x9bf8('0x7c')](_0x3a516d,_0x53ad0e);})[_0x9bf8('0x1b')](function(){return new Promise(function(_0x1cc3e6,_0x547ec6){zipdir(_0x14087e,{'saveTo':_0x3082a9},function(_0x4e2ee8,_0xdda4aa){if(_0x4e2ee8)return _0x547ec6(_0x4e2ee8);return _0x1cc3e6(_0xdda4aa);});})[_0x9bf8('0x1b')](function(){return new Promise(function(_0x411982,_0x3bdbed){rimraf(_0x14087e,function(_0x304d67){if(_0x304d67)_0x3bdbed(_0x304d67);return _0x411982();});});})[_0x9bf8('0x1b')](function(){return _0x251b8f[_0x9bf8('0x52')](_0x3082a9,_0x373134,function(_0x63a019){if(_0x63a019){logger[_0x9bf8('0x1c')](_0x9bf8('0x7d'),_0x63a019);}else{fs['unlinkSync'](_0x3082a9);}});});});}else{return _0x251b8f[_0x9bf8('0xf')](0xc8);}})[_0x9bf8('0x29')](handleError(_0x251b8f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7128b62..1c6ff7d 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 _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 +var _0xc2b0=['setDataValue','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then'];(function(_0x3fda3,_0x28f527){var _0x59e823=function(_0x2b95ce){while(--_0x2b95ce){_0x3fda3['push'](_0x3fda3['shift']());}};_0x59e823(++_0x28f527);}(_0xc2b0,0x80));var _0x0c2b=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xc2b0[_0x68ee8b];return _0x5148f7;};'use strict';var EventEmitter=require(_0x0c2b('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x0c2b('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0c2b('0x2')](0x0);var events={'afterCreate':_0x0c2b('0x3'),'afterUpdate':'update','afterDestroy':_0x0c2b('0x4')};function emitEvent(_0x6a6aa9){return function(_0x403cb6,_0x52247c,_0x8aaeba){_0x403cb6[_0x0c2b('0x5')]({'attributes':['id'],'raw':!![]})[_0x0c2b('0x6')](function(_0xaf6431){_0x403cb6[_0x0c2b('0x7')]('Users',_0xaf6431[_0x0c2b('0x8')](function(_0x326abe){return{'id':_0x326abe['id']};}));return OpenchannelMessage[_0x0c2b('0x9')]({'where':{'OpenchannelInteractionId':_0x403cb6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0c2b('0x6')](function(_0x4400df){_0x403cb6['setDataValue']('unreadMessages',_0x4400df[_0x0c2b('0xa')]);OpenchannelInteractionEvents[_0x0c2b('0xb')](_0x6a6aa9+':'+_0x403cb6['id'],_0x403cb6);OpenchannelInteractionEvents[_0x0c2b('0xb')](_0x6a6aa9,_0x403cb6);_0x8aaeba(null);})[_0x0c2b('0xc')](_0x8aaeba(null));};}for(var e in events){if(events[_0x0c2b('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x0c2b('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 514048e..52e24a7 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 _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 +var _0x3423=['OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x5bea24,_0x2f0a27){var _0x49f0ab=function(_0x1d201e){while(--_0x1d201e){_0x5bea24['push'](_0x5bea24['shift']());}};_0x49f0ab(++_0x2f0a27);}(_0x3423,0x127));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3342('0x0'));var util=require(_0x3342('0x1'));var logger=require('../../config/logger')(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var rp=require(_0x3342('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x307e9f,_0xebafc4){return _0x307e9f[_0x3342('0x8')](_0x3342('0x9'),attributes,{'tableName':_0x3342('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3342('0xb'),'collate':_0x3342('0xc'),'hooks':{'beforeUpdate':function(_0x137079,_0x2b37c3,_0xbeee6f){if(_0x137079[_0x3342('0xd')]('closed')){_0x137079[_0x3342('0xe')]=moment()['format'](_0x3342('0xf'));}_0xbeee6f(null,_0x137079);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 71e5d02..2ff760f 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 _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 +var _0x2e6a=['AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','debug'];(function(_0x3caecd,_0x53e0b2){var _0x13961b=function(_0x428715){while(--_0x428715){_0x3caecd['push'](_0x3caecd['shift']());}};_0x13961b(++_0x53e0b2);}(_0x2e6a,0xfd));var _0xa2e6=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x2e6a[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xa2e6('0x0'));var util=require(_0xa2e6('0x1'));var moment=require(_0xa2e6('0x2'));var BPromise=require('bluebird');var rs=require(_0xa2e6('0x3'));var fs=require('fs');var Redis=require(_0xa2e6('0x4'));var db=require(_0xa2e6('0x5'))['db'];var utils=require(_0xa2e6('0x6'));var logger=require(_0xa2e6('0x7'))(_0xa2e6('0x8'));var config=require(_0xa2e6('0x9'));var jayson=require(_0xa2e6('0xa'));var client=jayson['client'][_0xa2e6('0xb')]({'port':0x232a});config[_0xa2e6('0xc')]=_[_0xa2e6('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa2e6('0xe'))(new Redis(config[_0xa2e6('0xc')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2e5a2b,_0x2696d4,_0x1c0629){return new BPromise(function(_0x15b345,_0xc9af92){return client[_0xa2e6('0xf')](_0x2e5a2b,_0x1c0629)[_0xa2e6('0x10')](function(_0x5aaaf2){logger['info'](_0xa2e6('0x11'),_0x2696d4,_0xa2e6('0x12'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2696d4,'request\x20sent',JSON[_0xa2e6('0x13')](_0x5aaaf2));if(_0x5aaaf2['error']){if(_0x5aaaf2[_0xa2e6('0x14')]['code']===0x1f4){logger[_0xa2e6('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2696d4,_0x5aaaf2['error']['message']);return _0xc9af92(_0x5aaaf2['error'][_0xa2e6('0x15')]);}logger[_0xa2e6('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2696d4,_0x5aaaf2[_0xa2e6('0x14')][_0xa2e6('0x15')]);return _0x15b345(_0x5aaaf2[_0xa2e6('0x14')]['message']);}else{logger[_0xa2e6('0x16')](_0xa2e6('0x11'),_0x2696d4,_0xa2e6('0x12'));_0x15b345(_0x5aaaf2[_0xa2e6('0x17')][_0xa2e6('0x15')]);}})[_0xa2e6('0x18')](function(_0x45809f){logger[_0xa2e6('0x14')](_0xa2e6('0x11'),_0x2696d4,_0x45809f);_0xc9af92(_0x45809f);});});}exports[_0xa2e6('0x19')]=function(_0x31bdb5){var _0x43d705=this;return new Promise(function(_0x73c35f,_0x559a8c){return db['OpenchannelInteraction'][_0xa2e6('0x1a')](_0x31bdb5[_0xa2e6('0x1b')],{'raw':_0x31bdb5[_0xa2e6('0x1c')]?_0x31bdb5['options'][_0xa2e6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31bdb5['options']?_0x31bdb5[_0xa2e6('0x1c')][_0xa2e6('0x1e')]||null:null,'attributes':_0x31bdb5[_0xa2e6('0x1c')]?_0x31bdb5[_0xa2e6('0x1c')][_0xa2e6('0x1f')]||null:null,'limit':_0x31bdb5[_0xa2e6('0x1c')]?_0x31bdb5['options'][_0xa2e6('0x20')]||null:null})[_0xa2e6('0x10')](function(_0x362bbe){logger[_0xa2e6('0x16')](_0xa2e6('0x19'),_0x31bdb5);logger[_0xa2e6('0x21')](_0xa2e6('0x19'),_0x31bdb5,JSON['stringify'](_0x362bbe));_0x73c35f(_0x362bbe);})[_0xa2e6('0x18')](function(_0x302b83){logger[_0xa2e6('0x14')](_0xa2e6('0x19'),_0x302b83[_0xa2e6('0x15')],_0x31bdb5);_0x559a8c(_0x43d705[_0xa2e6('0x14')](0x1f4,_0x302b83[_0xa2e6('0x15')]));});});};exports[_0xa2e6('0x22')]=function(_0x42ca1c){return new Promise(function(_0xa20e38,_0x24308f){return db[_0xa2e6('0x23')][_0xa2e6('0x24')]({'where':_0x42ca1c[_0xa2e6('0x1c')]?_0x42ca1c[_0xa2e6('0x1c')][_0xa2e6('0x1e')]||null:null})[_0xa2e6('0x10')](function(_0x20188b){if(_0x20188b){return _0x20188b[_0xa2e6('0x25')](_0x42ca1c['body'][_0xa2e6('0x26')],_['omit'](_0x42ca1c[_0xa2e6('0x1b')],[_0xa2e6('0x26'),'id'])||{});}})[_0xa2e6('0x27')](function(_0x1ebaf9){logger[_0xa2e6('0x16')](_0xa2e6('0x28'),_0x42ca1c);logger[_0xa2e6('0x21')](_0xa2e6('0x28'),_0x42ca1c,JSON[_0xa2e6('0x13')](_0x1ebaf9));_0xa20e38(_0x1ebaf9);})[_0xa2e6('0x18')](function(_0x18f4d2){logger[_0xa2e6('0x14')](_0xa2e6('0x28'),_0x18f4d2[_0xa2e6('0x15')],_0x42ca1c);_0x24308f(_this[_0xa2e6('0x14')](0x1f4,_0x18f4d2[_0xa2e6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 037b1a1..8912c88 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 _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 +var _0xb7d3=['emit','removeListener','register','length','openchannelInteraction:','save','update'];(function(_0xb6df6e,_0x5e3e7a){var _0x39dc4f=function(_0x3b8b6a){while(--_0x3b8b6a){_0xb6df6e['push'](_0xb6df6e['shift']());}};_0x39dc4f(++_0x5e3e7a);}(_0xb7d3,0x1b7));var _0x3b7d=function(_0x21065c,_0x23839c){_0x21065c=_0x21065c-0x0;var _0x3500c0=_0xb7d3[_0x21065c];return _0x3500c0;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x3b7d('0x0'),'remove',_0x3b7d('0x1')];function createListener(_0x5a13da,_0x21bba6){return function(_0x1550f6){_0x21bba6[_0x3b7d('0x2')](_0x5a13da,_0x1550f6);};}function removeListener(_0xf6f60f,_0x38182c){return function(){OpenchannelInteractionEvents[_0x3b7d('0x3')](_0xf6f60f,_0x38182c);};}exports[_0x3b7d('0x4')]=function(_0x18da98){for(var _0x46ab6f=0x0,_0x21afc1=events[_0x3b7d('0x5')];_0x46ab6f<_0x21afc1;_0x46ab6f++){var _0x1faf52=events[_0x46ab6f];var _0x456d33=createListener(_0x3b7d('0x6')+_0x1faf52,_0x18da98);OpenchannelInteractionEvents['on'](_0x1faf52,_0x456d33);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 0f4338a..612cb78 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_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 +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(_0xd38a8a,_0x303834){var _0xdb71fc=function(_0x1c3c06){while(--_0x1c3c06){_0xd38a8a['push'](_0xd38a8a['shift']());}};_0xdb71fc(++_0x303834);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index f3347e2..3b4acb6 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 _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 +var _0x777d=['TEXT','medium','BOOLEAN','ENUM','STRING','exports'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x777d,0xe9));var _0xd777=function(_0x2ad1b8,_0x1ea09b){_0x2ad1b8=_0x2ad1b8-0x0;var _0x52547d=_0x777d[_0x2ad1b8];return _0x52547d;};'use strict';var Sequelize=require('sequelize');module[_0xd777('0x0')]={'body':{'type':Sequelize[_0xd777('0x1')](_0xd777('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd777('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd777('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xd777('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index a336107..547a0b1 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 _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 +var _0x662a=['pick','options','includeAll','findAll','rows','show','params','keys','include','merge','find','body','destroy','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','reject','save','update','then','name','index','map','OpenchannelMessage','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1fdc70,_0x3ae40e){var _0x30328c=function(_0x2edb35){while(--_0x2edb35){_0x1fdc70['push'](_0x1fdc70['shift']());}};_0x30328c(++_0x3ae40e);}(_0x662a,0xae));var _0xa662=function(_0x57bb3d,_0x994b5a){_0x57bb3d=_0x57bb3d-0x0;var _0x5b0497=_0x662a[_0x57bb3d];return _0x5b0497;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa662('0x0'));var zipdir=require(_0xa662('0x1'));var jsonpatch=require(_0xa662('0x2'));var rp=require(_0xa662('0x3'));var moment=require('moment');var BPromise=require(_0xa662('0x4'));var Mustache=require(_0xa662('0x5'));var util=require(_0xa662('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa662('0x7'));var ejs=require(_0xa662('0x8'));var fs=require('fs');var fs_extra=require(_0xa662('0x9'));var _=require(_0xa662('0xa'));var squel=require(_0xa662('0xb'));var crypto=require(_0xa662('0xc'));var jsforce=require(_0xa662('0xd'));var deskjs=require(_0xa662('0xe'));var toCsv=require(_0xa662('0x7'));var querystring=require('querystring');var Papa=require(_0xa662('0xf'));var Redis=require('ioredis');var authService=require(_0xa662('0x10'));var qs=require(_0xa662('0x11'));var as=require(_0xa662('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa662('0x13'))(_0xa662('0x14'));var utils=require('../../config/utils');var config=require(_0xa662('0x15'));var licenseUtil=require(_0xa662('0x16'));var db=require(_0xa662('0x17'))['db'];config[_0xa662('0x18')]=_[_0xa662('0x19')](config[_0xa662('0x18')],{'host':_0xa662('0x1a'),'port':0x18eb});var socket=require(_0xa662('0x1b'))(new Redis(config['redis']));require(_0xa662('0x1c'))[_0xa662('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa662('0x1e')][_0xa662('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xa662('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x22516f,_0x1cd9cd,_0xb511bb,_0x46ca3a){return new BPromise(function(_0x3b8d8c,_0x4d806b){var _0x121f86=_0x46ca3a||client;return _0x121f86[_0xa662('0x20')](_0x22516f,_0xb511bb)['then'](function(_0x1a53a7){logger[_0xa662('0x21')](_0xa662('0x22'),_0x1cd9cd,_0xa662('0x23'));logger['debug'](_0xa662('0x24'),_0x1cd9cd,_0xa662('0x23'),JSON[_0xa662('0x25')](_0x1a53a7));if(_0x1a53a7[_0xa662('0x26')]){if(_0x1a53a7[_0xa662('0x26')][_0xa662('0x27')]===0x1f4){logger[_0xa662('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x1cd9cd,_0x1a53a7['error'][_0xa662('0x28')]);return _0x4d806b(_0x1a53a7['error'][_0xa662('0x28')]);}logger['error'](_0xa662('0x22'),_0x1cd9cd,_0x1a53a7['error']['message']);return _0x3b8d8c(_0x1a53a7[_0xa662('0x26')]['message']);}else{logger[_0xa662('0x21')](_0xa662('0x22'),_0x1cd9cd,'request\x20sent');_0x3b8d8c(_0x1a53a7['result'][_0xa662('0x28')]);}})[_0xa662('0x29')](function(_0x406699){logger[_0xa662('0x26')](_0xa662('0x22'),_0x1cd9cd,_0x406699);_0x4d806b(_0x406699);});});}function respondWithStatusCode(_0x531c4f,_0x4da8ea){_0x4da8ea=_0x4da8ea||0xcc;return function(_0x37369d){if(_0x37369d){return _0x531c4f['sendStatus'](_0x4da8ea);}return _0x531c4f[_0xa662('0x2a')](_0x4da8ea)[_0xa662('0x2b')]();};}function respondWithResult(_0x1e133d,_0x507e06){_0x507e06=_0x507e06||0xc8;return function(_0x405c24){if(_0x405c24){return _0x1e133d[_0xa662('0x2a')](_0x507e06)[_0xa662('0x2c')](_0x405c24);}};}function respondWithFilteredResult(_0x4c45cc,_0x4299fd){return function(_0x10a0e6){if(_0x10a0e6){var _0x1dc05b=typeof _0x4299fd[_0xa662('0x2d')]===_0xa662('0x2e')&&typeof _0x4299fd[_0xa662('0x2f')]===_0xa662('0x2e');var _0x34b89f=_0x10a0e6[_0xa662('0x30')];var _0x190185=_0x1dc05b?0x0:_0x4299fd[_0xa662('0x2d')];var _0x2b2996=_0x1dc05b?_0x10a0e6[_0xa662('0x30')]:_0x4299fd[_0xa662('0x2d')]+_0x4299fd[_0xa662('0x2f')];var _0x4dfe1a;if(_0x2b2996>=_0x34b89f){_0x2b2996=_0x34b89f;_0x4dfe1a=0xc8;}else{_0x4dfe1a=0xce;}_0x4c45cc[_0xa662('0x2a')](_0x4dfe1a);return _0x4c45cc['set']('Content-Range',_0x190185+'-'+_0x2b2996+'/'+_0x34b89f)['json'](_0x10a0e6);}return null;};}function patchUpdates(_0x374392){return function(_0x3d7eb3){try{jsonpatch['apply'](_0x3d7eb3,_0x374392,!![]);}catch(_0xcd096b){return BPromise[_0xa662('0x31')](_0xcd096b);}return _0x3d7eb3[_0xa662('0x32')]();};}function saveUpdates(_0x5e57a7,_0x4feead){return function(_0x29c298){if(_0x29c298){return _0x29c298[_0xa662('0x33')](_0x5e57a7)[_0xa662('0x34')](function(_0x2a446b){return _0x2a446b;});}return null;};}function removeEntity(_0x582316,_0x247cef){return function(_0x547704){if(_0x547704){return _0x547704['destroy']()['then'](function(){_0x582316[_0xa662('0x2a')](0xcc)[_0xa662('0x2b')]();});}};}function handleEntityNotFound(_0x5591c5,_0x3efb01){return function(_0xd29448){if(!_0xd29448){_0x5591c5['sendStatus'](0x194);}return _0xd29448;};}function handleError(_0x4ae624,_0x2268d7){_0x2268d7=_0x2268d7||0x1f4;return function(_0x3e8359){logger[_0xa662('0x26')](_0x3e8359['stack']);if(_0x3e8359[_0xa662('0x35')]){delete _0x3e8359[_0xa662('0x35')];}_0x4ae624['status'](_0x2268d7)['send'](_0x3e8359);};}exports[_0xa662('0x36')]=function(_0x1b3329,_0x562379){var _0x54b3d4={},_0x2eaa4f={},_0x285894={'count':0x0,'rows':[]};var _0x18a1cf=_[_0xa662('0x37')](db[_0xa662('0x38')]['rawAttributes'],function(_0x5c640e){return{'name':_0x5c640e['fieldName'],'type':_0x5c640e[_0xa662('0x39')]['key']};});_0x2eaa4f[_0xa662('0x3a')]=_['map'](_0x18a1cf,_0xa662('0x35'));_0x2eaa4f['query']=_['keys'](_0x1b3329[_0xa662('0x3b')]);_0x2eaa4f[_0xa662('0x3c')]=_[_0xa662('0x3d')](_0x2eaa4f[_0xa662('0x3a')],_0x2eaa4f[_0xa662('0x3b')]);_0x54b3d4[_0xa662('0x3e')]=_[_0xa662('0x3d')](_0x2eaa4f['model'],qs[_0xa662('0x3f')](_0x1b3329[_0xa662('0x3b')]['fields']));_0x54b3d4[_0xa662('0x3e')]=_0x54b3d4[_0xa662('0x3e')][_0xa662('0x40')]?_0x54b3d4[_0xa662('0x3e')]:_0x2eaa4f['model'];if(!_0x1b3329[_0xa662('0x3b')][_0xa662('0x41')](_0xa662('0x42'))){_0x54b3d4[_0xa662('0x2f')]=qs[_0xa662('0x2f')](_0x1b3329[_0xa662('0x3b')][_0xa662('0x2f')]);_0x54b3d4[_0xa662('0x2d')]=qs[_0xa662('0x2d')](_0x1b3329[_0xa662('0x3b')]['offset']);}_0x54b3d4[_0xa662('0x43')]=qs[_0xa662('0x44')](_0x1b3329['query'][_0xa662('0x44')]);_0x54b3d4[_0xa662('0x45')]=qs[_0xa662('0x3c')](_[_0xa662('0x46')](_0x1b3329[_0xa662('0x3b')],_0x2eaa4f[_0xa662('0x3c')]),_0x18a1cf);if(_0x1b3329['query']['filter']){_0x54b3d4[_0xa662('0x45')]=_['merge'](_0x54b3d4[_0xa662('0x45')],{'$or':_[_0xa662('0x37')](_0x18a1cf,function(_0x5eabb5){if(_0x5eabb5[_0xa662('0x39')]!=='VIRTUAL'){var _0x20c358={};_0x20c358[_0x5eabb5[_0xa662('0x35')]]={'$like':'%'+_0x1b3329[_0xa662('0x3b')]['filter']+'%'};return _0x20c358;}})});}_0x54b3d4=_['merge']({},_0x54b3d4,_0x1b3329[_0xa662('0x47')]);var _0x11b387={'where':_0x54b3d4[_0xa662('0x45')]};return db['OpenchannelMessage']['count'](_0x11b387)[_0xa662('0x34')](function(_0x243ba4){_0x285894[_0xa662('0x30')]=_0x243ba4;if(_0x1b3329['query'][_0xa662('0x48')]){_0x54b3d4['include']=[{'all':!![]}];}return db[_0xa662('0x38')][_0xa662('0x49')](_0x54b3d4);})[_0xa662('0x34')](function(_0x47ad86){_0x285894[_0xa662('0x4a')]=_0x47ad86;return _0x285894;})[_0xa662('0x34')](respondWithFilteredResult(_0x562379,_0x54b3d4))[_0xa662('0x29')](handleError(_0x562379,null));};exports[_0xa662('0x4b')]=function(_0x2f0ddb,_0x187ce8){var _0x587d81={'raw':!![],'where':{'id':_0x2f0ddb[_0xa662('0x4c')]['id']}},_0x211b42={};_0x211b42[_0xa662('0x3a')]=_[_0xa662('0x4d')](db[_0xa662('0x38')]['rawAttributes']);_0x211b42['query']=_[_0xa662('0x4d')](_0x2f0ddb[_0xa662('0x3b')]);_0x211b42[_0xa662('0x3c')]=_[_0xa662('0x3d')](_0x211b42[_0xa662('0x3a')],_0x211b42[_0xa662('0x3b')]);_0x587d81[_0xa662('0x3e')]=_['intersection'](_0x211b42[_0xa662('0x3a')],qs['fields'](_0x2f0ddb[_0xa662('0x3b')][_0xa662('0x3f')]));_0x587d81[_0xa662('0x3e')]=_0x587d81[_0xa662('0x3e')][_0xa662('0x40')]?_0x587d81[_0xa662('0x3e')]:_0x211b42[_0xa662('0x3a')];if(_0x2f0ddb[_0xa662('0x3b')][_0xa662('0x48')]){_0x587d81[_0xa662('0x4e')]=[{'all':!![]}];}_0x587d81=_[_0xa662('0x4f')]({},_0x587d81,_0x2f0ddb[_0xa662('0x47')]);return db[_0xa662('0x38')][_0xa662('0x50')](_0x587d81)[_0xa662('0x34')](handleEntityNotFound(_0x187ce8,null))[_0xa662('0x34')](respondWithResult(_0x187ce8,null))[_0xa662('0x29')](handleError(_0x187ce8,null));};exports['create']=function(_0xa3bfb9,_0x362980){return db['OpenchannelMessage']['create'](_0xa3bfb9[_0xa662('0x51')],{})[_0xa662('0x34')](respondWithResult(_0x362980,0xc9))[_0xa662('0x29')](handleError(_0x362980,null));};exports[_0xa662('0x33')]=function(_0x229066,_0x16fb07){if(_0x229066[_0xa662('0x51')]['id']){delete _0x229066[_0xa662('0x51')]['id'];}return db[_0xa662('0x38')][_0xa662('0x50')]({'where':{'id':_0x229066[_0xa662('0x4c')]['id']}})[_0xa662('0x34')](handleEntityNotFound(_0x16fb07,null))[_0xa662('0x34')](saveUpdates(_0x229066[_0xa662('0x51')],null))['then'](respondWithResult(_0x16fb07,null))[_0xa662('0x29')](handleError(_0x16fb07,null));};exports[_0xa662('0x52')]=function(_0x188a29,_0x357b18){return db[_0xa662('0x38')][_0xa662('0x50')]({'where':{'id':_0x188a29[_0xa662('0x4c')]['id']}})[_0xa662('0x34')](handleEntityNotFound(_0x357b18,null))[_0xa662('0x34')](removeEntity(_0x357b18,null))[_0xa662('0x29')](handleError(_0x357b18,null));};exports['describe']=function(_0x5e78b8,_0x5645d6){return db[_0xa662('0x38')]['describe']()[_0xa662('0x34')](respondWithResult(_0x5645d6,null))[_0xa662('0x29')](handleError(_0x5645d6,null));};var interaction_log=require(_0xa662('0x13'))('openchannel-interactions');exports['accept']=function(_0x4487a6,_0x5eabd5,_0x26808c){var _0x537e5a={'agent':{},'channel':'openchannel'};if(_0x4487a6[_0xa662('0x51')]['id']){delete _0x4487a6['body']['id'];}_0x4487a6[_0xa662('0x51')][_0xa662('0x53')]=!![];_0x4487a6['body']['readAt']=moment()[_0xa662('0x54')](_0xa662('0x55'));_0x4487a6[_0xa662('0x51')][_0xa662('0x56')]=_0x4487a6[_0xa662('0x51')][_0xa662('0x56')]||_0x4487a6[_0xa662('0x57')]['id'];_0x537e5a[_0xa662('0x58')]['id']=_0x4487a6[_0xa662('0x51')][_0xa662('0x56')];return db[_0xa662('0x38')][_0xa662('0x50')]({'where':{'id':_0x4487a6[_0xa662('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5eabd5,null))[_0xa662('0x34')](saveUpdates(_0x4487a6[_0xa662('0x51')],null))[_0xa662('0x34')](function(_0x12230e){if(_0x12230e){_0x537e5a[_0xa662('0x28')]=_0x12230e[_0xa662('0x59')]({'plain':!![]});return db[_0xa662('0x5a')][_0xa662('0x50')]({'where':{'id':_0x12230e[_0xa662('0x5b')]}});}return null;})['then'](handleEntityNotFound(_0x5eabd5,null))[_0xa662('0x34')](function(_0x1eefc8){if(_0x1eefc8){return _0x1eefc8['update']({'UserId':_0x4487a6[_0xa662('0x51')][_0xa662('0x56')],'read1stAt':_[_0xa662('0x5c')](_0x1eefc8[_0xa662('0x5d')])?moment()[_0xa662('0x54')](_0xa662('0x55')):undefined});}return null;})[_0xa662('0x34')](function(_0x3a1024){if(_0x3a1024){_0x537e5a[_0xa662('0x5e')]=_0x3a1024[_0xa662('0x59')]({'plain':!![]});interaction_log[_0xa662('0x21')](_0xa662('0x5f'),_0x4487a6[_0xa662('0x57')]['id'],_0x4487a6[_0xa662('0x57')][_0xa662('0x35')],_0x4487a6['user'][_0xa662('0x60')],_0x537e5a[_0xa662('0x5e')]['id'],_0x4487a6[_0xa662('0x51')]?JSON[_0xa662('0x25')](_0x4487a6[_0xa662('0x51')]):_0xa662('0x61'));return respondWithRpcPromise('AcceptMessage',_0xa662('0x62'),_0x537e5a);}return null;})['then'](function(_0x2b43ec){var _0x5b1231='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b43ec['message'][_0xa662('0x63')];return db[_0xa662('0x64')]['query'](_0x5b1231,{'type':db[_0xa662('0x65')][_0xa662('0x66')][_0xa662('0x67')],'raw':!![]})[_0xa662('0x34')](function(_0x1b0778){return _0x1b0778;});})[_0xa662('0x34')](function(_0x32ed1c){if(_0x32ed1c){_0x537e5a[_0xa662('0x28')][_0xa662('0x68')]=_0x32ed1c[0x0];if(!_0x4487a6[_0xa662('0x51')][_0xa662('0x56')])return;return db[_0xa662('0x69')][_0xa662('0x50')]({'where':{'id':_0x4487a6[_0xa662('0x51')][_0xa662('0x56')],'role':_0xa662('0x58')},'attributes':['id','name',_0xa662('0x6a'),_0xa662('0x6b'),_0xa662('0x6c')],'raw':!![]});}return null;})[_0xa662('0x34')](function(_0x29102b){if(!_0x29102b)return null;_0x537e5a['message'][_0xa662('0x58')]=_0x29102b;return _0x537e5a;})[_0xa662('0x34')](function(_0xc25de5){if(_0xc25de5){if(_0x4487a6[_0xa662('0x51')][_0xa662('0x6d')]){_0x537e5a['message'][_0xa662('0x6e')]=util[_0xa662('0x54')]('SIP/%s',_0x4487a6[_0xa662('0x57')][_0xa662('0x35')]);_0x537e5a[_0xa662('0x28')][_0xa662('0x6f')]=_0x537e5a['channel'];_0x537e5a[_0xa662('0x28')][_0xa662('0x70')]=_0x537e5a[_0xa662('0x6f')];_0x537e5a[_0xa662('0x28')][_0xa662('0x71')]=_0xa662('0x72');return respondWithRpcPromise(_0xa662('0x73'),_0xa662('0x73'),{'event':_0xa662('0x74'),'message':_0x537e5a[_0xa662('0x28')]},client9002)[_0xa662('0x34')](function(){return _0x537e5a;});}return _0x537e5a;}return null;})[_0xa662('0x34')](respondWithResult(_0x5eabd5,null))['catch'](handleError(_0x5eabd5,null));};var interaction_log=require('../../config/logger')(_0xa662('0x75'));exports[_0xa662('0x31')]=function(_0xf6bb79,_0x4ebddb,_0x5c4469){var _0x2398fd={'agent':{},'channel':'openchannel'};if(_0xf6bb79['body']['id']){delete _0xf6bb79[_0xa662('0x51')]['id'];}_0xf6bb79[_0xa662('0x51')][_0xa662('0x56')]=_0xf6bb79[_0xa662('0x51')][_0xa662('0x56')]||_0xf6bb79[_0xa662('0x57')]['id'];_0x2398fd['agent']['id']=_0xf6bb79[_0xa662('0x51')]['UserId'];return db[_0xa662('0x38')]['find']({'where':{'id':_0xf6bb79['params']['id'],'UserId':null}})[_0xa662('0x34')](handleEntityNotFound(_0x4ebddb,null))[_0xa662('0x34')](function(_0x2f4215){if(_0x2f4215){_0x2398fd[_0xa662('0x28')]=_0x2f4215[_0xa662('0x59')]({'plain':!![]});return db[_0xa662('0x5a')]['find']({'where':{'id':_0x2f4215['OpenchannelInteractionId']}});}return null;})[_0xa662('0x34')](handleEntityNotFound(_0x4ebddb,null))[_0xa662('0x34')](function(_0x17f935){if(_0x17f935){_0x2398fd[_0xa662('0x5e')]=_0x17f935[_0xa662('0x59')]({'plain':!![]});interaction_log[_0xa662('0x21')](_0xa662('0x76'),_0xf6bb79[_0xa662('0x57')]['id'],_0xf6bb79['user']['name'],_0xf6bb79['user'][_0xa662('0x60')],_0x2398fd[_0xa662('0x5e')]['id'],_0xf6bb79[_0xa662('0x51')]?JSON[_0xa662('0x25')](_0xf6bb79[_0xa662('0x51')]):'null');return respondWithRpcPromise('RejectMessage',_0xa662('0x77'),_0x2398fd);}return null;})[_0xa662('0x34')](function(_0x413026){var _0x4bf9db='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x413026[_0xa662('0x28')]['ContactId'];return db['sequelize']['query'](_0x4bf9db,{'type':db[_0xa662('0x65')][_0xa662('0x66')][_0xa662('0x67')],'raw':!![]})[_0xa662('0x34')](function(_0x2eec0a){return _0x2eec0a;});})[_0xa662('0x34')](function(_0x3e5764){if(_0x3e5764){_0x2398fd[_0xa662('0x28')]['contact']=_0x3e5764[0x0];if(!_0xf6bb79[_0xa662('0x51')][_0xa662('0x56')])return;return db[_0xa662('0x69')]['find']({'where':{'id':_0xf6bb79[_0xa662('0x51')][_0xa662('0x56')],'role':_0xa662('0x58')},'attributes':['id',_0xa662('0x35'),_0xa662('0x6a'),_0xa662('0x6b'),_0xa662('0x6c')],'raw':!![]});}return null;})[_0xa662('0x34')](function(_0x329781){if(!_0x329781)return null;_0x2398fd['message'][_0xa662('0x58')]=_0x329781;return _0x2398fd;})[_0xa662('0x34')](function(_0x11a98f){if(_0x11a98f){_0x11a98f['message'][_0xa662('0x6e')]=util['format'](_0xa662('0x78'),_0xf6bb79['user'][_0xa662('0x35')]);_0x11a98f[_0xa662('0x28')][_0xa662('0x6f')]=_0x2398fd['channel'];_0x11a98f[_0xa662('0x28')][_0xa662('0x70')]=_0x2398fd['channel'];_0x11a98f[_0xa662('0x28')][_0xa662('0x71')]=_0xa662('0x31');respondWithRpcPromise(_0xa662('0x73'),'EventManager',{'event':_0xa662('0x79'),'message':_0x11a98f['message']},client9002);return _0x2398fd;}return null;})[_0xa662('0x34')](respondWithResult(_0x4ebddb,null))[_0xa662('0x29')](handleError(_0x4ebddb,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 831c233..e6a6402 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 _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 +var _0xfcf6=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2aa018,_0x57caab){var _0x1363f4=function(_0x1a33b6){while(--_0x1a33b6){_0x2aa018['push'](_0x2aa018['shift']());}};_0x1363f4(++_0x57caab);}(_0xfcf6,0x77));var _0x6fcf=function(_0x3e1fd6,_0x4b4d3f){_0x3e1fd6=_0x3e1fd6-0x0;var _0x340a20=_0xfcf6[_0x3e1fd6];return _0x340a20;};'use strict';var EventEmitter=require(_0x6fcf('0x0'));var OpenchannelMessage=require(_0x6fcf('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6fcf('0x2')](0x0);var events={'afterCreate':_0x6fcf('0x3'),'afterUpdate':_0x6fcf('0x4'),'afterDestroy':_0x6fcf('0x5')};function emitEvent(_0x2011e4){return function(_0x5bcb0b,_0x294481,_0x491ca5){OpenchannelMessageEvents['emit'](_0x2011e4+':'+_0x5bcb0b['id'],_0x5bcb0b);OpenchannelMessageEvents[_0x6fcf('0x6')](_0x2011e4,_0x5bcb0b);_0x491ca5(null);};}for(var e in events){if(events[_0x6fcf('0x7')](e)){var event=events[e];OpenchannelMessage[_0x6fcf('0x8')](e,emitEvent(event));}}module[_0x6fcf('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 2f25a68..928d27a 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 _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 +var _0x41d1=['FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','Contact','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','body'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x41d1,0x90));var _0x141d=function(_0x152ea8,_0x3fb53f){_0x152ea8=_0x152ea8-0x0;var _0x4c0ebe=_0x41d1[_0x152ea8];return _0x4c0ebe;};'use strict';var _=require(_0x141d('0x0'));var util=require(_0x141d('0x1'));var logger=require('../../config/logger')(_0x141d('0x2'));var moment=require(_0x141d('0x3'));var BPromise=require('bluebird');var rp=require(_0x141d('0x4'));var fs=require('fs');var path=require(_0x141d('0x5'));var rimraf=require('rimraf');var config=require(_0x141d('0x6'));var attributes=require(_0x141d('0x7'));module['exports']=function(_0x5e97d8,_0x5ba6dc){return _0x5e97d8[_0x141d('0x8')](_0x141d('0x9'),attributes,{'tableName':_0x141d('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x141d('0xb')],'type':_0x141d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb3dcac,_0x141320,_0x4d3375){var _0x2af953=_0x5e97d8[_0x141d('0xd')];var _0x34ffcf=_0xb3dcac[_0x141d('0xe')]({'plain':!![]});if(_0x34ffcf[_0x141d('0xf')]['toLowerCase']()==='in'||_0x34ffcf[_0x141d('0xf')][_0x141d('0x10')]()===_0x141d('0x11')&&!_0x34ffcf[_0x141d('0x12')]&&!_[_0x141d('0x13')](_0x34ffcf['UserId'])){_0x2af953[_0x141d('0x14')][_0x141d('0x15')]({'where':{'id':_0x34ffcf[_0x141d('0x16')]}})['then'](function(_0x49b434){if(_0x49b434){_0x49b434[_0x141d('0x17')]({'lastMsgAt':_0x34ffcf[_0x141d('0x18')],'lastMsgDirection':_0x34ffcf['direction'][_0x141d('0x10')]()});}})[_0x141d('0x19')](function(_0x16d178){console[_0x141d('0x1a')](_0x16d178);});}if(_0x34ffcf['direction']===_0x141d('0x11')&&!_0x34ffcf['secret']){var _0x389ce3;_0x2af953[_0x141d('0x1b')][_0x141d('0x1c')]()[_0x141d('0x1d')](function(_0x360c4e){return _0x2af953[_0x141d('0x1e')][_0x141d('0x1f')]({'where':{'id':_0x34ffcf[_0x141d('0x20')]},'include':[{'model':_0x2af953[_0x141d('0x14')],'as':'Interactions','where':{'id':_0x34ffcf[_0x141d('0x16')]},'limit':0x1,'include':[{'model':_0x2af953['CmContact'],'as':'Contact','attributes':_[_0x141d('0x21')](_0x360c4e)}]}]});})[_0x141d('0x1d')](function(_0x58f7f6){_0x389ce3=_0x58f7f6[_0x141d('0xe')]({'plain':!![]});if(_0x389ce3&&_0x389ce3[_0x141d('0x22')]){logger[_0x141d('0x23')](_0x141d('0x24'),_0x141d('0x25'),util[_0x141d('0x26')](_0x141d('0x27'),_0x34ffcf['id'],_0x389ce3[_0x141d('0x22')]));if(_0x389ce3[_0x141d('0x28')]&&_0x389ce3[_0x141d('0x28')][_0x141d('0x29')]){_0x34ffcf[_0x141d('0x2a')]=_['omit'](_0x389ce3['Interactions'][0x0],_0x141d('0x2b'));_0x34ffcf['Contact']=_0x389ce3[_0x141d('0x28')][0x0]['Contact'];}var _0x141320={'method':'POST','uri':encodeURI(_0x389ce3[_0x141d('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x141320['method']){case _0x141d('0x2c'):_0x141320['qs']=_0x34ffcf;break;case _0x141d('0x2d'):_0x141320[_0x141d('0xb')]=_0x34ffcf;break;}return rp(_0x141320)['then'](function(_0x11f1fa){logger[_0x141d('0x23')](_0x141d('0x24'),_0x141d('0x25'),util['format'](_0x141d('0x2e'),_0x34ffcf['id'],_0x389ce3[_0x141d('0x22')]));if(_0x11f1fa[_0x141d('0xb')][_0x141d('0x2f')]&&_0x11f1fa['body']['threadId']!=_0x34ffcf[_0x141d('0x2a')][_0x141d('0x2f')]){return _0x2af953[_0x141d('0x14')][_0x141d('0x17')]({'threadId':_0x11f1fa[_0x141d('0xb')][_0x141d('0x2f')]},{'where':{'id':_0x34ffcf[_0x141d('0x2a')]['id']}});}else{return;}})['then'](function(){return _0xb3dcac[_0x141d('0x17')]({'read':!![]});})[_0x141d('0x19')](function(_0x2a316f){logger[_0x141d('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x141d('0x25'),util[_0x141d('0x30')](_0x2a316f,{'showHidden':![],'depth':null}));_0x4d3375();});}else{_0x4d3375();}})[_0x141d('0x31')](function(){_0x4d3375();});}else{_0x4d3375();}}},'charset':_0x141d('0x32'),'collate':_0x141d('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8d14df0..d91eabb 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_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 +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x37e742,_0x3bad29){var _0x595965=function(_0x5d7f5f){while(--_0x5d7f5f){_0x37e742['push'](_0x37e742['shift']());}};_0x595965(++_0x3bad29);}(_0x1261,0x144));var _0x1126=function(_0x34f8ba,_0x2bb6a8){_0x34f8ba=_0x34f8ba-0x0;var _0xa5ed05=_0x1261[_0x34f8ba];return _0xa5ed05;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 855879a..8bc6b1b 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 _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 +var _0x475e=['openchannelMessage:','./openchannelMessage.events','emit','removeListener','register','length'];(function(_0x4309d9,_0x5b0b57){var _0x1af166=function(_0x20d871){while(--_0x20d871){_0x4309d9['push'](_0x4309d9['shift']());}};_0x1af166(++_0x5b0b57);}(_0x475e,0x8b));var _0xe475=function(_0x4c0573,_0x234938){_0x4c0573=_0x4c0573-0x0;var _0xcd1707=_0x475e[_0x4c0573];return _0xcd1707;};'use strict';var OpenchannelMessageEvents=require(_0xe475('0x0'));var events=['save','remove','update'];function createListener(_0x129291,_0x490249){return function(_0x11bc3b){_0x490249[_0xe475('0x1')](_0x129291,_0x11bc3b);};}function removeListener(_0x164f02,_0x2dfec4){return function(){OpenchannelMessageEvents[_0xe475('0x2')](_0x164f02,_0x2dfec4);};}exports[_0xe475('0x3')]=function(_0x308359){for(var _0x4a6517=0x0,_0x15b08b=events[_0xe475('0x4')];_0x4a6517<_0x15b08b;_0x4a6517++){var _0x5c9c70=events[_0x4a6517];var _0x3be177=createListener(_0xe475('0x5')+_0x5c9c70,_0x308359);OpenchannelMessageEvents['on'](_0x5c9c70,_0x3be177);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 526321b..488da00 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 _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 +var _0x995a=['../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','update','destroy','delete','removeTeams','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x7d48be,_0x18a3a3){var _0x1bd822=function(_0x2587f8){while(--_0x2587f8){_0x7d48be['push'](_0x7d48be['shift']());}};_0x1bd822(++_0x18a3a3);}(_0x995a,0x1ef));var _0xa995=function(_0x13f379,_0x5e7415){_0x13f379=_0x13f379-0x0;var _0x2bc237=_0x995a[_0x13f379];return _0x2bc237;};'use strict';var multer=require('multer');var util=require(_0xa995('0x0'));var path=require(_0xa995('0x1'));var timeout=require(_0xa995('0x2'));var express=require('express');var router=express[_0xa995('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa995('0x4'));var interaction=require(_0xa995('0x5'));var config=require('../../config/environment');var controller=require(_0xa995('0x6'));router[_0xa995('0x7')]('/',auth[_0xa995('0x8')](),controller[_0xa995('0x9')]);router[_0xa995('0x7')](_0xa995('0xa'),auth['isAuthenticated'](),controller[_0xa995('0xb')]);router[_0xa995('0x7')](_0xa995('0xc'),auth[_0xa995('0x8')](),controller[_0xa995('0xd')]);router['get'](_0xa995('0xe'),auth[_0xa995('0x8')](),controller[_0xa995('0xf')]);router[_0xa995('0x7')](_0xa995('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0xa995('0x7')](_0xa995('0x11'),auth[_0xa995('0x8')](),controller[_0xa995('0x12')]);router[_0xa995('0x13')]('/',auth['isAuthenticated'](),controller[_0xa995('0x14')]);router[_0xa995('0x13')](_0xa995('0x10'),auth[_0xa995('0x8')](),controller['addTeams']);router[_0xa995('0x13')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xa995('0xc'),auth[_0xa995('0x8')](),controller[_0xa995('0x15')]);router['delete'](_0xa995('0xc'),auth['isAuthenticated'](),controller[_0xa995('0x16')]);router[_0xa995('0x17')]('/:id/teams',auth[_0xa995('0x8')](),controller[_0xa995('0x18')]);router[_0xa995('0x17')](_0xa995('0x11'),auth[_0xa995('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ed7b61a..9673f06 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 _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 +var _0xce11=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x51ce35,_0x2b333a){var _0x2a60cf=function(_0x883508){while(--_0x883508){_0x51ce35['push'](_0x51ce35['shift']());}};_0x2a60cf(++_0x2b333a);}(_0xce11,0xf0));var _0x1ce1=function(_0x1db7ec,_0x55f012){_0x1db7ec=_0x1db7ec-0x0;var _0x4632a6=_0xce11[_0x1db7ec];return _0x4632a6;};'use strict';var Sequelize=require(_0x1ce1('0x0'));module[_0x1ce1('0x1')]={'name':{'type':Sequelize[_0x1ce1('0x2')],'unique':_0x1ce1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1ce1('0x2')]},'timeout':{'type':Sequelize[_0x1ce1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1ce1('0x5')](_0x1ce1('0x6'),_0x1ce1('0x7'),_0x1ce1('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4b6225b..bf80e19 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 _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 +var _0x284d=['keys','filters','attributes','fields','length','includeAll','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','intersection','nolimit','order','sort','pick','OpenchannelQueueId','filter','User','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','userOpenchannelQueue:save','ids','select','field','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','OpenchannelQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','rows','show','params','model'];(function(_0x352760,_0xe57f42){var _0x38ec16=function(_0x3f4433){while(--_0x3f4433){_0x352760['push'](_0x352760['shift']());}};_0x38ec16(++_0xe57f42);}(_0x284d,0x1b0));var _0xd284=function(_0x189aa8,_0xfb11c3){_0x189aa8=_0x189aa8-0x0;var _0xe29e44=_0x284d[_0x189aa8];return _0xe29e44;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xd284('0x0'));var squel=require('squel');var Redis=require(_0xd284('0x1'));var qs=require(_0xd284('0x2'));var logger=require(_0xd284('0x3'))('api');var config=require(_0xd284('0x4'));var db=require(_0xd284('0x5'))['db'];config['redis']=_[_0xd284('0x6')](config[_0xd284('0x7')],{'host':_0xd284('0x8'),'port':0x18eb});var socket=require(_0xd284('0x9'))(new Redis(config[_0xd284('0x7')]));require(_0xd284('0xa'))['register'](socket);function respondWithStatusCode(_0x5c7eec,_0x3ca3cc){_0x3ca3cc=_0x3ca3cc||0xcc;return function(_0x3b520e){if(_0x3b520e){return _0x5c7eec[_0xd284('0xb')](_0x3ca3cc);}return _0x5c7eec['status'](_0x3ca3cc)['end']();};}function respondWithResult(_0x9a64c8,_0x575daa){_0x575daa=_0x575daa||0xc8;return function(_0x3cabcc){if(_0x3cabcc){return _0x9a64c8['status'](_0x575daa)[_0xd284('0xc')](_0x3cabcc);}};}function respondWithFilteredResult(_0x402565,_0x34429f){return function(_0x375de7){if(_0x375de7){var _0x387477=typeof _0x34429f['offset']===_0xd284('0xd')&&typeof _0x34429f[_0xd284('0xe')]===_0xd284('0xd');var _0x1342d9=_0x375de7[_0xd284('0xf')];var _0x170ac7=_0x387477?0x0:_0x34429f[_0xd284('0x10')];var _0x1862db=_0x387477?_0x375de7[_0xd284('0xf')]:_0x34429f[_0xd284('0x10')]+_0x34429f[_0xd284('0xe')];var _0x3e1536;if(_0x1862db>=_0x1342d9){_0x1862db=_0x1342d9;_0x3e1536=0xc8;}else{_0x3e1536=0xce;}_0x402565[_0xd284('0x11')](_0x3e1536);return _0x402565[_0xd284('0x12')](_0xd284('0x13'),_0x170ac7+'-'+_0x1862db+'/'+_0x1342d9)[_0xd284('0xc')](_0x375de7);}return null;};}function saveUpdates(_0x1938ef){return function(_0x5385b4){if(_0x5385b4){return _0x5385b4[_0xd284('0x14')](_0x1938ef)['then'](function(_0x8134e2){return _0x8134e2;});}return null;};}function removeEntity(_0x42cac4){return function(_0x12b34c){if(_0x12b34c){return _0x12b34c[_0xd284('0x15')]()[_0xd284('0x16')](function(){var _0x2a4f15=_0x12b34c[_0xd284('0x17')]({'plain':!![]});var _0x3fd9d7=_0xd284('0x18');return db[_0xd284('0x19')][_0xd284('0x15')]({'where':{'type':_0x3fd9d7,'resourceId':_0x2a4f15['id']}})[_0xd284('0x16')](function(){return _0x12b34c;});})['then'](function(){_0x42cac4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x147671){return function(_0x2f1205){if(!_0x2f1205){_0x147671[_0xd284('0xb')](0x194);}return _0x2f1205;};}function handleError(_0x3c13c6,_0x13f731){_0x13f731=_0x13f731||0x1f4;return function(_0x1c7c8b){logger[_0xd284('0x1a')](_0x1c7c8b[_0xd284('0x1b')]);if(_0x1c7c8b[_0xd284('0x1c')]){delete _0x1c7c8b[_0xd284('0x1c')];}_0x3c13c6['status'](_0x13f731)['send'](_0x1c7c8b);};}exports[_0xd284('0x1d')]=function(_0x3d1cc2,_0x8045b5){var _0x5d0ebf={};var _0x3b8ef6={'count':0x0,'rows':[]};var _0x3a28d5=_[_0xd284('0x1e')](db[_0xd284('0x1f')][_0xd284('0x20')],function(_0x5ec642){return{'name':_0x5ec642['fieldName'],'type':_0x5ec642[_0xd284('0x21')][_0xd284('0x22')]};});_0x5d0ebf=qs[_0xd284('0x23')](_0x3a28d5,_0x3d1cc2);var _0x4609ce={'where':_0x5d0ebf[_0xd284('0x24')]};return db[_0xd284('0x1f')]['count'](_0x4609ce)[_0xd284('0x16')](function(_0x14dec6){_0x3b8ef6['count']=_0x14dec6;_0x5d0ebf['include']=qs[_0xd284('0x25')](_0x3d1cc2[_0xd284('0x26')]);return db[_0xd284('0x1f')][_0xd284('0x27')](_0x5d0ebf);})['then'](function(_0x5a2df1){_0x3b8ef6[_0xd284('0x28')]=_0x5a2df1;return _0x3b8ef6;})[_0xd284('0x16')](respondWithFilteredResult(_0x8045b5,_0x5d0ebf))['catch'](handleError(_0x8045b5,null));};exports[_0xd284('0x29')]=function(_0x29ab9e,_0x79f2c4){var _0x1a19c4={'raw':!![],'where':{'id':_0x29ab9e[_0xd284('0x2a')]['id']}},_0x178400={};_0x178400[_0xd284('0x2b')]=_[_0xd284('0x2c')](db['OpenchannelQueue']['rawAttributes']);_0x178400[_0xd284('0x26')]=_[_0xd284('0x2c')](_0x29ab9e[_0xd284('0x26')]);_0x178400[_0xd284('0x2d')]=_['intersection'](_0x178400[_0xd284('0x2b')],_0x178400[_0xd284('0x26')]);_0x1a19c4[_0xd284('0x2e')]=_['intersection'](_0x178400['model'],qs[_0xd284('0x2f')](_0x29ab9e[_0xd284('0x26')][_0xd284('0x2f')]));_0x1a19c4[_0xd284('0x2e')]=_0x1a19c4[_0xd284('0x2e')][_0xd284('0x30')]?_0x1a19c4[_0xd284('0x2e')]:_0x178400[_0xd284('0x2b')];if(_0x29ab9e[_0xd284('0x26')][_0xd284('0x31')]){_0x1a19c4[_0xd284('0x25')]=[{'all':!![]}];}_0x1a19c4=_[_0xd284('0x32')]({},_0x1a19c4,_0x29ab9e[_0xd284('0x33')]);return db[_0xd284('0x1f')][_0xd284('0x34')](_0x1a19c4)['then'](handleEntityNotFound(_0x79f2c4,null))['then'](respondWithResult(_0x79f2c4,null))[_0xd284('0x35')](handleError(_0x79f2c4,null));};exports[_0xd284('0x36')]=function(_0x2f1615,_0x97cd2f){return db[_0xd284('0x1f')]['create'](_0x2f1615[_0xd284('0x37')],{})[_0xd284('0x16')](function(_0x1acb17){var _0x324a91=_0x2f1615['user']['get']({'plain':!![]});if(!_0x324a91)throw new Error(_0xd284('0x38'));if(_0x324a91['role']==='user'){var _0x1ddf04=_0x1acb17[_0xd284('0x17')]({'plain':!![]});var _0x5c81ec=_0xd284('0x18');return db[_0xd284('0x39')][_0xd284('0x34')]({'where':{'name':_0x5c81ec,'userProfileId':_0x324a91['userProfileId']},'raw':!![]})[_0xd284('0x16')](function(_0x4c9c3d){if(_0x4c9c3d&&_0x4c9c3d['autoAssociation']===0x0){return db[_0xd284('0x19')][_0xd284('0x36')]({'name':_0x1ddf04[_0xd284('0x1c')],'resourceId':_0x1ddf04['id'],'type':_0x4c9c3d['name'],'sectionId':_0x4c9c3d['id']},{})[_0xd284('0x16')](function(){return _0x1acb17;});}else{return _0x1acb17;}})[_0xd284('0x35')](function(_0x3aa864){logger[_0xd284('0x1a')](_0xd284('0x3a'),_0x3aa864);throw _0x3aa864;});}return _0x1acb17;})[_0xd284('0x16')](respondWithResult(_0x97cd2f,0xc9))[_0xd284('0x35')](handleError(_0x97cd2f,null));};exports[_0xd284('0x14')]=function(_0x18f010,_0x5e3873){if(_0x18f010[_0xd284('0x37')]['id']){delete _0x18f010[_0xd284('0x37')]['id'];}return db[_0xd284('0x1f')][_0xd284('0x34')]({'where':{'id':_0x18f010[_0xd284('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5e3873,null))[_0xd284('0x16')](saveUpdates(_0x18f010['body'],null))[_0xd284('0x16')](respondWithResult(_0x5e3873,null))[_0xd284('0x35')](handleError(_0x5e3873,null));};exports[_0xd284('0x15')]=function(_0x4925fd,_0x546ff1){return db[_0xd284('0x1f')]['find']({'where':{'id':_0x4925fd['params']['id']}})[_0xd284('0x16')](handleEntityNotFound(_0x546ff1,null))['then'](removeEntity(_0x546ff1,null))[_0xd284('0x35')](handleError(_0x546ff1,null));};exports[_0xd284('0x3b')]=function(_0x418d7f,_0xf7c4f){return db[_0xd284('0x1f')]['describe']()[_0xd284('0x16')](respondWithResult(_0xf7c4f,null))[_0xd284('0x35')](handleError(_0xf7c4f,null));};exports[_0xd284('0x3c')]=function(_0x482afa,_0x4d3e70){var _0x2c3309={'raw':!![],'where':{}},_0x222717={},_0x4cab5e;return db[_0xd284('0x1f')][_0xd284('0x3d')]({'where':{'id':_0x482afa[_0xd284('0x2a')]['id']}})[_0xd284('0x16')](handleEntityNotFound(_0x4d3e70,null))[_0xd284('0x16')](function(_0x499412){if(_0x499412){_0x4cab5e=_0x499412[_0xd284('0x17')]({'plain':!![]});_0x222717['model']=_[_0xd284('0x2c')](db[_0xd284('0x3e')][_0xd284('0x20')]);_0x222717[_0xd284('0x26')]=_[_0xd284('0x2c')](_0x482afa[_0xd284('0x26')]);_0x222717['filters']=_['intersection'](_0x222717[_0xd284('0x2b')],_0x222717['query']);_0x2c3309[_0xd284('0x2e')]=_[_0xd284('0x3f')](_0x222717[_0xd284('0x2b')],qs[_0xd284('0x2f')](_0x482afa[_0xd284('0x26')]['fields']));_0x2c3309[_0xd284('0x2e')]=_0x2c3309['attributes'][_0xd284('0x30')]?_0x2c3309['attributes']:_0x222717['model'];if(!_0x482afa[_0xd284('0x26')]['hasOwnProperty'](_0xd284('0x40'))){_0x2c3309[_0xd284('0xe')]=qs[_0xd284('0xe')](_0x482afa[_0xd284('0x26')]['limit']);_0x2c3309['offset']=qs[_0xd284('0x10')](_0x482afa['query'][_0xd284('0x10')]);}_0x2c3309[_0xd284('0x41')]=qs[_0xd284('0x42')](_0x482afa[_0xd284('0x26')][_0xd284('0x42')]);_0x2c3309['where']=qs[_0xd284('0x2d')](_[_0xd284('0x43')](_0x482afa[_0xd284('0x26')],_0x222717['filters']));_0x2c3309[_0xd284('0x24')][_0xd284('0x44')]=_0x499412['id'];if(_0x482afa[_0xd284('0x26')][_0xd284('0x45')]){_0x2c3309[_0xd284('0x24')]=_[_0xd284('0x32')](_0x2c3309[_0xd284('0x24')],{'$or':_[_0xd284('0x1e')](_0x2c3309['attributes'],function(_0x1e4332){var _0x46ecca={};_0x46ecca[_0x1e4332]={'$like':'%'+_0x482afa[_0xd284('0x26')]['filter']+'%'};return _0x46ecca;})});}_0x2c3309=_[_0xd284('0x32')]({},_0x2c3309,_0x482afa['options']);return db[_0xd284('0x3e')][_0xd284('0x27')](_0x2c3309);}})[_0xd284('0x16')](function(_0x1af730){if(_0x1af730){return db[_0xd284('0x46')]['findAndCountAll']({'where':{'id':_[_0xd284('0x1e')](_0x1af730,'UserId'),'role':_0xd284('0x47')},'attributes':['id',_0xd284('0x1c'),_0xd284('0x48'),_0xd284('0x49'),_0xd284('0x4a')]});}})['then'](function(_0x24a92b){if(_0x24a92b){return{'count':_0x24a92b[_0xd284('0xf')],'rows':_[_0xd284('0x1e')](_0x24a92b[_0xd284('0x28')],function(_0x4061c5){return{'membername':_0x4061c5['name'],'UserId':_0x4061c5['id'],'queue_name':_0x4cab5e[_0xd284('0x1c')],'OpenchannelQueueId':_0x4cab5e['id'],'interface':util['format'](_0xd284('0x4b'),_0xd284('0x4c'),_0x4061c5['name']),'penalty':0x0,'paused':_0x4061c5[_0xd284('0x48')],'createdAt':_0x4061c5[_0xd284('0x4a')],'updatedAt':_0x4061c5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d3e70,_0x2c3309))[_0xd284('0x35')](handleError(_0x4d3e70,null));};exports[_0xd284('0x4d')]=function(_0x29f8ef,_0x5af997){var _0x4ce99a={};var _0x3c589c={};var _0x59effd;var _0x560edb;return db[_0xd284('0x1f')][_0xd284('0x3d')]({'where':{'id':_0x29f8ef[_0xd284('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5af997,null))[_0xd284('0x16')](function(_0xd8d82){if(_0xd8d82){_0x59effd=_0xd8d82;_0x3c589c[_0xd284('0x2b')]=_['keys'](db[_0xd284('0x4e')][_0xd284('0x20')]);_0x3c589c['query']=_['keys'](_0x29f8ef['query']);_0x3c589c[_0xd284('0x2d')]=_[_0xd284('0x3f')](_0x3c589c[_0xd284('0x2b')],_0x3c589c['query']);_0x4ce99a[_0xd284('0x2e')]=_[_0xd284('0x3f')](_0x3c589c[_0xd284('0x2b')],qs[_0xd284('0x2f')](_0x29f8ef[_0xd284('0x26')][_0xd284('0x2f')]));_0x4ce99a[_0xd284('0x2e')]=_0x4ce99a[_0xd284('0x2e')][_0xd284('0x30')]?_0x4ce99a['attributes']:_0x3c589c['model'];_0x4ce99a[_0xd284('0x41')]=qs[_0xd284('0x42')](_0x29f8ef[_0xd284('0x26')]['sort']);_0x4ce99a['where']=qs[_0xd284('0x2d')](_[_0xd284('0x43')](_0x29f8ef[_0xd284('0x26')],_0x3c589c[_0xd284('0x2d')]));if(_0x29f8ef['query'][_0xd284('0x45')]){_0x4ce99a[_0xd284('0x24')]=_['merge'](_0x4ce99a['where'],{'$or':_['map'](_0x4ce99a[_0xd284('0x2e')],function(_0x3394d0){var _0x7bc73a={};_0x7bc73a[_0x3394d0]={'$like':'%'+_0x29f8ef[_0xd284('0x26')][_0xd284('0x45')]+'%'};return _0x7bc73a;})});}_0x4ce99a=_[_0xd284('0x32')]({},_0x4ce99a,_0x29f8ef[_0xd284('0x33')]);return _0x59effd[_0xd284('0x4d')](_0x4ce99a);}})['then'](function(_0xe6c284){if(_0xe6c284){_0x560edb=_0xe6c284[_0xd284('0x30')];if(!_0x29f8ef[_0xd284('0x26')][_0xd284('0x4f')](_0xd284('0x40'))){_0x4ce99a[_0xd284('0xe')]=qs[_0xd284('0xe')](_0x29f8ef[_0xd284('0x26')][_0xd284('0xe')]);_0x4ce99a[_0xd284('0x10')]=qs[_0xd284('0x10')](_0x29f8ef['query'][_0xd284('0x10')]);}return _0x59effd[_0xd284('0x4d')](_0x4ce99a);}})['then'](function(_0xc36d56){if(_0xc36d56){return _0xc36d56?{'count':_0x560edb,'rows':_0xc36d56}:null;}})[_0xd284('0x16')](respondWithResult(_0x5af997,null))[_0xd284('0x35')](handleError(_0x5af997,null));};exports[_0xd284('0x50')]=function(_0x8e7d4,_0x56859d){var _0x5af4dc=_0x8e7d4[_0xd284('0x37')]['ids'];return db[_0xd284('0x4e')][_0xd284('0x27')]({'where':{'id':_0x5af4dc},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd284('0x51'),'attributes':['id',_0xd284('0x1c'),_0xd284('0x52'),_0xd284('0x53'),_0xd284('0x54')],'raw':!![]}]})[_0xd284('0x16')](function(_0x21b9d7){if(_0x21b9d7){var _0x557463=_[_0xd284('0x55')](_0x21b9d7,function(_0x14063f){var _0xc05b9=_0x14063f[_0xd284('0x17')]({'plain':!![]});return _0xc05b9[_0xd284('0x51')];});return db['OpenchannelQueue'][_0xd284('0x34')]({'where':{'id':_0x8e7d4['params']['id']}})['then'](function(_0x2d3df2){return db['sequelize'][_0xd284('0x56')](function(_0x37c155){return _0x2d3df2[_0xd284('0x50')](_0x5af4dc,{'transaction':_0x37c155})['then'](function(){return BPromise[_0xd284('0x57')](_0x557463,function(_0xfe1421){return db[_0xd284('0x3e')]['findOrCreate']({'where':{'UserId':_0xfe1421['id'],'OpenchannelQueueId':_0x8e7d4['params']['id']},'transaction':_0x37c155});});})[_0xd284('0x16')](function(){_0x557463[_0xd284('0x58')](function(_0x1ba200){socket[_0xd284('0x59')](_0xd284('0x5a'),{'UserId':_0x1ba200['id'],'OpenchannelQueueId':_0x2d3df2['id']});});});});});}})[_0xd284('0x16')](respondWithStatusCode(_0x56859d,null))[_0xd284('0x35')](handleError(_0x56859d,null));};exports['removeTeams']=function(_0x7b2964,_0x210a72){return db[_0xd284('0x4e')]['findAll']({'where':{'id':_0x7b2964[_0xd284('0x26')][_0xd284('0x5b')]},'attributes':['id'],'include':[{'model':db[_0xd284('0x46')],'as':_0xd284('0x51'),'attributes':['id'],'raw':!![]}]})[_0xd284('0x16')](handleEntityNotFound(_0x210a72,null))[_0xd284('0x16')](function(_0x440453){var _0x5cca05=_[_0xd284('0x1e')](_0x440453,'id');var _0x164b1c=[];var _0x5a5dea=[];var _0x371874=squel[_0xd284('0x5c')]();_0x371874[_0xd284('0x5d')]('tq.TeamId')[_0xd284('0x5e')](_0xd284('0x5f'),'tq')[_0xd284('0x60')]('user_has_teams','ut',_0xd284('0x61'))[_0xd284('0x24')](_0xd284('0x62'),_0x7b2964[_0xd284('0x2a')]['id']);for(var _0x1f5d41=0x0;_0x1f5d41<_0x440453[_0xd284('0x30')];_0x1f5d41+=0x1){let _0x1ba1bd=_0x440453[_0x1f5d41];for(var _0x3bccd1=0x0;_0x3bccd1<_0x1ba1bd[_0xd284('0x51')][_0xd284('0x30')];_0x3bccd1+=0x1){let _0x58d26b=_0x1ba1bd[_0xd284('0x51')][_0x3bccd1];var _0x266dd2=_0x371874[_0xd284('0x63')]();_0x266dd2[_0xd284('0x24')]('ut.UserId\x20=\x20?',_0x58d26b['id']);_0x5a5dea[_0xd284('0x64')](db[_0xd284('0x65')][_0xd284('0x26')](_0x266dd2[_0xd284('0x66')](),{'type':db['sequelize'][_0xd284('0x67')]['SELECT']})[_0xd284('0x16')](function(_0x1a1b0f){if(_0x1a1b0f['length']===0x1){return _0x58d26b['id'];}else{var _0x11cde3=_[_0xd284('0x68')](_[_0xd284('0x1e')](_0x1a1b0f,_0xd284('0x69')),function(_0x2801c9){return _[_0xd284('0x6a')](_0x5cca05,_0x2801c9);});if(_0x11cde3){return _0x58d26b['id'];}}}));}}return BPromise[_0xd284('0x6b')](_0x5a5dea)['then'](function(_0x24f9a7){_0x164b1c=_(_0x164b1c)[_0xd284('0x6c')](_0x24f9a7)[_0xd284('0x6d')]()[_0xd284('0x6e')]();return db['OpenchannelQueue'][_0xd284('0x34')]({'where':{'id':_0x7b2964['params']['id']}})[_0xd284('0x16')](function(_0x4ca317){return db['sequelize']['transaction'](function(_0x5130b2){return _0x4ca317[_0xd284('0x6f')](_0x7b2964[_0xd284('0x26')][_0xd284('0x5b')],{'transaction':_0x5130b2})[_0xd284('0x16')](function(){if(!_[_0xd284('0x70')](_0x164b1c)){return _0x4ca317[_0xd284('0x71')](_0x164b1c,{'transaction':_0x5130b2});}})['then'](function(){_0x164b1c[_0xd284('0x58')](function(_0x561736){socket[_0xd284('0x59')](_0xd284('0x72'),{'UserId':_0x561736,'OpenchannelQueueId':_0x4ca317['id']});});});});});});})['then'](respondWithStatusCode(_0x210a72,null))[_0xd284('0x35')](handleError(_0x210a72,null));};exports[_0xd284('0x73')]=function(_0xc878a3,_0x16ac03){return db['OpenchannelQueue'][_0xd284('0x34')]({'where':{'id':_0xc878a3[_0xd284('0x2a')]['id']}})[_0xd284('0x16')](handleEntityNotFound(_0x16ac03,null))[_0xd284('0x16')](function(_0x1b5dc3){if(_0x1b5dc3){return _0x1b5dc3[_0xd284('0x73')](_0xc878a3[_0xd284('0x37')]['ids'],_[_0xd284('0x74')](_0xc878a3[_0xd284('0x37')],[_0xd284('0x5b'),'id'])||{})[_0xd284('0x75')](function(_0x1f7b37){for(var _0x197843=0x0;_0x197843<_0xc878a3[_0xd284('0x37')][_0xd284('0x5b')][_0xd284('0x30')];_0x197843+=0x1){socket[_0xd284('0x59')](_0xd284('0x5a'),{'UserId':Number(_0xc878a3[_0xd284('0x37')]['ids'][_0x197843]),'OpenchannelQueueId':Number(_0xc878a3['params']['id'])});}return _0x1f7b37;});}})[_0xd284('0x16')](respondWithResult(_0x16ac03,null))[_0xd284('0x35')](handleError(_0x16ac03,null));};exports[_0xd284('0x71')]=function(_0x1688fa,_0xcb137f){return db[_0xd284('0x1f')][_0xd284('0x34')]({'where':{'id':_0x1688fa[_0xd284('0x2a')]['id']}})[_0xd284('0x16')](handleEntityNotFound(_0xcb137f,null))[_0xd284('0x16')](function(_0x3e02d5){if(_0x3e02d5){return _0x3e02d5[_0xd284('0x71')](_0x1688fa[_0xd284('0x26')][_0xd284('0x5b')])['then'](function(){if(_['isArray'](_0x1688fa[_0xd284('0x26')][_0xd284('0x5b')])){for(var _0xb31390=0x0;_0xb31390<_0x1688fa[_0xd284('0x26')][_0xd284('0x5b')][_0xd284('0x30')];_0xb31390+=0x1){socket[_0xd284('0x59')](_0xd284('0x72'),{'UserId':Number(_0x1688fa['query']['ids'][_0xb31390]),'OpenchannelQueueId':Number(_0x1688fa[_0xd284('0x2a')]['id'])});}}else{socket[_0xd284('0x59')](_0xd284('0x72'),{'UserId':Number(_0x1688fa[_0xd284('0x26')][_0xd284('0x5b')]),'OpenchannelQueueId':Number(_0x1688fa['params']['id'])});}});}})[_0xd284('0x16')](respondWithStatusCode(_0xcb137f,null))[_0xd284('0x35')](handleError(_0xcb137f,null));};exports[_0xd284('0x76')]=function(_0x457a46,_0x43eb24){var _0x584091={};var _0x42111c={};var _0x272b2e;var _0x40875b;return db[_0xd284('0x1f')][_0xd284('0x3d')]({'where':{'id':_0x457a46[_0xd284('0x2a')]['id']}})['then'](handleEntityNotFound(_0x43eb24,null))[_0xd284('0x16')](function(_0x569382){if(_0x569382){_0x272b2e=_0x569382;_0x42111c[_0xd284('0x2b')]=_['keys'](db['User']['rawAttributes']);_0x42111c['query']=_[_0xd284('0x2c')](_0x457a46[_0xd284('0x26')]);_0x42111c[_0xd284('0x2d')]=_['intersection'](_0x42111c['model'],_0x42111c[_0xd284('0x26')]);_0x584091['attributes']=_[_0xd284('0x3f')](_0x42111c[_0xd284('0x2b')],qs[_0xd284('0x2f')](_0x457a46['query'][_0xd284('0x2f')]));_0x584091[_0xd284('0x2e')]=_0x584091[_0xd284('0x2e')]['length']?_0x584091[_0xd284('0x2e')]:_0x42111c[_0xd284('0x2b')];_0x584091['order']=qs[_0xd284('0x42')](_0x457a46[_0xd284('0x26')][_0xd284('0x42')]);_0x584091[_0xd284('0x24')]=qs[_0xd284('0x2d')](_[_0xd284('0x43')](_0x457a46['query'],_0x42111c[_0xd284('0x2d')]));if(_0x457a46[_0xd284('0x26')]['filter']){_0x584091[_0xd284('0x24')]=_[_0xd284('0x32')](_0x584091['where'],{'$or':_[_0xd284('0x1e')](_0x584091[_0xd284('0x2e')],function(_0x2e1783){var _0x28eca5={};_0x28eca5[_0x2e1783]={'$like':'%'+_0x457a46[_0xd284('0x26')][_0xd284('0x45')]+'%'};return _0x28eca5;})});}_0x584091=_['merge']({},_0x584091,_0x457a46[_0xd284('0x33')]);return _0x272b2e[_0xd284('0x76')](_0x584091);}})[_0xd284('0x16')](function(_0x30cf14){if(_0x30cf14){_0x40875b=_0x30cf14[_0xd284('0x30')];if(!_0x457a46[_0xd284('0x26')][_0xd284('0x4f')](_0xd284('0x40'))){_0x584091['limit']=qs[_0xd284('0xe')](_0x457a46[_0xd284('0x26')][_0xd284('0xe')]);_0x584091[_0xd284('0x10')]=qs['offset'](_0x457a46[_0xd284('0x26')][_0xd284('0x10')]);}return _0x272b2e[_0xd284('0x76')](_0x584091);}})[_0xd284('0x16')](function(_0x2f18d9){if(_0x2f18d9){return _0x2f18d9?{'count':_0x40875b,'rows':_0x2f18d9}:null;}})[_0xd284('0x16')](respondWithResult(_0x43eb24,null))[_0xd284('0x35')](handleError(_0x43eb24,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 15229ec..40202c1 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 _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 +var _0x6130=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6130,0x1be));var _0x0613=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x6130[_0x9cd4c3];return _0x4c9025;};'use strict';var EventEmitter=require(_0x0613('0x0'));var OpenchannelQueue=require(_0x0613('0x1'))['db'][_0x0613('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0613('0x3')](0x0);var events={'afterCreate':_0x0613('0x4'),'afterUpdate':_0x0613('0x5'),'afterDestroy':_0x0613('0x6')};function emitEvent(_0xcf7d0d){return function(_0xb13d09,_0x2fe21f,_0x217d12){OpenchannelQueueEvents['emit'](_0xcf7d0d+':'+_0xb13d09['id'],_0xb13d09);OpenchannelQueueEvents['emit'](_0xcf7d0d,_0xb13d09);_0x217d12(null);};}for(var e in events){if(events[_0x0613('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0613('0x8')](e,emitEvent(event));}}module[_0x0613('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 001a4fb..e74d8d1 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 _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 +var _0x69b1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x1f2f54,_0x2110f1){var _0x30bed5=function(_0x4258f7){while(--_0x4258f7){_0x1f2f54['push'](_0x1f2f54['shift']());}};_0x30bed5(++_0x2110f1);}(_0x69b1,0x196));var _0x169b=function(_0x3588c3,_0x5e4eed){_0x3588c3=_0x3588c3-0x0;var _0x96d818=_0x69b1[_0x3588c3];return _0x96d818;};'use strict';var _=require(_0x169b('0x0'));var util=require(_0x169b('0x1'));var logger=require(_0x169b('0x2'))(_0x169b('0x3'));var moment=require(_0x169b('0x4'));var BPromise=require(_0x169b('0x5'));var rp=require(_0x169b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x169b('0x7'));var config=require(_0x169b('0x8'));var attributes=require(_0x169b('0x9'));module[_0x169b('0xa')]=function(_0x3f0596,_0x1d8b83){return _0x3f0596[_0x169b('0xb')](_0x169b('0xc'),attributes,{'tableName':_0x169b('0xd'),'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 51c37b6..7caab9d 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 _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 +var _0x6cc4=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','then','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5c52a3,_0x13c8d5){var _0x5537b9=function(_0x469e93){while(--_0x469e93){_0x5c52a3['push'](_0x5c52a3['shift']());}};_0x5537b9(++_0x13c8d5);}(_0x6cc4,0x1e7));var _0x46cc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6cc4[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x46cc('0x0'));var util=require(_0x46cc('0x1'));var moment=require('moment');var BPromise=require(_0x46cc('0x2'));var rs=require(_0x46cc('0x3'));var fs=require('fs');var Redis=require(_0x46cc('0x4'));var db=require(_0x46cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46cc('0x6'))(_0x46cc('0x7'));var config=require(_0x46cc('0x8'));var jayson=require(_0x46cc('0x9'));var client=jayson[_0x46cc('0xa')][_0x46cc('0xb')]({'port':0x232a});config[_0x46cc('0xc')]=_[_0x46cc('0xd')](config[_0x46cc('0xc')],{'host':_0x46cc('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46cc('0xc')]));require(_0x46cc('0xf'))[_0x46cc('0x10')](socket);function respondWithRpcPromise(_0x1e66e3,_0x16486b,_0x2e1ea8){return new BPromise(function(_0x562633,_0x4a2cc0){return client[_0x46cc('0x11')](_0x1e66e3,_0x2e1ea8)['then'](function(_0x5a4f0f){logger[_0x46cc('0x12')](_0x46cc('0x13'),_0x16486b,_0x46cc('0x14'));logger[_0x46cc('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x16486b,_0x46cc('0x14'),JSON[_0x46cc('0x16')](_0x5a4f0f));if(_0x5a4f0f['error']){if(_0x5a4f0f[_0x46cc('0x17')][_0x46cc('0x18')]===0x1f4){logger[_0x46cc('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x16486b,_0x5a4f0f[_0x46cc('0x17')]['message']);return _0x4a2cc0(_0x5a4f0f['error']['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x16486b,_0x5a4f0f[_0x46cc('0x17')][_0x46cc('0x19')]);return _0x562633(_0x5a4f0f[_0x46cc('0x17')][_0x46cc('0x19')]);}else{logger[_0x46cc('0x12')](_0x46cc('0x13'),_0x16486b,_0x46cc('0x14'));_0x562633(_0x5a4f0f['result'][_0x46cc('0x19')]);}})[_0x46cc('0x1a')](function(_0x6391a7){logger[_0x46cc('0x17')](_0x46cc('0x13'),_0x16486b,_0x6391a7);_0x4a2cc0(_0x6391a7);});});}exports[_0x46cc('0x1b')]=function(_0x27334d){var _0x38e93e=this;return new Promise(function(_0xa29892,_0x320479){return db[_0x46cc('0x1c')][_0x46cc('0x1d')]({'raw':_0x27334d[_0x46cc('0x1e')]?_0x27334d[_0x46cc('0x1e')][_0x46cc('0x1f')]===undefined?!![]:![]:!![],'where':_0x27334d['options']?_0x27334d[_0x46cc('0x1e')][_0x46cc('0x20')]||null:null,'attributes':_0x27334d[_0x46cc('0x1e')]?_0x27334d[_0x46cc('0x1e')][_0x46cc('0x21')]||null:null,'limit':_0x27334d['options']?_0x27334d[_0x46cc('0x1e')][_0x46cc('0x22')]||null:null,'include':_0x27334d['options']?_0x27334d['options'][_0x46cc('0x23')]?_[_0x46cc('0x24')](_0x27334d[_0x46cc('0x1e')][_0x46cc('0x23')],function(_0x153c10){return{'model':db[_0x153c10['model']],'as':_0x153c10['as'],'attributes':_0x153c10['attributes'],'include':_0x153c10[_0x46cc('0x23')]?_[_0x46cc('0x24')](_0x153c10[_0x46cc('0x23')],function(_0x528225){return{'model':db[_0x528225[_0x46cc('0x25')]],'as':_0x528225['as'],'attributes':_0x528225[_0x46cc('0x21')],'include':_0x528225[_0x46cc('0x23')]?_[_0x46cc('0x24')](_0x528225[_0x46cc('0x23')],function(_0x390a11){return{'model':db[_0x390a11[_0x46cc('0x25')]],'as':_0x390a11['as'],'attributes':_0x390a11[_0x46cc('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x595f53){logger[_0x46cc('0x12')](_0x46cc('0x1b'),_0x27334d);logger[_0x46cc('0x15')](_0x46cc('0x1b'),_0x27334d,JSON[_0x46cc('0x16')](_0x595f53));_0xa29892(_0x595f53);})[_0x46cc('0x1a')](function(_0x2b342d){logger[_0x46cc('0x17')](_0x46cc('0x1b'),_0x2b342d['message'],_0x27334d);_0x320479(_0x38e93e[_0x46cc('0x17')](0x1f4,_0x2b342d[_0x46cc('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x4bae95){var _0x1c0153=this;return new Promise(function(_0x2f1d1c,_0x93ac4c){return db[_0x46cc('0x1c')][_0x46cc('0x26')]({'raw':_0x4bae95[_0x46cc('0x1e')]?_0x4bae95[_0x46cc('0x1e')][_0x46cc('0x1f')]===undefined?!![]:![]:!![],'where':_0x4bae95[_0x46cc('0x1e')]?_0x4bae95['options'][_0x46cc('0x20')]||null:null,'attributes':_0x4bae95[_0x46cc('0x1e')]?_0x4bae95[_0x46cc('0x1e')]['attributes']||null:null,'include':_0x4bae95[_0x46cc('0x1e')]?_0x4bae95[_0x46cc('0x1e')]['include']?_['map'](_0x4bae95[_0x46cc('0x1e')][_0x46cc('0x23')],function(_0x324743){return{'model':db[_0x324743[_0x46cc('0x25')]],'as':_0x324743['as'],'attributes':_0x324743[_0x46cc('0x21')],'include':_0x324743[_0x46cc('0x23')]?_[_0x46cc('0x24')](_0x324743[_0x46cc('0x23')],function(_0x2b2445){return{'model':db[_0x2b2445[_0x46cc('0x25')]],'as':_0x2b2445['as'],'attributes':_0x2b2445[_0x46cc('0x21')],'include':_0x2b2445['include']?_[_0x46cc('0x24')](_0x2b2445[_0x46cc('0x23')],function(_0x27790c){return{'model':db[_0x27790c[_0x46cc('0x25')]],'as':_0x27790c['as'],'attributes':_0x27790c[_0x46cc('0x21')]};}):[]};}):[]};}):[]:[]})[_0x46cc('0x27')](function(_0x4a0133){logger[_0x46cc('0x12')]('ShowOpenchannelQueue',_0x4bae95);logger[_0x46cc('0x15')](_0x46cc('0x28'),_0x4bae95,JSON[_0x46cc('0x16')](_0x4a0133));_0x2f1d1c(_0x4a0133);})[_0x46cc('0x1a')](function(_0x3813f3){logger[_0x46cc('0x17')]('ShowOpenchannelQueue',_0x3813f3[_0x46cc('0x19')],_0x4bae95);_0x93ac4c(_0x1c0153['error'](0x1f4,_0x3813f3[_0x46cc('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 486cbe5..402e0f7 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 _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 +var _0x5539=['emit','register','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x27367a,_0x84a95c){var _0x3306f1=function(_0x1cbb6b){while(--_0x1cbb6b){_0x27367a['push'](_0x27367a['shift']());}};_0x3306f1(++_0x84a95c);}(_0x5539,0x141));var _0x9553=function(_0x2db148,_0x23a294){_0x2db148=_0x2db148-0x0;var _0x563a87=_0x5539[_0x2db148];return _0x563a87;};'use strict';var OpenchannelQueueEvents=require(_0x9553('0x0'));var events=[_0x9553('0x1'),_0x9553('0x2'),'update'];function createListener(_0x5309b0,_0x5f3698){return function(_0x1d2cc4){_0x5f3698[_0x9553('0x3')](_0x5309b0,_0x1d2cc4);};}function removeListener(_0x9c4bb1,_0x1999a0){return function(){OpenchannelQueueEvents['removeListener'](_0x9c4bb1,_0x1999a0);};}exports[_0x9553('0x4')]=function(_0x38bc9e){for(var _0x11135c=0x0,_0x19da57=events['length'];_0x11135c<_0x19da57;_0x11135c++){var _0x5e78bc=events[_0x11135c];var _0x3e3d45=createListener(_0x9553('0x5')+_0x5e78bc,_0x38bc9e);OpenchannelQueueEvents['on'](_0x5e78bc,_0x3e3d45);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 3ebf1d1..e1da914 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 _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 +var _0x15a4=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x15a4,0x1c4));var _0x415a=function(_0x1fc0f2,_0x557517){_0x1fc0f2=_0x1fc0f2-0x0;var _0x5a3eef=_0x15a4[_0x1fc0f2];return _0x5a3eef;};'use strict';var multer=require(_0x415a('0x0'));var util=require(_0x415a('0x1'));var path=require(_0x415a('0x2'));var timeout=require(_0x415a('0x3'));var express=require(_0x415a('0x4'));var router=express['Router']();var fs_extra=require(_0x415a('0x5'));var auth=require(_0x415a('0x6'));var interaction=require(_0x415a('0x7'));var config=require(_0x415a('0x8'));var controller=require(_0x415a('0x9'));router[_0x415a('0xa')]('/',auth[_0x415a('0xb')](),controller[_0x415a('0xc')]);router[_0x415a('0xa')](_0x415a('0xd'),auth[_0x415a('0xb')](),controller[_0x415a('0xe')]);router['get'](_0x415a('0xf'),auth[_0x415a('0xb')](),controller[_0x415a('0x10')]);router['post']('/',auth[_0x415a('0xb')](),controller[_0x415a('0x11')]);router[_0x415a('0x12')](_0x415a('0xf'),auth[_0x415a('0xb')](),controller['update']);router['delete'](_0x415a('0xf'),auth[_0x415a('0xb')](),controller[_0x415a('0x13')]);module[_0x415a('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index b4283e4..feb8d44 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 _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 +var _0x3b85=['moment','sequelize','exports','STRING','DATE'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x3b85,0x14a));var _0x53b8=function(_0xac2804,_0x4b22b8){_0xac2804=_0xac2804-0x0;var _0x1f1c66=_0x3b85[_0xac2804];return _0x1f1c66;};'use strict';var moment=require(_0x53b8('0x0'));var Sequelize=require(_0x53b8('0x1'));module[_0x53b8('0x2')]={'uniqueid':{'type':Sequelize[_0x53b8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x53b8('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x53b8('0x4')]},'acceptAt':{'type':Sequelize[_0x53b8('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x53b8('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 0c59a56..f177c55 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 _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 +var _0x4d83=['rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','catch','create','find','params','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','save','update','destroy','error','name','send','index','map','OpenchannelQueueReport'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x4d83,0x1ba));var _0x34d8=function(_0x448f04,_0xa951e9){_0x448f04=_0x448f04-0x0;var _0x37641f=_0x4d83[_0x448f04];return _0x37641f;};'use strict';var emlformat=require(_0x34d8('0x0'));var rimraf=require(_0x34d8('0x1'));var zipdir=require(_0x34d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34d8('0x3'));var moment=require(_0x34d8('0x4'));var BPromise=require(_0x34d8('0x5'));var Mustache=require(_0x34d8('0x6'));var util=require(_0x34d8('0x7'));var path=require(_0x34d8('0x8'));var sox=require(_0x34d8('0x9'));var csv=require('to-csv');var ejs=require(_0x34d8('0xa'));var fs=require('fs');var fs_extra=require(_0x34d8('0xb'));var _=require(_0x34d8('0xc'));var squel=require(_0x34d8('0xd'));var crypto=require(_0x34d8('0xe'));var jsforce=require(_0x34d8('0xf'));var deskjs=require(_0x34d8('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x34d8('0x11'));var Redis=require(_0x34d8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x34d8('0x13'));var as=require(_0x34d8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x34d8('0x15'));var config=require(_0x34d8('0x16'));var licenseUtil=require(_0x34d8('0x17'));var db=require(_0x34d8('0x18'))['db'];function respondWithStatusCode(_0x252c38,_0x41b68b){_0x41b68b=_0x41b68b||0xcc;return function(_0x325d73){if(_0x325d73){return _0x252c38['sendStatus'](_0x41b68b);}return _0x252c38[_0x34d8('0x19')](_0x41b68b)['end']();};}function respondWithResult(_0x1d070f,_0x534268){_0x534268=_0x534268||0xc8;return function(_0x5a79e8){if(_0x5a79e8){return _0x1d070f[_0x34d8('0x19')](_0x534268)[_0x34d8('0x1a')](_0x5a79e8);}};}function respondWithFilteredResult(_0x301493,_0x2163cc){return function(_0xd1ed78){if(_0xd1ed78){var _0x287895=typeof _0x2163cc[_0x34d8('0x1b')]===_0x34d8('0x1c')&&typeof _0x2163cc[_0x34d8('0x1d')]==='undefined';var _0x41ba64=_0xd1ed78[_0x34d8('0x1e')];var _0x11c224=_0x287895?0x0:_0x2163cc[_0x34d8('0x1b')];var _0x11cac4=_0x287895?_0xd1ed78[_0x34d8('0x1e')]:_0x2163cc[_0x34d8('0x1b')]+_0x2163cc[_0x34d8('0x1d')];var _0x5f1e7e;if(_0x11cac4>=_0x41ba64){_0x11cac4=_0x41ba64;_0x5f1e7e=0xc8;}else{_0x5f1e7e=0xce;}_0x301493[_0x34d8('0x19')](_0x5f1e7e);return _0x301493[_0x34d8('0x1f')]('Content-Range',_0x11c224+'-'+_0x11cac4+'/'+_0x41ba64)[_0x34d8('0x1a')](_0xd1ed78);}return null;};}function patchUpdates(_0x1d010e){return function(_0xb16c66){try{jsonpatch['apply'](_0xb16c66,_0x1d010e,!![]);}catch(_0x3e7991){return BPromise['reject'](_0x3e7991);}return _0xb16c66[_0x34d8('0x20')]();};}function saveUpdates(_0x24f6a3,_0xfe97d1){return function(_0xfb5345){if(_0xfb5345){return _0xfb5345[_0x34d8('0x21')](_0x24f6a3)['then'](function(_0xdb1eb4){return _0xdb1eb4;});}return null;};}function removeEntity(_0x2e2c80,_0x54f0fb){return function(_0x33b397){if(_0x33b397){return _0x33b397[_0x34d8('0x22')]()['then'](function(){_0x2e2c80[_0x34d8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb4e9,_0x31d327){return function(_0x1beb35){if(!_0x1beb35){_0x3fb4e9['sendStatus'](0x194);}return _0x1beb35;};}function handleError(_0xbaa3de,_0x1cb520){_0x1cb520=_0x1cb520||0x1f4;return function(_0x4b3485){logger[_0x34d8('0x23')](_0x4b3485['stack']);if(_0x4b3485['name']){delete _0x4b3485[_0x34d8('0x24')];}_0xbaa3de['status'](_0x1cb520)[_0x34d8('0x25')](_0x4b3485);};}exports[_0x34d8('0x26')]=function(_0x351529,_0x37efff){var _0x160f3a={},_0x502422={},_0xbbcf4d={'count':0x0,'rows':[]};var _0x290f66=_[_0x34d8('0x27')](db[_0x34d8('0x28')][_0x34d8('0x29')],function(_0x414177){return{'name':_0x414177[_0x34d8('0x2a')],'type':_0x414177[_0x34d8('0x2b')][_0x34d8('0x2c')]};});_0x502422[_0x34d8('0x2d')]=_[_0x34d8('0x27')](_0x290f66,_0x34d8('0x24'));_0x502422['query']=_[_0x34d8('0x2e')](_0x351529[_0x34d8('0x2f')]);_0x502422[_0x34d8('0x30')]=_['intersection'](_0x502422[_0x34d8('0x2d')],_0x502422[_0x34d8('0x2f')]);_0x160f3a[_0x34d8('0x31')]=_[_0x34d8('0x32')](_0x502422[_0x34d8('0x2d')],qs[_0x34d8('0x33')](_0x351529['query'][_0x34d8('0x33')]));_0x160f3a[_0x34d8('0x31')]=_0x160f3a[_0x34d8('0x31')][_0x34d8('0x34')]?_0x160f3a[_0x34d8('0x31')]:_0x502422['model'];if(!_0x351529[_0x34d8('0x2f')]['hasOwnProperty']('nolimit')){_0x160f3a[_0x34d8('0x1d')]=qs['limit'](_0x351529['query'][_0x34d8('0x1d')]);_0x160f3a[_0x34d8('0x1b')]=qs['offset'](_0x351529[_0x34d8('0x2f')][_0x34d8('0x1b')]);}_0x160f3a[_0x34d8('0x35')]=qs['sort'](_0x351529[_0x34d8('0x2f')]['sort']);_0x160f3a[_0x34d8('0x36')]=qs['filters'](_['pick'](_0x351529[_0x34d8('0x2f')],_0x502422['filters']),_0x290f66);if(_0x351529[_0x34d8('0x2f')][_0x34d8('0x37')]){_0x160f3a['where']=_[_0x34d8('0x38')](_0x160f3a['where'],{'$or':_['map'](_0x290f66,function(_0x43d9fb){if(_0x43d9fb[_0x34d8('0x2b')]!==_0x34d8('0x39')){var _0x60ff56={};_0x60ff56[_0x43d9fb[_0x34d8('0x24')]]={'$like':'%'+_0x351529[_0x34d8('0x2f')][_0x34d8('0x37')]+'%'};return _0x60ff56;}})});}_0x160f3a=_[_0x34d8('0x38')]({},_0x160f3a,_0x351529[_0x34d8('0x3a')]);var _0xf52e4f={'where':_0x160f3a[_0x34d8('0x36')]};return db[_0x34d8('0x28')]['count'](_0xf52e4f)['then'](function(_0x42102b){_0xbbcf4d[_0x34d8('0x1e')]=_0x42102b;if(_0x351529['query'][_0x34d8('0x3b')]){_0x160f3a[_0x34d8('0x3c')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x34d8('0x3d')](_0x160f3a);})[_0x34d8('0x3e')](function(_0x5093a3){_0xbbcf4d['rows']=_0x5093a3;return _0xbbcf4d;})[_0x34d8('0x3e')](respondWithFilteredResult(_0x37efff,_0x160f3a))[_0x34d8('0x3f')](handleError(_0x37efff,null));};exports['show']=function(_0x4a901d,_0x4f2e03){var _0x4217a4={'raw':!![],'where':{'id':_0x4a901d['params']['id']}},_0x1bcd76={};_0x1bcd76['model']=_[_0x34d8('0x2e')](db[_0x34d8('0x28')][_0x34d8('0x29')]);_0x1bcd76[_0x34d8('0x2f')]=_[_0x34d8('0x2e')](_0x4a901d[_0x34d8('0x2f')]);_0x1bcd76['filters']=_['intersection'](_0x1bcd76[_0x34d8('0x2d')],_0x1bcd76['query']);_0x4217a4[_0x34d8('0x31')]=_[_0x34d8('0x32')](_0x1bcd76[_0x34d8('0x2d')],qs[_0x34d8('0x33')](_0x4a901d['query'][_0x34d8('0x33')]));_0x4217a4[_0x34d8('0x31')]=_0x4217a4[_0x34d8('0x31')]['length']?_0x4217a4[_0x34d8('0x31')]:_0x1bcd76[_0x34d8('0x2d')];if(_0x4a901d['query'][_0x34d8('0x3b')]){_0x4217a4[_0x34d8('0x3c')]=[{'all':!![]}];}_0x4217a4=_[_0x34d8('0x38')]({},_0x4217a4,_0x4a901d[_0x34d8('0x3a')]);return db[_0x34d8('0x28')]['find'](_0x4217a4)[_0x34d8('0x3e')](handleEntityNotFound(_0x4f2e03,null))[_0x34d8('0x3e')](respondWithResult(_0x4f2e03,null))['catch'](handleError(_0x4f2e03,null));};exports[_0x34d8('0x40')]=function(_0x3b1b9a,_0x321234){return db[_0x34d8('0x28')]['create'](_0x3b1b9a['body'],{})[_0x34d8('0x3e')](respondWithResult(_0x321234,0xc9))['catch'](handleError(_0x321234,null));};exports[_0x34d8('0x21')]=function(_0x5c9450,_0x421dc7){if(_0x5c9450['body']['id']){delete _0x5c9450['body']['id'];}return db['OpenchannelQueueReport'][_0x34d8('0x41')]({'where':{'id':_0x5c9450[_0x34d8('0x42')]['id']}})[_0x34d8('0x3e')](handleEntityNotFound(_0x421dc7,null))[_0x34d8('0x3e')](saveUpdates(_0x5c9450[_0x34d8('0x43')],null))[_0x34d8('0x3e')](respondWithResult(_0x421dc7,null))[_0x34d8('0x3f')](handleError(_0x421dc7,null));};exports[_0x34d8('0x22')]=function(_0x25fc04,_0x4bb1af){return db['OpenchannelQueueReport'][_0x34d8('0x41')]({'where':{'id':_0x25fc04[_0x34d8('0x42')]['id']}})[_0x34d8('0x3e')](handleEntityNotFound(_0x4bb1af,null))[_0x34d8('0x3e')](removeEntity(_0x4bb1af,null))[_0x34d8('0x3f')](handleError(_0x4bb1af,null));};exports[_0x34d8('0x44')]=function(_0x3c304d,_0x23d13d){return db[_0x34d8('0x28')][_0x34d8('0x44')]()[_0x34d8('0x3e')](respondWithResult(_0x23d13d,null))[_0x34d8('0x3f')](handleError(_0x23d13d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index bd75f7e..7ad19b3 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 _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 +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x58e4eb,_0x4e9a11){var _0x3c8177=function(_0x2b17ba){while(--_0x2b17ba){_0x58e4eb['push'](_0x58e4eb['shift']());}};_0x3c8177(++_0x4e9a11);}(_0x7a54,0x106));var _0x47a5=function(_0x302d12,_0x529be4){_0x302d12=_0x302d12-0x0;var _0xab27a1=_0x7a54[_0x302d12];return _0xab27a1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('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 2d9f43b..3caf262 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 _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 +var _0x2884=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','attributes','limit','lodash','moment'];(function(_0x4cc31e,_0x480830){var _0x5cae79=function(_0x3a1b6a){while(--_0x3a1b6a){_0x4cc31e['push'](_0x4cc31e['shift']());}};_0x5cae79(++_0x480830);}(_0x2884,0x1eb));var _0x4288=function(_0x5aea3e,_0x20d237){_0x5aea3e=_0x5aea3e-0x0;var _0x558b7b=_0x2884[_0x5aea3e];return _0x558b7b;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x526a07,_0x3a930e,_0x5e4cfc){return new BPromise(function(_0x25023a,_0x237b02){return client['request'](_0x526a07,_0x5e4cfc)[_0x4288('0x9')](function(_0x3c8d6e){logger[_0x4288('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a930e,'request\x20sent');logger[_0x4288('0xb')](_0x4288('0xc'),_0x3a930e,_0x4288('0xd'),JSON[_0x4288('0xe')](_0x3c8d6e));if(_0x3c8d6e[_0x4288('0xf')]){if(_0x3c8d6e[_0x4288('0xf')][_0x4288('0x10')]===0x1f4){logger['error'](_0x4288('0x11'),_0x3a930e,_0x3c8d6e[_0x4288('0xf')][_0x4288('0x12')]);return _0x237b02(_0x3c8d6e[_0x4288('0xf')]['message']);}logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x3c8d6e['error'][_0x4288('0x12')]);return _0x25023a(_0x3c8d6e['error'][_0x4288('0x12')]);}else{logger['info'](_0x4288('0x11'),_0x3a930e,_0x4288('0xd'));_0x25023a(_0x3c8d6e[_0x4288('0x13')][_0x4288('0x12')]);}})[_0x4288('0x14')](function(_0x1db33b){logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x1db33b);_0x237b02(_0x1db33b);});});}exports[_0x4288('0x15')]=function(_0x53fb81){var _0x199919=this;return new Promise(function(_0xde03f4,_0x5e6de1){return db['OpenchannelQueueReport']['create'](_0x53fb81[_0x4288('0x16')],{'raw':_0x53fb81[_0x4288('0x17')]?_0x53fb81['options'][_0x4288('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x865365){logger[_0x4288('0xa')](_0x4288('0x15'),_0x53fb81);logger['debug'](_0x4288('0x15'),_0x53fb81,JSON[_0x4288('0xe')](_0x865365));_0xde03f4(_0x865365);})[_0x4288('0x14')](function(_0x4b9cda){logger['error'](_0x4288('0x15'),_0x4b9cda[_0x4288('0x12')],_0x53fb81);_0x5e6de1(_0x199919[_0x4288('0xf')](0x1f4,_0x4b9cda[_0x4288('0x12')]));});});};exports[_0x4288('0x19')]=function(_0x292e74){var _0x500c1e=this;return new Promise(function(_0x5f0c29,_0x1ff415){return db[_0x4288('0x1a')]['update'](_0x292e74[_0x4288('0x16')],{'raw':_0x292e74['options']?_0x292e74['options'][_0x4288('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x292e74[_0x4288('0x17')]?_0x292e74[_0x4288('0x17')]['where']||null:null,'attributes':_0x292e74[_0x4288('0x17')]?_0x292e74[_0x4288('0x17')][_0x4288('0x1b')]||null:null,'limit':_0x292e74[_0x4288('0x17')]?_0x292e74[_0x4288('0x17')][_0x4288('0x1c')]||null:null})['then'](function(_0x3a8e3e){logger[_0x4288('0xa')](_0x4288('0x19'),_0x292e74);logger[_0x4288('0xb')](_0x4288('0x19'),_0x292e74,JSON[_0x4288('0xe')](_0x3a8e3e));_0x5f0c29(_0x3a8e3e);})[_0x4288('0x14')](function(_0x5bca41){logger[_0x4288('0xf')](_0x4288('0x19'),_0x5bca41[_0x4288('0x12')],_0x292e74);_0x1ff415(_0x500c1e[_0x4288('0xf')](0x1f4,_0x5bca41[_0x4288('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 711a67c..f2ecbeb 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 _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 +var _0x4951=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','util','path','express'];(function(_0x34978d,_0x4fa165){var _0x2820f7=function(_0x374749){while(--_0x374749){_0x34978d['push'](_0x34978d['shift']());}};_0x2820f7(++_0x4fa165);}(_0x4951,0xe1));var _0x1495=function(_0x16b6e2,_0x24b2a5){_0x16b6e2=_0x16b6e2-0x0;var _0xad9cda=_0x4951[_0x16b6e2];return _0xad9cda;};'use strict';var multer=require('multer');var util=require(_0x1495('0x0'));var path=require(_0x1495('0x1'));var timeout=require('connect-timeout');var express=require(_0x1495('0x2'));var router=express[_0x1495('0x3')]();var fs_extra=require(_0x1495('0x4'));var auth=require(_0x1495('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1495('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0x1495('0x7')]('/',auth[_0x1495('0x8')](),controller[_0x1495('0x9')]);router['get'](_0x1495('0xa'),auth[_0x1495('0x8')](),controller[_0x1495('0xb')]);router[_0x1495('0x7')](_0x1495('0xc'),auth['isAuthenticated'](),controller[_0x1495('0xd')]);router[_0x1495('0xe')]('/',auth[_0x1495('0x8')](),controller['create']);router[_0x1495('0xf')](_0x1495('0xc'),auth[_0x1495('0x8')](),controller[_0x1495('0x10')]);router[_0x1495('0x11')](_0x1495('0xc'),auth[_0x1495('0x8')](),controller['destroy']);module[_0x1495('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index a2b59e2..d94014c 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 _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 +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x265721,_0x1503f2){var _0x11ec95=function(_0x907b1e){while(--_0x907b1e){_0x265721['push'](_0x265721['shift']());}};_0x11ec95(++_0x1503f2);}(_0x54ef,0x112));var _0xf54e=function(_0x26dc14,_0x4e223a){_0x26dc14=_0x26dc14-0x0;var _0x164cd0=_0x54ef[_0x26dc14];return _0x164cd0;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 667ba61..56a664b 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 _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 +var _0xbf46=['../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','body','describe','eml-format','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3de13f,_0x303c12){var _0x1211c1=function(_0x213faa){while(--_0x213faa){_0x3de13f['push'](_0x3de13f['shift']());}};_0x1211c1(++_0x303c12);}(_0xbf46,0x107));var _0x6bf4=function(_0x9e5574,_0x41bf88){_0x9e5574=_0x9e5574-0x0;var _0x21bac1=_0xbf46[_0x9e5574];return _0x21bac1;};'use strict';var emlformat=require(_0x6bf4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bf4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6bf4('0x2'));var util=require(_0x6bf4('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x6bf4('0x4'));var ejs=require(_0x6bf4('0x5'));var fs=require('fs');var fs_extra=require(_0x6bf4('0x6'));var _=require(_0x6bf4('0x7'));var squel=require(_0x6bf4('0x8'));var crypto=require('crypto');var jsforce=require(_0x6bf4('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6bf4('0xa'));var Papa=require(_0x6bf4('0xb'));var Redis=require(_0x6bf4('0xc'));var authService=require(_0x6bf4('0xd'));var qs=require(_0x6bf4('0xe'));var as=require(_0x6bf4('0xf'));var hardwareService=require(_0x6bf4('0x10'));var logger=require(_0x6bf4('0x11'))(_0x6bf4('0x12'));var utils=require(_0x6bf4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8f683f,_0x3ee992){_0x3ee992=_0x3ee992||0xcc;return function(_0x46c4e0){if(_0x46c4e0){return _0x8f683f[_0x6bf4('0x14')](_0x3ee992);}return _0x8f683f[_0x6bf4('0x15')](_0x3ee992)[_0x6bf4('0x16')]();};}function respondWithResult(_0x58fbf3,_0x475a86){_0x475a86=_0x475a86||0xc8;return function(_0x37d9f9){if(_0x37d9f9){return _0x58fbf3[_0x6bf4('0x15')](_0x475a86)[_0x6bf4('0x17')](_0x37d9f9);}};}function respondWithFilteredResult(_0x544a5b,_0x2cd73b){return function(_0x45e945){if(_0x45e945){var _0x280e33=typeof _0x2cd73b['offset']===_0x6bf4('0x18')&&typeof _0x2cd73b[_0x6bf4('0x19')]==='undefined';var _0x1b3561=_0x45e945[_0x6bf4('0x1a')];var _0x24c2c9=_0x280e33?0x0:_0x2cd73b[_0x6bf4('0x1b')];var _0x43edfe=_0x280e33?_0x45e945['count']:_0x2cd73b[_0x6bf4('0x1b')]+_0x2cd73b[_0x6bf4('0x19')];var _0x50067e;if(_0x43edfe>=_0x1b3561){_0x43edfe=_0x1b3561;_0x50067e=0xc8;}else{_0x50067e=0xce;}_0x544a5b[_0x6bf4('0x15')](_0x50067e);return _0x544a5b[_0x6bf4('0x1c')](_0x6bf4('0x1d'),_0x24c2c9+'-'+_0x43edfe+'/'+_0x1b3561)[_0x6bf4('0x17')](_0x45e945);}return null;};}function patchUpdates(_0x520529){return function(_0x6edf13){try{jsonpatch[_0x6bf4('0x1e')](_0x6edf13,_0x520529,!![]);}catch(_0x179d94){return BPromise[_0x6bf4('0x1f')](_0x179d94);}return _0x6edf13[_0x6bf4('0x20')]();};}function saveUpdates(_0x3c4a89,_0xea5aba){return function(_0x369544){if(_0x369544){return _0x369544[_0x6bf4('0x21')](_0x3c4a89)[_0x6bf4('0x22')](function(_0x5c68e2){return _0x5c68e2;});}return null;};}function removeEntity(_0x329bdd,_0x48e4af){return function(_0x1619c5){if(_0x1619c5){return _0x1619c5[_0x6bf4('0x23')]()['then'](function(){_0x329bdd[_0x6bf4('0x15')](0xcc)[_0x6bf4('0x16')]();});}};}function handleEntityNotFound(_0x5bcd81,_0x29a751){return function(_0x191656){if(!_0x191656){_0x5bcd81['sendStatus'](0x194);}return _0x191656;};}function handleError(_0x402ad3,_0x406a65){_0x406a65=_0x406a65||0x1f4;return function(_0x47bf55){logger[_0x6bf4('0x24')](_0x47bf55['stack']);if(_0x47bf55[_0x6bf4('0x25')]){delete _0x47bf55[_0x6bf4('0x25')];}_0x402ad3[_0x6bf4('0x15')](_0x406a65)[_0x6bf4('0x26')](_0x47bf55);};}exports['index']=function(_0x7ea8f0,_0x1e2f26){var _0x21868a={},_0x329272={},_0x4c90a7={'count':0x0,'rows':[]};var _0xfb4168=_[_0x6bf4('0x27')](db[_0x6bf4('0x28')][_0x6bf4('0x29')],function(_0x227ced){return{'name':_0x227ced[_0x6bf4('0x2a')],'type':_0x227ced[_0x6bf4('0x2b')][_0x6bf4('0x2c')]};});_0x329272['model']=_[_0x6bf4('0x27')](_0xfb4168,'name');_0x329272[_0x6bf4('0x2d')]=_[_0x6bf4('0x2e')](_0x7ea8f0[_0x6bf4('0x2d')]);_0x329272[_0x6bf4('0x2f')]=_['intersection'](_0x329272[_0x6bf4('0x30')],_0x329272[_0x6bf4('0x2d')]);_0x21868a['attributes']=_[_0x6bf4('0x31')](_0x329272[_0x6bf4('0x30')],qs[_0x6bf4('0x32')](_0x7ea8f0[_0x6bf4('0x2d')][_0x6bf4('0x32')]));_0x21868a[_0x6bf4('0x33')]=_0x21868a[_0x6bf4('0x33')][_0x6bf4('0x34')]?_0x21868a[_0x6bf4('0x33')]:_0x329272[_0x6bf4('0x30')];if(!_0x7ea8f0[_0x6bf4('0x2d')]['hasOwnProperty'](_0x6bf4('0x35'))){_0x21868a[_0x6bf4('0x19')]=qs[_0x6bf4('0x19')](_0x7ea8f0[_0x6bf4('0x2d')][_0x6bf4('0x19')]);_0x21868a['offset']=qs[_0x6bf4('0x1b')](_0x7ea8f0[_0x6bf4('0x2d')][_0x6bf4('0x1b')]);}_0x21868a[_0x6bf4('0x36')]=qs[_0x6bf4('0x37')](_0x7ea8f0['query'][_0x6bf4('0x37')]);_0x21868a[_0x6bf4('0x38')]=qs[_0x6bf4('0x2f')](_[_0x6bf4('0x39')](_0x7ea8f0[_0x6bf4('0x2d')],_0x329272[_0x6bf4('0x2f')]),_0xfb4168);if(_0x7ea8f0[_0x6bf4('0x2d')][_0x6bf4('0x3a')]){_0x21868a[_0x6bf4('0x38')]=_[_0x6bf4('0x3b')](_0x21868a[_0x6bf4('0x38')],{'$or':_[_0x6bf4('0x27')](_0xfb4168,function(_0x21c0aa){if(_0x21c0aa['type']!=='VIRTUAL'){var _0x10f5cf={};_0x10f5cf[_0x21c0aa[_0x6bf4('0x25')]]={'$like':'%'+_0x7ea8f0[_0x6bf4('0x2d')][_0x6bf4('0x3a')]+'%'};return _0x10f5cf;}})});}_0x21868a=_[_0x6bf4('0x3b')]({},_0x21868a,_0x7ea8f0[_0x6bf4('0x3c')]);var _0x239300={'where':_0x21868a[_0x6bf4('0x38')]};return db[_0x6bf4('0x28')][_0x6bf4('0x1a')](_0x239300)[_0x6bf4('0x22')](function(_0x4791af){_0x4c90a7[_0x6bf4('0x1a')]=_0x4791af;if(_0x7ea8f0['query'][_0x6bf4('0x3d')]){_0x21868a[_0x6bf4('0x3e')]=[{'all':!![]}];}return db[_0x6bf4('0x28')][_0x6bf4('0x3f')](_0x21868a);})[_0x6bf4('0x22')](function(_0x3463f2){_0x4c90a7[_0x6bf4('0x40')]=_0x3463f2;return _0x4c90a7;})[_0x6bf4('0x22')](respondWithFilteredResult(_0x1e2f26,_0x21868a))[_0x6bf4('0x41')](handleError(_0x1e2f26,null));};exports['show']=function(_0xa0be5e,_0x487b91){var _0x26905f={'raw':!![],'where':{'id':_0xa0be5e[_0x6bf4('0x42')]['id']}},_0xcb9ac6={};_0xcb9ac6[_0x6bf4('0x30')]=_[_0x6bf4('0x2e')](db[_0x6bf4('0x28')][_0x6bf4('0x29')]);_0xcb9ac6[_0x6bf4('0x2d')]=_[_0x6bf4('0x2e')](_0xa0be5e[_0x6bf4('0x2d')]);_0xcb9ac6[_0x6bf4('0x2f')]=_[_0x6bf4('0x31')](_0xcb9ac6[_0x6bf4('0x30')],_0xcb9ac6[_0x6bf4('0x2d')]);_0x26905f['attributes']=_['intersection'](_0xcb9ac6[_0x6bf4('0x30')],qs[_0x6bf4('0x32')](_0xa0be5e[_0x6bf4('0x2d')][_0x6bf4('0x32')]));_0x26905f[_0x6bf4('0x33')]=_0x26905f[_0x6bf4('0x33')]['length']?_0x26905f[_0x6bf4('0x33')]:_0xcb9ac6[_0x6bf4('0x30')];if(_0xa0be5e[_0x6bf4('0x2d')][_0x6bf4('0x3d')]){_0x26905f[_0x6bf4('0x3e')]=[{'all':!![]}];}_0x26905f=_['merge']({},_0x26905f,_0xa0be5e[_0x6bf4('0x3c')]);return db[_0x6bf4('0x28')]['find'](_0x26905f)[_0x6bf4('0x22')](handleEntityNotFound(_0x487b91,null))[_0x6bf4('0x22')](respondWithResult(_0x487b91,null))[_0x6bf4('0x41')](handleError(_0x487b91,null));};exports[_0x6bf4('0x43')]=function(_0x4291f6,_0x2efd61){return db[_0x6bf4('0x28')][_0x6bf4('0x43')](_0x4291f6[_0x6bf4('0x44')],{})[_0x6bf4('0x22')](respondWithResult(_0x2efd61,0xc9))[_0x6bf4('0x41')](handleError(_0x2efd61,null));};exports[_0x6bf4('0x21')]=function(_0x3f1cdb,_0xee135b){if(_0x3f1cdb[_0x6bf4('0x44')]['id']){delete _0x3f1cdb[_0x6bf4('0x44')]['id'];}return db[_0x6bf4('0x28')]['find']({'where':{'id':_0x3f1cdb['params']['id']}})[_0x6bf4('0x22')](handleEntityNotFound(_0xee135b,null))[_0x6bf4('0x22')](saveUpdates(_0x3f1cdb[_0x6bf4('0x44')],null))[_0x6bf4('0x22')](respondWithResult(_0xee135b,null))[_0x6bf4('0x41')](handleError(_0xee135b,null));};exports[_0x6bf4('0x23')]=function(_0x3a87f8,_0x1fc487){return db[_0x6bf4('0x28')]['find']({'where':{'id':_0x3a87f8[_0x6bf4('0x42')]['id']}})[_0x6bf4('0x22')](handleEntityNotFound(_0x1fc487,null))[_0x6bf4('0x22')](removeEntity(_0x1fc487,null))[_0x6bf4('0x41')](handleError(_0x1fc487,null));};exports[_0x6bf4('0x45')]=function(_0xc75939,_0x327f51){return db['OpenchannelTransferReport'][_0x6bf4('0x45')]()['then'](respondWithResult(_0x327f51,null))['catch'](handleError(_0x327f51,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 58f5223..c11adbe 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 _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 +var _0x17d7=['../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3b8c47,_0x554d82){var _0x4422a5=function(_0x1637cc){while(--_0x1637cc){_0x3b8c47['push'](_0x3b8c47['shift']());}};_0x4422a5(++_0x554d82);}(_0x17d7,0x88));var _0x717d=function(_0x1ac292,_0x4912bc){_0x1ac292=_0x1ac292-0x0;var _0x1ef8ae=_0x17d7[_0x1ac292];return _0x1ef8ae;};'use strict';var _=require(_0x717d('0x0'));var util=require('util');var logger=require(_0x717d('0x1'))(_0x717d('0x2'));var moment=require(_0x717d('0x3'));var BPromise=require(_0x717d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x717d('0x5'));var rimraf=require(_0x717d('0x6'));var config=require(_0x717d('0x7'));var attributes=require(_0x717d('0x8'));module['exports']=function(_0x537dea,_0x43b087){return _0x537dea[_0x717d('0x9')](_0x717d('0xa'),attributes,{'tableName':_0x717d('0xb'),'paranoid':![],'indexes':[{'name':_0x717d('0xc'),'fields':[_0x717d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index f67c6c0..8d3ef8f 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 _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 +var _0xa0a1=['request\x20sent','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x4fcaf1,_0x59fa8b){var _0x509afb=function(_0x3019c1){while(--_0x3019c1){_0x4fcaf1['push'](_0x4fcaf1['shift']());}};_0x509afb(++_0x59fa8b);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x178cc7,_0x129249){_0x178cc7=_0x178cc7-0x0;var _0x5ca149=_0xa0a1[_0x178cc7];return _0x5ca149;};'use strict';var _=require(_0x1a0a('0x0'));var util=require('util');var moment=require(_0x1a0a('0x1'));var BPromise=require(_0x1a0a('0x2'));var rs=require(_0x1a0a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a0a('0x4'));var logger=require(_0x1a0a('0x5'))('rpc');var config=require(_0x1a0a('0x6'));var jayson=require(_0x1a0a('0x7'));var client=jayson['client'][_0x1a0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe59f97,_0x3fe29f,_0x245f3d){return new BPromise(function(_0x9da67c,_0x48d604){return client[_0x1a0a('0x9')](_0xe59f97,_0x245f3d)[_0x1a0a('0xa')](function(_0x8165a1){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3fe29f,'request\x20sent');logger[_0x1a0a('0xb')](_0x1a0a('0xc'),_0x3fe29f,_0x1a0a('0xd'),JSON['stringify'](_0x8165a1));if(_0x8165a1[_0x1a0a('0xe')]){if(_0x8165a1['error'][_0x1a0a('0xf')]===0x1f4){logger[_0x1a0a('0xe')](_0x1a0a('0x10'),_0x3fe29f,_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);return _0x48d604(_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);}logger['error'](_0x1a0a('0x10'),_0x3fe29f,_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);return _0x9da67c(_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);}else{logger['info'](_0x1a0a('0x10'),_0x3fe29f,_0x1a0a('0xd'));_0x9da67c(_0x8165a1[_0x1a0a('0x12')]['message']);}})[_0x1a0a('0x13')](function(_0x57c942){logger[_0x1a0a('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3fe29f,_0x57c942);_0x48d604(_0x57c942);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1e83a68..5ab6c2a 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 _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 +var _0x005d=['get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x005d,0x64));var _0xd005=function(_0x12dc8d,_0x5037e9){_0x12dc8d=_0x12dc8d-0x0;var _0xa9f23=_0x005d[_0x12dc8d];return _0xa9f23;};'use strict';var multer=require(_0xd005('0x0'));var util=require('util');var path=require(_0xd005('0x1'));var timeout=require(_0xd005('0x2'));var express=require(_0xd005('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd005('0x4'));var interaction=require(_0xd005('0x5'));var config=require(_0xd005('0x6'));var controller=require(_0xd005('0x7'));router[_0xd005('0x8')]('/',auth[_0xd005('0x9')](),controller[_0xd005('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd005('0xb')]);router[_0xd005('0xc')]('/',auth[_0xd005('0x9')](),controller['create']);router[_0xd005('0xd')](_0xd005('0xe'),auth[_0xd005('0x9')](),controller[_0xd005('0xf')]);router[_0xd005('0x10')](_0xd005('0xe'),auth[_0xd005('0x9')](),controller[_0xd005('0x11')]);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 c72df78..9bef1dd 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 _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 +var _0x9943=['exports','STRING','sequelize'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x9943,0x17f));var _0x3994=function(_0x192ac5,_0x308bad){_0x192ac5=_0x192ac5-0x0;var _0x2073f8=_0x9943[_0x192ac5];return _0x2073f8;};'use strict';var Sequelize=require(_0x3994('0x0'));module[_0x3994('0x1')]={'name':{'type':Sequelize[_0x3994('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3994('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3621b28..9825520 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 _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 +var _0x3977=['body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Pauses','UserProfileResource','destroy','end','sendStatus','error','name','send','index','map','Pause','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','rawAttributes','length','find','create'];(function(_0x43d265,_0x6fc83d){var _0x361f7d=function(_0x44617d){while(--_0x44617d){_0x43d265['push'](_0x43d265['shift']());}};_0x361f7d(++_0x6fc83d);}(_0x3977,0x143));var _0x7397=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3977[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7397('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7397('0x1'));var rp=require(_0x7397('0x2'));var moment=require(_0x7397('0x3'));var BPromise=require(_0x7397('0x4'));var Mustache=require(_0x7397('0x5'));var util=require(_0x7397('0x6'));var path=require(_0x7397('0x7'));var sox=require(_0x7397('0x8'));var csv=require(_0x7397('0x9'));var ejs=require(_0x7397('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7397('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7397('0xc'));var deskjs=require(_0x7397('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7397('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7397('0xf'));var qs=require(_0x7397('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7397('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7397('0x12'))['db'];function respondWithStatusCode(_0x75d7b7,_0x5e6028){_0x5e6028=_0x5e6028||0xcc;return function(_0x49a6f5){if(_0x49a6f5){return _0x75d7b7['sendStatus'](_0x5e6028);}return _0x75d7b7[_0x7397('0x13')](_0x5e6028)['end']();};}function respondWithResult(_0x496f23,_0x2cb800){_0x2cb800=_0x2cb800||0xc8;return function(_0x33d83d){if(_0x33d83d){return _0x496f23['status'](_0x2cb800)[_0x7397('0x14')](_0x33d83d);}};}function respondWithFilteredResult(_0x465c7b,_0x37c7f){return function(_0x2184e5){if(_0x2184e5){var _0x2f31e0=typeof _0x37c7f['offset']===_0x7397('0x15')&&typeof _0x37c7f[_0x7397('0x16')]===_0x7397('0x15');var _0x228008=_0x2184e5[_0x7397('0x17')];var _0x4efe0b=_0x2f31e0?0x0:_0x37c7f[_0x7397('0x18')];var _0x233aa4=_0x2f31e0?_0x2184e5[_0x7397('0x17')]:_0x37c7f[_0x7397('0x18')]+_0x37c7f['limit'];var _0x1bc3c7;if(_0x233aa4>=_0x228008){_0x233aa4=_0x228008;_0x1bc3c7=0xc8;}else{_0x1bc3c7=0xce;}_0x465c7b[_0x7397('0x13')](_0x1bc3c7);return _0x465c7b[_0x7397('0x19')](_0x7397('0x1a'),_0x4efe0b+'-'+_0x233aa4+'/'+_0x228008)[_0x7397('0x14')](_0x2184e5);}return null;};}function patchUpdates(_0x2b5924){return function(_0x28eaa9){try{jsonpatch[_0x7397('0x1b')](_0x28eaa9,_0x2b5924,!![]);}catch(_0x4a3a33){return BPromise[_0x7397('0x1c')](_0x4a3a33);}return _0x28eaa9[_0x7397('0x1d')]();};}function saveUpdates(_0x3fe2b9,_0x57b846){return function(_0x38a4c8){if(_0x38a4c8){return _0x38a4c8[_0x7397('0x1e')](_0x3fe2b9)[_0x7397('0x1f')](function(_0x40b057){return _0x40b057;});}return null;};}function removeEntity(_0x3c400b,_0x266683){return function(_0x120f76){if(_0x120f76){return _0x120f76['destroy']()[_0x7397('0x1f')](function(){var _0x1d54b8=_0x120f76[_0x7397('0x20')]({'plain':!![]});var _0x3a5598=_0x7397('0x21');return db[_0x7397('0x22')][_0x7397('0x23')]({'where':{'type':_0x3a5598,'resourceId':_0x1d54b8['id']}})[_0x7397('0x1f')](function(){return _0x120f76;});})[_0x7397('0x1f')](function(){_0x3c400b[_0x7397('0x13')](0xcc)[_0x7397('0x24')]();});}};}function handleEntityNotFound(_0x4b8856,_0xe5010d){return function(_0x4526f4){if(!_0x4526f4){_0x4b8856[_0x7397('0x25')](0x194);}return _0x4526f4;};}function handleError(_0x5dd377,_0x3a263b){_0x3a263b=_0x3a263b||0x1f4;return function(_0x12c226){logger[_0x7397('0x26')](_0x12c226['stack']);if(_0x12c226[_0x7397('0x27')]){delete _0x12c226[_0x7397('0x27')];}_0x5dd377['status'](_0x3a263b)[_0x7397('0x28')](_0x12c226);};}exports[_0x7397('0x29')]=function(_0x45e7d4,_0x30fb32){var _0x7e94c8={},_0x3e290b={},_0x47be80={'count':0x0,'rows':[]};var _0x462e7b=_[_0x7397('0x2a')](db[_0x7397('0x2b')]['rawAttributes'],function(_0x273ba9){return{'name':_0x273ba9[_0x7397('0x2c')],'type':_0x273ba9[_0x7397('0x2d')]['key']};});_0x3e290b[_0x7397('0x2e')]=_[_0x7397('0x2a')](_0x462e7b,_0x7397('0x27'));_0x3e290b[_0x7397('0x2f')]=_['keys'](_0x45e7d4[_0x7397('0x2f')]);_0x3e290b[_0x7397('0x30')]=_[_0x7397('0x31')](_0x3e290b[_0x7397('0x2e')],_0x3e290b[_0x7397('0x2f')]);_0x7e94c8['attributes']=_['intersection'](_0x3e290b[_0x7397('0x2e')],qs[_0x7397('0x32')](_0x45e7d4['query']['fields']));_0x7e94c8['attributes']=_0x7e94c8[_0x7397('0x33')]['length']?_0x7e94c8['attributes']:_0x3e290b['model'];if(!_0x45e7d4[_0x7397('0x2f')][_0x7397('0x34')](_0x7397('0x35'))){_0x7e94c8['limit']=qs[_0x7397('0x16')](_0x45e7d4[_0x7397('0x2f')][_0x7397('0x16')]);_0x7e94c8[_0x7397('0x18')]=qs[_0x7397('0x18')](_0x45e7d4[_0x7397('0x2f')]['offset']);}_0x7e94c8[_0x7397('0x36')]=qs['sort'](_0x45e7d4[_0x7397('0x2f')][_0x7397('0x37')]);_0x7e94c8[_0x7397('0x38')]=qs[_0x7397('0x30')](_[_0x7397('0x39')](_0x45e7d4[_0x7397('0x2f')],_0x3e290b[_0x7397('0x30')]),_0x462e7b);if(_0x45e7d4['query'][_0x7397('0x3a')]){_0x7e94c8[_0x7397('0x38')]=_[_0x7397('0x3b')](_0x7e94c8[_0x7397('0x38')],{'$or':_[_0x7397('0x2a')](_0x462e7b,function(_0x4358ba){if(_0x4358ba['type']!==_0x7397('0x3c')){var _0x2842a6={};_0x2842a6[_0x4358ba['name']]={'$like':'%'+_0x45e7d4[_0x7397('0x2f')][_0x7397('0x3a')]+'%'};return _0x2842a6;}})});}_0x7e94c8=_['merge']({},_0x7e94c8,_0x45e7d4[_0x7397('0x3d')]);var _0x2d4f11={'where':_0x7e94c8[_0x7397('0x38')]};return db[_0x7397('0x2b')][_0x7397('0x17')](_0x2d4f11)[_0x7397('0x1f')](function(_0x1bea25){_0x47be80['count']=_0x1bea25;if(_0x45e7d4[_0x7397('0x2f')][_0x7397('0x3e')]){_0x7e94c8[_0x7397('0x3f')]=[{'all':!![]}];}return db[_0x7397('0x2b')]['findAll'](_0x7e94c8);})['then'](function(_0x59943f){_0x47be80[_0x7397('0x40')]=_0x59943f;return _0x47be80;})[_0x7397('0x1f')](respondWithFilteredResult(_0x30fb32,_0x7e94c8))[_0x7397('0x41')](handleError(_0x30fb32,null));};exports['show']=function(_0x58d1ad,_0x1c9c54){var _0xdac6c7={'raw':!![],'where':{'id':_0x58d1ad[_0x7397('0x42')]['id']}},_0x459110={};_0x459110['model']=_[_0x7397('0x43')](db[_0x7397('0x2b')][_0x7397('0x44')]);_0x459110['query']=_[_0x7397('0x43')](_0x58d1ad[_0x7397('0x2f')]);_0x459110[_0x7397('0x30')]=_[_0x7397('0x31')](_0x459110[_0x7397('0x2e')],_0x459110['query']);_0xdac6c7[_0x7397('0x33')]=_['intersection'](_0x459110['model'],qs[_0x7397('0x32')](_0x58d1ad[_0x7397('0x2f')]['fields']));_0xdac6c7[_0x7397('0x33')]=_0xdac6c7[_0x7397('0x33')][_0x7397('0x45')]?_0xdac6c7['attributes']:_0x459110[_0x7397('0x2e')];if(_0x58d1ad[_0x7397('0x2f')]['includeAll']){_0xdac6c7[_0x7397('0x3f')]=[{'all':!![]}];}_0xdac6c7=_['merge']({},_0xdac6c7,_0x58d1ad[_0x7397('0x3d')]);return db['Pause'][_0x7397('0x46')](_0xdac6c7)[_0x7397('0x1f')](handleEntityNotFound(_0x1c9c54,null))[_0x7397('0x1f')](respondWithResult(_0x1c9c54,null))[_0x7397('0x41')](handleError(_0x1c9c54,null));};exports['create']=function(_0x3c4cd0,_0x5b7dd3){return db[_0x7397('0x2b')][_0x7397('0x47')](_0x3c4cd0[_0x7397('0x48')],{})['then'](function(_0x32eaa6){var _0x5cc896=_0x3c4cd0[_0x7397('0x49')]['get']({'plain':!![]});if(!_0x5cc896)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc896[_0x7397('0x4a')]==='user'){var _0x3082c8=_0x32eaa6[_0x7397('0x20')]({'plain':!![]});var _0x25587d='Pauses';return db[_0x7397('0x4b')][_0x7397('0x46')]({'where':{'name':_0x25587d,'userProfileId':_0x5cc896[_0x7397('0x4c')]},'raw':!![]})[_0x7397('0x1f')](function(_0x295872){if(_0x295872&&_0x295872[_0x7397('0x4d')]===0x0){return db[_0x7397('0x22')][_0x7397('0x47')]({'name':_0x3082c8[_0x7397('0x27')],'resourceId':_0x3082c8['id'],'type':_0x295872[_0x7397('0x27')],'sectionId':_0x295872['id']},{})[_0x7397('0x1f')](function(){return _0x32eaa6;});}else{return _0x32eaa6;}})[_0x7397('0x41')](function(_0x5dcffc){logger['error'](_0x7397('0x4e'),_0x5dcffc);throw _0x5dcffc;});}return _0x32eaa6;})[_0x7397('0x1f')](respondWithResult(_0x5b7dd3,0xc9))[_0x7397('0x41')](handleError(_0x5b7dd3,null));};exports[_0x7397('0x1e')]=function(_0x17c5f6,_0x227f89){if(_0x17c5f6['body']['id']){delete _0x17c5f6[_0x7397('0x48')]['id'];}return db[_0x7397('0x2b')][_0x7397('0x46')]({'where':{'id':_0x17c5f6[_0x7397('0x42')]['id']}})[_0x7397('0x1f')](handleEntityNotFound(_0x227f89,null))['then'](saveUpdates(_0x17c5f6[_0x7397('0x48')],null))[_0x7397('0x1f')](respondWithResult(_0x227f89,null))['catch'](handleError(_0x227f89,null));};exports[_0x7397('0x23')]=function(_0x109e3c,_0x25fa2f){return db[_0x7397('0x2b')][_0x7397('0x46')]({'where':{'id':_0x109e3c['params']['id']}})[_0x7397('0x1f')](handleEntityNotFound(_0x25fa2f,null))[_0x7397('0x1f')](removeEntity(_0x25fa2f,null))[_0x7397('0x41')](handleError(_0x25fa2f,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b399385..5922039 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 _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 +var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x161a9a,_0x4f2072){var _0x163385=function(_0x27fc4d){while(--_0x27fc4d){_0x161a9a['push'](_0x161a9a['shift']());}};_0x163385(++_0x4f2072);}(_0x814b,0x1a2));var _0xb814=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x814b[_0x27af45];return _0x18df21;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index f8cbc39..1445ce7 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_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 +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(_0x401d1a,_0x584ee0){var _0x2b9dc0=function(_0x512e48){while(--_0x512e48){_0x401d1a['push'](_0x401d1a['shift']());}};_0x2b9dc0(++_0x584ee0);}(_0xb10b,0x12a));var _0xbb10=function(_0x45aca3,_0x2dc880){_0x45aca3=_0x45aca3-0x0;var _0x540d06=_0xb10b[_0x45aca3];return _0x540d06;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 8c28f55..d75e51e 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 _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 +var _0x4b84=['exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/webhook','get','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','basename','now','extname','upload','webhookPost','/:id','isAuthenticated','delete'];(function(_0x3ee5df,_0x583073){var _0x446d24=function(_0x12e54e){while(--_0x12e54e){_0x3ee5df['push'](_0x3ee5df['shift']());}};_0x446d24(++_0x583073);}(_0x4b84,0x1cc));var _0x44b8=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x4b84[_0x265003];return _0x33c743;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./plugin.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),controller['webhookGet']);router[_0x44b8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x9')]);router[_0x44b8('0x8')](_0x44b8('0xa'),auth['isAuthenticated'](),controller[_0x44b8('0xb')]);var upload=multer({'storage':multer[_0x44b8('0xc')]({'destination':function(_0x4315f6,_0x9b6048,_0x24dd10){_0x24dd10(null,path[_0x44b8('0xd')](config[_0x44b8('0xe')],'server/files/plugins'));},'filename':function(_0x147529,_0x4301a6,_0x4bcc43){_0x4301a6[_0x44b8('0xf')]=_0x4301a6['originalname'][_0x44b8('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bcc43(null,util[_0x44b8('0x11')]('%s-%s%s',path[_0x44b8('0x12')](_0x4301a6['originalname'],path['extname'](_0x4301a6[_0x44b8('0xf')])),Date[_0x44b8('0x13')](),path[_0x44b8('0x14')](_0x4301a6[_0x44b8('0xf')])));}})});router['post']('/',upload['single']('file'),controller[_0x44b8('0x15')]);router['post'](_0x44b8('0x7'),controller[_0x44b8('0x16')]);router['put'](_0x44b8('0x17'),auth[_0x44b8('0x18')](),controller['update']);router[_0x44b8('0x19')](_0x44b8('0x17'),auth['isAuthenticated'](),controller[_0x44b8('0x19')]);module[_0x44b8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index e4fc892..6a94966 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 _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 +var _0x63da=['never','sequelize','STRING','ENUM','html','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0x5340fb,_0x53d5a2){var _0x35701e=function(_0x47ce2f){while(--_0x47ce2f){_0x5340fb['push'](_0x5340fb['shift']());}};_0x35701e(++_0x53d5a2);}(_0x63da,0x1af));var _0xa63d=function(_0x111ccc,_0x4f5094){_0x111ccc=_0x111ccc-0x0;var _0x5bd2a5=_0x63da[_0x111ccc];return _0x5bd2a5;};'use strict';var Sequelize=require(_0xa63d('0x0'));module['exports']={'name':{'type':Sequelize[_0xa63d('0x1')]},'type':{'type':Sequelize[_0xa63d('0x2')](_0xa63d('0x3'),'script')},'description':{'type':Sequelize[_0xa63d('0x4')]},'version':{'type':Sequelize[_0xa63d('0x4')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa63d('0x5')},'sidebar':{'type':Sequelize['ENUM'](_0xa63d('0x6'),_0xa63d('0x7'),_0xa63d('0x8'),_0xa63d('0x9')),'defaultValue':_0xa63d('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xa63d('0x1')]},'agentUrl':{'type':Sequelize[_0xa63d('0x1')]},'scriptName':{'type':Sequelize[_0xa63d('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b33ef2a..f87321f 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 _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 +var _0x5ec0=['\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','encoding','method','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./plugin.socket','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','get','Plugins','destroy','end','error','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','download','join','root','server/files/plugins','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','dirname','basename','node_modules/**/*','format','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','html','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','test','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet'];(function(_0xbc2974,_0xec3342){var _0x3a5b4f=function(_0x5ec5b5){while(--_0x5ec5b5){_0xbc2974['push'](_0xbc2974['shift']());}};_0x3a5b4f(++_0xec3342);}(_0x5ec0,0xb3));var _0x05ec=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5ec0[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x05ec('0x0'));var rimraf=require(_0x05ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05ec('0x2'));var rp=require(_0x05ec('0x3'));var moment=require('moment');var BPromise=require(_0x05ec('0x4'));var Mustache=require('mustache');var util=require(_0x05ec('0x5'));var path=require(_0x05ec('0x6'));var sox=require(_0x05ec('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05ec('0x8'));var _=require(_0x05ec('0x9'));var squel=require(_0x05ec('0xa'));var crypto=require('crypto');var jsforce=require(_0x05ec('0xb'));var deskjs=require(_0x05ec('0xc'));var toCsv=require(_0x05ec('0xd'));var querystring=require(_0x05ec('0xe'));var Papa=require(_0x05ec('0xf'));var extract=require('extract-zip');var rimraf=require(_0x05ec('0x1'));var archiver=require(_0x05ec('0x10'));var Redis=require(_0x05ec('0x11'));var authService=require(_0x05ec('0x12'));var qs=require(_0x05ec('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05ec('0x14'));var logger=require(_0x05ec('0x15'))(_0x05ec('0x16'));var utils=require(_0x05ec('0x17'));var config=require(_0x05ec('0x18'));var licenseUtil=require(_0x05ec('0x19'));var db=require(_0x05ec('0x1a'))['db'];config[_0x05ec('0x1b')]=_['defaults'](config[_0x05ec('0x1b')],{'host':_0x05ec('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05ec('0x1b')]));require(_0x05ec('0x1d'))['register'](socket);function respondWithStatusCode(_0x2500ad,_0x4fe7ce){_0x4fe7ce=_0x4fe7ce||0xcc;return function(_0x40c5d0){if(_0x40c5d0){return _0x2500ad[_0x05ec('0x1e')](_0x4fe7ce);}return _0x2500ad['status'](_0x4fe7ce)['end']();};}function respondWithResult(_0x264dbe,_0x25ce8c){_0x25ce8c=_0x25ce8c||0xc8;return function(_0x2f05a2){if(_0x2f05a2){return _0x264dbe[_0x05ec('0x1f')](_0x25ce8c)[_0x05ec('0x20')](_0x2f05a2);}};}function respondWithFilteredResult(_0x21a49d,_0x44a244){return function(_0x5a0faf){if(_0x5a0faf){var _0x187cbe=typeof _0x44a244['offset']===_0x05ec('0x21')&&typeof _0x44a244[_0x05ec('0x22')]===_0x05ec('0x21');var _0x22dd63=_0x5a0faf['count'];var _0x20eb98=_0x187cbe?0x0:_0x44a244[_0x05ec('0x23')];var _0x48c9dc=_0x187cbe?_0x5a0faf[_0x05ec('0x24')]:_0x44a244[_0x05ec('0x23')]+_0x44a244[_0x05ec('0x22')];var _0x9fd5cc;if(_0x48c9dc>=_0x22dd63){_0x48c9dc=_0x22dd63;_0x9fd5cc=0xc8;}else{_0x9fd5cc=0xce;}_0x21a49d[_0x05ec('0x1f')](_0x9fd5cc);return _0x21a49d[_0x05ec('0x25')](_0x05ec('0x26'),_0x20eb98+'-'+_0x48c9dc+'/'+_0x22dd63)['json'](_0x5a0faf);}return null;};}function patchUpdates(_0x985bdc){return function(_0x385208){try{jsonpatch['apply'](_0x385208,_0x985bdc,!![]);}catch(_0x5812ea){return BPromise[_0x05ec('0x27')](_0x5812ea);}return _0x385208[_0x05ec('0x28')]();};}function saveUpdates(_0x2ce975,_0x30803f){return function(_0x42cb34){if(_0x42cb34){return _0x42cb34['update'](_0x2ce975)[_0x05ec('0x29')](function(_0x23648a){return _0x23648a;});}return null;};}function removeEntity(_0x30156b,_0x1adfe8){return function(_0x2086a9){if(_0x2086a9){return _0x2086a9['destroy']()['then'](function(){var _0x3789b1=_0x2086a9[_0x05ec('0x2a')]({'plain':!![]});var _0x81fe3a=_0x05ec('0x2b');return db['UserProfileResource'][_0x05ec('0x2c')]({'where':{'type':_0x81fe3a,'resourceId':_0x3789b1['id']}})[_0x05ec('0x29')](function(){return _0x2086a9;});})[_0x05ec('0x29')](function(){_0x30156b['status'](0xcc)[_0x05ec('0x2d')]();});}};}function handleEntityNotFound(_0x2966d0,_0x286f20){return function(_0x2620b7){if(!_0x2620b7){_0x2966d0[_0x05ec('0x1e')](0x194);}return _0x2620b7;};}function handleError(_0x29497e,_0x4f539c){_0x4f539c=_0x4f539c||0x1f4;return function(_0x294626){logger[_0x05ec('0x2e')](_0x294626['stack']);if(_0x294626[_0x05ec('0x2f')]){delete _0x294626['name'];}_0x29497e[_0x05ec('0x1f')](_0x4f539c)[_0x05ec('0x30')](_0x294626);};}exports['index']=function(_0x34c3a8,_0x90296d){var _0x44fe85={},_0x5a029e={},_0x389b66={'count':0x0,'rows':[]};var _0xf77997=_[_0x05ec('0x31')](db[_0x05ec('0x32')][_0x05ec('0x33')],function(_0x6e8bc9){return{'name':_0x6e8bc9[_0x05ec('0x34')],'type':_0x6e8bc9[_0x05ec('0x35')][_0x05ec('0x36')]};});_0x5a029e[_0x05ec('0x37')]=_['map'](_0xf77997,_0x05ec('0x2f'));_0x5a029e[_0x05ec('0x38')]=_[_0x05ec('0x39')](_0x34c3a8['query']);_0x5a029e[_0x05ec('0x3a')]=_[_0x05ec('0x3b')](_0x5a029e[_0x05ec('0x37')],_0x5a029e[_0x05ec('0x38')]);_0x44fe85[_0x05ec('0x3c')]=_[_0x05ec('0x3b')](_0x5a029e['model'],qs['fields'](_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x3d')]));_0x44fe85[_0x05ec('0x3c')]=_0x44fe85[_0x05ec('0x3c')][_0x05ec('0x3e')]?_0x44fe85['attributes']:_0x5a029e[_0x05ec('0x37')];if(!_0x34c3a8[_0x05ec('0x38')]['hasOwnProperty'](_0x05ec('0x3f'))){_0x44fe85[_0x05ec('0x22')]=qs[_0x05ec('0x22')](_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x22')]);_0x44fe85[_0x05ec('0x23')]=qs['offset'](_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x23')]);}_0x44fe85[_0x05ec('0x40')]=qs[_0x05ec('0x41')](_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x41')]);_0x44fe85[_0x05ec('0x42')]=qs[_0x05ec('0x3a')](_[_0x05ec('0x43')](_0x34c3a8['query'],_0x5a029e[_0x05ec('0x3a')]),_0xf77997);if(_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x44')]){_0x44fe85[_0x05ec('0x42')]=_[_0x05ec('0x45')](_0x44fe85['where'],{'$or':_[_0x05ec('0x31')](_0xf77997,function(_0x4205aa){if(_0x4205aa[_0x05ec('0x35')]!==_0x05ec('0x46')){var _0x2df5bf={};_0x2df5bf[_0x4205aa[_0x05ec('0x2f')]]={'$like':'%'+_0x34c3a8['query'][_0x05ec('0x44')]+'%'};return _0x2df5bf;}})});}_0x44fe85=_[_0x05ec('0x45')]({},_0x44fe85,_0x34c3a8[_0x05ec('0x47')]);var _0x5c714c={'where':_0x44fe85['where']};return db[_0x05ec('0x32')]['count'](_0x5c714c)[_0x05ec('0x29')](function(_0x2cd398){_0x389b66[_0x05ec('0x24')]=_0x2cd398;if(_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x48')]){_0x44fe85[_0x05ec('0x49')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x44fe85);})[_0x05ec('0x29')](function(_0x2b9e62){_0x389b66['rows']=_0x2b9e62;return _0x389b66;})[_0x05ec('0x29')](respondWithFilteredResult(_0x90296d,_0x44fe85))[_0x05ec('0x4a')](handleError(_0x90296d,null));};exports[_0x05ec('0x4b')]=function(_0x25f97e,_0x3a447c){var _0x571189={'raw':!![],'where':{'id':_0x25f97e[_0x05ec('0x4c')]['id']}},_0x2eede2={};_0x2eede2[_0x05ec('0x37')]=_['keys'](db['Plugin']['rawAttributes']);_0x2eede2[_0x05ec('0x38')]=_[_0x05ec('0x39')](_0x25f97e[_0x05ec('0x38')]);_0x2eede2[_0x05ec('0x3a')]=_[_0x05ec('0x3b')](_0x2eede2[_0x05ec('0x37')],_0x2eede2[_0x05ec('0x38')]);_0x571189['attributes']=_[_0x05ec('0x3b')](_0x2eede2[_0x05ec('0x37')],qs[_0x05ec('0x3d')](_0x25f97e[_0x05ec('0x38')]['fields']));_0x571189[_0x05ec('0x3c')]=_0x571189[_0x05ec('0x3c')][_0x05ec('0x3e')]?_0x571189[_0x05ec('0x3c')]:_0x2eede2[_0x05ec('0x37')];if(_0x25f97e[_0x05ec('0x38')][_0x05ec('0x48')]){_0x571189['include']=[{'all':!![]}];}_0x571189=_['merge']({},_0x571189,_0x25f97e[_0x05ec('0x47')]);return db[_0x05ec('0x32')][_0x05ec('0x4d')](_0x571189)['then'](handleEntityNotFound(_0x3a447c,null))[_0x05ec('0x29')](respondWithResult(_0x3a447c,null))['catch'](handleError(_0x3a447c,null));};exports[_0x05ec('0x4e')]=function(_0x1bcf7f,_0x34985f,_0x15316d){return db[_0x05ec('0x32')][_0x05ec('0x4d')]({'where':{'id':_0x1bcf7f[_0x05ec('0x4c')]['id']},'attributes':['name','path'],'raw':!![]})['then'](handleEntityNotFound(_0x34985f,null))[_0x05ec('0x29')](function(_0x521136){if(_0x521136){var _0xe5d605=path[_0x05ec('0x4f')](config[_0x05ec('0x50')],_0x05ec('0x51'),util['format']('%s.zip',path['basename'](_0x521136[_0x05ec('0x6')])));var _0x5984f7=fs[_0x05ec('0x52')](_0xe5d605);var _0x465493=archiver(_0x05ec('0x53'),{'zlib':{'level':0x9}});_0x465493['on'](_0x05ec('0x54'),function(_0x377cec){if(_0x377cec[_0x05ec('0x55')]===_0x05ec('0x56')){logger[_0x05ec('0x2e')](_0x377cec);}else{throw new db['Sequelize'][(_0x05ec('0x57'))](_0x05ec('0x58'));}});_0x465493['on'](_0x05ec('0x2e'),function(_0x13e618){throw new db[(_0x05ec('0x59'))][(_0x05ec('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x465493[_0x05ec('0x5a')](_0x5984f7);_0x465493[_0x05ec('0x5b')]('**/*',{'cwd':path['join'](config[_0x05ec('0x50')],_0x05ec('0x51'),path[_0x05ec('0x5c')](_0x521136[_0x05ec('0x6')])),'ignore':[path[_0x05ec('0x4f')](path[_0x05ec('0x5d')](_0x521136[_0x05ec('0x6')]),_0x05ec('0x5e')),path['join'](path[_0x05ec('0x5d')](_0x521136[_0x05ec('0x6')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x5984f7['on']('close',function(){if(!fs['existsSync'](_0xe5d605)){throw new db[(_0x05ec('0x59'))][(_0x05ec('0x57'))]('Plugin\x20not\x20found');}return _0x34985f[_0x05ec('0x4e')](_0xe5d605,util[_0x05ec('0x5f')](_0x05ec('0x60'),path[_0x05ec('0x5d')](_0x521136[_0x05ec('0x6')])),function(_0x542148){if(_0x542148){throw new db[(_0x05ec('0x59'))][(_0x05ec('0x57'))](_0x05ec('0x61'));}fs[_0x05ec('0x62')](_0xe5d605);logger['info'](_0x05ec('0x63'));logger[_0x05ec('0x64')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x34985f,null));};exports['upload']=function(_0x3c73bf,_0x39ff27,_0xfc0989){var _0x15c3a2=path[_0x05ec('0x5d')](_0x3c73bf['file'][_0x05ec('0x65')],path['extname'](_0x3c73bf['file'][_0x05ec('0x65')]));var _0x41b725=path[_0x05ec('0x4f')](config['root'],_0x05ec('0x51'),_0x3c73bf[_0x05ec('0x66')][_0x05ec('0x65')]);var _0x32de88=path[_0x05ec('0x4f')](config[_0x05ec('0x50')],'server/files/plugins',_0x15c3a2);logger[_0x05ec('0x64')](_0x05ec('0x67'),_0x41b725);logger['info'](_0x05ec('0x68'),_0x32de88);try{fs[_0x05ec('0x69')](_0x41b725,parseInt('0777',0x8));extract(_0x41b725,{'dir':_0x32de88},function(_0xc897fe){if(_0xc897fe){logger['error'](_0xc897fe);handleError(_0xc897fe,!![]);};var _0x4203fd=fs[_0x05ec('0x6a')](_0x32de88);if(_0x4203fd[_0x05ec('0x3e')]>0x1){removeReferences(_0x41b725,_0x32de88);logger['error'](_0x05ec('0x6b'));return _0xfc0989(new Error(_0x05ec('0x6b')));}var _0x4de288=fs[_0x05ec('0x6c')](path[_0x05ec('0x4f')](_0x32de88,_0x4203fd[0x0]));if(_0x4de288[_0x05ec('0x6d')]()){removeReferences(_0x41b725,_0x32de88);logger[_0x05ec('0x2e')](_0x05ec('0x6b'));return _0xfc0989(new Error(_0x05ec('0x6b')));}if(_0x4de288[_0x05ec('0x6e')]()){var _0x344087=fs[_0x05ec('0x6a')](path['join'](_0x32de88,_0x4203fd[0x0]));if(_0x344087[_0x05ec('0x3e')]===0x0){removeReferences(_0x41b725,_0x32de88);logger[_0x05ec('0x2e')](_0x05ec('0x6b'));return _0xfc0989(new Error(_0x05ec('0x6b')));}var _0x4fe84f=_0x344087[_0x05ec('0x6f')](function(_0x4a85de){return _0x4a85de===_0x05ec('0x70');});if(!_0x4fe84f){return _0xfc0989(new Error(_0x05ec('0x71')));}var _0x64ab1a=fs[_0x05ec('0x72')](path[_0x05ec('0x4f')](_0x32de88,_0x4203fd[0x0],_0x05ec('0x70')));var _0x209cd9=JSON[_0x05ec('0x73')](_0x64ab1a);if(_0x05ec('0x21')==typeof _0x209cd9[_0x05ec('0x2f')]){return _0xfc0989(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x05ec('0x21')==typeof _0x209cd9[_0x05ec('0x35')]){return _0xfc0989(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x05ec('0x21')==typeof _0x209cd9['version']){return _0xfc0989(new Error(_0x05ec('0x74')));}if(_0x05ec('0x21')==typeof _0x209cd9[_0x05ec('0x75')]){return _0xfc0989(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x209cd9['type']==='html'){if('undefined'==typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x76')]){return _0xfc0989(new Error(_0x05ec('0x77')));}if(_0x05ec('0x21')==typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x76')]['admin']&&'undefined'==typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x76')][_0x05ec('0x78')]){return _0xfc0989(new Error(_0x05ec('0x79')));}}else if(_0x209cd9[_0x05ec('0x35')]===_0x05ec('0x7a')){if('undefined'==typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x7b')]){return _0xfc0989(new Error(_0x05ec('0x7c')));}if(_0x05ec('0x21')==typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x7d')]){return _0xfc0989(new Error(_0x05ec('0x7e')));}}else{return _0xfc0989(new Error(_0x05ec('0x7f')));}var _0x3ba93e=_0x209cd9[_0x05ec('0x2f')];var _0x460ebc=_0x209cd9[_0x05ec('0x80')];var _0x265115=_0x209cd9[_0x05ec('0x35')];var _0x22428e=_0x209cd9[_0x05ec('0x81')]?_0x209cd9[_0x05ec('0x81')]:'always';var _0x3046ff=_0x209cd9[_0x05ec('0x82')]?_0x209cd9[_0x05ec('0x82')]:_0x05ec('0x83');var _0x467692='';var _0xd97dc8='';var _0xd3f4d9='';var _0x5327a8='';var _0xc18127=_0x209cd9['version'];if(_0x265115===_0x05ec('0x84')){if(_0x05ec('0x21')!=typeof _0x209cd9['parameters'][_0x05ec('0x76')][_0x05ec('0x85')]){var _0x23ca48=_0x209cd9[_0x05ec('0x75')]['views'][_0x05ec('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x23ca48)){_0x467692=path['join'](_0x05ec('0x86'),_0x15c3a2,_0x4203fd[0x0],_0x23ca48);}else{_0x467692=_0x23ca48;}}else{logger['info'](_0x05ec('0x87'));}if(_0x05ec('0x21')!=typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x76')][_0x05ec('0x78')]){var _0x44506b=_0x209cd9['parameters']['views'][_0x05ec('0x78')];if(!/^(f|ht)tps?:\/\//i['test'](_0x44506b)){_0xd97dc8=path[_0x05ec('0x4f')](_0x05ec('0x86'),_0x15c3a2,_0x4203fd[0x0],_0x44506b);}else{_0xd97dc8=_0x44506b;}}else{logger[_0x05ec('0x64')](_0x05ec('0x88'));}}else if(_0x265115===_0x05ec('0x7a')){_0xd3f4d9=_0x209cd9[_0x05ec('0x75')][_0x05ec('0x7b')];_0x5327a8=_0x209cd9[_0x05ec('0x75')]['scriptPath'];if(_0x05ec('0x21')!=typeof _0x209cd9[_0x05ec('0x75')]['views']){if(_0x05ec('0x21')!=typeof _0x209cd9['parameters']['views'][_0x05ec('0x85')]){var _0x23ca48=_0x209cd9[_0x05ec('0x75')]['views'][_0x05ec('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x05ec('0x89')](_0x23ca48)){_0x467692=path[_0x05ec('0x4f')](_0x05ec('0x86'),_0x15c3a2,_0x4203fd[0x0],_0x23ca48);}else{_0x467692=_0x23ca48;}}if(_0x05ec('0x21')!=typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x76')][_0x05ec('0x78')]){var _0x44506b=_0x209cd9[_0x05ec('0x75')]['views'][_0x05ec('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x05ec('0x89')](_0x44506b)){_0xd97dc8=path[_0x05ec('0x4f')]('plugins',_0x15c3a2,_0x4203fd[0x0],_0x44506b);}else{_0xd97dc8=_0x44506b;}}}}var _0x3db196={'name':_0x3ba93e,'description':_0x460ebc,'path':path[_0x05ec('0x4f')](_0x15c3a2,_0x4203fd[0x0]),'type':_0x265115,'sidebar':_0x22428e,'icon':_0x3046ff,'adminUrl':_0x467692,'agentUrl':_0xd97dc8,'scriptName':_0xd3f4d9,'scriptPath':_0x5327a8,'version':_0xc18127};removeReferences(_0x41b725,null);return db[_0x05ec('0x32')]['create'](_0x3db196)[_0x05ec('0x29')](function(_0x560cdf){var _0x201030={'role':_0x3c73bf[_0x05ec('0x8a')][_0x05ec('0x8b')],'userProfileId':_0x3c73bf[_0x05ec('0x8a')][_0x05ec('0x8c')]};if(!_0x201030)throw new Error(_0x05ec('0x8d'));if(_0x201030[_0x05ec('0x8b')]===_0x05ec('0x8e')){var _0x537af7=_0x560cdf[_0x05ec('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0x05ec('0x4d')]({'where':{'name':_0x05ec('0x2b'),'userProfileId':_0x201030[_0x05ec('0x8c')]},'raw':!![]})['then'](function(_0x53ab9e){if(_0x53ab9e&&_0x53ab9e['autoAssociation']===0x0){return db[_0x05ec('0x8f')]['create']({'name':_0x537af7[_0x05ec('0x2f')],'resourceId':_0x537af7['id'],'type':_0x53ab9e[_0x05ec('0x2f')],'sectionId':_0x53ab9e['id']},{})[_0x05ec('0x29')](function(){return _0x560cdf;});}else{return _0x560cdf;}})[_0x05ec('0x4a')](function(_0x32b838){logger['error'](_0x05ec('0x90'),_0x32b838);throw _0x32b838;});}return _0x560cdf;})[_0x05ec('0x29')](respondWithResult(_0x39ff27,null))[_0x05ec('0x4a')](handleError(_0x39ff27,null));}});}catch(_0x10ffb3){_0x39ff27[_0x05ec('0x1f')](0x1f4)['send'](_0x10ffb3);}};function removeReferences(_0x5d8770,_0x2d54da){try{if(_0x5d8770){fs[_0x05ec('0x62')](_0x5d8770);logger['info'](_0x05ec('0x91'));}if(_0x2d54da){rimraf(_0x2d54da,function(){});logger[_0x05ec('0x64')](_0x05ec('0x92'));}}catch(_0x1b8861){logger[_0x05ec('0x2e')](_0x1b8861);}}exports[_0x05ec('0x93')]=function(_0x359bc0,_0x206499,_0x48ea13){return db['Plugin'][_0x05ec('0x4d')]({'where':{'id':_0x359bc0['params']['id']}})[_0x05ec('0x29')](handleEntityNotFound(_0x206499,null))['then'](saveUpdates(_0x359bc0[_0x05ec('0x8a')],null))[_0x05ec('0x29')](respondWithResult(_0x206499,null))['catch'](handleError(_0x206499,null));};exports['delete']=function(_0x521363,_0x353144,_0x504da1){return db['Plugin'][_0x05ec('0x4d')]({'where':{'id':_0x521363[_0x05ec('0x4c')]['id']}})[_0x05ec('0x29')](function(_0x4f9a36){if(_0x4f9a36){return _0x4f9a36['destroy']();}})[_0x05ec('0x29')](function(_0x3b7f5f){rimraf(path[_0x05ec('0x4f')](config['root'],_0x05ec('0x51'),path['dirname'](_0x3b7f5f[_0x05ec('0x6')])),function(){});return _0x3b7f5f;})['then'](handleEntityNotFound(_0x353144,null))[_0x05ec('0x29')](respondWithStatusCode(_0x353144,null))[_0x05ec('0x4a')](handleError(_0x353144,null));};exports[_0x05ec('0x94')]=function(_0x14c217,_0x4be229,_0x4244cb){return BPromise['resolve']()['then'](function(){if(!_0x14c217[_0x05ec('0x38')][_0x05ec('0x6')]){throw new Error(_0x05ec('0x95'));}if(!_0x14c217['query'][_0x05ec('0x96')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x53bf86=_0x14c217[_0x05ec('0x38')][_0x05ec('0x97')]?_0x14c217[_0x05ec('0x38')][_0x05ec('0x97')]+':'+_0x14c217[_0x05ec('0x38')][_0x05ec('0x96')]:_0x05ec('0x98')+_0x14c217['query'][_0x05ec('0x96')];var _0x40afd5=_0x14c217[_0x05ec('0x38')][_0x05ec('0x20')]?_0x14c217['query'][_0x05ec('0x20')]:!![];var _0x3f91eb=_0x14c217['query']['encoding']?_0x14c217[_0x05ec('0x38')]['encoding']:null;var _0x6b1f0b={'method':_0x14c217['method'],'uri':util[_0x05ec('0x5f')](_0x05ec('0x99'),_0x53bf86,_0x14c217[_0x05ec('0x38')][_0x05ec('0x6')]),'json':_0x40afd5,'resolveWithFullResponse':!![],'encoding':_0x3f91eb,'qs':_0x14c217['query']};if(_0x14c217[_0x05ec('0x9a')]){_0x6b1f0b[_0x05ec('0x9a')]=_0x14c217['headers'];if(_0x6b1f0b[_0x05ec('0x9a')][_0x05ec('0x9b')]){delete _0x6b1f0b[_0x05ec('0x9a')][_0x05ec('0x9b')];}}if(_0x6b1f0b[_0x05ec('0x9a')][_0x05ec('0x9c')]){delete _0x6b1f0b['headers'][_0x05ec('0x9c')];}return rp(_0x6b1f0b);})['then'](function(_0x250154){if(_0x250154){_0x4be229[_0x05ec('0x25')](_0x250154['headers']);logger[_0x05ec('0x64')](_0x250154[_0x05ec('0x8a')]);if(_[_0x05ec('0x9d')](_0x14c217[_0x05ec('0x38')][_0x05ec('0x6')],_0x05ec('0x4e'))&&_0x250154[_0x05ec('0x9e')]==0x1f4){return _0x4be229[_0x05ec('0x1e')](_0x250154[_0x05ec('0x9e')]);}else{return _0x4be229[_0x05ec('0x1f')](_0x250154['statusCode'])['send'](_0x250154[_0x05ec('0x8a')]);}}else{return _0x4be229[_0x05ec('0x1e')](0xc8);}})[_0x05ec('0x4a')](handleError(_0x4be229,null));};exports[_0x05ec('0x9f')]=function(_0x2270c3,_0x8e32c0,_0x4aeb44){return BPromise[_0x05ec('0xa0')]()[_0x05ec('0x29')](function(){if(!_0x2270c3[_0x05ec('0x38')][_0x05ec('0x6')]){throw new Error(_0x05ec('0x95'));}if(!_0x2270c3[_0x05ec('0x38')][_0x05ec('0x96')]){throw new Error(_0x05ec('0xa1'));}var _0x127727=_0x2270c3['query'][_0x05ec('0x97')]?_0x2270c3[_0x05ec('0x38')][_0x05ec('0x97')]+':'+_0x2270c3[_0x05ec('0x38')][_0x05ec('0x96')]:_0x05ec('0x98')+_0x2270c3['query'][_0x05ec('0x96')];var _0x284d6f=_0x2270c3[_0x05ec('0x38')][_0x05ec('0x20')]?_0x2270c3[_0x05ec('0x38')]['json']:!![];var _0x58f455=_0x2270c3[_0x05ec('0x38')][_0x05ec('0xa2')]?_0x2270c3[_0x05ec('0x38')][_0x05ec('0xa2')]:null;var _0x2dfda3={'method':_0x2270c3[_0x05ec('0xa3')],'uri':util[_0x05ec('0x5f')](_0x05ec('0x99'),_0x127727,_0x2270c3['query']['path']),'json':_0x284d6f,'resolveWithFullResponse':!![],'encoding':_0x58f455,'body':_0x2270c3[_0x05ec('0x8a')]};if(_0x2270c3['headers']){_0x2dfda3[_0x05ec('0x9a')]=_0x2270c3['headers'];if(_0x2dfda3[_0x05ec('0x9a')][_0x05ec('0x9b')]){delete _0x2dfda3['headers']['content-length'];}}if(_0x2dfda3[_0x05ec('0x9a')][_0x05ec('0x9c')]){delete _0x2dfda3[_0x05ec('0x9a')][_0x05ec('0x9c')];}return rp(_0x2dfda3);})[_0x05ec('0x29')](function(_0x85363e){if(_0x85363e){_0x8e32c0[_0x05ec('0x25')](_0x85363e[_0x05ec('0x9a')]);logger[_0x05ec('0x64')](_0x85363e[_0x05ec('0x8a')]);return _0x8e32c0[_0x05ec('0x1f')](_0x85363e[_0x05ec('0x9e')])[_0x05ec('0x30')](_0x85363e[_0x05ec('0x8a')]);}else{return _0x8e32c0[_0x05ec('0x1e')](0xc8);}})['catch'](handleError(_0x8e32c0,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 64eea82..17d2e61 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 _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 +var _0x979e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','update'];(function(_0x529a2d,_0xc0dc7){var _0x388e94=function(_0x54b87f){while(--_0x54b87f){_0x529a2d['push'](_0x529a2d['shift']());}};_0x388e94(++_0xc0dc7);}(_0x979e,0x195));var _0xe979=function(_0x533da3,_0x24b542){_0x533da3=_0x533da3-0x0;var _0x18354d=_0x979e[_0x533da3];return _0x18354d;};'use strict';var EventEmitter=require(_0xe979('0x0'));var Plugin=require(_0xe979('0x1'))['db'][_0xe979('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe979('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe979('0x4'),'afterDestroy':_0xe979('0x5')};function emitEvent(_0x386036){return function(_0x3b4b06,_0x2d62dd,_0x5afb7f){PluginEvents[_0xe979('0x6')](_0x386036+':'+_0x3b4b06['id'],_0x3b4b06);PluginEvents['emit'](_0x386036,_0x3b4b06);_0x5afb7f(null);};}for(var e in events){if(events[_0xe979('0x7')](e)){var event=events[e];Plugin[_0xe979('0x8')](e,emitEvent(event));}}module[_0xe979('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index a2a4897..4368241 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 _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 +var _0x13f6=['plugins','util','api','moment','path','rimraf'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x13f6,0xaf));var _0x613f=function(_0xa6ff4,_0x19bc12){_0xa6ff4=_0xa6ff4-0x0;var _0x6affe6=_0x13f6[_0xa6ff4];return _0x6affe6;};'use strict';var _=require('lodash');var util=require(_0x613f('0x0'));var logger=require('../../config/logger')(_0x613f('0x1'));var moment=require(_0x613f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x613f('0x3'));var rimraf=require(_0x613f('0x4'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module['exports']=function(_0x48618b,_0x389d76){return _0x48618b['define']('Plugin',attributes,{'tableName':_0x613f('0x5'),'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 fceb363..9d8ab30 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 _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 +var _0x97bb=['client','http','defaults','redis','./plugin.socket','request','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','create','body','options','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x17bfbe,_0x83257f){var _0x3666e2=function(_0x41fb6b){while(--_0x41fb6b){_0x17bfbe['push'](_0x17bfbe['shift']());}};_0x3666e2(++_0x83257f);}(_0x97bb,0x1c2));var _0xb97b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x97bb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb97b('0x0'));var util=require(_0xb97b('0x1'));var moment=require(_0xb97b('0x2'));var BPromise=require(_0xb97b('0x3'));var rs=require(_0xb97b('0x4'));var fs=require('fs');var Redis=require(_0xb97b('0x5'));var db=require(_0xb97b('0x6'))['db'];var utils=require(_0xb97b('0x7'));var logger=require(_0xb97b('0x8'))(_0xb97b('0x9'));var config=require(_0xb97b('0xa'));var jayson=require(_0xb97b('0xb'));var client=jayson[_0xb97b('0xc')][_0xb97b('0xd')]({'port':0x232a});config['redis']=_[_0xb97b('0xe')](config[_0xb97b('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb97b('0xf')]));require(_0xb97b('0x10'))['register'](socket);function respondWithRpcPromise(_0x124c42,_0x31e692,_0x4be741){return new BPromise(function(_0x307e41,_0x4611e4){return client[_0xb97b('0x11')](_0x124c42,_0x4be741)['then'](function(_0x2d84c9){logger['info'](_0xb97b('0x12'),_0x31e692,'request\x20sent');logger[_0xb97b('0x13')](_0xb97b('0x14'),_0x31e692,_0xb97b('0x15'),JSON[_0xb97b('0x16')](_0x2d84c9));if(_0x2d84c9['error']){if(_0x2d84c9[_0xb97b('0x17')][_0xb97b('0x18')]===0x1f4){logger[_0xb97b('0x17')](_0xb97b('0x12'),_0x31e692,_0x2d84c9['error'][_0xb97b('0x19')]);return _0x4611e4(_0x2d84c9['error'][_0xb97b('0x19')]);}logger[_0xb97b('0x17')](_0xb97b('0x12'),_0x31e692,_0x2d84c9[_0xb97b('0x17')][_0xb97b('0x19')]);return _0x307e41(_0x2d84c9[_0xb97b('0x17')][_0xb97b('0x19')]);}else{logger[_0xb97b('0x1a')](_0xb97b('0x12'),_0x31e692,'request\x20sent');_0x307e41(_0x2d84c9[_0xb97b('0x1b')][_0xb97b('0x19')]);}})[_0xb97b('0x1c')](function(_0x71ed08){logger[_0xb97b('0x17')](_0xb97b('0x12'),_0x31e692,_0x71ed08);_0x4611e4(_0x71ed08);});});}exports['CreatePlugin']=function(_0x1900ab){var _0x2756f0=this;return new Promise(function(_0x44946f,_0x21dcf6){return db['Plugin'][_0xb97b('0x1d')](_0x1900ab[_0xb97b('0x1e')],{'raw':_0x1900ab['options']?_0x1900ab[_0xb97b('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5871fe){logger['info'](_0xb97b('0x20'),_0x1900ab);logger[_0xb97b('0x13')](_0xb97b('0x20'),_0x1900ab,JSON[_0xb97b('0x16')](_0x5871fe));_0x44946f(_0x5871fe);})[_0xb97b('0x1c')](function(_0x54d8b3){logger[_0xb97b('0x17')]('CreatePlugin',_0x54d8b3[_0xb97b('0x19')],_0x1900ab);_0x21dcf6(_0x2756f0[_0xb97b('0x17')](0x1f4,_0x54d8b3[_0xb97b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ba46255..0846611 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 _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 +var _0x34af=['plugin:','save','remove','update','emit','removeListener','register','length'];(function(_0x36f37b,_0x36ea03){var _0x249634=function(_0x1cde21){while(--_0x1cde21){_0x36f37b['push'](_0x36f37b['shift']());}};_0x249634(++_0x36ea03);}(_0x34af,0x111));var _0xf34a=function(_0x152f25,_0x4d21d4){_0x152f25=_0x152f25-0x0;var _0x49d957=_0x34af[_0x152f25];return _0x49d957;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xf34a('0x0'),_0xf34a('0x1'),_0xf34a('0x2')];function createListener(_0x427c41,_0x4164de){return function(_0x4e0072){_0x4164de[_0xf34a('0x3')](_0x427c41,_0x4e0072);};}function removeListener(_0x90db31,_0x109903){return function(){PluginEvents[_0xf34a('0x4')](_0x90db31,_0x109903);};}exports[_0xf34a('0x5')]=function(_0x5ab794){for(var _0x3ae062=0x0,_0x5dc980=events[_0xf34a('0x6')];_0x3ae062<_0x5dc980;_0x3ae062++){var _0x155a70=events[_0x3ae062];var _0x5c3486=createListener(_0xf34a('0x7')+_0x155a70,_0x5ab794);PluginEvents['on'](_0x155a70,_0x5c3486);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 83e4529..90e5472 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(_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 +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x174d5f,_0xbc80c3){var _0x6b2305=function(_0x40e5f6){while(--_0x40e5f6){_0x174d5f['push'](_0x174d5f['shift']());}};_0x6b2305(++_0xbc80c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 719e22e..ddd9b50 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 _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 +var _0xe5b5=['../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','then','reject','motion2','length','show','describe','catch','body','script','join','../../files/plugins','chdir','dirname','start','dump','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2'];(function(_0x513ee5,_0x4bcd35){var _0x293713=function(_0x1610b8){while(--_0x1610b8){_0x513ee5['push'](_0x513ee5['shift']());}};_0x293713(++_0x4bcd35);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0xe5b5[_0x2e76a7];return _0x454cde;};'use strict';var _=require(_0x5e5b('0x0'));var pm2=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var path=require(_0x5e5b('0x4'));var exec=require(_0x5e5b('0x5'))[_0x5e5b('0x6')];var BPromise=require(_0x5e5b('0x7'));function handleEntityNotFound(_0xf20c6a,_0x20a50c){return function(_0xdc6616){if(!_0xdc6616){_0xf20c6a[_0x5e5b('0x8')](0x194);;}return _0xdc6616;};}function respondWithResult(_0xf1fbe2,_0x11e0e0){_0x11e0e0=_0x11e0e0||0xc8;return function(_0x545eb3){if(_0x545eb3){return _0xf1fbe2[_0x5e5b('0x9')](_0x11e0e0)[_0x5e5b('0xa')](_0x545eb3);}return null;};}function handleError(_0xcbd478,_0x258414){_0x258414=_0x258414||0x1f4;return function(_0xb9d72b){logger[_0x5e5b('0xb')](_0xb9d72b[_0x5e5b('0xc')]);if(_0xb9d72b[_0x5e5b('0xd')]){delete _0xb9d72b['name'];}_0xcbd478[_0x5e5b('0x9')](_0x258414)['send'](_0xb9d72b);};}function execChildProcess(){return new BPromise(function(_0x108c34,_0x58185){exec(_0x5e5b('0xe'),function(_0x3f64b6,_0x55c974,_0x4a1424){logger['info'](_0x55c974);logger[_0x5e5b('0xf')](_0x4a1424);if(_0x3f64b6){logger[_0x5e5b('0xb')](_0x3f64b6);return _0x58185(_0x3f64b6);}return _0x108c34(_0x55c974);});});}exports[_0x5e5b('0x10')]=function(_0x1694ff,_0x13a01e){return pm2[_0x5e5b('0x11')]()[_0x5e5b('0x12')](function(_0x49edd0){if(_0x49edd0){var _0x2b37fa=_[_0x5e5b('0x13')](_0x49edd0,function(_0x4ff37b){return _0x4ff37b[_0x5e5b('0xd')]==='express'||_0x4ff37b['name']===_0x5e5b('0x14');});return{'rows':_0x2b37fa,'count':_0x2b37fa[_0x5e5b('0x15')]};}return null;})[_0x5e5b('0x12')](respondWithResult(_0x13a01e,null))['catch'](handleError(_0x13a01e,null));};exports[_0x5e5b('0x16')]=function(_0x4d490c,_0x1796af){return pm2[_0x5e5b('0x17')](_0x4d490c['params']['id'])[_0x5e5b('0x12')](respondWithResult(_0x1796af,null))[_0x5e5b('0x12')](handleEntityNotFound(_0x1796af,null))[_0x5e5b('0x18')](handleError(_0x1796af,null));};exports['create']=function(_0x2bf0b7,_0x3f1103){if(_0x2bf0b7['body'][_0x5e5b('0xd')]&&_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]){var _0x2d8252=path[_0x5e5b('0x1b')](__dirname,_0x5e5b('0x1c'),_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]);var _0x4a78e3=process['cwd']();process[_0x5e5b('0x1d')](path[_0x5e5b('0x1e')](_0x2d8252));return execChildProcess()[_0x5e5b('0x12')](function(_0xe1c268){process[_0x5e5b('0x1d')](_0x4a78e3);return pm2[_0x5e5b('0x1f')]({'name':_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0xd')],'script':_0x2d8252});})[_0x5e5b('0x12')](function(_0x26bc02){pm2[_0x5e5b('0x20')]();return _0x26bc02[0x0];})['then'](respondWithResult(_0x3f1103,0xc9))[_0x5e5b('0x18')](handleError(_0x3f1103,null));}else{return _0x3f1103[_0x5e5b('0x9')](0x1f4)[_0x5e5b('0x21')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5e5b('0x22')]=function(_0xdb2863,_0x5ee866){if(_0xdb2863[_0x5e5b('0x19')]['id']){delete _0xdb2863[_0x5e5b('0x19')]['id'];}var _0x39ce16={'online':_0x5e5b('0x23'),'stopped':_0x5e5b('0x24')};if(_0x39ce16[_0x5e5b('0x25')](_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')])){return pm2[_0x39ce16[_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')]]](_0xdb2863[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](respondWithResult(_0x5ee866,0xc8))['catch'](handleError(_0x5ee866,null));}else{return _0x5ee866['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x27')});}};exports[_0x5e5b('0x28')]=function(_0x3dcdab,_0x12f1ee){if(_0x3dcdab['body']['id']){delete _0x3dcdab[_0x5e5b('0x19')]['id'];}if(_0x3dcdab['params']['id']){return pm2[_0x5e5b('0x29')](_0x3dcdab[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](function(_0xc2bc09){pm2['dump']();return _0xc2bc09[0x0];})[_0x5e5b('0x12')](respondWithResult(_0x12f1ee,null))[_0x5e5b('0x18')](handleError(_0x12f1ee,null));}else{return _0x12f1ee['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x2a')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 8a4b61b..43cfa21 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 _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 +var _0x7354=['./realtime.controller','isAuthenticated','getAgents','get','/queues','getQueues','exports','express','../../components/auth/service'];(function(_0x3e23f6,_0x5e2c5d){var _0x461c10=function(_0xa5ca53){while(--_0xa5ca53){_0x3e23f6['push'](_0x3e23f6['shift']());}};_0x461c10(++_0x5e2c5d);}(_0x7354,0x15d));var _0x4735=function(_0x204c59,_0x5614ee){_0x204c59=_0x204c59-0x0;var _0x4cd35b=_0x7354[_0x204c59];return _0x4cd35b;};'use strict';var express=require(_0x4735('0x0'));var router=express['Router']();var auth=require(_0x4735('0x1'));var controller=require(_0x4735('0x2'));router['get']('/agents',auth[_0x4735('0x3')](),controller[_0x4735('0x4')]);router[_0x4735('0x5')](_0x4735('0x6'),auth['isAuthenticated'](),controller[_0x4735('0x7')]);module[_0x4735('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 07c6c9a..85311eb 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(_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 +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(_0x4fa4e8,_0x45e204){var _0x8a08b9=function(_0xddcbb9){while(--_0xddcbb9){_0x4fa4e8['push'](_0x4fa4e8['shift']());}};_0x8a08b9(++_0x45e204);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 1f3a5ec..289de6f 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 _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 +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x228025,_0x139f58){var _0x36f26f=function(_0x334026){while(--_0x334026){_0x228025['push'](_0x228025['shift']());}};_0x36f26f(++_0x139f58);}(_0xedd9,0xfc));var _0x9edd=function(_0x247402,_0x269fc8){_0x247402=_0x247402-0x0;var _0x438ef9=_0xedd9[_0x247402];return _0x438ef9;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index cc90616..520af59 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 _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 +var _0xbfe8=['INTEGER','exports','STRING','DATE'];(function(_0x395fed,_0x553d31){var _0x32a854=function(_0x4ba6e4){while(--_0x4ba6e4){_0x395fed['push'](_0x395fed['shift']());}};_0x32a854(++_0x553d31);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x4894d3,_0x576c0c){_0x4894d3=_0x4894d3-0x0;var _0x4b0b87=_0xbfe8[_0x4894d3];return _0x4b0b87;};'use strict';var Sequelize=require('sequelize');module[_0x8bfe('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8bfe('0x1')]},'scheduledat':{'type':Sequelize[_0x8bfe('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8bfe('0x2')]},'ringtime':{'type':Sequelize[_0x8bfe('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8bfe('0x1')]},'membername':{'type':Sequelize[_0x8bfe('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 80fd3dc..473f0a8 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 _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 +var _0x7b1e=['define','ReportAgentPreview','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x47daa1,_0x456720){var _0xf6c149=function(_0x2b929f){while(--_0x2b929f){_0x47daa1['push'](_0x47daa1['shift']());}};_0xf6c149(++_0x456720);}(_0x7b1e,0x1e2));var _0xe7b1=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x7b1e[_0xf51c06];return _0x1d5420;};'use strict';var _=require(_0xe7b1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe7b1('0x1'));var moment=require('moment');var BPromise=require(_0xe7b1('0x2'));var rp=require(_0xe7b1('0x3'));var fs=require('fs');var path=require(_0xe7b1('0x4'));var rimraf=require(_0xe7b1('0x5'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x55f371,_0x2f79cd){return _0x55f371[_0xe7b1('0x6')](_0xe7b1('0x7'),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 45af317..916f0e9 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 _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 +var _0xcffa=['code','message','result','create','body','options','raw','CreateReportAgentPreview','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error'];(function(_0xd6db21,_0x1d08f3){var _0x3b96a0=function(_0x157017){while(--_0x157017){_0xd6db21['push'](_0xd6db21['shift']());}};_0x3b96a0(++_0x1d08f3);}(_0xcffa,0x96));var _0xacff=function(_0x59305b,_0x3002e5){_0x59305b=_0x59305b-0x0;var _0x47c604=_0xcffa[_0x59305b];return _0x47c604;};'use strict';var _=require(_0xacff('0x0'));var util=require(_0xacff('0x1'));var moment=require(_0xacff('0x2'));var BPromise=require('bluebird');var rs=require(_0xacff('0x3'));var fs=require('fs');var Redis=require(_0xacff('0x4'));var db=require(_0xacff('0x5'))['db'];var utils=require(_0xacff('0x6'));var logger=require('../../config/logger')(_0xacff('0x7'));var config=require(_0xacff('0x8'));var jayson=require(_0xacff('0x9'));var client=jayson[_0xacff('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29cad6,_0x4d8eed,_0x2822dc){return new BPromise(function(_0x502f17,_0x1c8927){return client['request'](_0x29cad6,_0x2822dc)[_0xacff('0xb')](function(_0x138335){logger[_0xacff('0xc')](_0xacff('0xd'),_0x4d8eed,_0xacff('0xe'));logger[_0xacff('0xf')](_0xacff('0x10'),_0x4d8eed,_0xacff('0xe'),JSON['stringify'](_0x138335));if(_0x138335[_0xacff('0x11')]){if(_0x138335['error'][_0xacff('0x12')]===0x1f4){logger[_0xacff('0x11')](_0xacff('0xd'),_0x4d8eed,_0x138335[_0xacff('0x11')]['message']);return _0x1c8927(_0x138335[_0xacff('0x11')][_0xacff('0x13')]);}logger['error'](_0xacff('0xd'),_0x4d8eed,_0x138335[_0xacff('0x11')][_0xacff('0x13')]);return _0x502f17(_0x138335['error']['message']);}else{logger[_0xacff('0xc')](_0xacff('0xd'),_0x4d8eed,_0xacff('0xe'));_0x502f17(_0x138335[_0xacff('0x14')][_0xacff('0x13')]);}})['catch'](function(_0x64768d){logger['error'](_0xacff('0xd'),_0x4d8eed,_0x64768d);_0x1c8927(_0x64768d);});});}exports['CreateReportAgentPreview']=function(_0x5954b7){var _0x64542c=this;return new Promise(function(_0x17e240,_0x334829){return db['ReportAgentPreview'][_0xacff('0x15')](_0x5954b7[_0xacff('0x16')],{'raw':_0x5954b7[_0xacff('0x17')]?_0x5954b7[_0xacff('0x17')][_0xacff('0x18')]===undefined?!![]:![]:!![]})[_0xacff('0xb')](function(_0x28a95d){logger['info'](_0xacff('0x19'),_0x5954b7);logger['debug']('CreateReportAgentPreview',_0x5954b7,JSON[_0xacff('0x1a')](_0x28a95d));_0x17e240(_0x28a95d);})[_0xacff('0x1b')](function(_0x478da6){logger[_0xacff('0x11')](_0xacff('0x19'),_0x478da6[_0xacff('0x13')],_0x5954b7);_0x334829(_0x64542c[_0xacff('0x11')](0x1f4,_0x478da6['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 468196f..06daed0 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 _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 +var _0x2f17=['/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','post','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts'];(function(_0xa599e2,_0x3046be){var _0x122f49=function(_0x4f3d6d){while(--_0x4f3d6d){_0xa599e2['push'](_0xa599e2['shift']());}};_0x122f49(++_0x3046be);}(_0x2f17,0xb9));var _0x72f1=function(_0x81e56f,_0x26c5a2){_0x81e56f=_0x81e56f-0x0;var _0x384f8b=_0x2f17[_0x81e56f];return _0x384f8b;};'use strict';var multer=require(_0x72f1('0x0'));var util=require(_0x72f1('0x1'));var path=require(_0x72f1('0x2'));var express=require(_0x72f1('0x3'));var router=express[_0x72f1('0x4')]();var auth=require(_0x72f1('0x5'));var controller=require('./rpc.controller');router[_0x72f1('0x6')](_0x72f1('0x7'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x9')]);router['get'](_0x72f1('0xa'),auth[_0x72f1('0x8')](),controller[_0x72f1('0xb')]);router[_0x72f1('0x6')](_0x72f1('0xc'),auth['isAuthenticated'](),controller[_0x72f1('0xd')]);router[_0x72f1('0x6')](_0x72f1('0xe'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x72f1('0x6')](_0x72f1('0xf'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x10')]);router['get'](_0x72f1('0x11'),auth['isAuthenticated'](),controller[_0x72f1('0x12')]);router[_0x72f1('0x6')](_0x72f1('0x13'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x14')]);router['get'](_0x72f1('0x15'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x16')]);router[_0x72f1('0x6')](_0x72f1('0x17'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x18')]);router[_0x72f1('0x6')](_0x72f1('0x19'),auth['isAuthenticated'](),controller[_0x72f1('0x1a')]);router['get'](_0x72f1('0x1b'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x1c')]);router[_0x72f1('0x6')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x72f1('0x6')]('/voice/queues/channels',auth[_0x72f1('0x8')](),controller[_0x72f1('0x1d')]);router[_0x72f1('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x72f1('0x8')](),controller['voiceQueuesChannel']);router['get'](_0x72f1('0x1e'),auth[_0x72f1('0x8')](),controller['voiceQueuesChannelHangup']);router['get'](_0x72f1('0x1f'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x20')]);router['get']('/voice/queues/:id',auth[_0x72f1('0x8')](),controller[_0x72f1('0x21')]);router[_0x72f1('0x22')]('/voice/queues/:id',auth[_0x72f1('0x8')](),controller[_0x72f1('0x23')]);router[_0x72f1('0x6')](_0x72f1('0x24'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x25')]);router[_0x72f1('0x6')](_0x72f1('0x26'),auth['isAuthenticated'](),controller[_0x72f1('0x27')]);router[_0x72f1('0x6')]('/agents',auth[_0x72f1('0x8')](),controller[_0x72f1('0x28')]);router[_0x72f1('0x22')](_0x72f1('0x29'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x2a')]);router[_0x72f1('0x6')](_0x72f1('0x2b'),auth[_0x72f1('0x8')](),controller['telephones']);router[_0x72f1('0x6')](_0x72f1('0x2c'),auth[_0x72f1('0x8')](),controller['trunks']);router[_0x72f1('0x6')](_0x72f1('0x2d'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x2e')]);router[_0x72f1('0x6')](_0x72f1('0x2f'),auth['isAuthenticated'](),controller[_0x72f1('0x30')]);router[_0x72f1('0x6')](_0x72f1('0x31'),auth[_0x72f1('0x8')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x72f1('0x32'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x33')]);router['get']('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x72f1('0x34'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x35')]);router[_0x72f1('0x6')](_0x72f1('0x36'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x37')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x72f1('0x8')](),controller[_0x72f1('0x38')]);router['get'](_0x72f1('0x39'),auth['isAuthenticated'](),controller[_0x72f1('0x3a')]);router['post'](_0x72f1('0x3b'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x3c')]('mail'));router[_0x72f1('0x6')](_0x72f1('0x3d'),auth[_0x72f1('0x8')](),controller['showMailQueues']);router[_0x72f1('0x3e')](_0x72f1('0x3f'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x3c')](_0x72f1('0x40')));router[_0x72f1('0x6')]('/chat/queues/:id',auth[_0x72f1('0x8')](),controller[_0x72f1('0x41')]);router[_0x72f1('0x3e')](_0x72f1('0x42'),auth['isAuthenticated'](),controller[_0x72f1('0x3c')](_0x72f1('0x43')));router[_0x72f1('0x6')]('/fax/queues/:id',auth[_0x72f1('0x8')](),controller[_0x72f1('0x44')]);router[_0x72f1('0x3e')](_0x72f1('0x45'),auth[_0x72f1('0x8')](),controller['queueNotify'](_0x72f1('0x46')));router[_0x72f1('0x6')]('/openchannel/queues/:id',auth[_0x72f1('0x8')](),controller[_0x72f1('0x47')]);router[_0x72f1('0x3e')](_0x72f1('0x48'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x3c')]('sms'));router[_0x72f1('0x3e')](_0x72f1('0x49'),auth['isAuthenticated'](),controller[_0x72f1('0x3c')]('whatsapp'));router['get'](_0x72f1('0x4a'),auth['isAuthenticated'](),controller[_0x72f1('0x4b')]);router[_0x72f1('0x6')](_0x72f1('0x4c'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x4d')]);router[_0x72f1('0x3e')]('/agents/:id/notify',auth[_0x72f1('0x8')](),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 685de34..f25da82 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 _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 +var _0x903c=['faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','Interaction','Account','\x20Message\x20not\x20found','MessageId','InteractionId','From','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','messageId','update','agent','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','code','message','error','result','catch','sendStatus','stack','name','status','send','isNil','find','rows','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','then','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','internal','AgentCapacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','whatsappQueuesWaitingInteractions'];(function(_0x447aab,_0x3146fe){var _0x1c8ec2=function(_0x4860e3){while(--_0x4860e3){_0x447aab['push'](_0x447aab['shift']());}};_0x1c8ec2(++_0x3146fe);}(_0x903c,0x19a));var _0xc903=function(_0x8f43ee,_0x3faae2){_0x8f43ee=_0x8f43ee-0x0;var _0x29e4ba=_0x903c[_0x8f43ee];return _0x29e4ba;};'use strict';var BPromise=require(_0xc903('0x0'));var moment=require(_0xc903('0x1'));var _=require(_0xc903('0x2'));var util=require(_0xc903('0x3'));var db=require(_0xc903('0x4'))['db'];var logger=require(_0xc903('0x5'))(_0xc903('0x6'));var jayson=require(_0xc903('0x7'));var amiClient=jayson[_0xc903('0x8')]['http']({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client'][_0xc903('0x9')]({'port':0x232c});function respondWithRpcPromise(_0xcba790,_0xf62f51,_0x1ea54a){return new BPromise(function(_0x568e7e,_0x4a523d){var _0x35bf79=_0x1ea54a?_0x1ea54a:amiClient;return _0x35bf79[_0xc903('0xa')](_0xcba790,_0xf62f51)['then'](function(_0x1edf52){if(_0x1edf52['error']){if(_0x1edf52['error'][_0xc903('0xb')]===0x1f4){return _0x4a523d(_0x1edf52['error'][_0xc903('0xc')]);}return _0x568e7e(_0x1edf52[_0xc903('0xd')][_0xc903('0xc')]);}else{_0x568e7e(_0x1edf52[_0xc903('0xe')]);}})[_0xc903('0xf')](function(_0x4a0258){_0x4a523d(_0x4a0258);});});}function respondWithResult(_0x7761af,_0xdcd20a){_0xdcd20a=_0xdcd20a||0xc8;return function(_0x26bcdf){if(_0x26bcdf){return _0x7761af['status'](_0xdcd20a)['json'](_0x26bcdf);}return _0x7761af[_0xc903('0x10')](0x194);};}function handleError(_0x37caac,_0x592478){_0x592478=_0x592478||0x1f4;return function(_0x4236ed){logger[_0xc903('0xd')](_0x4236ed[_0xc903('0x11')]);if(_0x4236ed[_0xc903('0x12')]){delete _0x4236ed['name'];}_0x37caac[_0xc903('0x13')](_0x592478)[_0xc903('0x14')](_0x4236ed);};}function findById(_0x52e546){return function(_0xdb775b){if(!_[_0xc903('0x15')](_0x52e546)&&!_[_0xc903('0x15')](_0xdb775b)&&!_[_0xc903('0x15')](_0xdb775b['rows'])){return _[_0xc903('0x16')](_0xdb775b[_0xc903('0x17')],function(_0x11ea64){return _0x11ea64['id']==_0x52e546;});}return null;};}exports['voiceChannels']=function(_0x1b7d17,_0x1f51f7){return respondWithRpcPromise('VoiceChannels',_0x1b7d17[_0xc903('0x18')])['then'](respondWithResult(_0x1f51f7,null))['catch'](handleError(_0x1f51f7,null));};exports[_0xc903('0x19')]=function(_0x125dd0,_0x2b8fbd){return respondWithRpcPromise(_0xc903('0x1a'),_[_0xc903('0x1b')](_0x125dd0[_0xc903('0x18')],_0x125dd0[_0xc903('0x1c')]))[_0xc903('0x1d')](respondWithResult(_0x2b8fbd,null))[_0xc903('0xf')](handleError(_0x2b8fbd,null));};exports[_0xc903('0x1e')]=function(_0x50ddc5,_0x304b8c){return respondWithRpcPromise(_0xc903('0x1f'),_[_0xc903('0x1b')](_0x50ddc5[_0xc903('0x18')],_0x50ddc5[_0xc903('0x1c')]))['then'](respondWithResult(_0x304b8c,null))['catch'](handleError(_0x304b8c,null));};exports[_0xc903('0x20')]=function(_0x47f7f2,_0x281046){return respondWithRpcPromise(_0xc903('0x21'),_0x47f7f2[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x281046,null))[_0xc903('0xf')](handleError(_0x281046,null));};exports[_0xc903('0x22')]=function(_0x14a51f,_0x9495c7){return respondWithRpcPromise(_0xc903('0x21'),_0x14a51f[_0xc903('0x18')])[_0xc903('0x1d')](findById(_0x14a51f[_0xc903('0x1c')]['id']))[_0xc903('0x1d')](respondWithResult(_0x9495c7,null))['catch'](handleError(_0x9495c7,null));};exports['updateVoiceQueue']=function(_0x4a70b2,_0x4f18fa){return respondWithRpcPromise(_0xc903('0x23'),_[_0xc903('0x1b')](_0x4a70b2['body'],_0x4a70b2[_0xc903('0x1c')]))[_0xc903('0x1d')](respondWithResult(_0x4f18fa,null))[_0xc903('0xf')](handleError(_0x4f18fa,null));};exports[_0xc903('0x24')]=function(_0x5f2f39,_0x59ef05){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x5f2f39[_0xc903('0x18')],_0x5f2f39[_0xc903('0x1c')]))[_0xc903('0x1d')](respondWithResult(_0x59ef05,null))[_0xc903('0xf')](handleError(_0x59ef05,null));};exports[_0xc903('0x25')]=function(_0x5c8183,_0x4d4792){return respondWithRpcPromise(_0xc903('0x26'),_0x5c8183[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x4d4792,null))[_0xc903('0xf')](handleError(_0x4d4792,null));};exports[_0xc903('0x27')]=function(_0x1d42fd,_0x284f9f){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x1d42fd['query'],_0x1d42fd[_0xc903('0x1c')]))[_0xc903('0x1d')](respondWithResult(_0x284f9f,null))[_0xc903('0xf')](handleError(_0x284f9f,null));};exports[_0xc903('0x28')]=function(_0x2a612b,_0x247ea0){return respondWithRpcPromise(_0xc903('0x29'),_['merge'](_0x2a612b['query'],_0x2a612b[_0xc903('0x1c')]))[_0xc903('0x1d')](respondWithResult(_0x247ea0,null))[_0xc903('0xf')](handleError(_0x247ea0,null));};exports[_0xc903('0x2a')]=function(_0x101f9b,_0x57a793){return respondWithRpcPromise(_0xc903('0x2b'),_[_0xc903('0x1b')](_0x101f9b[_0xc903('0x18')],_0x101f9b['params']))[_0xc903('0x1d')](respondWithResult(_0x57a793,null))['catch'](handleError(_0x57a793,null));};exports['outbound']=function(_0x583375,_0xf4a2fc){return respondWithRpcPromise(_0xc903('0x2c'),_0x583375[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0xf4a2fc,null))['catch'](handleError(_0xf4a2fc,null));};exports[_0xc903('0x2d')]=function(_0x58c41a,_0x38d461){return respondWithRpcPromise(_0xc903('0x2e'),_0x58c41a[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x38d461,null))[_0xc903('0xf')](handleError(_0x38d461,null));};exports[_0xc903('0x2f')]=function(_0x4d720d,_0x3de8e5){var _0x1e67e6;return respondWithRpcPromise(_0xc903('0x30'),_0x4d720d[_0xc903('0x18')])[_0xc903('0x1d')](function(_0x396f8c){_0x1e67e6=_0x396f8c;return respondWithRpcPromise(_0xc903('0x30'),_0x4d720d[_0xc903('0x18')],routingClient);})[_0xc903('0x1d')](function(_0x489609){return _[_0xc903('0x1b')]({},_0x489609,_0x1e67e6);})[_0xc903('0x1d')](respondWithResult(_0x3de8e5,null))[_0xc903('0xf')](handleError(_0x3de8e5,null));};exports['agentCapacity']=function(_0x5ee41e,_0x26aab5){if(_0x5ee41e[_0xc903('0x31')]&&_0x5ee41e[_0xc903('0x31')]['interaction']&&_0x5ee41e['user']&&_0x5ee41e[_0xc903('0x32')]['name']){for(var _0x5befed in _0x5ee41e[_0xc903('0x31')][_0xc903('0x33')]){if(_0x5ee41e[_0xc903('0x31')]['interaction'][_0xc903('0x34')](_0x5befed)){db[_0xc903('0x35')]['findAll']({'where':{'channel':_0x5befed,'membername':_0x5ee41e[_0xc903('0x32')]['name'],'type':_0xc903('0x36'),'exitAt':null,'uniqueid':_0x5ee41e[_0xc903('0x31')][_0xc903('0x33')][_0x5befed]&&_0x5ee41e[_0xc903('0x31')][_0xc903('0x33')][_0x5befed][_0xc903('0x37')]?{'$notIn':_0x5ee41e['body'][_0xc903('0x33')][_0x5befed]}:{'$ne':null}}})['then'](function(_0x1c7874){var _0x4d0432=moment()[_0xc903('0x38')](_0xc903('0x39'));for(var _0x5b9eb0=0x0,_0x50059d=_0x1c7874[_0xc903('0x37')];_0x5b9eb0<_0x50059d;_0x5b9eb0+=0x1){_0x1c7874[_0x5b9eb0][_0xc903('0x3a')]({'exitAt':_0x4d0432});}});for(var _0x421847=0x0;_0x421847<_0x5ee41e['body'][_0xc903('0x33')][_0x5befed]['length'];_0x421847+=0x1){db[_0xc903('0x35')][_0xc903('0x3b')]({'where':{'channel':_0x5befed,'membername':_0x5ee41e[_0xc903('0x32')][_0xc903('0x12')],'type':_0xc903('0x36'),'uniqueid':_0x5ee41e[_0xc903('0x31')][_0xc903('0x33')][_0x5befed][_0x421847],'exitAt':null},'defaults':{'channel':_0x5befed,'membername':_0x5ee41e[_0xc903('0x32')][_0xc903('0x12')],'interface':_[_0xc903('0x15')](_0x5ee41e[_0xc903('0x32')][_0xc903('0x3c')])?util[_0xc903('0x38')](_0xc903('0x3d'),_0x5ee41e[_0xc903('0x32')][_0xc903('0x12')]):_0x5ee41e[_0xc903('0x32')][_0xc903('0x3c')],'type':_0xc903('0x36'),'enterAt':moment()[_0xc903('0x38')](_0xc903('0x39')),'role':'agent','internal':_0x5ee41e[_0xc903('0x32')][_0xc903('0x3e')],'uniqueid':_0x5ee41e[_0xc903('0x31')][_0xc903('0x33')][_0x5befed][_0x421847]}});}}}}return respondWithRpcPromise(_0xc903('0x3f'),{'id':_0x5ee41e[_0xc903('0x1c')]['id'],'capacity':_0x5ee41e['body']['capacity']},routingClient)['then'](respondWithResult(_0x26aab5,null))[_0xc903('0xf')](handleError(_0x26aab5,null));};exports['telephones']=function(_0x31f0fe,_0x2e18ef){return respondWithRpcPromise(_0xc903('0x40'),_0x31f0fe[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x2e18ef,null))[_0xc903('0xf')](handleError(_0x2e18ef,null));};exports[_0xc903('0x41')]=function(_0x1e1f21,_0x416412){return respondWithRpcPromise(_0xc903('0x42'),_0x1e1f21['query'])[_0xc903('0x1d')](respondWithResult(_0x416412,null))[_0xc903('0xf')](handleError(_0x416412,null));};exports[_0xc903('0x43')]=function(_0x410ec9,_0x500080){return respondWithRpcPromise(_0xc903('0x44'),_0x410ec9[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x500080,null))[_0xc903('0xf')](handleError(_0x500080,null));};exports[_0xc903('0x45')]=function(_0x25c72e,_0x54f948){return respondWithRpcPromise(_0xc903('0x46'),_0x25c72e['query'],routingClient)[_0xc903('0x1d')](respondWithResult(_0x54f948,null))['catch'](handleError(_0x54f948,null));};exports['showChatQueues']=function(_0x49d624,_0x2665ba){return respondWithRpcPromise(_0xc903('0x46'),_0x49d624[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](findById(_0x49d624[_0xc903('0x1c')]['id']))['then'](respondWithResult(_0x2665ba,null))[_0xc903('0xf')](handleError(_0x2665ba,null));};exports[_0xc903('0x47')]=function(_0x57ba44,_0x2ffb7e){return respondWithRpcPromise(_0xc903('0x48'),_0x57ba44[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x2ffb7e,null))[_0xc903('0xf')](handleError(_0x2ffb7e,null));};exports[_0xc903('0x49')]=function(_0x13a9a3,_0x2858bd){return respondWithRpcPromise(_0xc903('0x48'),_0x13a9a3[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](findById(_0x13a9a3['params']['id']))[_0xc903('0x1d')](respondWithResult(_0x2858bd,null))[_0xc903('0xf')](handleError(_0x2858bd,null));};exports[_0xc903('0x4a')]=function(_0xc11cd7,_0x3056ef){return respondWithRpcPromise(_0xc903('0x4b'),_0xc11cd7[_0xc903('0x18')],mailClient)['then'](respondWithResult(_0x3056ef,null))[_0xc903('0xf')](handleError(_0x3056ef,null));};exports[_0xc903('0x4c')]=function(_0x55d38d,_0x26f70d){return respondWithRpcPromise(_0xc903('0x4d'),_0x55d38d['query'],routingClient)[_0xc903('0x1d')](respondWithResult(_0x26f70d,null))[_0xc903('0xf')](handleError(_0x26f70d,null));};exports[_0xc903('0x4e')]=function(_0x1fda4d,_0x8b13c6){return respondWithRpcPromise('OpenchannelQueues',_0x1fda4d['query'],routingClient)[_0xc903('0x1d')](findById(_0x1fda4d[_0xc903('0x1c')]['id']))['then'](respondWithResult(_0x8b13c6,null))[_0xc903('0xf')](handleError(_0x8b13c6,null));};exports[_0xc903('0x4f')]=function(_0x3ea3bc,_0x5127f4){return respondWithRpcPromise('SmsQueues',_0x3ea3bc['query'],routingClient)['then'](respondWithResult(_0x5127f4,null))[_0xc903('0xf')](handleError(_0x5127f4,null));};exports[_0xc903('0x50')]=function(_0x561fcf,_0x426f37){return respondWithRpcPromise(_0xc903('0x51'),_0x561fcf[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](findById(_0x561fcf['params']['id']))[_0xc903('0x1d')](respondWithResult(_0x426f37,null))[_0xc903('0xf')](handleError(_0x426f37,null));};exports[_0xc903('0x52')]=function(_0x190954,_0x297346){return respondWithRpcPromise('WhatsappQueues',_0x190954['query'],routingClient)['then'](respondWithResult(_0x297346,null))[_0xc903('0xf')](handleError(_0x297346,null));};exports[_0xc903('0x53')]=function(_0x370917,_0x3a3280){return respondWithRpcPromise(_0xc903('0x54'),_0x370917[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](findById(_0x370917['params']['id']))[_0xc903('0x1d')](respondWithResult(_0x3a3280,null))[_0xc903('0xf')](handleError(_0x3a3280,null));};exports[_0xc903('0x55')]=function(_0x1d3933,_0x5e93ef){return respondWithRpcPromise('FaxQueues',_0x1d3933[_0xc903('0x18')],routingClient)['then'](respondWithResult(_0x5e93ef,null))['catch'](handleError(_0x5e93ef,null));};exports[_0xc903('0x56')]=function(_0x121163,_0x56d8d1){return respondWithRpcPromise(_0xc903('0x57'),_0x121163[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](findById(_0x121163[_0xc903('0x1c')]['id']))[_0xc903('0x1d')](respondWithResult(_0x56d8d1,null))[_0xc903('0xf')](handleError(_0x56d8d1,null));};exports[_0xc903('0x58')]=function(_0x37a6eb,_0x5bdcd2){return respondWithRpcPromise(_0xc903('0x59'),_0x37a6eb[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x5bdcd2,null))[_0xc903('0xf')](handleError(_0x5bdcd2,null));};exports[_0xc903('0x5a')]=function(_0x3de80d,_0x4c19b2){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x3de80d[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x4c19b2,null))[_0xc903('0xf')](handleError(_0x4c19b2,null));};exports['mailQueuesWaitingInteractions']=function(_0x3a8d61,_0x280f50){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x3a8d61['query'],routingClient)[_0xc903('0x1d')](respondWithResult(_0x280f50,null))[_0xc903('0xf')](handleError(_0x280f50,null));};exports[_0xc903('0x5b')]=function(_0x37ccb5,_0x5e9f61){return respondWithRpcPromise(_0xc903('0x5c'),_0x37ccb5[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x5e9f61,null))[_0xc903('0xf')](handleError(_0x5e9f61,null));};exports[_0xc903('0x5d')]=function(_0x4ef00a,_0x5b9ce3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4ef00a['query'],routingClient)[_0xc903('0x1d')](function(_0x518c2c){if(_0x4ef00a['query'][_0xc903('0x5e')]!==undefined){var _0x49b54b=_(_0x518c2c[_0xc903('0x17')])[_0xc903('0x5f')]([_0x4ef00a[_0xc903('0x18')]['type'],_0x4ef00a[_0xc903('0x1c')]['id']])[_0xc903('0x60')](_0xc903('0x61'))[_0xc903('0x62')]()[_0xc903('0x63')]();return _0x518c2c[_0xc903('0x17')]['filter'](function(_0x54e6dd){return _0x49b54b[_0xc903('0x64')](_0x54e6dd[_0xc903('0x61')])>-0x1;});}else{return _0x518c2c[_0xc903('0x17')][_0xc903('0x5f')](function(_0x314c6a){return _0x314c6a[_0xc903('0x61')]===parseInt(_0x4ef00a[_0xc903('0x1c')]['id']);});}})['then'](respondWithResult(_0x5b9ce3,null))[_0xc903('0xf')](handleError(_0x5b9ce3,null));};exports['smsQueuesWaitingInteractions']=function(_0x1688c0,_0x3dc4c8){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1688c0[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x3dc4c8,null))[_0xc903('0xf')](handleError(_0x3dc4c8,null));};exports[_0xc903('0x65')]=function(_0x1ca558,_0x5fa80b){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x1ca558[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x5fa80b,null))[_0xc903('0xf')](handleError(_0x5fa80b,null));};exports[_0xc903('0x66')]=function(_0x188054,_0x11de16){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x188054[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x11de16,null))['catch'](handleError(_0x11de16,null));};exports[_0xc903('0x67')]=function(_0x8c49b3){return function(_0xff199a,_0x428961){var _0x247369,_0x107a16;var _0x1a6da9=_[_0xc903('0x68')](_0x8c49b3);var _0x5d5184=_0x8c49b3==='chat'?_0xc903('0x69'):'Account';return db[_0x1a6da9+_0xc903('0x6a')]['findOne']({'raw':!![],'where':{'id':_0xff199a[_0xc903('0x1c')]['id']}})[_0xc903('0x1d')](function(_0x29ecd2){if(_[_0xc903('0x15')](_0x29ecd2)){throw new Error(_0x1a6da9+_0xc903('0x6b'));}_0x247369=_0x29ecd2;return db[_0x1a6da9+_0xc903('0x6c')]['findOne']({'where':{'id':_0xff199a[_0xc903('0x31')]['messageId']},'include':[{'model':db[_0x1a6da9+_0xc903('0x6d')],'as':_0xc903('0x6d')},{'model':db[_0x1a6da9+_0x5d5184],'as':_0xc903('0x6e')}]});})[_0xc903('0x1d')](function(_0x302313){if(_[_0xc903('0x15')](_0x302313)){throw new Error(_0x1a6da9+_0xc903('0x6f'));}_0x107a16=_0x302313;return _0x302313['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xc903('0x1d')](function(){var _0x336d8e={'uniqueid':_0x8c49b3+'.'+_0x107a16['id']+'.'+_0x107a16[_0xc903('0x6d')]['id'],'FromUserId':_0xff199a['user']['id'],'type':'queue'};_0x336d8e[_0x1a6da9+_0xc903('0x70')]=_0x107a16['id'];_0x336d8e[_0x1a6da9+_0xc903('0x71')]=_0x107a16[_0xc903('0x6d')]['id'];_0x336d8e[_0xc903('0x72')+_0x1a6da9+_0x5d5184+'Id']=_0x107a16[_0xc903('0x6e')]['id'];_0x336d8e['To'+_0x1a6da9+'QueueId']=_0x247369['id'];return db[_0x1a6da9+_0xc903('0x73')][_0xc903('0x74')](_0x336d8e);})[_0xc903('0x1d')](function(){return respondWithRpcPromise('Start',{'channel':_0x8c49b3,'interaction':_0x107a16[_0xc903('0x6d')],'message':_0x107a16,'account':_0x107a16['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xc903('0x75'),'appdata':_0x247369[_0xc903('0x12')]+','+(_0x107a16[_0xc903('0x6e')][_0xc903('0x76')]||0x12c),'interval':_0xc903('0x77')}]},routingClient);})[_0xc903('0x1d')](respondWithResult(_0x428961,null))['catch'](handleError(_0x428961,null));};};exports[_0xc903('0x78')]=function(_0x464bf0,_0x48fa23){var _0x323eba,_0x4847e6;if(_[_0xc903('0x15')](_0x464bf0[_0xc903('0x31')][_0xc903('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x560e16=_0x464bf0[_0xc903('0x31')][_0xc903('0x79')];var _0x3cc7f5=_[_0xc903('0x68')](_0x560e16);var _0x61c2ba=_0x560e16==='chat'?'Website':'Account';return db[_0xc903('0x7a')]['findOne']({'raw':!![],'where':{'id':_0x464bf0[_0xc903('0x1c')]['id'],'role':'agent'}})[_0xc903('0x1d')](function(_0x24fc15){if(_[_0xc903('0x15')](_0x24fc15)){throw new Error(_0xc903('0x7b'));}_0x323eba=_0x24fc15;return db[_0x3cc7f5+_0xc903('0x6c')]['findOne']({'where':{'id':_0x464bf0[_0xc903('0x31')][_0xc903('0x7c')]},'include':[{'model':db[_0x3cc7f5+_0xc903('0x6d')],'as':_0xc903('0x6d')},{'model':db[_0x3cc7f5+_0x61c2ba],'as':'Account'}]});})[_0xc903('0x1d')](function(_0x18dc95){if(_[_0xc903('0x15')](_0x18dc95)){throw new Error(_0x3cc7f5+'\x20Message\x20not\x20found');}_0x4847e6=_0x18dc95;return _0x18dc95[_0xc903('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3be2bc={'uniqueid':_0x560e16+'.'+_0x4847e6['id']+'.'+_0x4847e6[_0xc903('0x6d')]['id'],'FromUserId':_0x464bf0[_0xc903('0x32')]['id'],'type':_0xc903('0x7e'),'ToUserId':_0x323eba['id']};_0x3be2bc[_0x3cc7f5+_0xc903('0x70')]=_0x4847e6['id'];_0x3be2bc[_0x3cc7f5+_0xc903('0x71')]=_0x4847e6[_0xc903('0x6d')]['id'];_0x3be2bc[_0xc903('0x72')+_0x3cc7f5+_0x61c2ba+'Id']=_0x4847e6[_0xc903('0x6e')]['id'];return db[_0x3cc7f5+_0xc903('0x73')][_0xc903('0x74')](_0x3be2bc);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x560e16,'interaction':_0x4847e6[_0xc903('0x6d')],'message':_0x4847e6,'account':_0x4847e6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xc903('0x7e'),'appdata':_0x323eba[_0xc903('0x12')]+','+(_0x4847e6['Account'][_0xc903('0x7f')]||0x12c),'interval':_0xc903('0x77')}]},routingClient);})[_0xc903('0x1d')](respondWithResult(_0x48fa23,null))[_0xc903('0xf')](handleError(_0x48fa23,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e188be5..74afa0a 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 _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 +var _0x457f=['create','put','delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','index','/:id','isAuthenticated','/:id/run','run'];(function(_0x10a35c,_0x3275b7){var _0x18eff2=function(_0x3e0d0c){while(--_0x3e0d0c){_0x10a35c['push'](_0x10a35c['shift']());}};_0x18eff2(++_0x3275b7);}(_0x457f,0x163));var _0xf457=function(_0x18a8e8,_0x2fa2b0){_0x18a8e8=_0x18a8e8-0x0;var _0x49fdac=_0x457f[_0x18a8e8];return _0x49fdac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf457('0x0'));var timeout=require(_0xf457('0x1'));var express=require(_0xf457('0x2'));var router=express['Router']();var fs_extra=require(_0xf457('0x3'));var auth=require(_0xf457('0x4'));var interaction=require(_0xf457('0x5'));var config=require('../../config/environment');var controller=require(_0xf457('0x6'));router[_0xf457('0x7')]('/',auth['isAuthenticated'](),controller[_0xf457('0x8')]);router[_0xf457('0x7')](_0xf457('0x9'),auth[_0xf457('0xa')](),controller['show']);router['get'](_0xf457('0xb'),auth['isAuthenticated'](),controller[_0xf457('0xc')]);router['post']('/',auth[_0xf457('0xa')](),controller[_0xf457('0xd')]);router[_0xf457('0xe')](_0xf457('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xf457('0xf')](_0xf457('0x9'),auth[_0xf457('0xa')](),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 054ea45..e8a254d 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 _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 +var _0xb82c=['hours','csv','pdf','xlsx','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','weeks','days'];(function(_0xa633e2,_0xc85ba8){var _0x57e2dd=function(_0xa3ecb7){while(--_0xa3ecb7){_0xa633e2['push'](_0xa633e2['shift']());}};_0x57e2dd(++_0xc85ba8);}(_0xb82c,0xf4));var _0xcb82=function(_0x552d53,_0x56ced2){_0x552d53=_0x552d53-0x0;var _0x2cc575=_0xb82c[_0x552d53];return _0x2cc575;};'use strict';var Sequelize=require(_0xcb82('0x0'));module[_0xcb82('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcb82('0x2')]},'active':{'type':Sequelize[_0xcb82('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xcb82('0x2')],'allowNull':![],'defaultValue':_0xcb82('0x4')},'startAt':{'type':Sequelize[_0xcb82('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xcb82('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xcb82('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xcb82('0x7')]('years',_0xcb82('0x8'),'months',_0xcb82('0x9'),_0xcb82('0xa'),_0xcb82('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xcb82('0xa')},'output':{'type':Sequelize[_0xcb82('0x7')](_0xcb82('0xc'),_0xcb82('0xd'),_0xcb82('0xe')),'allowNull':![],'defaultValue':_0xcb82('0xc')},'type':{'type':Sequelize[_0xcb82('0x7')]('custom',_0xcb82('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xcb82('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xcb82('0x10')]},'bcc':{'type':Sequelize[_0xcb82('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xcb82('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index a2a9d22..d815e88 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 _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 +var _0x06bd=['role','Scheduler','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','status','error','stack','name','send','map','Schedule','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1241db,_0x4c1b73){var _0x11d9ec=function(_0x149d46){while(--_0x149d46){_0x1241db['push'](_0x1241db['shift']());}};_0x11d9ec(++_0x4c1b73);}(_0x06bd,0xb2));var _0xd06b=function(_0x3c8499,_0x1e052e){_0x3c8499=_0x3c8499-0x0;var _0x51d346=_0x06bd[_0x3c8499];return _0x51d346;};'use strict';var emlformat=require(_0xd06b('0x0'));var rimraf=require(_0xd06b('0x1'));var zipdir=require(_0xd06b('0x2'));var jsonpatch=require(_0xd06b('0x3'));var rp=require(_0xd06b('0x4'));var moment=require('moment');var BPromise=require(_0xd06b('0x5'));var Mustache=require(_0xd06b('0x6'));var util=require(_0xd06b('0x7'));var path=require(_0xd06b('0x8'));var sox=require(_0xd06b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd06b('0xa'));var squel=require(_0xd06b('0xb'));var crypto=require(_0xd06b('0xc'));var jsforce=require(_0xd06b('0xd'));var deskjs=require(_0xd06b('0xe'));var toCsv=require(_0xd06b('0xf'));var querystring=require(_0xd06b('0x10'));var Papa=require('papaparse');var Redis=require(_0xd06b('0x11'));var authService=require(_0xd06b('0x12'));var qs=require(_0xd06b('0x13'));var as=require(_0xd06b('0x14'));var hardwareService=require(_0xd06b('0x15'));var logger=require('../../config/logger')(_0xd06b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd06b('0x17'))['db'];function respondWithStatusCode(_0x1c5f86,_0x584371){_0x584371=_0x584371||0xcc;return function(_0xabe3a6){if(_0xabe3a6){return _0x1c5f86[_0xd06b('0x18')](_0x584371);}return _0x1c5f86['status'](_0x584371)[_0xd06b('0x19')]();};}function respondWithResult(_0x2206b8,_0x1ca9e3){_0x1ca9e3=_0x1ca9e3||0xc8;return function(_0x145fb4){if(_0x145fb4){return _0x2206b8['status'](_0x1ca9e3)[_0xd06b('0x1a')](_0x145fb4);}};}function respondWithFilteredResult(_0xd65fed,_0x48b799){return function(_0x3b1f10){if(_0x3b1f10){var _0x2a8b72=typeof _0x48b799[_0xd06b('0x1b')]===_0xd06b('0x1c')&&typeof _0x48b799[_0xd06b('0x1d')]===_0xd06b('0x1c');var _0x3eaa6e=_0x3b1f10[_0xd06b('0x1e')];var _0x44ebea=_0x2a8b72?0x0:_0x48b799[_0xd06b('0x1b')];var _0x32b368=_0x2a8b72?_0x3b1f10['count']:_0x48b799[_0xd06b('0x1b')]+_0x48b799[_0xd06b('0x1d')];var _0x2bbeac;if(_0x32b368>=_0x3eaa6e){_0x32b368=_0x3eaa6e;_0x2bbeac=0xc8;}else{_0x2bbeac=0xce;}_0xd65fed['status'](_0x2bbeac);return _0xd65fed[_0xd06b('0x1f')](_0xd06b('0x20'),_0x44ebea+'-'+_0x32b368+'/'+_0x3eaa6e)['json'](_0x3b1f10);}return null;};}function patchUpdates(_0x46de31){return function(_0x3f6868){try{jsonpatch[_0xd06b('0x21')](_0x3f6868,_0x46de31,!![]);}catch(_0x4840c8){return BPromise[_0xd06b('0x22')](_0x4840c8);}return _0x3f6868[_0xd06b('0x23')]();};}function saveUpdates(_0x20b8ab,_0x5c1568){return function(_0x4dd9b5){if(_0x4dd9b5){return _0x4dd9b5[_0xd06b('0x24')](_0x20b8ab)[_0xd06b('0x25')](function(_0x5cab2f){return _0x5cab2f;});}return null;};}function removeEntity(_0xc4f212,_0x2ccdb5){return function(_0x5e3284){if(_0x5e3284){return _0x5e3284[_0xd06b('0x26')]()[_0xd06b('0x25')](function(){var _0x5c9567=_0x5e3284[_0xd06b('0x27')]({'plain':!![]});var _0x270324='Scheduler';return db[_0xd06b('0x28')][_0xd06b('0x26')]({'where':{'type':_0x270324,'resourceId':_0x5c9567['id']}})['then'](function(){return _0x5e3284;});})[_0xd06b('0x25')](function(){_0xc4f212[_0xd06b('0x29')](0xcc)[_0xd06b('0x19')]();});}};}function handleEntityNotFound(_0x53601d,_0x49fc71){return function(_0x270843){if(!_0x270843){_0x53601d[_0xd06b('0x18')](0x194);}return _0x270843;};}function handleError(_0x76d251,_0x234e1b){_0x234e1b=_0x234e1b||0x1f4;return function(_0x322cd7){logger[_0xd06b('0x2a')](_0x322cd7[_0xd06b('0x2b')]);if(_0x322cd7[_0xd06b('0x2c')]){delete _0x322cd7[_0xd06b('0x2c')];}_0x76d251['status'](_0x234e1b)[_0xd06b('0x2d')](_0x322cd7);};}exports['index']=function(_0x145931,_0x2f30bb){var _0x1541b1={},_0x14e570={},_0x51611b={'count':0x0,'rows':[]};var _0x43d2a7=_[_0xd06b('0x2e')](db[_0xd06b('0x2f')]['rawAttributes'],function(_0x287594){return{'name':_0x287594[_0xd06b('0x30')],'type':_0x287594[_0xd06b('0x31')][_0xd06b('0x32')]};});_0x14e570[_0xd06b('0x33')]=_[_0xd06b('0x2e')](_0x43d2a7,_0xd06b('0x2c'));_0x14e570[_0xd06b('0x34')]=_[_0xd06b('0x35')](_0x145931[_0xd06b('0x34')]);_0x14e570['filters']=_[_0xd06b('0x36')](_0x14e570['model'],_0x14e570['query']);_0x1541b1[_0xd06b('0x37')]=_['intersection'](_0x14e570[_0xd06b('0x33')],qs[_0xd06b('0x38')](_0x145931[_0xd06b('0x34')]['fields']));_0x1541b1['attributes']=_0x1541b1[_0xd06b('0x37')][_0xd06b('0x39')]?_0x1541b1[_0xd06b('0x37')]:_0x14e570[_0xd06b('0x33')];if(!_0x145931[_0xd06b('0x34')][_0xd06b('0x3a')]('nolimit')){_0x1541b1[_0xd06b('0x1d')]=qs[_0xd06b('0x1d')](_0x145931[_0xd06b('0x34')]['limit']);_0x1541b1[_0xd06b('0x1b')]=qs['offset'](_0x145931[_0xd06b('0x34')][_0xd06b('0x1b')]);}_0x1541b1[_0xd06b('0x3b')]=qs[_0xd06b('0x3c')](_0x145931[_0xd06b('0x34')][_0xd06b('0x3c')]);_0x1541b1[_0xd06b('0x3d')]=qs[_0xd06b('0x3e')](_['pick'](_0x145931[_0xd06b('0x34')],_0x14e570['filters']),_0x43d2a7);if(_0x145931[_0xd06b('0x34')][_0xd06b('0x3f')]){_0x1541b1[_0xd06b('0x3d')]=_['merge'](_0x1541b1['where'],{'$or':_[_0xd06b('0x2e')](_0x43d2a7,function(_0x1edebb){if(_0x1edebb[_0xd06b('0x31')]!==_0xd06b('0x40')){var _0x14ae5a={};_0x14ae5a[_0x1edebb[_0xd06b('0x2c')]]={'$like':'%'+_0x145931[_0xd06b('0x34')]['filter']+'%'};return _0x14ae5a;}})});}_0x1541b1=_[_0xd06b('0x41')]({},_0x1541b1,_0x145931['options']);var _0xf9a40b={'where':_0x1541b1['where']};return db[_0xd06b('0x2f')][_0xd06b('0x1e')](_0xf9a40b)[_0xd06b('0x25')](function(_0x3e9558){_0x51611b[_0xd06b('0x1e')]=_0x3e9558;if(_0x145931['query'][_0xd06b('0x42')]){_0x1541b1[_0xd06b('0x43')]=[{'all':!![]}];}return db['Schedule'][_0xd06b('0x44')](_0x1541b1);})[_0xd06b('0x25')](function(_0x561f76){_0x51611b[_0xd06b('0x45')]=_0x561f76;return _0x51611b;})[_0xd06b('0x25')](respondWithFilteredResult(_0x2f30bb,_0x1541b1))[_0xd06b('0x46')](handleError(_0x2f30bb,null));};exports[_0xd06b('0x47')]=function(_0x58afeb,_0x27ef96){var _0x1b5ed9={'raw':![],'where':{'id':_0x58afeb[_0xd06b('0x48')]['id']}},_0x1515c7={};_0x1515c7[_0xd06b('0x33')]=_[_0xd06b('0x35')](db[_0xd06b('0x2f')]['rawAttributes']);_0x1515c7[_0xd06b('0x34')]=_[_0xd06b('0x35')](_0x58afeb[_0xd06b('0x34')]);_0x1515c7[_0xd06b('0x3e')]=_[_0xd06b('0x36')](_0x1515c7[_0xd06b('0x33')],_0x1515c7['query']);_0x1b5ed9[_0xd06b('0x37')]=_[_0xd06b('0x36')](_0x1515c7['model'],qs[_0xd06b('0x38')](_0x58afeb[_0xd06b('0x34')][_0xd06b('0x38')]));_0x1b5ed9['attributes']=_0x1b5ed9[_0xd06b('0x37')][_0xd06b('0x39')]?_0x1b5ed9['attributes']:_0x1515c7[_0xd06b('0x33')];if(_0x58afeb[_0xd06b('0x34')][_0xd06b('0x42')]){_0x1b5ed9['include']=[{'all':!![]}];}_0x1b5ed9=_[_0xd06b('0x41')]({},_0x1b5ed9,_0x58afeb['options']);return db[_0xd06b('0x2f')]['find'](_0x1b5ed9)[_0xd06b('0x25')](handleEntityNotFound(_0x27ef96,null))[_0xd06b('0x25')](respondWithResult(_0x27ef96,null))[_0xd06b('0x46')](handleError(_0x27ef96,null));};exports[_0xd06b('0x49')]=function(_0x6180c7,_0x3f39cf){return db[_0xd06b('0x2f')][_0xd06b('0x49')](_0x6180c7[_0xd06b('0x4a')],{})['then'](function(_0x1e4858){var _0x587059=_0x6180c7[_0xd06b('0x4b')]['get']({'plain':!![]});if(!_0x587059)throw new Error(_0xd06b('0x4c'));if(_0x587059[_0xd06b('0x4d')]===_0xd06b('0x4b')){var _0x477b12=_0x1e4858[_0xd06b('0x27')]({'plain':!![]});var _0x5c7e17=_0xd06b('0x4e');return db[_0xd06b('0x4f')][_0xd06b('0x50')]({'where':{'name':_0x5c7e17,'userProfileId':_0x587059[_0xd06b('0x51')]},'raw':!![]})[_0xd06b('0x25')](function(_0x3a6437){if(_0x3a6437&&_0x3a6437['autoAssociation']===0x0){return db[_0xd06b('0x28')][_0xd06b('0x49')]({'name':_0x477b12[_0xd06b('0x2c')],'resourceId':_0x477b12['id'],'type':_0x3a6437[_0xd06b('0x2c')],'sectionId':_0x3a6437['id']},{})[_0xd06b('0x25')](function(){return _0x1e4858;});}else{return _0x1e4858;}})[_0xd06b('0x46')](function(_0x15d6e3){logger[_0xd06b('0x2a')](_0xd06b('0x52'),_0x15d6e3);throw _0x15d6e3;});}return _0x1e4858;})[_0xd06b('0x25')](respondWithResult(_0x3f39cf,0xc9))['catch'](handleError(_0x3f39cf,null));};exports[_0xd06b('0x24')]=function(_0x1c3d56,_0x3eb112){if(_0x1c3d56[_0xd06b('0x4a')]['id']){delete _0x1c3d56[_0xd06b('0x4a')]['id'];}return db['Schedule'][_0xd06b('0x50')]({'where':{'id':_0x1c3d56[_0xd06b('0x48')]['id']}})[_0xd06b('0x25')](handleEntityNotFound(_0x3eb112,null))['then'](saveUpdates(_0x1c3d56[_0xd06b('0x4a')],null))[_0xd06b('0x25')](respondWithResult(_0x3eb112,null))['catch'](handleError(_0x3eb112,null));};exports[_0xd06b('0x26')]=function(_0x1eedf3,_0x541cb4){return db[_0xd06b('0x2f')][_0xd06b('0x50')]({'where':{'id':_0x1eedf3[_0xd06b('0x48')]['id']}})[_0xd06b('0x25')](handleEntityNotFound(_0x541cb4,null))[_0xd06b('0x25')](removeEntity(_0x541cb4,null))['catch'](handleError(_0x541cb4,null));};exports[_0xd06b('0x53')]=function(_0x548764,_0x4b3043,_0x34fce3){var _0x2a0446=require(_0xd06b('0x54'));return db['Schedule'][_0xd06b('0x50')]({'where':{'id':_0x548764[_0xd06b('0x48')]['id']},'raw':!![]})[_0xd06b('0x25')](handleEntityNotFound(_0x4b3043,null))['then'](function(){_0x2a0446[_0xd06b('0x53')](_0x548764[_0xd06b('0x48')]['id']);})['then'](respondWithStatusCode(_0x4b3043,null))[_0xd06b('0x46')](handleError(_0x4b3043,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index bc15b65..641d9df 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 _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 +var _0x3c5f=['util','../../config/logger','api','moment','request-promise','exports','define','tools_schedules'];(function(_0xf2c25d,_0x2c3260){var _0x2c2291=function(_0x1c2028){while(--_0x1c2028){_0xf2c25d['push'](_0xf2c25d['shift']());}};_0x2c2291(++_0x2c3260);}(_0x3c5f,0x110));var _0xf3c5=function(_0x199f7b,_0x5ab14b){_0x199f7b=_0x199f7b-0x0;var _0x546b95=_0x3c5f[_0x199f7b];return _0x546b95;};'use strict';var _=require('lodash');var util=require(_0xf3c5('0x0'));var logger=require(_0xf3c5('0x1'))(_0xf3c5('0x2'));var moment=require(_0xf3c5('0x3'));var BPromise=require('bluebird');var rp=require(_0xf3c5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xf3c5('0x5')]=function(_0x4dd86b,_0x35bc85){return _0x4dd86b[_0xf3c5('0x6')]('Schedule',attributes,{'tableName':_0xf3c5('0x7'),'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 2512a5b..0179fca 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 _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 +var _0x321d=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x321d,0xca));var _0xd321=function(_0x20865b,_0x54cd35){_0x20865b=_0x20865b-0x0;var _0x272305=_0x321d[_0x20865b];return _0x272305;};'use strict';var _=require(_0xd321('0x0'));var util=require(_0xd321('0x1'));var moment=require(_0xd321('0x2'));var BPromise=require('bluebird');var rs=require(_0xd321('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd321('0x4'))['db'];var utils=require(_0xd321('0x5'));var logger=require(_0xd321('0x6'))(_0xd321('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd321('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x370baa,_0x44b443,_0x25e555){return new BPromise(function(_0x121756,_0x286304){return client[_0xd321('0x9')](_0x370baa,_0x25e555)[_0xd321('0xa')](function(_0x1223a5){logger[_0xd321('0xb')](_0xd321('0xc'),_0x44b443,'request\x20sent');logger[_0xd321('0xd')](_0xd321('0xe'),_0x44b443,'request\x20sent',JSON[_0xd321('0xf')](_0x1223a5));if(_0x1223a5['error']){if(_0x1223a5[_0xd321('0x10')][_0xd321('0x11')]===0x1f4){logger[_0xd321('0x10')]('Schedule,\x20%s,\x20%s',_0x44b443,_0x1223a5['error'][_0xd321('0x12')]);return _0x286304(_0x1223a5[_0xd321('0x10')]['message']);}logger[_0xd321('0x10')]('Schedule,\x20%s,\x20%s',_0x44b443,_0x1223a5[_0xd321('0x10')][_0xd321('0x12')]);return _0x121756(_0x1223a5[_0xd321('0x10')][_0xd321('0x12')]);}else{logger[_0xd321('0xb')](_0xd321('0xc'),_0x44b443,'request\x20sent');_0x121756(_0x1223a5['result'][_0xd321('0x12')]);}})[_0xd321('0x13')](function(_0x131304){logger[_0xd321('0x10')](_0xd321('0xc'),_0x44b443,_0x131304);_0x286304(_0x131304);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e2c91a0..070b849 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 _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 +var _0xf54b=['get','isAuthenticated','index','/describe','describe','/:id','show','download','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x16f88c,_0x2aad29){var _0x20ab2e=function(_0x438525){while(--_0x438525){_0x16f88c['push'](_0x16f88c['shift']());}};_0x20ab2e(++_0x2aad29);}(_0xf54b,0xb4));var _0xbf54=function(_0x1fb6e2,_0x3a22ce){_0x1fb6e2=_0x1fb6e2-0x0;var _0x354690=_0xf54b[_0x1fb6e2];return _0x354690;};'use strict';var multer=require(_0xbf54('0x0'));var util=require(_0xbf54('0x1'));var path=require(_0xbf54('0x2'));var timeout=require(_0xbf54('0x3'));var express=require(_0xbf54('0x4'));var router=express[_0xbf54('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf54('0x6'));var config=require(_0xbf54('0x7'));var controller=require(_0xbf54('0x8'));router[_0xbf54('0x9')]('/',auth[_0xbf54('0xa')](),controller[_0xbf54('0xb')]);router[_0xbf54('0x9')](_0xbf54('0xc'),auth[_0xbf54('0xa')](),controller[_0xbf54('0xd')]);router[_0xbf54('0x9')](_0xbf54('0xe'),auth[_0xbf54('0xa')](),controller[_0xbf54('0xf')]);router[_0xbf54('0x9')]('/:id/download',auth[_0xbf54('0xa')](),controller[_0xbf54('0x10')]);router[_0xbf54('0x11')]('/',auth['isAuthenticated'](),controller[_0xbf54('0x12')]);router['put']('/:id',auth[_0xbf54('0xa')](),controller['update']);router[_0xbf54('0x13')](_0xbf54('0xe'),auth['isAuthenticated'](),controller[_0xbf54('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 5413232..ae5d4ae 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 _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 +var _0x1f81=['setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','../../config/environment','exports','getDataValue','value','extname','STRING','replace'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x1f81,0xab));var _0x11f8=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x1f81[_0x20cb20];return _0x2fcf4b;};'use strict';var Sequelize=require(_0x11f8('0x0'));var moment=require(_0x11f8('0x1'));var path=require('path');var config=require(_0x11f8('0x2'));module[_0x11f8('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x11f8('0x4')](_0x11f8('0x5'))?path[_0x11f8('0x6')](this[_0x11f8('0x4')](_0x11f8('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x11f8('0x7')]},'channel':{'type':Sequelize[_0x11f8('0x7')]},'value':{'type':Sequelize[_0x11f8('0x7')],'set':function(_0x4fd0cf){var _0x1d899d=_0x4fd0cf[_0x11f8('0x8')](/\\/g,'/');this[_0x11f8('0x9')](_0x11f8('0x5'),_0x1d899d);}},'rating':{'type':Sequelize[_0x11f8('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x11f8('0xa')],'set':function(_0x5ec20c){this[_0x11f8('0x9')](_0x11f8('0xb'),moment()[_0x11f8('0xc')](_0x5ec20c,'ms'));this[_0x11f8('0x9')]('closedAt',moment());this[_0x11f8('0x9')](_0x11f8('0xd'),_0x5ec20c);}},'startedAt':{'type':Sequelize[_0x11f8('0xe')],'get':function(){return moment(this[_0x11f8('0x4')](_0x11f8('0xb')))[_0x11f8('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x11f8('0x10')]();}},'closedAt':{'type':Sequelize[_0x11f8('0xe')],'get':function(){return moment(this[_0x11f8('0x4')]('closedAt'))[_0x11f8('0xf')](_0x11f8('0x11'))[_0x11f8('0x10')]();}},'createdAt':{'type':Sequelize[_0x11f8('0xe')],'get':function(){return moment(this['getDataValue'](_0x11f8('0x12')))[_0x11f8('0xf')](_0x11f8('0x11'))[_0x11f8('0x10')]();}},'updatedAt':{'type':Sequelize[_0x11f8('0xe')],'get':function(){return moment(this['getDataValue'](_0x11f8('0x13')))[_0x11f8('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x11f8('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 31d24e4..5c43a80 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 _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 +var _0x55ca=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','moment','bluebird','util','path'];(function(_0x53ed1a,_0x8a6e77){var _0x317cb5=function(_0x291af3){while(--_0x291af3){_0x53ed1a['push'](_0x53ed1a['shift']());}};_0x317cb5(++_0x8a6e77);}(_0x55ca,0x126));var _0xa55c=function(_0x546c68,_0x5c0116){_0x546c68=_0x546c68-0x0;var _0x4a2389=_0x55ca[_0x546c68];return _0x4a2389;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](_['map'](_0x201941,_0xa55c('0x25')),[_0xa55c('0x2e')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x906caa[_0xa55c('0x2f')]);_0x22f6b6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2f')]);_0x1377b0[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x22f6b6['model'],qs['fields'](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x1377b0['attributes']=_0x1377b0[_0xa55c('0x33')][_0xa55c('0x35')]?_0x1377b0[_0xa55c('0x33')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2f')][_0xa55c('0x36')](_0xa55c('0x37'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa['query']['limit']);_0x1377b0['offset']=qs[_0xa55c('0x1a')](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x1a')]);}_0x1377b0['order']=qs[_0xa55c('0x38')](_0x906caa['query'][_0xa55c('0x38')]);_0x1377b0['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x39')](_0x906caa[_0xa55c('0x2f')],_0x22f6b6['filters']),_0x201941);if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3a')]){_0x1377b0['where']=_[_0xa55c('0x3b')](_0x1377b0[_0xa55c('0x3c')],{'$or':_['map'](_0x201941,function(_0x529ff8){if(_0x529ff8[_0xa55c('0x2a')]!=='VIRTUAL'){var _0x1e75dc={};_0x1e75dc[_0x529ff8[_0xa55c('0x25')]]={'$like':'%'+_0x906caa['query']['filter']+'%'};return _0x1e75dc;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x3b3308={'where':_0x1377b0[_0xa55c('0x3c')]};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x3b3308)[_0xa55c('0x20')](function(_0x56d17c){_0x1b8388[_0xa55c('0x1d')]=_0x56d17c;if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3d')]){_0x1377b0[_0xa55c('0x3e')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0x1377b0);})['then'](function(_0x386e34){_0x1b8388['rows']=_0x386e34;return _0x1b8388;})['then'](respondWithFilteredResult(_0x5d940d,_0x1377b0))[_0xa55c('0x40')](handleError(_0x5d940d,null));};exports[_0xa55c('0x41')]=function(_0x496920,_0x2bd98b){var _0x508bd3={'raw':![],'where':{'id':_0x496920[_0xa55c('0x42')]['id']}},_0x5f25f7={};_0x5f25f7[_0xa55c('0x2c')]=_[_0xa55c('0x30')](db['ScreenRecording'][_0xa55c('0x43')]);_0x5f25f7[_0xa55c('0x2f')]=_['keys'](_0x496920[_0xa55c('0x2f')]);_0x5f25f7['filters']=_[_0xa55c('0x32')](_0x5f25f7[_0xa55c('0x2c')],_0x5f25f7['query']);_0x508bd3[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5f25f7['model'],qs[_0xa55c('0x34')](_0x496920[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x508bd3['attributes']=_0x508bd3[_0xa55c('0x33')]['length']?_0x508bd3[_0xa55c('0x33')]:_0x5f25f7[_0xa55c('0x2c')];if(_0x496920[_0xa55c('0x2f')]['includeAll']){_0x508bd3[_0xa55c('0x3e')]=[{'all':!![]}];}_0x508bd3=_[_0xa55c('0x3b')]({},_0x508bd3,_0x496920['options']);return db[_0xa55c('0x29')][_0xa55c('0x44')](_0x508bd3)['then'](handleEntityNotFound(_0x2bd98b,null))[_0xa55c('0x20')](respondWithResult(_0x2bd98b,null))[_0xa55c('0x40')](handleError(_0x2bd98b,null));};exports['create']=function(_0x46f839,_0x81cee8){return db[_0xa55c('0x29')][_0xa55c('0x45')](_0x46f839['body'],{})[_0xa55c('0x20')](respondWithResult(_0x81cee8,0xc9))['catch'](handleError(_0x81cee8,null));};exports[_0xa55c('0x1f')]=function(_0x213100,_0x194a79){if(_0x213100['body']['id']){delete _0x213100[_0xa55c('0x46')]['id'];}delete _0x213100[_0xa55c('0x46')]['duration'];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x47')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x48')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x49')];return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x213100[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x194a79,null))['then'](saveUpdates(_0x213100[_0xa55c('0x46')],null))[_0xa55c('0x20')](respondWithResult(_0x194a79,null))[_0xa55c('0x40')](handleError(_0x194a79,null));};exports['describe']=function(_0x4c3095,_0x35bf0a){return db['ScreenRecording'][_0xa55c('0x4a')]()['then'](respondWithResult(_0x35bf0a,null))[_0xa55c('0x40')](handleError(_0x35bf0a,null));};exports[_0xa55c('0x4b')]=function(_0x181802,_0x3f9313,_0x2ecf79){var _0x5b1cf3=require(_0xa55c('0x4c'));var _0x4607ca=![];var _0x4b85cc={};if(_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]&&_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]==='uniqueid'){_0x4b85cc['uniqueid']=_0x181802[_0xa55c('0x42')]['id'];}else{_0x4b85cc['id']=_0x181802[_0xa55c('0x42')]['id'];}return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':_0x4b85cc,'attributes':['id','value'],'raw':!![]})[_0xa55c('0x20')](handleEntityNotFound(_0x3f9313,null))['then'](function(_0x2742e4){if(_0x2742e4){var _0x437ced=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x2742e4['value']);var _0x1cb73b=util['format'](_0xa55c('0x50'),_0x437ced);if(fs[_0xa55c('0x51')](_0x1cb73b)){_0x4607ca=!![];return _0x5b1cf3[_0xa55c('0x52')](_0x1cb73b,_0x437ced,config[_0xa55c('0x53')][_0xa55c('0x54')])[_0xa55c('0x20')](function(){return _0x2742e4;});}return _0x2742e4;}})[_0xa55c('0x20')](function(_0x53e2be){if(_0x53e2be){var _0x450567=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x53e2be[_0xa55c('0x49')]);if(!fs['existsSync'](_0x450567)){throw new db[(_0xa55c('0x55'))][(_0xa55c('0x56'))](_0xa55c('0x57'));}if(_0x53e2be[_0xa55c('0x58')]){return _0x3f9313[_0xa55c('0x4b')](_0x450567,_0x53e2be['filename']+path[_0xa55c('0x59')](_0x450567),function(){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}else{return _0x3f9313[_0xa55c('0x4b')](_0x450567,function(_0x16d9b2){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}}})['catch'](function(_0x419fc3){if(_0x419fc3['message']===_0xa55c('0x57')){_0x3f9313['status'](0x194)[_0xa55c('0x26')]('Not\x20found');}else{return handleError(_0x3f9313,null);}});};exports[_0xa55c('0x5b')]=function(_0x1333da,_0x21d6b4){return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x1333da[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](function(_0x2f2226){if(_[_0xa55c('0x5c')](_0x2f2226)){throw new ReferenceError(_0xa55c('0x5d'));}return _0x2f2226;})['then'](function(_0x150a07){var _0x311bb9=path['join'](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x150a07[_0xa55c('0x49')]);logger[_0xa55c('0x5e')](_0xa55c('0x5f'),_0x311bb9);if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger['info'](_0xa55c('0x60')+_0x311bb9+_0xa55c('0x61'));fs[_0xa55c('0x62')](_0x311bb9);}_0x311bb9=_0x311bb9+_0xa55c('0x63');if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger[_0xa55c('0x5e')](_0xa55c('0x60')+_0x311bb9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa55c('0x62')](_0x311bb9);}return _0x150a07;})[_0xa55c('0x20')](function(_0x40c56a){if(!_0x40c56a)throw new InternalError();return _0x40c56a[_0xa55c('0x5b')]();})[_0xa55c('0x20')](function(){_0x21d6b4[_0xa55c('0x18')](0xcc)[_0xa55c('0x21')]();})[_0xa55c('0x40')](handleError(_0x21d6b4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 024ce18..946bd69 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 _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 +var _0x60e8=['moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','interactionid','lodash','util','../../config/logger'];(function(_0x1aba9c,_0x465976){var _0x414891=function(_0x179f91){while(--_0x179f91){_0x1aba9c['push'](_0x1aba9c['shift']());}};_0x414891(++_0x465976);}(_0x60e8,0x81));var _0x860e=function(_0x47f31b,_0xbbd26d){_0x47f31b=_0x47f31b-0x0;var _0x28623b=_0x60e8[_0x47f31b];return _0x28623b;};'use strict';var _=require(_0x860e('0x0'));var util=require(_0x860e('0x1'));var logger=require(_0x860e('0x2'))('api');var moment=require(_0x860e('0x3'));var BPromise=require(_0x860e('0x4'));var rp=require(_0x860e('0x5'));var fs=require('fs');var path=require(_0x860e('0x6'));var rimraf=require('rimraf');var config=require(_0x860e('0x7'));var attributes=require(_0x860e('0x8'));module[_0x860e('0x9')]=function(_0x2e384a,_0x4206fc){return _0x2e384a['define']('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x860e('0xa'),'fields':[_0x860e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 92f42f3..971ea9c 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 _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 +var _0x1ae9=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util'];(function(_0x50166f,_0x4f3444){var _0x349931=function(_0x5f4236){while(--_0x5f4236){_0x50166f['push'](_0x50166f['shift']());}};_0x349931(++_0x4f3444);}(_0x1ae9,0x152));var _0x91ae=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x1ae9[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0x91ae('0x0'));var util=require(_0x91ae('0x1'));var moment=require(_0x91ae('0x2'));var BPromise=require('bluebird');var rs=require(_0x91ae('0x3'));var fs=require('fs');var Redis=require(_0x91ae('0x4'));var db=require(_0x91ae('0x5'))['db'];var utils=require(_0x91ae('0x6'));var logger=require('../../config/logger')(_0x91ae('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x91ae('0x8')][_0x91ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f8aab,_0x381fa0,_0x2ab8d3){return new BPromise(function(_0x306a9e,_0x354db0){return client[_0x91ae('0xa')](_0x4f8aab,_0x2ab8d3)[_0x91ae('0xb')](function(_0x224e78){logger[_0x91ae('0xc')](_0x91ae('0xd'),_0x381fa0,_0x91ae('0xe'));logger['debug'](_0x91ae('0xf'),_0x381fa0,_0x91ae('0xe'),JSON['stringify'](_0x224e78));if(_0x224e78['error']){if(_0x224e78[_0x91ae('0x10')][_0x91ae('0x11')]===0x1f4){logger[_0x91ae('0x10')](_0x91ae('0xd'),_0x381fa0,_0x224e78[_0x91ae('0x10')][_0x91ae('0x12')]);return _0x354db0(_0x224e78[_0x91ae('0x10')][_0x91ae('0x12')]);}logger[_0x91ae('0x10')](_0x91ae('0xd'),_0x381fa0,_0x224e78[_0x91ae('0x10')][_0x91ae('0x12')]);return _0x306a9e(_0x224e78[_0x91ae('0x10')][_0x91ae('0x12')]);}else{logger[_0x91ae('0xc')](_0x91ae('0xd'),_0x381fa0,'request\x20sent');_0x306a9e(_0x224e78[_0x91ae('0x13')][_0x91ae('0x12')]);}})['catch'](function(_0xabff8){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x381fa0,_0xabff8);_0x354db0(_0xabff8);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index f41e303..90eb726 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 _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 +var _0x6058=['/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','file','join','format','logologin','single','addLogoLogin','preferred','addPreferred','favicon','put','update','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/now','getDate','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6058,0x6c));var _0x8605=function(_0x5182f9,_0x4acf0c){_0x5182f9=_0x5182f9-0x0;var _0x4c9fad=_0x6058[_0x5182f9];return _0x4c9fad;};'use strict';var multer=require('multer');var util=require(_0x8605('0x0'));var path=require(_0x8605('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8605('0x2')]();var fs_extra=require(_0x8605('0x3'));var auth=require(_0x8605('0x4'));var interaction=require(_0x8605('0x5'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x8605('0x6')]('/',auth['isAuthenticated'](),controller[_0x8605('0x7')]);router[_0x8605('0x6')](_0x8605('0x8'),controller[_0x8605('0x9')]);router['get'](_0x8605('0xa'),controller[_0x8605('0xb')]);router[_0x8605('0x6')](_0x8605('0xc'),controller[_0x8605('0xd')]);router['get'](_0x8605('0xe'),controller['getLogoLogin']);router[_0x8605('0x6')](_0x8605('0xf'),controller[_0x8605('0x10')]);router[_0x8605('0x6')](_0x8605('0x11'),controller[_0x8605('0x12')]);router[_0x8605('0x6')](_0x8605('0x13'),controller['getFavicon']);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x4ff686,_0x357704,_0x24fd88){_0x24fd88(null,path['join'](config[_0x8605('0x15')],_0x8605('0x16')));},'filename':function(_0x4f59b1,_0xebbb49,_0x41694a){_0x41694a(null,util['format'](_0x8605('0x17'),_0x8605('0x18'),path[_0x8605('0x19')](_0xebbb49[_0x8605('0x1a')])));}})});router[_0x8605('0x1b')](_0x8605('0xc'),upload['single'](_0x8605('0x1c')),controller['addLogo']);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x373e9e,_0x498c6a,_0x54d370){_0x54d370(null,path[_0x8605('0x1d')](config[_0x8605('0x15')],'server/files/images/logos/'));},'filename':function(_0x36646a,_0x1dc64e,_0x51ac48){_0x51ac48(null,util[_0x8605('0x1e')](_0x8605('0x17'),_0x8605('0x1f'),path['extname'](_0x1dc64e['originalname'])));}})});router[_0x8605('0x1b')](_0x8605('0xe'),upload[_0x8605('0x20')]('file'),controller[_0x8605('0x21')]);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x1c733c,_0x2de8cb,_0x3b8d76){_0x3b8d76(null,path[_0x8605('0x1d')](config[_0x8605('0x15')],_0x8605('0x16')));},'filename':function(_0x3e717c,_0x1ef22a,_0x1e9ccd){_0x1e9ccd(null,util[_0x8605('0x1e')](_0x8605('0x17'),_0x8605('0x22'),path['extname'](_0x1ef22a['originalname'])));}})});router['post'](_0x8605('0x11'),upload[_0x8605('0x20')]('file'),controller[_0x8605('0x23')]);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x29345f,_0x4f1ee6,_0x54a57e){_0x54a57e(null,path[_0x8605('0x1d')](config[_0x8605('0x15')],'server/files/images/logos/'));},'filename':function(_0x345aff,_0x245d79,_0x3f9184){_0x3f9184(null,util[_0x8605('0x1e')](_0x8605('0x17'),_0x8605('0x24'),path[_0x8605('0x19')](_0x245d79[_0x8605('0x1a')])));}})});router[_0x8605('0x1b')]('/:id/favicon',upload[_0x8605('0x20')]('file'),controller['addFavicon']);router[_0x8605('0x25')](_0x8605('0xa'),auth['isAuthenticated'](),controller[_0x8605('0x26')]);module[_0x8605('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index dcf9774..b19b420 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(_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 +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x402639,_0x1e1991){var _0x37633e=function(_0x44b094){while(--_0x44b094){_0x402639['push'](_0x402639['shift']());}};_0x37633e(++_0x1e1991);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 e9f8d8b..6c5bd39 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 _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 +var _0xe8a4=['bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','end','json','undefined','limit','count','offset','save','destroy','status','stack','name','map','Setting','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','filter','where','merge','options','findAll','rows','catch','params','fields','includeAll','include','body','find','file','filename','loginLogo','getLogo','server/files/images/logos','logo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','request-promise','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe8a4,0x158));var _0x4e8a=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xe8a4[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require(_0x4e8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e8a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e8a('0x2'));var moment=require(_0x4e8a('0x3'));var BPromise=require(_0x4e8a('0x4'));var Mustache=require('mustache');var util=require(_0x4e8a('0x5'));var path=require(_0x4e8a('0x6'));var sox=require('sox');var csv=require(_0x4e8a('0x7'));var ejs=require(_0x4e8a('0x8'));var fs=require('fs');var fs_extra=require(_0x4e8a('0x9'));var _=require(_0x4e8a('0xa'));var squel=require(_0x4e8a('0xb'));var crypto=require(_0x4e8a('0xc'));var jsforce=require(_0x4e8a('0xd'));var deskjs=require(_0x4e8a('0xe'));var toCsv=require(_0x4e8a('0x7'));var querystring=require(_0x4e8a('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e8a('0x10'));var authService=require(_0x4e8a('0x11'));var qs=require(_0x4e8a('0x12'));var as=require(_0x4e8a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e8a('0x14'))(_0x4e8a('0x15'));var utils=require('../../config/utils');var config=require(_0x4e8a('0x16'));var licenseUtil=require(_0x4e8a('0x17'));var db=require(_0x4e8a('0x18'))['db'];var jayson=require(_0x4e8a('0x19'));var client=jayson['client'][_0x4e8a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4f04d5,_0x39be1d,_0x25a431,_0x4270fb){return new BPromise(function(_0x4e5e38,_0x6e7291){var _0x4d342c=_0x4270fb||client;return _0x4d342c[_0x4e8a('0x1b')](_0x4f04d5,_0x25a431)[_0x4e8a('0x1c')](function(_0x61acb9){logger['info'](_0x4e8a('0x1d'),_0x39be1d,_0x4e8a('0x1e'));logger[_0x4e8a('0x1f')](_0x4e8a('0x20'),_0x39be1d,'request\x20sent',JSON[_0x4e8a('0x21')](_0x61acb9));if(_0x61acb9['error']){if(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x23')]===0x1f4){logger[_0x4e8a('0x22')](_0x4e8a('0x1d'),_0x39be1d,_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);return _0x6e7291(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);}logger[_0x4e8a('0x22')]('Setting,\x20%s,\x20%s',_0x39be1d,_0x61acb9['error']['message']);return _0x4e5e38(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);}else{logger[_0x4e8a('0x25')](_0x4e8a('0x1d'),_0x39be1d,_0x4e8a('0x1e'));_0x4e5e38(_0x61acb9['result']['message']);}})['catch'](function(_0x4955f9){logger[_0x4e8a('0x22')](_0x4e8a('0x1d'),_0x39be1d,_0x4955f9);_0x6e7291(_0x4955f9);});});}function respondWithStatusCode(_0x2a8948,_0x590b58){_0x590b58=_0x590b58||0xcc;return function(_0x1c2ce7){if(_0x1c2ce7){return _0x2a8948[_0x4e8a('0x26')](_0x590b58);}return _0x2a8948['status'](_0x590b58)[_0x4e8a('0x27')]();};}function respondWithResult(_0x3c80de,_0x50a80a){_0x50a80a=_0x50a80a||0xc8;return function(_0x1c6598){if(_0x1c6598){return _0x3c80de['status'](_0x50a80a)[_0x4e8a('0x28')](_0x1c6598);}};}function respondWithFilteredResult(_0x34b531,_0x3a9d32){return function(_0x690b4f){if(_0x690b4f){var _0x4a664f=typeof _0x3a9d32['offset']===_0x4e8a('0x29')&&typeof _0x3a9d32[_0x4e8a('0x2a')]==='undefined';var _0x3339ee=_0x690b4f['count'];var _0x1d22d5=_0x4a664f?0x0:_0x3a9d32['offset'];var _0x2d1e63=_0x4a664f?_0x690b4f[_0x4e8a('0x2b')]:_0x3a9d32[_0x4e8a('0x2c')]+_0x3a9d32[_0x4e8a('0x2a')];var _0x47190d;if(_0x2d1e63>=_0x3339ee){_0x2d1e63=_0x3339ee;_0x47190d=0xc8;}else{_0x47190d=0xce;}_0x34b531['status'](_0x47190d);return _0x34b531['set']('Content-Range',_0x1d22d5+'-'+_0x2d1e63+'/'+_0x3339ee)[_0x4e8a('0x28')](_0x690b4f);}return null;};}function patchUpdates(_0x2473b5){return function(_0x2a3703){try{jsonpatch['apply'](_0x2a3703,_0x2473b5,!![]);}catch(_0x3ebc0c){return BPromise['reject'](_0x3ebc0c);}return _0x2a3703[_0x4e8a('0x2d')]();};}function saveUpdates(_0x539b96,_0x4f8161){return function(_0x4c4c22){if(_0x4c4c22){return _0x4c4c22['update'](_0x539b96)[_0x4e8a('0x1c')](function(_0x3647df){return _0x3647df;});}return null;};}function removeEntity(_0x2177ed,_0x9331dd){return function(_0x2337ae){if(_0x2337ae){return _0x2337ae[_0x4e8a('0x2e')]()[_0x4e8a('0x1c')](function(){_0x2177ed[_0x4e8a('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x409fc8,_0x4b5f1e){return function(_0x3d9dd2){if(!_0x3d9dd2){_0x409fc8[_0x4e8a('0x26')](0x194);}return _0x3d9dd2;};}function handleError(_0x52ef06,_0x3fd5b9){_0x3fd5b9=_0x3fd5b9||0x1f4;return function(_0x5168b2){logger[_0x4e8a('0x22')](_0x5168b2[_0x4e8a('0x30')]);if(_0x5168b2[_0x4e8a('0x31')]){delete _0x5168b2[_0x4e8a('0x31')];}_0x52ef06['status'](_0x3fd5b9)['send'](_0x5168b2);};}exports['index']=function(_0x17340f,_0x5e79ea){var _0x4693ac={},_0xc4e355={},_0x37ca6e={'count':0x0,'rows':[]};var _0x5564df=_[_0x4e8a('0x32')](db[_0x4e8a('0x33')][_0x4e8a('0x34')],function(_0x297dfb){return{'name':_0x297dfb[_0x4e8a('0x35')],'type':_0x297dfb[_0x4e8a('0x36')]['key']};});_0xc4e355['model']=_['map'](_0x5564df,_0x4e8a('0x31'));_0xc4e355[_0x4e8a('0x37')]=_[_0x4e8a('0x38')](_0x17340f[_0x4e8a('0x37')]);_0xc4e355[_0x4e8a('0x39')]=_[_0x4e8a('0x3a')](_0xc4e355[_0x4e8a('0x3b')],_0xc4e355[_0x4e8a('0x37')]);_0x4693ac['attributes']=_['intersection'](_0xc4e355['model'],qs['fields'](_0x17340f[_0x4e8a('0x37')]['fields']));_0x4693ac[_0x4e8a('0x3c')]=_0x4693ac[_0x4e8a('0x3c')][_0x4e8a('0x3d')]?_0x4693ac['attributes']:_0xc4e355[_0x4e8a('0x3b')];if(!_0x17340f[_0x4e8a('0x37')]['hasOwnProperty'](_0x4e8a('0x3e'))){_0x4693ac[_0x4e8a('0x2a')]=qs['limit'](_0x17340f['query'][_0x4e8a('0x2a')]);_0x4693ac[_0x4e8a('0x2c')]=qs['offset'](_0x17340f[_0x4e8a('0x37')][_0x4e8a('0x2c')]);}_0x4693ac[_0x4e8a('0x3f')]=qs[_0x4e8a('0x40')](_0x17340f[_0x4e8a('0x37')][_0x4e8a('0x40')]);_0x4693ac['where']=qs[_0x4e8a('0x39')](_['pick'](_0x17340f[_0x4e8a('0x37')],_0xc4e355[_0x4e8a('0x39')]),_0x5564df);if(_0x17340f['query'][_0x4e8a('0x41')]){_0x4693ac[_0x4e8a('0x42')]=_[_0x4e8a('0x43')](_0x4693ac[_0x4e8a('0x42')],{'$or':_[_0x4e8a('0x32')](_0x5564df,function(_0x58916c){if(_0x58916c[_0x4e8a('0x36')]!=='VIRTUAL'){var _0x1309bd={};_0x1309bd[_0x58916c['name']]={'$like':'%'+_0x17340f[_0x4e8a('0x37')]['filter']+'%'};return _0x1309bd;}})});}_0x4693ac=_[_0x4e8a('0x43')]({},_0x4693ac,_0x17340f[_0x4e8a('0x44')]);var _0x1d92bb={'where':_0x4693ac['where']};return db[_0x4e8a('0x33')]['count'](_0x1d92bb)['then'](function(_0x3c700c){_0x37ca6e[_0x4e8a('0x2b')]=_0x3c700c;if(_0x17340f['query']['includeAll']){_0x4693ac['include']=[{'all':!![]}];}return db[_0x4e8a('0x33')][_0x4e8a('0x45')](_0x4693ac);})[_0x4e8a('0x1c')](function(_0x3a4f2b){_0x37ca6e[_0x4e8a('0x46')]=_0x3a4f2b;return _0x37ca6e;})['then'](respondWithFilteredResult(_0x5e79ea,_0x4693ac))[_0x4e8a('0x47')](handleError(_0x5e79ea,null));};exports['show']=function(_0x4c2c1b,_0xc0c96b){var _0xfeb06a={'raw':![],'where':{'id':_0x4c2c1b[_0x4e8a('0x48')]['id']}},_0x40b53f={};_0x40b53f[_0x4e8a('0x3b')]=_[_0x4e8a('0x38')](db[_0x4e8a('0x33')][_0x4e8a('0x34')]);_0x40b53f[_0x4e8a('0x37')]=_[_0x4e8a('0x38')](_0x4c2c1b[_0x4e8a('0x37')]);_0x40b53f[_0x4e8a('0x39')]=_['intersection'](_0x40b53f[_0x4e8a('0x3b')],_0x40b53f[_0x4e8a('0x37')]);_0xfeb06a['attributes']=_[_0x4e8a('0x3a')](_0x40b53f[_0x4e8a('0x3b')],qs[_0x4e8a('0x49')](_0x4c2c1b['query'][_0x4e8a('0x49')]));_0xfeb06a[_0x4e8a('0x3c')]=_0xfeb06a[_0x4e8a('0x3c')][_0x4e8a('0x3d')]?_0xfeb06a[_0x4e8a('0x3c')]:_0x40b53f['model'];if(_0x4c2c1b[_0x4e8a('0x37')][_0x4e8a('0x4a')]){_0xfeb06a[_0x4e8a('0x4b')]=[{'all':!![]}];}_0xfeb06a=_[_0x4e8a('0x43')]({},_0xfeb06a,_0x4c2c1b[_0x4e8a('0x44')]);return db[_0x4e8a('0x33')]['find'](_0xfeb06a)[_0x4e8a('0x1c')](handleEntityNotFound(_0xc0c96b,null))[_0x4e8a('0x1c')](respondWithResult(_0xc0c96b,null))[_0x4e8a('0x47')](handleError(_0xc0c96b,null));};exports['update']=function(_0x11ca60,_0x4515f5){if(_0x11ca60[_0x4e8a('0x4c')]['id']){delete _0x11ca60[_0x4e8a('0x4c')]['id'];}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x11ca60[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4515f5,null))[_0x4e8a('0x1c')](saveUpdates(_0x11ca60[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x4515f5,null))['catch'](handleError(_0x4515f5,null));};exports['addLogo']=function(_0x571ad7,_0x1ab43a,_0x1caa6d){if(_0x571ad7[_0x4e8a('0x4e')]&&_0x571ad7['file']['filename']){_0x571ad7[_0x4e8a('0x4c')]['logo']=_0x571ad7['file'][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x571ad7[_0x4e8a('0x48')]['id']}})[_0x4e8a('0x1c')](handleEntityNotFound(_0x1ab43a,null))[_0x4e8a('0x1c')](saveUpdates(_0x571ad7[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x1ab43a,null))[_0x4e8a('0x47')](handleError(_0x1ab43a,null));};exports['addLogoLogin']=function(_0x3d3a51,_0x234efe,_0xe91845){if(_0x3d3a51['file']&&_0x3d3a51['file'][_0x4e8a('0x4f')]){_0x3d3a51[_0x4e8a('0x4c')][_0x4e8a('0x50')]=_0x3d3a51[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x3d3a51[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x234efe,null))[_0x4e8a('0x1c')](saveUpdates(_0x3d3a51[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x234efe,null))['catch'](handleError(_0x234efe,null));};var utilLicense=require('../../config/license/util');exports[_0x4e8a('0x51')]=function(_0x3b3f87,_0x5c1c44,_0x20fb1c){var _0x47857e=_0x4e8a('0x52');var _0x4b418b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4aed87){if(_0x4aed87){_0x4b418b=_0x4aed87;}return db['Setting']['find']({'where':{'id':_0x3b3f87[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),'favicon',_0x4e8a('0x55'),_0x4e8a('0x56'),_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x5c1c44,null))[_0x4e8a('0x1c')](function(_0x1a807a){if(_0x1a807a){var _0x182c57=_0x1a807a['logo']&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_[_0x4e8a('0x5c')](_0x1a807a[_0x4e8a('0x53')])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_['toLower'](_0x1a807a[_0x4e8a('0x53')])):path['join'](config['root'],_0x47857e,_[_0x4e8a('0x5c')]('default_logo.svg'));var _0x48be64=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')](_0x4e8a('0x53'));if(_0x1a807a[_0x48be64]||!_0x4b418b[_0x4e8a('0x5f')]){_0x182c57=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_[_0x4e8a('0x5c')]('default_logo.svg'));}if(!fs[_0x4e8a('0x59')](_0x182c57)){throw new db[(_0x4e8a('0x60'))][(_0x4e8a('0x61'))](_[_0x4e8a('0x5e')](_0x4e8a('0x53'))+_0x4e8a('0x62'));}return _0x5c1c44[_0x4e8a('0x63')](_0x182c57);}})[_0x4e8a('0x47')](handleError(_0x5c1c44,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x64')]=function(_0x269e2f,_0x4d87ea,_0xd64425){var _0x5085d7='server/files/images/logos';var _0x272c72={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x24d1cd){if(_0x24d1cd){_0x272c72=_0x24d1cd;}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x269e2f['params']['id']},'attributes':[_0x4e8a('0x53'),'loginLogo',_0x4e8a('0x54'),_0x4e8a('0x65'),_0x4e8a('0x55'),'defaultLoginLogo',_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x4d87ea,null))[_0x4e8a('0x1c')](function(_0x5cdda){if(_0x5cdda){var _0x11db8f=_0x5cdda[_0x4e8a('0x50')]&&fs['existsSync'](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_[_0x4e8a('0x5c')](_0x5cdda[_0x4e8a('0x50')])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_['toLower'](_0x5cdda['loginLogo'])):path[_0x4e8a('0x5a')](config['root'],_0x5085d7,_[_0x4e8a('0x5c')](_0x4e8a('0x66')));var _0x3fd6e2=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')]('loginLogo');if(_0x5cdda[_0x3fd6e2]||!_0x272c72[_0x4e8a('0x5f')]){_0x11db8f=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_[_0x4e8a('0x5c')](_0x4e8a('0x66')));}if(!fs[_0x4e8a('0x59')](_0x11db8f)){throw new db['Sequelize'][(_0x4e8a('0x61'))](_[_0x4e8a('0x5e')](_0x4e8a('0x50'))+'\x20not\x20found');}return _0x4d87ea[_0x4e8a('0x63')](_0x11db8f);}})[_0x4e8a('0x47')](handleError(_0x4d87ea,null));};exports[_0x4e8a('0x67')]=function(_0x2a1bee,_0x36124d){return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x2a1bee[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x68')]})[_0x4e8a('0x1c')](respondWithResult(_0x36124d,null))[_0x4e8a('0x47')](handleError(_0x36124d,null));};exports[_0x4e8a('0x69')]=function(_0x4ea640,_0x340f39,_0x59c499){if(_0x4ea640[_0x4e8a('0x4e')]&&_0x4ea640[_0x4e8a('0x4e')][_0x4e8a('0x4f')]){_0x4ea640[_0x4e8a('0x4c')]['preferred']=_0x4ea640[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db['Setting'][_0x4e8a('0x4d')]({'where':{'id':_0x4ea640[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x340f39,null))[_0x4e8a('0x1c')](saveUpdates(_0x4ea640[_0x4e8a('0x4c')],null))['then'](respondWithResult(_0x340f39,null))[_0x4e8a('0x47')](handleError(_0x340f39,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x6a')]=function(_0x3a1902,_0xf8d79,_0x2047da){var _0x2b4220=_0x4e8a('0x52');var _0x52ef93={'custom':![]};return utilLicense[_0x4e8a('0x6b')]()['then'](function(_0x4feedd){if(_0x4feedd){_0x52ef93=_0x4feedd;}return db['Setting']['find']({'where':{'id':_0x3a1902[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),_0x4e8a('0x65'),'defaultLogo',_0x4e8a('0x56'),_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0xf8d79,null))['then'](function(_0x20503a){if(_0x20503a){var _0x1f7929=_0x20503a[_0x4e8a('0x54')]&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')](_0x20503a['preferred'])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_['toLower'](_0x20503a['preferred'])):path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')](_0x4e8a('0x6c')));var _0x1fbfcb=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')](_0x4e8a('0x54'));if(_0x20503a[_0x1fbfcb]||!_0x52ef93[_0x4e8a('0x5f')]||!_0x52ef93[_0x4e8a('0x54')]){_0x1f7929=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')]('default_preferred.png'));}if(!fs['existsSync'](_0x1f7929)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x4e8a('0x54'))+_0x4e8a('0x62'));}return _0xf8d79[_0x4e8a('0x63')](_0x1f7929);}})[_0x4e8a('0x47')](handleError(_0xf8d79,null));};exports[_0x4e8a('0x6d')]=function(_0xbc556b,_0x3f7720,_0x2f73e3){if(_0xbc556b[_0x4e8a('0x4e')]&&_0xbc556b['file']['filename']){_0xbc556b[_0x4e8a('0x4c')][_0x4e8a('0x65')]=_0xbc556b[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0xbc556b[_0x4e8a('0x48')]['id']}})[_0x4e8a('0x1c')](handleEntityNotFound(_0x3f7720,null))[_0x4e8a('0x1c')](saveUpdates(_0xbc556b['body'],null))[_0x4e8a('0x1c')](respondWithResult(_0x3f7720,null))[_0x4e8a('0x47')](handleError(_0x3f7720,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x6e')]=function(_0x3fd30d,_0x10c80f,_0x2aaf19){var _0x36366e=_0x4e8a('0x52');var _0x19cd89={'custom':![]};return utilLicense[_0x4e8a('0x6b')]()[_0x4e8a('0x1c')](function(_0xd095e7){if(_0xd095e7){_0x19cd89=_0xd095e7;}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x3fd30d[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),'favicon','defaultLogo',_0x4e8a('0x56'),_0x4e8a('0x57'),'defaultFavicon'],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x10c80f,null))[_0x4e8a('0x1c')](function(_0x35a8bd){if(_0x35a8bd){var _0x63d11a=_0x35a8bd[_0x4e8a('0x65')]&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config['root'],_0x36366e,_['toLower'](_0x35a8bd[_0x4e8a('0x65')])))?path[_0x4e8a('0x5a')](config['root'],_0x36366e,_[_0x4e8a('0x5c')](_0x35a8bd['favicon'])):path['join'](config[_0x4e8a('0x5b')],_0x36366e,_['toLower'](_0x4e8a('0x6f')));var _0x5eeb9d=_0x4e8a('0x5d')+_['upperFirst'](_0x4e8a('0x65'));if(_0x35a8bd[_0x5eeb9d]||!_0x19cd89['custom']){_0x63d11a=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x36366e,_[_0x4e8a('0x5c')](_0x4e8a('0x6f')));}if(!fs[_0x4e8a('0x59')](_0x63d11a)){throw new db[(_0x4e8a('0x60'))][(_0x4e8a('0x61'))](_['upperFirst'](_0x4e8a('0x65'))+_0x4e8a('0x62'));}return _0x10c80f[_0x4e8a('0x63')](_0x63d11a);}})['catch'](handleError(_0x10c80f,null));};exports[_0x4e8a('0x70')]=function(_0x4122e8,_0x18248e){var _0x1a245={'offset':moment()[_0x4e8a('0x71')]()};_0x1a245['now']=moment()['utcOffset'](_0x1a245[_0x4e8a('0x2c')])['format'](_0x4e8a('0x72'));return _0x18248e['status'](0xc8)[_0x4e8a('0x73')](_0x1a245);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 979afd9..5bb2479 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 _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 +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0xf859b3,_0x250f40){var _0x156c5b=function(_0x15f63d){while(--_0x15f63d){_0xf859b3['push'](_0xf859b3['shift']());}};_0x156c5b(++_0x250f40);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f8da5,_0x1d703b){_0x3f8da5=_0x3f8da5-0x0;var _0x5c19cf=_0xedd9[_0x3f8da5];return _0x5c19cf;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index a4d123e..f1b3dc2 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 _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 +var _0x3581=['map','include','model','ShowSetting','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','find','options','raw','where','attributes'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x3581,0x11b));var _0x1358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3581[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1358('0x0'));var rs=require(_0x1358('0x1'));var fs=require('fs');var Redis=require(_0x1358('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1358('0x3'));var logger=require(_0x1358('0x4'))('rpc');var config=require(_0x1358('0x5'));var jayson=require(_0x1358('0x6'));var client=jayson[_0x1358('0x7')][_0x1358('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58f1b9,_0x122608,_0x18ec68){return new BPromise(function(_0x3f4ccf,_0x16a9df){return client[_0x1358('0x9')](_0x58f1b9,_0x18ec68)[_0x1358('0xa')](function(_0x257338){logger[_0x1358('0xb')](_0x1358('0xc'),_0x122608,'request\x20sent');logger[_0x1358('0xd')](_0x1358('0xe'),_0x122608,_0x1358('0xf'),JSON[_0x1358('0x10')](_0x257338));if(_0x257338[_0x1358('0x11')]){if(_0x257338['error'][_0x1358('0x12')]===0x1f4){logger[_0x1358('0x11')]('Setting,\x20%s,\x20%s',_0x122608,_0x257338['error']['message']);return _0x16a9df(_0x257338['error'][_0x1358('0x13')]);}logger[_0x1358('0x11')](_0x1358('0xc'),_0x122608,_0x257338[_0x1358('0x11')][_0x1358('0x13')]);return _0x3f4ccf(_0x257338[_0x1358('0x11')]['message']);}else{logger[_0x1358('0xb')](_0x1358('0xc'),_0x122608,_0x1358('0xf'));_0x3f4ccf(_0x257338[_0x1358('0x14')][_0x1358('0x13')]);}})[_0x1358('0x15')](function(_0x1b041c){logger[_0x1358('0x11')](_0x1358('0xc'),_0x122608,_0x1b041c);_0x16a9df(_0x1b041c);});});}exports['ShowSetting']=function(_0xb80d86){var _0x5a6e73=this;return new Promise(function(_0x30cdc8,_0x5664d9){return db['Setting'][_0x1358('0x16')]({'raw':_0xb80d86[_0x1358('0x17')]?_0xb80d86[_0x1358('0x17')][_0x1358('0x18')]===undefined?!![]:![]:!![],'where':_0xb80d86[_0x1358('0x17')]?_0xb80d86['options'][_0x1358('0x19')]||null:null,'attributes':_0xb80d86[_0x1358('0x17')]?_0xb80d86[_0x1358('0x17')][_0x1358('0x1a')]||null:null,'include':_0xb80d86['options']?_0xb80d86['options']['include']?_[_0x1358('0x1b')](_0xb80d86[_0x1358('0x17')][_0x1358('0x1c')],function(_0x4740c){return{'model':db[_0x4740c[_0x1358('0x1d')]],'as':_0x4740c['as'],'attributes':_0x4740c[_0x1358('0x1a')],'include':_0x4740c['include']?_[_0x1358('0x1b')](_0x4740c[_0x1358('0x1c')],function(_0x4368c8){return{'model':db[_0x4368c8[_0x1358('0x1d')]],'as':_0x4368c8['as'],'attributes':_0x4368c8['attributes'],'include':_0x4368c8[_0x1358('0x1c')]?_[_0x1358('0x1b')](_0x4368c8[_0x1358('0x1c')],function(_0x4da13c){return{'model':db[_0x4da13c[_0x1358('0x1d')]],'as':_0x4da13c['as'],'attributes':_0x4da13c[_0x1358('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb0bfa4){logger[_0x1358('0xb')]('ShowSetting',_0xb80d86);logger[_0x1358('0xd')](_0x1358('0x1e'),_0xb80d86,JSON['stringify'](_0xb0bfa4));_0x30cdc8(_0xb0bfa4);})[_0x1358('0x15')](function(_0x201f24){logger[_0x1358('0x11')](_0x1358('0x1e'),_0x201f24[_0x1358('0x13')],_0xb80d86);_0x5664d9(_0x5a6e73[_0x1358('0x11')](0x1f4,_0x201f24[_0x1358('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 03fc665..31fcc05 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_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 +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(_0x381cbe,_0x17511b){var _0x1a615d=function(_0x2433d4){while(--_0x2433d4){_0x381cbe['push'](_0x381cbe['shift']());}};_0x1a615d(++_0x17511b);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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 62ee6c6..553b374 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 _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 +var _0x26be=['randomstring','exports','name','STRING','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x26be,0x15f));var _0xe26b=function(_0x260d37,_0xa7355e){_0x260d37=_0x260d37-0x0;var _0x1a2d8b=_0x26be[_0x260d37];return _0x1a2d8b;};'use strict';var Sequelize=require(_0xe26b('0x0'));var rs=require(_0xe26b('0x1'));module[_0xe26b('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xe26b('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xe26b('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xe26b('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe26b('0x5')](_0xe26b('0x6'),_0xe26b('0x7'),'connectel',_0xe26b('0x8'),_0xe26b('0x9'),_0xe26b('0xa'),_0xe26b('0xb'),_0xe26b('0xc'),'infobip',_0xe26b('0xd'))},'accountSid':{'type':Sequelize[_0xe26b('0x4')]},'authId':{'type':Sequelize[_0xe26b('0x4')]},'authToken':{'type':Sequelize[_0xe26b('0x4')]},'smsMethod':{'type':Sequelize[_0xe26b('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe26b('0x4')]},'password':{'type':Sequelize[_0xe26b('0x4')]},'apiKey':{'type':Sequelize[_0xe26b('0x4')]},'applicationId':{'type':Sequelize[_0xe26b('0x4')]},'accountId':{'type':Sequelize[_0xe26b('0x4')]},'senderString':{'type':Sequelize[_0xe26b('0x4')]},'deliveryReport':{'type':Sequelize[_0xe26b('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xe26b('0x4')]},'notificationTemplate':{'type':Sequelize[_0xe26b('0xf')],'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':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe26b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe26b('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe26b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe26b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe26b('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe26b('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe26b('0x12'),'set':function(_0x23187a){if(!_0x23187a)this[_0xe26b('0x13')](_0xe26b('0x14'),null);this[_0xe26b('0x13')](_0xe26b('0x15'),_0x23187a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 7735a37..702fe22 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 _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 +var _0x2892=['SmsApplication','Applications','account','applications','orderBy','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','from','message_id','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','mapKey','includes','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','SmsMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','stringify','Content-Type','text/xml','send','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','Contact','fullname','internal','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','csc','state','message-id','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','findOne','ids','addAnswer','CannedAnswer','getAnswers','length','removeAnswers','notify'];(function(_0x25787e,_0x12c583){var _0x3b4a65=function(_0x3473a7){while(--_0x3473a7){_0x25787e['push'](_0x25787e['shift']());}};_0x3b4a65(++_0x12c583);}(_0x2892,0x74));var _0x2289=function(_0x1e95b6,_0xf75a82){_0x1e95b6=_0x1e95b6-0x0;var _0x3982c6=_0x2892[_0x1e95b6];return _0x3982c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2289('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2289('0x1'));var moment=require(_0x2289('0x2'));var BPromise=require(_0x2289('0x3'));var Mustache=require('mustache');var util=require(_0x2289('0x4'));var path=require(_0x2289('0x5'));var sox=require(_0x2289('0x6'));var csv=require(_0x2289('0x7'));var ejs=require(_0x2289('0x8'));var fs=require('fs');var fs_extra=require(_0x2289('0x9'));var _=require(_0x2289('0xa'));var squel=require('squel');var crypto=require(_0x2289('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2289('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2289('0xd'));var Redis=require('ioredis');var authService=require(_0x2289('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2289('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2289('0x10'));var utils=require(_0x2289('0x11'));var config=require(_0x2289('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x2289('0x13'))['db'];config[_0x2289('0x14')]=_[_0x2289('0x15')](config[_0x2289('0x14')],{'host':_0x2289('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2289('0x14')]));require(_0x2289('0x17'))[_0x2289('0x18')](socket);var jayson=require(_0x2289('0x19'));var client=jayson['client'][_0x2289('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x1e188c,_0x2fe899,_0x370a0d,_0x38ccd0){return new BPromise(function(_0xa2ceb4,_0x2d1281){var _0x51b1c3=_0x38ccd0||client;return _0x51b1c3[_0x2289('0x1b')](_0x1e188c,_0x370a0d)[_0x2289('0x1c')](function(_0x2ccfae){logger[_0x2289('0x1d')](_0x2289('0x1e'),_0x2fe899,'request\x20sent');logger[_0x2289('0x1f')](_0x2289('0x20'),_0x2fe899,_0x2289('0x21'),JSON['stringify'](_0x2ccfae));if(_0x2ccfae['error']){if(_0x2ccfae[_0x2289('0x22')][_0x2289('0x23')]===0x1f4){logger[_0x2289('0x22')](_0x2289('0x1e'),_0x2fe899,_0x2ccfae[_0x2289('0x22')]['message']);return _0x2d1281(_0x2ccfae[_0x2289('0x22')]['message']);}logger['error'](_0x2289('0x1e'),_0x2fe899,_0x2ccfae[_0x2289('0x22')][_0x2289('0x24')]);return _0xa2ceb4(_0x2ccfae[_0x2289('0x22')]['message']);}else{logger['info'](_0x2289('0x1e'),_0x2fe899,'request\x20sent');_0xa2ceb4(_0x2ccfae[_0x2289('0x25')][_0x2289('0x24')]);}})['catch'](function(_0x1be522){logger[_0x2289('0x22')](_0x2289('0x1e'),_0x2fe899,_0x1be522);_0x2d1281(_0x1be522);});});}function respondWithStatusCode(_0x27fe5c,_0x56eb81){_0x56eb81=_0x56eb81||0xcc;return function(_0x1626d7){if(_0x1626d7){return _0x27fe5c[_0x2289('0x26')](_0x56eb81);}return _0x27fe5c[_0x2289('0x27')](_0x56eb81)['end']();};}function respondWithResult(_0x327540,_0x115c7b){_0x115c7b=_0x115c7b||0xc8;return function(_0x219352){if(_0x219352){return _0x327540[_0x2289('0x27')](_0x115c7b)['json'](_0x219352);}};}function respondWithFilteredResult(_0x24b9e9,_0x15d300){return function(_0x18cf4d){if(_0x18cf4d){var _0x1082c3=typeof _0x15d300[_0x2289('0x28')]===_0x2289('0x29')&&typeof _0x15d300[_0x2289('0x2a')]===_0x2289('0x29');var _0x387653=_0x18cf4d[_0x2289('0x2b')];var _0x88f73b=_0x1082c3?0x0:_0x15d300[_0x2289('0x28')];var _0x58e00a=_0x1082c3?_0x18cf4d['count']:_0x15d300['offset']+_0x15d300[_0x2289('0x2a')];var _0x4a11a1;if(_0x58e00a>=_0x387653){_0x58e00a=_0x387653;_0x4a11a1=0xc8;}else{_0x4a11a1=0xce;}_0x24b9e9['status'](_0x4a11a1);return _0x24b9e9[_0x2289('0x2c')](_0x2289('0x2d'),_0x88f73b+'-'+_0x58e00a+'/'+_0x387653)[_0x2289('0x2e')](_0x18cf4d);}return null;};}function patchUpdates(_0x19729b){return function(_0x218ae9){try{jsonpatch[_0x2289('0x2f')](_0x218ae9,_0x19729b,!![]);}catch(_0x18ad40){return BPromise[_0x2289('0x30')](_0x18ad40);}return _0x218ae9['save']();};}function saveUpdates(_0x36fe2a,_0x864350){return function(_0x2818da){if(_0x2818da){return _0x2818da[_0x2289('0x31')](_0x36fe2a)['then'](function(_0x35a98a){return _0x35a98a;});}return null;};}function removeEntity(_0x37c6d7,_0x485106){return function(_0x3eb0ce){if(_0x3eb0ce){return _0x3eb0ce['destroy']()[_0x2289('0x1c')](function(){var _0x9e2a6f=_0x3eb0ce[_0x2289('0x32')]({'plain':!![]});var _0x2a8b70=_0x2289('0x33');return db[_0x2289('0x34')][_0x2289('0x35')]({'where':{'type':_0x2a8b70,'resourceId':_0x9e2a6f['id']}})[_0x2289('0x1c')](function(){return _0x3eb0ce;});})[_0x2289('0x1c')](function(){_0x37c6d7[_0x2289('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cedc6,_0x14a509){return function(_0x1ae824){if(!_0x1ae824){_0x1cedc6['sendStatus'](0x194);}return _0x1ae824;};}function handleError(_0x2db333,_0x47a724){_0x47a724=_0x47a724||0x1f4;return function(_0x279f57){logger[_0x2289('0x22')](_0x279f57[_0x2289('0x36')]);if(_0x279f57[_0x2289('0x37')]){delete _0x279f57[_0x2289('0x37')];}_0x2db333['status'](_0x47a724)['send'](_0x279f57);};}exports['index']=function(_0x4277f5,_0x448197){var _0x1341bd={'include':[{'model':db[_0x2289('0x38')],'as':_0x2289('0x39')}]},_0x3b4cfd={},_0x4c5fd9={'count':0x0,'rows':[]};var _0x1d2b38=_[_0x2289('0x3a')](db[_0x2289('0x3b')]['rawAttributes'],function(_0x108597){return{'name':_0x108597[_0x2289('0x3c')],'type':_0x108597[_0x2289('0x3d')][_0x2289('0x3e')]};});_0x3b4cfd['model']=_[_0x2289('0x3a')](_0x1d2b38,'name');_0x3b4cfd[_0x2289('0x3f')]=_['keys'](_0x4277f5[_0x2289('0x3f')]);_0x3b4cfd['filters']=_['intersection'](_0x3b4cfd[_0x2289('0x40')],_0x3b4cfd[_0x2289('0x3f')]);_0x1341bd[_0x2289('0x41')]=_[_0x2289('0x42')](_0x3b4cfd['model'],qs[_0x2289('0x43')](_0x4277f5[_0x2289('0x3f')][_0x2289('0x43')]));_0x1341bd['attributes']=_0x1341bd[_0x2289('0x41')]['length']?_0x1341bd[_0x2289('0x41')]:_0x3b4cfd[_0x2289('0x40')];if(!_0x4277f5['query'][_0x2289('0x44')](_0x2289('0x45'))){_0x1341bd[_0x2289('0x2a')]=qs['limit'](_0x4277f5[_0x2289('0x3f')][_0x2289('0x2a')]);_0x1341bd[_0x2289('0x28')]=qs[_0x2289('0x28')](_0x4277f5[_0x2289('0x3f')][_0x2289('0x28')]);}_0x1341bd[_0x2289('0x46')]=qs[_0x2289('0x47')](_0x4277f5[_0x2289('0x3f')][_0x2289('0x47')]);_0x1341bd[_0x2289('0x48')]=qs[_0x2289('0x49')](_[_0x2289('0x4a')](_0x4277f5['query'],_0x3b4cfd['filters']),_0x1d2b38);if(_0x4277f5[_0x2289('0x3f')][_0x2289('0x4b')]){_0x1341bd[_0x2289('0x48')]=_[_0x2289('0x4c')](_0x1341bd['where'],{'$or':_[_0x2289('0x3a')](_0x1d2b38,function(_0x332adf){if(_0x332adf[_0x2289('0x3d')]!==_0x2289('0x4d')){var _0x334813={};_0x334813[_0x332adf[_0x2289('0x37')]]={'$like':'%'+_0x4277f5['query'][_0x2289('0x4b')]+'%'};return _0x334813;}})});}_0x1341bd=_[_0x2289('0x4c')]({},_0x1341bd,_0x4277f5[_0x2289('0x4e')]);var _0x54c2b6={'where':_0x1341bd[_0x2289('0x48')]};return db[_0x2289('0x3b')][_0x2289('0x2b')](_0x54c2b6)['then'](function(_0x497344){_0x4c5fd9[_0x2289('0x2b')]=_0x497344;if(_0x4277f5[_0x2289('0x3f')][_0x2289('0x4f')]){_0x1341bd[_0x2289('0x50')]=[{'all':!![]}];}return db['SmsAccount'][_0x2289('0x51')](_0x1341bd);})[_0x2289('0x1c')](function(_0xa27876){_0x4c5fd9[_0x2289('0x52')]=_0xa27876;return _0x4c5fd9;})[_0x2289('0x1c')](respondWithFilteredResult(_0x448197,_0x1341bd))[_0x2289('0x53')](handleError(_0x448197,null));};exports['show']=function(_0x1a2840,_0x7578f){var _0x24abf3={'raw':![],'where':{'id':_0x1a2840[_0x2289('0x54')]['id']},'include':[{'model':db[_0x2289('0x38')],'as':_0x2289('0x39')}]},_0x50144e={};_0x50144e['model']=_[_0x2289('0x55')](db[_0x2289('0x3b')][_0x2289('0x56')]);_0x50144e['query']=_[_0x2289('0x55')](_0x1a2840[_0x2289('0x3f')]);_0x50144e['filters']=_[_0x2289('0x42')](_0x50144e[_0x2289('0x40')],_0x50144e[_0x2289('0x3f')]);_0x24abf3[_0x2289('0x41')]=_[_0x2289('0x42')](_0x50144e[_0x2289('0x40')],qs[_0x2289('0x43')](_0x1a2840['query'][_0x2289('0x43')]));_0x24abf3['attributes']=_0x24abf3[_0x2289('0x41')]['length']?_0x24abf3[_0x2289('0x41')]:_0x50144e[_0x2289('0x40')];if(_0x1a2840['query'][_0x2289('0x4f')]){_0x24abf3[_0x2289('0x50')]=[{'all':!![]}];}_0x24abf3=_['merge']({},_0x24abf3,_0x1a2840[_0x2289('0x4e')]);return db['SmsAccount'][_0x2289('0x57')](_0x24abf3)[_0x2289('0x1c')](handleEntityNotFound(_0x7578f,null))[_0x2289('0x1c')](respondWithResult(_0x7578f,null))['catch'](handleError(_0x7578f,null));};exports[_0x2289('0x58')]=function(_0x13dbbc,_0x24d8cf){return db['SmsAccount']['create'](_0x13dbbc['body'],{})[_0x2289('0x1c')](function(_0xc82cd9){var _0x20b20b=_0x13dbbc[_0x2289('0x59')][_0x2289('0x32')]({'plain':!![]});if(!_0x20b20b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20b20b[_0x2289('0x5a')]==='user'){var _0x1171a0=_0xc82cd9[_0x2289('0x32')]({'plain':!![]});var _0x214c79=_0x2289('0x33');return db[_0x2289('0x5b')]['find']({'where':{'name':_0x214c79,'userProfileId':_0x20b20b[_0x2289('0x5c')]},'raw':!![]})['then'](function(_0x7b4cf5){if(_0x7b4cf5&&_0x7b4cf5[_0x2289('0x5d')]===0x0){return db[_0x2289('0x34')][_0x2289('0x58')]({'name':_0x1171a0[_0x2289('0x37')],'resourceId':_0x1171a0['id'],'type':_0x7b4cf5['name'],'sectionId':_0x7b4cf5['id']},{})['then'](function(){return _0xc82cd9;});}else{return _0xc82cd9;}})[_0x2289('0x53')](function(_0x25d193){logger[_0x2289('0x22')](_0x2289('0x5e'),_0x25d193);throw _0x25d193;});}return _0xc82cd9;})[_0x2289('0x1c')](respondWithResult(_0x24d8cf,0xc9))[_0x2289('0x53')](handleError(_0x24d8cf,null));};exports[_0x2289('0x31')]=function(_0xca7a62,_0x492691){if(_0xca7a62['body']['id']){delete _0xca7a62[_0x2289('0x5f')]['id'];}return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0xca7a62[_0x2289('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x2289('0x39')}]})[_0x2289('0x1c')](handleEntityNotFound(_0x492691,null))['then'](saveUpdates(_0xca7a62[_0x2289('0x5f')],null))[_0x2289('0x1c')](respondWithResult(_0x492691,null))[_0x2289('0x53')](handleError(_0x492691,null));};exports[_0x2289('0x35')]=function(_0x4386e9,_0x4cb688){return db[_0x2289('0x3b')]['find']({'where':{'id':_0x4386e9[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x4cb688,null))[_0x2289('0x1c')](removeEntity(_0x4cb688,null))[_0x2289('0x53')](handleError(_0x4cb688,null));};exports['describe']=function(_0x20ac25,_0x8bb334){return db[_0x2289('0x3b')][_0x2289('0x60')]()['then'](respondWithResult(_0x8bb334,null))[_0x2289('0x53')](handleError(_0x8bb334,null));};exports[_0x2289('0x61')]=function(_0x564044,_0x47f1fb,_0x3024c5){if(_0x564044[_0x2289('0x5f')]['id']){delete _0x564044[_0x2289('0x5f')]['id'];}return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x564044[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x47f1fb,null))[_0x2289('0x1c')](function(_0x4a9e65){if(_0x4a9e65){_0x564044['body'][_0x2289('0x62')]=_0x4a9e65['id'];return db[_0x2289('0x63')][_0x2289('0x58')](_0x564044[_0x2289('0x5f')]);}})['then'](respondWithResult(_0x47f1fb,null))['catch'](handleError(_0x47f1fb,null));};exports['getDispositions']=function(_0x339b82,_0x157409,_0x562867){var _0xb0b134={'raw':![],'where':{}};var _0x18dc8d={};var _0x2ac880={'count':0x0,'rows':[]};return db[_0x2289('0x3b')][_0x2289('0x64')]({'where':{'id':_0x339b82[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x157409,null))[_0x2289('0x1c')](function(_0x1d366d){if(_0x1d366d){_0x18dc8d[_0x2289('0x40')]=_[_0x2289('0x55')](db['Disposition']['rawAttributes']);_0x18dc8d[_0x2289('0x3f')]=_[_0x2289('0x55')](_0x339b82[_0x2289('0x3f')]);_0x18dc8d[_0x2289('0x49')]=_[_0x2289('0x42')](_0x18dc8d[_0x2289('0x40')],_0x18dc8d[_0x2289('0x3f')]);_0xb0b134[_0x2289('0x41')]=_[_0x2289('0x42')](_0x18dc8d[_0x2289('0x40')],qs['fields'](_0x339b82[_0x2289('0x3f')]['fields']));_0xb0b134[_0x2289('0x41')]=_0xb0b134[_0x2289('0x41')]['length']?_0xb0b134[_0x2289('0x41')]:_0x18dc8d[_0x2289('0x40')];if(!_0x339b82[_0x2289('0x3f')][_0x2289('0x44')]('nolimit')){_0xb0b134[_0x2289('0x2a')]=qs[_0x2289('0x2a')](_0x339b82[_0x2289('0x3f')][_0x2289('0x2a')]);_0xb0b134[_0x2289('0x28')]=qs[_0x2289('0x28')](_0x339b82[_0x2289('0x3f')][_0x2289('0x28')]);}_0xb0b134[_0x2289('0x46')]=qs[_0x2289('0x47')](_0x339b82[_0x2289('0x3f')][_0x2289('0x47')]);_0xb0b134[_0x2289('0x48')]=qs[_0x2289('0x49')](_[_0x2289('0x4a')](_0x339b82['query'],_0x18dc8d[_0x2289('0x49')]));_0xb0b134[_0x2289('0x48')][_0x2289('0x62')]=_0x1d366d['id'];if(_0x339b82[_0x2289('0x3f')][_0x2289('0x4b')]){_0xb0b134[_0x2289('0x48')]=_[_0x2289('0x4c')](_0xb0b134['where'],{'$or':_[_0x2289('0x3a')](_0xb0b134[_0x2289('0x41')],function(_0x1671ab){var _0x58dfe6={};_0x58dfe6[_0x1671ab]={'$like':'%'+_0x339b82[_0x2289('0x3f')][_0x2289('0x4b')]+'%'};return _0x58dfe6;})});}_0xb0b134=_['merge']({},_0xb0b134,_0x339b82[_0x2289('0x4e')]);return db['Disposition']['count']({'where':_0xb0b134['where']})[_0x2289('0x1c')](function(_0x55e608){_0x2ac880[_0x2289('0x2b')]=_0x55e608;if(_0x339b82[_0x2289('0x3f')][_0x2289('0x4f')]){_0xb0b134[_0x2289('0x50')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xb0b134);})['then'](function(_0x50ad36){_0x2ac880['rows']=_0x50ad36;return _0x2ac880;});}})[_0x2289('0x1c')](respondWithFilteredResult(_0x157409,_0xb0b134))['catch'](handleError(_0x157409,null));};exports['removeDispositions']=function(_0x52b4ae,_0x46d8ea,_0x3aecc4){return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x52b4ae[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x46d8ea,null))[_0x2289('0x1c')](function(_0x4b15fd){if(_0x4b15fd){return _0x4b15fd['removeDispositions'](_0x52b4ae['query'][_0x2289('0x65')]);}})[_0x2289('0x1c')](respondWithStatusCode(_0x46d8ea,null))['catch'](handleError(_0x46d8ea,null));};exports[_0x2289('0x66')]=function(_0x1b1290,_0x181e43,_0x36a988){if(_0x1b1290[_0x2289('0x5f')]['id']){delete _0x1b1290[_0x2289('0x5f')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x1b1290[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x181e43,null))[_0x2289('0x1c')](function(_0xcaa317){if(_0xcaa317){_0x1b1290['body'][_0x2289('0x62')]=_0xcaa317['id'];return db[_0x2289('0x67')][_0x2289('0x58')](_0x1b1290[_0x2289('0x5f')]);}})[_0x2289('0x1c')](respondWithResult(_0x181e43,null))[_0x2289('0x53')](handleError(_0x181e43,null));};exports[_0x2289('0x68')]=function(_0x26c472,_0x293e73,_0x133d1c){var _0x4215cd={'raw':![],'where':{}};var _0x3b34de={};var _0x162c53={'count':0x0,'rows':[]};return db[_0x2289('0x3b')]['findOne']({'where':{'id':_0x26c472[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x293e73,null))[_0x2289('0x1c')](function(_0x2d425d){if(_0x2d425d){_0x3b34de[_0x2289('0x40')]=_[_0x2289('0x55')](db[_0x2289('0x67')]['rawAttributes']);_0x3b34de[_0x2289('0x3f')]=_[_0x2289('0x55')](_0x26c472[_0x2289('0x3f')]);_0x3b34de['filters']=_[_0x2289('0x42')](_0x3b34de[_0x2289('0x40')],_0x3b34de[_0x2289('0x3f')]);_0x4215cd[_0x2289('0x41')]=_[_0x2289('0x42')](_0x3b34de[_0x2289('0x40')],qs['fields'](_0x26c472[_0x2289('0x3f')]['fields']));_0x4215cd[_0x2289('0x41')]=_0x4215cd[_0x2289('0x41')][_0x2289('0x69')]?_0x4215cd['attributes']:_0x3b34de['model'];if(!_0x26c472[_0x2289('0x3f')][_0x2289('0x44')]('nolimit')){_0x4215cd[_0x2289('0x2a')]=qs[_0x2289('0x2a')](_0x26c472[_0x2289('0x3f')][_0x2289('0x2a')]);_0x4215cd[_0x2289('0x28')]=qs[_0x2289('0x28')](_0x26c472[_0x2289('0x3f')]['offset']);}_0x4215cd[_0x2289('0x46')]=qs[_0x2289('0x47')](_0x26c472[_0x2289('0x3f')][_0x2289('0x47')]);_0x4215cd[_0x2289('0x48')]=qs['filters'](_[_0x2289('0x4a')](_0x26c472[_0x2289('0x3f')],_0x3b34de[_0x2289('0x49')]));_0x4215cd[_0x2289('0x48')][_0x2289('0x62')]=_0x2d425d['id'];if(_0x26c472[_0x2289('0x3f')][_0x2289('0x4b')]){_0x4215cd['where']=_['merge'](_0x4215cd[_0x2289('0x48')],{'$or':_['map'](_0x4215cd[_0x2289('0x41')],function(_0x396fc7){var _0x1e8072={};_0x1e8072[_0x396fc7]={'$like':'%'+_0x26c472[_0x2289('0x3f')][_0x2289('0x4b')]+'%'};return _0x1e8072;})});}_0x4215cd=_[_0x2289('0x4c')]({},_0x4215cd,_0x26c472[_0x2289('0x4e')]);return db[_0x2289('0x67')][_0x2289('0x2b')]({'where':_0x4215cd[_0x2289('0x48')]})[_0x2289('0x1c')](function(_0x5e2bef){_0x162c53[_0x2289('0x2b')]=_0x5e2bef;if(_0x26c472[_0x2289('0x3f')][_0x2289('0x4f')]){_0x4215cd[_0x2289('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2289('0x51')](_0x4215cd);})[_0x2289('0x1c')](function(_0x57e9bd){_0x162c53[_0x2289('0x52')]=_0x57e9bd;return _0x162c53;});}})['then'](respondWithFilteredResult(_0x293e73,_0x4215cd))[_0x2289('0x53')](handleError(_0x293e73,null));};exports[_0x2289('0x6a')]=function(_0x1c81d9,_0x35523f,_0x11f49f){return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x1c81d9[_0x2289('0x54')]['id']}})['then'](handleEntityNotFound(_0x35523f,null))['then'](function(_0x20e31e){if(_0x20e31e){return _0x20e31e['removeAnswers'](_0x1c81d9['query'][_0x2289('0x65')]);}})['then'](respondWithStatusCode(_0x35523f,null))['catch'](handleError(_0x35523f,null));};exports[_0x2289('0x6b')]=function(_0x207e4a,_0x17bcbb,_0x3b8574){var _0x2e820c={'channel':'sms'};var _0x3af2d1=[];var _0x14b3de=[];var _0x5bc69c={};return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x207e4a['params']['id']},'include':[{'model':db[_0x2289('0x6c')],'as':_0x2289('0x6d')}]})[_0x2289('0x1c')](handleEntityNotFound(_0x17bcbb,null))[_0x2289('0x1c')](function(_0x1e0d28){_0x2e820c[_0x2289('0x6e')]=_0x1e0d28;_0x2e820c[_0x2289('0x6f')]=_[_0x2289('0x70')](_0x1e0d28['Applications'],[_0x2289('0x71')],['asc']);if(_0x2e820c[_0x2289('0x6e')][_0x2289('0x6d')]){delete _0x2e820c[_0x2289('0x6e')][_0x2289('0x6d')];}return db[_0x2289('0x72')]['describe']();})[_0x2289('0x1c')](function(_0x28c73f){if(!_0x28c73f){throw new db['Sequelize']['ValidationError'](_0x2289('0x73'));}_0x3af2d1=_[_0x2289('0x74')](_['keys'](_0x28c73f),[_0x2289('0x75'),_0x2289('0x76')]);_0x14b3de=_[_0x2289('0x74')](_[_0x2289('0x55')](_0x28c73f),[_0x2289('0x75'),_0x2289('0x76'),_0x2289('0x77'),'ListId']);_0x2e820c[_0x2289('0x5f')]={'mapKey':_0x2289('0x78')};if(_0x2e820c[_0x2289('0x6e')][_0x2289('0x3d')]){switch(_0x2e820c[_0x2289('0x6e')][_0x2289('0x3d')]){case _0x2289('0x79'):_0x2e820c[_0x2289('0x5f')]['from']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x7a')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x7b')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x7c')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x7d')];break;case _0x2289('0x7e'):_0x2e820c['body']['from']='+'+_0x207e4a[_0x2289('0x5f')][_0x2289('0x7f')];_0x2e820c[_0x2289('0x5f')]['body']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x80')];break;case _0x2289('0x81'):_0x2e820c['body']['from']=_0x207e4a[_0x2289('0x5f')]['from'];_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x24')];break;case _0x2289('0x82'):_0x2e820c[_0x2289('0x5f')]['from']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x83')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x5f')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x7c')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x84')];break;case'plivo':_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')]=_0x207e4a['body'][_0x2289('0x7a')];_0x2e820c['body'][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x85')];_0x2e820c[_0x2289('0x5f')]['messageId']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x86')];break;case _0x2289('0x87'):_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')]='+'+_0x207e4a[_0x2289('0x5f')][_0x2289('0x88')][0x0][_0x2289('0x83')];_0x2e820c['body']['body']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x88')][0x0][_0x2289('0x80')];_0x2e820c[_0x2289('0x5f')]['messageId']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x88')][0x0]['messageId'];break;case'csc':_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x89')];_0x2e820c['body'][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x8a')]['message'];break;case _0x2289('0x8b'):_0x2e820c['body'][_0x2289('0x83')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x8c')];_0x2e820c['body'][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x80')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x7c')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x8d')];break;case _0x2289('0x8e'):_0x2e820c['body'][_0x2289('0x7c')]=_0x207e4a[_0x2289('0x5f')][0x0]['message']['id'];_0x2e820c['body'][_0x2289('0x83')]=_0x207e4a[_0x2289('0x5f')][0x0][_0x2289('0x24')][_0x2289('0x83')];_0x2e820c[_0x2289('0x5f')]['body']=_0x207e4a[_0x2289('0x5f')][0x0][_0x2289('0x24')][_0x2289('0x80')];break;case _0x2289('0x8f'):_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x83')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x24')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x7c')]=_0x207e4a['body'][_0x2289('0x90')];break;}}if(_0x2e820c[_0x2289('0x5f')]['id']){delete _0x2e820c['body']['id'];}if(_['isNil'](_0x2e820c['body'][_0x2289('0x83')])){throw new db[(_0x2289('0x91'))][(_0x2289('0x92'))](_0x2289('0x93'));}if(_[_0x2289('0x94')](_0x2e820c[_0x2289('0x5f')]['body'])||_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')]===''){throw new db[(_0x2289('0x91'))][(_0x2289('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2e820c[_0x2289('0x5f')][_0x2289('0x95')])){throw new db['Sequelize'][(_0x2289('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x14b3de);}if(!_[_0x2289('0x96')](_0x14b3de,_0x2e820c[_0x2289('0x5f')][_0x2289('0x95')])){throw new db['Sequelize'][(_0x2289('0x92'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x14b3de);}_0x5bc69c[_0x2e820c[_0x2289('0x5f')]['mapKey']]=_0x2e820c['body']['from'];return db[_0x2289('0x97')]['find']({'where':{'id':_0x2e820c[_0x2289('0x6e')][_0x2289('0x98')]},'include':[{'model':db[_0x2289('0x72')],'as':_0x2289('0x99'),'where':_0x5bc69c,'limit':0x1,'order':[['updatedAt',_0x2289('0x9a')]]}]});})[_0x2289('0x1c')](handleEntityNotFound(_0x17bcbb,null))[_0x2289('0x1c')](function(_0x5be3d9){if(_0x5be3d9){_0x2e820c[_0x2289('0x9b')]=_[_0x2289('0x9c')](_0x5be3d9,[_0x2289('0x99')]);if(_0x5be3d9[_0x2289('0x99')][_0x2289('0x69')]){return _0x5be3d9['Contacts'][0x0];}var _0x509bf2=_[_0x2289('0x15')](_0x2e820c[_0x2289('0x5f')],{'firstName':_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')],'ListId':_0x5be3d9['id']});_0x509bf2[_0x2e820c[_0x2289('0x5f')]['mapKey']]=_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')];return db[_0x2289('0x72')][_0x2289('0x58')](_0x509bf2,{'fields':_0x3af2d1,'raw':!![]});}})[_0x2289('0x1c')](handleEntityNotFound(_0x17bcbb,null))['then'](function(_0x5bf00d){if(_0x5bf00d){_0x2e820c[_0x2289('0x9d')]=_0x5bf00d;var _0x30a217={'ContactId':_0x5bf00d['id'],'phone':_0x2e820c[_0x2289('0x5f')]['from'],'SmsAccountId':_0x207e4a['params']['id']};var _0x54e06d={'ContactId':_0x5bf00d['id'],'SmsAccountId':_0x207e4a[_0x2289('0x54')]['id'],'closed':![]};return db[_0x2289('0x9e')]['find']({'where':_0x54e06d})[_0x2289('0x1c')](function(_0x52c5fa){if(_0x52c5fa){return[_0x52c5fa,![]];}return db[_0x2289('0x9e')][_0x2289('0x58')](_0x30a217)['then'](function(_0x143c72){return[_0x143c72,!![]];});});}})[_0x2289('0x9f')](function(_0xbfd34e,_0x555899){_0x2e820c[_0x2289('0xa0')]=_0xbfd34e[_0x2289('0x32')]({'plain':!![]});_0x2e820c[_0x2289('0xa0')][_0x2289('0xa1')]=![];if(_0x555899){if(_0x2e820c['account'][_0x2289('0xa2')]){_0x2e820c['applications'][_0x2289('0xa3')]({'id':0x0,'priority':_0x2e820c[_0x2289('0x6f')][_0x2289('0x69')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x2e820c['interaction'][_0x2289('0xa1')]=!![];}return db[_0x2289('0xa4')][_0x2289('0x58')]({'phone':_0x2e820c['body']['from'],'messageId':_0x2e820c[_0x2289('0x5f')]['messageId'],'body':_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')],'SmsAccountId':_0x207e4a[_0x2289('0x54')]['id'],'SmsInteractionId':_0xbfd34e['id'],'direction':'in','ContactId':_0xbfd34e['ContactId'],'AttachmentId':_0x2e820c[_0x2289('0x5f')][_0x2289('0xa5')]});})['then'](function(_0x168f30){_0x2e820c[_0x2289('0x24')]=_0x168f30;if(!_0x2e820c[_0x2289('0xa0')]['UserId'])return;return db[_0x2289('0xa6')][_0x2289('0x57')]({'attributes':['id','name'],'where':{'id':_0x2e820c[_0x2289('0xa0')][_0x2289('0xa7')]}});})['then'](function(_0x4cfe92){if(_0x4cfe92){_0x2e820c['applications'][_0x2289('0xa8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4cfe92[_0x2289('0x37')]+','+(_0x2e820c[_0x2289('0x6e')][_0x2289('0xa9')]||0xa),'interval':_0x2289('0xaa')});}if(!_0x2e820c[_0x2289('0xa0')][_0x2289('0xab')])return;return db[_0x2289('0xac')]['find']({'attributes':['id','name'],'where':{'id':_0x2e820c['interaction']['queueId']}});})[_0x2289('0x1c')](function(_0x5f46d2){if(_0x5f46d2){_0x2e820c[_0x2289('0x6f')]['unshift']({'id':0x0,'priority':0x1,'app':_0x2289('0xad'),'appdata':_0x5f46d2['name']+','+(_0x2e820c[_0x2289('0x6e')][_0x2289('0xae')]||0x12c),'interval':_0x2289('0xaa')});}return respondWithRpcPromise(_0x2289('0xaf'),'startRouting',_0x2e820c);})[_0x2289('0x1c')](function(_0x26fcba){if(_0x26fcba){var _0x1000cd=0xc8;var _0x577b8d=_0x2289('0xb0');logger[_0x2289('0x1d')](_0x2289('0x20'),_0x577b8d,_0x1000cd,_0x2289('0xb1'));logger[_0x2289('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x577b8d,_0x1000cd,_0x2289('0xb1'),JSON[_0x2289('0xb2')](_0x26fcba));if(_0x2e820c[_0x2289('0x6e')][_0x2289('0x3d')]==='twilio'){return _0x17bcbb[_0x2289('0x27')](_0x1000cd)[_0x2289('0x2c')](_0x2289('0xb3'),_0x2289('0xb4'))[_0x2289('0xb5')](_0x2289('0xb6'));}else{return _0x17bcbb[_0x2289('0x27')](_0x1000cd)['json'](_0x26fcba);}}})[_0x2289('0x53')](handleError(_0x17bcbb,null));};exports[_0x2289('0xb7')]=function(_0x5d6457,_0x1cfdd0){var _0x2d20e=_0x5d6457['params']['id'];var _0x2c21d4=_0x5d6457[_0x2289('0x5f')];var _0x41213e=0xc8;var _0x51c5a7=null;return db['sequelize'][_0x2289('0xb8')]({'isolationLevel':db[_0x2289('0xb9')][_0x2289('0xba')][_0x2289('0xbb')]['READ_COMMITTED']},function(_0x3f1e69){return db[_0x2289('0x3b')]['findOne']({'where':{'id':_0x2d20e},'transaction':_0x3f1e69})[_0x2289('0x1c')](function(_0x54b906){if(_0x54b906){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x2d20e},'transaction':_0x3f1e69})['then'](function(){var _0x55c386=_[_0x2289('0x3a')](_0x2c21d4,function(_0x4c98c5){_0x4c98c5[_0x2289('0x62')]=_0x2d20e;return _0x4c98c5;});return db[_0x2289('0x6c')][_0x2289('0xbc')](_0x55c386,{'transaction':_0x3f1e69});});}else{_0x41213e=0x194;_0x51c5a7=[];}});})[_0x2289('0x1c')](function(){if(_0x41213e!==0x194){return db['SmsApplication'][_0x2289('0xbd')]({'where':{'SmsAccountId':_0x2d20e},'order':'priority'})['then'](function(_0x8deca6){_0x51c5a7=_0x8deca6;});}})['catch'](function(_0x371849){_0x41213e=0x1f4;logger[_0x2289('0x22')](_0x371849[_0x2289('0x36')]);if(_0x371849[_0x2289('0x37')]){delete _0x371849['name'];}_0x51c5a7=_0x371849;})[_0x2289('0xbe')](function(){if(_0x51c5a7===null){_0x1cfdd0[_0x2289('0x26')](_0x41213e);}else{if(_0x41213e===0x1f4){_0x1cfdd0[_0x2289('0x27')](_0x41213e)[_0x2289('0xb5')](_0x51c5a7);}else{_0x1cfdd0['status'](_0x41213e)[_0x2289('0x2e')](_0x51c5a7);}}});};exports[_0x2289('0xbf')]=function(_0x180455,_0x170b8d,_0x2f62fe){var _0x69673f={};var _0x4bf93e={};var _0x143949;var _0x323000;return db[_0x2289('0x3b')]['findOne']({'where':{'id':_0x180455['params']['id']}})['then'](handleEntityNotFound(_0x170b8d,null))[_0x2289('0x1c')](function(_0x44b7da){if(_0x44b7da){_0x143949=_0x44b7da;_0x4bf93e[_0x2289('0x40')]=_[_0x2289('0x55')](db[_0x2289('0x6c')][_0x2289('0x56')]);_0x4bf93e[_0x2289('0x3f')]=_[_0x2289('0x55')](_0x180455[_0x2289('0x3f')]);_0x4bf93e[_0x2289('0x49')]=_[_0x2289('0x42')](_0x4bf93e[_0x2289('0x40')],_0x4bf93e[_0x2289('0x3f')]);_0x69673f[_0x2289('0x41')]=_[_0x2289('0x42')](_0x4bf93e[_0x2289('0x40')],qs[_0x2289('0x43')](_0x180455[_0x2289('0x3f')][_0x2289('0x43')]));_0x69673f['attributes']=_0x69673f['attributes'][_0x2289('0x69')]?_0x69673f[_0x2289('0x41')]:_0x4bf93e['model'];_0x69673f[_0x2289('0x46')]=qs['sort'](_0x180455['query'][_0x2289('0x47')]);_0x69673f[_0x2289('0x48')]=qs[_0x2289('0x49')](_['pick'](_0x180455[_0x2289('0x3f')],_0x4bf93e[_0x2289('0x49')]));if(_0x180455[_0x2289('0x3f')][_0x2289('0x4b')]){_0x69673f[_0x2289('0x48')]=_['merge'](_0x69673f[_0x2289('0x48')],{'$or':_[_0x2289('0x3a')](_0x69673f[_0x2289('0x41')],function(_0x30a37c){var _0x1fa00b={};_0x1fa00b[_0x30a37c]={'$like':'%'+_0x180455[_0x2289('0x3f')][_0x2289('0x4b')]+'%'};return _0x1fa00b;})});}_0x69673f=_[_0x2289('0x4c')]({},_0x69673f,_0x180455['options']);return _0x143949[_0x2289('0xbf')](_0x69673f);}})[_0x2289('0x1c')](function(_0x14545d){if(_0x14545d){_0x323000=_0x14545d[_0x2289('0x69')];if(!_0x180455[_0x2289('0x3f')][_0x2289('0x44')](_0x2289('0x45'))){_0x69673f[_0x2289('0x2a')]=qs[_0x2289('0x2a')](_0x180455[_0x2289('0x3f')][_0x2289('0x2a')]);_0x69673f[_0x2289('0x28')]=qs['offset'](_0x180455[_0x2289('0x3f')]['offset']);}return _0x143949[_0x2289('0xbf')](_0x69673f);}})['then'](function(_0x4d2898){if(_0x4d2898){return _0x4d2898?{'count':_0x323000,'rows':_0x4d2898}:null;}})[_0x2289('0x1c')](respondWithResult(_0x170b8d,null))[_0x2289('0x53')](handleError(_0x170b8d,null));};exports['getInteractions']=function(_0x4e7765,_0x5a8c94,_0x29f189){var _0x535204={'raw':![],'where':{}};var _0x13dbac={};var _0x3efd4d={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x4e7765[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x5a8c94,null))[_0x2289('0x1c')](function(_0x17434a){if(_0x17434a){_0x13dbac[_0x2289('0x40')]=_[_0x2289('0x55')](db[_0x2289('0x9e')][_0x2289('0x56')]);_0x13dbac[_0x2289('0x3f')]=_['keys'](_0x4e7765['query']);_0x13dbac[_0x2289('0x49')]=_[_0x2289('0x42')](_0x13dbac[_0x2289('0x40')],_0x13dbac['query']);_0x535204['attributes']=_['intersection'](_0x13dbac['model'],qs[_0x2289('0x43')](_0x4e7765[_0x2289('0x3f')][_0x2289('0x43')]));_0x535204['attributes']=_0x535204['attributes'][_0x2289('0x69')]?_0x535204[_0x2289('0x41')]:_0x13dbac[_0x2289('0x40')];if(!_0x4e7765[_0x2289('0x3f')]['hasOwnProperty']('nolimit')){_0x535204[_0x2289('0x2a')]=qs[_0x2289('0x2a')](_0x4e7765[_0x2289('0x3f')]['limit']);_0x535204['offset']=qs[_0x2289('0x28')](_0x4e7765[_0x2289('0x3f')][_0x2289('0x28')]);}_0x535204['order']=qs[_0x2289('0x47')](_0x4e7765['query'][_0x2289('0x47')]);_0x535204[_0x2289('0x48')]=qs[_0x2289('0x49')](_['pick'](_0x4e7765['query'],_0x13dbac[_0x2289('0x49')]));_0x535204[_0x2289('0x48')][_0x2289('0x62')]=_0x17434a['id'];if(_0x4e7765[_0x2289('0x3f')][_0x2289('0x4b')]){_0x535204[_0x2289('0x48')]=_[_0x2289('0x4c')](_0x535204['where'],{'$or':_[_0x2289('0x3a')](_0x535204['attributes'],function(_0x57ded7){var _0x30c63c={};_0x30c63c[_0x57ded7]={'$like':'%'+_0x4e7765['query']['filter']+'%'};return _0x30c63c;})});}_0x535204=_['merge']({},_0x535204,_0x4e7765['options']);return db[_0x2289('0x9e')][_0x2289('0x2b')]({'where':_0x535204[_0x2289('0x48')]})[_0x2289('0x1c')](function(_0x1bcbc6){_0x3efd4d[_0x2289('0x2b')]=_0x1bcbc6;if(_0x4e7765['query'][_0x2289('0x4f')]){_0x535204[_0x2289('0x50')]=[{'model':db[_0x2289('0x72')],'as':_0x2289('0xc0'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x2289('0x37'),_0x2289('0xc1'),_0x2289('0xc2')],'required':![]},{'model':db['Tag'],'as':_0x2289('0xc3'),'attributes':['id',_0x2289('0x37'),'color'],'where':_0x4e7765[_0x2289('0x3f')][_0x2289('0xc4')]?{'id':_0x4e7765['query'][_0x2289('0xc4')]}:undefined,'required':_0x4e7765['query']['tag']?!![]:![]}];}return db[_0x2289('0x9e')][_0x2289('0x51')](_0x535204);})[_0x2289('0x1c')](function(_0x1f74f3){_0x3efd4d[_0x2289('0x52')]=_0x1f74f3;return _0x3efd4d;});}})[_0x2289('0x1c')](respondWithFilteredResult(_0x5a8c94,_0x535204))['catch'](handleError(_0x5a8c94,null));};exports[_0x2289('0xb5')]=function(_0x49b038,_0x47420e,_0x37d211){var _0x2b0c6f,_0x2b750c,_0x4b4a6b;if(_[_0x2289('0x94')](_0x49b038[_0x2289('0x5f')][_0x2289('0x5f')])||_0x49b038['body'][_0x2289('0x5f')]===''){throw new db['Sequelize'][(_0x2289('0x92'))](_0x2289('0xc5'));}if(_['isNil'](_0x49b038['body']['to'])){throw new db[(_0x2289('0x91'))]['ValidationError'](_0x2289('0xc6'));}_0x2b0c6f=_0x49b038[_0x2289('0x5f')]['to'];return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x49b038[_0x2289('0x54')]['id']},'include':[{'model':db[_0x2289('0x97')],'as':'List','include':[{'model':db['CmContact'],'as':_0x2289('0x99'),'where':{'mobile':_0x2b0c6f},'limit':0x1,'order':[['updatedAt',_0x2289('0x9a')]]}]}]})[_0x2289('0x1c')](handleEntityNotFound(_0x47420e,null))['then'](function(_0x39684a){if(_0x39684a&&_0x39684a[_0x2289('0xc7')]){_0x2b750c=_0x39684a[_0x2289('0x32')]({'plain':!![]});if(_0x2b750c['List']&&_0x2b750c[_0x2289('0xc7')][_0x2289('0x99')]['length']){return _0x2b750c['List'][_0x2289('0x99')][0x0];}return db[_0x2289('0x72')][_0x2289('0x58')](_[_0x2289('0x15')](_0x49b038['body'],{'firstName':_0x2b0c6f,'mobile':_0x2b0c6f,'phone':_0x2b0c6f,'ListId':_0x2b750c[_0x2289('0x98')]}));}})[_0x2289('0x1c')](handleEntityNotFound(_0x47420e,null))[_0x2289('0x1c')](function(_0x4dba75){if(_0x4dba75){_0x4b4a6b=_0x4dba75;return db[_0x2289('0x9e')]['find']({'where':{'ContactId':_0x4b4a6b['id'],'closed':![],'SmsAccountId':_0x2b750c['id']}})[_0x2289('0x1c')](function(_0x3dbfb7){if(_0x3dbfb7){return[_0x3dbfb7,![]];}return db[_0x2289('0x9e')]['create']({'UserId':_0x49b038[_0x2289('0x59')]['id'],'ContactId':_0x4b4a6b['id'],'SmsAccountId':_0x2b750c['id'],'phone':_0x2b0c6f,'firstMsgDirection':_0x2289('0xc8'),'Messages':[_[_0x2289('0x4c')](_0x49b038[_0x2289('0x5f')],{'read':![],'body':_0x49b038[_0x2289('0x5f')]['body'],'phone':_0x2b0c6f,'SmsAccountId':_0x2b750c['id'],'UserId':_0x49b038[_0x2289('0x59')]['id'],'ContactId':_0x4b4a6b['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x2289('0xc9')}]})['then'](function(_0x4b12d9){return[_0x4b12d9,!![]];});});}})[_0x2289('0x9f')](function(_0x2c795c,_0x7ed0f8){if(_0x7ed0f8){return _0x2c795c;}return db[_0x2289('0xa4')][_0x2289('0x58')](_['merge'](_0x49b038[_0x2289('0x5f')],{'read':![],'body':_0x49b038[_0x2289('0x5f')][_0x2289('0x5f')],'phone':_0x2b0c6f,'SmsAccountId':_0x2b750c['id'],'SmsInteractionId':_0x2c795c['id'],'UserId':_0x49b038[_0x2289('0x59')]['id'],'ContactId':_0x4b4a6b['id']}))['then'](function(_0xc6a789){_0x2c795c[_0x2289('0xca')]['Messages']=[];_0x2c795c['dataValues']['Messages'][_0x2289('0xa3')](_0xc6a789[_0x2289('0xca')]);return _0x2c795c;});})['then'](respondWithResult(_0x47420e,null))[_0x2289('0x53')](handleError(_0x47420e,null));};exports['status']=function(_0x30fe16,_0x556a3d,_0x4000eb){if(_0x30fe16[_0x2289('0x5f')]['id']){delete _0x30fe16[_0x2289('0x5f')]['id'];}var _0x1e3d1f,_0x1e8636,_0x1a6cd6;return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x30fe16[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x556a3d,null))[_0x2289('0x1c')](function(_0x57c013){if(_0x57c013){_0x1a6cd6=_0x57c013;logger[_0x2289('0x1f')](_0x2289('0x20'),'status',_0x2289('0xcb'),_0x57c013[_0x2289('0x3d')],util[_0x2289('0xcc')](_0x30fe16['body'],{'showHidden':![],'depth':null}));switch(_0x57c013[_0x2289('0x3d')]){case _0x2289('0x7e'):if(_0x30fe16[_0x2289('0x5f')][_0x2289('0xcd')]&&_0x30fe16[_0x2289('0x5f')][_0x2289('0x27')]){_0x1e8636=_0x30fe16[_0x2289('0x5f')][_0x2289('0x27')];return db[_0x2289('0xa4')][_0x2289('0x57')]({'where':{'messageId':_0x30fe16[_0x2289('0x5f')][_0x2289('0xcd')]}});}break;case _0x2289('0x81'):if(_0x30fe16[_0x2289('0x5f')][_0x2289('0xce')]&&_0x30fe16[_0x2289('0x5f')][_0x2289('0xcf')]){_0x1e8636=_0x30fe16[_0x2289('0x5f')][_0x2289('0xcf')];return db['SmsMessage'][_0x2289('0x57')]({'where':{'messageId':_0x30fe16[_0x2289('0x5f')][_0x2289('0xce')]}});}break;case'clicksend':if(_0x30fe16[_0x2289('0x5f')]['message_id']&&_0x30fe16['body'][_0x2289('0xd0')]){_0x1e8636=_0x30fe16['body'][_0x2289('0xd0')];return db['SmsMessage'][_0x2289('0x57')]({'where':{'messageId':_0x30fe16[_0x2289('0x5f')][_0x2289('0x84')]}});}break;case _0x2289('0x87'):var _0x5757d3=_0x30fe16[_0x2289('0x5f')][_0x2289('0x88')][0x0];if(_0x5757d3[_0x2289('0x7c')]&&_0x5757d3[_0x2289('0x27')][_0x2289('0xd1')]===_0x2289('0xd2')){_0x1e8636=_0x5757d3[_0x2289('0x27')][_0x2289('0xd1')];return db[_0x2289('0xa4')][_0x2289('0x57')]({'where':{'messageId':_0x5757d3[_0x2289('0x7c')]}});}break;case _0x2289('0x8b'):if(_0x30fe16[_0x2289('0x5f')]['messageId']&&_0x30fe16['body']['status']){_0x1e8636=_0x30fe16['body'][_0x2289('0x27')];return db['SmsMessage']['find']({'where':{'messageId':_0x30fe16[_0x2289('0x5f')][_0x2289('0x7c')]}});}break;case _0x2289('0x8e'):if(_0x30fe16[_0x2289('0x5f')][0x0]['message']['id']){_0x1e8636=_0x30fe16[_0x2289('0x5f')][0x0][_0x2289('0x3d')];return db[_0x2289('0xa4')][_0x2289('0x57')]({'where':{'messageId':_0x30fe16[_0x2289('0x5f')][0x0][_0x2289('0x24')]['id']}});}break;case _0x2289('0x8f'):if(_0x30fe16[_0x2289('0x5f')][_0x2289('0xd3')]&&_0x30fe16[_0x2289('0x5f')][_0x2289('0x27')]){_0x1e8636=_0x30fe16[_0x2289('0x5f')][_0x2289('0x27')];return db['SmsMessage']['find']({'where':{'messageId':_0x30fe16['body']['redif']}});}break;}}})['then'](handleEntityNotFound(_0x556a3d,null))[_0x2289('0x1c')](function(_0x46d027){if(_0x46d027){_0x1e3d1f=_0x46d027;switch(_0x1a6cd6['type']){case _0x2289('0x7e'):if(_0x1e8636===_0x2289('0xd2')){return _0x1e3d1f[_0x2289('0x31')]({'read':!![]});}else{logger[_0x2289('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0x2289('0xcc')](_0x30fe16['body'],{'showHidden':![],'depth':null}));}break;case _0x2289('0x81'):if(_0x1e8636==='1'){return _0x1e3d1f[_0x2289('0x31')]({'read':!![]});}else{logger[_0x2289('0x22')](_0x2289('0x20'),_0x2289('0x27'),_0x2289('0x7e'),util[_0x2289('0xcc')](_0x30fe16[_0x2289('0x5f')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x30fe16[_0x2289('0x5f')]['error_code']&&_0x1e8636>=0xc8&&_0x1e8636<=0xce){return _0x1e3d1f[_0x2289('0x31')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2289('0x27'),_0x2289('0x82'),util[_0x2289('0xcc')](_0x30fe16[_0x2289('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xe6c17f=_0x30fe16['body'][_0x2289('0x88')][0x0];if(_0xe6c17f[_0x2289('0x27')]['groupName']===_0x2289('0xd2')){return _0x1e3d1f['update']({'read':!![]});}else{logger[_0x2289('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2289('0x27'),_0x2289('0x87'),util[_0x2289('0xcc')](_0x30fe16['body'],{'showHidden':![],'depth':null}));}break;case _0x2289('0x8b'):if(_0x1e8636==_0x2289('0xd4')||_0x1e8636==_0x2289('0xd5')){return _0x1e3d1f[_0x2289('0x31')]({'read':!![]});}else{logger[_0x2289('0x22')](_0x2289('0x20'),'status',_0x2289('0x8b'),util['inspect'](_0x30fe16['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x1e8636==_0x2289('0xd6')){return _0x1e3d1f['update']({'read':!![]});}else{logger['error'](_0x2289('0x20'),_0x2289('0x27'),_0x2289('0x8e'),util['inspect'](_0x30fe16[_0x2289('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2289('0x8f'):if(_0x1e8636==='DELIVRD'||_0x1e8636==='ACCEPTD'){return _0x1e3d1f[_0x2289('0x31')]({'read':!![]});}else{logger[_0x2289('0x22')](_0x2289('0x20'),_0x2289('0x27'),_0x2289('0x8f'),util['inspect'](_0x30fe16[_0x2289('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x1e3d1f;}})['then'](respondWithResult(_0x556a3d,null))['catch'](handleError(_0x556a3d,null));};exports['statusGet']=function(_0x2bbcdc,_0x5ce7c3,_0x4b2639){var _0x19c2ab,_0x3c50c4,_0x2d5588;return db['SmsAccount']['find']({'where':{'id':_0x2bbcdc[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x5ce7c3,null))[_0x2289('0x1c')](function(_0x1a1a0c){if(_0x1a1a0c){_0x2d5588=_0x1a1a0c;logger[_0x2289('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2289('0x27'),'received\x20delivery\x20report\x20from',_0x1a1a0c[_0x2289('0x3d')],util[_0x2289('0xcc')](_0x2bbcdc[_0x2289('0x3f')],{'showHidden':![],'depth':null}));switch(_0x1a1a0c[_0x2289('0x3d')]){case _0x2289('0xd7'):if(_0x2bbcdc[_0x2289('0x3f')]['message-id']&&_0x2bbcdc[_0x2289('0x3f')]['state']){_0x3c50c4=_0x2bbcdc[_0x2289('0x3f')][_0x2289('0xd8')];return db[_0x2289('0xa4')]['find']({'where':{'messageId':_0x2bbcdc[_0x2289('0x3f')][_0x2289('0xd9')]}});}break;}}})[_0x2289('0x1c')](handleEntityNotFound(_0x5ce7c3,null))[_0x2289('0x1c')](function(_0x2ccc41){if(_0x2ccc41){_0x19c2ab=_0x2ccc41;switch(_0x2d5588[_0x2289('0x3d')]){case _0x2289('0xd7'):if(_0x3c50c4==='2'||_0x3c50c4==='6'){return _0x19c2ab[_0x2289('0x31')]({'read':!![]});}else{logger['error'](_0x2289('0x20'),_0x2289('0x27'),_0x2289('0xd7'),util['inspect'](_0x2bbcdc['query'],{'showHidden':![],'depth':null}));};break;}return _0x19c2ab;}})[_0x2289('0x1c')](respondWithResult(_0x5ce7c3,null))[_0x2289('0x53')](handleError(_0x5ce7c3,null));};exports['addAgents']=function(_0x571a65,_0x1b838c,_0x4ea123){return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x571a65[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x1b838c,null))[_0x2289('0x1c')](function(_0x174936){if(_0x174936){return _0x174936['addAgents'](_0x571a65['body'][_0x2289('0x65')],_[_0x2289('0x9c')](_0x571a65[_0x2289('0x5f')],[_0x2289('0x65'),'id'])||{})['spread'](function(_0x2463cd){for(var _0x106498=0x0;_0x106498<_0x571a65[_0x2289('0x5f')][_0x2289('0x65')][_0x2289('0x69')];_0x106498+=0x1){socket[_0x2289('0xda')](_0x2289('0xdb'),{'UserId':Number(_0x571a65['body'][_0x2289('0x65')][_0x106498]),'SmsAccountId':Number(_0x571a65[_0x2289('0x54')]['id'])});}return _0x2463cd;});}})[_0x2289('0x1c')](respondWithResult(_0x1b838c,null))[_0x2289('0x53')](handleError(_0x1b838c,null));};exports['removeAgents']=function(_0xcc27da,_0x18397c,_0x9cfc87){return db[_0x2289('0x3b')]['find']({'where':{'id':_0xcc27da['params']['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x18397c,null))['then'](function(_0x43138d){if(_0x43138d){return _0x43138d[_0x2289('0xdc')](_0xcc27da['query']['ids'])['then'](function(){if(_[_0x2289('0xdd')](_0xcc27da[_0x2289('0x3f')][_0x2289('0x65')])){for(var _0x5e8e60=0x0;_0x5e8e60<_0xcc27da[_0x2289('0x3f')][_0x2289('0x65')][_0x2289('0x69')];_0x5e8e60+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0xcc27da['query'][_0x2289('0x65')][_0x5e8e60]),'SmsAccountId':Number(_0xcc27da[_0x2289('0x54')]['id'])});}}else{socket[_0x2289('0xda')](_0x2289('0xde'),{'UserId':Number(_0xcc27da['query'][_0x2289('0x65')]),'SmsAccountId':Number(_0xcc27da[_0x2289('0x54')]['id'])});}});}})[_0x2289('0x1c')](respondWithStatusCode(_0x18397c,null))[_0x2289('0x53')](handleError(_0x18397c,null));};exports[_0x2289('0xdf')]=function(_0x5536e4,_0x4b0ebc,_0x5e2eeb){var _0x3dd541={};var _0x30895d={};var _0x34ee61;var _0x21fa19;return db[_0x2289('0x3b')]['findOne']({'where':{'id':_0x5536e4[_0x2289('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b0ebc,null))[_0x2289('0x1c')](function(_0x4156e1){if(_0x4156e1){_0x34ee61=_0x4156e1;_0x30895d[_0x2289('0x40')]=_['keys'](db[_0x2289('0xa6')]['rawAttributes']);_0x30895d[_0x2289('0x3f')]=_[_0x2289('0x55')](_0x5536e4[_0x2289('0x3f')]);_0x30895d['filters']=_[_0x2289('0x42')](_0x30895d['model'],_0x30895d['query']);_0x3dd541[_0x2289('0x41')]=_['intersection'](_0x30895d[_0x2289('0x40')],qs[_0x2289('0x43')](_0x5536e4[_0x2289('0x3f')][_0x2289('0x43')]));_0x3dd541[_0x2289('0x41')]=_0x3dd541[_0x2289('0x41')][_0x2289('0x69')]?_0x3dd541[_0x2289('0x41')]:_0x30895d[_0x2289('0x40')];_0x3dd541[_0x2289('0x46')]=qs[_0x2289('0x47')](_0x5536e4[_0x2289('0x3f')][_0x2289('0x47')]);_0x3dd541[_0x2289('0x48')]=qs[_0x2289('0x49')](_[_0x2289('0x4a')](_0x5536e4[_0x2289('0x3f')],_0x30895d[_0x2289('0x49')]));if(_0x5536e4[_0x2289('0x3f')][_0x2289('0x4b')]){_0x3dd541[_0x2289('0x48')]=_[_0x2289('0x4c')](_0x3dd541[_0x2289('0x48')],{'$or':_[_0x2289('0x3a')](_0x3dd541[_0x2289('0x41')],function(_0x337819){var _0x544884={};_0x544884[_0x337819]={'$like':'%'+_0x5536e4[_0x2289('0x3f')][_0x2289('0x4b')]+'%'};return _0x544884;})});}_0x3dd541=_[_0x2289('0x4c')]({},_0x3dd541,_0x5536e4['options']);return _0x34ee61[_0x2289('0xdf')](_0x3dd541);}})[_0x2289('0x1c')](function(_0xdd1caf){if(_0xdd1caf){_0x21fa19=_0xdd1caf[_0x2289('0x69')];if(!_0x5536e4[_0x2289('0x3f')][_0x2289('0x44')]('nolimit')){_0x3dd541['limit']=qs[_0x2289('0x2a')](_0x5536e4[_0x2289('0x3f')][_0x2289('0x2a')]);_0x3dd541[_0x2289('0x28')]=qs[_0x2289('0x28')](_0x5536e4['query'][_0x2289('0x28')]);}return _0x34ee61[_0x2289('0xdf')](_0x3dd541);}})['then'](function(_0x115f50){if(_0x115f50){return _0x115f50?{'count':_0x21fa19,'rows':_0x115f50}:null;}})['then'](respondWithResult(_0x4b0ebc,null))[_0x2289('0x53')](handleError(_0x4b0ebc,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 438b535..fd49814 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 _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 +var _0x0585=['emit','hasOwnProperty','hook','exports','events','SmsAccount','setMaxListeners','remove'];(function(_0x4a27f8,_0x2657ed){var _0x5b1119=function(_0x226eb9){while(--_0x226eb9){_0x4a27f8['push'](_0x4a27f8['shift']());}};_0x5b1119(++_0x2657ed);}(_0x0585,0xcc));var _0x5058=function(_0x41c00f,_0x199897){_0x41c00f=_0x41c00f-0x0;var _0x2bfa66=_0x0585[_0x41c00f];return _0x2bfa66;};'use strict';var EventEmitter=require(_0x5058('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x5058('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5058('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5058('0x3')};function emitEvent(_0x331e38){return function(_0x1a7c7a,_0x4d1920,_0x53a47f){SmsAccountEvents[_0x5058('0x4')](_0x331e38+':'+_0x1a7c7a['id'],_0x1a7c7a);SmsAccountEvents['emit'](_0x331e38,_0x1a7c7a);_0x53a47f(null);};}for(var e in events){if(events[_0x5058('0x5')](e)){var event=events[e];SmsAccount[_0x5058('0x6')](e,emitEvent(event));}}module[_0x5058('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 e5d373c..37620b7 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 _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 +var _0xfdec=['path','exports','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment'];(function(_0x1e4f9e,_0x20d717){var _0x5715cc=function(_0x21fcc2){while(--_0x21fcc2){_0x1e4f9e['push'](_0x1e4f9e['shift']());}};_0x5715cc(++_0x20d717);}(_0xfdec,0xdc));var _0xcfde=function(_0x43709e,_0x2c3b45){_0x43709e=_0x43709e-0x0;var _0x452820=_0xfdec[_0x43709e];return _0x452820;};'use strict';var _=require(_0xcfde('0x0'));var util=require('util');var logger=require(_0xcfde('0x1'))(_0xcfde('0x2'));var moment=require(_0xcfde('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfde('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xcfde('0x5')]=function(_0x504566,_0x3c358e){return _0x504566['define'](_0xcfde('0x6'),attributes,{'tableName':_0xcfde('0x7'),'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 1552557..3b54b3e 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 _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 +var _0xcccb=['include','map','model','ShowSmsAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsAccount','find','options','raw','where','attributes'];(function(_0x2e3386,_0x1aefbd){var _0x493420=function(_0x508b2d){while(--_0x508b2d){_0x2e3386['push'](_0x2e3386['shift']());}};_0x493420(++_0x1aefbd);}(_0xcccb,0xa0));var _0xbccc=function(_0x3df625,_0x4255dc){_0x3df625=_0x3df625-0x0;var _0x2430b6=_0xcccb[_0x3df625];return _0x2430b6;};'use strict';var _=require(_0xbccc('0x0'));var util=require(_0xbccc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbccc('0x2'));var fs=require('fs');var Redis=require(_0xbccc('0x3'));var db=require(_0xbccc('0x4'))['db'];var utils=require(_0xbccc('0x5'));var logger=require(_0xbccc('0x6'))('rpc');var config=require(_0xbccc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbccc('0x8')][_0xbccc('0x9')]({'port':0x232a});config[_0xbccc('0xa')]=_[_0xbccc('0xb')](config[_0xbccc('0xa')],{'host':_0xbccc('0xc'),'port':0x18eb});var socket=require(_0xbccc('0xd'))(new Redis(config[_0xbccc('0xa')]));require(_0xbccc('0xe'))[_0xbccc('0xf')](socket);function respondWithRpcPromise(_0x5da234,_0x4d5d30,_0x55231f){return new BPromise(function(_0x141e40,_0x19a993){return client[_0xbccc('0x10')](_0x5da234,_0x55231f)[_0xbccc('0x11')](function(_0x202666){logger[_0xbccc('0x12')](_0xbccc('0x13'),_0x4d5d30,_0xbccc('0x14'));logger[_0xbccc('0x15')](_0xbccc('0x16'),_0x4d5d30,_0xbccc('0x14'),JSON[_0xbccc('0x17')](_0x202666));if(_0x202666[_0xbccc('0x18')]){if(_0x202666[_0xbccc('0x18')][_0xbccc('0x19')]===0x1f4){logger['error'](_0xbccc('0x13'),_0x4d5d30,_0x202666[_0xbccc('0x18')]['message']);return _0x19a993(_0x202666[_0xbccc('0x18')][_0xbccc('0x1a')]);}logger[_0xbccc('0x18')](_0xbccc('0x13'),_0x4d5d30,_0x202666['error']['message']);return _0x141e40(_0x202666[_0xbccc('0x18')][_0xbccc('0x1a')]);}else{logger[_0xbccc('0x12')](_0xbccc('0x13'),_0x4d5d30,'request\x20sent');_0x141e40(_0x202666[_0xbccc('0x1b')][_0xbccc('0x1a')]);}})[_0xbccc('0x1c')](function(_0x26e5e3){logger[_0xbccc('0x18')](_0xbccc('0x13'),_0x4d5d30,_0x26e5e3);_0x19a993(_0x26e5e3);});});}exports['ShowSmsAccount']=function(_0x547755){var _0x42cdf8=this;return new Promise(function(_0x178b2d,_0x366d64){return db[_0xbccc('0x1d')][_0xbccc('0x1e')]({'raw':_0x547755[_0xbccc('0x1f')]?_0x547755[_0xbccc('0x1f')][_0xbccc('0x20')]===undefined?!![]:![]:!![],'where':_0x547755[_0xbccc('0x1f')]?_0x547755[_0xbccc('0x1f')][_0xbccc('0x21')]||null:null,'attributes':_0x547755['options']?_0x547755[_0xbccc('0x1f')][_0xbccc('0x22')]||null:null,'include':_0x547755['options']?_0x547755[_0xbccc('0x1f')][_0xbccc('0x23')]?_['map'](_0x547755[_0xbccc('0x1f')][_0xbccc('0x23')],function(_0x1a6e92){return{'model':db[_0x1a6e92['model']],'as':_0x1a6e92['as'],'attributes':_0x1a6e92[_0xbccc('0x22')],'include':_0x1a6e92[_0xbccc('0x23')]?_[_0xbccc('0x24')](_0x1a6e92['include'],function(_0x20c6fd){return{'model':db[_0x20c6fd[_0xbccc('0x25')]],'as':_0x20c6fd['as'],'attributes':_0x20c6fd[_0xbccc('0x22')],'include':_0x20c6fd[_0xbccc('0x23')]?_[_0xbccc('0x24')](_0x20c6fd[_0xbccc('0x23')],function(_0x1df68d){return{'model':db[_0x1df68d[_0xbccc('0x25')]],'as':_0x1df68d['as'],'attributes':_0x1df68d[_0xbccc('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbccc('0x11')](function(_0x2306d1){logger[_0xbccc('0x12')](_0xbccc('0x26'),_0x547755);logger[_0xbccc('0x15')](_0xbccc('0x26'),_0x547755,JSON['stringify'](_0x2306d1));_0x178b2d(_0x2306d1);})['catch'](function(_0x39f0fa){logger[_0xbccc('0x18')](_0xbccc('0x26'),_0x39f0fa[_0xbccc('0x1a')],_0x547755);_0x366d64(_0x42cdf8[_0xbccc('0x18')](0x1f4,_0x39f0fa['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index bed2fc2..7a4e942 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(_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 +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 34c4fc6..573eec9 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 _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 +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x9d1102,_0x5c55c9){var _0x2c668e=function(_0x4ed3ba){while(--_0x4ed3ba){_0x9d1102['push'](_0x9d1102['shift']());}};_0x2c668e(++_0x5c55c9);}(_0x3e74,0x175));var _0x43e7=function(_0x2f10aa,_0x40f519){_0x2f10aa=_0x2f10aa-0x0;var _0xa7dc31=_0x3e74[_0x2f10aa];return _0xa7dc31;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index bb3a7a5..bba0ffb 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 _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 +var _0x1692=['*,*,*,*','sequelize','exports','noop','TEXT','STRING'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x1692,0x1e7));var _0x2169=function(_0x599be2,_0x101b71){_0x599be2=_0x599be2-0x0;var _0x13dba4=_0x1692[_0x599be2];return _0x13dba4;};'use strict';var Sequelize=require(_0x2169('0x0'));module[_0x2169('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2169('0x2')},'appdata':{'type':Sequelize[_0x2169('0x3')]()},'description':{'type':Sequelize[_0x2169('0x4')]},'interval':{'type':Sequelize[_0x2169('0x4')],'defaultValue':_0x2169('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 60aff39..24a8f8e 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 _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 +var _0xe77e=['api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','send','index','fieldName','key','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','SmsApplication','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','eml-format','zip-dir','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2bb9d6,_0x3e1050){var _0x48e0b4=function(_0x1f4c60){while(--_0x1f4c60){_0x2bb9d6['push'](_0x2bb9d6['shift']());}};_0x48e0b4(++_0x3e1050);}(_0xe77e,0xca));var _0xee77=function(_0x1b1bfd,_0x567608){_0x1b1bfd=_0x1b1bfd-0x0;var _0x1fc165=_0xe77e[_0x1b1bfd];return _0x1fc165;};'use strict';var emlformat=require(_0xee77('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee77('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee77('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee77('0x3'));var path=require('path');var sox=require(_0xee77('0x4'));var csv=require(_0xee77('0x5'));var ejs=require(_0xee77('0x6'));var fs=require('fs');var fs_extra=require(_0xee77('0x7'));var _=require(_0xee77('0x8'));var squel=require(_0xee77('0x9'));var crypto=require(_0xee77('0xa'));var jsforce=require(_0xee77('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee77('0x5'));var querystring=require(_0xee77('0xc'));var Papa=require(_0xee77('0xd'));var Redis=require(_0xee77('0xe'));var authService=require(_0xee77('0xf'));var qs=require(_0xee77('0x10'));var as=require(_0xee77('0x11'));var hardwareService=require(_0xee77('0x12'));var logger=require(_0xee77('0x13'))(_0xee77('0x14'));var utils=require(_0xee77('0x15'));var config=require(_0xee77('0x16'));var licenseUtil=require(_0xee77('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2899e5,_0x2ee7fe){_0x2ee7fe=_0x2ee7fe||0xcc;return function(_0x5ad7b2){if(_0x5ad7b2){return _0x2899e5['sendStatus'](_0x2ee7fe);}return _0x2899e5[_0xee77('0x18')](_0x2ee7fe)[_0xee77('0x19')]();};}function respondWithResult(_0x20e985,_0x3ae5fa){_0x3ae5fa=_0x3ae5fa||0xc8;return function(_0x3baaa2){if(_0x3baaa2){return _0x20e985[_0xee77('0x18')](_0x3ae5fa)[_0xee77('0x1a')](_0x3baaa2);}};}function respondWithFilteredResult(_0x40e7ec,_0x268764){return function(_0x592a90){if(_0x592a90){var _0x22a15f=typeof _0x268764[_0xee77('0x1b')]===_0xee77('0x1c')&&typeof _0x268764[_0xee77('0x1d')]===_0xee77('0x1c');var _0x458fab=_0x592a90[_0xee77('0x1e')];var _0x3339d5=_0x22a15f?0x0:_0x268764[_0xee77('0x1b')];var _0x2df20c=_0x22a15f?_0x592a90['count']:_0x268764['offset']+_0x268764['limit'];var _0xe045bf;if(_0x2df20c>=_0x458fab){_0x2df20c=_0x458fab;_0xe045bf=0xc8;}else{_0xe045bf=0xce;}_0x40e7ec[_0xee77('0x18')](_0xe045bf);return _0x40e7ec['set'](_0xee77('0x1f'),_0x3339d5+'-'+_0x2df20c+'/'+_0x458fab)[_0xee77('0x1a')](_0x592a90);}return null;};}function patchUpdates(_0x2efb3c){return function(_0x12b52f){try{jsonpatch[_0xee77('0x20')](_0x12b52f,_0x2efb3c,!![]);}catch(_0x15e98b){return BPromise[_0xee77('0x21')](_0x15e98b);}return _0x12b52f[_0xee77('0x22')]();};}function saveUpdates(_0x1cc44b,_0x42fced){return function(_0x22ca34){if(_0x22ca34){return _0x22ca34[_0xee77('0x23')](_0x1cc44b)[_0xee77('0x24')](function(_0xb901fb){return _0xb901fb;});}return null;};}function removeEntity(_0xf87a9a,_0x5376bb){return function(_0x50d983){if(_0x50d983){return _0x50d983[_0xee77('0x25')]()[_0xee77('0x24')](function(){_0xf87a9a[_0xee77('0x18')](0xcc)[_0xee77('0x19')]();});}};}function handleEntityNotFound(_0x1d6911,_0x1d38e4){return function(_0x2e1449){if(!_0x2e1449){_0x1d6911[_0xee77('0x26')](0x194);}return _0x2e1449;};}function handleError(_0x5b3a6f,_0x452d0c){_0x452d0c=_0x452d0c||0x1f4;return function(_0x4167f7){logger[_0xee77('0x27')](_0x4167f7['stack']);if(_0x4167f7['name']){delete _0x4167f7['name'];}_0x5b3a6f[_0xee77('0x18')](_0x452d0c)[_0xee77('0x28')](_0x4167f7);};}exports[_0xee77('0x29')]=function(_0xa2590f,_0x4c5086){var _0x36cd43={},_0x1684af={},_0x3d423b={'count':0x0,'rows':[]};var _0x10caa1=_['map'](db['SmsApplication']['rawAttributes'],function(_0x312eba){return{'name':_0x312eba[_0xee77('0x2a')],'type':_0x312eba['type'][_0xee77('0x2b')]};});_0x1684af[_0xee77('0x2c')]=_[_0xee77('0x2d')](_0x10caa1,_0xee77('0x2e'));_0x1684af[_0xee77('0x2f')]=_[_0xee77('0x30')](_0xa2590f[_0xee77('0x2f')]);_0x1684af['filters']=_[_0xee77('0x31')](_0x1684af['model'],_0x1684af['query']);_0x36cd43[_0xee77('0x32')]=_[_0xee77('0x31')](_0x1684af['model'],qs['fields'](_0xa2590f[_0xee77('0x2f')][_0xee77('0x33')]));_0x36cd43[_0xee77('0x32')]=_0x36cd43['attributes']['length']?_0x36cd43[_0xee77('0x32')]:_0x1684af['model'];if(!_0xa2590f[_0xee77('0x2f')][_0xee77('0x34')](_0xee77('0x35'))){_0x36cd43[_0xee77('0x1d')]=qs['limit'](_0xa2590f[_0xee77('0x2f')][_0xee77('0x1d')]);_0x36cd43[_0xee77('0x1b')]=qs[_0xee77('0x1b')](_0xa2590f[_0xee77('0x2f')][_0xee77('0x1b')]);}_0x36cd43[_0xee77('0x36')]=qs['sort'](_0xa2590f[_0xee77('0x2f')]['sort']);_0x36cd43[_0xee77('0x37')]=qs['filters'](_[_0xee77('0x38')](_0xa2590f[_0xee77('0x2f')],_0x1684af[_0xee77('0x39')]),_0x10caa1);if(_0xa2590f[_0xee77('0x2f')][_0xee77('0x3a')]){_0x36cd43['where']=_[_0xee77('0x3b')](_0x36cd43[_0xee77('0x37')],{'$or':_[_0xee77('0x2d')](_0x10caa1,function(_0x47426e){if(_0x47426e['type']!==_0xee77('0x3c')){var _0x3eeddf={};_0x3eeddf[_0x47426e[_0xee77('0x2e')]]={'$like':'%'+_0xa2590f[_0xee77('0x2f')]['filter']+'%'};return _0x3eeddf;}})});}_0x36cd43=_[_0xee77('0x3b')]({},_0x36cd43,_0xa2590f['options']);var _0x45f614={'where':_0x36cd43[_0xee77('0x37')]};return db[_0xee77('0x3d')][_0xee77('0x1e')](_0x45f614)[_0xee77('0x24')](function(_0x57f3f0){_0x3d423b['count']=_0x57f3f0;if(_0xa2590f[_0xee77('0x2f')][_0xee77('0x3e')]){_0x36cd43[_0xee77('0x3f')]=[{'all':!![]}];}return db[_0xee77('0x3d')][_0xee77('0x40')](_0x36cd43);})[_0xee77('0x24')](function(_0x46888c){_0x3d423b[_0xee77('0x41')]=_0x46888c;return _0x3d423b;})[_0xee77('0x24')](respondWithFilteredResult(_0x4c5086,_0x36cd43))[_0xee77('0x42')](handleError(_0x4c5086,null));};exports['show']=function(_0x4865ea,_0x36d5c1){var _0x507ae6={'raw':!![],'where':{'id':_0x4865ea[_0xee77('0x43')]['id']}},_0xa22471={};_0xa22471[_0xee77('0x2c')]=_['keys'](db['SmsApplication'][_0xee77('0x44')]);_0xa22471['query']=_[_0xee77('0x30')](_0x4865ea[_0xee77('0x2f')]);_0xa22471['filters']=_[_0xee77('0x31')](_0xa22471[_0xee77('0x2c')],_0xa22471[_0xee77('0x2f')]);_0x507ae6[_0xee77('0x32')]=_[_0xee77('0x31')](_0xa22471[_0xee77('0x2c')],qs[_0xee77('0x33')](_0x4865ea[_0xee77('0x2f')][_0xee77('0x33')]));_0x507ae6[_0xee77('0x32')]=_0x507ae6['attributes'][_0xee77('0x45')]?_0x507ae6[_0xee77('0x32')]:_0xa22471[_0xee77('0x2c')];if(_0x4865ea['query']['includeAll']){_0x507ae6[_0xee77('0x3f')]=[{'all':!![]}];}_0x507ae6=_[_0xee77('0x3b')]({},_0x507ae6,_0x4865ea[_0xee77('0x46')]);return db[_0xee77('0x3d')][_0xee77('0x47')](_0x507ae6)[_0xee77('0x24')](handleEntityNotFound(_0x36d5c1,null))[_0xee77('0x24')](respondWithResult(_0x36d5c1,null))[_0xee77('0x42')](handleError(_0x36d5c1,null));};exports[_0xee77('0x48')]=function(_0x22915a,_0x413c9d){return db['SmsApplication'][_0xee77('0x48')](_0x22915a[_0xee77('0x49')],{})[_0xee77('0x24')](respondWithResult(_0x413c9d,0xc9))['catch'](handleError(_0x413c9d,null));};exports[_0xee77('0x23')]=function(_0x146fe6,_0x2367cd){if(_0x146fe6[_0xee77('0x49')]['id']){delete _0x146fe6[_0xee77('0x49')]['id'];}return db[_0xee77('0x3d')][_0xee77('0x47')]({'where':{'id':_0x146fe6[_0xee77('0x43')]['id']}})['then'](handleEntityNotFound(_0x2367cd,null))[_0xee77('0x24')](saveUpdates(_0x146fe6[_0xee77('0x49')],null))[_0xee77('0x24')](respondWithResult(_0x2367cd,null))[_0xee77('0x42')](handleError(_0x2367cd,null));};exports[_0xee77('0x25')]=function(_0x3a2a44,_0x206014){return db[_0xee77('0x3d')][_0xee77('0x47')]({'where':{'id':_0x3a2a44['params']['id']}})[_0xee77('0x24')](handleEntityNotFound(_0x206014,null))[_0xee77('0x24')](removeEntity(_0x206014,null))['catch'](handleError(_0x206014,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0f6e74a..be1bbf9 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 _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 +var _0xc15b=['moment','bluebird','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','lodash','../../config/logger','api'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xc15b,0xe4));var _0xbc15=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xc15b[_0x35da42];return _0x370035;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var logger=require(_0xbc15('0x1'))(_0xbc15('0x2'));var moment=require(_0xbc15('0x3'));var BPromise=require(_0xbc15('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc15('0x5'));var config=require(_0xbc15('0x6'));var attributes=require(_0xbc15('0x7'));module['exports']=function(_0x55885f,_0x54f394){return _0x55885f[_0xbc15('0x8')](_0xbc15('0x9'),attributes,{'tableName':_0xbc15('0xa'),'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 f4fde69..d687591 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 _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 +var _0xd2f5=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','stringify','error','code','SmsApplication,\x20%s,\x20%s','message'];(function(_0x514c23,_0x2453d0){var _0x46a240=function(_0xb443d7){while(--_0xb443d7){_0x514c23['push'](_0x514c23['shift']());}};_0x46a240(++_0x2453d0);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x2946cf,_0x1114b5){_0x2946cf=_0x2946cf-0x0;var _0x3243f8=_0xd2f5[_0x2946cf];return _0x3243f8;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var moment=require(_0x5d2f('0x2'));var BPromise=require(_0x5d2f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d2f('0x8')][_0x5d2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbf53b,_0x57673f,_0x3062bf){return new BPromise(function(_0x72bf9f,_0x330195){return client['request'](_0xbf53b,_0x3062bf)['then'](function(_0x43293d){logger[_0x5d2f('0xa')]('SmsApplication,\x20%s,\x20%s',_0x57673f,_0x5d2f('0xb'));logger[_0x5d2f('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x57673f,'request\x20sent',JSON[_0x5d2f('0xd')](_0x43293d));if(_0x43293d[_0x5d2f('0xe')]){if(_0x43293d['error'][_0x5d2f('0xf')]===0x1f4){logger[_0x5d2f('0xe')](_0x5d2f('0x10'),_0x57673f,_0x43293d[_0x5d2f('0xe')][_0x5d2f('0x11')]);return _0x330195(_0x43293d[_0x5d2f('0xe')][_0x5d2f('0x11')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x57673f,_0x43293d['error']['message']);return _0x72bf9f(_0x43293d[_0x5d2f('0xe')]['message']);}else{logger[_0x5d2f('0xa')](_0x5d2f('0x10'),_0x57673f,_0x5d2f('0xb'));_0x72bf9f(_0x43293d[_0x5d2f('0x12')]['message']);}})[_0x5d2f('0x13')](function(_0x875750){logger['error'](_0x5d2f('0x10'),_0x57673f,_0x875750);_0x330195(_0x875750);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 2990f50..0cf1a55 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 _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 +var _0x0713=['put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','smsinteraction:addtags','addTags'];(function(_0x313535,_0x28e960){var _0x48c033=function(_0x543de2){while(--_0x543de2){_0x313535['push'](_0x313535['shift']());}};_0x48c033(++_0x28e960);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/download',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x11')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['post']('/:id/messages',auth[_0x3071('0x9')](),controller['addMessage']);router[_0x3071('0x11')](_0x3071('0x13'),auth['isAuthenticated'](),interaction[_0x3071('0x14')]('sms',_0x3071('0x15')),controller[_0x3071('0x16')]);router[_0x3071('0x17')](_0x3071('0xd'),auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x19')),controller[_0x3071('0x1a')]);router[_0x3071('0x1b')]('/:id',auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x1c')),controller[_0x3071('0x1d')]);router[_0x3071('0x1b')](_0x3071('0x13'),auth[_0x3071('0x9')](),controller['removeTags']);module[_0x3071('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 1182084..d648ee7 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 _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 +var _0x45c2=['STRING','DATE','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN'];(function(_0x552544,_0x110fd2){var _0x25f09f=function(_0x718046){while(--_0x718046){_0x552544['push'](_0x552544['shift']());}};_0x25f09f(++_0x110fd2);}(_0x45c2,0x68));var _0x245c=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x45c2[_0x4b4f24];return _0x1c13d4;};'use strict';var Sequelize=require(_0x245c('0x0'));var moment=require(_0x245c('0x1'));module[_0x245c('0x2')]={'closed':{'type':Sequelize[_0x245c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x245c('0x4')]},'secondDisposition':{'type':Sequelize[_0x245c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x245c('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x245c('0x4')]},'read1stAt':{'type':Sequelize[_0x245c('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x245c('0x6')]('in',_0x245c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x245c('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x245c('0x6')]('in',_0x245c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x245c('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x245c('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 0cc54ee..8dc30a0 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 _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 +var _0xf98e=['filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','describe','addMessage','SmsMessage','ids','omit','findOne','nolimit','order','sort','pick','where','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','Tag','color','smsInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','Messages','createdAt','direction','secret','read','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','format','closed','closedAt','map','out','System','firstName','lastName','value','views','downloadInteraction.ejs','transcript-','download','zip-dir','moment','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','getOptions','sms','query','user','catch','show','params','model','keys'];(function(_0x32d8a8,_0x1b2e34){var _0x5d8934=function(_0x55dd45){while(--_0x55dd45){_0x32d8a8['push'](_0x32d8a8['shift']());}};_0x5d8934(++_0x1b2e34);}(_0xf98e,0x136));var _0xef98=function(_0x12833e,_0x302abb){_0x12833e=_0x12833e-0x0;var _0xe6208a=_0xf98e[_0x12833e];return _0xe6208a;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xef98('0x0'));var moment=require(_0xef98('0x1'));var BPromise=require('bluebird');var util=require(_0xef98('0x2'));var path=require(_0xef98('0x3'));var ejs=require(_0xef98('0x4'));var fs=require('fs');var _=require(_0xef98('0x5'));var Redis=require('ioredis');var interaction=require(_0xef98('0x6'));var qs=require(_0xef98('0x7'));var pdf=require(_0xef98('0x8'));var logger=require(_0xef98('0x9'))(_0xef98('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xef98('0xb')](config[_0xef98('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xef98('0xd'))(new Redis(config[_0xef98('0xc')]));require(_0xef98('0xe'))[_0xef98('0xf')](socket);function respondWithStatusCode(_0x56b3a5,_0x165984){_0x165984=_0x165984||0xcc;return function(_0x3f9556){if(_0x3f9556){return _0x56b3a5['sendStatus'](_0x165984);}return _0x56b3a5[_0xef98('0x10')](_0x165984)['end']();};}function respondWithResult(_0x2a2a28,_0x3fe127){_0x3fe127=_0x3fe127||0xc8;return function(_0x7ad3c4){if(_0x7ad3c4){return _0x2a2a28[_0xef98('0x10')](_0x3fe127)[_0xef98('0x11')](_0x7ad3c4);}};}function respondWithFilteredResult(_0x37ee0b,_0x3575b3){return function(_0x197c09){if(_0x197c09){var _0x1548bb=typeof _0x3575b3[_0xef98('0x12')]===_0xef98('0x13')&&typeof _0x3575b3['limit']===_0xef98('0x13');var _0x569726=_0x197c09[_0xef98('0x14')];var _0x431b80=_0x1548bb?0x0:_0x3575b3[_0xef98('0x12')];var _0x4a9676=_0x1548bb?_0x197c09[_0xef98('0x14')]:_0x3575b3[_0xef98('0x12')]+_0x3575b3[_0xef98('0x15')];var _0x2ac47a;if(_0x4a9676>=_0x569726){_0x4a9676=_0x569726;_0x2ac47a=0xc8;}else{_0x2ac47a=0xce;}_0x37ee0b['status'](_0x2ac47a);return _0x37ee0b[_0xef98('0x16')](_0xef98('0x17'),_0x431b80+'-'+_0x4a9676+'/'+_0x569726)[_0xef98('0x11')](_0x197c09);}return null;};}function saveUpdates(_0x5579b0){return function(_0x4f43d3){if(_0x4f43d3){return _0x4f43d3[_0xef98('0x18')](_0x5579b0)[_0xef98('0x19')](function(_0x5e185e){return _0x5e185e;});}return null;};}function removeEntity(_0x340cf0){return function(_0x4e3ad8){if(_0x4e3ad8){return _0x4e3ad8[_0xef98('0x1a')]()[_0xef98('0x19')](function(){_0x340cf0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x407f80){return function(_0x58bc0f){if(!_0x58bc0f){_0x407f80[_0xef98('0x1b')](0x194);}return _0x58bc0f;};}function handleError(_0x41c8cf,_0x174ba4){_0x174ba4=_0x174ba4||0x1f4;return function(_0x1a046e){logger['error'](_0x1a046e[_0xef98('0x1c')]);if(_0x1a046e[_0xef98('0x1d')]){delete _0x1a046e[_0xef98('0x1d')];}_0x41c8cf[_0xef98('0x10')](_0x174ba4)[_0xef98('0x1e')](_0x1a046e);};}exports[_0xef98('0x1f')]=function(_0x34d691,_0x4a70cc){var _0x1d856b={};var _0x14cee0=_['map'](db[_0xef98('0x20')][_0xef98('0x21')],function(_0x1b2132){return{'name':_0x1b2132[_0xef98('0x22')],'type':_0x1b2132['type']['key']};});_0x1d856b=qs[_0xef98('0x23')](_0x14cee0,_0x34d691);return interaction['findAll'](_0xef98('0x24'),_0x34d691[_0xef98('0x25')],_0x34d691[_0xef98('0x26')],_0x1d856b,_0x14cee0)[_0xef98('0x19')](respondWithFilteredResult(_0x4a70cc,_0x1d856b))[_0xef98('0x27')](handleError(_0x4a70cc,null));};exports[_0xef98('0x28')]=function(_0x1e8d73,_0xea9c66){var _0x1ce2b9={'raw':![],'where':{'id':_0x1e8d73[_0xef98('0x29')]['id']}},_0x9c91ff={};_0x9c91ff[_0xef98('0x2a')]=_['keys'](db[_0xef98('0x20')]['rawAttributes']);_0x9c91ff[_0xef98('0x25')]=_[_0xef98('0x2b')](_0x1e8d73[_0xef98('0x25')]);_0x9c91ff[_0xef98('0x2c')]=_[_0xef98('0x2d')](_0x9c91ff[_0xef98('0x2a')],_0x9c91ff[_0xef98('0x25')]);_0x1ce2b9[_0xef98('0x2e')]=_[_0xef98('0x2d')](_0x9c91ff['model'],qs[_0xef98('0x2f')](_0x1e8d73['query'][_0xef98('0x2f')]));_0x1ce2b9[_0xef98('0x2e')]=_0x1ce2b9['attributes'][_0xef98('0x30')]?_0x1ce2b9[_0xef98('0x2e')]:_0x9c91ff[_0xef98('0x2a')];if(_0x1e8d73[_0xef98('0x25')][_0xef98('0x31')]){_0x1ce2b9[_0xef98('0x32')]=[{'all':!![]}];}_0x1ce2b9=_[_0xef98('0x33')]({},_0x1ce2b9,_0x1e8d73[_0xef98('0x34')]);return db['SmsInteraction'][_0xef98('0x35')](_0x1ce2b9)[_0xef98('0x19')](handleEntityNotFound(_0xea9c66,null))[_0xef98('0x19')](respondWithResult(_0xea9c66,null))[_0xef98('0x27')](handleError(_0xea9c66,null));};exports['create']=function(_0x5ca39f,_0x5558bd){return db[_0xef98('0x20')]['create'](_0x5ca39f['body'],{})[_0xef98('0x19')](respondWithResult(_0x5558bd,0xc9))[_0xef98('0x27')](handleError(_0x5558bd,null));};exports['update']=function(_0x2c13ef,_0x356764){if(_0x2c13ef[_0xef98('0x36')]['id']){delete _0x2c13ef[_0xef98('0x36')]['id'];}return db['SmsInteraction'][_0xef98('0x35')]({'where':{'id':_0x2c13ef['params']['id']}})['then'](handleEntityNotFound(_0x356764,null))[_0xef98('0x19')](saveUpdates(_0x2c13ef['body'],null))[_0xef98('0x19')](respondWithResult(_0x356764,null))[_0xef98('0x27')](handleError(_0x356764,null));};exports[_0xef98('0x1a')]=function(_0x4d83d8,_0x518ab2){return db[_0xef98('0x20')][_0xef98('0x35')]({'where':{'id':_0x4d83d8[_0xef98('0x29')]['id']}})[_0xef98('0x19')](handleEntityNotFound(_0x518ab2,null))[_0xef98('0x19')](removeEntity(_0x518ab2,null))[_0xef98('0x27')](handleError(_0x518ab2,null));};exports[_0xef98('0x37')]=function(_0x5c9dee,_0xd86cc2){return db[_0xef98('0x20')][_0xef98('0x37')]()[_0xef98('0x19')](respondWithResult(_0xd86cc2,null))['catch'](handleError(_0xd86cc2,null));};exports[_0xef98('0x38')]=function(_0x3fac75,_0x314cec){return db[_0xef98('0x39')][_0xef98('0x35')]({'where':{'id':_0x3fac75['params']['id']}})[_0xef98('0x19')](handleEntityNotFound(_0x314cec,null))[_0xef98('0x19')](function(_0x2b4ca0){if(_0x2b4ca0){return _0x2b4ca0[_0xef98('0x38')](_0x3fac75[_0xef98('0x36')][_0xef98('0x3a')],_[_0xef98('0x3b')](_0x3fac75[_0xef98('0x36')],[_0xef98('0x3a'),'id'])||{});}})[_0xef98('0x19')](respondWithResult(_0x314cec,null))[_0xef98('0x27')](handleError(_0x314cec,null));};exports['getMessages']=function(_0x3d4d02,_0x4cca5c){var _0x498718={'raw':![],'where':{}};var _0x56b5ef={};var _0x4df7f7={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xef98('0x3c')]({'where':{'id':_0x3d4d02['params']['id']}})[_0xef98('0x19')](handleEntityNotFound(_0x4cca5c,null))[_0xef98('0x19')](function(_0x376852){if(_0x376852){_0x56b5ef[_0xef98('0x2a')]=_[_0xef98('0x2b')](db[_0xef98('0x39')][_0xef98('0x21')]);_0x56b5ef[_0xef98('0x25')]=_[_0xef98('0x2b')](_0x3d4d02[_0xef98('0x25')]);_0x56b5ef['filters']=_[_0xef98('0x2d')](_0x56b5ef['model'],_0x56b5ef[_0xef98('0x25')]);_0x498718[_0xef98('0x2e')]=_[_0xef98('0x2d')](_0x56b5ef[_0xef98('0x2a')],qs['fields'](_0x3d4d02['query']['fields']));_0x498718[_0xef98('0x2e')]=_0x498718['attributes'][_0xef98('0x30')]?_0x498718[_0xef98('0x2e')]:_0x56b5ef[_0xef98('0x2a')];if(!_0x3d4d02['query']['hasOwnProperty'](_0xef98('0x3d'))){_0x498718[_0xef98('0x15')]=qs['limit'](_0x3d4d02[_0xef98('0x25')][_0xef98('0x15')]);_0x498718['offset']=qs[_0xef98('0x12')](_0x3d4d02[_0xef98('0x25')][_0xef98('0x12')]);}_0x498718[_0xef98('0x3e')]=qs['sort'](_0x3d4d02[_0xef98('0x25')][_0xef98('0x3f')]);_0x498718['where']=qs[_0xef98('0x2c')](_[_0xef98('0x40')](_0x3d4d02[_0xef98('0x25')],_0x56b5ef[_0xef98('0x2c')]));_0x498718[_0xef98('0x41')][_0xef98('0x42')]=_0x376852['id'];if(_0x3d4d02[_0xef98('0x25')][_0xef98('0x43')]){_0x498718[_0xef98('0x41')]=_[_0xef98('0x33')](_0x498718[_0xef98('0x41')],{'$or':_['map'](_0x498718[_0xef98('0x2e')],function(_0xe69aa6){var _0x45ca74={};_0x45ca74[_0xe69aa6]={'$like':'%'+_0x3d4d02[_0xef98('0x25')][_0xef98('0x43')]+'%'};return _0x45ca74;})});}if(_0x3d4d02[_0xef98('0x25')][_0xef98('0x44')]){var _0x28e894=_0x3d4d02['query'][_0xef98('0x44')][_0xef98('0x45')](',');var _0x23b0e2={};_0x23b0e2[_0x28e894[0x0]]={'$gte':moment(_0x28e894[0x1])['format'](_0xef98('0x46'))};_0x498718['where']=_[_0xef98('0x33')](_0x498718['where'],_0x23b0e2);}_0x498718=_['merge']({},_0x498718,_0x3d4d02['options']);return db[_0xef98('0x39')]['count']({'where':_0x498718['where']})[_0xef98('0x19')](function(_0x3e1334){_0x4df7f7[_0xef98('0x14')]=_0x3e1334;if(_0x3d4d02[_0xef98('0x25')][_0xef98('0x31')]){_0x498718[_0xef98('0x32')]=[{'all':!![]}];}return db[_0xef98('0x39')][_0xef98('0x47')](_0x498718);})[_0xef98('0x19')](function(_0xb847fc){_0x4df7f7[_0xef98('0x48')]=_0xb847fc;return _0x4df7f7;});}})[_0xef98('0x19')](respondWithFilteredResult(_0x4cca5c,_0x498718))[_0xef98('0x27')](handleError(_0x4cca5c,null));};exports[_0xef98('0x49')]=function(_0x39ad79,_0x4fe8eb){return db[_0xef98('0x20')]['find']({'where':{'id':_0x39ad79[_0xef98('0x29')]['id']}})[_0xef98('0x19')](handleEntityNotFound(_0x4fe8eb,null))[_0xef98('0x19')](function(_0x31e628){if(_0x31e628){return _0x31e628[_0xef98('0x4a')](_0x39ad79[_0xef98('0x36')][_0xef98('0x3a')],_[_0xef98('0x3b')](_0x39ad79[_0xef98('0x36')],[_0xef98('0x3a'),'id'])||{})[_0xef98('0x4b')](function(){return db[_0xef98('0x4c')][_0xef98('0x47')]({'attributes':['id',_0xef98('0x1d'),_0xef98('0x4d')],'where':{'id':_0x39ad79[_0xef98('0x36')][_0xef98('0x3a')]}});})[_0xef98('0x19')](function(_0x1eecfb){socket['emit'](_0xef98('0x4e'),{'id':Number(_0x39ad79[_0xef98('0x29')]['id']),'tags':_0x1eecfb||[]});return{'id':Number(_0x39ad79[_0xef98('0x29')]['id']),'tags':_0x1eecfb||[]};});}})[_0xef98('0x19')](respondWithResult(_0x4fe8eb,null))[_0xef98('0x27')](handleError(_0x4fe8eb,null));};exports[_0xef98('0x4f')]=function(_0x254f9c,_0x125967){return db['SmsInteraction'][_0xef98('0x35')]({'where':{'id':_0x254f9c[_0xef98('0x29')]['id']}})[_0xef98('0x19')](handleEntityNotFound(_0x125967,null))[_0xef98('0x19')](function(_0x79c562){if(_0x79c562){return _0x79c562[_0xef98('0x4f')](_0x254f9c[_0xef98('0x25')][_0xef98('0x3a')]);}})[_0xef98('0x19')](respondWithStatusCode(_0x125967,null))[_0xef98('0x27')](handleError(_0x125967,null));};exports['download']=function(_0x1164b0,_0xc362c8){var _0x59cd74=moment()[_0xef98('0x50')]()[_0xef98('0x51')]();var _0x5e2b45=path[_0xef98('0x52')](config[_0xef98('0x53')],_0xef98('0x54'),_0xef98('0x55'),_0xef98('0x56'));var _0x1a86fe=path[_0xef98('0x52')](_0x5e2b45,_0x59cd74);var _0x246949=util['format'](_0xef98('0x57'),_0x1164b0[_0xef98('0x29')]['id'],_0x59cd74);var _0x3d3316=path['join'](_0x5e2b45,_0x246949);var _0x5f54b8=[];_0x5f54b8['push']({'model':db[_0xef98('0x58')],'as':_0xef98('0x58'),'attributes':['id',_0xef98('0x59')],'raw':!![]});_0x5f54b8[_0xef98('0x5a')]({'model':db[_0xef98('0x5b')],'as':_0xef98('0x5c'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x2621e8=[{'model':db['SmsMessage'],'as':_0xef98('0x5d'),'attributes':['id','body',_0xef98('0x5e'),_0xef98('0x5f'),_0xef98('0x60'),_0xef98('0x61')],'include':_0x5f54b8}];_0x2621e8[_0xef98('0x5a')]({'model':db[_0xef98('0x62')],'as':_0xef98('0x63'),'attributes':['id','name']});_0x2621e8[_0xef98('0x5a')]({'model':db['User'],'as':'Owner','attributes':['id',_0xef98('0x59')]});return db[_0xef98('0x20')][_0xef98('0x35')]({'where':{'id':_0x1164b0[_0xef98('0x29')]['id']},'include':_0x2621e8})[_0xef98('0x19')](handleEntityNotFound(_0xc362c8,null))[_0xef98('0x19')](function(_0x138c96){if(_0x138c96){var _0xb0643b=_0x138c96[_0xef98('0x64')]({'plain':!![]});fs[_0xef98('0x65')](_0x1a86fe);var _0x10d74e={'channel':_0xef98('0x66'),'account':_0xb0643b[_0xef98('0x63')]['name'],'agent':_0xb0643b[_0xef98('0x67')]?_0xb0643b['Owner'][_0xef98('0x59')]:_0xef98('0x68'),'createdAt':moment(_0xb0643b[_0xef98('0x5e')])[_0xef98('0x69')](_0xef98('0x46'))[_0xef98('0x51')](),'closedAt':_0xb0643b[_0xef98('0x6a')]?moment(_0xb0643b[_0xef98('0x6b')])[_0xef98('0x69')](_0xef98('0x46'))[_0xef98('0x51')]():'','disposition':_0xb0643b['disposition'],'messages':_(_0xb0643b[_0xef98('0x5d')])[_0xef98('0x43')]({'secret':![]})[_0xef98('0x6c')](function(_0x315a67){return{'date':moment(_0x315a67[_0xef98('0x5e')])[_0xef98('0x69')](_0xef98('0x46'))[_0xef98('0x51')](),'sender':_0x315a67['direction']===_0xef98('0x6d')?_0x315a67[_0xef98('0x58')]?_0x315a67[_0xef98('0x58')]['fullname']:_0xef98('0x6e'):_0x315a67[_0xef98('0x5c')][_0xef98('0x6f')]+(_0x315a67[_0xef98('0x5c')][_0xef98('0x70')]?'\x20'+_0x315a67[_0xef98('0x5c')][_0xef98('0x70')]:''),'body':_0x315a67[_0xef98('0x36')],'direction':_0x315a67[_0xef98('0x5f')]==='out'?'A':'C','secret':_0x315a67[_0xef98('0x60')],'read':_0x315a67[_0xef98('0x61')]};})[_0xef98('0x71')]()};return ejs['renderFile'](path['join'](config['root'],'server',_0xef98('0x72'),_0xef98('0x73')),{'interaction':_0x10d74e})[_0xef98('0x19')](function(_0x1ec9ad){var _0x1cd0bf=path[_0xef98('0x52')](_0x1a86fe,_0xef98('0x74')+_0xb0643b['id']+'-'+_0x59cd74+'.pdf');var _0x54ee6b={'path':_0x1cd0bf,'channel':'Sms','interactionId':_0xb0643b['id']};return pdf['createPdfFromHTML'](_0x1ec9ad,_0x54ee6b);})[_0xef98('0x19')](function(){return new BPromise(function(_0x3974de,_0x54825f){zipdir(_0x1a86fe,{'saveTo':_0x3d3316},function(_0x114e39,_0x343ded){if(_0x114e39)return _0x54825f(_0x114e39);return _0x3974de(_0x343ded);});})[_0xef98('0x19')](function(){return new BPromise(function(_0x52b152,_0x57754a){rimraf(_0x1a86fe,function(_0x1e2919){if(_0x1e2919)_0x57754a(_0x1e2919);return _0x52b152();});});})[_0xef98('0x19')](function(){return _0xc362c8[_0xef98('0x75')](_0x3d3316,_0x246949,function(_0x5a655a){if(_0x5a655a){console['log']('err',_0x5a655a);}else{fs['unlinkSync'](_0x3d3316);}});});});}else{return _0xc362c8[_0xef98('0x1b')](0xc8);}})[_0xef98('0x27')](handleError(_0xc362c8,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 6339945..075cb4c 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 _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 +var _0x2da6=['setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2da6,0x1dd));var _0x62da=function(_0x4b71fd,_0x3540c6){_0x4b71fd=_0x4b71fd-0x0;var _0x281ab5=_0x2da6[_0x4b71fd];return _0x281ab5;};'use strict';var EventEmitter=require(_0x62da('0x0'));var SmsInteraction=require(_0x62da('0x1'))['db'][_0x62da('0x2')];var SmsMessage=require(_0x62da('0x1'))['db'][_0x62da('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x62da('0x4')](0x0);var events={'afterCreate':_0x62da('0x5'),'afterUpdate':_0x62da('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4a8428){return function(_0xe28204,_0x3163df,_0x3a59f8){_0xe28204[_0x62da('0x7')]({'attributes':['id'],'raw':!![]})[_0x62da('0x8')](function(_0x9d9139){_0xe28204[_0x62da('0x9')](_0x62da('0xa'),_0x9d9139[_0x62da('0xb')](function(_0x4cfc5d){return{'id':_0x4cfc5d['id']};}));return SmsMessage[_0x62da('0xc')]({'where':{'SmsInteractionId':_0xe28204['id'],'direction':'in','read':![]},'raw':!![]});})[_0x62da('0x8')](function(_0x2a3d7c){_0xe28204[_0x62da('0x9')]('unreadMessages',_0x2a3d7c[_0x62da('0xd')]);SmsInteractionEvents[_0x62da('0xe')](_0x4a8428+':'+_0xe28204['id'],_0xe28204);SmsInteractionEvents[_0x62da('0xe')](_0x4a8428,_0xe28204);_0x3a59f8(null);})[_0x62da('0xf')](_0x3a59f8(null));};}for(var e in events){if(events[_0x62da('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x62da('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index dcd83ce..317ef01 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 _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 +var _0x0d6c=['bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','lodash','../../config/logger','api'];(function(_0x3bafa0,_0x5075fb){var _0x35dcfa=function(_0x1746d2){while(--_0x1746d2){_0x3bafa0['push'](_0x3bafa0['shift']());}};_0x35dcfa(++_0x5075fb);}(_0x0d6c,0xde));var _0xc0d6=function(_0x5948fe,_0x18d3d2){_0x5948fe=_0x5948fe-0x0;var _0x1be901=_0x0d6c[_0x5948fe];return _0x1be901;};'use strict';var _=require(_0xc0d6('0x0'));var util=require('util');var logger=require(_0xc0d6('0x1'))(_0xc0d6('0x2'));var moment=require('moment');var BPromise=require(_0xc0d6('0x3'));var rp=require(_0xc0d6('0x4'));var fs=require('fs');var path=require(_0xc0d6('0x5'));var rimraf=require(_0xc0d6('0x6'));var config=require(_0xc0d6('0x7'));var attributes=require(_0xc0d6('0x8'));module[_0xc0d6('0x9')]=function(_0x29ed46,_0x520a84){return _0x29ed46[_0xc0d6('0xa')](_0xc0d6('0xb'),attributes,{'tableName':_0xc0d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xcc4a82,_0x5dbc51,_0x21b516){if(_0xcc4a82[_0xc0d6('0xd')](_0xc0d6('0xe'))){_0xcc4a82['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x21b516(null,_0xcc4a82);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 35e5e62..77e48a3 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 _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 +var _0x7de4=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','attributes','limit','then','stringify','AddTagsToSmsInteraction','find','where','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7de4,0x1b2));var _0x47de=function(_0x54487b,_0x5b4b8a){_0x54487b=_0x54487b-0x0;var _0x2105e8=_0x7de4[_0x54487b];return _0x2105e8;};'use strict';var _=require(_0x47de('0x0'));var util=require(_0x47de('0x1'));var moment=require(_0x47de('0x2'));var BPromise=require(_0x47de('0x3'));var rs=require(_0x47de('0x4'));var fs=require('fs');var Redis=require(_0x47de('0x5'));var db=require(_0x47de('0x6'))['db'];var utils=require(_0x47de('0x7'));var logger=require(_0x47de('0x8'))(_0x47de('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x47de('0xa')]['http']({'port':0x232a});config[_0x47de('0xb')]=_[_0x47de('0xc')](config['redis'],{'host':_0x47de('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47de('0xb')]));require(_0x47de('0xe'))[_0x47de('0xf')](socket);function respondWithRpcPromise(_0x3d0777,_0x18d467,_0x315a1d){return new BPromise(function(_0x216813,_0x4703cf){return client[_0x47de('0x10')](_0x3d0777,_0x315a1d)['then'](function(_0x54bf4d){logger[_0x47de('0x11')](_0x47de('0x12'),_0x18d467,_0x47de('0x13'));logger[_0x47de('0x14')](_0x47de('0x15'),_0x18d467,_0x47de('0x13'),JSON['stringify'](_0x54bf4d));if(_0x54bf4d[_0x47de('0x16')]){if(_0x54bf4d[_0x47de('0x16')][_0x47de('0x17')]===0x1f4){logger[_0x47de('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x18d467,_0x54bf4d['error'][_0x47de('0x18')]);return _0x4703cf(_0x54bf4d[_0x47de('0x16')][_0x47de('0x18')]);}logger[_0x47de('0x16')](_0x47de('0x12'),_0x18d467,_0x54bf4d['error'][_0x47de('0x18')]);return _0x216813(_0x54bf4d[_0x47de('0x16')][_0x47de('0x18')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x18d467,_0x47de('0x13'));_0x216813(_0x54bf4d[_0x47de('0x19')][_0x47de('0x18')]);}})['catch'](function(_0x20b766){logger[_0x47de('0x16')](_0x47de('0x12'),_0x18d467,_0x20b766);_0x4703cf(_0x20b766);});});}exports[_0x47de('0x1a')]=function(_0x1aa4d4){var _0x57bf1c=this;return new Promise(function(_0x5706af,_0x2dc44a){return db[_0x47de('0x1b')][_0x47de('0x1c')](_0x1aa4d4[_0x47de('0x1d')],{'raw':_0x1aa4d4[_0x47de('0x1e')]?_0x1aa4d4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1aa4d4['options']?_0x1aa4d4[_0x47de('0x1e')]['where']||null:null,'attributes':_0x1aa4d4[_0x47de('0x1e')]?_0x1aa4d4[_0x47de('0x1e')][_0x47de('0x1f')]||null:null,'limit':_0x1aa4d4['options']?_0x1aa4d4[_0x47de('0x1e')][_0x47de('0x20')]||null:null})[_0x47de('0x21')](function(_0x4cce2d){logger[_0x47de('0x11')]('UpdateSmsInteraction',_0x1aa4d4);logger[_0x47de('0x14')](_0x47de('0x1a'),_0x1aa4d4,JSON[_0x47de('0x22')](_0x4cce2d));_0x5706af(_0x4cce2d);})['catch'](function(_0x5f49e9){logger['error'](_0x47de('0x1a'),_0x5f49e9['message'],_0x1aa4d4);_0x2dc44a(_0x57bf1c['error'](0x1f4,_0x5f49e9[_0x47de('0x18')]));});});};exports[_0x47de('0x23')]=function(_0x4761c7){return new Promise(function(_0x310f35,_0x7afaf4){return db[_0x47de('0x1b')][_0x47de('0x24')]({'where':_0x4761c7['options']?_0x4761c7['options'][_0x47de('0x25')]||null:null})['then'](function(_0x4436ca){if(_0x4436ca){return _0x4436ca[_0x47de('0x26')](_0x4761c7[_0x47de('0x1d')][_0x47de('0x27')],_[_0x47de('0x28')](_0x4761c7[_0x47de('0x1d')],[_0x47de('0x27'),'id'])||{});}})[_0x47de('0x29')](function(_0x1e42b6){logger[_0x47de('0x11')](_0x47de('0x2a'),_0x4761c7);logger[_0x47de('0x14')](_0x47de('0x2a'),_0x4761c7,JSON[_0x47de('0x22')](_0x1e42b6));_0x310f35(_0x1e42b6);})['catch'](function(_0x57769a){logger[_0x47de('0x16')](_0x47de('0x2a'),_0x57769a['message'],_0x4761c7);_0x7afaf4(_this[_0x47de('0x16')](0x1f4,_0x57769a[_0x47de('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d4df223..828dc85 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 _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 +var _0x101c=['smsInteraction:','save','update','length'];(function(_0xaa226c,_0x15f41e){var _0x2c1068=function(_0xcb1a5f){while(--_0xcb1a5f){_0xaa226c['push'](_0xaa226c['shift']());}};_0x2c1068(++_0x15f41e);}(_0x101c,0x171));var _0xc101=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x101c[_0x28f32c];return _0x355402;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xc101('0x0'),'remove',_0xc101('0x1')];function createListener(_0x4ce991,_0x345e59){return function(_0x1b45bb){_0x345e59['emit'](_0x4ce991,_0x1b45bb);};}function removeListener(_0x3d30c8,_0x32def3){return function(){SmsInteractionEvents['removeListener'](_0x3d30c8,_0x32def3);};}exports['register']=function(_0x56c0b8){for(var _0x598275=0x0,_0x245e62=events[_0xc101('0x2')];_0x598275<_0x245e62;_0x598275++){var _0x524abb=events[_0x598275];var _0x2e1348=createListener(_0xc101('0x3')+_0x524abb,_0x56c0b8);SmsInteractionEvents['on'](_0x524abb,_0x2e1348);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 5fc8562..5b9dcdd 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 _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 +var _0xc2ff=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','delete','destroy','multer'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc2ff,0x195));var _0xfc2f=function(_0x20d295,_0x17b857){_0x20d295=_0x20d295-0x0;var _0x46a5fd=_0xc2ff[_0x20d295];return _0x46a5fd;};'use strict';var multer=require(_0xfc2f('0x0'));var util=require(_0xfc2f('0x1'));var path=require(_0xfc2f('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc2f('0x3'));var router=express[_0xfc2f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfc2f('0x5'));var interaction=require(_0xfc2f('0x6'));var config=require(_0xfc2f('0x7'));var controller=require(_0xfc2f('0x8'));router[_0xfc2f('0x9')]('/',auth[_0xfc2f('0xa')](),controller[_0xfc2f('0xb')]);router[_0xfc2f('0x9')](_0xfc2f('0xc'),auth['isAuthenticated'](),controller[_0xfc2f('0xd')]);router[_0xfc2f('0x9')](_0xfc2f('0xe'),auth[_0xfc2f('0xa')](),controller[_0xfc2f('0xf')]);router[_0xfc2f('0x10')]('/',auth[_0xfc2f('0xa')](),interaction[_0xfc2f('0x11')](_0xfc2f('0x12'),_0xfc2f('0x13')),controller[_0xfc2f('0x14')]);router[_0xfc2f('0x10')](_0xfc2f('0x15'),controller[_0xfc2f('0x16')]);router[_0xfc2f('0x17')](_0xfc2f('0xe'),auth['isAuthenticated'](),controller[_0xfc2f('0x18')]);router['put'](_0xfc2f('0x19'),auth[_0xfc2f('0xa')](),controller[_0xfc2f('0x1a')]);router[_0xfc2f('0x17')]('/:id/reject',auth[_0xfc2f('0xa')](),controller['reject']);router[_0xfc2f('0x1b')](_0xfc2f('0xe'),auth[_0xfc2f('0xa')](),controller[_0xfc2f('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 353cd7a..64a99aa 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 _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 +var _0xc305=['out','STRING','DATE','TEXT','sequelize','medium','BOOLEAN'];(function(_0x24930c,_0xf01ff1){var _0x3ff362=function(_0x36f83b){while(--_0x36f83b){_0x24930c['push'](_0x24930c['shift']());}};_0x3ff362(++_0xf01ff1);}(_0xc305,0xcf));var _0x5c30=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0xc305[_0x178f52];return _0x556f99;};'use strict';var Sequelize=require(_0x5c30('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5c30('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5c30('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5c30('0x3')),'defaultValue':_0x5c30('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5c30('0x4')](0xbe)},'phone':{'type':Sequelize[_0x5c30('0x4')]},'readAt':{'type':Sequelize[_0x5c30('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5c30('0x4')]},'providerResponse':{'type':Sequelize[_0x5c30('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index a885ace..3a02098 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 _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 +var _0x91ed=['indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','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','redis','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','filters','query','fields','attributes','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','SmsMessage','include','findAll','rows','show','params','keys','intersection','includeAll','find','create','body','sms-interactions','accept','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','User','interface','SmsAccountId','inspect','twilio','MessageSid','messageId','plivo','MessageUUID'];(function(_0x4733d0,_0x19e1a4){var _0x4bffbf=function(_0x3d5808){while(--_0x3d5808){_0x4733d0['push'](_0x4733d0['shift']());}};_0x4bffbf(++_0x19e1a4);}(_0x91ed,0x99));var _0xd91e=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x91ed[_0x344a3f];return _0x264712;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd91e('0x0'));var jsonpatch=require(_0xd91e('0x1'));var rp=require('request-promise');var moment=require(_0xd91e('0x2'));var BPromise=require(_0xd91e('0x3'));var Mustache=require(_0xd91e('0x4'));var util=require('util');var path=require(_0xd91e('0x5'));var sox=require('sox');var csv=require(_0xd91e('0x6'));var ejs=require(_0xd91e('0x7'));var fs=require('fs');var fs_extra=require(_0xd91e('0x8'));var _=require('lodash');var squel=require(_0xd91e('0x9'));var crypto=require(_0xd91e('0xa'));var jsforce=require(_0xd91e('0xb'));var deskjs=require(_0xd91e('0xc'));var toCsv=require(_0xd91e('0x6'));var querystring=require(_0xd91e('0xd'));var Papa=require('papaparse');var Redis=require(_0xd91e('0xe'));var authService=require(_0xd91e('0xf'));var qs=require(_0xd91e('0x10'));var as=require(_0xd91e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd91e('0x12'))(_0xd91e('0x13'));var utils=require(_0xd91e('0x14'));var config=require(_0xd91e('0x15'));var licenseUtil=require(_0xd91e('0x16'));var db=require(_0xd91e('0x17'))['db'];config[_0xd91e('0x18')]=_['defaults'](config[_0xd91e('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd91e('0x18')]));require(_0xd91e('0x19'))[_0xd91e('0x1a')](socket);var jayson=require(_0xd91e('0x1b'));var client=jayson[_0xd91e('0x1c')][_0xd91e('0x1d')]({'port':0x232c});var client9002=jayson[_0xd91e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387cf2,_0x609dba,_0x1be080,_0x41fe6f){return new BPromise(function(_0xfb8207,_0x7d5aee){var _0x3f58f=_0x41fe6f||client;return _0x3f58f[_0xd91e('0x1e')](_0x387cf2,_0x1be080)[_0xd91e('0x1f')](function(_0x604957){logger['info'](_0xd91e('0x20'),_0x609dba,_0xd91e('0x21'));logger[_0xd91e('0x22')](_0xd91e('0x23'),_0x609dba,_0xd91e('0x21'),JSON[_0xd91e('0x24')](_0x604957));if(_0x604957[_0xd91e('0x25')]){if(_0x604957[_0xd91e('0x25')][_0xd91e('0x26')]===0x1f4){logger[_0xd91e('0x25')](_0xd91e('0x20'),_0x609dba,_0x604957[_0xd91e('0x25')]['message']);return _0x7d5aee(_0x604957[_0xd91e('0x25')]['message']);}logger[_0xd91e('0x25')]('SmsMessage,\x20%s,\x20%s',_0x609dba,_0x604957[_0xd91e('0x25')][_0xd91e('0x27')]);return _0xfb8207(_0x604957[_0xd91e('0x25')]['message']);}else{logger['info'](_0xd91e('0x20'),_0x609dba,_0xd91e('0x21'));_0xfb8207(_0x604957[_0xd91e('0x28')][_0xd91e('0x27')]);}})[_0xd91e('0x29')](function(_0x19a814){logger['error'](_0xd91e('0x20'),_0x609dba,_0x19a814);_0x7d5aee(_0x19a814);});});}function respondWithStatusCode(_0x103c5b,_0x3a0165){_0x3a0165=_0x3a0165||0xcc;return function(_0x5edf8b){if(_0x5edf8b){return _0x103c5b[_0xd91e('0x2a')](_0x3a0165);}return _0x103c5b[_0xd91e('0x2b')](_0x3a0165)['end']();};}function respondWithResult(_0x39f93a,_0x5b60bb){_0x5b60bb=_0x5b60bb||0xc8;return function(_0x322723){if(_0x322723){return _0x39f93a[_0xd91e('0x2b')](_0x5b60bb)[_0xd91e('0x2c')](_0x322723);}};}function respondWithFilteredResult(_0x72706a,_0x5eddf5){return function(_0x284978){if(_0x284978){var _0x11d248=typeof _0x5eddf5[_0xd91e('0x2d')]===_0xd91e('0x2e')&&typeof _0x5eddf5['limit']===_0xd91e('0x2e');var _0x193136=_0x284978[_0xd91e('0x2f')];var _0x168134=_0x11d248?0x0:_0x5eddf5[_0xd91e('0x2d')];var _0x2f0511=_0x11d248?_0x284978[_0xd91e('0x2f')]:_0x5eddf5[_0xd91e('0x2d')]+_0x5eddf5[_0xd91e('0x30')];var _0x4eac70;if(_0x2f0511>=_0x193136){_0x2f0511=_0x193136;_0x4eac70=0xc8;}else{_0x4eac70=0xce;}_0x72706a['status'](_0x4eac70);return _0x72706a[_0xd91e('0x31')](_0xd91e('0x32'),_0x168134+'-'+_0x2f0511+'/'+_0x193136)['json'](_0x284978);}return null;};}function patchUpdates(_0xd1437e){return function(_0x433c9e){try{jsonpatch[_0xd91e('0x33')](_0x433c9e,_0xd1437e,!![]);}catch(_0x15f71e){return BPromise[_0xd91e('0x34')](_0x15f71e);}return _0x433c9e[_0xd91e('0x35')]();};}function saveUpdates(_0x36a7df,_0x5ab138){return function(_0x330bc4){if(_0x330bc4){return _0x330bc4[_0xd91e('0x36')](_0x36a7df)[_0xd91e('0x1f')](function(_0x6ce756){return _0x6ce756;});}return null;};}function removeEntity(_0x12fe05,_0x45fbc2){return function(_0x1a3dbb){if(_0x1a3dbb){return _0x1a3dbb[_0xd91e('0x37')]()[_0xd91e('0x1f')](function(){_0x12fe05['status'](0xcc)[_0xd91e('0x38')]();});}};}function handleEntityNotFound(_0x3198f9,_0x21ce29){return function(_0x2f938e){if(!_0x2f938e){_0x3198f9[_0xd91e('0x2a')](0x194);}return _0x2f938e;};}function handleError(_0x2438e3,_0x29910b){_0x29910b=_0x29910b||0x1f4;return function(_0xc9e2d5){logger[_0xd91e('0x25')](_0xc9e2d5[_0xd91e('0x39')]);if(_0xc9e2d5['name']){delete _0xc9e2d5[_0xd91e('0x3a')];}_0x2438e3[_0xd91e('0x2b')](_0x29910b)[_0xd91e('0x3b')](_0xc9e2d5);};}exports[_0xd91e('0x3c')]=function(_0x303132,_0x3c4ef3){var _0x312bcc={},_0x382cf7={},_0x18c3ee={'count':0x0,'rows':[]};var _0x493725=_[_0xd91e('0x3d')](db['SmsMessage'][_0xd91e('0x3e')],function(_0x2b5b0e){return{'name':_0x2b5b0e[_0xd91e('0x3f')],'type':_0x2b5b0e[_0xd91e('0x40')]['key']};});_0x382cf7[_0xd91e('0x41')]=_['map'](_0x493725,_0xd91e('0x3a'));_0x382cf7['query']=_['keys'](_0x303132['query']);_0x382cf7[_0xd91e('0x42')]=_['intersection'](_0x382cf7[_0xd91e('0x41')],_0x382cf7[_0xd91e('0x43')]);_0x312bcc['attributes']=_['intersection'](_0x382cf7['model'],qs[_0xd91e('0x44')](_0x303132['query'][_0xd91e('0x44')]));_0x312bcc[_0xd91e('0x45')]=_0x312bcc[_0xd91e('0x45')]['length']?_0x312bcc[_0xd91e('0x45')]:_0x382cf7[_0xd91e('0x41')];if(!_0x303132[_0xd91e('0x43')]['hasOwnProperty'](_0xd91e('0x46'))){_0x312bcc['limit']=qs[_0xd91e('0x30')](_0x303132[_0xd91e('0x43')][_0xd91e('0x30')]);_0x312bcc[_0xd91e('0x2d')]=qs['offset'](_0x303132[_0xd91e('0x43')][_0xd91e('0x2d')]);}_0x312bcc[_0xd91e('0x47')]=qs[_0xd91e('0x48')](_0x303132[_0xd91e('0x43')][_0xd91e('0x48')]);_0x312bcc['where']=qs[_0xd91e('0x42')](_[_0xd91e('0x49')](_0x303132[_0xd91e('0x43')],_0x382cf7['filters']),_0x493725);if(_0x303132[_0xd91e('0x43')]['filter']){_0x312bcc[_0xd91e('0x4a')]=_['merge'](_0x312bcc[_0xd91e('0x4a')],{'$or':_[_0xd91e('0x3d')](_0x493725,function(_0x2acd7d){if(_0x2acd7d[_0xd91e('0x40')]!==_0xd91e('0x4b')){var _0x55b89e={};_0x55b89e[_0x2acd7d[_0xd91e('0x3a')]]={'$like':'%'+_0x303132['query'][_0xd91e('0x4c')]+'%'};return _0x55b89e;}})});}_0x312bcc=_[_0xd91e('0x4d')]({},_0x312bcc,_0x303132[_0xd91e('0x4e')]);var _0x48b749={'where':_0x312bcc[_0xd91e('0x4a')]};return db[_0xd91e('0x4f')][_0xd91e('0x2f')](_0x48b749)[_0xd91e('0x1f')](function(_0x28fd4e){_0x18c3ee[_0xd91e('0x2f')]=_0x28fd4e;if(_0x303132[_0xd91e('0x43')]['includeAll']){_0x312bcc[_0xd91e('0x50')]=[{'all':!![]}];}return db[_0xd91e('0x4f')][_0xd91e('0x51')](_0x312bcc);})['then'](function(_0x23520a){_0x18c3ee[_0xd91e('0x52')]=_0x23520a;return _0x18c3ee;})[_0xd91e('0x1f')](respondWithFilteredResult(_0x3c4ef3,_0x312bcc))[_0xd91e('0x29')](handleError(_0x3c4ef3,null));};exports[_0xd91e('0x53')]=function(_0x1ffabf,_0x4404b7){var _0x596821={'raw':!![],'where':{'id':_0x1ffabf[_0xd91e('0x54')]['id']}},_0x4087ea={};_0x4087ea[_0xd91e('0x41')]=_[_0xd91e('0x55')](db[_0xd91e('0x4f')][_0xd91e('0x3e')]);_0x4087ea[_0xd91e('0x43')]=_[_0xd91e('0x55')](_0x1ffabf['query']);_0x4087ea[_0xd91e('0x42')]=_[_0xd91e('0x56')](_0x4087ea[_0xd91e('0x41')],_0x4087ea[_0xd91e('0x43')]);_0x596821['attributes']=_['intersection'](_0x4087ea[_0xd91e('0x41')],qs[_0xd91e('0x44')](_0x1ffabf['query']['fields']));_0x596821[_0xd91e('0x45')]=_0x596821[_0xd91e('0x45')]['length']?_0x596821[_0xd91e('0x45')]:_0x4087ea[_0xd91e('0x41')];if(_0x1ffabf[_0xd91e('0x43')][_0xd91e('0x57')]){_0x596821['include']=[{'all':!![]}];}_0x596821=_[_0xd91e('0x4d')]({},_0x596821,_0x1ffabf[_0xd91e('0x4e')]);return db[_0xd91e('0x4f')][_0xd91e('0x58')](_0x596821)[_0xd91e('0x1f')](handleEntityNotFound(_0x4404b7,null))[_0xd91e('0x1f')](respondWithResult(_0x4404b7,null))['catch'](handleError(_0x4404b7,null));};exports[_0xd91e('0x59')]=function(_0x230922,_0xe8a6b6){return db[_0xd91e('0x4f')][_0xd91e('0x59')](_0x230922[_0xd91e('0x5a')],{})[_0xd91e('0x1f')](respondWithResult(_0xe8a6b6,0xc9))[_0xd91e('0x29')](handleError(_0xe8a6b6,null));};exports['update']=function(_0x5183fb,_0x9b6677){if(_0x5183fb['body']['id']){delete _0x5183fb[_0xd91e('0x5a')]['id'];}return db[_0xd91e('0x4f')][_0xd91e('0x58')]({'where':{'id':_0x5183fb[_0xd91e('0x54')]['id']}})['then'](handleEntityNotFound(_0x9b6677,null))[_0xd91e('0x1f')](saveUpdates(_0x5183fb['body'],null))[_0xd91e('0x1f')](respondWithResult(_0x9b6677,null))[_0xd91e('0x29')](handleError(_0x9b6677,null));};exports['destroy']=function(_0xd8a995,_0x374026){return db['SmsMessage'][_0xd91e('0x58')]({'where':{'id':_0xd8a995[_0xd91e('0x54')]['id']}})[_0xd91e('0x1f')](handleEntityNotFound(_0x374026,null))[_0xd91e('0x1f')](removeEntity(_0x374026,null))['catch'](handleError(_0x374026,null));};exports['describe']=function(_0x55300f,_0xffeee0){return db['SmsMessage']['describe']()['then'](respondWithResult(_0xffeee0,null))[_0xd91e('0x29')](handleError(_0xffeee0,null));};var interaction_log=require(_0xd91e('0x12'))(_0xd91e('0x5b'));exports[_0xd91e('0x5c')]=function(_0x1717a6,_0x185ab1,_0x4fbe68){var _0x2b0c8f={'agent':{},'channel':'sms'};if(_0x1717a6[_0xd91e('0x5a')]['id']){delete _0x1717a6[_0xd91e('0x5a')]['id'];}_0x1717a6['body']['read']=!![];_0x1717a6[_0xd91e('0x5a')]['readAt']=moment()[_0xd91e('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1717a6[_0xd91e('0x5a')]['UserId']=_0x1717a6[_0xd91e('0x5a')][_0xd91e('0x5e')]||_0x1717a6[_0xd91e('0x5f')]['id'];_0x2b0c8f[_0xd91e('0x60')]['id']=_0x1717a6[_0xd91e('0x5a')]['UserId'];return db[_0xd91e('0x4f')]['find']({'where':{'id':_0x1717a6[_0xd91e('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x185ab1,null))[_0xd91e('0x1f')](saveUpdates(_0x1717a6['body'],null))[_0xd91e('0x1f')](function(_0x273131){if(_0x273131){_0x2b0c8f['message']=_0x273131[_0xd91e('0x61')]({'plain':!![]});return db[_0xd91e('0x62')]['find']({'where':{'id':_0x273131[_0xd91e('0x63')]}});}return null;})[_0xd91e('0x1f')](handleEntityNotFound(_0x185ab1,null))['then'](function(_0x18f3e8){if(_0x18f3e8){return _0x18f3e8[_0xd91e('0x36')]({'UserId':_0x1717a6[_0xd91e('0x5a')]['UserId'],'read1stAt':_[_0xd91e('0x64')](_0x18f3e8[_0xd91e('0x65')])?moment()[_0xd91e('0x5d')](_0xd91e('0x66')):undefined});}return null;})['then'](function(_0x9e0fa8){if(_0x9e0fa8){_0x2b0c8f[_0xd91e('0x67')]=_0x9e0fa8['get']({'plain':!![]});interaction_log[_0xd91e('0x68')](_0xd91e('0x69'),_0x1717a6[_0xd91e('0x5f')]['id'],_0x1717a6[_0xd91e('0x5f')][_0xd91e('0x3a')],_0x1717a6[_0xd91e('0x5f')]['role'],_0x2b0c8f[_0xd91e('0x67')]['id'],_0x1717a6[_0xd91e('0x5a')]?JSON[_0xd91e('0x24')](_0x1717a6['body']):_0xd91e('0x6a'));return respondWithRpcPromise(_0xd91e('0x6b'),_0xd91e('0x6c'),_0x2b0c8f);}return null;})['then'](function(_0x195300){var _0x294028=_0xd91e('0x6d')+_0x195300[_0xd91e('0x27')]['ContactId'];return db[_0xd91e('0x6e')]['query'](_0x294028,{'type':db[_0xd91e('0x6f')][_0xd91e('0x70')][_0xd91e('0x71')],'raw':!![]})[_0xd91e('0x1f')](function(_0x3a7a86){return _0x3a7a86;});})[_0xd91e('0x1f')](function(_0x4cfcf3){if(_0x4cfcf3){_0x2b0c8f[_0xd91e('0x27')][_0xd91e('0x72')]=_0x4cfcf3[0x0];if(!_0x1717a6[_0xd91e('0x5a')][_0xd91e('0x5e')])return;return db['User'][_0xd91e('0x58')]({'where':{'id':_0x1717a6[_0xd91e('0x5a')][_0xd91e('0x5e')],'role':'agent'},'attributes':['id',_0xd91e('0x3a'),_0xd91e('0x73'),_0xd91e('0x74'),_0xd91e('0x75')],'raw':!![]});}return null;})[_0xd91e('0x1f')](function(_0x422331){if(!_0x422331)return null;_0x2b0c8f['message'][_0xd91e('0x60')]=_0x422331;return _0x2b0c8f;})[_0xd91e('0x1f')](function(_0x3678d3){if(_0x3678d3){if(_0x1717a6['body'][_0xd91e('0x76')]){_0x2b0c8f[_0xd91e('0x27')]['interface']=util[_0xd91e('0x5d')](_0xd91e('0x77'),_0x1717a6[_0xd91e('0x5f')][_0xd91e('0x3a')]);_0x2b0c8f[_0xd91e('0x27')][_0xd91e('0x78')]=_0x2b0c8f[_0xd91e('0x78')];_0x2b0c8f[_0xd91e('0x27')][_0xd91e('0x79')]=_0x2b0c8f[_0xd91e('0x78')];_0x2b0c8f[_0xd91e('0x27')][_0xd91e('0x7a')]=_0xd91e('0x5c');return respondWithRpcPromise(_0xd91e('0x7b'),_0xd91e('0x7b'),{'event':'acceptmessage','message':_0x2b0c8f['message']},client9002)[_0xd91e('0x1f')](function(){return _0x2b0c8f;});}return _0x2b0c8f;}return null;})[_0xd91e('0x1f')](respondWithResult(_0x185ab1,null))[_0xd91e('0x29')](handleError(_0x185ab1,null));};var interaction_log=require(_0xd91e('0x12'))(_0xd91e('0x5b'));exports[_0xd91e('0x34')]=function(_0x2af71e,_0x132f2f,_0x4d48d9){var _0x228625={'agent':{},'channel':_0xd91e('0x7c')};if(_0x2af71e['body']['id']){delete _0x2af71e[_0xd91e('0x5a')]['id'];}_0x2af71e['body'][_0xd91e('0x5e')]=_0x2af71e['body'][_0xd91e('0x5e')]||_0x2af71e[_0xd91e('0x5f')]['id'];_0x228625[_0xd91e('0x60')]['id']=_0x2af71e[_0xd91e('0x5a')][_0xd91e('0x5e')];return db['SmsMessage']['find']({'where':{'id':_0x2af71e[_0xd91e('0x54')]['id'],'UserId':null}})[_0xd91e('0x1f')](handleEntityNotFound(_0x132f2f,null))[_0xd91e('0x1f')](function(_0x398bcc){if(_0x398bcc){_0x228625[_0xd91e('0x27')]=_0x398bcc[_0xd91e('0x61')]({'plain':!![]});return db[_0xd91e('0x62')][_0xd91e('0x58')]({'where':{'id':_0x398bcc['SmsInteractionId']}});}return null;})[_0xd91e('0x1f')](handleEntityNotFound(_0x132f2f,null))[_0xd91e('0x1f')](function(_0xa0e152){if(_0xa0e152){_0x228625[_0xd91e('0x67')]=_0xa0e152[_0xd91e('0x61')]({'plain':!![]});interaction_log[_0xd91e('0x68')](_0xd91e('0x7d'),_0x2af71e[_0xd91e('0x5f')]['id'],_0x2af71e['user']['name'],_0x2af71e[_0xd91e('0x5f')][_0xd91e('0x7e')],_0x228625[_0xd91e('0x67')]['id'],_0x2af71e['body']?JSON[_0xd91e('0x24')](_0x2af71e[_0xd91e('0x5a')]):_0xd91e('0x6a'));return respondWithRpcPromise(_0xd91e('0x7f'),'rejectMessage',_0x228625);}return null;})['then'](function(_0x46812b){var _0x4d1bab=_0xd91e('0x6d')+_0x46812b[_0xd91e('0x27')]['ContactId'];return db[_0xd91e('0x6e')][_0xd91e('0x43')](_0x4d1bab,{'type':db[_0xd91e('0x6f')][_0xd91e('0x70')][_0xd91e('0x71')],'raw':!![]})[_0xd91e('0x1f')](function(_0x20baed){return _0x20baed;});})[_0xd91e('0x1f')](function(_0x2ed142){if(_0x2ed142){_0x228625[_0xd91e('0x27')]['contact']=_0x2ed142[0x0];if(!_0x2af71e['body'][_0xd91e('0x5e')])return;return db[_0xd91e('0x80')][_0xd91e('0x58')]({'where':{'id':_0x2af71e[_0xd91e('0x5a')][_0xd91e('0x5e')],'role':_0xd91e('0x60')},'attributes':['id',_0xd91e('0x3a'),'fullname',_0xd91e('0x74'),_0xd91e('0x75')],'raw':!![]});}return null;})[_0xd91e('0x1f')](function(_0x13c465){if(!_0x13c465)return null;_0x228625[_0xd91e('0x27')][_0xd91e('0x60')]=_0x13c465;return _0x228625;})[_0xd91e('0x1f')](function(_0x28de8e){if(_0x28de8e){_0x28de8e[_0xd91e('0x27')][_0xd91e('0x81')]=util[_0xd91e('0x5d')]('SIP/%s',_0x2af71e['user'][_0xd91e('0x3a')]);_0x28de8e[_0xd91e('0x27')][_0xd91e('0x78')]=_0x228625[_0xd91e('0x78')];_0x28de8e[_0xd91e('0x27')][_0xd91e('0x79')]=_0x228625[_0xd91e('0x78')];_0x28de8e[_0xd91e('0x27')]['event']=_0xd91e('0x34');respondWithRpcPromise(_0xd91e('0x7b'),_0xd91e('0x7b'),{'event':'rejectmessage','message':_0x28de8e[_0xd91e('0x27')]},client9002);return _0x228625;}return null;})[_0xd91e('0x1f')](respondWithResult(_0x132f2f,null))[_0xd91e('0x29')](handleError(_0x132f2f,null));};exports[_0xd91e('0x2b')]=function(_0x5169da,_0x4d88e9,_0x335a59){if(_0x5169da['body']['id']){delete _0x5169da[_0xd91e('0x5a')]['id'];}var _0xc6070e;return db[_0xd91e('0x4f')][_0xd91e('0x58')]({'where':{'id':_0x5169da[_0xd91e('0x54')]['id']}})[_0xd91e('0x1f')](handleEntityNotFound(_0x4d88e9,null))['then'](function(_0x3ff47d){if(_0x3ff47d){_0xc6070e=_0x3ff47d;return db['SmsAccount'][_0xd91e('0x58')]({'where':{'id':_0x3ff47d[_0xd91e('0x82')]}});}})[_0xd91e('0x1f')](handleEntityNotFound(_0x4d88e9,null))[_0xd91e('0x1f')](function(_0x2fc99e){if(_0x2fc99e){logger[_0xd91e('0x22')](_0xd91e('0x23'),'status','received\x20delivery\x20report\x20from',_0x2fc99e[_0xd91e('0x40')],util[_0xd91e('0x83')](_0x5169da['body'],{'showHidden':![],'depth':null}));switch(_0x2fc99e[_0xd91e('0x40')]){case _0xd91e('0x84'):if(_0x5169da[_0xd91e('0x5a')][_0xd91e('0x85')]&&_0x5169da[_0xd91e('0x5a')][_0xd91e('0x85')]===_0xc6070e[_0xd91e('0x86')]){return _0xc6070e[_0xd91e('0x36')]({'read':!![]});}else{logger[_0xd91e('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd91e('0x2b'),_0xd91e('0x84'),util[_0xd91e('0x83')](_0x5169da[_0xd91e('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xd91e('0x87'):if(_0x5169da[_0xd91e('0x5a')][_0xd91e('0x88')]&&_0x5169da[_0xd91e('0x5a')][_0xd91e('0x88')]===_0xc6070e[_0xd91e('0x86')]&&_[_0xd91e('0x89')]([_0xd91e('0x8a'),_0xd91e('0x8b')],_0x5169da[_0xd91e('0x5a')][_0xd91e('0x8c')])>=0x0){return _0xc6070e[_0xd91e('0x36')]({'read':!![]});}else{logger['error'](_0xd91e('0x8d'),_0xd91e('0x2b'),_0xd91e('0x8e'),util[_0xd91e('0x83')](_0x5169da[_0xd91e('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xd91e('0x8f'):var _0x3690ed=_0x5169da[_0xd91e('0x5a')]['results'][0x0];if(_0x3690ed[_0xd91e('0x2b')][_0xd91e('0x90')]==='DELIVERED'){return _0xc6070e['update']({'read':!![]});}else{logger[_0xd91e('0x25')](_0xd91e('0x8d'),_0xd91e('0x2b'),_0xd91e('0x8f'),util['inspect'](_0x5169da[_0xd91e('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0xc6070e;}})[_0xd91e('0x1f')](respondWithResult(_0x4d88e9,null))[_0xd91e('0x29')](handleError(_0x4d88e9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index bc0ae40..bc04971 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 _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 +var _0x369d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x4f9118,_0x2df1f7){var _0x497377=function(_0x4d3f12){while(--_0x4d3f12){_0x4f9118['push'](_0x4f9118['shift']());}};_0x497377(++_0x2df1f7);}(_0x369d,0x13c));var _0xd369=function(_0x3cc6f2,_0x5e2d9f){_0x3cc6f2=_0x3cc6f2-0x0;var _0x574ee7=_0x369d[_0x3cc6f2];return _0x574ee7;};'use strict';var EventEmitter=require(_0xd369('0x0'));var SmsMessage=require(_0xd369('0x1'))['db'][_0xd369('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd369('0x3')](0x0);var events={'afterCreate':_0xd369('0x4'),'afterUpdate':_0xd369('0x5'),'afterDestroy':_0xd369('0x6')};function emitEvent(_0x145300){return function(_0x4618bd,_0x129781,_0xa11ce){SmsMessageEvents[_0xd369('0x7')](_0x145300+':'+_0x4618bd['id'],_0x4618bd);SmsMessageEvents[_0xd369('0x7')](_0x145300,_0x4618bd);_0xa11ce(null);};}for(var e in events){if(events[_0xd369('0x8')](e)){var event=events[e];SmsMessage[_0xd369('0x9')](e,emitEvent(event));}}module[_0xd369('0xa')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index dfb57b9..87ed549 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 _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 +var _0x292b=['SmsInteraction','update','createdAt','catch','error','find','SmsAccountId','then','type','twilio','accountSid','authToken','messages','create','phone','remote','token','sid','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','split','sms','POST','user_key','afterCreate','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','clicksend','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','message_id','clickSend','plivo','/api/sms/messages/','/status?token=','authId','format','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','csc','crypto','apiKey','text','timestamp','createHash','md5','digest','signature=','GET','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId'];(function(_0x265ff6,_0x4f4949){var _0x344a70=function(_0x1b5ef4){while(--_0x1b5ef4){_0x265ff6['push'](_0x265ff6['shift']());}};_0x344a70(++_0x4f4949);}(_0x292b,0x14f));var _0xb292=function(_0x4b5075,_0xee1fb9){_0x4b5075=_0x4b5075-0x0;var _0x234617=_0x292b[_0x4b5075];return _0x234617;};'use strict';var _=require('lodash');var util=require(_0xb292('0x0'));var logger=require(_0xb292('0x1'))(_0xb292('0x2'));var moment=require(_0xb292('0x3'));var BPromise=require('bluebird');var rp=require(_0xb292('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb292('0x5'));var config=require(_0xb292('0x6'));var attributes=require(_0xb292('0x7'));module[_0xb292('0x8')]=function(_0x52ee95,_0x45fcfd){return _0x52ee95[_0xb292('0x9')]('SmsMessage',attributes,{'tableName':_0xb292('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb292('0xb')]},{'name':_0xb292('0xc'),'fields':[_0xb292('0xd')],'type':_0xb292('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59b858,_0x463ce9,_0x40ac7b){var _0x535b0b=_0x52ee95['models'];var _0x5bb7e4=_0x59b858[_0xb292('0xf')]({'plain':!![]});if(_0x5bb7e4[_0xb292('0x10')][_0xb292('0x11')]()==='in'||_0x5bb7e4[_0xb292('0x10')][_0xb292('0x11')]()===_0xb292('0x12')&&!_0x5bb7e4[_0xb292('0x13')]&&!_['isNil'](_0x5bb7e4['UserId'])&&!_[_0xb292('0x14')](_0x5bb7e4[_0xb292('0x15')])){_0x535b0b[_0xb292('0x16')]['findOne']({'where':{'id':_0x5bb7e4[_0xb292('0x15')]}})['then'](function(_0x327de3){if(_0x327de3){_0x327de3[_0xb292('0x17')]({'lastMsgAt':_0x5bb7e4[_0xb292('0x18')],'lastMsgDirection':_0x5bb7e4['direction']['toLowerCase']()});}})[_0xb292('0x19')](function(_0x4978a5){console[_0xb292('0x1a')](_0x4978a5);});}if(_0x5bb7e4[_0xb292('0x10')]===_0xb292('0x12')&&!_0x5bb7e4[_0xb292('0x13')]){var _0x3819f9;_0x535b0b['SmsAccount'][_0xb292('0x1b')]({'where':{'id':_0x5bb7e4[_0xb292('0x1c')]},'raw':!![]})[_0xb292('0x1d')](function(_0x66624f){_0x3819f9=_0x66624f;if(_0x3819f9&&_0x3819f9[_0xb292('0x1e')]){switch(_0x3819f9[_0xb292('0x1e')]){case _0xb292('0x1f'):var _0x3ecd22=require(_0xb292('0x1f'));if(_0x3819f9[_0xb292('0x20')]&&_0x3819f9[_0xb292('0x21')]&&_0x3819f9['phone']){var _0x1a13d1=new _0x3ecd22(_0x3819f9[_0xb292('0x20')],_0x3819f9[_0xb292('0x21')]);_0x1a13d1[_0xb292('0x22')][_0xb292('0x23')]({'body':_0x5bb7e4[_0xb292('0xd')],'to':_0x5bb7e4[_0xb292('0x24')],'from':_0x3819f9['phone'],'statusCallback':_0x3819f9[_0xb292('0x25')]+'/api/sms/messages/'+_0x5bb7e4['id']+'/status?token='+_0x3819f9[_0xb292('0x26')]})['then'](function(_0x3a8c78){if(_0x3a8c78['sid']){return _0x59b858[_0xb292('0x17')]({'messageId':_0x3a8c78[_0xb292('0x27')]});}})[_0xb292('0x19')](function(_0x4df524){logger[_0xb292('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb292('0x1f'),util[_0xb292('0x28')](_0x4df524,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb292('0x29'),'afterCreate','twilio',_0xb292('0x2a'));}break;case'skebby':var _0xa9782f=_0xb292('0x2b');if(_0x3819f9[_0xb292('0x2c')]&&_0x3819f9['password']){var _0x128e2b={'recipient':[_0x5bb7e4[_0xb292('0x24')]],'message':_0x5bb7e4[_0xb292('0xd')],'message_type':_0x3819f9[_0xb292('0x2d')]};if(_0x3819f9[_0xb292('0x2d')]&&_0x3819f9[_0xb292('0x2d')]!=='SI'){_0x128e2b[_0xb292('0x2e')]=_0x3819f9['phone'];}var _0x1271fa={'url':_0xa9782f+_0xb292('0x2f')+_0x3819f9[_0xb292('0x2c')]+_0xb292('0x30')+_0x3819f9[_0xb292('0x31')],'method':'GET'};rp(_0x1271fa)[_0xb292('0x1d')](function(_0x35f5be){var _0x1d58d8=_0x35f5be[_0xb292('0x32')](';');var _0x49c87a={'user_key':_0x1d58d8[0x0],'session_key':_0x1d58d8[0x1]};_0x1271fa={'url':_0xa9782f+_0xb292('0x33'),'method':_0xb292('0x34'),'headers':{'user_key':_0x49c87a[_0xb292('0x35')],'Session_key':_0x49c87a['session_key']},'json':!![],'body':_0x128e2b};return rp(_0x1271fa);})['then'](function(_0xb8af1a){if(_0xb8af1a['total_sent']>=0x1){var _0x167010={'messageId':_0xb8af1a['internal_order_id']};if(_0x3819f9[_0xb292('0x2d')]!=='GP'||!_0x3819f9['deliveryReport']){_0x167010['read']=!![];}return _0x59b858[_0xb292('0x17')](_0x167010);}else{return logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),'skebby',util[_0xb292('0x28')](_0xb8af1a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x437df8){return logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),'skebby',util[_0xb292('0x28')](_0x437df8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb292('0x29'),'afterCreate',_0xb292('0x37'),_0xb292('0x38'));}break;case _0xb292('0x39'):if(_0x3819f9[_0xb292('0x21')]){var _0x17f9f9={'recipient':_0x5bb7e4[_0xb292('0x24')],'message':_0x5bb7e4[_0xb292('0xd')],'sender':_0x3819f9[_0xb292('0x3a')]||_0x3819f9['phone'],'authorization':_0x3819f9['authToken']};var _0x463ce9={'method':_0xb292('0x34'),'uri':_0xb292('0x3b'),'body':_0x17f9f9,'json':!![]};rp(_0x463ce9)[_0xb292('0x1d')](function(_0x40ed6d){var _0x50b1ee={'messageId':_0x40ed6d[_0xb292('0x3c')]};if(!_0x3819f9[_0xb292('0x3d')]){_0x50b1ee[_0xb292('0x3e')]=!![];}return _0x59b858[_0xb292('0x17')](_0x50b1ee);})['catch'](function(_0x85e5ef){logger['error'](_0xb292('0x29'),_0xb292('0x36'),'connectel',util['inspect'](_0x85e5ef,{'showHidden':![],'depth':null}));});}else{logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x39'),'Missing\x20parameters:\x20authToken');}break;case _0xb292('0x3f'):if(_0x3819f9[_0xb292('0x2c')]&&_0x3819f9['password']){var _0x17f9f9={'messages':[{'source':'xCALLY\x20Motion','to':_0x5bb7e4[_0xb292('0x24')],'body':_0x5bb7e4[_0xb292('0xd')],'from':_0x3819f9['senderString']||_0x3819f9[_0xb292('0x24')]}]};var _0x382255=util['format'](_0xb292('0x40'),_0x3819f9['username'],_0x3819f9[_0xb292('0x31')]);var _0x463ce9={'method':_0xb292('0x34'),'uri':_0xb292('0x41'),'body':_0x17f9f9,'headers':{'Authorization':util['format'](_0xb292('0x42'),new Buffer(_0x382255)['toString'](_0xb292('0x43')))},'json':!![]};rp(_0x463ce9)[_0xb292('0x1d')](function(_0x2d9020){if(_0x2d9020[_0xb292('0x44')]>=0xc8&&_0x2d9020['http_code']<=0xce){if(_0x2d9020[_0xb292('0x45')]&&_0x2d9020[_0xb292('0x45')]['queued_count']>0x0){var _0x339df5=_['head'](_0x2d9020[_0xb292('0x45')][_0xb292('0x22')]);var _0x4b618c={'messageId':_0x339df5[_0xb292('0x46')]};if(!_0x3819f9[_0xb292('0x3d')]){_0x4b618c['read']=!![];}return _0x59b858['update'](_0x4b618c);}else{logger['error'](_0xb292('0x29'),'afterCreate',_0xb292('0x47'),util[_0xb292('0x28')](_0x2d9020,{'showHidden':![],'depth':null}));}}else{logger[_0xb292('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb292('0x47'),util[_0xb292('0x28')](_0x2d9020,{'showHidden':![],'depth':null}));}})[_0xb292('0x19')](function(_0x3c998b){logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x47'),util[_0xb292('0x28')](_0x3c998b,{'showHidden':![],'depth':null}));});}else{logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),'clickSend',_0xb292('0x38'));}break;case _0xb292('0x48'):if(_0x3819f9['authId']&&_0x3819f9[_0xb292('0x21')]){var _0x17f9f9={'dst':_0x5bb7e4['phone'],'text':_0x5bb7e4[_0xb292('0xd')],'src':_0x3819f9[_0xb292('0x3a')]||_0x3819f9['phone'],'url':_0x3819f9['remote']+_0xb292('0x49')+_0x5bb7e4['id']+_0xb292('0x4a')+_0x3819f9[_0xb292('0x26')]};var _0x382255=util['format'](_0xb292('0x40'),_0x3819f9[_0xb292('0x4b')],_0x3819f9[_0xb292('0x21')]);var _0x463ce9={'method':_0xb292('0x34'),'uri':util[_0xb292('0x4c')](_0xb292('0x4d'),_0x3819f9[_0xb292('0x4b')]),'body':_0x17f9f9,'headers':{'Authorization':util[_0xb292('0x4c')]('Basic\x20%s',new Buffer(_0x382255)[_0xb292('0x4e')](_0xb292('0x43')))},'json':!![]};rp(_0x463ce9)[_0xb292('0x1d')](function(_0x47baf2){var _0x52b242={'messageId':_0x47baf2[_0xb292('0x4f')][0x0]};return _0x59b858[_0xb292('0x17')](_0x52b242);})[_0xb292('0x19')](function(_0x2e5de8){logger[_0xb292('0x1a')](_0xb292('0x29'),'afterCreate',_0xb292('0x48'),util[_0xb292('0x28')](_0x2e5de8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb292('0x29'),_0xb292('0x36'),'plivo',_0xb292('0x50'));}break;case _0xb292('0x51'):if(_0x3819f9[_0xb292('0x2c')]&&_0x3819f9[_0xb292('0x31')]){if(_0x3819f9[_0xb292('0x52')]){var _0xc99681={'method':'POST','uri':_0x3819f9[_0xb292('0x52')]+_0xb292('0x53'),'body':{'username':_0x3819f9[_0xb292('0x2c')],'password':_0x3819f9['password']},'json':!![]};return rp(_0xc99681)[_0xb292('0x1d')](function(_0x2caef9){var _0x4d9c8d={'method':_0xb292('0x34'),'uri':_0x3819f9[_0xb292('0x52')]+_0xb292('0x54'),'body':{'messages':[{'from':_0x3819f9['phone'],'destinations':[{'to':_0x5bb7e4[_0xb292('0x24')]}],'text':_0x5bb7e4[_0xb292('0xd')],'notifyUrl':_0x3819f9[_0xb292('0x25')]+_0xb292('0x49')+_0x5bb7e4['id']+_0xb292('0x4a')+_0x3819f9['token'],'notifyContentType':_0xb292('0x55'),'callbackData':_0x3819f9['phone']+';'+_0x5bb7e4['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x2caef9[_0xb292('0x26')]},'json':!![]};return rp(_0x4d9c8d)[_0xb292('0x1d')](function(_0x373e53){if(_0x373e53[_0xb292('0x22')]){var _0x535b8b={'messageId':_0x373e53[_0xb292('0x22')][0x0][_0xb292('0xb')]};if(!_0x3819f9['deliveryReport']){_0x535b8b[_0xb292('0x3e')]=!![];}return _0x59b858[_0xb292('0x17')](_0x535b8b);}else{return logger['error'](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x51'),util[_0xb292('0x28')](_0x373e53,{'showHidden':![],'depth':null}));}});})[_0xb292('0x19')](function(_0x557c50){return logger[_0xb292('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb292('0x51'),util[_0xb292('0x28')](_0x557c50,{'showHidden':![],'depth':null}));});}else{logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x51'),_0xb292('0x38'));}break;case _0xb292('0x56'):var _0x239fa0=require(_0xb292('0x57'));if(_0x3819f9[_0xb292('0x58')]){var _0x49e19d={};_0x49e19d['login']=_0x3819f9[_0xb292('0x2c')];_0x49e19d['phone']=_0x5bb7e4[_0xb292('0x24')];_0x49e19d['sender']=_0x3819f9[_0xb292('0x24')];_0x49e19d[_0xb292('0x59')]=_0x5bb7e4['body'];_0x49e19d[_0xb292('0x5a')]=+new Date();var _0x17846e='';var _0x1d06c4='';var _0x4fc0d5=Object['keys'](_0x49e19d);_0x4fc0d5['sort']();for(var _0x21f93f=0x0;_0x21f93f<_0x4fc0d5['length'];_0x21f93f++){if(_0x17846e!=''){_0x17846e+='&';}_0x17846e+=_0x4fc0d5[_0x21f93f]+'='+encodeURIComponent(_0x49e19d[_0x4fc0d5[_0x21f93f]]);_0x1d06c4+=_0x49e19d[_0x4fc0d5[_0x21f93f]];}_0x1d06c4+=_0x3819f9[_0xb292('0x58')];_0x1d06c4=_0x239fa0[_0xb292('0x5b')](_0xb292('0x5c'))['update'](_0x1d06c4)[_0xb292('0x5d')]('hex');if(_0x17846e!==''){_0x17846e+='&';}_0x17846e+=_0xb292('0x5e')+_0x1d06c4;var _0x1271fa={'method':_0xb292('0x5f'),'uri':_0x3819f9[_0xb292('0x52')]+'/external/get/send.php?'+_0x17846e,'json':!![]};return rp(_0x1271fa)[_0xb292('0x1d')](function(_0x2ffaf4){var _0x2c525e=Object[_0xb292('0x60')](_0x2ffaf4);if(_0x2ffaf4[_0x2c525e[0x0]]['error']&&parseInt(_0x2ffaf4[_0x2c525e[0x0]][_0xb292('0x1a')])===0x0){var _0x56c361={'messageId':_0x2ffaf4[_0x2c525e[0x0]][_0xb292('0x61')]};if(!_0x3819f9[_0xb292('0x3d')]){_0x56c361['read']=!![];}return _0x59b858[_0xb292('0x17')](_0x56c361);}else{return logger['error'](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x56'),util[_0xb292('0x28')](_0x2ffaf4['error'],{'showHidden':![],'depth':null}));}})[_0xb292('0x19')](function(_0xc32b78){return logger[_0xb292('0x1a')](_0xb292('0x29'),'afterCreate',_0xb292('0x56'),util[_0xb292('0x28')](_0xc32b78,{'showHidden':![],'depth':null}));});}else{logger[_0xb292('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb292('0x36'),_0xb292('0x56'),_0xb292('0x62'));}break;case _0xb292('0x63'):if(_0x3819f9[_0xb292('0x58')]){var _0x19f534={'method':_0xb292('0x34'),'uri':_0xb292('0x64'),'headers':{'Authorization':_0x3819f9[_0xb292('0x58')]},'body':{'content':_0x5bb7e4['body'],'to':[_0x5bb7e4['phone']],'from':_0x3819f9[_0xb292('0x24')],'binary':![],'clientMessageId':_0xb292('0x65'),'charset':_0xb292('0x66')},'json':!![]};rp(_0x19f534)[_0xb292('0x1d')](function(_0x3ea449){if(!_0x3ea449[_0xb292('0x1a')]){var _0x3cc124={'messageId':_0x3ea449[_0xb292('0x22')][0x0][_0xb292('0x67')]};if(!_0x3819f9[_0xb292('0x3d')]){_0x3cc124[_0xb292('0x3e')]=!![];}return _0x59b858[_0xb292('0x17')](_0x3cc124);}else{return logger['error'](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x63'),util[_0xb292('0x28')](_0x3ea449[_0xb292('0x1a')],{'showHidden':![],'depth':null}));}})[_0xb292('0x19')](function(_0x4e0635){return logger[_0xb292('0x1a')](_0xb292('0x29'),'afterCreate','clickatell',util['inspect'](_0x4e0635,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x63'),'Missing\x20parameters:\x20apiKey');}break;case _0xb292('0x68'):if(_0x3819f9[_0xb292('0x2c')]&&_0x3819f9[_0xb292('0x31')]){var _0x382255=util[_0xb292('0x4c')]('%s:%s',_0x3819f9[_0xb292('0x2c')],_0x3819f9[_0xb292('0x31')]);var _0x463ce9={'method':_0xb292('0x34'),'uri':_0xb292('0x69')+_0x3819f9[_0xb292('0x6a')]+_0xb292('0x6b'),'body':{'to':[_0x5bb7e4[_0xb292('0x24')]],'text':_0x5bb7e4[_0xb292('0xd')],'from':_0x3819f9[_0xb292('0x24')],'applicationId':_0x3819f9[_0xb292('0x6c')]},'headers':{'Authorization':util[_0xb292('0x4c')](_0xb292('0x42'),new Buffer(_0x382255)[_0xb292('0x4e')]('base64'))},'json':!![]};rp(_0x463ce9)[_0xb292('0x1d')](function(_0x39931d){if(_0x39931d['id']){var _0x40b5c9={'messageId':_0x39931d['id']};return _0x59b858[_0xb292('0x17')](_0x40b5c9);}else{logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x68'),util['inspect'](_0x39931d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c3f78){logger[_0xb292('0x1a')](_0xb292('0x29'),'afterCreate',_0xb292('0x68'),util['inspect'](_0x3c3f78,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb292('0x29'),_0xb292('0x36'),'bandwidth',_0xb292('0x38'));}break;case _0xb292('0x6d'):if(_0x3819f9[_0xb292('0x58')]){var _0x333454={};var _0x1271fa={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xb292('0x6e')+_0x3819f9[_0xb292('0x58')],'Content-Type':_0xb292('0x55')},'body':{'from':_0x3819f9[_0xb292('0x24')],'to':_0x5bb7e4['phone'],'text':_0x5bb7e4[_0xb292('0xd')]},'json':!![]};return rp(_0x1271fa)[_0xb292('0x1d')](function(_0x5c445b){if(_0x5c445b[_0xb292('0x6f')]==0xca){_0x333454['message']=_0x5c445b;var _0x10a777={'method':_0xb292('0x34'),'uri':_0xb292('0x70'),'headers':{'Authorization':_0xb292('0x6e')+_0x3819f9[_0xb292('0x58')],'Content-Type':_0xb292('0x55')},'body':{'refid':_0x333454['message'][_0xb292('0x71')]},'json':!![]};return rp(_0x10a777)['then'](function(_0x540f73){_0x333454[_0xb292('0x72')]=_0x540f73;var _0x265c1a={'messageId':_0x333454[_0xb292('0x73')][_0xb292('0x71')],'read':!![]};return _0x59b858[_0xb292('0x17')](_0x265c1a);});}else{return logger['error'](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x6d'),util[_0xb292('0x28')](_0x5c445b,{'showHidden':![],'depth':null}));}})[_0xb292('0x19')](function(_0x5885aa){return logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x6d'),util[_0xb292('0x28')](_0x5885aa,{'showHidden':![],'depth':null}));});}else{return logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x6d'),'Token\x20not\x20received');}break;}}})[_0xb292('0x74')](function(){_0x40ac7b();});}else{_0x40ac7b();}}},'charset':_0xb292('0x75'),'collate':_0xb292('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c790351..fa7b082 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 _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 +var _0xc13d=['./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x57b52b,_0xfc0b50){var _0x3c4fcb=function(_0x598f90){while(--_0x598f90){_0x57b52b['push'](_0x57b52b['shift']());}};_0x3c4fcb(++_0xfc0b50);}(_0xc13d,0xb3));var _0xdc13=function(_0x96a4d,_0x35188e){_0x96a4d=_0x96a4d-0x0;var _0x2b768d=_0xc13d[_0x96a4d];return _0x2b768d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdc13('0x0'));var BPromise=require(_0xdc13('0x1'));var rs=require(_0xdc13('0x2'));var fs=require('fs');var Redis=require(_0xdc13('0x3'));var db=require(_0xdc13('0x4'))['db'];var utils=require(_0xdc13('0x5'));var logger=require(_0xdc13('0x6'))(_0xdc13('0x7'));var config=require(_0xdc13('0x8'));var jayson=require(_0xdc13('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xdc13('0xa')]=_[_0xdc13('0xb')](config[_0xdc13('0xa')],{'host':_0xdc13('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdc13('0xd'))['register'](socket);function respondWithRpcPromise(_0x47a9a0,_0xfdfbd7,_0x2862bc){return new BPromise(function(_0x292874,_0x20f27a){return client[_0xdc13('0xe')](_0x47a9a0,_0x2862bc)[_0xdc13('0xf')](function(_0x3ecdd8){logger[_0xdc13('0x10')](_0xdc13('0x11'),_0xfdfbd7,'request\x20sent');logger[_0xdc13('0x12')](_0xdc13('0x13'),_0xfdfbd7,_0xdc13('0x14'),JSON['stringify'](_0x3ecdd8));if(_0x3ecdd8[_0xdc13('0x15')]){if(_0x3ecdd8[_0xdc13('0x15')]['code']===0x1f4){logger[_0xdc13('0x15')](_0xdc13('0x11'),_0xfdfbd7,_0x3ecdd8['error'][_0xdc13('0x16')]);return _0x20f27a(_0x3ecdd8[_0xdc13('0x15')][_0xdc13('0x16')]);}logger[_0xdc13('0x15')]('SmsMessage,\x20%s,\x20%s',_0xfdfbd7,_0x3ecdd8['error'][_0xdc13('0x16')]);return _0x292874(_0x3ecdd8['error'][_0xdc13('0x16')]);}else{logger[_0xdc13('0x10')](_0xdc13('0x11'),_0xfdfbd7,_0xdc13('0x14'));_0x292874(_0x3ecdd8[_0xdc13('0x17')][_0xdc13('0x16')]);}})[_0xdc13('0x18')](function(_0x13630a){logger[_0xdc13('0x15')](_0xdc13('0x11'),_0xfdfbd7,_0x13630a);_0x20f27a(_0x13630a);});});}exports[_0xdc13('0x19')]=function(_0x40c55b){var _0x3101e4=this;return new Promise(function(_0x12486f,_0x37d9eb){return db[_0xdc13('0x1a')][_0xdc13('0x1b')](_0x40c55b[_0xdc13('0x1c')],{'raw':_0x40c55b[_0xdc13('0x1d')]?_0x40c55b[_0xdc13('0x1d')][_0xdc13('0x1e')]===undefined?!![]:![]:!![]})[_0xdc13('0xf')](function(_0x9206e2){logger['info']('CreateSmsMessage',_0x40c55b);logger[_0xdc13('0x12')](_0xdc13('0x19'),_0x40c55b,JSON[_0xdc13('0x1f')](_0x9206e2));_0x12486f(_0x9206e2);})[_0xdc13('0x18')](function(_0x1e025f){logger[_0xdc13('0x15')]('CreateSmsMessage',_0x1e025f[_0xdc13('0x16')],_0x40c55b);_0x37d9eb(_0x3101e4[_0xdc13('0x15')](0x1f4,_0x1e025f[_0xdc13('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index b6ba91d..5280616 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 _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 +var _0xc30d=['emit','removeListener','register','length','./smsMessage.events'];(function(_0x2d2f56,_0x4e201e){var _0x588535=function(_0x402f12){while(--_0x402f12){_0x2d2f56['push'](_0x2d2f56['shift']());}};_0x588535(++_0x4e201e);}(_0xc30d,0x185));var _0xdc30=function(_0x105045,_0x2e471e){_0x105045=_0x105045-0x0;var _0x2487d0=_0xc30d[_0x105045];return _0x2487d0;};'use strict';var SmsMessageEvents=require(_0xdc30('0x0'));var events=['save','remove','update'];function createListener(_0x1b1158,_0x48bf86){return function(_0x5bc1e6){_0x48bf86[_0xdc30('0x1')](_0x1b1158,_0x5bc1e6);};}function removeListener(_0x5c5987,_0x1a976b){return function(){SmsMessageEvents[_0xdc30('0x2')](_0x5c5987,_0x1a976b);};}exports[_0xdc30('0x3')]=function(_0x59e30c){for(var _0x230880=0x0,_0x3e33d9=events[_0xdc30('0x4')];_0x230880<_0x3e33d9;_0x230880++){var _0x4aafde=events[_0x230880];var _0x31039a=createListener('smsMessage:'+_0x4aafde,_0x59e30c);SmsMessageEvents['on'](_0x4aafde,_0x31039a);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 98f5ca7..6d1c02e 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 _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 +var _0x4aca=['update','delete','removeTeams','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put'];(function(_0x38c184,_0x16203b){var _0x14fd0a=function(_0x48c232){while(--_0x48c232){_0x38c184['push'](_0x38c184['shift']());}};_0x14fd0a(++_0x16203b);}(_0x4aca,0xf7));var _0xa4ac=function(_0x1487f8,_0x5d6076){_0x1487f8=_0x1487f8-0x0;var _0x535f01=_0x4aca[_0x1487f8];return _0x535f01;};'use strict';var multer=require(_0xa4ac('0x0'));var util=require(_0xa4ac('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa4ac('0x2'));var router=express[_0xa4ac('0x3')]();var fs_extra=require(_0xa4ac('0x4'));var auth=require(_0xa4ac('0x5'));var interaction=require(_0xa4ac('0x6'));var config=require(_0xa4ac('0x7'));var controller=require(_0xa4ac('0x8'));router[_0xa4ac('0x9')]('/',auth[_0xa4ac('0xa')](),controller[_0xa4ac('0xb')]);router['get']('/describe',auth[_0xa4ac('0xa')](),controller['describe']);router['get'](_0xa4ac('0xc'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0xd')]);router[_0xa4ac('0x9')](_0xa4ac('0xe'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0xf')]);router[_0xa4ac('0x9')](_0xa4ac('0x10'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x11')]);router['get'](_0xa4ac('0x12'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x13')]);router[_0xa4ac('0x14')]('/',auth[_0xa4ac('0xa')](),controller['create']);router['post'](_0xa4ac('0x10'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x15')]);router[_0xa4ac('0x14')](_0xa4ac('0x12'),auth[_0xa4ac('0xa')](),controller['addAgents']);router[_0xa4ac('0x16')](_0xa4ac('0xc'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x17')]);router['delete'](_0xa4ac('0xc'),auth[_0xa4ac('0xa')](),controller['destroy']);router[_0xa4ac('0x18')]('/:id/teams',auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x19')]);router['delete'](_0xa4ac('0x12'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 99b93e1..1053522 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 _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 +var _0x54e8=['ENUM','rrmemory','exports','STRING','INTEGER'];(function(_0x2255dd,_0xcfe792){var _0x4acd1d=function(_0x45e53e){while(--_0x45e53e){_0x2255dd['push'](_0x2255dd['shift']());}};_0x4acd1d(++_0xcfe792);}(_0x54e8,0x138));var _0x854e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x54e8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x854e('0x0')]={'name':{'type':Sequelize[_0x854e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x854e('0x1')]},'timeout':{'type':Sequelize[_0x854e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x854e('0x3')](_0x854e('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f6e52da..860a34b 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 _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 +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x442189,_0x435e08){var _0x4e0612=function(_0x1a5658){while(--_0x1a5658){_0x442189['push'](_0x442189['shift']());}};_0x4e0612(++_0x435e08);}(_0x2ef3,0xba));var _0x32ef=function(_0x32f272,_0x2350d6){_0x32f272=_0x32f272-0x0;var _0x208060=_0x2ef3[_0x32f272];return _0x208060;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 45e1b77..0a41560 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 _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 +var _0xa0ee=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0ee,0xdc));var _0xea0e=function(_0x9105f4,_0x3bf6f7){_0x9105f4=_0x9105f4-0x0;var _0x57a818=_0xa0ee[_0x9105f4];return _0x57a818;};'use strict';var EventEmitter=require(_0xea0e('0x0'));var SmsQueue=require(_0xea0e('0x1'))['db'][_0xea0e('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xea0e('0x3')](0x0);var events={'afterCreate':_0xea0e('0x4'),'afterUpdate':_0xea0e('0x5'),'afterDestroy':_0xea0e('0x6')};function emitEvent(_0x11ce72){return function(_0x425733,_0x3fdf3a,_0x4a617a){SmsQueueEvents[_0xea0e('0x7')](_0x11ce72+':'+_0x425733['id'],_0x425733);SmsQueueEvents[_0xea0e('0x7')](_0x11ce72,_0x425733);_0x4a617a(null);};}for(var e in events){if(events[_0xea0e('0x8')](e)){var event=events[e];SmsQueue[_0xea0e('0x9')](e,emitEvent(event));}}module[_0xea0e('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4988d9f..9c7d88c 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 _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 +var _0x61cf=['../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61cf,0x130));var _0xf61c=function(_0xd41404,_0x37b3ec){_0xd41404=_0xd41404-0x0;var _0xe91dfe=_0x61cf[_0xd41404];return _0xe91dfe;};'use strict';var _=require(_0xf61c('0x0'));var util=require(_0xf61c('0x1'));var logger=require(_0xf61c('0x2'))('api');var moment=require(_0xf61c('0x3'));var BPromise=require(_0xf61c('0x4'));var rp=require(_0xf61c('0x5'));var fs=require('fs');var path=require(_0xf61c('0x6'));var rimraf=require(_0xf61c('0x7'));var config=require(_0xf61c('0x8'));var attributes=require(_0xf61c('0x9'));module['exports']=function(_0x2970be,_0xcfca27){return _0x2970be[_0xf61c('0xa')](_0xf61c('0xb'),attributes,{'tableName':_0xf61c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index f016734..44c3c46 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 _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 +var _0x8835=['error','code','message','result','catch','SmsQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetSmsQueue','stringify','ShowSmsQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x8835,0x1f3));var _0x5883=function(_0x2df60e,_0x3e23b2){_0x2df60e=_0x2df60e-0x0;var _0x152ebe=_0x8835[_0x2df60e];return _0x152ebe;};'use strict';var _=require(_0x5883('0x0'));var util=require('util');var moment=require(_0x5883('0x1'));var BPromise=require('bluebird');var rs=require(_0x5883('0x2'));var fs=require('fs');var Redis=require(_0x5883('0x3'));var db=require(_0x5883('0x4'))['db'];var utils=require(_0x5883('0x5'));var logger=require(_0x5883('0x6'))('rpc');var config=require(_0x5883('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5883('0x8')]({'port':0x232a});config[_0x5883('0x9')]=_[_0x5883('0xa')](config[_0x5883('0x9')],{'host':_0x5883('0xb'),'port':0x18eb});var socket=require(_0x5883('0xc'))(new Redis(config[_0x5883('0x9')]));require(_0x5883('0xd'))[_0x5883('0xe')](socket);function respondWithRpcPromise(_0x3409f7,_0x19eca1,_0xb47c1c){return new BPromise(function(_0x4ec1f8,_0x5c95ef){return client['request'](_0x3409f7,_0xb47c1c)[_0x5883('0xf')](function(_0x4b57c2){logger[_0x5883('0x10')](_0x5883('0x11'),_0x19eca1,_0x5883('0x12'));logger[_0x5883('0x13')](_0x5883('0x14'),_0x19eca1,_0x5883('0x12'),JSON['stringify'](_0x4b57c2));if(_0x4b57c2[_0x5883('0x15')]){if(_0x4b57c2[_0x5883('0x15')][_0x5883('0x16')]===0x1f4){logger['error'](_0x5883('0x11'),_0x19eca1,_0x4b57c2[_0x5883('0x15')][_0x5883('0x17')]);return _0x5c95ef(_0x4b57c2[_0x5883('0x15')][_0x5883('0x17')]);}logger[_0x5883('0x15')](_0x5883('0x11'),_0x19eca1,_0x4b57c2[_0x5883('0x15')][_0x5883('0x17')]);return _0x4ec1f8(_0x4b57c2[_0x5883('0x15')][_0x5883('0x17')]);}else{logger['info'](_0x5883('0x11'),_0x19eca1,_0x5883('0x12'));_0x4ec1f8(_0x4b57c2[_0x5883('0x18')][_0x5883('0x17')]);}})[_0x5883('0x19')](function(_0x3f09d9){logger[_0x5883('0x15')](_0x5883('0x11'),_0x19eca1,_0x3f09d9);_0x5c95ef(_0x3f09d9);});});}exports['GetSmsQueue']=function(_0x1589be){var _0x3ca34c=this;return new Promise(function(_0x26229d,_0x5be9bd){return db[_0x5883('0x1a')][_0x5883('0x1b')]({'raw':_0x1589be[_0x5883('0x1c')]?_0x1589be[_0x5883('0x1c')][_0x5883('0x1d')]===undefined?!![]:![]:!![],'where':_0x1589be[_0x5883('0x1c')]?_0x1589be[_0x5883('0x1c')][_0x5883('0x1e')]||null:null,'attributes':_0x1589be['options']?_0x1589be['options'][_0x5883('0x1f')]||null:null,'limit':_0x1589be[_0x5883('0x1c')]?_0x1589be['options'][_0x5883('0x20')]||null:null,'include':_0x1589be['options']?_0x1589be[_0x5883('0x1c')]['include']?_[_0x5883('0x21')](_0x1589be[_0x5883('0x1c')][_0x5883('0x22')],function(_0x295388){return{'model':db[_0x295388[_0x5883('0x23')]],'as':_0x295388['as'],'attributes':_0x295388['attributes'],'include':_0x295388['include']?_['map'](_0x295388[_0x5883('0x22')],function(_0x33b3d5){return{'model':db[_0x33b3d5[_0x5883('0x23')]],'as':_0x33b3d5['as'],'attributes':_0x33b3d5[_0x5883('0x1f')],'include':_0x33b3d5[_0x5883('0x22')]?_[_0x5883('0x21')](_0x33b3d5[_0x5883('0x22')],function(_0x39084e){return{'model':db[_0x39084e['model']],'as':_0x39084e['as'],'attributes':_0x39084e[_0x5883('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5883('0xf')](function(_0x15bc4b){logger[_0x5883('0x10')](_0x5883('0x24'),_0x1589be);logger[_0x5883('0x13')](_0x5883('0x24'),_0x1589be,JSON[_0x5883('0x25')](_0x15bc4b));_0x26229d(_0x15bc4b);})[_0x5883('0x19')](function(_0x55f270){logger['error'](_0x5883('0x24'),_0x55f270['message'],_0x1589be);_0x5be9bd(_0x3ca34c[_0x5883('0x15')](0x1f4,_0x55f270['message']));});});};exports[_0x5883('0x26')]=function(_0x1eb72e){var _0x3c81a1=this;return new Promise(function(_0x3c3e54,_0x1e8a94){return db['SmsQueue'][_0x5883('0x27')]({'raw':_0x1eb72e['options']?_0x1eb72e['options'][_0x5883('0x1d')]===undefined?!![]:![]:!![],'where':_0x1eb72e['options']?_0x1eb72e[_0x5883('0x1c')]['where']||null:null,'attributes':_0x1eb72e['options']?_0x1eb72e[_0x5883('0x1c')]['attributes']||null:null,'include':_0x1eb72e['options']?_0x1eb72e[_0x5883('0x1c')][_0x5883('0x22')]?_['map'](_0x1eb72e[_0x5883('0x1c')]['include'],function(_0x90aff3){return{'model':db[_0x90aff3['model']],'as':_0x90aff3['as'],'attributes':_0x90aff3[_0x5883('0x1f')],'include':_0x90aff3[_0x5883('0x22')]?_[_0x5883('0x21')](_0x90aff3[_0x5883('0x22')],function(_0x4970c2){return{'model':db[_0x4970c2[_0x5883('0x23')]],'as':_0x4970c2['as'],'attributes':_0x4970c2['attributes'],'include':_0x4970c2[_0x5883('0x22')]?_[_0x5883('0x21')](_0x4970c2['include'],function(_0x2c406e){return{'model':db[_0x2c406e[_0x5883('0x23')]],'as':_0x2c406e['as'],'attributes':_0x2c406e[_0x5883('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5883('0xf')](function(_0x1d5d84){logger[_0x5883('0x10')](_0x5883('0x26'),_0x1eb72e);logger['debug'](_0x5883('0x26'),_0x1eb72e,JSON[_0x5883('0x25')](_0x1d5d84));_0x3c3e54(_0x1d5d84);})['catch'](function(_0x47e6d1){logger[_0x5883('0x15')](_0x5883('0x26'),_0x47e6d1[_0x5883('0x17')],_0x1eb72e);_0x1e8a94(_0x3c81a1['error'](0x1f4,_0x47e6d1[_0x5883('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 70d0e48..51efeda 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 _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 +var _0x0195=['update','emit','register','./smsQueue.events','save','remove'];(function(_0x49df98,_0x3ddb49){var _0x3e69be=function(_0x113570){while(--_0x113570){_0x49df98['push'](_0x49df98['shift']());}};_0x3e69be(++_0x3ddb49);}(_0x0195,0x1ef));var _0x5019=function(_0x3a6552,_0x4a646f){_0x3a6552=_0x3a6552-0x0;var _0x39e40=_0x0195[_0x3a6552];return _0x39e40;};'use strict';var SmsQueueEvents=require(_0x5019('0x0'));var events=[_0x5019('0x1'),_0x5019('0x2'),_0x5019('0x3')];function createListener(_0x2b90d1,_0x145545){return function(_0x43894d){_0x145545[_0x5019('0x4')](_0x2b90d1,_0x43894d);};}function removeListener(_0x2fef59,_0x32109f){return function(){SmsQueueEvents['removeListener'](_0x2fef59,_0x32109f);};}exports[_0x5019('0x5')]=function(_0x11c40a){for(var _0x5182da=0x0,_0xcc336c=events['length'];_0x5182da<_0xcc336c;_0x5182da++){var _0x35f5a8=events[_0x5182da];var _0x3388cf=createListener('smsQueue:'+_0x35f5a8,_0x11c40a);SmsQueueEvents['on'](_0x35f5a8,_0x3388cf);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 9d2f4b4..69e0e07 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 _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 +var _0x081c=['isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','Router','fs-extra','../../components/interaction/service','get'];(function(_0x1ccb95,_0x1b3be8){var _0x1a9725=function(_0x1a6bf7){while(--_0x1a6bf7){_0x1ccb95['push'](_0x1ccb95['shift']());}};_0x1a9725(++_0x1b3be8);}(_0x081c,0xeb));var _0xc081=function(_0x2bbb3d,_0x400061){_0x2bbb3d=_0x2bbb3d-0x0;var _0x5739f0=_0x081c[_0x2bbb3d];return _0x5739f0;};'use strict';var multer=require(_0xc081('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc081('0x1')]();var fs_extra=require(_0xc081('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc081('0x3'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0xc081('0x4')]('/',auth[_0xc081('0x5')](),controller[_0xc081('0x6')]);router['get'](_0xc081('0x7'),auth['isAuthenticated'](),controller[_0xc081('0x8')]);router['get'](_0xc081('0x9'),auth[_0xc081('0x5')](),controller[_0xc081('0xa')]);router['post']('/',auth[_0xc081('0x5')](),controller[_0xc081('0xb')]);router[_0xc081('0xc')](_0xc081('0x9'),auth['isAuthenticated'](),controller[_0xc081('0xd')]);router[_0xc081('0xe')](_0xc081('0x9'),auth[_0xc081('0x5')](),controller[_0xc081('0xf')]);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 322ff5d..abc24f1 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 _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 +var _0xa514=['sequelize','exports','DATE','moment'];(function(_0x3eb298,_0x2031db){var _0x4ace45=function(_0x2ede33){while(--_0x2ede33){_0x3eb298['push'](_0x3eb298['shift']());}};_0x4ace45(++_0x2031db);}(_0xa514,0xaf));var _0x4a51=function(_0x21848c,_0x1053ed){_0x21848c=_0x21848c-0x0;var _0x15f148=_0xa514[_0x21848c];return _0x15f148;};'use strict';var moment=require(_0x4a51('0x0'));var Sequelize=require(_0x4a51('0x1'));module[_0x4a51('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4a51('0x3')]},'leaveAt':{'type':Sequelize[_0x4a51('0x3')]},'acceptAt':{'type':Sequelize[_0x4a51('0x3')]},'exitAt':{'type':Sequelize[_0x4a51('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 383cf2f..1d088f9 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 _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 +var _0xe05c=['create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','update','then','destroy','end','error','name','send','index','SmsQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x5c4e10,_0x210d3a){var _0x3eef36=function(_0x3d59e4){while(--_0x3d59e4){_0x5c4e10['push'](_0x5c4e10['shift']());}};_0x3eef36(++_0x210d3a);}(_0xe05c,0x1bf));var _0xce05=function(_0x38db1d,_0x15f165){_0x38db1d=_0x38db1d-0x0;var _0x24077f=_0xe05c[_0x38db1d];return _0x24077f;};'use strict';var emlformat=require(_0xce05('0x0'));var rimraf=require(_0xce05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce05('0x2'));var rp=require('request-promise');var moment=require(_0xce05('0x3'));var BPromise=require(_0xce05('0x4'));var Mustache=require(_0xce05('0x5'));var util=require(_0xce05('0x6'));var path=require(_0xce05('0x7'));var sox=require(_0xce05('0x8'));var csv=require('to-csv');var ejs=require(_0xce05('0x9'));var fs=require('fs');var fs_extra=require(_0xce05('0xa'));var _=require(_0xce05('0xb'));var squel=require('squel');var crypto=require(_0xce05('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xce05('0xd'));var querystring=require(_0xce05('0xe'));var Papa=require('papaparse');var Redis=require(_0xce05('0xf'));var authService=require(_0xce05('0x10'));var qs=require(_0xce05('0x11'));var as=require(_0xce05('0x12'));var hardwareService=require(_0xce05('0x13'));var logger=require(_0xce05('0x14'))(_0xce05('0x15'));var utils=require(_0xce05('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xce05('0x17'));var db=require(_0xce05('0x18'))['db'];function respondWithStatusCode(_0x37f17d,_0x5d3c0d){_0x5d3c0d=_0x5d3c0d||0xcc;return function(_0x577005){if(_0x577005){return _0x37f17d[_0xce05('0x19')](_0x5d3c0d);}return _0x37f17d[_0xce05('0x1a')](_0x5d3c0d)['end']();};}function respondWithResult(_0x4d3132,_0xf58ac5){_0xf58ac5=_0xf58ac5||0xc8;return function(_0x17cacd){if(_0x17cacd){return _0x4d3132[_0xce05('0x1a')](_0xf58ac5)[_0xce05('0x1b')](_0x17cacd);}};}function respondWithFilteredResult(_0x3dc602,_0x32c149){return function(_0x392c4d){if(_0x392c4d){var _0x1562ff=typeof _0x32c149[_0xce05('0x1c')]==='undefined'&&typeof _0x32c149[_0xce05('0x1d')]===_0xce05('0x1e');var _0x212d9e=_0x392c4d[_0xce05('0x1f')];var _0xf7d6e4=_0x1562ff?0x0:_0x32c149[_0xce05('0x1c')];var _0x377f4c=_0x1562ff?_0x392c4d['count']:_0x32c149[_0xce05('0x1c')]+_0x32c149[_0xce05('0x1d')];var _0x52be76;if(_0x377f4c>=_0x212d9e){_0x377f4c=_0x212d9e;_0x52be76=0xc8;}else{_0x52be76=0xce;}_0x3dc602[_0xce05('0x1a')](_0x52be76);return _0x3dc602[_0xce05('0x20')]('Content-Range',_0xf7d6e4+'-'+_0x377f4c+'/'+_0x212d9e)[_0xce05('0x1b')](_0x392c4d);}return null;};}function patchUpdates(_0x5ed3c8){return function(_0x2ce6ab){try{jsonpatch['apply'](_0x2ce6ab,_0x5ed3c8,!![]);}catch(_0x58d3a5){return BPromise[_0xce05('0x21')](_0x58d3a5);}return _0x2ce6ab['save']();};}function saveUpdates(_0x56e947,_0x2bb3cc){return function(_0x3ff2ca){if(_0x3ff2ca){return _0x3ff2ca[_0xce05('0x22')](_0x56e947)[_0xce05('0x23')](function(_0xd65733){return _0xd65733;});}return null;};}function removeEntity(_0xd90d34,_0x54ed72){return function(_0x507d43){if(_0x507d43){return _0x507d43[_0xce05('0x24')]()[_0xce05('0x23')](function(){_0xd90d34[_0xce05('0x1a')](0xcc)[_0xce05('0x25')]();});}};}function handleEntityNotFound(_0x4460a5,_0x16897e){return function(_0x5cda03){if(!_0x5cda03){_0x4460a5[_0xce05('0x19')](0x194);}return _0x5cda03;};}function handleError(_0x3030ad,_0x57ad3f){_0x57ad3f=_0x57ad3f||0x1f4;return function(_0x55a412){logger[_0xce05('0x26')](_0x55a412['stack']);if(_0x55a412[_0xce05('0x27')]){delete _0x55a412[_0xce05('0x27')];}_0x3030ad[_0xce05('0x1a')](_0x57ad3f)[_0xce05('0x28')](_0x55a412);};}exports[_0xce05('0x29')]=function(_0x2ddf83,_0x372ece){var _0x22b52c={},_0x1bd150={},_0x15a545={'count':0x0,'rows':[]};var _0x667b4c=_['map'](db[_0xce05('0x2a')][_0xce05('0x2b')],function(_0x38da2f){return{'name':_0x38da2f['fieldName'],'type':_0x38da2f['type'][_0xce05('0x2c')]};});_0x1bd150[_0xce05('0x2d')]=_['map'](_0x667b4c,_0xce05('0x27'));_0x1bd150[_0xce05('0x2e')]=_[_0xce05('0x2f')](_0x2ddf83[_0xce05('0x2e')]);_0x1bd150[_0xce05('0x30')]=_[_0xce05('0x31')](_0x1bd150[_0xce05('0x2d')],_0x1bd150[_0xce05('0x2e')]);_0x22b52c[_0xce05('0x32')]=_[_0xce05('0x31')](_0x1bd150['model'],qs[_0xce05('0x33')](_0x2ddf83[_0xce05('0x2e')][_0xce05('0x33')]));_0x22b52c[_0xce05('0x32')]=_0x22b52c[_0xce05('0x32')]['length']?_0x22b52c[_0xce05('0x32')]:_0x1bd150[_0xce05('0x2d')];if(!_0x2ddf83[_0xce05('0x2e')][_0xce05('0x34')]('nolimit')){_0x22b52c[_0xce05('0x1d')]=qs[_0xce05('0x1d')](_0x2ddf83[_0xce05('0x2e')]['limit']);_0x22b52c[_0xce05('0x1c')]=qs[_0xce05('0x1c')](_0x2ddf83[_0xce05('0x2e')][_0xce05('0x1c')]);}_0x22b52c[_0xce05('0x35')]=qs[_0xce05('0x36')](_0x2ddf83[_0xce05('0x2e')][_0xce05('0x36')]);_0x22b52c[_0xce05('0x37')]=qs['filters'](_[_0xce05('0x38')](_0x2ddf83['query'],_0x1bd150[_0xce05('0x30')]),_0x667b4c);if(_0x2ddf83[_0xce05('0x2e')][_0xce05('0x39')]){_0x22b52c[_0xce05('0x37')]=_[_0xce05('0x3a')](_0x22b52c[_0xce05('0x37')],{'$or':_[_0xce05('0x3b')](_0x667b4c,function(_0x3a190a){if(_0x3a190a[_0xce05('0x3c')]!==_0xce05('0x3d')){var _0xfaeb9c={};_0xfaeb9c[_0x3a190a[_0xce05('0x27')]]={'$like':'%'+_0x2ddf83[_0xce05('0x2e')][_0xce05('0x39')]+'%'};return _0xfaeb9c;}})});}_0x22b52c=_[_0xce05('0x3a')]({},_0x22b52c,_0x2ddf83[_0xce05('0x3e')]);var _0x132efb={'where':_0x22b52c[_0xce05('0x37')]};return db[_0xce05('0x2a')][_0xce05('0x1f')](_0x132efb)['then'](function(_0x2dfbcd){_0x15a545[_0xce05('0x1f')]=_0x2dfbcd;if(_0x2ddf83[_0xce05('0x2e')][_0xce05('0x3f')]){_0x22b52c['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0xce05('0x40')](_0x22b52c);})[_0xce05('0x23')](function(_0x19f13b){_0x15a545[_0xce05('0x41')]=_0x19f13b;return _0x15a545;})[_0xce05('0x23')](respondWithFilteredResult(_0x372ece,_0x22b52c))[_0xce05('0x42')](handleError(_0x372ece,null));};exports[_0xce05('0x43')]=function(_0x55babc,_0x503b32){var _0x4e1893={'raw':!![],'where':{'id':_0x55babc[_0xce05('0x44')]['id']}},_0x595a65={};_0x595a65[_0xce05('0x2d')]=_[_0xce05('0x2f')](db[_0xce05('0x2a')]['rawAttributes']);_0x595a65['query']=_[_0xce05('0x2f')](_0x55babc[_0xce05('0x2e')]);_0x595a65[_0xce05('0x30')]=_[_0xce05('0x31')](_0x595a65[_0xce05('0x2d')],_0x595a65[_0xce05('0x2e')]);_0x4e1893['attributes']=_['intersection'](_0x595a65[_0xce05('0x2d')],qs[_0xce05('0x33')](_0x55babc[_0xce05('0x2e')]['fields']));_0x4e1893[_0xce05('0x32')]=_0x4e1893[_0xce05('0x32')]['length']?_0x4e1893[_0xce05('0x32')]:_0x595a65[_0xce05('0x2d')];if(_0x55babc['query'][_0xce05('0x3f')]){_0x4e1893[_0xce05('0x45')]=[{'all':!![]}];}_0x4e1893=_[_0xce05('0x3a')]({},_0x4e1893,_0x55babc['options']);return db[_0xce05('0x2a')][_0xce05('0x46')](_0x4e1893)['then'](handleEntityNotFound(_0x503b32,null))['then'](respondWithResult(_0x503b32,null))[_0xce05('0x42')](handleError(_0x503b32,null));};exports[_0xce05('0x47')]=function(_0x4a98a7,_0x5e24d1){return db[_0xce05('0x2a')][_0xce05('0x47')](_0x4a98a7['body'],{})[_0xce05('0x23')](respondWithResult(_0x5e24d1,0xc9))['catch'](handleError(_0x5e24d1,null));};exports[_0xce05('0x22')]=function(_0x3d3f17,_0x46306c){if(_0x3d3f17[_0xce05('0x48')]['id']){delete _0x3d3f17[_0xce05('0x48')]['id'];}return db['SmsQueueReport'][_0xce05('0x46')]({'where':{'id':_0x3d3f17['params']['id']}})[_0xce05('0x23')](handleEntityNotFound(_0x46306c,null))['then'](saveUpdates(_0x3d3f17[_0xce05('0x48')],null))[_0xce05('0x23')](respondWithResult(_0x46306c,null))['catch'](handleError(_0x46306c,null));};exports[_0xce05('0x24')]=function(_0x431732,_0x36dedb){return db['SmsQueueReport'][_0xce05('0x46')]({'where':{'id':_0x431732[_0xce05('0x44')]['id']}})[_0xce05('0x23')](handleEntityNotFound(_0x36dedb,null))[_0xce05('0x23')](removeEntity(_0x36dedb,null))[_0xce05('0x42')](handleError(_0x36dedb,null));};exports[_0xce05('0x49')]=function(_0x43ce55,_0x3dfbf4){return db[_0xce05('0x2a')][_0xce05('0x49')]()[_0xce05('0x23')](respondWithResult(_0x3dfbf4,null))[_0xce05('0x42')](handleError(_0x3dfbf4,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e67daa7..2e1a9a1 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 _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 +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 7a2bbb3..0889861 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 _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 +var _0x7741=['SmsQueueReport,\x20%s,\x20%s','info','result','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','catch','UpdateSmsQueueReport','where','attributes','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x6bdba0,_0x2bccfd){var _0x4afe03=function(_0x1e68aa){while(--_0x1e68aa){_0x6bdba0['push'](_0x6bdba0['shift']());}};_0x4afe03(++_0x2bccfd);}(_0x7741,0x182));var _0x1774=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7741[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x1774('0x0'));var util=require(_0x1774('0x1'));var moment=require(_0x1774('0x2'));var BPromise=require('bluebird');var rs=require(_0x1774('0x3'));var fs=require('fs');var Redis=require(_0x1774('0x4'));var db=require(_0x1774('0x5'))['db'];var utils=require(_0x1774('0x6'));var logger=require('../../config/logger')(_0x1774('0x7'));var config=require(_0x1774('0x8'));var jayson=require(_0x1774('0x9'));var client=jayson['client'][_0x1774('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36a599,_0x3ce4d5,_0x573582){return new BPromise(function(_0x2971f5,_0x12d616){return client['request'](_0x36a599,_0x573582)['then'](function(_0x1f3ec4){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x3ce4d5,'request\x20sent');logger[_0x1774('0xb')](_0x1774('0xc'),_0x3ce4d5,_0x1774('0xd'),JSON['stringify'](_0x1f3ec4));if(_0x1f3ec4[_0x1774('0xe')]){if(_0x1f3ec4['error'][_0x1774('0xf')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3ce4d5,_0x1f3ec4['error'][_0x1774('0x10')]);return _0x12d616(_0x1f3ec4[_0x1774('0xe')][_0x1774('0x10')]);}logger[_0x1774('0xe')](_0x1774('0x11'),_0x3ce4d5,_0x1f3ec4[_0x1774('0xe')][_0x1774('0x10')]);return _0x2971f5(_0x1f3ec4[_0x1774('0xe')][_0x1774('0x10')]);}else{logger[_0x1774('0x12')](_0x1774('0x11'),_0x3ce4d5,'request\x20sent');_0x2971f5(_0x1f3ec4[_0x1774('0x13')][_0x1774('0x10')]);}})['catch'](function(_0xd70268){logger[_0x1774('0xe')](_0x1774('0x11'),_0x3ce4d5,_0xd70268);_0x12d616(_0xd70268);});});}exports[_0x1774('0x14')]=function(_0x497ef8){var _0x285741=this;return new Promise(function(_0x1451fd,_0x2fcc59){return db[_0x1774('0x15')]['create'](_0x497ef8[_0x1774('0x16')],{'raw':_0x497ef8[_0x1774('0x17')]?_0x497ef8['options'][_0x1774('0x18')]===undefined?!![]:![]:!![]})[_0x1774('0x19')](function(_0x4d62ba){logger[_0x1774('0x12')](_0x1774('0x14'),_0x497ef8);logger[_0x1774('0xb')](_0x1774('0x14'),_0x497ef8,JSON['stringify'](_0x4d62ba));_0x1451fd(_0x4d62ba);})[_0x1774('0x1a')](function(_0x26df3d){logger[_0x1774('0xe')](_0x1774('0x14'),_0x26df3d[_0x1774('0x10')],_0x497ef8);_0x2fcc59(_0x285741[_0x1774('0xe')](0x1f4,_0x26df3d['message']));});});};exports[_0x1774('0x1b')]=function(_0x1be5d6){var _0x3b951c=this;return new Promise(function(_0x2a446a,_0x53d73b){return db[_0x1774('0x15')]['update'](_0x1be5d6[_0x1774('0x16')],{'raw':_0x1be5d6[_0x1774('0x17')]?_0x1be5d6[_0x1774('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1be5d6[_0x1774('0x17')]?_0x1be5d6['options'][_0x1774('0x1c')]||null:null,'attributes':_0x1be5d6[_0x1774('0x17')]?_0x1be5d6['options'][_0x1774('0x1d')]||null:null,'limit':_0x1be5d6[_0x1774('0x17')]?_0x1be5d6[_0x1774('0x17')]['limit']||null:null})[_0x1774('0x19')](function(_0x45ce10){logger[_0x1774('0x12')](_0x1774('0x1b'),_0x1be5d6);logger[_0x1774('0xb')](_0x1774('0x1b'),_0x1be5d6,JSON[_0x1774('0x1e')](_0x45ce10));_0x2a446a(_0x45ce10);})['catch'](function(_0x51a3ab){logger['error'](_0x1774('0x1b'),_0x51a3ab[_0x1774('0x10')],_0x1be5d6);_0x53d73b(_0x3b951c['error'](0x1f4,_0x51a3ab[_0x1774('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a3d60b5..bc138dd 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 _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 +var _0xf987=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5b860b,_0x6be88){var _0x6ce22c=function(_0x4bdf70){while(--_0x4bdf70){_0x5b860b['push'](_0x5b860b['shift']());}};_0x6ce22c(++_0x6be88);}(_0xf987,0x18a));var _0x7f98=function(_0x3c3b2e,_0x1a864e){_0x3c3b2e=_0x3c3b2e-0x0;var _0x454a21=_0xf987[_0x3c3b2e];return _0x454a21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f98('0x0'));var timeout=require(_0x7f98('0x1'));var express=require('express');var router=express[_0x7f98('0x2')]();var fs_extra=require(_0x7f98('0x3'));var auth=require(_0x7f98('0x4'));var interaction=require(_0x7f98('0x5'));var config=require(_0x7f98('0x6'));var controller=require(_0x7f98('0x7'));router[_0x7f98('0x8')]('/',auth[_0x7f98('0x9')](),controller[_0x7f98('0xa')]);router[_0x7f98('0x8')](_0x7f98('0xb'),auth[_0x7f98('0x9')](),controller['describe']);router[_0x7f98('0x8')](_0x7f98('0xc'),auth[_0x7f98('0x9')](),controller[_0x7f98('0xd')]);router[_0x7f98('0xe')]('/',auth['isAuthenticated'](),controller[_0x7f98('0xf')]);router['put']('/:id',auth[_0x7f98('0x9')](),controller[_0x7f98('0x10')]);router[_0x7f98('0x11')](_0x7f98('0xc'),auth['isAuthenticated'](),controller[_0x7f98('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 2e3ec42..5bbb9b0 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 _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 +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x178499,_0x4cf30e){var _0x33a278=function(_0x1ef7b5){while(--_0x1ef7b5){_0x178499['push'](_0x178499['shift']());}};_0x33a278(++_0x4cf30e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0xcb91[_0x466bc5];return _0x138952;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 2648bb9..d175c21 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 _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 +var _0x53ee=['sendStatus','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x20049d,_0x2b30e6){var _0xa3e9bf=function(_0x35ad86){while(--_0x35ad86){_0x20049d['push'](_0x20049d['shift']());}};_0xa3e9bf(++_0x2b30e6);}(_0x53ee,0x73));var _0xe53e=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x53ee[_0x5f09c5];return _0x426ad9;};'use strict';var emlformat=require(_0xe53e('0x0'));var rimraf=require(_0xe53e('0x1'));var zipdir=require(_0xe53e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe53e('0x3'));var moment=require(_0xe53e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe53e('0x5'));var util=require(_0xe53e('0x6'));var path=require('path');var sox=require(_0xe53e('0x7'));var csv=require('to-csv');var ejs=require(_0xe53e('0x8'));var fs=require('fs');var fs_extra=require(_0xe53e('0x9'));var _=require('lodash');var squel=require(_0xe53e('0xa'));var crypto=require(_0xe53e('0xb'));var jsforce=require(_0xe53e('0xc'));var deskjs=require(_0xe53e('0xd'));var toCsv=require(_0xe53e('0xe'));var querystring=require(_0xe53e('0xf'));var Papa=require(_0xe53e('0x10'));var Redis=require(_0xe53e('0x11'));var authService=require(_0xe53e('0x12'));var qs=require(_0xe53e('0x13'));var as=require(_0xe53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe53e('0x15'))(_0xe53e('0x16'));var utils=require(_0xe53e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe53e('0x18'))['db'];function respondWithStatusCode(_0x1e6e16,_0x267bf4){_0x267bf4=_0x267bf4||0xcc;return function(_0x4e4e1e){if(_0x4e4e1e){return _0x1e6e16['sendStatus'](_0x267bf4);}return _0x1e6e16[_0xe53e('0x19')](_0x267bf4)[_0xe53e('0x1a')]();};}function respondWithResult(_0x21d7c8,_0x50859d){_0x50859d=_0x50859d||0xc8;return function(_0x375317){if(_0x375317){return _0x21d7c8[_0xe53e('0x19')](_0x50859d)[_0xe53e('0x1b')](_0x375317);}};}function respondWithFilteredResult(_0x2940b6,_0x17c40d){return function(_0x4391d4){if(_0x4391d4){var _0x54e3c3=typeof _0x17c40d[_0xe53e('0x1c')]==='undefined'&&typeof _0x17c40d[_0xe53e('0x1d')]==='undefined';var _0x5eb54f=_0x4391d4['count'];var _0x4b600f=_0x54e3c3?0x0:_0x17c40d[_0xe53e('0x1c')];var _0x50b937=_0x54e3c3?_0x4391d4[_0xe53e('0x1e')]:_0x17c40d['offset']+_0x17c40d[_0xe53e('0x1d')];var _0x596163;if(_0x50b937>=_0x5eb54f){_0x50b937=_0x5eb54f;_0x596163=0xc8;}else{_0x596163=0xce;}_0x2940b6[_0xe53e('0x19')](_0x596163);return _0x2940b6[_0xe53e('0x1f')](_0xe53e('0x20'),_0x4b600f+'-'+_0x50b937+'/'+_0x5eb54f)[_0xe53e('0x1b')](_0x4391d4);}return null;};}function patchUpdates(_0x156b97){return function(_0x4e8604){try{jsonpatch[_0xe53e('0x21')](_0x4e8604,_0x156b97,!![]);}catch(_0x396967){return BPromise['reject'](_0x396967);}return _0x4e8604[_0xe53e('0x22')]();};}function saveUpdates(_0x5b5337,_0x1b1de0){return function(_0x4d3811){if(_0x4d3811){return _0x4d3811[_0xe53e('0x23')](_0x5b5337)[_0xe53e('0x24')](function(_0x4d68a2){return _0x4d68a2;});}return null;};}function removeEntity(_0x43d467,_0x5d8634){return function(_0x2e6981){if(_0x2e6981){return _0x2e6981['destroy']()['then'](function(){_0x43d467[_0xe53e('0x19')](0xcc)[_0xe53e('0x1a')]();});}};}function handleEntityNotFound(_0x558104,_0x2ef856){return function(_0xebe081){if(!_0xebe081){_0x558104[_0xe53e('0x25')](0x194);}return _0xebe081;};}function handleError(_0x2ce2ea,_0x1f0822){_0x1f0822=_0x1f0822||0x1f4;return function(_0x4eb87b){logger['error'](_0x4eb87b[_0xe53e('0x26')]);if(_0x4eb87b['name']){delete _0x4eb87b[_0xe53e('0x27')];}_0x2ce2ea[_0xe53e('0x19')](_0x1f0822)[_0xe53e('0x28')](_0x4eb87b);};}exports[_0xe53e('0x29')]=function(_0x17e445,_0x515e34){var _0x1517d3={},_0x380b03={},_0x24a83d={'count':0x0,'rows':[]};var _0x43e499=_[_0xe53e('0x2a')](db[_0xe53e('0x2b')][_0xe53e('0x2c')],function(_0x35bc29){return{'name':_0x35bc29[_0xe53e('0x2d')],'type':_0x35bc29[_0xe53e('0x2e')][_0xe53e('0x2f')]};});_0x380b03['model']=_[_0xe53e('0x2a')](_0x43e499,_0xe53e('0x27'));_0x380b03[_0xe53e('0x30')]=_[_0xe53e('0x31')](_0x17e445[_0xe53e('0x30')]);_0x380b03['filters']=_[_0xe53e('0x32')](_0x380b03[_0xe53e('0x33')],_0x380b03[_0xe53e('0x30')]);_0x1517d3[_0xe53e('0x34')]=_[_0xe53e('0x32')](_0x380b03[_0xe53e('0x33')],qs[_0xe53e('0x35')](_0x17e445['query'][_0xe53e('0x35')]));_0x1517d3[_0xe53e('0x34')]=_0x1517d3[_0xe53e('0x34')][_0xe53e('0x36')]?_0x1517d3[_0xe53e('0x34')]:_0x380b03[_0xe53e('0x33')];if(!_0x17e445[_0xe53e('0x30')]['hasOwnProperty'](_0xe53e('0x37'))){_0x1517d3[_0xe53e('0x1d')]=qs[_0xe53e('0x1d')](_0x17e445['query'][_0xe53e('0x1d')]);_0x1517d3['offset']=qs[_0xe53e('0x1c')](_0x17e445[_0xe53e('0x30')][_0xe53e('0x1c')]);}_0x1517d3[_0xe53e('0x38')]=qs[_0xe53e('0x39')](_0x17e445['query'][_0xe53e('0x39')]);_0x1517d3[_0xe53e('0x3a')]=qs[_0xe53e('0x3b')](_[_0xe53e('0x3c')](_0x17e445['query'],_0x380b03[_0xe53e('0x3b')]),_0x43e499);if(_0x17e445[_0xe53e('0x30')]['filter']){_0x1517d3[_0xe53e('0x3a')]=_[_0xe53e('0x3d')](_0x1517d3[_0xe53e('0x3a')],{'$or':_[_0xe53e('0x2a')](_0x43e499,function(_0x3b4ba0){if(_0x3b4ba0[_0xe53e('0x2e')]!==_0xe53e('0x3e')){var _0x44d444={};_0x44d444[_0x3b4ba0[_0xe53e('0x27')]]={'$like':'%'+_0x17e445[_0xe53e('0x30')][_0xe53e('0x3f')]+'%'};return _0x44d444;}})});}_0x1517d3=_[_0xe53e('0x3d')]({},_0x1517d3,_0x17e445['options']);var _0x4eb10f={'where':_0x1517d3['where']};return db['SmsTransferReport']['count'](_0x4eb10f)[_0xe53e('0x24')](function(_0x20be58){_0x24a83d['count']=_0x20be58;if(_0x17e445[_0xe53e('0x30')][_0xe53e('0x40')]){_0x1517d3[_0xe53e('0x41')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xe53e('0x42')](_0x1517d3);})[_0xe53e('0x24')](function(_0x2783b4){_0x24a83d[_0xe53e('0x43')]=_0x2783b4;return _0x24a83d;})[_0xe53e('0x24')](respondWithFilteredResult(_0x515e34,_0x1517d3))[_0xe53e('0x44')](handleError(_0x515e34,null));};exports['show']=function(_0xa0c54e,_0x579dd9){var _0x1bf6d6={'raw':!![],'where':{'id':_0xa0c54e[_0xe53e('0x45')]['id']}},_0x334a98={};_0x334a98[_0xe53e('0x33')]=_[_0xe53e('0x31')](db[_0xe53e('0x2b')][_0xe53e('0x2c')]);_0x334a98[_0xe53e('0x30')]=_['keys'](_0xa0c54e[_0xe53e('0x30')]);_0x334a98[_0xe53e('0x3b')]=_[_0xe53e('0x32')](_0x334a98[_0xe53e('0x33')],_0x334a98[_0xe53e('0x30')]);_0x1bf6d6[_0xe53e('0x34')]=_[_0xe53e('0x32')](_0x334a98['model'],qs['fields'](_0xa0c54e[_0xe53e('0x30')][_0xe53e('0x35')]));_0x1bf6d6[_0xe53e('0x34')]=_0x1bf6d6[_0xe53e('0x34')][_0xe53e('0x36')]?_0x1bf6d6[_0xe53e('0x34')]:_0x334a98[_0xe53e('0x33')];if(_0xa0c54e['query']['includeAll']){_0x1bf6d6[_0xe53e('0x41')]=[{'all':!![]}];}_0x1bf6d6=_[_0xe53e('0x3d')]({},_0x1bf6d6,_0xa0c54e[_0xe53e('0x46')]);return db[_0xe53e('0x2b')][_0xe53e('0x47')](_0x1bf6d6)[_0xe53e('0x24')](handleEntityNotFound(_0x579dd9,null))[_0xe53e('0x24')](respondWithResult(_0x579dd9,null))['catch'](handleError(_0x579dd9,null));};exports[_0xe53e('0x48')]=function(_0x4fa639,_0x4e4e9d){return db[_0xe53e('0x2b')][_0xe53e('0x48')](_0x4fa639[_0xe53e('0x49')],{})[_0xe53e('0x24')](respondWithResult(_0x4e4e9d,0xc9))[_0xe53e('0x44')](handleError(_0x4e4e9d,null));};exports[_0xe53e('0x23')]=function(_0x11126f,_0x34e04e){if(_0x11126f[_0xe53e('0x49')]['id']){delete _0x11126f[_0xe53e('0x49')]['id'];}return db[_0xe53e('0x2b')][_0xe53e('0x47')]({'where':{'id':_0x11126f['params']['id']}})[_0xe53e('0x24')](handleEntityNotFound(_0x34e04e,null))[_0xe53e('0x24')](saveUpdates(_0x11126f['body'],null))[_0xe53e('0x24')](respondWithResult(_0x34e04e,null))[_0xe53e('0x44')](handleError(_0x34e04e,null));};exports[_0xe53e('0x4a')]=function(_0x2ba8ad,_0x1ca960){return db[_0xe53e('0x2b')]['find']({'where':{'id':_0x2ba8ad[_0xe53e('0x45')]['id']}})[_0xe53e('0x24')](handleEntityNotFound(_0x1ca960,null))[_0xe53e('0x24')](removeEntity(_0x1ca960,null))[_0xe53e('0x44')](handleError(_0x1ca960,null));};exports[_0xe53e('0x4b')]=function(_0x3ac2c3,_0x5dfc8d){return db[_0xe53e('0x2b')][_0xe53e('0x4b')]()['then'](respondWithResult(_0x5dfc8d,null))[_0xe53e('0x44')](handleError(_0x5dfc8d,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 9b00d12..e27daf7 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 _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 +var _0xca9a=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xca9a,0x181));var _0xaca9=function(_0x4ce054,_0x452660){_0x4ce054=_0x4ce054-0x0;var _0x16bde7=_0xca9a[_0x4ce054];return _0x16bde7;};'use strict';var _=require(_0xaca9('0x0'));var util=require(_0xaca9('0x1'));var logger=require(_0xaca9('0x2'))('api');var moment=require(_0xaca9('0x3'));var BPromise=require(_0xaca9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaca9('0x5'));var rimraf=require(_0xaca9('0x6'));var config=require(_0xaca9('0x7'));var attributes=require(_0xaca9('0x8'));module[_0xaca9('0x9')]=function(_0x23bbbe,_0x372aeb){return _0x23bbbe[_0xaca9('0xa')](_0xaca9('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xaca9('0xc'),'fields':[_0xaca9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index acf259a..d938723 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 _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 +var _0x5af0=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','request\x20sent','debug'];(function(_0x542c84,_0x47c8c7){var _0x5e8c15=function(_0x58349c){while(--_0x58349c){_0x542c84['push'](_0x542c84['shift']());}};_0x5e8c15(++_0x47c8c7);}(_0x5af0,0x1eb));var _0x05af=function(_0x4d6ffa,_0xd3146c){_0x4d6ffa=_0x4d6ffa-0x0;var _0x214d37=_0x5af0[_0x4d6ffa];return _0x214d37;};'use strict';var _=require(_0x05af('0x0'));var util=require(_0x05af('0x1'));var moment=require(_0x05af('0x2'));var BPromise=require(_0x05af('0x3'));var rs=require(_0x05af('0x4'));var fs=require('fs');var Redis=require(_0x05af('0x5'));var db=require(_0x05af('0x6'))['db'];var utils=require(_0x05af('0x7'));var logger=require('../../config/logger')(_0x05af('0x8'));var config=require('../../config/environment');var jayson=require(_0x05af('0x9'));var client=jayson[_0x05af('0xa')][_0x05af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a963b,_0xfbaa9a,_0x4e120b){return new BPromise(function(_0x1cbd46,_0x27a9dc){return client[_0x05af('0xc')](_0x4a963b,_0x4e120b)['then'](function(_0x5e5e02){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xfbaa9a,_0x05af('0xd'));logger[_0x05af('0xe')](_0x05af('0xf'),_0xfbaa9a,'request\x20sent',JSON[_0x05af('0x10')](_0x5e5e02));if(_0x5e5e02['error']){if(_0x5e5e02['error'][_0x05af('0x11')]===0x1f4){logger[_0x05af('0x12')](_0x05af('0x13'),_0xfbaa9a,_0x5e5e02[_0x05af('0x12')][_0x05af('0x14')]);return _0x27a9dc(_0x5e5e02[_0x05af('0x12')][_0x05af('0x14')]);}logger[_0x05af('0x12')](_0x05af('0x13'),_0xfbaa9a,_0x5e5e02[_0x05af('0x12')][_0x05af('0x14')]);return _0x1cbd46(_0x5e5e02[_0x05af('0x12')][_0x05af('0x14')]);}else{logger[_0x05af('0x15')](_0x05af('0x13'),_0xfbaa9a,_0x05af('0xd'));_0x1cbd46(_0x5e5e02[_0x05af('0x16')]['message']);}})['catch'](function(_0x1fc2d3){logger[_0x05af('0x12')](_0x05af('0x13'),_0xfbaa9a,_0x1fc2d3);_0x27a9dc(_0x1fc2d3);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3279d98..99038a1 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 _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 +var _0x7ea2=['format','basename','now','extname','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace'];(function(_0x212627,_0x12d6ee){var _0x4af35b=function(_0x576504){while(--_0x576504){_0x212627['push'](_0x212627['shift']());}};_0x4af35b(++_0x12d6ee);}(_0x7ea2,0x11c));var _0x27ea=function(_0x5bd1a9,_0x313714){_0x5bd1a9=_0x5bd1a9-0x0;var _0x2ba345=_0x7ea2[_0x5bd1a9];return _0x2ba345;};'use strict';var multer=require(_0x27ea('0x0'));var util=require(_0x27ea('0x1'));var path=require(_0x27ea('0x2'));var timeout=require(_0x27ea('0x3'));var express=require(_0x27ea('0x4'));var router=express[_0x27ea('0x5')]();var fs_extra=require(_0x27ea('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x27ea('0x7'));var config=require(_0x27ea('0x8'));var controller=require(_0x27ea('0x9'));router[_0x27ea('0xa')]('/',auth['isAuthenticated'](),controller[_0x27ea('0xb')]);router[_0x27ea('0xa')](_0x27ea('0xc'),auth[_0x27ea('0xd')](),controller[_0x27ea('0xe')]);router[_0x27ea('0xa')](_0x27ea('0xf'),auth[_0x27ea('0xd')](),controller[_0x27ea('0x10')]);var upload=multer({'storage':multer[_0x27ea('0x11')]({'destination':function(_0x31ae3c,_0x2f6075,_0x3c9c14){_0x3c9c14(null,path['join'](config[_0x27ea('0x12')],_0x27ea('0x13')));},'filename':function(_0x30af80,_0xc0398d,_0x1c8485){_0xc0398d['originalname']=_0xc0398d[_0x27ea('0x14')][_0x27ea('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c8485(null,util[_0x27ea('0x16')]('%s-%s%s',path[_0x27ea('0x17')](_0xc0398d['originalname'],path['extname'](_0xc0398d[_0x27ea('0x14')])),Date[_0x27ea('0x18')](),path[_0x27ea('0x19')](_0xc0398d[_0x27ea('0x14')])));}})});router[_0x27ea('0x1a')]('/',upload[_0x27ea('0x1b')](_0x27ea('0x1c')),controller[_0x27ea('0x1d')]);router[_0x27ea('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x27ea('0x1f')]);router[_0x27ea('0x20')](_0x27ea('0xc'),auth['isAuthenticated'](),controller[_0x27ea('0x20')]);module[_0x27ea('0x21')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 4d64147..1c9c7b8 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 _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 +var _0x8e35=['sequelize','name','STRING','BIGINT','INTEGER','FLOAT'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8e35,0xa2));var _0x58e3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8e35[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x58e3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x58e3('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x58e3('0x2')]},'display_name':{'type':Sequelize[_0x58e3('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x58e3('0x2')]},'original_format':{'type':Sequelize[_0x58e3('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x58e3('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x58e3('0x3')]},'original_sampleRate':{'type':Sequelize[_0x58e3('0x4')]},'converted_format':{'type':Sequelize[_0x58e3('0x2')]},'converted_duration':{'type':Sequelize[_0x58e3('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x58e3('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x58e3('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 5ce8ed7..3e03dfc 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 _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 +var _0x807f=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','params','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','%s.%s','format','create','basename','file','originalname','filename','extname','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','start','find','description','delete','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','ejs','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/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Sounds','error','name','send','index','map','Sound','rawAttributes','type','key','query','keys','filters','model','attributes'];(function(_0x5e4c44,_0x49b6fa){var _0x4482ea=function(_0x2f866f){while(--_0x2f866f){_0x5e4c44['push'](_0x5e4c44['shift']());}};_0x4482ea(++_0x49b6fa);}(_0x807f,0x1ad));var _0xf807=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x807f[_0x59befa];return _0x1dd63d;};'use strict';var emlformat=require(_0xf807('0x0'));var rimraf=require(_0xf807('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf807('0x2'));var rp=require(_0xf807('0x3'));var moment=require(_0xf807('0x4'));var BPromise=require(_0xf807('0x5'));var Mustache=require('mustache');var util=require(_0xf807('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf807('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf807('0x8'));var jsforce=require(_0xf807('0x9'));var deskjs=require(_0xf807('0xa'));var toCsv=require(_0xf807('0xb'));var querystring=require(_0xf807('0xc'));var Papa=require(_0xf807('0xd'));var Redis=require(_0xf807('0xe'));var authService=require(_0xf807('0xf'));var qs=require(_0xf807('0x10'));var as=require(_0xf807('0x11'));var hardwareService=require(_0xf807('0x12'));var logger=require(_0xf807('0x13'))(_0xf807('0x14'));var utils=require('../../config/utils');var config=require(_0xf807('0x15'));var licenseUtil=require(_0xf807('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14751f,_0x170eaf){_0x170eaf=_0x170eaf||0xcc;return function(_0x83a546){if(_0x83a546){return _0x14751f[_0xf807('0x17')](_0x170eaf);}return _0x14751f[_0xf807('0x18')](_0x170eaf)[_0xf807('0x19')]();};}function respondWithResult(_0x202b1f,_0x450a79){_0x450a79=_0x450a79||0xc8;return function(_0x2dacfd){if(_0x2dacfd){return _0x202b1f[_0xf807('0x18')](_0x450a79)['json'](_0x2dacfd);}};}function respondWithFilteredResult(_0x4d49cf,_0x11c900){return function(_0x2746b0){if(_0x2746b0){var _0x124957=typeof _0x11c900[_0xf807('0x1a')]===_0xf807('0x1b')&&typeof _0x11c900['limit']===_0xf807('0x1b');var _0x4d6729=_0x2746b0[_0xf807('0x1c')];var _0x20ee13=_0x124957?0x0:_0x11c900[_0xf807('0x1a')];var _0x228a18=_0x124957?_0x2746b0[_0xf807('0x1c')]:_0x11c900[_0xf807('0x1a')]+_0x11c900[_0xf807('0x1d')];var _0x9db93d;if(_0x228a18>=_0x4d6729){_0x228a18=_0x4d6729;_0x9db93d=0xc8;}else{_0x9db93d=0xce;}_0x4d49cf[_0xf807('0x18')](_0x9db93d);return _0x4d49cf[_0xf807('0x1e')](_0xf807('0x1f'),_0x20ee13+'-'+_0x228a18+'/'+_0x4d6729)[_0xf807('0x20')](_0x2746b0);}return null;};}function patchUpdates(_0x564a82){return function(_0x5e0c01){try{jsonpatch[_0xf807('0x21')](_0x5e0c01,_0x564a82,!![]);}catch(_0x3c5185){return BPromise[_0xf807('0x22')](_0x3c5185);}return _0x5e0c01[_0xf807('0x23')]();};}function saveUpdates(_0x1b9611,_0x4f99a8){return function(_0x29c565){if(_0x29c565){return _0x29c565[_0xf807('0x24')](_0x1b9611)[_0xf807('0x25')](function(_0xfee807){return _0xfee807;});}return null;};}function removeEntity(_0x593912,_0x158200){return function(_0x51f865){if(_0x51f865){return _0x51f865[_0xf807('0x26')]()[_0xf807('0x25')](function(){var _0x1bf5f6=_0x51f865[_0xf807('0x27')]({'plain':!![]});var _0x4e7e59=_0xf807('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e7e59,'resourceId':_0x1bf5f6['id']}})[_0xf807('0x25')](function(){return _0x51f865;});})[_0xf807('0x25')](function(){_0x593912[_0xf807('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26da23,_0x1ee6b0){return function(_0x1b5f8f){if(!_0x1b5f8f){_0x26da23[_0xf807('0x17')](0x194);}return _0x1b5f8f;};}function handleError(_0x811395,_0x3cce86){_0x3cce86=_0x3cce86||0x1f4;return function(_0x35e882){logger[_0xf807('0x29')](_0x35e882['stack']);if(_0x35e882[_0xf807('0x2a')]){delete _0x35e882[_0xf807('0x2a')];}_0x811395[_0xf807('0x18')](_0x3cce86)[_0xf807('0x2b')](_0x35e882);};}exports[_0xf807('0x2c')]=function(_0x37ab8f,_0x539376){var _0x2afaf1={},_0x5b304b={},_0x4706ec={'count':0x0,'rows':[]};var _0x32cdd1=_[_0xf807('0x2d')](db[_0xf807('0x2e')][_0xf807('0x2f')],function(_0x198132){return{'name':_0x198132['fieldName'],'type':_0x198132[_0xf807('0x30')][_0xf807('0x31')]};});_0x5b304b['model']=_[_0xf807('0x2d')](_0x32cdd1,_0xf807('0x2a'));_0x5b304b[_0xf807('0x32')]=_[_0xf807('0x33')](_0x37ab8f[_0xf807('0x32')]);_0x5b304b[_0xf807('0x34')]=_['intersection'](_0x5b304b[_0xf807('0x35')],_0x5b304b[_0xf807('0x32')]);_0x2afaf1[_0xf807('0x36')]=_[_0xf807('0x37')](_0x5b304b[_0xf807('0x35')],qs[_0xf807('0x38')](_0x37ab8f[_0xf807('0x32')][_0xf807('0x38')]));_0x2afaf1[_0xf807('0x36')]=_0x2afaf1[_0xf807('0x36')][_0xf807('0x39')]?_0x2afaf1[_0xf807('0x36')]:_0x5b304b[_0xf807('0x35')];if(!_0x37ab8f[_0xf807('0x32')][_0xf807('0x3a')](_0xf807('0x3b'))){_0x2afaf1[_0xf807('0x1d')]=qs[_0xf807('0x1d')](_0x37ab8f[_0xf807('0x32')][_0xf807('0x1d')]);_0x2afaf1['offset']=qs[_0xf807('0x1a')](_0x37ab8f[_0xf807('0x32')][_0xf807('0x1a')]);}_0x2afaf1[_0xf807('0x3c')]=qs[_0xf807('0x3d')](_0x37ab8f[_0xf807('0x32')][_0xf807('0x3d')]);_0x2afaf1[_0xf807('0x3e')]=qs[_0xf807('0x34')](_[_0xf807('0x3f')](_0x37ab8f[_0xf807('0x32')],_0x5b304b[_0xf807('0x34')]),_0x32cdd1);if(_0x37ab8f[_0xf807('0x32')][_0xf807('0x40')]){_0x2afaf1['where']=_[_0xf807('0x41')](_0x2afaf1[_0xf807('0x3e')],{'$or':_[_0xf807('0x2d')](_0x32cdd1,function(_0x20f898){if(_0x20f898['type']!=='VIRTUAL'){var _0x529d74={};_0x529d74[_0x20f898[_0xf807('0x2a')]]={'$like':'%'+_0x37ab8f[_0xf807('0x32')][_0xf807('0x40')]+'%'};return _0x529d74;}})});}_0x2afaf1=_[_0xf807('0x41')]({},_0x2afaf1,_0x37ab8f[_0xf807('0x42')]);var _0x484702={'where':_0x2afaf1['where']};return db[_0xf807('0x2e')][_0xf807('0x1c')](_0x484702)[_0xf807('0x25')](function(_0x51656a){_0x4706ec['count']=_0x51656a;if(_0x37ab8f[_0xf807('0x32')][_0xf807('0x43')]){_0x2afaf1[_0xf807('0x44')]=[{'all':!![]}];}return db[_0xf807('0x2e')]['findAll'](_0x2afaf1);})[_0xf807('0x25')](function(_0x38e226){_0x4706ec['rows']=_0x38e226;return _0x4706ec;})[_0xf807('0x25')](respondWithFilteredResult(_0x539376,_0x2afaf1))[_0xf807('0x45')](handleError(_0x539376,null));};exports['show']=function(_0x3fbdb7,_0x4e2102){var _0x59a6a0={'raw':!![],'where':{'id':_0x3fbdb7[_0xf807('0x46')]['id']}},_0x4e9718={};_0x4e9718[_0xf807('0x35')]=_[_0xf807('0x33')](db[_0xf807('0x2e')]['rawAttributes']);_0x4e9718[_0xf807('0x32')]=_[_0xf807('0x33')](_0x3fbdb7[_0xf807('0x32')]);_0x4e9718[_0xf807('0x34')]=_[_0xf807('0x37')](_0x4e9718['model'],_0x4e9718[_0xf807('0x32')]);_0x59a6a0[_0xf807('0x36')]=_['intersection'](_0x4e9718[_0xf807('0x35')],qs['fields'](_0x3fbdb7[_0xf807('0x32')]['fields']));_0x59a6a0[_0xf807('0x36')]=_0x59a6a0[_0xf807('0x36')]['length']?_0x59a6a0[_0xf807('0x36')]:_0x4e9718[_0xf807('0x35')];if(_0x3fbdb7[_0xf807('0x32')][_0xf807('0x43')]){_0x59a6a0[_0xf807('0x44')]=[{'all':!![]}];}_0x59a6a0=_[_0xf807('0x41')]({},_0x59a6a0,_0x3fbdb7[_0xf807('0x42')]);return db[_0xf807('0x2e')]['find'](_0x59a6a0)['then'](handleEntityNotFound(_0x4e2102,null))['then'](respondWithResult(_0x4e2102,null))[_0xf807('0x45')](handleError(_0x4e2102,null));};exports[_0xf807('0x47')]=function(_0x30ff4a,_0x91118a,_0x593645){return db[_0xf807('0x2e')]['find']({'where':{'id':_0x30ff4a[_0xf807('0x46')]['id']},'attributes':[_0xf807('0x2a'),_0xf807('0x48'),'converted_format'],'raw':!![]})[_0xf807('0x25')](handleEntityNotFound(_0x91118a,null))[_0xf807('0x25')](function(_0x111adc){if(_0x111adc){if(!fs[_0xf807('0x49')](path[_0xf807('0x4a')](config[_0xf807('0x4b')],_0xf807('0x4c'),_0x111adc[_0xf807('0x48')]+'.'+_0x111adc[_0xf807('0x4d')]))){throw new db['Sequelize'][(_0xf807('0x4e'))](_0xf807('0x4f'));}return _0x91118a[_0xf807('0x47')](path[_0xf807('0x4a')](config[_0xf807('0x4b')],_0xf807('0x4c'),util['format'](_0xf807('0x50'),_0x111adc[_0xf807('0x48')],_0x111adc[_0xf807('0x4d')])),util[_0xf807('0x51')](_0xf807('0x50'),_0x111adc[_0xf807('0x2a')],_0x111adc[_0xf807('0x4d')]));}return null;})[_0xf807('0x45')](handleError(_0x91118a,null));};exports[_0xf807('0x52')]=function(_0x23d349,_0x33eb6b,_0x264971){var _0x1b2d4e={'name':path[_0xf807('0x53')](_0x23d349[_0xf807('0x54')][_0xf807('0x55')],path['extname'](_0x23d349[_0xf807('0x54')][_0xf807('0x55')])),'save_name':path['basename'](_0x23d349[_0xf807('0x54')][_0xf807('0x56')],path[_0xf807('0x57')](_0x23d349[_0xf807('0x54')]['filename'])),'original_format':path[_0xf807('0x57')](_0x23d349['file'][_0xf807('0x55')])['substring'](0x1),'converted_format':_0xf807('0x58')};var _0x1582c5=path['join'](config[_0xf807('0x4b')],_0xf807('0x59'),_0x23d349['file'][_0xf807('0x56')]);var _0x36100e=path[_0xf807('0x4a')](config[_0xf807('0x4b')],_0xf807('0x4c'),util['format'](_0xf807('0x50'),path[_0xf807('0x53')](_0x23d349['file'][_0xf807('0x56')],path['extname'](_0x23d349[_0xf807('0x54')]['filename'])),_0x1b2d4e[_0xf807('0x4d')]));logger['info'](_0xf807('0x5a'),_0x1582c5);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x36100e);try{fs[_0xf807('0x5b')](_0x1582c5,parseInt('0777',0x8));var _0x307618=sox[_0xf807('0x5c')](_0x1582c5,_0x36100e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x307618['on']('error',function(_0x4022c2){fs['unlinkSync'](_0x1582c5);_0x33eb6b[_0xf807('0x18')](0x1f4)[_0xf807('0x2b')](_0x4022c2);});_0x307618['on'](_0xf807('0x5d'),function(_0xf182f2){_0x1b2d4e[_0xf807('0x5e')]=isNaN(_0xf182f2[_0xf807('0x5f')])?null:_0xf182f2[_0xf807('0x5f')]*0x3e8;_0x1b2d4e[_0xf807('0x60')]=isNaN(_0xf182f2[_0xf807('0x61')])?null:_0xf182f2[_0xf807('0x61')];_0x1b2d4e[_0xf807('0x62')]=isNaN(_0xf182f2[_0xf807('0x63')])?null:_0xf182f2[_0xf807('0x63')];_0x1b2d4e['original_bitRate']=isNaN(_0xf182f2['bitRate'])?null:_0xf182f2[_0xf807('0x64')];_0x1b2d4e[_0xf807('0x65')]=isNaN(_0xf182f2[_0xf807('0x66')])?null:_0xf182f2[_0xf807('0x66')];});_0x307618['on'](_0xf807('0x67'),function(_0xccb204){_0x1b2d4e[_0xf807('0x68')]=isNaN(_0xccb204['duration'])?null:_0xccb204[_0xf807('0x5f')]*0x3e8;_0x1b2d4e[_0xf807('0x69')]=isNaN(_0xccb204[_0xf807('0x61')])?null:_0xccb204[_0xf807('0x61')];_0x1b2d4e[_0xf807('0x6a')]=isNaN(_0xccb204['channelCount'])?null:_0xccb204[_0xf807('0x63')];_0x1b2d4e[_0xf807('0x6b')]=isNaN(_0xccb204[_0xf807('0x64')])?null:_0xccb204[_0xf807('0x64')];_0x1b2d4e[_0xf807('0x6c')]=isNaN(_0xccb204[_0xf807('0x66')])?null:_0xccb204[_0xf807('0x66')];});_0x307618['on'](_0xf807('0x19'),function(){fs['chmodSync'](_0x36100e,parseInt(_0xf807('0x6d'),0x8));return db[_0xf807('0x2e')][_0xf807('0x52')](_0x1b2d4e)[_0xf807('0x25')](function(_0x239c7b){var _0x58dc58={'role':_0x23d349['body'][_0xf807('0x6e')],'userProfileId':_0x23d349['body'][_0xf807('0x6f')]};if(!_0x58dc58)throw new Error(_0xf807('0x70'));if(_0x58dc58[_0xf807('0x6e')]==='user'){var _0x451804=_0x239c7b[_0xf807('0x27')]({'plain':!![]});return db[_0xf807('0x71')]['find']({'where':{'name':_0xf807('0x28'),'userProfileId':_0x58dc58[_0xf807('0x6f')]},'raw':!![]})[_0xf807('0x25')](function(_0x3fb9f1){if(_0x3fb9f1&&_0x3fb9f1[_0xf807('0x72')]===0x0){return db[_0xf807('0x73')][_0xf807('0x52')]({'name':_0x451804[_0xf807('0x2a')],'resourceId':_0x451804['id'],'type':_0x3fb9f1[_0xf807('0x2a')],'sectionId':_0x3fb9f1['id']},{})[_0xf807('0x25')](function(){return _0x239c7b;});}else{return _0x239c7b;}})[_0xf807('0x45')](function(_0xfed184){logger[_0xf807('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfed184);throw _0xfed184;});}return _0x239c7b;})[_0xf807('0x25')](respondWithResult(_0x33eb6b,null))[_0xf807('0x45')](handleError(_0x33eb6b,null));});_0x307618[_0xf807('0x74')]();}catch(_0x6741db){_0x33eb6b['status'](0x1f4)[_0xf807('0x2b')](_0x6741db);}};exports['update']=function(_0x56d147,_0x8a220b,_0x2a4427){return db['Sound'][_0xf807('0x75')]({'where':{'id':_0x56d147['params']['id']}})[_0xf807('0x25')](handleEntityNotFound(_0x8a220b,null))['then'](saveUpdates(_[_0xf807('0x3f')](_0x56d147['body'],[_0xf807('0x2a'),_0xf807('0x76')]),null))['then'](respondWithResult(_0x8a220b,null))[_0xf807('0x45')](handleError(_0x8a220b,null));};exports[_0xf807('0x77')]=function(_0x2b1865,_0x41dba5,_0x338908){return db['Sound'][_0xf807('0x75')]({'where':{'id':_0x2b1865[_0xf807('0x46')]['id']}})[_0xf807('0x25')](function(_0x1dbf75){if(_0x1dbf75){return _0x1dbf75[_0xf807('0x26')]();}})[_0xf807('0x25')](function(_0x2435a6){var _0x14e236=path['join'](config[_0xf807('0x4b')],_0xf807('0x59'),util[_0xf807('0x51')](_0xf807('0x50'),_0x2435a6[_0xf807('0x48')],_0x2435a6['original_format']));var _0x1a8698=path[_0xf807('0x4a')](config[_0xf807('0x4b')],_0xf807('0x4c'),util[_0xf807('0x51')]('%s.%s',_0x2435a6['save_name'],_0x2435a6[_0xf807('0x4d')]));fs[_0xf807('0x78')](_0x14e236);fs[_0xf807('0x78')](_0x1a8698);return _0x2435a6;})['then'](function(_0x4a4b34){if(_0x4a4b34){return _0x41dba5[_0xf807('0x18')](0xcc)[_0xf807('0x19')]();}})['then'](handleEntityNotFound(_0x41dba5,null))['catch'](handleError(_0x41dba5,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 5cc7cd6..113bbd7 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 _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 +var _0x4764=['./sound.attributes','exports','define','tools_sounds','util','api','moment','rimraf','../../config/environment'];(function(_0x238202,_0x10da07){var _0x217367=function(_0x34f6d0){while(--_0x34f6d0){_0x238202['push'](_0x238202['shift']());}};_0x217367(++_0x10da07);}(_0x4764,0x16c));var _0x4476=function(_0x32f680,_0x4158c4){_0x32f680=_0x32f680-0x0;var _0x5e3ce6=_0x4764[_0x32f680];return _0x5e3ce6;};'use strict';var _=require('lodash');var util=require(_0x4476('0x0'));var logger=require('../../config/logger')(_0x4476('0x1'));var moment=require(_0x4476('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4476('0x3'));var config=require(_0x4476('0x4'));var attributes=require(_0x4476('0x5'));module[_0x4476('0x6')]=function(_0x84e7d,_0x265f90){return _0x84e7d[_0x4476('0x7')]('Sound',attributes,{'tableName':_0x4476('0x8'),'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 e2ac807..98210e1 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 _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 +var _0xfe6a=['Sound','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','ShowSound'];(function(_0x25df8b,_0x7766c9){var _0xd8b05f=function(_0xb20df2){while(--_0xb20df2){_0x25df8b['push'](_0x25df8b['shift']());}};_0xd8b05f(++_0x7766c9);}(_0xfe6a,0x117));var _0xafe6=function(_0x420b45,_0x20cd1b){_0x420b45=_0x420b45-0x0;var _0x2ce16d=_0xfe6a[_0x420b45];return _0x2ce16d;};'use strict';var _=require(_0xafe6('0x0'));var util=require(_0xafe6('0x1'));var moment=require(_0xafe6('0x2'));var BPromise=require(_0xafe6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xafe6('0x4'));var logger=require(_0xafe6('0x5'))(_0xafe6('0x6'));var config=require(_0xafe6('0x7'));var jayson=require(_0xafe6('0x8'));var client=jayson['client'][_0xafe6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c768c,_0xf25e6c,_0x29c505){return new BPromise(function(_0x1e289e,_0x3b85b6){return client[_0xafe6('0xa')](_0x5c768c,_0x29c505)[_0xafe6('0xb')](function(_0x2b1202){logger[_0xafe6('0xc')](_0xafe6('0xd'),_0xf25e6c,_0xafe6('0xe'));logger[_0xafe6('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0xf25e6c,'request\x20sent',JSON[_0xafe6('0x10')](_0x2b1202));if(_0x2b1202[_0xafe6('0x11')]){if(_0x2b1202[_0xafe6('0x11')]['code']===0x1f4){logger[_0xafe6('0x11')](_0xafe6('0xd'),_0xf25e6c,_0x2b1202[_0xafe6('0x11')][_0xafe6('0x12')]);return _0x3b85b6(_0x2b1202[_0xafe6('0x11')]['message']);}logger[_0xafe6('0x11')](_0xafe6('0xd'),_0xf25e6c,_0x2b1202[_0xafe6('0x11')][_0xafe6('0x12')]);return _0x1e289e(_0x2b1202['error']['message']);}else{logger[_0xafe6('0xc')](_0xafe6('0xd'),_0xf25e6c,'request\x20sent');_0x1e289e(_0x2b1202['result']['message']);}})[_0xafe6('0x13')](function(_0xd805a7){logger[_0xafe6('0x11')]('Sound,\x20%s,\x20%s',_0xf25e6c,_0xd805a7);_0x3b85b6(_0xd805a7);});});}exports[_0xafe6('0x14')]=function(_0x278733){var _0xfbbf55=this;return new Promise(function(_0x318665,_0x108ec7){return db[_0xafe6('0x15')][_0xafe6('0x16')]({'raw':_0x278733[_0xafe6('0x17')]?_0x278733[_0xafe6('0x17')][_0xafe6('0x18')]===undefined?!![]:![]:!![],'where':_0x278733['options']?_0x278733[_0xafe6('0x17')][_0xafe6('0x19')]||null:null,'attributes':_0x278733[_0xafe6('0x17')]?_0x278733[_0xafe6('0x17')][_0xafe6('0x1a')]||null:null,'include':_0x278733['options']?_0x278733['options'][_0xafe6('0x1b')]?_[_0xafe6('0x1c')](_0x278733[_0xafe6('0x17')]['include'],function(_0x2662b1){return{'model':db[_0x2662b1[_0xafe6('0x1d')]],'as':_0x2662b1['as'],'attributes':_0x2662b1['attributes'],'include':_0x2662b1['include']?_[_0xafe6('0x1c')](_0x2662b1['include'],function(_0x480d7f){return{'model':db[_0x480d7f[_0xafe6('0x1d')]],'as':_0x480d7f['as'],'attributes':_0x480d7f[_0xafe6('0x1a')],'include':_0x480d7f[_0xafe6('0x1b')]?_['map'](_0x480d7f[_0xafe6('0x1b')],function(_0x1409ef){return{'model':db[_0x1409ef['model']],'as':_0x1409ef['as'],'attributes':_0x1409ef[_0xafe6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xafe6('0xb')](function(_0x2f5a1c){logger[_0xafe6('0xc')](_0xafe6('0x14'),_0x278733);logger[_0xafe6('0xf')](_0xafe6('0x14'),_0x278733,JSON[_0xafe6('0x10')](_0x2f5a1c));_0x318665(_0x2f5a1c);})[_0xafe6('0x13')](function(_0x10c623){logger[_0xafe6('0x11')]('ShowSound',_0x10c623['message'],_0x278733);_0x108ec7(_0xfbbf55['error'](0x1f4,_0x10c623[_0xafe6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index efd6ef2..e1ca07f 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_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 +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x9ed781,_0x1d1fcb){var _0x354572=function(_0x4ac4ea){while(--_0x4ac4ea){_0x9ed781['push'](_0x9ed781['shift']());}};_0x354572(++_0x1d1fcb);}(_0x14a0,0x8e));var _0x014a=function(_0x3dffb5,_0x1964ac){_0x3dffb5=_0x3dffb5-0x0;var _0x252404=_0x14a0[_0x3dffb5];return _0x252404;};'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 9ec6776..7bb5002 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 _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 +var _0x0aa0=['TEXT','ENUM','out','sequelize','exports','STRING'];(function(_0x4c3f70,_0x53ac7e){var _0x4445b4=function(_0x53da94){while(--_0x53da94){_0x4c3f70['push'](_0x4c3f70['shift']());}};_0x4445b4(++_0x53ac7e);}(_0x0aa0,0x189));var _0x00aa=function(_0xf93b19,_0x1881f4){_0xf93b19=_0xf93b19-0x0;var _0x53cf20=_0x0aa0[_0xf93b19];return _0x53cf20;};'use strict';var Sequelize=require(_0x00aa('0x0'));module[_0x00aa('0x1')]={'uniqueid':{'type':Sequelize[_0x00aa('0x2')]},'body':{'type':Sequelize[_0x00aa('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x00aa('0x4')]('in','out'),'defaultValue':_0x00aa('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x00aa('0x2')]},'providerResponse':{'type':Sequelize[_0x00aa('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 7301e91..90a6a78 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 _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 +var _0x0f8e=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','name','index','SquareMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','map','include','findAll','show','params','merge','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x5a4257,_0x3ae34d){var _0x3746a7=function(_0x31fff0){while(--_0x31fff0){_0x5a4257['push'](_0x5a4257['shift']());}};_0x3746a7(++_0x3ae34d);}(_0x0f8e,0x7a));var _0xe0f8=function(_0x58bf72,_0x270672){_0x58bf72=_0x58bf72-0x0;var _0x5ac3aa=_0x0f8e[_0x58bf72];return _0x5ac3aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0f8('0x0'));var zipdir=require(_0xe0f8('0x1'));var jsonpatch=require(_0xe0f8('0x2'));var rp=require(_0xe0f8('0x3'));var moment=require('moment');var BPromise=require(_0xe0f8('0x4'));var Mustache=require(_0xe0f8('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe0f8('0x6'));var ejs=require(_0xe0f8('0x7'));var fs=require('fs');var fs_extra=require(_0xe0f8('0x8'));var _=require(_0xe0f8('0x9'));var squel=require('squel');var crypto=require(_0xe0f8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe0f8('0xb'));var toCsv=require(_0xe0f8('0x6'));var querystring=require(_0xe0f8('0xc'));var Papa=require(_0xe0f8('0xd'));var Redis=require(_0xe0f8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe0f8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe0f8('0x10'));var utils=require('../../config/utils');var config=require(_0xe0f8('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xae46f8,_0x331aea){_0x331aea=_0x331aea||0xcc;return function(_0x116a4c){if(_0x116a4c){return _0xae46f8[_0xe0f8('0x12')](_0x331aea);}return _0xae46f8[_0xe0f8('0x13')](_0x331aea)[_0xe0f8('0x14')]();};}function respondWithResult(_0x54b2c8,_0x1793e7){_0x1793e7=_0x1793e7||0xc8;return function(_0x2b18b5){if(_0x2b18b5){return _0x54b2c8['status'](_0x1793e7)[_0xe0f8('0x15')](_0x2b18b5);}};}function respondWithFilteredResult(_0x12b40f,_0xc10e61){return function(_0x4e5a44){if(_0x4e5a44){var _0x123f27=typeof _0xc10e61[_0xe0f8('0x16')]===_0xe0f8('0x17')&&typeof _0xc10e61[_0xe0f8('0x18')]===_0xe0f8('0x17');var _0x3c95fd=_0x4e5a44[_0xe0f8('0x19')];var _0x46256b=_0x123f27?0x0:_0xc10e61['offset'];var _0x4ceb06=_0x123f27?_0x4e5a44['count']:_0xc10e61[_0xe0f8('0x16')]+_0xc10e61[_0xe0f8('0x18')];var _0x232877;if(_0x4ceb06>=_0x3c95fd){_0x4ceb06=_0x3c95fd;_0x232877=0xc8;}else{_0x232877=0xce;}_0x12b40f[_0xe0f8('0x13')](_0x232877);return _0x12b40f[_0xe0f8('0x1a')](_0xe0f8('0x1b'),_0x46256b+'-'+_0x4ceb06+'/'+_0x3c95fd)[_0xe0f8('0x15')](_0x4e5a44);}return null;};}function patchUpdates(_0x1ef604){return function(_0x32b360){try{jsonpatch[_0xe0f8('0x1c')](_0x32b360,_0x1ef604,!![]);}catch(_0x44f467){return BPromise[_0xe0f8('0x1d')](_0x44f467);}return _0x32b360['save']();};}function saveUpdates(_0x17f7e9,_0x3f03eb){return function(_0x2b8bce){if(_0x2b8bce){return _0x2b8bce[_0xe0f8('0x1e')](_0x17f7e9)[_0xe0f8('0x1f')](function(_0x2228be){return _0x2228be;});}return null;};}function removeEntity(_0xcb9c36,_0x360355){return function(_0x341882){if(_0x341882){return _0x341882['destroy']()[_0xe0f8('0x1f')](function(){_0xcb9c36[_0xe0f8('0x13')](0xcc)[_0xe0f8('0x14')]();});}};}function handleEntityNotFound(_0x56422c,_0x2b0bba){return function(_0x16bc49){if(!_0x16bc49){_0x56422c[_0xe0f8('0x12')](0x194);}return _0x16bc49;};}function handleError(_0x4de625,_0x32dbe7){_0x32dbe7=_0x32dbe7||0x1f4;return function(_0x146629){logger['error'](_0x146629['stack']);if(_0x146629[_0xe0f8('0x20')]){delete _0x146629[_0xe0f8('0x20')];}_0x4de625[_0xe0f8('0x13')](_0x32dbe7)['send'](_0x146629);};}exports[_0xe0f8('0x21')]=function(_0x440a29,_0x4d8b25){var _0x1379fc={},_0x28bd10={},_0x42aed4={'count':0x0,'rows':[]};var _0x36da82=_['map'](db[_0xe0f8('0x22')][_0xe0f8('0x23')],function(_0x3e545c){return{'name':_0x3e545c[_0xe0f8('0x24')],'type':_0x3e545c[_0xe0f8('0x25')][_0xe0f8('0x26')]};});_0x28bd10[_0xe0f8('0x27')]=_['map'](_0x36da82,'name');_0x28bd10['query']=_[_0xe0f8('0x28')](_0x440a29[_0xe0f8('0x29')]);_0x28bd10[_0xe0f8('0x2a')]=_[_0xe0f8('0x2b')](_0x28bd10['model'],_0x28bd10[_0xe0f8('0x29')]);_0x1379fc[_0xe0f8('0x2c')]=_[_0xe0f8('0x2b')](_0x28bd10[_0xe0f8('0x27')],qs['fields'](_0x440a29[_0xe0f8('0x29')][_0xe0f8('0x2d')]));_0x1379fc['attributes']=_0x1379fc['attributes'][_0xe0f8('0x2e')]?_0x1379fc['attributes']:_0x28bd10[_0xe0f8('0x27')];if(!_0x440a29[_0xe0f8('0x29')]['hasOwnProperty'](_0xe0f8('0x2f'))){_0x1379fc[_0xe0f8('0x18')]=qs[_0xe0f8('0x18')](_0x440a29[_0xe0f8('0x29')][_0xe0f8('0x18')]);_0x1379fc[_0xe0f8('0x16')]=qs['offset'](_0x440a29[_0xe0f8('0x29')]['offset']);}_0x1379fc['order']=qs[_0xe0f8('0x30')](_0x440a29[_0xe0f8('0x29')]['sort']);_0x1379fc['where']=qs[_0xe0f8('0x2a')](_[_0xe0f8('0x31')](_0x440a29[_0xe0f8('0x29')],_0x28bd10['filters']),_0x36da82);if(_0x440a29[_0xe0f8('0x29')][_0xe0f8('0x32')]){_0x1379fc[_0xe0f8('0x33')]=_['merge'](_0x1379fc[_0xe0f8('0x33')],{'$or':_[_0xe0f8('0x34')](_0x36da82,function(_0x525e72){if(_0x525e72[_0xe0f8('0x25')]!=='VIRTUAL'){var _0x249c5e={};_0x249c5e[_0x525e72[_0xe0f8('0x20')]]={'$like':'%'+_0x440a29['query'][_0xe0f8('0x32')]+'%'};return _0x249c5e;}})});}_0x1379fc=_['merge']({},_0x1379fc,_0x440a29['options']);var _0x49b136={'where':_0x1379fc[_0xe0f8('0x33')]};return db[_0xe0f8('0x22')][_0xe0f8('0x19')](_0x49b136)['then'](function(_0x5e2010){_0x42aed4['count']=_0x5e2010;if(_0x440a29[_0xe0f8('0x29')]['includeAll']){_0x1379fc[_0xe0f8('0x35')]=[{'all':!![]}];}return db[_0xe0f8('0x22')][_0xe0f8('0x36')](_0x1379fc);})[_0xe0f8('0x1f')](function(_0x303a80){_0x42aed4['rows']=_0x303a80;return _0x42aed4;})[_0xe0f8('0x1f')](respondWithFilteredResult(_0x4d8b25,_0x1379fc))['catch'](handleError(_0x4d8b25,null));};exports[_0xe0f8('0x37')]=function(_0x2aa761,_0x2ec05a){var _0x594ec6={'raw':!![],'where':{'id':_0x2aa761[_0xe0f8('0x38')]['id']}},_0x377b55={};_0x377b55[_0xe0f8('0x27')]=_[_0xe0f8('0x28')](db[_0xe0f8('0x22')][_0xe0f8('0x23')]);_0x377b55[_0xe0f8('0x29')]=_[_0xe0f8('0x28')](_0x2aa761[_0xe0f8('0x29')]);_0x377b55[_0xe0f8('0x2a')]=_[_0xe0f8('0x2b')](_0x377b55['model'],_0x377b55[_0xe0f8('0x29')]);_0x594ec6[_0xe0f8('0x2c')]=_[_0xe0f8('0x2b')](_0x377b55[_0xe0f8('0x27')],qs[_0xe0f8('0x2d')](_0x2aa761[_0xe0f8('0x29')][_0xe0f8('0x2d')]));_0x594ec6['attributes']=_0x594ec6[_0xe0f8('0x2c')][_0xe0f8('0x2e')]?_0x594ec6[_0xe0f8('0x2c')]:_0x377b55['model'];if(_0x2aa761[_0xe0f8('0x29')]['includeAll']){_0x594ec6['include']=[{'all':!![]}];}_0x594ec6=_[_0xe0f8('0x39')]({},_0x594ec6,_0x2aa761[_0xe0f8('0x3a')]);return db[_0xe0f8('0x22')][_0xe0f8('0x3b')](_0x594ec6)[_0xe0f8('0x1f')](handleEntityNotFound(_0x2ec05a,null))[_0xe0f8('0x1f')](respondWithResult(_0x2ec05a,null))[_0xe0f8('0x3c')](handleError(_0x2ec05a,null));};exports['create']=function(_0x4db5ef,_0x15cdb4){return db[_0xe0f8('0x22')][_0xe0f8('0x3d')](_0x4db5ef['body'],{})[_0xe0f8('0x1f')](respondWithResult(_0x15cdb4,0xc9))[_0xe0f8('0x3c')](handleError(_0x15cdb4,null));};exports[_0xe0f8('0x1e')]=function(_0x3b88b7,_0xe9bea8){if(_0x3b88b7['body']['id']){delete _0x3b88b7['body']['id'];}return db[_0xe0f8('0x22')][_0xe0f8('0x3b')]({'where':{'id':_0x3b88b7[_0xe0f8('0x38')]['id']}})[_0xe0f8('0x1f')](handleEntityNotFound(_0xe9bea8,null))[_0xe0f8('0x1f')](saveUpdates(_0x3b88b7[_0xe0f8('0x3e')],null))['then'](respondWithResult(_0xe9bea8,null))['catch'](handleError(_0xe9bea8,null));};exports[_0xe0f8('0x3f')]=function(_0x1c9caa,_0x54307f){return db[_0xe0f8('0x22')]['find']({'where':{'id':_0x1c9caa[_0xe0f8('0x38')]['id']}})[_0xe0f8('0x1f')](handleEntityNotFound(_0x54307f,null))['then'](removeEntity(_0x54307f,null))[_0xe0f8('0x3c')](handleError(_0x54307f,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 2f48867..afb44ed 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 _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 +var _0x6dcd=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x276465,_0x43ebbb){var _0x47a772=function(_0x123a48){while(--_0x123a48){_0x276465['push'](_0x276465['shift']());}};_0x47a772(++_0x43ebbb);}(_0x6dcd,0xa2));var _0xd6dc=function(_0x1240f3,_0x5b66b5){_0x1240f3=_0x1240f3-0x0;var _0x4166a2=_0x6dcd[_0x1240f3];return _0x4166a2;};'use strict';var _=require('lodash');var util=require(_0xd6dc('0x0'));var logger=require('../../config/logger')(_0xd6dc('0x1'));var moment=require(_0xd6dc('0x2'));var BPromise=require(_0xd6dc('0x3'));var rp=require(_0xd6dc('0x4'));var fs=require('fs');var path=require(_0xd6dc('0x5'));var rimraf=require(_0xd6dc('0x6'));var config=require(_0xd6dc('0x7'));var attributes=require(_0xd6dc('0x8'));module[_0xd6dc('0x9')]=function(_0x18277f,_0x311f22){return _0x18277f[_0xd6dc('0xa')](_0xd6dc('0xb'),attributes,{'tableName':_0xd6dc('0xc'),'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 647c82b..0afde8a 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 _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 +var _0xdc22=['jayson/promise','http','request','then','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','catch','create','body','options','raw','info','CreateSquareMessage','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x3c94bc,_0x2ebad1){var _0x4f0ef3=function(_0x38fb16){while(--_0x38fb16){_0x3c94bc['push'](_0x3c94bc['shift']());}};_0x4f0ef3(++_0x2ebad1);}(_0xdc22,0x199));var _0x2dc2=function(_0x47c038,_0x1f7096){_0x47c038=_0x47c038-0x0;var _0x1e0f88=_0xdc22[_0x47c038];return _0x1e0f88;};'use strict';var _=require(_0x2dc2('0x0'));var util=require(_0x2dc2('0x1'));var moment=require(_0x2dc2('0x2'));var BPromise=require('bluebird');var rs=require(_0x2dc2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2dc2('0x4'))(_0x2dc2('0x5'));var config=require(_0x2dc2('0x6'));var jayson=require(_0x2dc2('0x7'));var client=jayson['client'][_0x2dc2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa21545,_0x2478e6,_0x5d6900){return new BPromise(function(_0xc56b54,_0x9f127e){return client[_0x2dc2('0x9')](_0xa21545,_0x5d6900)[_0x2dc2('0xa')](function(_0x10341d){logger['info']('SquareMessage,\x20%s,\x20%s',_0x2478e6,_0x2dc2('0xb'));logger[_0x2dc2('0xc')](_0x2dc2('0xd'),_0x2478e6,_0x2dc2('0xb'),JSON[_0x2dc2('0xe')](_0x10341d));if(_0x10341d[_0x2dc2('0xf')]){if(_0x10341d['error'][_0x2dc2('0x10')]===0x1f4){logger[_0x2dc2('0xf')](_0x2dc2('0x11'),_0x2478e6,_0x10341d[_0x2dc2('0xf')][_0x2dc2('0x12')]);return _0x9f127e(_0x10341d[_0x2dc2('0xf')][_0x2dc2('0x12')]);}logger[_0x2dc2('0xf')](_0x2dc2('0x11'),_0x2478e6,_0x10341d[_0x2dc2('0xf')]['message']);return _0xc56b54(_0x10341d[_0x2dc2('0xf')][_0x2dc2('0x12')]);}else{logger['info'](_0x2dc2('0x11'),_0x2478e6,'request\x20sent');_0xc56b54(_0x10341d['result']['message']);}})[_0x2dc2('0x13')](function(_0x572b88){logger[_0x2dc2('0xf')]('SquareMessage,\x20%s,\x20%s',_0x2478e6,_0x572b88);_0x9f127e(_0x572b88);});});}exports['CreateSquareMessage']=function(_0x402f3f){var _0x328d73=this;return new Promise(function(_0x211862,_0x234d1c){return db['SquareMessage'][_0x2dc2('0x14')](_0x402f3f[_0x2dc2('0x15')],{'raw':_0x402f3f[_0x2dc2('0x16')]?_0x402f3f['options'][_0x2dc2('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4c0499){logger[_0x2dc2('0x18')](_0x2dc2('0x19'),_0x402f3f);logger['debug'](_0x2dc2('0x19'),_0x402f3f,JSON[_0x2dc2('0xe')](_0x4c0499));_0x211862(_0x4c0499);})[_0x2dc2('0x13')](function(_0x161e54){logger[_0x2dc2('0xf')](_0x2dc2('0x19'),_0x161e54['message'],_0x402f3f);_0x234d1c(_0x328d73[_0x2dc2('0xf')](0x1f4,_0x161e54[_0x2dc2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 291d12d..82b428a 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 _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 +var _0xf0b7=['update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/test','15s','test','create'];(function(_0x1a6475,_0x31fd7e){var _0x4fabc4=function(_0x130766){while(--_0x130766){_0x1a6475['push'](_0x1a6475['shift']());}};_0x4fabc4(++_0x31fd7e);}(_0xf0b7,0x192));var _0x7f0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0b7[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x7f0b('0x0'));var path=require(_0x7f0b('0x1'));var timeout=require(_0x7f0b('0x2'));var express=require(_0x7f0b('0x3'));var router=express['Router']();var fs_extra=require(_0x7f0b('0x4'));var auth=require(_0x7f0b('0x5'));var interaction=require(_0x7f0b('0x6'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x7f0b('0x7')]('/',auth['isAuthenticated'](),controller[_0x7f0b('0x8')]);router[_0x7f0b('0x7')](_0x7f0b('0x9'),auth[_0x7f0b('0xa')](),controller[_0x7f0b('0xb')]);router['get'](_0x7f0b('0xc'),auth[_0x7f0b('0xa')](),timeout(_0x7f0b('0xd')),controller[_0x7f0b('0xe')]);router['post']('/',auth[_0x7f0b('0xa')](),controller[_0x7f0b('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7f0b('0x10')]);router[_0x7f0b('0x11')]('/:id',auth[_0x7f0b('0xa')](),controller[_0x7f0b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 793be74..d1568dd 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 _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 +var _0x601d=['name','sequelize','exports','STRING'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0x601d,0xe1));var _0xd601=function(_0x17ad4d,_0xc5b92){_0x17ad4d=_0x17ad4d-0x0;var _0x361d3c=_0x601d[_0x17ad4d];return _0x361d3c;};'use strict';var Sequelize=require(_0xd601('0x0'));module[_0xd601('0x1')]={'name':{'type':Sequelize[_0xd601('0x2')],'unique':_0xd601('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd601('0x2')]},'description':{'type':Sequelize[_0xd601('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0eb4926..5323aea 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 _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 +var _0x3fcc=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x3fcc,0x1da));var _0xc3fc=function(_0x19ccae,_0x5aebc6){_0x19ccae=_0x19ccae-0x0;var _0x7ea497=_0x3fcc[_0x19ccae];return _0x7ea497;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3fc('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3fc('0x1'));var moment=require('moment');var BPromise=require(_0xc3fc('0x2'));var Mustache=require(_0xc3fc('0x3'));var util=require(_0xc3fc('0x4'));var path=require(_0xc3fc('0x5'));var sox=require(_0xc3fc('0x6'));var csv=require('to-csv');var ejs=require(_0xc3fc('0x7'));var fs=require('fs');var fs_extra=require(_0xc3fc('0x8'));var _=require(_0xc3fc('0x9'));var squel=require('squel');var crypto=require(_0xc3fc('0xa'));var jsforce=require(_0xc3fc('0xb'));var deskjs=require(_0xc3fc('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc3fc('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc3fc('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3fc('0xf'));var logger=require(_0xc3fc('0x10'))(_0xc3fc('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d43a3,_0x4ad6be){_0x4ad6be=_0x4ad6be||0xcc;return function(_0x195aa1){if(_0x195aa1){return _0x1d43a3[_0xc3fc('0x12')](_0x4ad6be);}return _0x1d43a3[_0xc3fc('0x13')](_0x4ad6be)[_0xc3fc('0x14')]();};}function respondWithResult(_0x504dde,_0xee74dc){_0xee74dc=_0xee74dc||0xc8;return function(_0xe6c605){if(_0xe6c605){return _0x504dde['status'](_0xee74dc)[_0xc3fc('0x15')](_0xe6c605);}};}function respondWithFilteredResult(_0x1e759f,_0xe6803f){return function(_0x5979ca){if(_0x5979ca){var _0x1aca20=typeof _0xe6803f[_0xc3fc('0x16')]===_0xc3fc('0x17')&&typeof _0xe6803f[_0xc3fc('0x18')]===_0xc3fc('0x17');var _0x59968f=_0x5979ca[_0xc3fc('0x19')];var _0x216956=_0x1aca20?0x0:_0xe6803f[_0xc3fc('0x16')];var _0xe78ab1=_0x1aca20?_0x5979ca[_0xc3fc('0x19')]:_0xe6803f[_0xc3fc('0x16')]+_0xe6803f[_0xc3fc('0x18')];var _0x5d3324;if(_0xe78ab1>=_0x59968f){_0xe78ab1=_0x59968f;_0x5d3324=0xc8;}else{_0x5d3324=0xce;}_0x1e759f['status'](_0x5d3324);return _0x1e759f[_0xc3fc('0x1a')](_0xc3fc('0x1b'),_0x216956+'-'+_0xe78ab1+'/'+_0x59968f)['json'](_0x5979ca);}return null;};}function patchUpdates(_0x26a7bc){return function(_0x2c5109){try{jsonpatch[_0xc3fc('0x1c')](_0x2c5109,_0x26a7bc,!![]);}catch(_0x2adddb){return BPromise[_0xc3fc('0x1d')](_0x2adddb);}return _0x2c5109['save']();};}function saveUpdates(_0x354931,_0x2d62af){return function(_0x58f0ba){if(_0x58f0ba){return _0x58f0ba[_0xc3fc('0x1e')](_0x354931)[_0xc3fc('0x1f')](function(_0x292aaa){return _0x292aaa;});}return null;};}function removeEntity(_0x3fcf73,_0x5c0f3a){return function(_0x2e3d76){if(_0x2e3d76){return _0x2e3d76[_0xc3fc('0x20')]()[_0xc3fc('0x1f')](function(){var _0x54ff70=_0x2e3d76[_0xc3fc('0x21')]({'plain':!![]});var _0x2439e3=_0xc3fc('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x2439e3,'resourceId':_0x54ff70['id']}})[_0xc3fc('0x1f')](function(){return _0x2e3d76;});})[_0xc3fc('0x1f')](function(){_0x3fcf73['status'](0xcc)[_0xc3fc('0x14')]();});}};}function handleEntityNotFound(_0x21d994,_0x2db699){return function(_0x5841b9){if(!_0x5841b9){_0x21d994[_0xc3fc('0x12')](0x194);}return _0x5841b9;};}function handleError(_0x3dec9f,_0xb7b544){_0xb7b544=_0xb7b544||0x1f4;return function(_0x2ad455){logger['error'](_0x2ad455[_0xc3fc('0x23')]);if(_0x2ad455[_0xc3fc('0x24')]){delete _0x2ad455['name'];}_0x3dec9f[_0xc3fc('0x13')](_0xb7b544)[_0xc3fc('0x25')](_0x2ad455);};}exports['index']=function(_0x347b8a,_0x43b5fa){var _0x32ec4d={},_0x57bcb6={},_0x587e4b={'count':0x0,'rows':[]};var _0x5c329a=_[_0xc3fc('0x26')](db[_0xc3fc('0x27')][_0xc3fc('0x28')],function(_0x5e4ec2){return{'name':_0x5e4ec2[_0xc3fc('0x29')],'type':_0x5e4ec2[_0xc3fc('0x2a')]['key']};});_0x57bcb6[_0xc3fc('0x2b')]=_['map'](_0x5c329a,_0xc3fc('0x24'));_0x57bcb6[_0xc3fc('0x2c')]=_['keys'](_0x347b8a['query']);_0x57bcb6[_0xc3fc('0x2d')]=_[_0xc3fc('0x2e')](_0x57bcb6[_0xc3fc('0x2b')],_0x57bcb6[_0xc3fc('0x2c')]);_0x32ec4d[_0xc3fc('0x2f')]=_[_0xc3fc('0x2e')](_0x57bcb6['model'],qs['fields'](_0x347b8a['query'][_0xc3fc('0x30')]));_0x32ec4d['attributes']=_0x32ec4d[_0xc3fc('0x2f')]['length']?_0x32ec4d['attributes']:_0x57bcb6[_0xc3fc('0x2b')];if(!_0x347b8a['query'][_0xc3fc('0x31')](_0xc3fc('0x32'))){_0x32ec4d[_0xc3fc('0x18')]=qs[_0xc3fc('0x18')](_0x347b8a[_0xc3fc('0x2c')][_0xc3fc('0x18')]);_0x32ec4d[_0xc3fc('0x16')]=qs['offset'](_0x347b8a[_0xc3fc('0x2c')][_0xc3fc('0x16')]);}_0x32ec4d['order']=qs['sort'](_0x347b8a['query'][_0xc3fc('0x33')]);_0x32ec4d[_0xc3fc('0x34')]=qs[_0xc3fc('0x2d')](_[_0xc3fc('0x35')](_0x347b8a['query'],_0x57bcb6[_0xc3fc('0x2d')]),_0x5c329a);if(_0x347b8a[_0xc3fc('0x2c')][_0xc3fc('0x36')]){_0x32ec4d[_0xc3fc('0x34')]=_[_0xc3fc('0x37')](_0x32ec4d[_0xc3fc('0x34')],{'$or':_[_0xc3fc('0x26')](_0x5c329a,function(_0x511e6d){if(_0x511e6d[_0xc3fc('0x2a')]!==_0xc3fc('0x38')){var _0x51fc97={};_0x51fc97[_0x511e6d['name']]={'$like':'%'+_0x347b8a[_0xc3fc('0x2c')][_0xc3fc('0x36')]+'%'};return _0x51fc97;}})});}_0x32ec4d=_[_0xc3fc('0x37')]({},_0x32ec4d,_0x347b8a['options']);var _0x56a029={'where':_0x32ec4d[_0xc3fc('0x34')]};return db[_0xc3fc('0x27')][_0xc3fc('0x19')](_0x56a029)['then'](function(_0x522e96){_0x587e4b[_0xc3fc('0x19')]=_0x522e96;if(_0x347b8a['query'][_0xc3fc('0x39')]){_0x32ec4d[_0xc3fc('0x3a')]=[{'all':!![]}];}return db[_0xc3fc('0x27')]['findAll'](_0x32ec4d);})['then'](function(_0x2ddf21){_0x587e4b[_0xc3fc('0x3b')]=_0x2ddf21;return _0x587e4b;})[_0xc3fc('0x1f')](respondWithFilteredResult(_0x43b5fa,_0x32ec4d))[_0xc3fc('0x3c')](handleError(_0x43b5fa,null));};exports[_0xc3fc('0x3d')]=function(_0x5d4ffc,_0x10607c){var _0x3b018b={'raw':!![],'where':{'id':_0x5d4ffc[_0xc3fc('0x3e')]['id']}},_0x4fd09c={};_0x4fd09c[_0xc3fc('0x2b')]=_[_0xc3fc('0x3f')](db['SquareOdbc'][_0xc3fc('0x28')]);_0x4fd09c[_0xc3fc('0x2c')]=_[_0xc3fc('0x3f')](_0x5d4ffc[_0xc3fc('0x2c')]);_0x4fd09c[_0xc3fc('0x2d')]=_[_0xc3fc('0x2e')](_0x4fd09c['model'],_0x4fd09c[_0xc3fc('0x2c')]);_0x3b018b[_0xc3fc('0x2f')]=_[_0xc3fc('0x2e')](_0x4fd09c['model'],qs[_0xc3fc('0x30')](_0x5d4ffc[_0xc3fc('0x2c')][_0xc3fc('0x30')]));_0x3b018b['attributes']=_0x3b018b[_0xc3fc('0x2f')][_0xc3fc('0x40')]?_0x3b018b[_0xc3fc('0x2f')]:_0x4fd09c[_0xc3fc('0x2b')];if(_0x5d4ffc[_0xc3fc('0x2c')][_0xc3fc('0x39')]){_0x3b018b[_0xc3fc('0x3a')]=[{'all':!![]}];}_0x3b018b=_[_0xc3fc('0x37')]({},_0x3b018b,_0x5d4ffc[_0xc3fc('0x41')]);return db[_0xc3fc('0x27')][_0xc3fc('0x42')](_0x3b018b)[_0xc3fc('0x1f')](handleEntityNotFound(_0x10607c,null))[_0xc3fc('0x1f')](respondWithResult(_0x10607c,null))[_0xc3fc('0x3c')](handleError(_0x10607c,null));};exports[_0xc3fc('0x43')]=function(_0x213cd6,_0x4deff1){return db['SquareOdbc'][_0xc3fc('0x43')](_0x213cd6[_0xc3fc('0x44')],{})[_0xc3fc('0x1f')](function(_0x4fa608){var _0x529f60=_0x213cd6['user'][_0xc3fc('0x21')]({'plain':!![]});if(!_0x529f60)throw new Error(_0xc3fc('0x45'));if(_0x529f60['role']===_0xc3fc('0x46')){var _0x218681=_0x4fa608[_0xc3fc('0x21')]({'plain':!![]});var _0x5c2eb4=_0xc3fc('0x22');return db['UserProfileSection'][_0xc3fc('0x42')]({'where':{'name':_0x5c2eb4,'userProfileId':_0x529f60['userProfileId']},'raw':!![]})[_0xc3fc('0x1f')](function(_0xa3089b){if(_0xa3089b&&_0xa3089b[_0xc3fc('0x47')]===0x0){return db['UserProfileResource'][_0xc3fc('0x43')]({'name':_0x218681[_0xc3fc('0x24')],'resourceId':_0x218681['id'],'type':_0xa3089b[_0xc3fc('0x24')],'sectionId':_0xa3089b['id']},{})[_0xc3fc('0x1f')](function(){return _0x4fa608;});}else{return _0x4fa608;}})[_0xc3fc('0x3c')](function(_0x377398){logger[_0xc3fc('0x48')](_0xc3fc('0x49'),_0x377398);throw _0x377398;});}return _0x4fa608;})[_0xc3fc('0x1f')](respondWithResult(_0x4deff1,0xc9))[_0xc3fc('0x3c')](handleError(_0x4deff1,null));};exports[_0xc3fc('0x1e')]=function(_0x3eafd5,_0x43cd22){if(_0x3eafd5[_0xc3fc('0x44')]['id']){delete _0x3eafd5['body']['id'];}return db[_0xc3fc('0x27')][_0xc3fc('0x42')]({'where':{'id':_0x3eafd5[_0xc3fc('0x3e')]['id']}})[_0xc3fc('0x1f')](handleEntityNotFound(_0x43cd22,null))[_0xc3fc('0x1f')](saveUpdates(_0x3eafd5['body'],null))[_0xc3fc('0x1f')](respondWithResult(_0x43cd22,null))[_0xc3fc('0x3c')](handleError(_0x43cd22,null));};exports['destroy']=function(_0x1d8955,_0x5a7645){return db[_0xc3fc('0x27')][_0xc3fc('0x42')]({'where':{'id':_0x1d8955[_0xc3fc('0x3e')]['id']}})[_0xc3fc('0x1f')](handleEntityNotFound(_0x5a7645,null))[_0xc3fc('0x1f')](removeEntity(_0x5a7645,null))[_0xc3fc('0x3c')](handleError(_0x5a7645,null));};exports[_0xc3fc('0x4a')]=function(_0x24ff1c,_0xb4f1bd,_0x5965fa){var _0xc6a999;return db[_0xc3fc('0x27')]['find']({'where':{'id':_0x24ff1c[_0xc3fc('0x3e')]['id']},'attributes':['id',_0xc3fc('0x4b')]})[_0xc3fc('0x1f')](handleEntityNotFound(_0xb4f1bd,null))['then'](function(_0x26d5bf){if(_0x26d5bf){var _0x496072=require('odbc')();_0x496072[_0xc3fc('0x4c')](_0x26d5bf[_0xc3fc('0x4b')]);_0x496072[_0xc3fc('0x4d')]();return _0x26d5bf;}})['then'](respondWithResult(_0xb4f1bd,null))[_0xc3fc('0x3c')](handleError(_0xb4f1bd,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b94f175..1ec52f2 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 _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 +var _0x0056=['bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0056,0x188));var _0x6005=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x0056[_0x52096b];return _0x2b1cc7;};'use strict';var _=require(_0x6005('0x0'));var util=require(_0x6005('0x1'));var logger=require(_0x6005('0x2'))('api');var moment=require(_0x6005('0x3'));var BPromise=require(_0x6005('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6005('0x5'));var rimraf=require(_0x6005('0x6'));var config=require(_0x6005('0x7'));var attributes=require(_0x6005('0x8'));module[_0x6005('0x9')]=function(_0x1f7c48,_0x46d6ab){return _0x1f7c48[_0x6005('0xa')](_0x6005('0xb'),attributes,{'tableName':'square_odbc','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 d016d6f..966d565 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 _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 +var _0xa4db=['client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','error','message','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','stringify','catch','util','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0xe4c9a3,_0x4cf555){var _0x5caba0=function(_0x2eacc0){while(--_0x2eacc0){_0xe4c9a3['push'](_0xe4c9a3['shift']());}};_0x5caba0(++_0x4cf555);}(_0xa4db,0x1d6));var _0xba4d=function(_0xd473bf,_0x3cbbe3){_0xd473bf=_0xd473bf-0x0;var _0x64e977=_0xa4db[_0xd473bf];return _0x64e977;};'use strict';var _=require('lodash');var util=require(_0xba4d('0x0'));var moment=require('moment');var BPromise=require(_0xba4d('0x1'));var rs=require(_0xba4d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xba4d('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xba4d('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xba4d('0x5')][_0xba4d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x246056,_0x331b3c,_0xdb7bc0){return new BPromise(function(_0x141e37,_0x451407){return client[_0xba4d('0x7')](_0x246056,_0xdb7bc0)[_0xba4d('0x8')](function(_0x3212c7){logger[_0xba4d('0x9')](_0xba4d('0xa'),_0x331b3c,_0xba4d('0xb'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x331b3c,_0xba4d('0xb'),JSON['stringify'](_0x3212c7));if(_0x3212c7[_0xba4d('0xc')]){if(_0x3212c7[_0xba4d('0xc')]['code']===0x1f4){logger[_0xba4d('0xc')](_0xba4d('0xa'),_0x331b3c,_0x3212c7['error'][_0xba4d('0xd')]);return _0x451407(_0x3212c7[_0xba4d('0xc')][_0xba4d('0xd')]);}logger[_0xba4d('0xc')](_0xba4d('0xa'),_0x331b3c,_0x3212c7[_0xba4d('0xc')][_0xba4d('0xd')]);return _0x141e37(_0x3212c7['error']['message']);}else{logger[_0xba4d('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x331b3c,_0xba4d('0xb'));_0x141e37(_0x3212c7['result'][_0xba4d('0xd')]);}})['catch'](function(_0x3ce35f){logger[_0xba4d('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x331b3c,_0x3ce35f);_0x451407(_0x3ce35f);});});}exports[_0xba4d('0xe')]=function(_0x57fa62){var _0x8da823=this;return new Promise(function(_0x13fe20,_0x4213ad){return db[_0xba4d('0xf')]['find']({'raw':_0x57fa62[_0xba4d('0x10')]?_0x57fa62[_0xba4d('0x10')][_0xba4d('0x11')]===undefined?!![]:![]:!![],'where':_0x57fa62['options']?_0x57fa62[_0xba4d('0x10')][_0xba4d('0x12')]||null:null,'attributes':_0x57fa62['options']?_0x57fa62[_0xba4d('0x10')][_0xba4d('0x13')]||null:null,'include':_0x57fa62[_0xba4d('0x10')]?_0x57fa62['options'][_0xba4d('0x14')]?_[_0xba4d('0x15')](_0x57fa62[_0xba4d('0x10')][_0xba4d('0x14')],function(_0x23f2af){return{'model':db[_0x23f2af[_0xba4d('0x16')]],'as':_0x23f2af['as'],'attributes':_0x23f2af[_0xba4d('0x13')],'include':_0x23f2af[_0xba4d('0x14')]?_[_0xba4d('0x15')](_0x23f2af[_0xba4d('0x14')],function(_0x8d3fa7){return{'model':db[_0x8d3fa7[_0xba4d('0x16')]],'as':_0x8d3fa7['as'],'attributes':_0x8d3fa7[_0xba4d('0x13')],'include':_0x8d3fa7[_0xba4d('0x14')]?_['map'](_0x8d3fa7[_0xba4d('0x14')],function(_0x86d72f){return{'model':db[_0x86d72f[_0xba4d('0x16')]],'as':_0x86d72f['as'],'attributes':_0x86d72f[_0xba4d('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfeb1a4){logger[_0xba4d('0x9')](_0xba4d('0xe'),_0x57fa62);logger['debug'](_0xba4d('0xe'),_0x57fa62,JSON[_0xba4d('0x17')](_0xfeb1a4));_0x13fe20(_0xfeb1a4);})[_0xba4d('0x18')](function(_0x324bae){logger[_0xba4d('0xc')](_0xba4d('0xe'),_0x324bae[_0xba4d('0xd')],_0x57fa62);_0x4213ad(_0x8da823[_0xba4d('0xc')](0x1f4,_0x324bae[_0xba4d('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 8fd1ba3..b2300d2 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 _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 +var _0x3178=['Router','fs-extra','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','path','express'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x3178,0x196));var _0x8317=function(_0x131f28,_0xadc7ab){_0x131f28=_0x131f28-0x0;var _0x223641=_0x3178[_0x131f28];return _0x223641;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8317('0x0'));var timeout=require('connect-timeout');var express=require(_0x8317('0x1'));var router=express[_0x8317('0x2')]();var fs_extra=require(_0x8317('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8317('0x4'));var controller=require(_0x8317('0x5'));router[_0x8317('0x6')]('/',auth[_0x8317('0x7')](),controller[_0x8317('0x8')]);router[_0x8317('0x6')](_0x8317('0x9'),auth[_0x8317('0x7')](),controller[_0x8317('0xa')]);router[_0x8317('0xb')]('/',auth[_0x8317('0x7')](),controller[_0x8317('0xc')]);router[_0x8317('0xd')](_0x8317('0x9'),auth[_0x8317('0x7')](),controller['update']);router[_0x8317('0xe')](_0x8317('0x9'),auth['isAuthenticated'](),controller[_0x8317('0xf')]);module[_0x8317('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ba4af50..9415fa4 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 _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 +var _0xec36=['production','DATE','sequelize','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long'];(function(_0x377570,_0xfd20e1){var _0x43e675=function(_0x4596f5){while(--_0x4596f5){_0x377570['push'](_0x377570['shift']());}};_0x43e675(++_0xfd20e1);}(_0xec36,0xda));var _0x6ec3=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xec36[_0x3ba924];return _0x4cc1df;};'use strict';var Sequelize=require(_0x6ec3('0x0'));module['exports']={'name':{'type':Sequelize[_0x6ec3('0x1')],'unique':_0x6ec3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6ec3('0x1')]},'notes':{'type':Sequelize[_0x6ec3('0x3')]},'preproduction':{'type':Sequelize[_0x6ec3('0x4')]('long'),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x6ec3('0x5')](_0x6ec3('0x6'))[_0x6ec3('0x7')](_0x6ec3('0x8'));}}},'production':{'type':Sequelize[_0x6ec3('0x4')](_0x6ec3('0x9')),'get':function(){if(this['getDataValue'](_0x6ec3('0xa'))){return this['getDataValue'](_0x6ec3('0xa'))[_0x6ec3('0x7')](_0x6ec3('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x6ec3('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index e3cc5cb..f1b84d4 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 _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 +var _0x5c55=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','production','lodash','ioredis','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','json','offset','limit','undefined','count','status','set','Content-Range','then','destroy','get','UserProfileResource','publish','stringify','end','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map'];(function(_0x123e7a,_0x557878){var _0x398c86=function(_0x69aba4){while(--_0x69aba4){_0x123e7a['push'](_0x123e7a['shift']());}};_0x398c86(++_0x557878);}(_0x5c55,0x6a));var _0x55c5=function(_0xd5a842,_0x3bef1f){_0xd5a842=_0xd5a842-0x0;var _0xcedd84=_0x5c55[_0xd5a842];return _0xcedd84;};'use strict';var _=require(_0x55c5('0x0'));var Redis=require(_0x55c5('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x55c5('0x2'))(_0x55c5('0x3'));var config=require('../../config/environment');var db=require(_0x55c5('0x4'))['db'];config['redis']=_[_0x55c5('0x5')](config[_0x55c5('0x6')],{'host':_0x55c5('0x7'),'port':0x18eb});var socket=require(_0x55c5('0x8'))(new Redis(config['redis']));require(_0x55c5('0x9'))['register'](socket);function respondWithResult(_0x36e7a0,_0x50f201){_0x50f201=_0x50f201||0xc8;return function(_0x54f80a){if(_0x54f80a){return _0x36e7a0['status'](_0x50f201)[_0x55c5('0xa')](_0x54f80a);}};}function respondWithFilteredResult(_0x241e95,_0x3a1569){return function(_0x526f31){if(_0x526f31){var _0x1848d3=typeof _0x3a1569[_0x55c5('0xb')]==='undefined'&&typeof _0x3a1569[_0x55c5('0xc')]===_0x55c5('0xd');var _0x3628b7=_0x526f31[_0x55c5('0xe')];var _0x4aff35=_0x1848d3?0x0:_0x3a1569[_0x55c5('0xb')];var _0x3c7266=_0x1848d3?_0x526f31[_0x55c5('0xe')]:_0x3a1569[_0x55c5('0xb')]+_0x3a1569[_0x55c5('0xc')];var _0x58b8f8;if(_0x3c7266>=_0x3628b7){_0x3c7266=_0x3628b7;_0x58b8f8=0xc8;}else{_0x58b8f8=0xce;}_0x241e95[_0x55c5('0xf')](_0x58b8f8);return _0x241e95[_0x55c5('0x10')](_0x55c5('0x11'),_0x4aff35+'-'+_0x3c7266+'/'+_0x3628b7)[_0x55c5('0xa')](_0x526f31);}return null;};}function saveUpdates(_0xa91378){return function(_0x29e726){if(_0x29e726){return _0x29e726['update'](_0xa91378)[_0x55c5('0x12')](function(_0x557f1b){return _0x557f1b;});}return null;};}function removeEntity(_0x44fadb){return function(_0x5b8145){if(_0x5b8145){return _0x5b8145[_0x55c5('0x13')]()[_0x55c5('0x12')](function(){var _0x4154e5=_0x5b8145[_0x55c5('0x14')]({'plain':!![]});var _0xd2fdde='SquareProjects';return db[_0x55c5('0x15')]['destroy']({'where':{'type':_0xd2fdde,'resourceId':_0x4154e5['id']}})[_0x55c5('0x12')](function(){return _0x5b8145;});})[_0x55c5('0x12')](function(){var _0x1141e4=new Redis(config[_0x55c5('0x6')]);_0x1141e4[_0x55c5('0x16')]('agi',JSON[_0x55c5('0x17')]({'id':_0x5b8145['id'],'deleted':!![]}));})[_0x55c5('0x12')](function(){_0x44fadb[_0x55c5('0xf')](0xcc)[_0x55c5('0x18')]();});}};}function handleEntityNotFound(_0x577643){return function(_0x5c22c3){if(!_0x5c22c3){_0x577643[_0x55c5('0x19')](0x194);}return _0x5c22c3;};}function handleError(_0x33bee6,_0xf56c65){_0xf56c65=_0xf56c65||0x1f4;return function(_0x48274e){logger[_0x55c5('0x1a')](_0x48274e[_0x55c5('0x1b')]);if(_0x48274e[_0x55c5('0x1c')]){delete _0x48274e[_0x55c5('0x1c')];}_0x33bee6[_0x55c5('0xf')](_0xf56c65)[_0x55c5('0x1d')](_0x48274e);};}exports[_0x55c5('0x1e')]=function(_0x267ca6,_0x21a8bc){var _0x3d9d3b={},_0x1f3d5f={},_0x2d9db5={'count':0x0,'rows':[]};var _0x38a8b7=_['map'](db[_0x55c5('0x1f')][_0x55c5('0x20')],function(_0x18f404){return{'name':_0x18f404[_0x55c5('0x21')],'type':_0x18f404[_0x55c5('0x22')][_0x55c5('0x23')]};});_0x1f3d5f[_0x55c5('0x24')]=_[_0x55c5('0x25')](_0x38a8b7,'name');_0x1f3d5f[_0x55c5('0x26')]=_[_0x55c5('0x27')](_0x267ca6[_0x55c5('0x26')]);_0x1f3d5f[_0x55c5('0x28')]=_[_0x55c5('0x29')](_0x1f3d5f['model'],_0x1f3d5f['query']);_0x3d9d3b[_0x55c5('0x2a')]=_['intersection'](_0x1f3d5f[_0x55c5('0x24')],qs[_0x55c5('0x2b')](_0x267ca6['query'][_0x55c5('0x2b')]));_0x3d9d3b['attributes']=_0x3d9d3b['attributes'][_0x55c5('0x2c')]?_0x3d9d3b[_0x55c5('0x2a')]:_0x1f3d5f[_0x55c5('0x24')];if(!_0x267ca6[_0x55c5('0x26')][_0x55c5('0x2d')](_0x55c5('0x2e'))){_0x3d9d3b[_0x55c5('0xc')]=qs[_0x55c5('0xc')](_0x267ca6[_0x55c5('0x26')][_0x55c5('0xc')]);_0x3d9d3b['offset']=qs[_0x55c5('0xb')](_0x267ca6[_0x55c5('0x26')][_0x55c5('0xb')]);}_0x3d9d3b[_0x55c5('0x2f')]=qs[_0x55c5('0x30')](_0x267ca6[_0x55c5('0x26')][_0x55c5('0x30')]);_0x3d9d3b[_0x55c5('0x31')]=qs[_0x55c5('0x28')](_[_0x55c5('0x32')](_0x267ca6['query'],_0x1f3d5f[_0x55c5('0x28')]),_0x38a8b7);if(_0x267ca6[_0x55c5('0x26')][_0x55c5('0x33')]){_0x3d9d3b[_0x55c5('0x31')]=_[_0x55c5('0x34')](_0x3d9d3b[_0x55c5('0x31')],{'$or':_['map'](_0x38a8b7,function(_0x51ae49){if(_0x51ae49[_0x55c5('0x22')]!==_0x55c5('0x35')){var _0x2fa854={};_0x2fa854[_0x51ae49[_0x55c5('0x1c')]]={'$like':'%'+_0x267ca6[_0x55c5('0x26')]['filter']+'%'};return _0x2fa854;}})});}_0x3d9d3b=_[_0x55c5('0x34')]({},_0x3d9d3b,_0x267ca6[_0x55c5('0x36')]);var _0x199fb6={'where':_0x3d9d3b[_0x55c5('0x31')]};return db[_0x55c5('0x1f')]['count'](_0x199fb6)[_0x55c5('0x12')](function(_0x28c26d){_0x2d9db5['count']=_0x28c26d;if(_0x267ca6[_0x55c5('0x26')]['includeAll']){_0x3d9d3b[_0x55c5('0x37')]=[{'all':!![]}];}return db[_0x55c5('0x1f')][_0x55c5('0x38')](_0x3d9d3b);})['then'](function(_0x2ea152){_0x2d9db5[_0x55c5('0x39')]=_0x2ea152;return _0x2d9db5;})[_0x55c5('0x12')](respondWithFilteredResult(_0x21a8bc,_0x3d9d3b))[_0x55c5('0x3a')](handleError(_0x21a8bc,null));};exports['show']=function(_0x58e843,_0x520617){var _0x15a3b4={'raw':![],'where':{'id':_0x58e843[_0x55c5('0x3b')]['id']}},_0x577e8d={};_0x577e8d[_0x55c5('0x24')]=_[_0x55c5('0x27')](db[_0x55c5('0x1f')][_0x55c5('0x20')]);_0x577e8d[_0x55c5('0x26')]=_[_0x55c5('0x27')](_0x58e843[_0x55c5('0x26')]);_0x577e8d['filters']=_['intersection'](_0x577e8d[_0x55c5('0x24')],_0x577e8d[_0x55c5('0x26')]);_0x15a3b4[_0x55c5('0x2a')]=_[_0x55c5('0x29')](_0x577e8d[_0x55c5('0x24')],qs['fields'](_0x58e843[_0x55c5('0x26')][_0x55c5('0x2b')]));_0x15a3b4['attributes']=_0x15a3b4[_0x55c5('0x2a')]['length']?_0x15a3b4[_0x55c5('0x2a')]:_0x577e8d['model'];if(_0x58e843[_0x55c5('0x26')][_0x55c5('0x3c')]){_0x15a3b4[_0x55c5('0x37')]=[{'all':!![]}];}_0x15a3b4=_[_0x55c5('0x34')]({},_0x15a3b4,_0x58e843[_0x55c5('0x36')]);return db[_0x55c5('0x1f')][_0x55c5('0x3d')](_0x15a3b4)[_0x55c5('0x12')](handleEntityNotFound(_0x520617,null))['then'](respondWithResult(_0x520617,null))[_0x55c5('0x3a')](handleError(_0x520617,null));};exports['create']=function(_0xb598c0,_0x1f300c){return db['SquareProject']['create'](_0xb598c0[_0x55c5('0x3e')],{})[_0x55c5('0x12')](function(_0x178f20){var _0x42a311=_0xb598c0[_0x55c5('0x3f')][_0x55c5('0x14')]({'plain':!![]});if(!_0x42a311)throw new Error(_0x55c5('0x40'));if(_0x42a311['role']===_0x55c5('0x3f')){var _0x1b4c22=_0x178f20[_0x55c5('0x14')]({'plain':!![]});var _0x2ce6a8='SquareProjects';return db[_0x55c5('0x41')][_0x55c5('0x3d')]({'where':{'name':_0x2ce6a8,'userProfileId':_0x42a311[_0x55c5('0x42')]},'raw':!![]})['then'](function(_0x30fbef){if(_0x30fbef&&_0x30fbef[_0x55c5('0x43')]===0x0){return db[_0x55c5('0x15')][_0x55c5('0x44')]({'name':_0x1b4c22[_0x55c5('0x1c')],'resourceId':_0x1b4c22['id'],'type':_0x30fbef[_0x55c5('0x1c')],'sectionId':_0x30fbef['id']},{})[_0x55c5('0x12')](function(){return _0x178f20;});}else{return _0x178f20;}})['catch'](function(_0x2069c4){logger[_0x55c5('0x1a')](_0x55c5('0x45'),_0x2069c4);throw _0x2069c4;});}return _0x178f20;})[_0x55c5('0x12')](respondWithResult(_0x1f300c,0xc9))[_0x55c5('0x3a')](handleError(_0x1f300c,null));};exports['update']=function(_0x1cbec0,_0x4e20f7){if(_0x1cbec0[_0x55c5('0x3e')]['id']){delete _0x1cbec0[_0x55c5('0x3e')]['id'];}return db['SquareProject'][_0x55c5('0x3d')]({'where':{'id':_0x1cbec0[_0x55c5('0x3b')]['id']}})[_0x55c5('0x12')](handleEntityNotFound(_0x4e20f7,null))[_0x55c5('0x12')](saveUpdates(_0x1cbec0[_0x55c5('0x3e')],null))['then'](function(_0xa81fc6){if(!_0xa81fc6)return;var _0x41db20=_0xa81fc6[_0x55c5('0x14')]({'plain':!![]});return _0x41db20;})[_0x55c5('0x12')](function(_0x363a84){var _0x19ba77=new Redis(config['redis']);_0x19ba77[_0x55c5('0x16')](_0x55c5('0x46'),JSON[_0x55c5('0x17')](_[_0x55c5('0x32')](_0x363a84,['id',_0x55c5('0x1c'),_0x55c5('0x47')])));return _0x363a84;})[_0x55c5('0x12')](respondWithResult(_0x4e20f7,null))[_0x55c5('0x3a')](handleError(_0x4e20f7,null));};exports[_0x55c5('0x13')]=function(_0x1a87a6,_0x24f281){return db[_0x55c5('0x1f')][_0x55c5('0x3d')]({'where':{'id':_0x1a87a6[_0x55c5('0x3b')]['id']}})[_0x55c5('0x12')](handleEntityNotFound(_0x24f281,null))[_0x55c5('0x12')](removeEntity(_0x24f281,null))['catch'](handleError(_0x24f281,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1ef0d04..d9d821b 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 _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 +var _0x64da=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x5b7b9c,_0x1b7f14){var _0x134213=function(_0x11726b){while(--_0x11726b){_0x5b7b9c['push'](_0x5b7b9c['shift']());}};_0x134213(++_0x1b7f14);}(_0x64da,0x1ad));var _0xa64d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x64da[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xa64d('0x0'))['db'][_0xa64d('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa64d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa64d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3b36d7){return function(_0x1affde,_0x4f100a,_0x3f912b){SquareProjectEvents[_0xa64d('0x4')](_0x3b36d7+':'+_0x1affde['id'],_0x1affde);SquareProjectEvents[_0xa64d('0x4')](_0x3b36d7,_0x1affde);_0x3f912b(null);};}for(var e in events){if(events[_0xa64d('0x5')](e)){var event=events[e];SquareProject[_0xa64d('0x6')](e,emitEvent(event));}}module[_0xa64d('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 75af417..4763c0f 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 _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 +var _0xa886=['production','publishedAt','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5cb76d,_0x47d11a){var _0x34a1f2=function(_0x189bc8){while(--_0x189bc8){_0x5cb76d['push'](_0x5cb76d['shift']());}};_0x34a1f2(++_0x47d11a);}(_0xa886,0x112));var _0x6a88=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa886[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x6a88('0x0'));var util=require('util');var logger=require(_0x6a88('0x1'))(_0x6a88('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a88('0x4'));var config=require(_0x6a88('0x5'));var attributes=require(_0x6a88('0x6'));module['exports']=function(_0x1c8618,_0x364704){return _0x1c8618[_0x6a88('0x7')](_0x6a88('0x8'),attributes,{'tableName':_0x6a88('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fb3df,_0x11b39f,_0x2c08c2){if(_0x2fb3df[_0x6a88('0xa')](_0x6a88('0xb'))){_0x2fb3df[_0x6a88('0xc')]=moment()[_0x6a88('0xd')](_0x6a88('0xe'));}if(_0x2fb3df[_0x6a88('0xa')](_0x6a88('0xf'))){_0x2fb3df[_0x6a88('0x10')]=moment()[_0x6a88('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2c08c2(null,_0x2fb3df);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 499a295..137c1c8 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 _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 +var _0x5388=['stringify','catch','error','message','ShowSquareProject','find','info','lodash','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','model','map','then','debug'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5388,0x17b));var _0x8538=function(_0xd63b06,_0x34850f){_0xd63b06=_0xd63b06-0x0;var _0x343035=_0x5388[_0xd63b06];return _0x343035;};'use strict';var _=require(_0x8538('0x0'));var Redis=require(_0x8538('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x8538('0x2'))(_0x8538('0x3'));var config=require(_0x8538('0x4'));config[_0x8538('0x5')]=_[_0x8538('0x6')](config[_0x8538('0x5')],{'host':_0x8538('0x7'),'port':0x18eb});var socket=require(_0x8538('0x8'))(new Redis(config['redis']));require(_0x8538('0x9'))[_0x8538('0xa')](socket);exports[_0x8538('0xb')]=function(_0x5dc823){var _0x5c36a8=this;return new Promise(function(_0x4e04d5,_0x3edcc1){return db[_0x8538('0xc')][_0x8538('0xd')]({'raw':_0x5dc823[_0x8538('0xe')]?_0x5dc823[_0x8538('0xe')][_0x8538('0xf')]===undefined?!![]:![]:!![],'where':_0x5dc823[_0x8538('0xe')]?_0x5dc823[_0x8538('0xe')][_0x8538('0x10')]||null:null,'attributes':_0x5dc823[_0x8538('0xe')]?_0x5dc823[_0x8538('0xe')][_0x8538('0x11')]||null:null,'limit':_0x5dc823[_0x8538('0xe')]?_0x5dc823[_0x8538('0xe')][_0x8538('0x12')]||null:null,'include':_0x5dc823['options']?_0x5dc823[_0x8538('0xe')][_0x8538('0x13')]?_['map'](_0x5dc823[_0x8538('0xe')]['include'],function(_0x1ae1e1){return{'model':db[_0x1ae1e1[_0x8538('0x14')]],'as':_0x1ae1e1['as'],'attributes':_0x1ae1e1[_0x8538('0x11')],'include':_0x1ae1e1['include']?_[_0x8538('0x15')](_0x1ae1e1['include'],function(_0x305001){return{'model':db[_0x305001['model']],'as':_0x305001['as'],'attributes':_0x305001[_0x8538('0x11')],'include':_0x305001[_0x8538('0x13')]?_['map'](_0x305001[_0x8538('0x13')],function(_0x4e7cd4){return{'model':db[_0x4e7cd4[_0x8538('0x14')]],'as':_0x4e7cd4['as'],'attributes':_0x4e7cd4['attributes']};}):[]};}):[]};}):[]:[]})[_0x8538('0x16')](function(_0x455cf2){logger['info']('GetSquareProjects',_0x5dc823);logger[_0x8538('0x17')](_0x8538('0xb'),_0x5dc823,JSON[_0x8538('0x18')](_0x455cf2));_0x4e04d5(_0x455cf2);})[_0x8538('0x19')](function(_0x47ea8b){logger[_0x8538('0x1a')](_0x8538('0xb'),_0x47ea8b[_0x8538('0x1b')],_0x5dc823);_0x3edcc1(_0x5c36a8[_0x8538('0x1a')](0x1f4,_0x47ea8b[_0x8538('0x1b')]));});});};exports[_0x8538('0x1c')]=function(_0x2f43ff){var _0x563466=this;return new Promise(function(_0x221dc7,_0xebb50f){return db[_0x8538('0xc')][_0x8538('0x1d')]({'raw':_0x2f43ff[_0x8538('0xe')]?_0x2f43ff[_0x8538('0xe')][_0x8538('0xf')]===undefined?!![]:![]:!![],'where':_0x2f43ff['options']?_0x2f43ff[_0x8538('0xe')]['where']||null:null,'attributes':_0x2f43ff[_0x8538('0xe')]?_0x2f43ff[_0x8538('0xe')][_0x8538('0x11')]||null:null,'include':_0x2f43ff[_0x8538('0xe')]?_0x2f43ff[_0x8538('0xe')][_0x8538('0x13')]?_[_0x8538('0x15')](_0x2f43ff['options'][_0x8538('0x13')],function(_0x50dda4){return{'model':db[_0x50dda4[_0x8538('0x14')]],'as':_0x50dda4['as'],'attributes':_0x50dda4['attributes'],'include':_0x50dda4[_0x8538('0x13')]?_[_0x8538('0x15')](_0x50dda4[_0x8538('0x13')],function(_0xa57909){return{'model':db[_0xa57909['model']],'as':_0xa57909['as'],'attributes':_0xa57909[_0x8538('0x11')],'include':_0xa57909[_0x8538('0x13')]?_['map'](_0xa57909[_0x8538('0x13')],function(_0x35b440){return{'model':db[_0x35b440['model']],'as':_0x35b440['as'],'attributes':_0x35b440[_0x8538('0x11')]};}):[]};}):[]};}):[]:[]})[_0x8538('0x16')](function(_0x3a0748){logger[_0x8538('0x1e')](_0x8538('0x1c'),_0x2f43ff);logger['debug'](_0x8538('0x1c'),_0x2f43ff,JSON[_0x8538('0x18')](_0x3a0748));_0x221dc7(_0x3a0748);})[_0x8538('0x19')](function(_0x517714){logger[_0x8538('0x1a')](_0x8538('0x1c'),_0x517714[_0x8538('0x1b')],_0x2f43ff);_0xebb50f(_0x563466[_0x8538('0x1a')](0x1f4,_0x517714[_0x8538('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index ca02f6d..c4543d2 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 _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 +var _0x64f9=['register','length','./squareProject.events','save','remove'];(function(_0x53ca5e,_0x10e2e0){var _0x3bfcd5=function(_0x31b43f){while(--_0x31b43f){_0x53ca5e['push'](_0x53ca5e['shift']());}};_0x3bfcd5(++_0x10e2e0);}(_0x64f9,0x1e7));var _0x964f=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x64f9[_0x2fd69d];return _0x5d5ef3;};'use strict';var SquareProjectEvents=require(_0x964f('0x0'));var events=[_0x964f('0x1'),_0x964f('0x2'),'update'];function createListener(_0x26d647,_0x51c8e2){return function(_0x47f68a){_0x51c8e2['emit'](_0x26d647,_0x47f68a);};}function removeListener(_0xacafbe,_0x5cf361){return function(){SquareProjectEvents['removeListener'](_0xacafbe,_0x5cf361);};}exports[_0x964f('0x3')]=function(_0x4729b4){for(var _0x378a94=0x0,_0x13ada2=events[_0x964f('0x4')];_0x378a94<_0x13ada2;_0x378a94++){var _0x589005=events[_0x378a94];var _0x38b057=createListener('squareProject:'+_0x589005,_0x4729b4);SquareProjectEvents['on'](_0x589005,_0x38b057);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index bf41591..ce06fcc 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 _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 +var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1e0590,_0x3447b0){var _0x90460=function(_0x108a33){while(--_0x108a33){_0x1e0590['push'](_0x1e0590['shift']());}};_0x90460(++_0x3447b0);}(_0xf494,0x1c6));var _0x4f49=function(_0xd9fc71,_0x3cd9ee){_0xd9fc71=_0xd9fc71-0x0;var _0x3a03aa=_0xf494[_0xd9fc71];return _0x3a03aa;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 798c10c..2241cb1 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 _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 +var _0x6f47=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x43bacf,_0x241269){var _0x1f358b=function(_0x3dca79){while(--_0x3dca79){_0x43bacf['push'](_0x43bacf['shift']());}};_0x1f358b(++_0x241269);}(_0x6f47,0xc7));var _0x76f4=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x6f47[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'uniqueid':{'type':Sequelize[_0x76f4('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'dnid':{'type':Sequelize[_0x76f4('0x1')]},'projectName':{'type':Sequelize[_0x76f4('0x1')]},'saveName':{'type':Sequelize[_0x76f4('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x76f4('0x1')]},'format':{'type':Sequelize[_0x76f4('0x2')],'get':function(){var _0x2176a7='';var _0x497f99=this[_0x76f4('0x3')](_0x76f4('0x4'));if(_0x497f99){_0x2176a7=_0x497f99[_0x76f4('0x5')](_0x497f99[_0x76f4('0x6')]('.'));}return _0x2176a7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 158fb02..0a188ca 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 _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 +var _0x7fb3=['decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','SquareRecording','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','length','options','find','create','body','params','download','savePath','filename','format','%s.cypher'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x7fb3,0xd5));var _0x37fb=function(_0x367816,_0x35633c){_0x367816=_0x367816-0x0;var _0x2cdde2=_0x7fb3[_0x367816];return _0x2cdde2;};'use strict';var emlformat=require(_0x37fb('0x0'));var rimraf=require(_0x37fb('0x1'));var zipdir=require(_0x37fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37fb('0x3'));var moment=require('moment');var BPromise=require(_0x37fb('0x4'));var Mustache=require(_0x37fb('0x5'));var util=require(_0x37fb('0x6'));var path=require(_0x37fb('0x7'));var sox=require(_0x37fb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37fb('0x9'));var squel=require(_0x37fb('0xa'));var crypto=require(_0x37fb('0xb'));var jsforce=require(_0x37fb('0xc'));var deskjs=require(_0x37fb('0xd'));var toCsv=require(_0x37fb('0xe'));var querystring=require(_0x37fb('0xf'));var Papa=require(_0x37fb('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x37fb('0x11'));var as=require(_0x37fb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x37fb('0x13'));var utils=require(_0x37fb('0x14'));var config=require(_0x37fb('0x15'));var licenseUtil=require(_0x37fb('0x16'));var db=require(_0x37fb('0x17'))['db'];function respondWithStatusCode(_0x5cd0df,_0x599a21){_0x599a21=_0x599a21||0xcc;return function(_0x385b40){if(_0x385b40){return _0x5cd0df[_0x37fb('0x18')](_0x599a21);}return _0x5cd0df[_0x37fb('0x19')](_0x599a21)[_0x37fb('0x1a')]();};}function respondWithResult(_0x22c928,_0x5f492f){_0x5f492f=_0x5f492f||0xc8;return function(_0x20ac35){if(_0x20ac35){return _0x22c928[_0x37fb('0x19')](_0x5f492f)[_0x37fb('0x1b')](_0x20ac35);}};}function respondWithFilteredResult(_0x54e5cc,_0x5c44b1){return function(_0x114eb9){if(_0x114eb9){var _0x344b14=typeof _0x5c44b1['offset']==='undefined'&&typeof _0x5c44b1['limit']===_0x37fb('0x1c');var _0x427230=_0x114eb9[_0x37fb('0x1d')];var _0x3dc88f=_0x344b14?0x0:_0x5c44b1[_0x37fb('0x1e')];var _0x18f1f0=_0x344b14?_0x114eb9[_0x37fb('0x1d')]:_0x5c44b1['offset']+_0x5c44b1[_0x37fb('0x1f')];var _0x456dc0;if(_0x18f1f0>=_0x427230){_0x18f1f0=_0x427230;_0x456dc0=0xc8;}else{_0x456dc0=0xce;}_0x54e5cc[_0x37fb('0x19')](_0x456dc0);return _0x54e5cc[_0x37fb('0x20')](_0x37fb('0x21'),_0x3dc88f+'-'+_0x18f1f0+'/'+_0x427230)[_0x37fb('0x1b')](_0x114eb9);}return null;};}function patchUpdates(_0x15bc94){return function(_0x517024){try{jsonpatch[_0x37fb('0x22')](_0x517024,_0x15bc94,!![]);}catch(_0x26805a){return BPromise['reject'](_0x26805a);}return _0x517024[_0x37fb('0x23')]();};}function saveUpdates(_0x3afaad,_0xf9d2a6){return function(_0x3d14c9){if(_0x3d14c9){return _0x3d14c9[_0x37fb('0x24')](_0x3afaad)[_0x37fb('0x25')](function(_0xc43f22){return _0xc43f22;});}return null;};}function removeEntity(_0x55ca42,_0x85f376){return function(_0x3eaaa9){if(_0x3eaaa9){return _0x3eaaa9[_0x37fb('0x26')]()[_0x37fb('0x25')](function(){_0x55ca42[_0x37fb('0x19')](0xcc)[_0x37fb('0x1a')]();});}};}function handleEntityNotFound(_0x50847a,_0x58c928){return function(_0x3113ce){if(!_0x3113ce){_0x50847a[_0x37fb('0x18')](0x194);}return _0x3113ce;};}function handleError(_0x20bfcc,_0x29cadb){_0x29cadb=_0x29cadb||0x1f4;return function(_0xb3184c){logger['error'](_0xb3184c[_0x37fb('0x27')]);if(_0xb3184c['name']){delete _0xb3184c[_0x37fb('0x28')];}_0x20bfcc[_0x37fb('0x19')](_0x29cadb)['send'](_0xb3184c);};}exports[_0x37fb('0x29')]=function(_0x1df120,_0x3b4ddf){var _0x553a56={},_0x3f6bfc={},_0x189ea8={'count':0x0,'rows':[]};var _0x3f65f7=_[_0x37fb('0x2a')](db[_0x37fb('0x2b')][_0x37fb('0x2c')],function(_0x215dad){return{'name':_0x215dad['fieldName'],'type':_0x215dad[_0x37fb('0x2d')][_0x37fb('0x2e')]};});_0x3f6bfc['model']=_[_0x37fb('0x2a')](_0x3f65f7,_0x37fb('0x28'));_0x3f6bfc[_0x37fb('0x2f')]=_['keys'](_0x1df120[_0x37fb('0x2f')]);_0x3f6bfc[_0x37fb('0x30')]=_[_0x37fb('0x31')](_0x3f6bfc['model'],_0x3f6bfc[_0x37fb('0x2f')]);_0x553a56[_0x37fb('0x32')]=_['intersection'](_0x3f6bfc[_0x37fb('0x33')],qs[_0x37fb('0x34')](_0x1df120['query'][_0x37fb('0x34')]));_0x553a56[_0x37fb('0x32')]=_0x553a56[_0x37fb('0x32')]['length']?_0x553a56[_0x37fb('0x32')]:_0x3f6bfc[_0x37fb('0x33')];if(!_0x1df120[_0x37fb('0x2f')]['hasOwnProperty'](_0x37fb('0x35'))){_0x553a56[_0x37fb('0x1f')]=qs[_0x37fb('0x1f')](_0x1df120[_0x37fb('0x2f')]['limit']);_0x553a56[_0x37fb('0x1e')]=qs['offset'](_0x1df120[_0x37fb('0x2f')][_0x37fb('0x1e')]);}_0x553a56['order']=qs['sort'](_0x1df120[_0x37fb('0x2f')][_0x37fb('0x36')]);_0x553a56[_0x37fb('0x37')]=qs['filters'](_[_0x37fb('0x38')](_0x1df120[_0x37fb('0x2f')],_0x3f6bfc[_0x37fb('0x30')]),_0x3f65f7);if(_0x1df120[_0x37fb('0x2f')]['filter']){_0x553a56[_0x37fb('0x37')]=_[_0x37fb('0x39')](_0x553a56[_0x37fb('0x37')],{'$or':_['map'](_0x3f65f7,function(_0x511016){if(_0x511016['type']!==_0x37fb('0x3a')){var _0x18e25d={};_0x18e25d[_0x511016[_0x37fb('0x28')]]={'$like':'%'+_0x1df120[_0x37fb('0x2f')][_0x37fb('0x3b')]+'%'};return _0x18e25d;}})});}_0x553a56=_['merge']({},_0x553a56,_0x1df120['options']);var _0x315d1f={'where':_0x553a56[_0x37fb('0x37')]};return db[_0x37fb('0x2b')][_0x37fb('0x1d')](_0x315d1f)[_0x37fb('0x25')](function(_0x2741cf){_0x189ea8['count']=_0x2741cf;if(_0x1df120[_0x37fb('0x2f')][_0x37fb('0x3c')]){_0x553a56[_0x37fb('0x3d')]=[{'all':!![]}];}return db['SquareRecording'][_0x37fb('0x3e')](_0x553a56);})[_0x37fb('0x25')](function(_0x53a9e5){_0x189ea8[_0x37fb('0x3f')]=_0x53a9e5;return _0x189ea8;})[_0x37fb('0x25')](respondWithFilteredResult(_0x3b4ddf,_0x553a56))[_0x37fb('0x40')](handleError(_0x3b4ddf,null));};exports[_0x37fb('0x41')]=function(_0x234a80,_0x4769c4){var _0xe85eb6={'raw':!![],'where':{'id':_0x234a80['params']['id']}},_0x11b25e={};_0x11b25e['model']=_[_0x37fb('0x42')](db[_0x37fb('0x2b')]['rawAttributes']);_0x11b25e[_0x37fb('0x2f')]=_['keys'](_0x234a80[_0x37fb('0x2f')]);_0x11b25e[_0x37fb('0x30')]=_['intersection'](_0x11b25e[_0x37fb('0x33')],_0x11b25e['query']);_0xe85eb6['attributes']=_[_0x37fb('0x31')](_0x11b25e['model'],qs['fields'](_0x234a80[_0x37fb('0x2f')][_0x37fb('0x34')]));_0xe85eb6['attributes']=_0xe85eb6[_0x37fb('0x32')][_0x37fb('0x43')]?_0xe85eb6[_0x37fb('0x32')]:_0x11b25e[_0x37fb('0x33')];if(_0x234a80[_0x37fb('0x2f')][_0x37fb('0x3c')]){_0xe85eb6[_0x37fb('0x3d')]=[{'all':!![]}];}_0xe85eb6=_['merge']({},_0xe85eb6,_0x234a80[_0x37fb('0x44')]);return db['SquareRecording'][_0x37fb('0x45')](_0xe85eb6)[_0x37fb('0x25')](handleEntityNotFound(_0x4769c4,null))[_0x37fb('0x25')](respondWithResult(_0x4769c4,null))[_0x37fb('0x40')](handleError(_0x4769c4,null));};exports[_0x37fb('0x46')]=function(_0x7c518c,_0x291207){return db['SquareRecording'][_0x37fb('0x46')](_0x7c518c[_0x37fb('0x47')],{})['then'](respondWithResult(_0x291207,0xc9))[_0x37fb('0x40')](handleError(_0x291207,null));};exports['update']=function(_0x1378a1,_0x2b1df9){if(_0x1378a1[_0x37fb('0x47')]['id']){delete _0x1378a1['body']['id'];}return db['SquareRecording'][_0x37fb('0x45')]({'where':{'id':_0x1378a1[_0x37fb('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b1df9,null))[_0x37fb('0x25')](saveUpdates(_0x1378a1[_0x37fb('0x47')],null))[_0x37fb('0x25')](respondWithResult(_0x2b1df9,null))[_0x37fb('0x40')](handleError(_0x2b1df9,null));};exports[_0x37fb('0x49')]=function(_0x4b263f,_0x34586a,_0x395d3c){var _0x4022e8=require('../../components/encryptor');var _0x19526d=![];var _0x349751={};if(_0x4b263f[_0x37fb('0x2f')][_0x37fb('0x2d')]&&_0x4b263f[_0x37fb('0x2f')][_0x37fb('0x2d')]==='uniqueid'){_0x349751['uniqueid']=_0x4b263f[_0x37fb('0x48')]['id'];}else{_0x349751['id']=_0x4b263f[_0x37fb('0x48')]['id'];}return db['SquareRecording'][_0x37fb('0x45')]({'where':_0x349751,'attributes':['id',_0x37fb('0x4a'),_0x37fb('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x34586a,null))[_0x37fb('0x25')](function(_0xdd9b89){if(_0xdd9b89){var _0x1c8400=_0xdd9b89[_0x37fb('0x4a')];var _0x23893b=util[_0x37fb('0x4c')](_0x37fb('0x4d'),_0x1c8400);if(fs['existsSync'](_0x23893b)){_0x19526d=!![];return _0x4022e8[_0x37fb('0x4e')](_0x23893b,_0x1c8400,config[_0x37fb('0x4f')][_0x37fb('0x50')])[_0x37fb('0x25')](function(){return _0xdd9b89;});}return _0xdd9b89;}})[_0x37fb('0x25')](function(_0x16f2d5){if(_0x16f2d5){var _0x3f3193=_0x16f2d5[_0x37fb('0x4a')];if(!fs[_0x37fb('0x51')](_0x3f3193)){throw new db[(_0x37fb('0x52'))]['ValidationError'](_0x37fb('0x53'));}if(_0x16f2d5[_0x37fb('0x4b')]){return _0x34586a['download'](_0x3f3193,_0x16f2d5[_0x37fb('0x4b')]+path[_0x37fb('0x54')](_0x3f3193),function(){if(_0x19526d){fs[_0x37fb('0x55')](_0x3f3193);}});}else{return _0x34586a[_0x37fb('0x49')](_0x3f3193,function(_0x1aed14){if(_0x19526d){fs['unlink'](_0x3f3193);}});}}})[_0x37fb('0x40')](function(_0x20f4a5){if(_0x20f4a5[_0x37fb('0x56')]==='SquareRecording\x20not\x20found'){_0x34586a[_0x37fb('0x19')](0x194)[_0x37fb('0x57')](_0x37fb('0x58'));}else{return handleError(_0x34586a,null);}});};exports['destroy']=function(_0x95f949,_0x38f9c2){return db[_0x37fb('0x2b')]['find']({'where':{'id':_0x95f949[_0x37fb('0x48')]['id']}})[_0x37fb('0x25')](function(_0x51e91c){if(_[_0x37fb('0x59')](_0x51e91c)){throw new ReferenceError(_0x37fb('0x5a'));}return _0x51e91c;})[_0x37fb('0x25')](function(_0x1e1d26){var _0x46fc30=_0x1e1d26['savePath'];logger['info'](_0x37fb('0x5b'),_0x46fc30);if(!_[_0x37fb('0x59')](_0x1e1d26[_0x37fb('0x4a')])&&fs[_0x37fb('0x51')](_0x46fc30)){logger[_0x37fb('0x5c')](_0x37fb('0x5d')+_0x46fc30+_0x37fb('0x5e'));fs['unlinkSync'](_0x46fc30);}_0x46fc30=_0x46fc30+_0x37fb('0x5f');if(!_[_0x37fb('0x59')](_0x1e1d26[_0x37fb('0x4a')])&&fs['existsSync'](_0x46fc30)){logger['info'](_0x37fb('0x5d')+_0x46fc30+_0x37fb('0x5e'));fs[_0x37fb('0x60')](_0x46fc30);}return _0x1e1d26;})[_0x37fb('0x25')](function(_0x483fbe){if(!_0x483fbe)throw new InternalError();return _0x483fbe[_0x37fb('0x26')]();})[_0x37fb('0x25')](function(){_0x38f9c2[_0x37fb('0x19')](0xcc)['end']();})['catch'](handleError(_0x38f9c2,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8866648..1f2b7e6 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 _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 +var _0xed20=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util'];(function(_0x32fcaa,_0xb7d04){var _0xae52a4=function(_0x7bf594){while(--_0x7bf594){_0x32fcaa['push'](_0x32fcaa['shift']());}};_0xae52a4(++_0xb7d04);}(_0xed20,0xce));var _0x0ed2=function(_0x12d9c1,_0x5da90d){_0x12d9c1=_0x12d9c1-0x0;var _0x5360f7=_0xed20[_0x12d9c1];return _0x5360f7;};'use strict';var _=require(_0x0ed2('0x0'));var util=require(_0x0ed2('0x1'));var logger=require(_0x0ed2('0x2'))('api');var moment=require(_0x0ed2('0x3'));var BPromise=require(_0x0ed2('0x4'));var rp=require(_0x0ed2('0x5'));var fs=require('fs');var path=require(_0x0ed2('0x6'));var rimraf=require(_0x0ed2('0x7'));var config=require(_0x0ed2('0x8'));var attributes=require('./squareRecording.attributes');module[_0x0ed2('0x9')]=function(_0x88640a,_0x5c686a){return _0x88640a[_0x0ed2('0xa')](_0x0ed2('0xb'),attributes,{'tableName':_0x0ed2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index ac1f1c4..fde11c0 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 _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 +var _0x2032=['stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','then'];(function(_0x1434df,_0x3bbb32){var _0x260317=function(_0x34c365){while(--_0x34c365){_0x1434df['push'](_0x1434df['shift']());}};_0x260317(++_0x3bbb32);}(_0x2032,0xd9));var _0x2203=function(_0x3a4d46,_0xbdc3e6){_0x3a4d46=_0x3a4d46-0x0;var _0x2a5506=_0x2032[_0x3a4d46];return _0x2a5506;};'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});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SquareRecording,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SquareRecording,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['create'](_0x4893ff[_0x2203('0x16')],{'raw':_0x4893ff[_0x2203('0x17')]?_0x4893ff[_0x2203('0x17')][_0x2203('0x18')]===undefined?!![]:![]:!![]})[_0x2203('0x19')](function(_0x449039){logger['info'](_0x2203('0x14'),_0x4893ff);logger['debug']('CreateSquareRecording',_0x4893ff,JSON[_0x2203('0x1a')](_0x449039));_0x8906e1(_0x449039);})['catch'](function(_0x3b8ef9){logger[_0x2203('0xe')]('CreateSquareRecording',_0x3b8ef9[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6['error'](0x1f4,_0x3b8ef9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 02fa112..004fb5f 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_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 +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(_0xb4aa51,_0x1f7f1a){var _0x4fde40=function(_0x2a60f9){while(--_0x2a60f9){_0xb4aa51['push'](_0xb4aa51['shift']());}};_0x4fde40(++_0x1f7f1a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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 2731aee..44d4bcb 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 _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 +var _0x9afd=['BOOLEAN','exports','STRING','DATE'];(function(_0x438dad,_0x35c476){var _0x39e84d=function(_0x3be8d0){while(--_0x3be8d0){_0x438dad['push'](_0x438dad['shift']());}};_0x39e84d(++_0x35c476);}(_0x9afd,0xf9));var _0xd9af=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x9afd[_0x104e21];return _0x605b37;};'use strict';var Sequelize=require('sequelize');module[_0xd9af('0x0')]={'network':{'type':Sequelize[_0xd9af('0x1')]},'network_script':{'type':Sequelize[_0xd9af('0x1')]},'request':{'type':Sequelize[_0xd9af('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd9af('0x1')]},'type':{'type':Sequelize[_0xd9af('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xd9af('0x1')]},'callerid':{'type':Sequelize[_0xd9af('0x1')]},'calleridname':{'type':Sequelize[_0xd9af('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xd9af('0x1')]},'callington':{'type':Sequelize[_0xd9af('0x1')]},'callingtns':{'type':Sequelize[_0xd9af('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xd9af('0x1')]},'context':{'type':Sequelize[_0xd9af('0x1')]},'extension':{'type':Sequelize[_0xd9af('0x1')]},'priority':{'type':Sequelize[_0xd9af('0x1')]},'enhanced':{'type':Sequelize[_0xd9af('0x1')]},'accountcode':{'type':Sequelize[_0xd9af('0x1')]},'threadid':{'type':Sequelize[_0xd9af('0x1')]},'project_name':{'type':Sequelize[_0xd9af('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd9af('0x2')]},'bot':{'type':Sequelize[_0xd9af('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2757fef..b9cef62 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 _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 +var _0x4324=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','type','key','model','filters','attributes','intersection','query','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util'];(function(_0x2a15e5,_0x251c18){var _0x317590=function(_0x5484a8){while(--_0x5484a8){_0x2a15e5['push'](_0x2a15e5['shift']());}};_0x317590(++_0x251c18);}(_0x4324,0x113));var _0x4432=function(_0x597eb2,_0x165f5c){_0x597eb2=_0x597eb2-0x0;var _0x56875f=_0x4324[_0x597eb2];return _0x56875f;};'use strict';var emlformat=require(_0x4432('0x0'));var rimraf=require(_0x4432('0x1'));var zipdir=require(_0x4432('0x2'));var jsonpatch=require(_0x4432('0x3'));var rp=require(_0x4432('0x4'));var moment=require(_0x4432('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4432('0x6'));var path=require('path');var sox=require(_0x4432('0x7'));var csv=require(_0x4432('0x8'));var ejs=require(_0x4432('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4432('0xa'));var squel=require(_0x4432('0xb'));var crypto=require(_0x4432('0xc'));var jsforce=require(_0x4432('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4432('0x8'));var querystring=require('querystring');var Papa=require(_0x4432('0xe'));var Redis=require(_0x4432('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4432('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4432('0x11'));var logger=require('../../config/logger')(_0x4432('0x12'));var utils=require(_0x4432('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4432('0x14'));var db=require(_0x4432('0x15'))['db'];function respondWithStatusCode(_0x37e052,_0x5a5630){_0x5a5630=_0x5a5630||0xcc;return function(_0x4ee7e4){if(_0x4ee7e4){return _0x37e052[_0x4432('0x16')](_0x5a5630);}return _0x37e052[_0x4432('0x17')](_0x5a5630)[_0x4432('0x18')]();};}function respondWithResult(_0x436aa6,_0x22a9d){_0x22a9d=_0x22a9d||0xc8;return function(_0x59b7e6){if(_0x59b7e6){return _0x436aa6[_0x4432('0x17')](_0x22a9d)[_0x4432('0x19')](_0x59b7e6);}};}function respondWithFilteredResult(_0x1cdbb5,_0x5313af){return function(_0x21b83b){if(_0x21b83b){var _0x57d0b1=typeof _0x5313af[_0x4432('0x1a')]===_0x4432('0x1b')&&typeof _0x5313af[_0x4432('0x1c')]===_0x4432('0x1b');var _0x328707=_0x21b83b['count'];var _0x619810=_0x57d0b1?0x0:_0x5313af[_0x4432('0x1a')];var _0x5011bc=_0x57d0b1?_0x21b83b[_0x4432('0x1d')]:_0x5313af['offset']+_0x5313af[_0x4432('0x1c')];var _0x3e3b6a;if(_0x5011bc>=_0x328707){_0x5011bc=_0x328707;_0x3e3b6a=0xc8;}else{_0x3e3b6a=0xce;}_0x1cdbb5[_0x4432('0x17')](_0x3e3b6a);return _0x1cdbb5[_0x4432('0x1e')](_0x4432('0x1f'),_0x619810+'-'+_0x5011bc+'/'+_0x328707)[_0x4432('0x19')](_0x21b83b);}return null;};}function patchUpdates(_0x4d0824){return function(_0x598f82){try{jsonpatch['apply'](_0x598f82,_0x4d0824,!![]);}catch(_0x7716e2){return BPromise[_0x4432('0x20')](_0x7716e2);}return _0x598f82[_0x4432('0x21')]();};}function saveUpdates(_0x46d057,_0x447b51){return function(_0x2c28a1){if(_0x2c28a1){return _0x2c28a1[_0x4432('0x22')](_0x46d057)[_0x4432('0x23')](function(_0x57636c){return _0x57636c;});}return null;};}function removeEntity(_0x3d54e0,_0x8aed9){return function(_0x325dbf){if(_0x325dbf){return _0x325dbf[_0x4432('0x24')]()[_0x4432('0x23')](function(){_0x3d54e0[_0x4432('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34168a,_0x6238c0){return function(_0x286b4b){if(!_0x286b4b){_0x34168a[_0x4432('0x16')](0x194);}return _0x286b4b;};}function handleError(_0x548cee,_0x3efca0){_0x3efca0=_0x3efca0||0x1f4;return function(_0x50a8c5){logger[_0x4432('0x25')](_0x50a8c5['stack']);if(_0x50a8c5[_0x4432('0x26')]){delete _0x50a8c5[_0x4432('0x26')];}_0x548cee[_0x4432('0x17')](_0x3efca0)['send'](_0x50a8c5);};}exports[_0x4432('0x27')]=function(_0x4db3c8,_0x1175ca){var _0x26ca66={},_0x5d56ac={},_0x211c90={'count':0x0,'rows':[]};var _0x53c7ed=_[_0x4432('0x28')](db['SquareReport']['rawAttributes'],function(_0x14357e){return{'name':_0x14357e['fieldName'],'type':_0x14357e[_0x4432('0x29')][_0x4432('0x2a')]};});_0x5d56ac[_0x4432('0x2b')]=_[_0x4432('0x28')](_0x53c7ed,_0x4432('0x26'));_0x5d56ac['query']=_['keys'](_0x4db3c8['query']);_0x5d56ac[_0x4432('0x2c')]=_['intersection'](_0x5d56ac[_0x4432('0x2b')],_0x5d56ac['query']);_0x26ca66[_0x4432('0x2d')]=_[_0x4432('0x2e')](_0x5d56ac[_0x4432('0x2b')],qs['fields'](_0x4db3c8[_0x4432('0x2f')][_0x4432('0x30')]));_0x26ca66[_0x4432('0x2d')]=_0x26ca66[_0x4432('0x2d')]['length']?_0x26ca66['attributes']:_0x5d56ac['model'];if(!_0x4db3c8[_0x4432('0x2f')][_0x4432('0x31')](_0x4432('0x32'))){_0x26ca66[_0x4432('0x1c')]=qs[_0x4432('0x1c')](_0x4db3c8[_0x4432('0x2f')][_0x4432('0x1c')]);_0x26ca66[_0x4432('0x1a')]=qs[_0x4432('0x1a')](_0x4db3c8['query']['offset']);}_0x26ca66[_0x4432('0x33')]=qs['sort'](_0x4db3c8['query'][_0x4432('0x34')]);_0x26ca66[_0x4432('0x35')]=qs[_0x4432('0x2c')](_[_0x4432('0x36')](_0x4db3c8[_0x4432('0x2f')],_0x5d56ac[_0x4432('0x2c')]),_0x53c7ed);if(_0x4db3c8[_0x4432('0x2f')][_0x4432('0x37')]){_0x26ca66[_0x4432('0x35')]=_[_0x4432('0x38')](_0x26ca66[_0x4432('0x35')],{'$or':_[_0x4432('0x28')](_0x53c7ed,function(_0x4d3fa7){if(_0x4d3fa7[_0x4432('0x29')]!==_0x4432('0x39')){var _0x46cec5={};_0x46cec5[_0x4d3fa7[_0x4432('0x26')]]={'$like':'%'+_0x4db3c8['query']['filter']+'%'};return _0x46cec5;}})});}_0x26ca66=_['merge']({},_0x26ca66,_0x4db3c8[_0x4432('0x3a')]);var _0x2f9ace={'where':_0x26ca66[_0x4432('0x35')]};return db[_0x4432('0x3b')][_0x4432('0x1d')](_0x2f9ace)['then'](function(_0x40ca44){_0x211c90[_0x4432('0x1d')]=_0x40ca44;if(_0x4db3c8[_0x4432('0x2f')][_0x4432('0x3c')]){_0x26ca66[_0x4432('0x3d')]=[{'all':!![]}];}return db[_0x4432('0x3b')][_0x4432('0x3e')](_0x26ca66);})['then'](function(_0x42869f){_0x211c90[_0x4432('0x3f')]=_0x42869f;return _0x211c90;})[_0x4432('0x23')](respondWithFilteredResult(_0x1175ca,_0x26ca66))[_0x4432('0x40')](handleError(_0x1175ca,null));};exports[_0x4432('0x41')]=function(_0x15bac5,_0x2583e5){var _0x75fdcf={'raw':!![],'where':{'id':_0x15bac5['params']['id']}},_0x24cb14={};_0x24cb14[_0x4432('0x2b')]=_[_0x4432('0x42')](db[_0x4432('0x3b')][_0x4432('0x43')]);_0x24cb14[_0x4432('0x2f')]=_[_0x4432('0x42')](_0x15bac5[_0x4432('0x2f')]);_0x24cb14['filters']=_[_0x4432('0x2e')](_0x24cb14[_0x4432('0x2b')],_0x24cb14[_0x4432('0x2f')]);_0x75fdcf[_0x4432('0x2d')]=_[_0x4432('0x2e')](_0x24cb14['model'],qs[_0x4432('0x30')](_0x15bac5[_0x4432('0x2f')][_0x4432('0x30')]));_0x75fdcf[_0x4432('0x2d')]=_0x75fdcf[_0x4432('0x2d')][_0x4432('0x44')]?_0x75fdcf[_0x4432('0x2d')]:_0x24cb14[_0x4432('0x2b')];if(_0x15bac5[_0x4432('0x2f')][_0x4432('0x3c')]){_0x75fdcf[_0x4432('0x3d')]=[{'all':!![]}];}_0x75fdcf=_[_0x4432('0x38')]({},_0x75fdcf,_0x15bac5['options']);return db[_0x4432('0x3b')][_0x4432('0x45')](_0x75fdcf)[_0x4432('0x23')](handleEntityNotFound(_0x2583e5,null))[_0x4432('0x23')](respondWithResult(_0x2583e5,null))[_0x4432('0x40')](handleError(_0x2583e5,null));};exports[_0x4432('0x46')]=function(_0x1e48a4,_0x158a63){return db[_0x4432('0x3b')][_0x4432('0x46')](_0x1e48a4['body'],{})['then'](respondWithResult(_0x158a63,0xc9))['catch'](handleError(_0x158a63,null));};exports[_0x4432('0x22')]=function(_0x1a9786,_0x459730){if(_0x1a9786[_0x4432('0x47')]['id']){delete _0x1a9786[_0x4432('0x47')]['id'];}return db[_0x4432('0x3b')][_0x4432('0x45')]({'where':{'id':_0x1a9786[_0x4432('0x48')]['id']}})[_0x4432('0x23')](handleEntityNotFound(_0x459730,null))[_0x4432('0x23')](saveUpdates(_0x1a9786[_0x4432('0x47')],null))[_0x4432('0x23')](respondWithResult(_0x459730,null))[_0x4432('0x40')](handleError(_0x459730,null));};exports[_0x4432('0x24')]=function(_0x5ef119,_0x119bac){return db['SquareReport'][_0x4432('0x45')]({'where':{'id':_0x5ef119['params']['id']}})[_0x4432('0x23')](handleEntityNotFound(_0x119bac,null))['then'](removeEntity(_0x119bac,null))[_0x4432('0x40')](handleError(_0x119bac,null));};exports[_0x4432('0x49')]=function(_0x806485,_0xee3d7e){return db[_0x4432('0x3b')][_0x4432('0x49')]()[_0x4432('0x23')](respondWithResult(_0xee3d7e,null))['catch'](handleError(_0xee3d7e,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 841392b..9ebaa9c 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 _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 +var _0x7f44=['uniqueid','project_name','leaveAt','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x7f44,0x173));var _0x47f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f44[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x47f4('0x0'));var util=require(_0x47f4('0x1'));var logger=require('../../config/logger')(_0x47f4('0x2'));var moment=require(_0x47f4('0x3'));var BPromise=require(_0x47f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47f4('0x5'));var rimraf=require(_0x47f4('0x6'));var config=require(_0x47f4('0x7'));var attributes=require('./squareReport.attributes');module[_0x47f4('0x8')]=function(_0x289671,_0x2a473a){return _0x289671[_0x47f4('0x9')](_0x47f4('0xa'),attributes,{'tableName':_0x47f4('0xb'),'paranoid':![],'indexes':[{'name':_0x47f4('0xc'),'fields':[_0x47f4('0xd'),_0x47f4('0xe')]},{'name':_0x47f4('0xf'),'fields':[_0x47f4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c03ded0..07da29f 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 _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 +var _0xae40=['jayson/promise','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','SquareReport','create','body','options','raw','CreateSquareReport','where','UpdateSquareReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xae40,0xab));var _0x0ae4=function(_0x7738c0,_0x40ee7a){_0x7738c0=_0x7738c0-0x0;var _0x3d4d97=_0xae40[_0x7738c0];return _0x3d4d97;};'use strict';var _=require('lodash');var util=require(_0x0ae4('0x0'));var moment=require(_0x0ae4('0x1'));var BPromise=require(_0x0ae4('0x2'));var rs=require(_0x0ae4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ae4('0x4'))['db'];var utils=require(_0x0ae4('0x5'));var logger=require(_0x0ae4('0x6'))(_0x0ae4('0x7'));var config=require(_0x0ae4('0x8'));var jayson=require(_0x0ae4('0x9'));var client=jayson['client'][_0x0ae4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x235218,_0xcec1f5,_0x4024e6){return new BPromise(function(_0x14a8a6,_0x459304){return client['request'](_0x235218,_0x4024e6)[_0x0ae4('0xb')](function(_0x4ad27f){logger['info'](_0x0ae4('0xc'),_0xcec1f5,_0x0ae4('0xd'));logger[_0x0ae4('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0xcec1f5,_0x0ae4('0xd'),JSON[_0x0ae4('0xf')](_0x4ad27f));if(_0x4ad27f[_0x0ae4('0x10')]){if(_0x4ad27f[_0x0ae4('0x10')][_0x0ae4('0x11')]===0x1f4){logger[_0x0ae4('0x10')](_0x0ae4('0xc'),_0xcec1f5,_0x4ad27f[_0x0ae4('0x10')]['message']);return _0x459304(_0x4ad27f[_0x0ae4('0x10')][_0x0ae4('0x12')]);}logger[_0x0ae4('0x10')]('SquareReport,\x20%s,\x20%s',_0xcec1f5,_0x4ad27f[_0x0ae4('0x10')][_0x0ae4('0x12')]);return _0x14a8a6(_0x4ad27f[_0x0ae4('0x10')][_0x0ae4('0x12')]);}else{logger[_0x0ae4('0x13')](_0x0ae4('0xc'),_0xcec1f5,_0x0ae4('0xd'));_0x14a8a6(_0x4ad27f[_0x0ae4('0x14')][_0x0ae4('0x12')]);}})[_0x0ae4('0x15')](function(_0x19525a){logger[_0x0ae4('0x10')](_0x0ae4('0xc'),_0xcec1f5,_0x19525a);_0x459304(_0x19525a);});});}exports['CreateSquareReport']=function(_0xe7708e){var _0x87893e=this;return new Promise(function(_0x5c4347,_0x529d16){return db[_0x0ae4('0x16')][_0x0ae4('0x17')](_0xe7708e[_0x0ae4('0x18')],{'raw':_0xe7708e[_0x0ae4('0x19')]?_0xe7708e[_0x0ae4('0x19')][_0x0ae4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5bce1e){logger['info'](_0x0ae4('0x1b'),_0xe7708e);logger[_0x0ae4('0xe')]('CreateSquareReport',_0xe7708e,JSON['stringify'](_0x5bce1e));_0x5c4347(_0x5bce1e);})[_0x0ae4('0x15')](function(_0x2a8004){logger['error'](_0x0ae4('0x1b'),_0x2a8004[_0x0ae4('0x12')],_0xe7708e);_0x529d16(_0x87893e[_0x0ae4('0x10')](0x1f4,_0x2a8004[_0x0ae4('0x12')]));});});};exports['UpdateSquareReport']=function(_0x577548){var _0x50b70b=this;return new Promise(function(_0x3dd321,_0x3d942a){return db[_0x0ae4('0x16')]['update'](_0x577548[_0x0ae4('0x18')],{'raw':_0x577548[_0x0ae4('0x19')]?_0x577548[_0x0ae4('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x577548[_0x0ae4('0x19')]?_0x577548[_0x0ae4('0x19')][_0x0ae4('0x1c')]||null:null,'attributes':_0x577548['options']?_0x577548[_0x0ae4('0x19')]['attributes']||null:null,'limit':_0x577548[_0x0ae4('0x19')]?_0x577548[_0x0ae4('0x19')]['limit']||null:null})['then'](function(_0x3d3222){logger['info']('UpdateSquareReport',_0x577548);logger[_0x0ae4('0xe')](_0x0ae4('0x1d'),_0x577548,JSON['stringify'](_0x3d3222));_0x3dd321(_0x3d3222);})['catch'](function(_0x3b66b8){logger[_0x0ae4('0x10')](_0x0ae4('0x1d'),_0x3b66b8[_0x0ae4('0x12')],_0x577548);_0x3d942a(_0x50b70b[_0x0ae4('0x10')](0x1f4,_0x3b66b8[_0x0ae4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 26645bc..7b5893d 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 _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 +var _0x3f71=['/:id','post','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe'];(function(_0xc0cbf,_0x22f493){var _0x24a0ac=function(_0x33e3c9){while(--_0x33e3c9){_0xc0cbf['push'](_0xc0cbf['shift']());}};_0x24a0ac(++_0x22f493);}(_0x3f71,0x9d));var _0x13f7=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x3f71[_0x5cbf0e];return _0x1c76f8;};'use strict';var multer=require('multer');var util=require(_0x13f7('0x0'));var path=require(_0x13f7('0x1'));var timeout=require(_0x13f7('0x2'));var express=require(_0x13f7('0x3'));var router=express[_0x13f7('0x4')]();var fs_extra=require(_0x13f7('0x5'));var auth=require(_0x13f7('0x6'));var interaction=require(_0x13f7('0x7'));var config=require(_0x13f7('0x8'));var controller=require(_0x13f7('0x9'));router[_0x13f7('0xa')]('/',auth[_0x13f7('0xb')](),controller['index']);router[_0x13f7('0xa')](_0x13f7('0xc'),auth[_0x13f7('0xb')](),controller[_0x13f7('0xd')]);router[_0x13f7('0xa')](_0x13f7('0xe'),auth[_0x13f7('0xb')](),controller['show']);router[_0x13f7('0xf')]('/',auth[_0x13f7('0xb')](),controller['create']);router[_0x13f7('0x10')]('/:id',auth[_0x13f7('0xb')](),controller['update']);router[_0x13f7('0x11')](_0x13f7('0xe'),auth[_0x13f7('0xb')](),controller[_0x13f7('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 b176564..a1b5e7b 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 _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 +var _0x604e=['exports','STRING','TEXT','sequelize'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x604e,0x143));var _0xe604=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x604e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe604('0x0'));module[_0xe604('0x1')]={'uniqueid':{'type':Sequelize[_0xe604('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xe604('0x2')]},'data':{'type':Sequelize[_0xe604('0x3')]},'project_name':{'type':Sequelize[_0xe604('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 2001bd5..39d25f4 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 _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 +var _0xe499=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','params','length','find','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','key','model','query'];(function(_0x597bf3,_0x3a2bd8){var _0x4db0db=function(_0x4d5983){while(--_0x4d5983){_0x597bf3['push'](_0x597bf3['shift']());}};_0x4db0db(++_0x3a2bd8);}(_0xe499,0xfb));var _0x9e49=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0xe499[_0x11e05d];return _0x335588;};'use strict';var emlformat=require(_0x9e49('0x0'));var rimraf=require(_0x9e49('0x1'));var zipdir=require(_0x9e49('0x2'));var jsonpatch=require(_0x9e49('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e49('0x4'));var Mustache=require(_0x9e49('0x5'));var util=require(_0x9e49('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9e49('0x7'));var ejs=require(_0x9e49('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e49('0x9'));var squel=require(_0x9e49('0xa'));var crypto=require(_0x9e49('0xb'));var jsforce=require(_0x9e49('0xc'));var deskjs=require(_0x9e49('0xd'));var toCsv=require(_0x9e49('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9e49('0xe'));var authService=require(_0x9e49('0xf'));var qs=require(_0x9e49('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e49('0x11'));var logger=require(_0x9e49('0x12'))(_0x9e49('0x13'));var utils=require(_0x9e49('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9e49('0x15'));var db=require(_0x9e49('0x16'))['db'];function respondWithStatusCode(_0x38ddd4,_0x45127f){_0x45127f=_0x45127f||0xcc;return function(_0x4b73d6){if(_0x4b73d6){return _0x38ddd4[_0x9e49('0x17')](_0x45127f);}return _0x38ddd4[_0x9e49('0x18')](_0x45127f)[_0x9e49('0x19')]();};}function respondWithResult(_0x432208,_0x4ba5a2){_0x4ba5a2=_0x4ba5a2||0xc8;return function(_0x35f9fa){if(_0x35f9fa){return _0x432208[_0x9e49('0x18')](_0x4ba5a2)[_0x9e49('0x1a')](_0x35f9fa);}};}function respondWithFilteredResult(_0x357cfa,_0x2d16d5){return function(_0x31dab6){if(_0x31dab6){var _0x3e21ba=typeof _0x2d16d5[_0x9e49('0x1b')]===_0x9e49('0x1c')&&typeof _0x2d16d5['limit']===_0x9e49('0x1c');var _0x2df3b5=_0x31dab6[_0x9e49('0x1d')];var _0x456b58=_0x3e21ba?0x0:_0x2d16d5[_0x9e49('0x1b')];var _0x5e3bbc=_0x3e21ba?_0x31dab6[_0x9e49('0x1d')]:_0x2d16d5[_0x9e49('0x1b')]+_0x2d16d5['limit'];var _0xeb4c05;if(_0x5e3bbc>=_0x2df3b5){_0x5e3bbc=_0x2df3b5;_0xeb4c05=0xc8;}else{_0xeb4c05=0xce;}_0x357cfa['status'](_0xeb4c05);return _0x357cfa[_0x9e49('0x1e')](_0x9e49('0x1f'),_0x456b58+'-'+_0x5e3bbc+'/'+_0x2df3b5)[_0x9e49('0x1a')](_0x31dab6);}return null;};}function patchUpdates(_0x5eaefa){return function(_0x2e2c71){try{jsonpatch['apply'](_0x2e2c71,_0x5eaefa,!![]);}catch(_0x4b480d){return BPromise[_0x9e49('0x20')](_0x4b480d);}return _0x2e2c71[_0x9e49('0x21')]();};}function saveUpdates(_0x51f8ac,_0xa9cd6f){return function(_0x19e63e){if(_0x19e63e){return _0x19e63e[_0x9e49('0x22')](_0x51f8ac)['then'](function(_0x2130b8){return _0x2130b8;});}return null;};}function removeEntity(_0x4a6171,_0x3211f9){return function(_0x1f627b){if(_0x1f627b){return _0x1f627b['destroy']()[_0x9e49('0x23')](function(){_0x4a6171[_0x9e49('0x18')](0xcc)[_0x9e49('0x19')]();});}};}function handleEntityNotFound(_0x31a706,_0x548778){return function(_0x277b77){if(!_0x277b77){_0x31a706['sendStatus'](0x194);}return _0x277b77;};}function handleError(_0x462d9a,_0x292569){_0x292569=_0x292569||0x1f4;return function(_0x428de9){logger['error'](_0x428de9['stack']);if(_0x428de9[_0x9e49('0x24')]){delete _0x428de9[_0x9e49('0x24')];}_0x462d9a[_0x9e49('0x18')](_0x292569)[_0x9e49('0x25')](_0x428de9);};}exports[_0x9e49('0x26')]=function(_0x139675,_0x50ef5a){var _0x561976={},_0xbc9903={},_0x9ca6af={'count':0x0,'rows':[]};var _0x35c96e=_[_0x9e49('0x27')](db['SquareDetailsReport'][_0x9e49('0x28')],function(_0x207900){return{'name':_0x207900[_0x9e49('0x29')],'type':_0x207900['type'][_0x9e49('0x2a')]};});_0xbc9903[_0x9e49('0x2b')]=_[_0x9e49('0x27')](_0x35c96e,_0x9e49('0x24'));_0xbc9903[_0x9e49('0x2c')]=_[_0x9e49('0x2d')](_0x139675[_0x9e49('0x2c')]);_0xbc9903[_0x9e49('0x2e')]=_[_0x9e49('0x2f')](_0xbc9903[_0x9e49('0x2b')],_0xbc9903[_0x9e49('0x2c')]);_0x561976['attributes']=_[_0x9e49('0x2f')](_0xbc9903[_0x9e49('0x2b')],qs[_0x9e49('0x30')](_0x139675[_0x9e49('0x2c')][_0x9e49('0x30')]));_0x561976[_0x9e49('0x31')]=_0x561976[_0x9e49('0x31')]['length']?_0x561976[_0x9e49('0x31')]:_0xbc9903['model'];if(!_0x139675[_0x9e49('0x2c')][_0x9e49('0x32')](_0x9e49('0x33'))){_0x561976[_0x9e49('0x34')]=qs['limit'](_0x139675[_0x9e49('0x2c')][_0x9e49('0x34')]);_0x561976[_0x9e49('0x1b')]=qs[_0x9e49('0x1b')](_0x139675['query'][_0x9e49('0x1b')]);}_0x561976[_0x9e49('0x35')]=qs[_0x9e49('0x36')](_0x139675['query']['sort']);_0x561976[_0x9e49('0x37')]=qs[_0x9e49('0x2e')](_[_0x9e49('0x38')](_0x139675[_0x9e49('0x2c')],_0xbc9903[_0x9e49('0x2e')]),_0x35c96e);if(_0x139675[_0x9e49('0x2c')]['filter']){_0x561976[_0x9e49('0x37')]=_[_0x9e49('0x39')](_0x561976['where'],{'$or':_['map'](_0x35c96e,function(_0x1e4e1d){if(_0x1e4e1d[_0x9e49('0x3a')]!==_0x9e49('0x3b')){var _0x39d09c={};_0x39d09c[_0x1e4e1d[_0x9e49('0x24')]]={'$like':'%'+_0x139675['query'][_0x9e49('0x3c')]+'%'};return _0x39d09c;}})});}_0x561976=_[_0x9e49('0x39')]({},_0x561976,_0x139675[_0x9e49('0x3d')]);var _0x5f4aec={'where':_0x561976[_0x9e49('0x37')]};return db[_0x9e49('0x3e')]['count'](_0x5f4aec)[_0x9e49('0x23')](function(_0x1b6e7f){_0x9ca6af['count']=_0x1b6e7f;if(_0x139675[_0x9e49('0x2c')][_0x9e49('0x3f')]){_0x561976[_0x9e49('0x40')]=[{'all':!![]}];}return db[_0x9e49('0x3e')][_0x9e49('0x41')](_0x561976);})[_0x9e49('0x23')](function(_0xabe71d){_0x9ca6af[_0x9e49('0x42')]=_0xabe71d;return _0x9ca6af;})[_0x9e49('0x23')](respondWithFilteredResult(_0x50ef5a,_0x561976))[_0x9e49('0x43')](handleError(_0x50ef5a,null));};exports[_0x9e49('0x44')]=function(_0x16b04a,_0x5aa5ac){var _0x2547ce={'raw':!![],'where':{'id':_0x16b04a[_0x9e49('0x45')]['id']}},_0x5eba35={};_0x5eba35[_0x9e49('0x2b')]=_[_0x9e49('0x2d')](db[_0x9e49('0x3e')][_0x9e49('0x28')]);_0x5eba35[_0x9e49('0x2c')]=_[_0x9e49('0x2d')](_0x16b04a[_0x9e49('0x2c')]);_0x5eba35['filters']=_[_0x9e49('0x2f')](_0x5eba35[_0x9e49('0x2b')],_0x5eba35[_0x9e49('0x2c')]);_0x2547ce[_0x9e49('0x31')]=_['intersection'](_0x5eba35['model'],qs[_0x9e49('0x30')](_0x16b04a[_0x9e49('0x2c')][_0x9e49('0x30')]));_0x2547ce[_0x9e49('0x31')]=_0x2547ce[_0x9e49('0x31')][_0x9e49('0x46')]?_0x2547ce[_0x9e49('0x31')]:_0x5eba35[_0x9e49('0x2b')];if(_0x16b04a[_0x9e49('0x2c')][_0x9e49('0x3f')]){_0x2547ce[_0x9e49('0x40')]=[{'all':!![]}];}_0x2547ce=_[_0x9e49('0x39')]({},_0x2547ce,_0x16b04a[_0x9e49('0x3d')]);return db['SquareDetailsReport'][_0x9e49('0x47')](_0x2547ce)[_0x9e49('0x23')](handleEntityNotFound(_0x5aa5ac,null))['then'](respondWithResult(_0x5aa5ac,null))[_0x9e49('0x43')](handleError(_0x5aa5ac,null));};exports['create']=function(_0x54dc14,_0x5c8777){return db[_0x9e49('0x3e')]['create'](_0x54dc14[_0x9e49('0x48')],{})[_0x9e49('0x23')](respondWithResult(_0x5c8777,0xc9))[_0x9e49('0x43')](handleError(_0x5c8777,null));};exports[_0x9e49('0x22')]=function(_0x1632f8,_0x4f7bf0){if(_0x1632f8[_0x9e49('0x48')]['id']){delete _0x1632f8[_0x9e49('0x48')]['id'];}return db[_0x9e49('0x3e')][_0x9e49('0x47')]({'where':{'id':_0x1632f8[_0x9e49('0x45')]['id']}})[_0x9e49('0x23')](handleEntityNotFound(_0x4f7bf0,null))[_0x9e49('0x23')](saveUpdates(_0x1632f8['body'],null))[_0x9e49('0x23')](respondWithResult(_0x4f7bf0,null))['catch'](handleError(_0x4f7bf0,null));};exports[_0x9e49('0x49')]=function(_0x49d233,_0x22b178){return db['SquareDetailsReport']['find']({'where':{'id':_0x49d233['params']['id']}})[_0x9e49('0x23')](handleEntityNotFound(_0x22b178,null))[_0x9e49('0x23')](removeEntity(_0x22b178,null))[_0x9e49('0x43')](handleError(_0x22b178,null));};exports['describe']=function(_0x24ef88,_0x6803d8){return db[_0x9e49('0x3e')]['describe']()[_0x9e49('0x23')](respondWithResult(_0x6803d8,null))[_0x9e49('0x43')](handleError(_0x6803d8,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b956053..8137c0a 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 _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 +var _0x9f0b=['./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x487537,_0x2e1bc7){var _0x49aa6e=function(_0x920988){while(--_0x920988){_0x487537['push'](_0x487537['shift']());}};_0x49aa6e(++_0x2e1bc7);}(_0x9f0b,0x1ee));var _0xb9f0=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x9f0b[_0xa990b7];return _0x52c99c;};'use strict';var _=require('lodash');var util=require(_0xb9f0('0x0'));var logger=require(_0xb9f0('0x1'))(_0xb9f0('0x2'));var moment=require(_0xb9f0('0x3'));var BPromise=require(_0xb9f0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb9f0('0x5'));var attributes=require(_0xb9f0('0x6'));module['exports']=function(_0x51be85,_0x46986d){return _0x51be85[_0xb9f0('0x7')](_0xb9f0('0x8'),attributes,{'tableName':_0xb9f0('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 001d4f3..cfb4710 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 _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 +var _0x8f4c=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x502376,_0x4bf302){var _0x4724f9=function(_0xe17f00){while(--_0xe17f00){_0x502376['push'](_0x502376['shift']());}};_0x4724f9(++_0x4bf302);}(_0x8f4c,0x113));var _0xc8f4=function(_0x46d02b,_0x32be3f){_0x46d02b=_0x46d02b-0x0;var _0x5c2ecc=_0x8f4c[_0x46d02b];return _0x5c2ecc;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![]})[_0xc8f4('0xb')](function(_0x5f3264){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5f3264));_0x4763c1(_0x5f3264);})[_0xc8f4('0x16')](function(_0xaeee7d){logger[_0xc8f4('0x11')]('CreateSquareDetailsReport',_0xaeee7d[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0xaeee7d[_0xc8f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ed90119..60da89a 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 _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 +var _0xb384=['express','get','index','isAuthenticated','killProcess'];(function(_0x4e7d34,_0x5261c5){var _0x106b88=function(_0x1bd89d){while(--_0x1bd89d){_0x4e7d34['push'](_0x4e7d34['shift']());}};_0x106b88(++_0x5261c5);}(_0xb384,0xc8));var _0x4b38=function(_0x4e9986,_0x1635f7){_0x4e9986=_0x4e9986-0x0;var _0x53fce2=_0xb384[_0x4e9986];return _0x53fce2;};'use strict';var express=require(_0x4b38('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x4b38('0x1')]('/',auth['isAuthenticated'](),controller[_0x4b38('0x2')]);router['get']('/process/:pid/kill',auth[_0x4b38('0x3')](),controller[_0x4b38('0x4')]);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 d9882a3..d7d2dcb 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 _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 +var _0xe19f=['catch','killProcess','components/import/cm','format','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','systeminformation','child_process','exec','api','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json'];(function(_0x51f21d,_0xef3ec0){var _0x1077c2=function(_0x1afc5f){while(--_0x1afc5f){_0x51f21d['push'](_0x51f21d['shift']());}};_0x1077c2(++_0xef3ec0);}(_0xe19f,0x169));var _0xfe19=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe19f[_0x19950b];return _0x3c6b41;};'use strict';var info=require(_0xfe19('0x0'));var exec=require(_0xfe19('0x1'))[_0xfe19('0x2')];var logger=require('../../config/logger')(_0xfe19('0x3'));var util=require('util');var BPromise=require(_0xfe19('0x4'));var _=require(_0xfe19('0x5'));function handleError(_0x135c68,_0x5726e9,_0x27e691){_0x5726e9=_0x5726e9||0x1f4;return function(_0x355c68){logger['error'](_0xfe19('0x6'),_0x27e691,_0x5726e9,util[_0xfe19('0x7')](_0x355c68,{'showHidden':![],'depth':null}));delete _0x355c68[_0xfe19('0x8')];_0x135c68[_0xfe19('0x9')](_0x5726e9)[_0xfe19('0xa')](_0x355c68);};}exports[_0xfe19('0xb')]=function(_0x2b9857,_0x4a9341){return info['getAllData']()[_0xfe19('0xc')](function(_0x54abaf){return _0x4a9341[_0xfe19('0x9')](0xc8)[_0xfe19('0xd')](_0x54abaf);})[_0xfe19('0xe')](function(_0x3b716e){return _0x4a9341[_0xfe19('0x9')](0x1f4)[_0xfe19('0xd')](_0x3b716e);});};exports[_0xfe19('0xf')]=function(_0x492f3f,_0x24dee8){var _0x1b3ef0=[_0xfe19('0x10')];return new BPromise(function(_0x5e41bf,_0xb5bc9a){return exec(util[_0xfe19('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x492f3f['params'][_0xfe19('0x12')]),function(_0x251cb9,_0x38f130,_0x20405c){if(_0x251cb9){return _0xb5bc9a(_0x251cb9);}return _0x5e41bf(_0x38f130);});})[_0xfe19('0xc')](function(_0x2d36d2){var _0x1dc570=![];var _0x2b9b60=_0x2d36d2[_0xfe19('0x13')](/\n/);for(var _0x55083e=0x0,_0x4a68d4=_0x1b3ef0[_0xfe19('0x14')];_0x55083e<_0x4a68d4,_0x1dc570===![];_0x55083e+=0x1){if(_0x2d36d2[_0xfe19('0x15')](_0x1b3ef0[_0x55083e])>=0x0){_0x1dc570=!![];}}if(!_0x1dc570){throw new Error(util[_0xfe19('0x11')](_0xfe19('0x16'),_0x492f3f[_0xfe19('0x17')][_0xfe19('0x12')]));}process['kill'](_0x492f3f[_0xfe19('0x17')][_0xfe19('0x12')],_0xfe19('0x18'));return _0x24dee8['status'](0xc8)['json']({'message':util[_0xfe19('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x492f3f[_0xfe19('0x17')][_0xfe19('0x12')])});})[_0xfe19('0xe')](handleError(_0x24dee8,null,_0xfe19('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index bb10a24..ea619d5 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 _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 +var _0x558c=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete'];(function(_0x12b09c,_0x235ce6){var _0x54b03e=function(_0x39cf0d){while(--_0x39cf0d){_0x12b09c['push'](_0x12b09c['shift']());}};_0x54b03e(++_0x235ce6);}(_0x558c,0xbc));var _0xc558=function(_0x3f2859,_0x41049b){_0x3f2859=_0x3f2859-0x0;var _0x54a661=_0x558c[_0x3f2859];return _0x54a661;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc558('0x0'));var timeout=require(_0xc558('0x1'));var express=require(_0xc558('0x2'));var router=express[_0xc558('0x3')]();var fs_extra=require(_0xc558('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc558('0x5'));var config=require('../../config/environment');var controller=require(_0xc558('0x6'));router['get']('/',auth[_0xc558('0x7')](),controller[_0xc558('0x8')]);router[_0xc558('0x9')](_0xc558('0xa'),auth[_0xc558('0x7')](),controller[_0xc558('0xb')]);router[_0xc558('0xc')]('/',auth[_0xc558('0x7')](),controller['create']);router[_0xc558('0xd')]('/:id',auth[_0xc558('0x7')](),controller[_0xc558('0xe')]);router[_0xc558('0xf')](_0xc558('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc558('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0c986da..faf9b4f 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 _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 +var _0x8c50=['#0091EA','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8c50,0xcd));var _0x08c5=function(_0x43ba2e,_0x32253d){_0x43ba2e=_0x43ba2e-0x0;var _0x377348=_0x8c50[_0x43ba2e];return _0x377348;};'use strict';var Sequelize=require('sequelize');module[_0x08c5('0x0')]={'name':{'type':Sequelize[_0x08c5('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x08c5('0x1')],'defaultValue':_0x08c5('0x2')},'description':{'type':Sequelize[_0x08c5('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5d56933..2a12090 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 _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 +var _0x6c76=['to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','apply','reject','save','then','destroy','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path'];(function(_0x5442a5,_0x4110f1){var _0x130af0=function(_0x457ec2){while(--_0x457ec2){_0x5442a5['push'](_0x5442a5['shift']());}};_0x130af0(++_0x4110f1);}(_0x6c76,0x184));var _0x66c7=function(_0xecdc7c,_0x197f32){_0xecdc7c=_0xecdc7c-0x0;var _0x4a7142=_0x6c76[_0xecdc7c];return _0x4a7142;};'use strict';var emlformat=require(_0x66c7('0x0'));var rimraf=require(_0x66c7('0x1'));var zipdir=require(_0x66c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66c7('0x5'));var path=require(_0x66c7('0x6'));var sox=require('sox');var csv=require(_0x66c7('0x7'));var ejs=require(_0x66c7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x7'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];function respondWithStatusCode(_0x5176a3,_0x18c309){_0x18c309=_0x18c309||0xcc;return function(_0x760e36){if(_0x760e36){return _0x5176a3[_0x66c7('0x17')](_0x18c309);}return _0x5176a3[_0x66c7('0x18')](_0x18c309)[_0x66c7('0x19')]();};}function respondWithResult(_0x1e91d1,_0x618bd7){_0x618bd7=_0x618bd7||0xc8;return function(_0xf3b04){if(_0xf3b04){return _0x1e91d1[_0x66c7('0x18')](_0x618bd7)['json'](_0xf3b04);}};}function respondWithFilteredResult(_0x110f6d,_0x4dd902){return function(_0x208010){if(_0x208010){var _0x39f951=typeof _0x4dd902[_0x66c7('0x1a')]===_0x66c7('0x1b')&&typeof _0x4dd902[_0x66c7('0x1c')]==='undefined';var _0x5cf913=_0x208010['count'];var _0x5129f6=_0x39f951?0x0:_0x4dd902[_0x66c7('0x1a')];var _0x19f29d=_0x39f951?_0x208010['count']:_0x4dd902['offset']+_0x4dd902[_0x66c7('0x1c')];var _0x9b65cf;if(_0x19f29d>=_0x5cf913){_0x19f29d=_0x5cf913;_0x9b65cf=0xc8;}else{_0x9b65cf=0xce;}_0x110f6d[_0x66c7('0x18')](_0x9b65cf);return _0x110f6d[_0x66c7('0x1d')]('Content-Range',_0x5129f6+'-'+_0x19f29d+'/'+_0x5cf913)['json'](_0x208010);}return null;};}function patchUpdates(_0x1853b2){return function(_0x237177){try{jsonpatch[_0x66c7('0x1e')](_0x237177,_0x1853b2,!![]);}catch(_0x1c43c4){return BPromise[_0x66c7('0x1f')](_0x1c43c4);}return _0x237177[_0x66c7('0x20')]();};}function saveUpdates(_0x4804cf,_0x4ddbd2){return function(_0x366e9b){if(_0x366e9b){return _0x366e9b['update'](_0x4804cf)[_0x66c7('0x21')](function(_0x8b96b1){return _0x8b96b1;});}return null;};}function removeEntity(_0x44bdef,_0x1fc9d3){return function(_0x5bfaf6){if(_0x5bfaf6){return _0x5bfaf6[_0x66c7('0x22')]()[_0x66c7('0x21')](function(){var _0x5b28e6=_0x5bfaf6[_0x66c7('0x23')]({'plain':!![]});var _0x11a6b9=_0x66c7('0x24');return db[_0x66c7('0x25')][_0x66c7('0x22')]({'where':{'type':_0x11a6b9,'resourceId':_0x5b28e6['id']}})['then'](function(){return _0x5bfaf6;});})['then'](function(){_0x44bdef['status'](0xcc)[_0x66c7('0x19')]();});}};}function handleEntityNotFound(_0x542ff1,_0x5c5e42){return function(_0x9afd50){if(!_0x9afd50){_0x542ff1[_0x66c7('0x17')](0x194);}return _0x9afd50;};}function handleError(_0x205b7e,_0xb4b65b){_0xb4b65b=_0xb4b65b||0x1f4;return function(_0x36a830){logger[_0x66c7('0x26')](_0x36a830['stack']);if(_0x36a830[_0x66c7('0x27')]){delete _0x36a830[_0x66c7('0x27')];}_0x205b7e[_0x66c7('0x18')](_0xb4b65b)[_0x66c7('0x28')](_0x36a830);};}exports[_0x66c7('0x29')]=function(_0x592f0e,_0x263b48){var _0x4f1a34={},_0xfbd97={},_0x543fbf={'count':0x0,'rows':[]};var _0x296875=_[_0x66c7('0x2a')](db[_0x66c7('0x2b')][_0x66c7('0x2c')],function(_0xb26028){return{'name':_0xb26028[_0x66c7('0x2d')],'type':_0xb26028['type']['key']};});_0xfbd97[_0x66c7('0x2e')]=_[_0x66c7('0x2a')](_0x296875,_0x66c7('0x27'));_0xfbd97[_0x66c7('0x2f')]=_[_0x66c7('0x30')](_0x592f0e[_0x66c7('0x2f')]);_0xfbd97[_0x66c7('0x31')]=_[_0x66c7('0x32')](_0xfbd97[_0x66c7('0x2e')],_0xfbd97[_0x66c7('0x2f')]);_0x4f1a34[_0x66c7('0x33')]=_[_0x66c7('0x32')](_0xfbd97['model'],qs['fields'](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x34')]));_0x4f1a34[_0x66c7('0x33')]=_0x4f1a34[_0x66c7('0x33')][_0x66c7('0x35')]?_0x4f1a34[_0x66c7('0x33')]:_0xfbd97[_0x66c7('0x2e')];if(!_0x592f0e['query'][_0x66c7('0x36')](_0x66c7('0x37'))){_0x4f1a34[_0x66c7('0x1c')]=qs[_0x66c7('0x1c')](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x1c')]);_0x4f1a34[_0x66c7('0x1a')]=qs[_0x66c7('0x1a')](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x1a')]);}_0x4f1a34[_0x66c7('0x38')]=qs['sort'](_0x592f0e['query'][_0x66c7('0x39')]);_0x4f1a34[_0x66c7('0x3a')]=qs[_0x66c7('0x31')](_['pick'](_0x592f0e['query'],_0xfbd97[_0x66c7('0x31')]),_0x296875);if(_0x592f0e[_0x66c7('0x2f')]['filter']){_0x4f1a34[_0x66c7('0x3a')]=_[_0x66c7('0x3b')](_0x4f1a34[_0x66c7('0x3a')],{'$or':_['map'](_0x296875,function(_0x20374a){if(_0x20374a[_0x66c7('0x3c')]!==_0x66c7('0x3d')){var _0x14d59c={};_0x14d59c[_0x20374a[_0x66c7('0x27')]]={'$like':'%'+_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x3e')]+'%'};return _0x14d59c;}})});}_0x4f1a34=_[_0x66c7('0x3b')]({},_0x4f1a34,_0x592f0e[_0x66c7('0x3f')]);var _0x5f34ed={'where':_0x4f1a34[_0x66c7('0x3a')]};return db[_0x66c7('0x2b')][_0x66c7('0x40')](_0x5f34ed)[_0x66c7('0x21')](function(_0x3f169e){_0x543fbf[_0x66c7('0x40')]=_0x3f169e;if(_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x41')]){_0x4f1a34[_0x66c7('0x42')]=[{'all':!![]}];}return db[_0x66c7('0x2b')]['findAll'](_0x4f1a34);})['then'](function(_0x528f5c){_0x543fbf[_0x66c7('0x43')]=_0x528f5c;return _0x543fbf;})[_0x66c7('0x21')](respondWithFilteredResult(_0x263b48,_0x4f1a34))['catch'](handleError(_0x263b48,null));};exports['show']=function(_0x34d002,_0x3cd3ab){var _0x44d637={'raw':!![],'where':{'id':_0x34d002[_0x66c7('0x44')]['id']}},_0x900ee7={};_0x900ee7['model']=_[_0x66c7('0x30')](db['Tag']['rawAttributes']);_0x900ee7[_0x66c7('0x2f')]=_[_0x66c7('0x30')](_0x34d002[_0x66c7('0x2f')]);_0x900ee7[_0x66c7('0x31')]=_['intersection'](_0x900ee7['model'],_0x900ee7[_0x66c7('0x2f')]);_0x44d637['attributes']=_['intersection'](_0x900ee7[_0x66c7('0x2e')],qs[_0x66c7('0x34')](_0x34d002[_0x66c7('0x2f')][_0x66c7('0x34')]));_0x44d637['attributes']=_0x44d637[_0x66c7('0x33')][_0x66c7('0x35')]?_0x44d637[_0x66c7('0x33')]:_0x900ee7['model'];if(_0x34d002[_0x66c7('0x2f')][_0x66c7('0x41')]){_0x44d637[_0x66c7('0x42')]=[{'all':!![]}];}_0x44d637=_[_0x66c7('0x3b')]({},_0x44d637,_0x34d002[_0x66c7('0x3f')]);return db[_0x66c7('0x2b')][_0x66c7('0x45')](_0x44d637)[_0x66c7('0x21')](handleEntityNotFound(_0x3cd3ab,null))['then'](respondWithResult(_0x3cd3ab,null))[_0x66c7('0x46')](handleError(_0x3cd3ab,null));};exports[_0x66c7('0x47')]=function(_0x23d0eb,_0x1386a2){return db[_0x66c7('0x2b')][_0x66c7('0x47')](_0x23d0eb[_0x66c7('0x48')],{})[_0x66c7('0x21')](function(_0x1b3dc2){var _0x2d8eeb=_0x23d0eb[_0x66c7('0x49')][_0x66c7('0x23')]({'plain':!![]});if(!_0x2d8eeb)throw new Error(_0x66c7('0x4a'));if(_0x2d8eeb[_0x66c7('0x4b')]==='user'){var _0x43d4db=_0x1b3dc2[_0x66c7('0x23')]({'plain':!![]});var _0x27070b=_0x66c7('0x24');return db['UserProfileSection'][_0x66c7('0x45')]({'where':{'name':_0x27070b,'userProfileId':_0x2d8eeb[_0x66c7('0x4c')]},'raw':!![]})['then'](function(_0x275a20){if(_0x275a20&&_0x275a20[_0x66c7('0x4d')]===0x0){return db[_0x66c7('0x25')][_0x66c7('0x47')]({'name':_0x43d4db[_0x66c7('0x27')],'resourceId':_0x43d4db['id'],'type':_0x275a20[_0x66c7('0x27')],'sectionId':_0x275a20['id']},{})[_0x66c7('0x21')](function(){return _0x1b3dc2;});}else{return _0x1b3dc2;}})['catch'](function(_0x933dd6){logger[_0x66c7('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x933dd6);throw _0x933dd6;});}return _0x1b3dc2;})[_0x66c7('0x21')](respondWithResult(_0x1386a2,0xc9))[_0x66c7('0x46')](handleError(_0x1386a2,null));};exports[_0x66c7('0x4e')]=function(_0x5df6d1,_0x382a48){if(_0x5df6d1[_0x66c7('0x48')]['id']){delete _0x5df6d1[_0x66c7('0x48')]['id'];}return db[_0x66c7('0x2b')][_0x66c7('0x45')]({'where':{'id':_0x5df6d1[_0x66c7('0x44')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x382a48,null))[_0x66c7('0x21')](saveUpdates(_0x5df6d1['body'],null))[_0x66c7('0x21')](respondWithResult(_0x382a48,null))[_0x66c7('0x46')](handleError(_0x382a48,null));};exports['destroy']=function(_0x23f865,_0x167968){return db[_0x66c7('0x2b')]['find']({'where':{'id':_0x23f865['params']['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x167968,null))['then'](removeEntity(_0x167968,null))[_0x66c7('0x46')](handleError(_0x167968,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9dcc510..9ff2439 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 _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 +var _0xf7b4=['define','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0xf7b4,0x16e));var _0x4f7b=function(_0x2722bc,_0x221dd9){_0x2722bc=_0x2722bc-0x0;var _0x5ac515=_0xf7b4[_0x2722bc];return _0x5ac515;};'use strict';var _=require(_0x4f7b('0x0'));var util=require(_0x4f7b('0x1'));var logger=require(_0x4f7b('0x2'))(_0x4f7b('0x3'));var moment=require(_0x4f7b('0x4'));var BPromise=require(_0x4f7b('0x5'));var rp=require(_0x4f7b('0x6'));var fs=require('fs');var path=require(_0x4f7b('0x7'));var rimraf=require(_0x4f7b('0x8'));var config=require(_0x4f7b('0x9'));var attributes=require(_0x4f7b('0xa'));module[_0x4f7b('0xb')]=function(_0x11171c,_0x30717b){return _0x11171c[_0x4f7b('0xc')]('Tag',attributes,{'tableName':_0x4f7b('0xd'),'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 0a501c5..d9578ea 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 _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 +var _0x07c3=['code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x07c3,0x1bf));var _0x307c=function(_0x395667,_0x45593a){_0x395667=_0x395667-0x0;var _0x5cdb8f=_0x07c3[_0x395667];return _0x5cdb8f;};'use strict';var _=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var moment=require(_0x307c('0x2'));var BPromise=require(_0x307c('0x3'));var rs=require(_0x307c('0x4'));var fs=require('fs');var Redis=require(_0x307c('0x5'));var db=require(_0x307c('0x6'))['db'];var utils=require(_0x307c('0x7'));var logger=require('../../config/logger')(_0x307c('0x8'));var config=require(_0x307c('0x9'));var jayson=require(_0x307c('0xa'));var client=jayson[_0x307c('0xb')][_0x307c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x410ae8,_0x39af52,_0x3f5d08){return new BPromise(function(_0xfb14bf,_0x166467){return client[_0x307c('0xd')](_0x410ae8,_0x3f5d08)[_0x307c('0xe')](function(_0x1af97f){logger[_0x307c('0xf')](_0x307c('0x10'),_0x39af52,'request\x20sent');logger[_0x307c('0x11')](_0x307c('0x12'),_0x39af52,_0x307c('0x13'),JSON[_0x307c('0x14')](_0x1af97f));if(_0x1af97f['error']){if(_0x1af97f['error'][_0x307c('0x15')]===0x1f4){logger['error'](_0x307c('0x10'),_0x39af52,_0x1af97f[_0x307c('0x16')]['message']);return _0x166467(_0x1af97f[_0x307c('0x16')][_0x307c('0x17')]);}logger[_0x307c('0x16')](_0x307c('0x10'),_0x39af52,_0x1af97f[_0x307c('0x16')][_0x307c('0x17')]);return _0xfb14bf(_0x1af97f[_0x307c('0x16')][_0x307c('0x17')]);}else{logger[_0x307c('0xf')](_0x307c('0x10'),_0x39af52,_0x307c('0x13'));_0xfb14bf(_0x1af97f[_0x307c('0x18')]['message']);}})[_0x307c('0x19')](function(_0x364441){logger[_0x307c('0x16')](_0x307c('0x10'),_0x39af52,_0x364441);_0x166467(_0x364441);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index dc42e49..c6ca3c7 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(_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 +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 fd2f59f..203e174 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 _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 +var _0x2032=['name','exports','STRING'];(function(_0x2a8321,_0x180b7c){var _0x274e75=function(_0x111f7c){while(--_0x111f7c){_0x2a8321['push'](_0x2a8321['shift']());}};_0x274e75(++_0x180b7c);}(_0x2032,0xd9));var _0x2203=function(_0x31d231,_0x1be633){_0x31d231=_0x31d231-0x0;var _0x440bff=_0x2032[_0x31d231];return _0x440bff;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 9483ace..6b172ac 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 _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 +var _0x8dd8=['Queue','findOne','add','removeQueues','ids','addAgents','isArray','Voice','Chat','Sms','Whatsapp','through','penalty','Queues','QueueId','TeamVoiceQueue','User','findOrCreate','findAll','online','voicePause','interface','upsert','format','SIP/%s','all','spread','removeAgents','transaction','Queue:remove','UserVoiceQueueRt','getAgents','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./team.socket','register','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','Team','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','includeAll','find','create','body','user','get','role','Teams','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','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','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase'];(function(_0x2dea5e,_0x1e4c75){var _0x4e7c1c=function(_0x233244){while(--_0x233244){_0x2dea5e['push'](_0x2dea5e['shift']());}};_0x4e7c1c(++_0x1e4c75);}(_0x8dd8,0xb2));var _0x88dd=function(_0x24210a,_0x2c5597){_0x24210a=_0x24210a-0x0;var _0x248eab=_0x8dd8[_0x24210a];return _0x248eab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x88dd('0x0'));var jsonpatch=require(_0x88dd('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x88dd('0x2'));var util=require(_0x88dd('0x3'));var path=require(_0x88dd('0x4'));var sox=require(_0x88dd('0x5'));var csv=require(_0x88dd('0x6'));var ejs=require(_0x88dd('0x7'));var fs=require('fs');var fs_extra=require(_0x88dd('0x8'));var _=require('lodash');var squel=require(_0x88dd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x88dd('0xa'));var toCsv=require(_0x88dd('0x6'));var querystring=require(_0x88dd('0xb'));var Papa=require(_0x88dd('0xc'));var Redis=require('ioredis');var authService=require(_0x88dd('0xd'));var qs=require(_0x88dd('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x88dd('0xf'))('api');var utils=require(_0x88dd('0x10'));var config=require(_0x88dd('0x11'));var licenseUtil=require(_0x88dd('0x12'));var db=require(_0x88dd('0x13'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x88dd('0x14'),'port':0x18eb});var socket=require(_0x88dd('0x15'))(new Redis(config[_0x88dd('0x16')]));require(_0x88dd('0x17'))[_0x88dd('0x18')](socket);function respondWithStatusCode(_0x4c5640,_0xa43322){_0xa43322=_0xa43322||0xcc;return function(_0x410659){if(_0x410659){return _0x4c5640[_0x88dd('0x19')](_0xa43322);}return _0x4c5640['status'](_0xa43322)[_0x88dd('0x1a')]();};}function respondWithResult(_0x5490c2,_0x3e6250){_0x3e6250=_0x3e6250||0xc8;return function(_0x1a0eed){if(_0x1a0eed){return _0x5490c2[_0x88dd('0x1b')](_0x3e6250)['json'](_0x1a0eed);}};}function respondWithFilteredResult(_0x478dfe,_0x409a0a){return function(_0x445efe){if(_0x445efe){var _0x208f44=typeof _0x409a0a['offset']===_0x88dd('0x1c')&&typeof _0x409a0a['limit']===_0x88dd('0x1c');var _0x4a5c1c=_0x445efe[_0x88dd('0x1d')];var _0x351684=_0x208f44?0x0:_0x409a0a[_0x88dd('0x1e')];var _0x5b01da=_0x208f44?_0x445efe[_0x88dd('0x1d')]:_0x409a0a[_0x88dd('0x1e')]+_0x409a0a[_0x88dd('0x1f')];var _0x17c440;if(_0x5b01da>=_0x4a5c1c){_0x5b01da=_0x4a5c1c;_0x17c440=0xc8;}else{_0x17c440=0xce;}_0x478dfe[_0x88dd('0x1b')](_0x17c440);return _0x478dfe[_0x88dd('0x20')](_0x88dd('0x21'),_0x351684+'-'+_0x5b01da+'/'+_0x4a5c1c)[_0x88dd('0x22')](_0x445efe);}return null;};}function patchUpdates(_0x539cd4){return function(_0x4609ce){try{jsonpatch[_0x88dd('0x23')](_0x4609ce,_0x539cd4,!![]);}catch(_0x5264b3){return BPromise[_0x88dd('0x24')](_0x5264b3);}return _0x4609ce[_0x88dd('0x25')]();};}function saveUpdates(_0x1453ad,_0x571ac6){return function(_0x4028d0){if(_0x4028d0){return _0x4028d0[_0x88dd('0x26')](_0x1453ad)[_0x88dd('0x27')](function(_0xc9b40d){return _0xc9b40d;});}return null;};}function handleEntityNotFound(_0xd34d0c,_0x1a2131){return function(_0x39ccba){if(!_0x39ccba){_0xd34d0c['sendStatus'](0x194);}return _0x39ccba;};}function handleError(_0x3492b9,_0x175f5e){_0x175f5e=_0x175f5e||0x1f4;return function(_0x466eda){logger[_0x88dd('0x28')](_0x466eda['stack']);if(_0x466eda[_0x88dd('0x29')]){delete _0x466eda[_0x88dd('0x29')];}_0x3492b9[_0x88dd('0x1b')](_0x175f5e)[_0x88dd('0x2a')](_0x466eda);};}exports[_0x88dd('0x2b')]=function(_0x25fa09,_0x26f008){var _0xf60931={},_0xdd9985={},_0x61c45e={'count':0x0,'rows':[]};var _0xd508a9=_[_0x88dd('0x2c')](db[_0x88dd('0x2d')]['rawAttributes'],function(_0x2ab924){return{'name':_0x2ab924[_0x88dd('0x2e')],'type':_0x2ab924[_0x88dd('0x2f')]['key']};});_0xdd9985['model']=_[_0x88dd('0x2c')](_0xd508a9,_0x88dd('0x29'));_0xdd9985[_0x88dd('0x30')]=_[_0x88dd('0x31')](_0x25fa09['query']);_0xdd9985[_0x88dd('0x32')]=_[_0x88dd('0x33')](_0xdd9985[_0x88dd('0x34')],_0xdd9985['query']);_0xf60931['attributes']=_[_0x88dd('0x33')](_0xdd9985['model'],qs[_0x88dd('0x35')](_0x25fa09[_0x88dd('0x30')][_0x88dd('0x35')]));_0xf60931[_0x88dd('0x36')]=_0xf60931['attributes'][_0x88dd('0x37')]?_0xf60931[_0x88dd('0x36')]:_0xdd9985[_0x88dd('0x34')];if(!_0x25fa09[_0x88dd('0x30')][_0x88dd('0x38')](_0x88dd('0x39'))){_0xf60931[_0x88dd('0x1f')]=qs['limit'](_0x25fa09[_0x88dd('0x30')][_0x88dd('0x1f')]);_0xf60931[_0x88dd('0x1e')]=qs['offset'](_0x25fa09[_0x88dd('0x30')][_0x88dd('0x1e')]);}_0xf60931[_0x88dd('0x3a')]=qs[_0x88dd('0x3b')](_0x25fa09[_0x88dd('0x30')][_0x88dd('0x3b')]);_0xf60931[_0x88dd('0x3c')]=qs[_0x88dd('0x32')](_[_0x88dd('0x3d')](_0x25fa09[_0x88dd('0x30')],_0xdd9985['filters']),_0xd508a9);if(_0x25fa09['query']['filter']){_0xf60931[_0x88dd('0x3c')]=_[_0x88dd('0x3e')](_0xf60931[_0x88dd('0x3c')],{'$or':_[_0x88dd('0x2c')](_0xd508a9,function(_0x515bba){if(_0x515bba[_0x88dd('0x2f')]!==_0x88dd('0x3f')){var _0x57d744={};_0x57d744[_0x515bba[_0x88dd('0x29')]]={'$like':'%'+_0x25fa09['query'][_0x88dd('0x40')]+'%'};return _0x57d744;}})});}_0xf60931=_[_0x88dd('0x3e')]({},_0xf60931,_0x25fa09[_0x88dd('0x41')]);var _0x28c181={'where':_0xf60931[_0x88dd('0x3c')]};return db['Team']['count'](_0x28c181)[_0x88dd('0x27')](function(_0x49232d){_0x61c45e[_0x88dd('0x1d')]=_0x49232d;if(_0x25fa09[_0x88dd('0x30')]['includeAll']){_0xf60931[_0x88dd('0x42')]=[{'all':!![]}];}return db['Team']['findAll'](_0xf60931);})[_0x88dd('0x27')](function(_0x59d472){_0x61c45e[_0x88dd('0x43')]=_0x59d472;return _0x61c45e;})[_0x88dd('0x27')](respondWithFilteredResult(_0x26f008,_0xf60931))['catch'](handleError(_0x26f008,null));};exports[_0x88dd('0x44')]=function(_0x5611c2,_0x18f364){var _0x3fa77e={'raw':![],'where':{'id':_0x5611c2[_0x88dd('0x45')]['id']}},_0x4aad74={};_0x4aad74['model']=_[_0x88dd('0x31')](db[_0x88dd('0x2d')][_0x88dd('0x46')]);_0x4aad74[_0x88dd('0x30')]=_['keys'](_0x5611c2['query']);_0x4aad74[_0x88dd('0x32')]=_[_0x88dd('0x33')](_0x4aad74['model'],_0x4aad74[_0x88dd('0x30')]);_0x3fa77e[_0x88dd('0x36')]=_[_0x88dd('0x33')](_0x4aad74[_0x88dd('0x34')],qs[_0x88dd('0x35')](_0x5611c2[_0x88dd('0x30')][_0x88dd('0x35')]));_0x3fa77e[_0x88dd('0x36')]=_0x3fa77e[_0x88dd('0x36')][_0x88dd('0x37')]?_0x3fa77e[_0x88dd('0x36')]:_0x4aad74['model'];if(_0x5611c2[_0x88dd('0x30')][_0x88dd('0x47')]){_0x3fa77e['include']=[{'all':!![]}];}_0x3fa77e=_[_0x88dd('0x3e')]({},_0x3fa77e,_0x5611c2[_0x88dd('0x41')]);return db[_0x88dd('0x2d')][_0x88dd('0x48')](_0x3fa77e)[_0x88dd('0x27')](handleEntityNotFound(_0x18f364,null))[_0x88dd('0x27')](respondWithResult(_0x18f364,null))['catch'](handleError(_0x18f364,null));};exports[_0x88dd('0x49')]=function(_0x32994e,_0x1d4a45){return db[_0x88dd('0x2d')][_0x88dd('0x49')](_0x32994e[_0x88dd('0x4a')],{})['then'](function(_0xbae55b){var _0x3a9c7c=_0x32994e[_0x88dd('0x4b')][_0x88dd('0x4c')]({'plain':!![]});if(!_0x3a9c7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a9c7c[_0x88dd('0x4d')]===_0x88dd('0x4b')){var _0x5ba143=_0xbae55b['get']({'plain':!![]});var _0x236abf=_0x88dd('0x4e');return db['UserProfileSection'][_0x88dd('0x48')]({'where':{'name':_0x236abf,'userProfileId':_0x3a9c7c['userProfileId']},'raw':!![]})[_0x88dd('0x27')](function(_0x34f5b7){if(_0x34f5b7&&_0x34f5b7[_0x88dd('0x4f')]===0x0){return db[_0x88dd('0x50')][_0x88dd('0x49')]({'name':_0x5ba143['name'],'resourceId':_0x5ba143['id'],'type':_0x34f5b7[_0x88dd('0x29')],'sectionId':_0x34f5b7['id']},{})[_0x88dd('0x27')](function(){return _0xbae55b;});}else{return _0xbae55b;}})[_0x88dd('0x51')](function(_0x2f56fa){logger[_0x88dd('0x28')](_0x88dd('0x52'),_0x2f56fa);throw _0x2f56fa;});}return _0xbae55b;})['then'](respondWithResult(_0x1d4a45,0xc9))['catch'](handleError(_0x1d4a45,null));};exports[_0x88dd('0x26')]=function(_0x10cf68,_0x543a68){if(_0x10cf68[_0x88dd('0x4a')]['id']){delete _0x10cf68[_0x88dd('0x4a')]['id'];}return db[_0x88dd('0x2d')][_0x88dd('0x48')]({'where':{'id':_0x10cf68[_0x88dd('0x45')]['id']}})[_0x88dd('0x27')](handleEntityNotFound(_0x543a68,null))[_0x88dd('0x27')](saveUpdates(_0x10cf68['body'],null))[_0x88dd('0x27')](respondWithResult(_0x543a68,null))[_0x88dd('0x51')](handleError(_0x543a68,null));};exports[_0x88dd('0x53')]=function(_0x46756e,_0x530594){var _0x17cab9=_0x46756e[_0x88dd('0x45')]['id'];var _0x506950=[];return db[_0x88dd('0x54')]['transaction'](function(_0x727169){var _0x27a108=_0x88dd('0x55')+_0x17cab9;return db[_0x88dd('0x54')]['query'](_0x27a108,{'type':db[_0x88dd('0x56')][_0x88dd('0x57')]['SELECT'],'raw':!![],'transaction':_0x727169})['then'](function(_0x15a68f){_0x506950=_[_0x88dd('0x2c')](_0x15a68f,function(_0x2f68be){return Number(_0x2f68be['UserId']);});})['then'](function(){var _0x14926e='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17cab9;return db['sequelize'][_0x88dd('0x30')](_0x14926e,{'type':db[_0x88dd('0x56')][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x2a63d4){var _0x4effa2=_[_0x88dd('0x2c')](_0x2a63d4,function(_0x4208fe){return Number(_0x4208fe[_0x88dd('0x59')]);});return db[_0x88dd('0x5a')][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'VoiceQueueId':{'$in':_0x4effa2}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){var _0x454efd=_0x88dd('0x5b')+_0x17cab9;return db['sequelize'][_0x88dd('0x30')](_0x454efd,{'type':db[_0x88dd('0x56')][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x40d1a4){var _0x58b05e=_[_0x88dd('0x2c')](_0x40d1a4,function(_0x2c9831){return Number(_0x2c9831[_0x88dd('0x5c')]);});return db[_0x88dd('0x5d')][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'MailQueueId':{'$in':_0x58b05e}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){var _0x9831a7=_0x88dd('0x5e')+_0x17cab9;return db[_0x88dd('0x54')][_0x88dd('0x30')](_0x9831a7,{'type':db[_0x88dd('0x56')][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x4a1423){var _0x1d821e=_[_0x88dd('0x2c')](_0x4a1423,function(_0x47fe49){return Number(_0x47fe49[_0x88dd('0x5f')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x506950},'SmsQueueId':{'$in':_0x1d821e}},'transaction':_0x727169});})['then'](function(){var _0x36e643=_0x88dd('0x60')+_0x17cab9;return db['sequelize']['query'](_0x36e643,{'type':db[_0x88dd('0x56')][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x476462){var _0xebdca=_[_0x88dd('0x2c')](_0x476462,function(_0x25a676){return Number(_0x25a676['ChatQueueId']);});return db[_0x88dd('0x61')]['destroy']({'where':{'UserId':{'$in':_0x506950},'ChatQueueId':{'$in':_0xebdca}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){var _0x92fb96=_0x88dd('0x62')+_0x17cab9;return db['sequelize'][_0x88dd('0x30')](_0x92fb96,{'type':db['Sequelize']['QueryTypes'][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x89e347){var _0x4db659=_[_0x88dd('0x2c')](_0x89e347,function(_0x820681){return Number(_0x820681['FaxQueueId']);});return db[_0x88dd('0x63')][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'FaxQueueId':{'$in':_0x4db659}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){var _0x5565e5=_0x88dd('0x64')+_0x17cab9;return db[_0x88dd('0x54')][_0x88dd('0x30')](_0x5565e5,{'type':db['Sequelize'][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x276be0){var _0x1fca80=_['map'](_0x276be0,function(_0x4ce9d8){return Number(_0x4ce9d8[_0x88dd('0x65')]);});return db['UserOpenchannelQueue'][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'OpenchannelQueueId':{'$in':_0x1fca80}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){var _0x57371e=_0x88dd('0x66')+_0x17cab9;return db[_0x88dd('0x54')][_0x88dd('0x30')](_0x57371e,{'type':db['Sequelize'][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x10aecb){var _0x393d93=_[_0x88dd('0x2c')](_0x10aecb,function(_0x39d804){return Number(_0x39d804[_0x88dd('0x67')]);});return db[_0x88dd('0x68')][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'WhatsappQueueId':{'$in':_0x393d93}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){return db[_0x88dd('0x69')][_0x88dd('0x48')]({'where':{'TeamId':_0x17cab9}});})[_0x88dd('0x27')](function(_0x353938){if(_0x353938===null){return;}return db[_0x88dd('0x6a')][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'VoicePrefixId':_0x353938[_0x88dd('0x6b')]},'transaction':_0x727169});})[_0x88dd('0x27')](function(){return db['Team'][_0x88dd('0x53')]({'where':{'id':_0x17cab9},'cascade':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x32ee1b){if(_0x32ee1b===0x0){_0x530594['sendStatus'](0x194);}else{return db[_0x88dd('0x50')][_0x88dd('0x53')]({'where':{'type':_0x88dd('0x4e'),'resourceId':_0x17cab9},'cascade':!![],'transaction':_0x727169})[_0x88dd('0x27')](function(){_0x530594[_0x88dd('0x1b')](0xcc)[_0x88dd('0x1a')]();});}})[_0x88dd('0x51')](function(_0x3d12d8){_0x530594[_0x88dd('0x1b')](0x1f4)[_0x88dd('0x2a')](_0x3d12d8);});});};exports['getQueues']=function(_0x485c0a,_0x3de463,_0x4d74b6){return db['Team']['findOne']({'where':{'id':_0x485c0a[_0x88dd('0x45')]['id']}})[_0x88dd('0x27')](handleEntityNotFound(_0x3de463,null))['then'](function(_0x2d2faf){if(!_0x485c0a[_0x88dd('0x30')][_0x88dd('0x6c')]||!utils[_0x88dd('0x6d')](_0x485c0a[_0x88dd('0x30')][_0x88dd('0x6c')])){throw new db['Sequelize'][(_0x88dd('0x6e'))](_0x88dd('0x6f'));}var _0x567696={};var _0x3d5c08={};_0x3d5c08[_0x88dd('0x34')]=_[_0x88dd('0x31')](db[_[_0x88dd('0x70')](_0x485c0a[_0x88dd('0x30')][_0x88dd('0x6c')][_0x88dd('0x71')]())+_0x88dd('0x72')][_0x88dd('0x46')]);_0x3d5c08['query']=_['keys'](_0x485c0a['query']);_0x3d5c08[_0x88dd('0x32')]=_['intersection'](_0x3d5c08[_0x88dd('0x34')],_0x3d5c08[_0x88dd('0x30')]);_0x567696[_0x88dd('0x36')]=_[_0x88dd('0x33')](_0x3d5c08[_0x88dd('0x34')],qs[_0x88dd('0x35')](_0x485c0a[_0x88dd('0x30')]['fields']));_0x567696[_0x88dd('0x36')]=_0x567696[_0x88dd('0x36')][_0x88dd('0x37')]?_0x567696[_0x88dd('0x36')]:_0x3d5c08[_0x88dd('0x34')];_0x567696[_0x88dd('0x1f')]=qs['limit'](_0x485c0a['query'][_0x88dd('0x1f')]);_0x567696[_0x88dd('0x1e')]=qs['offset'](_0x485c0a[_0x88dd('0x30')][_0x88dd('0x1e')]);_0x567696['order']=qs[_0x88dd('0x3b')](_0x485c0a[_0x88dd('0x30')][_0x88dd('0x3b')]);_0x567696[_0x88dd('0x3c')]=qs['filters'](_[_0x88dd('0x3d')](_0x485c0a['query'],_0x3d5c08[_0x88dd('0x32')]));_0x567696=_[_0x88dd('0x3e')]({},_0x567696,_0x485c0a[_0x88dd('0x41')]);return _0x2d2faf[_0x88dd('0x4c')+_[_0x88dd('0x70')](_0x485c0a[_0x88dd('0x30')][_0x88dd('0x6c')][_0x88dd('0x71')]())+'Queues'](_0x567696);})[_0x88dd('0x27')](respondWithResult(_0x3de463,null))[_0x88dd('0x51')](handleError(_0x3de463,null));};exports['addQueues']=function(_0x52e328,_0x40e2be,_0x1d88ae){return db[_0x88dd('0x2d')][_0x88dd('0x73')]({'where':{'id':_0x52e328[_0x88dd('0x45')]['id']}})[_0x88dd('0x27')](function(_0x51b3a4){if(_0x51b3a4){if(!_0x52e328[_0x88dd('0x4a')]['channel']||!utils['isValidChannel'](_0x52e328[_0x88dd('0x4a')]['channel'])){throw new db[(_0x88dd('0x56'))][(_0x88dd('0x6e'))]('Unknown\x20channel');}return _0x51b3a4[_0x88dd('0x74')+_[_0x88dd('0x70')](_0x52e328[_0x88dd('0x4a')][_0x88dd('0x6c')]['toLowerCase']())+'Queues'](_0x52e328[_0x88dd('0x4a')]['ids']);}return null;})[_0x88dd('0x27')](handleEntityNotFound(_0x40e2be,null))[_0x88dd('0x27')](respondWithStatusCode(_0x40e2be,null))[_0x88dd('0x51')](handleError(_0x40e2be,null));};exports[_0x88dd('0x75')]=function(_0x193714,_0x37ecff,_0x238a0e){return db['Team'][_0x88dd('0x73')]({'where':{'id':_0x193714[_0x88dd('0x45')]['id']}})[_0x88dd('0x27')](function(_0x5429b1){if(_0x5429b1){if(!_0x193714['query'][_0x88dd('0x6c')]||!utils[_0x88dd('0x6d')](_0x193714[_0x88dd('0x30')]['channel'])){throw new db[(_0x88dd('0x56'))][(_0x88dd('0x6e'))](_0x88dd('0x6f'));}return _0x5429b1['remove'+_['capitalize'](_0x193714['query'][_0x88dd('0x6c')][_0x88dd('0x71')]())+'Queues'](_0x193714['query'][_0x88dd('0x76')]);}return null;})[_0x88dd('0x27')](handleEntityNotFound(_0x37ecff,null))[_0x88dd('0x27')](respondWithStatusCode(_0x37ecff,null))[_0x88dd('0x51')](handleError(_0x37ecff,null));};exports[_0x88dd('0x77')]=function(_0x1c3644,_0x3f5cbd){var _0x4f86ff=_[_0x88dd('0x78')](_0x1c3644[_0x88dd('0x4a')][_0x88dd('0x76')])?_0x1c3644[_0x88dd('0x4a')][_0x88dd('0x76')]:[_0x1c3644[_0x88dd('0x4a')][_0x88dd('0x76')]];var _0x5a0524=_0x1c3644[_0x88dd('0x45')]['id'];return db[_0x88dd('0x2d')][_0x88dd('0x48')]({'where':{'id':_0x5a0524}})[_0x88dd('0x27')](handleEntityNotFound(_0x3f5cbd,null))[_0x88dd('0x27')](function(_0x433ba5){if(_0x433ba5){var _0x3cd9d1=[_0x88dd('0x79'),_0x88dd('0x7a'),'Mail',_0x88dd('0x7b'),'Fax','Openchannel',_0x88dd('0x7c')];return db[_0x88dd('0x54')]['transaction'](function(_0x1c0f57){var _0x1e495c=_[_0x88dd('0x2c')](_0x3cd9d1,function(_0x4eb550){var _0x398194={'attributes':['id',_0x88dd('0x29')]};if(_0x4eb550===_0x88dd('0x79')){_0x398194[_0x88dd('0x7d')]={'attributes':[_0x88dd('0x7e')]};}return _0x433ba5['get'+_0x4eb550+_0x88dd('0x7f')](_0x398194)['then'](function(_0x4324bf){var _0x381e2d=_[_0x88dd('0x2c')](_0x4324bf,function(_0x5ac938){var _0x50ce5d=_['map'](_0x4f86ff,function(_0x17d0a6){var _0x4ab669={'where':{'UserId':_0x17d0a6,[_0x4eb550+_0x88dd('0x80')]:_0x5ac938['id']},'transaction':_0x1c0f57};if(_0x4eb550===_0x88dd('0x79')){_0x4ab669['defaults']={'penalty':_0x5ac938[_0x88dd('0x81')][_0x88dd('0x7e')]};}return db[_0x88dd('0x82')+_0x4eb550+_0x88dd('0x72')][_0x88dd('0x83')](_0x4ab669)[_0x88dd('0x27')](function(){socket['emit']('user'+_0x4eb550+'Queue:save',{'UserId':_0x17d0a6,[_0x4eb550+'QueueId']:_0x5ac938['id']});if(_0x4eb550!==_0x88dd('0x79')){return;}return db['User'][_0x88dd('0x84')]({'where':{'id':_0x4f86ff,'online':0x1},'attributes':['id','name',_0x88dd('0x85'),_0x88dd('0x86'),_0x88dd('0x87')],'raw':!![]})[_0x88dd('0x27')](function(_0x1226d2){var _0x23a219=_[_0x88dd('0x2c')](_0x1226d2,function(_0x4fc936){return db['UserVoiceQueueRt'][_0x88dd('0x88')]({'membername':_0x4fc936[_0x88dd('0x29')],'UserId':_0x4fc936['id'],'queue_name':_0x5ac938['name'],'VoiceQueueId':_0x5ac938['id'],'interface':_['isNil'](_0x4fc936['interface'])?util[_0x88dd('0x89')](_0x88dd('0x8a'),_0x4fc936[_0x88dd('0x29')]):_0x4fc936[_0x88dd('0x87')],'paused':_0x4fc936[_0x88dd('0x86')]||![],'penalty':_0x5ac938[_0x88dd('0x81')][_0x88dd('0x7e')]},{'transaction':_0x1c0f57});});return Promise[_0x88dd('0x8b')](_0x23a219);});});});return Promise[_0x88dd('0x8b')](_0x50ce5d);});return Promise[_0x88dd('0x8b')](_0x381e2d);})[_0x88dd('0x27')](function(){return db[_0x88dd('0x69')]['findOne']({'where':{'teamId':_0x5a0524}})[_0x88dd('0x27')](function(_0x1d532c){if(_0x1d532c){var _0x1d1d01=_[_0x88dd('0x2c')](_0x4f86ff,function(_0x1e958e){db[_0x88dd('0x6a')]['upsert']({'UserId':_0x1e958e,'VoicePrefixId':_0x1d532c[_0x88dd('0x6b')]});});return Promise[_0x88dd('0x8b')](_0x1d1d01);}});});});return Promise['all'](_0x1e495c)[_0x88dd('0x27')](function(){return _0x433ba5[_0x88dd('0x77')](_0x4f86ff,{'transaction':_0x1c0f57})[_0x88dd('0x8c')](function(_0x192278){return _0x192278;});});});}})[_0x88dd('0x27')](respondWithResult(_0x3f5cbd,null))[_0x88dd('0x51')](handleError(_0x3f5cbd,null));};exports[_0x88dd('0x8d')]=function(_0x429369,_0x55ce45){var _0x1acdd3=_[_0x88dd('0x78')](_0x429369['query'][_0x88dd('0x76')])?_0x429369[_0x88dd('0x30')][_0x88dd('0x76')]:[_0x429369[_0x88dd('0x30')][_0x88dd('0x76')]];var _0x29b25f=_0x429369[_0x88dd('0x45')]['id'];return db[_0x88dd('0x2d')][_0x88dd('0x48')]({'where':{'id':_0x29b25f}})[_0x88dd('0x27')](handleEntityNotFound(_0x55ce45,null))['then'](function(_0x1d02f7){if(_0x1d02f7){var _0x5277c2=[_0x88dd('0x79'),'Chat','Mail',_0x88dd('0x7b'),'Fax','Openchannel','Whatsapp'];return db[_0x88dd('0x54')][_0x88dd('0x8e')](function(_0x5a368f){var _0x447719=_[_0x88dd('0x2c')](_0x5277c2,function(_0x16cabc){var _0x45db59={'attributes':['id',_0x88dd('0x29')]};return _0x1d02f7[_0x88dd('0x4c')+_0x16cabc+_0x88dd('0x7f')](_0x45db59)[_0x88dd('0x27')](function(_0x476d9f){var _0x3bf0b0=_[_0x88dd('0x2c')](_0x476d9f,function(_0x51154f){return _0x51154f[_0x88dd('0x8d')](_0x1acdd3,{'transaction':_0x5a368f})[_0x88dd('0x27')](function(){var _0x30c3f1=_[_0x88dd('0x2c')](_0x1acdd3,function(_0x4903ed){socket['emit']('user'+_0x16cabc+_0x88dd('0x8f'),{'UserId':Number(_0x4903ed),[_0x16cabc+_0x88dd('0x80')]:_0x51154f['id']});if(_0x16cabc!==_0x88dd('0x79')){return;}return db[_0x88dd('0x90')][_0x88dd('0x53')]({'where':{'VoiceQueueId':_0x51154f['id'],'UserId':_0x4903ed},'transaction':_0x5a368f});});return Promise[_0x88dd('0x8b')](_0x30c3f1);});});return Promise[_0x88dd('0x8b')](_0x3bf0b0);});});return Promise[_0x88dd('0x8b')](_0x447719)[_0x88dd('0x27')](function(){return _0x1d02f7[_0x88dd('0x8d')](_0x1acdd3,{'transaction':_0x5a368f});})[_0x88dd('0x27')](function(){return db[_0x88dd('0x69')][_0x88dd('0x73')]({'where':{'teamId':_0x29b25f}})[_0x88dd('0x27')](function(_0x3fed4b){if(_0x3fed4b){var _0x5b9d1f=_[_0x88dd('0x2c')](_0x1acdd3,function(_0x5cc152){db['UserVoicePrefix'][_0x88dd('0x53')]({'where':{'UserId':_0x5cc152,'VoicePrefixId':_0x3fed4b['VoicePrefixId']}});});return Promise[_0x88dd('0x8b')](_0x5b9d1f);}});});});}})[_0x88dd('0x27')](respondWithStatusCode(_0x55ce45,null))[_0x88dd('0x51')](handleError(_0x55ce45,null));};exports[_0x88dd('0x91')]=function(_0x160cce,_0xb594e6,_0x45b57b){var _0x17e7b9={};var _0x4e76ea={};var _0x3e74a9;var _0xb92a8b;return db[_0x88dd('0x2d')][_0x88dd('0x73')]({'where':{'id':_0x160cce[_0x88dd('0x45')]['id']}})[_0x88dd('0x27')](handleEntityNotFound(_0xb594e6,null))[_0x88dd('0x27')](function(_0x2af858){if(_0x2af858){_0x3e74a9=_0x2af858;_0x4e76ea[_0x88dd('0x34')]=_[_0x88dd('0x31')](db[_0x88dd('0x82')][_0x88dd('0x46')]);_0x4e76ea[_0x88dd('0x30')]=_[_0x88dd('0x31')](_0x160cce[_0x88dd('0x30')]);_0x4e76ea[_0x88dd('0x32')]=_[_0x88dd('0x33')](_0x4e76ea[_0x88dd('0x34')],_0x4e76ea['query']);_0x17e7b9[_0x88dd('0x36')]=_[_0x88dd('0x33')](_0x4e76ea[_0x88dd('0x34')],qs[_0x88dd('0x35')](_0x160cce[_0x88dd('0x30')][_0x88dd('0x35')]));_0x17e7b9['attributes']=_0x17e7b9[_0x88dd('0x36')][_0x88dd('0x37')]?_0x17e7b9['attributes']:_0x4e76ea[_0x88dd('0x34')];_0x17e7b9[_0x88dd('0x3a')]=qs[_0x88dd('0x3b')](_0x160cce[_0x88dd('0x30')][_0x88dd('0x3b')]);_0x17e7b9[_0x88dd('0x3c')]=qs[_0x88dd('0x32')](_[_0x88dd('0x3d')](_0x160cce[_0x88dd('0x30')],_0x4e76ea[_0x88dd('0x32')]));if(_0x160cce['query'][_0x88dd('0x40')]){_0x17e7b9[_0x88dd('0x3c')]=_[_0x88dd('0x3e')](_0x17e7b9[_0x88dd('0x3c')],{'$or':_[_0x88dd('0x2c')](_0x17e7b9[_0x88dd('0x36')],function(_0x37bfc0){var _0x127260={};_0x127260[_0x37bfc0]={'$like':'%'+_0x160cce['query'][_0x88dd('0x40')]+'%'};return _0x127260;})});}_0x17e7b9=_['merge']({},_0x17e7b9,_0x160cce['options']);return _0x3e74a9[_0x88dd('0x91')](_0x17e7b9);}})[_0x88dd('0x27')](function(_0x4b716b){if(_0x4b716b){_0xb92a8b=_0x4b716b[_0x88dd('0x37')];if(!_0x160cce['query'][_0x88dd('0x38')](_0x88dd('0x39'))){_0x17e7b9['limit']=qs[_0x88dd('0x1f')](_0x160cce[_0x88dd('0x30')]['limit']);_0x17e7b9['offset']=qs[_0x88dd('0x1e')](_0x160cce['query'][_0x88dd('0x1e')]);}return _0x3e74a9[_0x88dd('0x91')](_0x17e7b9);}})[_0x88dd('0x27')](function(_0x3d459c){if(_0x3d459c){return _0x3d459c?{'count':_0xb92a8b,'rows':_0x3d459c}:null;}})['then'](respondWithResult(_0xb594e6,null))['catch'](handleError(_0xb594e6,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index ef2d568..7cb6f41 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 _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 +var _0x6882=['Team','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xd2e079,_0x10f572){var _0x35d5fc=function(_0x15a084){while(--_0x15a084){_0xd2e079['push'](_0xd2e079['shift']());}};_0x35d5fc(++_0x10f572);}(_0x6882,0x1ae));var _0x2688=function(_0x3d7b9f,_0x3f97a5){_0x3d7b9f=_0x3d7b9f-0x0;var _0x2e4acd=_0x6882[_0x3d7b9f];return _0x2e4acd;};'use strict';var EventEmitter=require(_0x2688('0x0'));var Team=require(_0x2688('0x1'))['db'][_0x2688('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2688('0x3'),'afterUpdate':_0x2688('0x4'),'afterDestroy':'remove'};function emitEvent(_0x54ef51){return function(_0x49be44,_0x39863e,_0x22de76){TeamEvents[_0x2688('0x5')](_0x54ef51+':'+_0x49be44['id'],_0x49be44);TeamEvents['emit'](_0x54ef51,_0x49be44);_0x22de76(null);};}for(var e in events){if(events[_0x2688('0x6')](e)){var event=events[e];Team[_0x2688('0x7')](e,emitEvent(event));}}module[_0x2688('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d42e13b..441b450 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 _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 +var _0xbf21=['resolve','all','lodash','./team.attributes','get','Queues','map','channel','catch','define','Team','teams','Mail','Sms','Whatsapp'];(function(_0x1fc26d,_0x42ff6c){var _0x373e68=function(_0x4a6407){while(--_0x4a6407){_0x1fc26d['push'](_0x1fc26d['shift']());}};_0x373e68(++_0x42ff6c);}(_0xbf21,0x188));var _0x1bf2=function(_0x115aa3,_0x4c8ba3){_0x115aa3=_0x115aa3-0x0;var _0x125165=_0xbf21[_0x115aa3];return _0x125165;};'use strict';var _=require(_0x1bf2('0x0'));var attributes=require(_0x1bf2('0x1'));function getQueuesByChannel(_0x2c82ce,_0x15679a){var _0x3ef9be=_0x1bf2('0x2')+_0x15679a+_0x1bf2('0x3');return _0x2c82ce[_0x3ef9be]()['then'](function(_0x3c19ca){return _[_0x1bf2('0x4')](_0x3c19ca,function(_0x4c52d5){_0x4c52d5['setDataValue'](_0x1bf2('0x5'),_0x15679a);return _0x4c52d5;});})[_0x1bf2('0x6')](function(_0x1d21eb){throw _0x1d21eb;});}module['exports']=function(_0x775b2d){return _0x775b2d[_0x1bf2('0x7')](_0x1bf2('0x8'),attributes,{'tableName':_0x1bf2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x332a29=this;var _0x25fc1d=['Chat','Fax',_0x1bf2('0xa'),'Openchannel',_0x1bf2('0xb'),'Voice',_0x1bf2('0xc')];return Promise[_0x1bf2('0xd')]()['then'](function(){var _0xafb2d9=_[_0x1bf2('0x4')](_0x25fc1d,function(_0x1568e3){return getQueuesByChannel(_0x332a29,_0x1568e3);});return Promise[_0x1bf2('0xe')](_0xafb2d9);})['catch'](function(_0x45449d){throw _0x45449d;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index dbe9134..15a03dd 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 _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 +var _0x56f4=['Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then'];(function(_0x154b56,_0x37dfab){var _0x5c7f31=function(_0x17046d){while(--_0x17046d){_0x154b56['push'](_0x154b56['shift']());}};_0x5c7f31(++_0x37dfab);}(_0x56f4,0xe2));var _0x456f=function(_0x1cdebf,_0x5d5554){_0x1cdebf=_0x1cdebf-0x0;var _0x335f58=_0x56f4[_0x1cdebf];return _0x335f58;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x456f('0x0'));var BPromise=require(_0x456f('0x1'));var rs=require(_0x456f('0x2'));var fs=require('fs');var Redis=require(_0x456f('0x3'));var db=require(_0x456f('0x4'))['db'];var utils=require(_0x456f('0x5'));var logger=require(_0x456f('0x6'))('rpc');var config=require(_0x456f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x456f('0x8')][_0x456f('0x9')]({'port':0x232a});config[_0x456f('0xa')]=_[_0x456f('0xb')](config[_0x456f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x456f('0xc'))(new Redis(config['redis']));require(_0x456f('0xd'))[_0x456f('0xe')](socket);function respondWithRpcPromise(_0x49757b,_0x56a696,_0x5513d6){return new BPromise(function(_0x5a2e69,_0x5442a6){return client[_0x456f('0xf')](_0x49757b,_0x5513d6)[_0x456f('0x10')](function(_0x478895){logger['info']('Team,\x20%s,\x20%s',_0x56a696,'request\x20sent');logger['debug'](_0x456f('0x11'),_0x56a696,_0x456f('0x12'),JSON[_0x456f('0x13')](_0x478895));if(_0x478895[_0x456f('0x14')]){if(_0x478895[_0x456f('0x14')][_0x456f('0x15')]===0x1f4){logger['error'](_0x456f('0x16'),_0x56a696,_0x478895[_0x456f('0x14')][_0x456f('0x17')]);return _0x5442a6(_0x478895[_0x456f('0x14')][_0x456f('0x17')]);}logger[_0x456f('0x14')](_0x456f('0x16'),_0x56a696,_0x478895[_0x456f('0x14')][_0x456f('0x17')]);return _0x5a2e69(_0x478895[_0x456f('0x14')][_0x456f('0x17')]);}else{logger[_0x456f('0x18')](_0x456f('0x16'),_0x56a696,_0x456f('0x12'));_0x5a2e69(_0x478895[_0x456f('0x19')][_0x456f('0x17')]);}})[_0x456f('0x1a')](function(_0x1c4f35){logger[_0x456f('0x14')](_0x456f('0x16'),_0x56a696,_0x1c4f35);_0x5442a6(_0x1c4f35);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a6df430..a4a34a7 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 _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 +var _0x4849=['save','remove','update','emit','register','length','team:'];(function(_0x50d8b2,_0x46f88d){var _0x2f9972=function(_0x4f728b){while(--_0x4f728b){_0x50d8b2['push'](_0x50d8b2['shift']());}};_0x2f9972(++_0x46f88d);}(_0x4849,0x181));var _0x9484=function(_0x1bb6a3,_0x200fe0){_0x1bb6a3=_0x1bb6a3-0x0;var _0x47624f=_0x4849[_0x1bb6a3];return _0x47624f;};'use strict';var TeamEvents=require('./team.events');var events=[_0x9484('0x0'),_0x9484('0x1'),_0x9484('0x2')];function createListener(_0x22e8eb,_0x530a18){return function(_0x337903){_0x530a18[_0x9484('0x3')](_0x22e8eb,_0x337903);};}function removeListener(_0xecde47,_0x95b89e){return function(){TeamEvents['removeListener'](_0xecde47,_0x95b89e);};}exports[_0x9484('0x4')]=function(_0x555b70){for(var _0x521217=0x0,_0x4e7b02=events[_0x9484('0x5')];_0x521217<_0x4e7b02;_0x521217++){var _0x515733=events[_0x521217];var _0x2952ea=createListener(_0x9484('0x6')+_0x515733,_0x555b70);TeamEvents['on'](_0x515733,_0x2952ea);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 2e20043..62b2a94 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 _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 +var _0x48fb=['sequelize','exports','INTEGER'];(function(_0x18bb25,_0xcd1457){var _0x27d5d7=function(_0x53755b){while(--_0x53755b){_0x18bb25['push'](_0x18bb25['shift']());}};_0x27d5d7(++_0xcd1457);}(_0x48fb,0x114));var _0xb48f=function(_0x1ce8bc,_0x2cbe8f){_0x1ce8bc=_0x1ce8bc-0x0;var _0x1d2b4e=_0x48fb[_0x1ce8bc];return _0x1d2b4e;};'use strict';var Sequelize=require(_0xb48f('0x0'));module[_0xb48f('0x1')]={'TeamId':{'type':Sequelize[_0xb48f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb48f('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 2e2eb08..5611c56 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 _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 +var _0x93e6=['api','bluebird','path','rimraf','../../config/environment','exports','lodash'];(function(_0x56669f,_0x5defab){var _0x16441a=function(_0x232b5b){while(--_0x232b5b){_0x56669f['push'](_0x56669f['shift']());}};_0x16441a(++_0x5defab);}(_0x93e6,0x11e));var _0x693e=function(_0x34dd23,_0x50ce42){_0x34dd23=_0x34dd23-0x0;var _0x18a648=_0x93e6[_0x34dd23];return _0x18a648;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x693e('0x1'));var moment=require('moment');var BPromise=require(_0x693e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x693e('0x3'));var rimraf=require(_0x693e('0x4'));var config=require(_0x693e('0x5'));var attributes=require('./teamVoicePrefix.attributes');module[_0x693e('0x6')]=function(_0x388eb6,_0x2569a4){return _0x388eb6['define']('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index f7df292..44d6732 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 _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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x56adea,_0x289c86){var _0x185ee5=function(_0x349841){while(--_0x349841){_0x56adea['push'](_0x56adea['shift']());}};_0x185ee5(++_0x289c86);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index b4a6a7a..51742f6 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 _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 +var _0x9364=['sequelize','exports','INTEGER'];(function(_0x28d2e4,_0x542000){var _0x46c577=function(_0x108ec0){while(--_0x108ec0){_0x28d2e4['push'](_0x28d2e4['shift']());}};_0x46c577(++_0x542000);}(_0x9364,0x141));var _0x4936=function(_0x14015d,_0x5c0d80){_0x14015d=_0x14015d-0x0;var _0x3bc2b7=_0x9364[_0x14015d];return _0x3bc2b7;};'use strict';var Sequelize=require(_0x4936('0x0'));module[_0x4936('0x1')]={'penalty':{'type':Sequelize[_0x4936('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 402d626..862e404 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 _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 +var _0xcea5=['api','moment','request-promise','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xcea5,0xed));var _0x5cea=function(_0x4bb9e8,_0x5e8598){_0x4bb9e8=_0x4bb9e8-0x0;var _0x32648e=_0xcea5[_0x4bb9e8];return _0x32648e;};'use strict';var _=require(_0x5cea('0x0'));var util=require(_0x5cea('0x1'));var logger=require(_0x5cea('0x2'))(_0x5cea('0x3'));var moment=require(_0x5cea('0x4'));var BPromise=require('bluebird');var rp=require(_0x5cea('0x5'));var fs=require('fs');var path=require(_0x5cea('0x6'));var rimraf=require(_0x5cea('0x7'));var config=require(_0x5cea('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0x5cea('0x9')]=function(_0x31e6f3,_0x599bc5){return _0x31e6f3['define']('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','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 3a63a73..8bfc18a 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 _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 +var _0x4fd9=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x4fd9,0xf1));var _0x94fd=function(_0x2213eb,_0x1bce8d){_0x2213eb=_0x2213eb-0x0;var _0x4606bb=_0x4fd9[_0x2213eb];return _0x4606bb;};'use strict';var _=require(_0x94fd('0x0'));var util=require(_0x94fd('0x1'));var moment=require(_0x94fd('0x2'));var BPromise=require(_0x94fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94fd('0x4'));var db=require(_0x94fd('0x5'))['db'];var utils=require(_0x94fd('0x6'));var logger=require(_0x94fd('0x7'))(_0x94fd('0x8'));var config=require(_0x94fd('0x9'));var jayson=require(_0x94fd('0xa'));var client=jayson[_0x94fd('0xb')][_0x94fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x347e0b,_0x9c75f1,_0x32b88e){return new BPromise(function(_0x52cee7,_0x51ccfc){return client[_0x94fd('0xd')](_0x347e0b,_0x32b88e)['then'](function(_0x275b82){logger['info'](_0x94fd('0xe'),_0x9c75f1,'request\x20sent');logger[_0x94fd('0xf')](_0x94fd('0x10'),_0x9c75f1,'request\x20sent',JSON[_0x94fd('0x11')](_0x275b82));if(_0x275b82[_0x94fd('0x12')]){if(_0x275b82[_0x94fd('0x12')][_0x94fd('0x13')]===0x1f4){logger[_0x94fd('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x9c75f1,_0x275b82[_0x94fd('0x12')][_0x94fd('0x14')]);return _0x51ccfc(_0x275b82[_0x94fd('0x12')][_0x94fd('0x14')]);}logger[_0x94fd('0x12')](_0x94fd('0xe'),_0x9c75f1,_0x275b82[_0x94fd('0x12')][_0x94fd('0x14')]);return _0x52cee7(_0x275b82[_0x94fd('0x12')]['message']);}else{logger[_0x94fd('0x15')](_0x94fd('0xe'),_0x9c75f1,_0x94fd('0x16'));_0x52cee7(_0x275b82[_0x94fd('0x17')][_0x94fd('0x14')]);}})['catch'](function(_0x141d5e){logger[_0x94fd('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x9c75f1,_0x141d5e);_0x51ccfc(_0x141d5e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ca3dacc..f7abef8 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 _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 +var _0x186d=['delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','index','get','/:id','show','post','isAuthenticated','put','update'];(function(_0x2a97f7,_0x465e0c){var _0x13c258=function(_0x1b043d){while(--_0x1b043d){_0x2a97f7['push'](_0x2a97f7['shift']());}};_0x13c258(++_0x465e0c);}(_0x186d,0x1ca));var _0xd186=function(_0x4864f0,_0x5da8c5){_0x4864f0=_0x4864f0-0x0;var _0x55445a=_0x186d[_0x4864f0];return _0x55445a;};'use strict';var multer=require('multer');var util=require(_0xd186('0x0'));var path=require(_0xd186('0x1'));var timeout=require(_0xd186('0x2'));var express=require(_0xd186('0x3'));var router=express[_0xd186('0x4')]();var fs_extra=require(_0xd186('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd186('0x6'));var config=require(_0xd186('0x7'));var controller=require(_0xd186('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd186('0x9')]);router[_0xd186('0xa')](_0xd186('0xb'),auth['isAuthenticated'](),controller[_0xd186('0xc')]);router[_0xd186('0xd')]('/',auth[_0xd186('0xe')](),controller['create']);router[_0xd186('0xf')](_0xd186('0xb'),auth[_0xd186('0xe')](),controller[_0xd186('0x10')]);router[_0xd186('0x11')](_0xd186('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd186('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 07c8539..73810f2 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 _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 +var _0xc801=['TEXT','exports','STRING'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xc801,0xb2));var _0x1c80=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xc801[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require('sequelize');module[_0x1c80('0x0')]={'name':{'type':Sequelize[_0x1c80('0x1')]},'description':{'type':Sequelize[_0x1c80('0x1')]},'html':{'type':Sequelize[_0x1c80('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 02626c3..a50291b 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 _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 +var _0x6012=['rawAttributes','fieldName','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Templates','UserProfileResource','end','error','name','send','index','map','Template'];(function(_0x49e0d4,_0x1b7d6c){var _0x4fe3a0=function(_0x1c9ca3){while(--_0x1c9ca3){_0x49e0d4['push'](_0x49e0d4['shift']());}};_0x4fe3a0(++_0x1b7d6c);}(_0x6012,0x122));var _0x2601=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x6012[_0xed4881];return _0x7fcbd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2601('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2601('0x1'));var rp=require(_0x2601('0x2'));var moment=require(_0x2601('0x3'));var BPromise=require(_0x2601('0x4'));var Mustache=require(_0x2601('0x5'));var util=require(_0x2601('0x6'));var path=require(_0x2601('0x7'));var sox=require(_0x2601('0x8'));var csv=require(_0x2601('0x9'));var ejs=require(_0x2601('0xa'));var fs=require('fs');var fs_extra=require(_0x2601('0xb'));var _=require('lodash');var squel=require(_0x2601('0xc'));var crypto=require(_0x2601('0xd'));var jsforce=require(_0x2601('0xe'));var deskjs=require(_0x2601('0xf'));var toCsv=require(_0x2601('0x9'));var querystring=require(_0x2601('0x10'));var Papa=require('papaparse');var Redis=require(_0x2601('0x11'));var authService=require(_0x2601('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2601('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2601('0x14'))(_0x2601('0x15'));var utils=require(_0x2601('0x16'));var config=require(_0x2601('0x17'));var licenseUtil=require(_0x2601('0x18'));var db=require(_0x2601('0x19'))['db'];function respondWithStatusCode(_0x5d4db6,_0xce7837){_0xce7837=_0xce7837||0xcc;return function(_0x5f55f2){if(_0x5f55f2){return _0x5d4db6[_0x2601('0x1a')](_0xce7837);}return _0x5d4db6[_0x2601('0x1b')](_0xce7837)['end']();};}function respondWithResult(_0x4068f1,_0x32aa09){_0x32aa09=_0x32aa09||0xc8;return function(_0x44d4f8){if(_0x44d4f8){return _0x4068f1[_0x2601('0x1b')](_0x32aa09)[_0x2601('0x1c')](_0x44d4f8);}};}function respondWithFilteredResult(_0x3ce7eb,_0x3f0cbd){return function(_0x319a1d){if(_0x319a1d){var _0x12b606=typeof _0x3f0cbd[_0x2601('0x1d')]===_0x2601('0x1e')&&typeof _0x3f0cbd[_0x2601('0x1f')]===_0x2601('0x1e');var _0x325d2d=_0x319a1d[_0x2601('0x20')];var _0x11a2b5=_0x12b606?0x0:_0x3f0cbd[_0x2601('0x1d')];var _0x1d97f2=_0x12b606?_0x319a1d[_0x2601('0x20')]:_0x3f0cbd['offset']+_0x3f0cbd[_0x2601('0x1f')];var _0x589d6e;if(_0x1d97f2>=_0x325d2d){_0x1d97f2=_0x325d2d;_0x589d6e=0xc8;}else{_0x589d6e=0xce;}_0x3ce7eb[_0x2601('0x1b')](_0x589d6e);return _0x3ce7eb[_0x2601('0x21')](_0x2601('0x22'),_0x11a2b5+'-'+_0x1d97f2+'/'+_0x325d2d)[_0x2601('0x1c')](_0x319a1d);}return null;};}function patchUpdates(_0x372403){return function(_0x1f6c88){try{jsonpatch[_0x2601('0x23')](_0x1f6c88,_0x372403,!![]);}catch(_0x267938){return BPromise[_0x2601('0x24')](_0x267938);}return _0x1f6c88['save']();};}function saveUpdates(_0xa6dc34,_0x552c7c){return function(_0x5a80fc){if(_0x5a80fc){return _0x5a80fc[_0x2601('0x25')](_0xa6dc34)[_0x2601('0x26')](function(_0x3d30e9){return _0x3d30e9;});}return null;};}function removeEntity(_0xaced97,_0x23c7e8){return function(_0x4ed662){if(_0x4ed662){return _0x4ed662[_0x2601('0x27')]()[_0x2601('0x26')](function(){var _0x1f728a=_0x4ed662[_0x2601('0x28')]({'plain':!![]});var _0x3050e3=_0x2601('0x29');return db[_0x2601('0x2a')][_0x2601('0x27')]({'where':{'type':_0x3050e3,'resourceId':_0x1f728a['id']}})[_0x2601('0x26')](function(){return _0x4ed662;});})[_0x2601('0x26')](function(){_0xaced97[_0x2601('0x1b')](0xcc)[_0x2601('0x2b')]();});}};}function handleEntityNotFound(_0x36447,_0xb7a5fb){return function(_0x2bf8a3){if(!_0x2bf8a3){_0x36447['sendStatus'](0x194);}return _0x2bf8a3;};}function handleError(_0x243de1,_0x265b0f){_0x265b0f=_0x265b0f||0x1f4;return function(_0x3cf10a){logger[_0x2601('0x2c')](_0x3cf10a['stack']);if(_0x3cf10a[_0x2601('0x2d')]){delete _0x3cf10a[_0x2601('0x2d')];}_0x243de1['status'](_0x265b0f)[_0x2601('0x2e')](_0x3cf10a);};}exports[_0x2601('0x2f')]=function(_0x3a8d36,_0x153f29){var _0x29445d={},_0x1043a8={},_0x16e149={'count':0x0,'rows':[]};var _0x412adf=_[_0x2601('0x30')](db[_0x2601('0x31')][_0x2601('0x32')],function(_0x3bdd81){return{'name':_0x3bdd81[_0x2601('0x33')],'type':_0x3bdd81['type']['key']};});_0x1043a8['model']=_[_0x2601('0x30')](_0x412adf,_0x2601('0x2d'));_0x1043a8['query']=_[_0x2601('0x34')](_0x3a8d36[_0x2601('0x35')]);_0x1043a8[_0x2601('0x36')]=_[_0x2601('0x37')](_0x1043a8[_0x2601('0x38')],_0x1043a8[_0x2601('0x35')]);_0x29445d['attributes']=_['intersection'](_0x1043a8[_0x2601('0x38')],qs[_0x2601('0x39')](_0x3a8d36[_0x2601('0x35')][_0x2601('0x39')]));_0x29445d['attributes']=_0x29445d[_0x2601('0x3a')][_0x2601('0x3b')]?_0x29445d[_0x2601('0x3a')]:_0x1043a8[_0x2601('0x38')];if(!_0x3a8d36[_0x2601('0x35')][_0x2601('0x3c')](_0x2601('0x3d'))){_0x29445d[_0x2601('0x1f')]=qs['limit'](_0x3a8d36[_0x2601('0x35')][_0x2601('0x1f')]);_0x29445d[_0x2601('0x1d')]=qs[_0x2601('0x1d')](_0x3a8d36[_0x2601('0x35')]['offset']);}_0x29445d[_0x2601('0x3e')]=qs[_0x2601('0x3f')](_0x3a8d36[_0x2601('0x35')][_0x2601('0x3f')]);_0x29445d[_0x2601('0x40')]=qs[_0x2601('0x36')](_['pick'](_0x3a8d36['query'],_0x1043a8[_0x2601('0x36')]),_0x412adf);if(_0x3a8d36[_0x2601('0x35')][_0x2601('0x41')]){_0x29445d[_0x2601('0x40')]=_[_0x2601('0x42')](_0x29445d['where'],{'$or':_[_0x2601('0x30')](_0x412adf,function(_0x35d092){if(_0x35d092['type']!==_0x2601('0x43')){var _0x535957={};_0x535957[_0x35d092['name']]={'$like':'%'+_0x3a8d36[_0x2601('0x35')][_0x2601('0x41')]+'%'};return _0x535957;}})});}_0x29445d=_[_0x2601('0x42')]({},_0x29445d,_0x3a8d36[_0x2601('0x44')]);var _0x10bce9={'where':_0x29445d[_0x2601('0x40')]};return db[_0x2601('0x31')][_0x2601('0x20')](_0x10bce9)[_0x2601('0x26')](function(_0x3fc64b){_0x16e149['count']=_0x3fc64b;if(_0x3a8d36['query'][_0x2601('0x45')]){_0x29445d[_0x2601('0x46')]=[{'all':!![]}];}return db[_0x2601('0x31')][_0x2601('0x47')](_0x29445d);})[_0x2601('0x26')](function(_0x27fe04){_0x16e149[_0x2601('0x48')]=_0x27fe04;return _0x16e149;})['then'](respondWithFilteredResult(_0x153f29,_0x29445d))[_0x2601('0x49')](handleError(_0x153f29,null));};exports[_0x2601('0x4a')]=function(_0x54202d,_0x75b3e9){var _0x1ba0af={'raw':!![],'where':{'id':_0x54202d[_0x2601('0x4b')]['id']}},_0x22158f={};_0x22158f[_0x2601('0x38')]=_[_0x2601('0x34')](db[_0x2601('0x31')][_0x2601('0x32')]);_0x22158f[_0x2601('0x35')]=_['keys'](_0x54202d[_0x2601('0x35')]);_0x22158f[_0x2601('0x36')]=_[_0x2601('0x37')](_0x22158f['model'],_0x22158f[_0x2601('0x35')]);_0x1ba0af[_0x2601('0x3a')]=_[_0x2601('0x37')](_0x22158f['model'],qs['fields'](_0x54202d[_0x2601('0x35')][_0x2601('0x39')]));_0x1ba0af[_0x2601('0x3a')]=_0x1ba0af['attributes']['length']?_0x1ba0af[_0x2601('0x3a')]:_0x22158f[_0x2601('0x38')];if(_0x54202d[_0x2601('0x35')][_0x2601('0x45')]){_0x1ba0af[_0x2601('0x46')]=[{'all':!![]}];}_0x1ba0af=_[_0x2601('0x42')]({},_0x1ba0af,_0x54202d[_0x2601('0x44')]);return db['Template']['find'](_0x1ba0af)[_0x2601('0x26')](handleEntityNotFound(_0x75b3e9,null))[_0x2601('0x26')](respondWithResult(_0x75b3e9,null))['catch'](handleError(_0x75b3e9,null));};exports[_0x2601('0x4c')]=function(_0xd19ca2,_0xdd656e){return db[_0x2601('0x31')][_0x2601('0x4c')](_0xd19ca2[_0x2601('0x4d')],{})['then'](function(_0x3596c0){var _0x249cca=_0xd19ca2[_0x2601('0x4e')][_0x2601('0x28')]({'plain':!![]});if(!_0x249cca)throw new Error(_0x2601('0x4f'));if(_0x249cca[_0x2601('0x50')]===_0x2601('0x4e')){var _0x11d796=_0x3596c0['get']({'plain':!![]});var _0x15151e=_0x2601('0x29');return db['UserProfileSection'][_0x2601('0x51')]({'where':{'name':_0x15151e,'userProfileId':_0x249cca[_0x2601('0x52')]},'raw':!![]})['then'](function(_0x30fac2){if(_0x30fac2&&_0x30fac2[_0x2601('0x53')]===0x0){return db[_0x2601('0x2a')][_0x2601('0x4c')]({'name':_0x11d796[_0x2601('0x2d')],'resourceId':_0x11d796['id'],'type':_0x30fac2[_0x2601('0x2d')],'sectionId':_0x30fac2['id']},{})[_0x2601('0x26')](function(){return _0x3596c0;});}else{return _0x3596c0;}})[_0x2601('0x49')](function(_0x3f7807){logger[_0x2601('0x2c')](_0x2601('0x54'),_0x3f7807);throw _0x3f7807;});}return _0x3596c0;})[_0x2601('0x26')](respondWithResult(_0xdd656e,0xc9))[_0x2601('0x49')](handleError(_0xdd656e,null));};exports[_0x2601('0x25')]=function(_0x15c880,_0x22cee8){if(_0x15c880[_0x2601('0x4d')]['id']){delete _0x15c880[_0x2601('0x4d')]['id'];}return db[_0x2601('0x31')][_0x2601('0x51')]({'where':{'id':_0x15c880[_0x2601('0x4b')]['id']}})[_0x2601('0x26')](handleEntityNotFound(_0x22cee8,null))[_0x2601('0x26')](saveUpdates(_0x15c880[_0x2601('0x4d')],null))['then'](respondWithResult(_0x22cee8,null))[_0x2601('0x49')](handleError(_0x22cee8,null));};exports[_0x2601('0x27')]=function(_0x31081d,_0x4ce8de){return db['Template'][_0x2601('0x51')]({'where':{'id':_0x31081d[_0x2601('0x4b')]['id']}})[_0x2601('0x26')](handleEntityNotFound(_0x4ce8de,null))[_0x2601('0x26')](removeEntity(_0x4ce8de,null))[_0x2601('0x49')](handleError(_0x4ce8de,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 1ea704d..b6e390f 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 _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 +var _0xd1a4=['bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','api','moment'];(function(_0x587bc3,_0x28ff63){var _0x587b59=function(_0x2a95aa){while(--_0x2a95aa){_0x587bc3['push'](_0x587bc3['shift']());}};_0x587b59(++_0x28ff63);}(_0xd1a4,0x19c));var _0x4d1a=function(_0x5b4f0f,_0x18e653){_0x5b4f0f=_0x5b4f0f-0x0;var _0xb1a86=_0xd1a4[_0x5b4f0f];return _0xb1a86;};'use strict';var _=require(_0x4d1a('0x0'));var util=require(_0x4d1a('0x1'));var logger=require('../../config/logger')(_0x4d1a('0x2'));var moment=require(_0x4d1a('0x3'));var BPromise=require(_0x4d1a('0x4'));var rp=require(_0x4d1a('0x5'));var fs=require('fs');var path=require(_0x4d1a('0x6'));var rimraf=require('rimraf');var config=require(_0x4d1a('0x7'));var attributes=require(_0x4d1a('0x8'));module[_0x4d1a('0x9')]=function(_0x5a8555,_0x39e455){return _0x5a8555[_0x4d1a('0xa')](_0x4d1a('0xb'),attributes,{'tableName':_0x4d1a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 78b5ee4..301814f 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 _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 +var _0x475f=['model','util','moment','randomstring','ioredis','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map'];(function(_0x12496f,_0x2b9479){var _0x3b482a=function(_0x38ec37){while(--_0x38ec37){_0x12496f['push'](_0x12496f['shift']());}};_0x3b482a(++_0x2b9479);}(_0x475f,0x187));var _0xf475=function(_0x54fa97,_0x25bb8b){_0x54fa97=_0x54fa97-0x0;var _0x1acd9b=_0x475f[_0x54fa97];return _0x1acd9b;};'use strict';var _=require('lodash');var util=require(_0xf475('0x0'));var moment=require(_0xf475('0x1'));var BPromise=require('bluebird');var rs=require(_0xf475('0x2'));var fs=require('fs');var Redis=require(_0xf475('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf475('0x4'));var config=require('../../config/environment');var jayson=require(_0xf475('0x5'));var client=jayson[_0xf475('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56c96e,_0x20e5eb,_0x118803){return new BPromise(function(_0x348ab7,_0x24e6d2){return client[_0xf475('0x7')](_0x56c96e,_0x118803)[_0xf475('0x8')](function(_0x793f50){logger[_0xf475('0x9')]('Template,\x20%s,\x20%s',_0x20e5eb,_0xf475('0xa'));logger[_0xf475('0xb')](_0xf475('0xc'),_0x20e5eb,_0xf475('0xa'),JSON[_0xf475('0xd')](_0x793f50));if(_0x793f50[_0xf475('0xe')]){if(_0x793f50[_0xf475('0xe')][_0xf475('0xf')]===0x1f4){logger[_0xf475('0xe')](_0xf475('0x10'),_0x20e5eb,_0x793f50[_0xf475('0xe')]['message']);return _0x24e6d2(_0x793f50['error']['message']);}logger[_0xf475('0xe')](_0xf475('0x10'),_0x20e5eb,_0x793f50[_0xf475('0xe')][_0xf475('0x11')]);return _0x348ab7(_0x793f50[_0xf475('0xe')]['message']);}else{logger[_0xf475('0x9')](_0xf475('0x10'),_0x20e5eb,_0xf475('0xa'));_0x348ab7(_0x793f50[_0xf475('0x12')][_0xf475('0x11')]);}})[_0xf475('0x13')](function(_0x235fe8){logger['error'](_0xf475('0x10'),_0x20e5eb,_0x235fe8);_0x24e6d2(_0x235fe8);});});}exports[_0xf475('0x14')]=function(_0x526bf3){var _0x377b1b=this;return new Promise(function(_0x5a37ee,_0x4e8518){return db[_0xf475('0x15')]['findAll']({'raw':_0x526bf3[_0xf475('0x16')]?_0x526bf3[_0xf475('0x16')][_0xf475('0x17')]===undefined?!![]:![]:!![],'where':_0x526bf3['options']?_0x526bf3[_0xf475('0x16')][_0xf475('0x18')]||null:null,'attributes':_0x526bf3[_0xf475('0x16')]?_0x526bf3['options'][_0xf475('0x19')]||null:null,'limit':_0x526bf3[_0xf475('0x16')]?_0x526bf3[_0xf475('0x16')][_0xf475('0x1a')]||null:null,'include':_0x526bf3[_0xf475('0x16')]?_0x526bf3[_0xf475('0x16')][_0xf475('0x1b')]?_[_0xf475('0x1c')](_0x526bf3[_0xf475('0x16')][_0xf475('0x1b')],function(_0x52cf06){return{'model':db[_0x52cf06[_0xf475('0x1d')]],'as':_0x52cf06['as'],'attributes':_0x52cf06[_0xf475('0x19')],'include':_0x52cf06['include']?_[_0xf475('0x1c')](_0x52cf06[_0xf475('0x1b')],function(_0x58eb7a){return{'model':db[_0x58eb7a['model']],'as':_0x58eb7a['as'],'attributes':_0x58eb7a[_0xf475('0x19')],'include':_0x58eb7a[_0xf475('0x1b')]?_[_0xf475('0x1c')](_0x58eb7a['include'],function(_0x4ecc73){return{'model':db[_0x4ecc73[_0xf475('0x1d')]],'as':_0x4ecc73['as'],'attributes':_0x4ecc73[_0xf475('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf475('0x8')](function(_0x51992d){logger[_0xf475('0x9')]('GetTemplate',_0x526bf3);logger[_0xf475('0xb')]('GetTemplate',_0x526bf3,JSON[_0xf475('0xd')](_0x51992d));_0x5a37ee(_0x51992d);})['catch'](function(_0x5504d9){logger[_0xf475('0xe')](_0xf475('0x14'),_0x5504d9[_0xf475('0x11')],_0x526bf3);_0x4e8518(_0x377b1b[_0xf475('0xe')](0x1f4,_0x5504d9['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b74f02c..d474236 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 _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 +var _0xf4d4=['create','post','addAllCondition','addAnyCondition','/:id/actions','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','getAllConditions','/:id/any_conditions','isAuthenticated','getAnyConditions'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xf4d4,0xf3));var _0x4f4d=function(_0x168c2b,_0x294e03){_0x168c2b=_0x168c2b-0x0;var _0x310e11=_0xf4d4[_0x168c2b];return _0x310e11;};'use strict';var multer=require(_0x4f4d('0x0'));var util=require(_0x4f4d('0x1'));var path=require(_0x4f4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f4d('0x3'));var router=express[_0x4f4d('0x4')]();var fs_extra=require(_0x4f4d('0x5'));var auth=require(_0x4f4d('0x6'));var interaction=require(_0x4f4d('0x7'));var config=require(_0x4f4d('0x8'));var controller=require(_0x4f4d('0x9'));router[_0x4f4d('0xa')]('/',auth['isAuthenticated'](),controller[_0x4f4d('0xb')]);router['get'](_0x4f4d('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x4f4d('0xd')]);router['get'](_0x4f4d('0xe'),auth[_0x4f4d('0xf')](),controller[_0x4f4d('0x10')]);router[_0x4f4d('0xa')]('/:id/actions',auth[_0x4f4d('0xf')](),controller['getActions']);router['post']('/',auth[_0x4f4d('0xf')](),controller[_0x4f4d('0x11')]);router[_0x4f4d('0x12')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x4f4d('0x13')]);router[_0x4f4d('0x12')]('/:id/any_conditions',auth[_0x4f4d('0xf')](),controller[_0x4f4d('0x14')]);router[_0x4f4d('0x12')](_0x4f4d('0x15'),auth[_0x4f4d('0xf')](),controller['addAction']);router[_0x4f4d('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4f4d('0x17')](_0x4f4d('0xc'),auth[_0x4f4d('0xf')](),controller[_0x4f4d('0x18')]);module[_0x4f4d('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d7a15d6..1118ee4 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 _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 +var _0x06bb=['sequelize','STRING','BOOLEAN'];(function(_0x4d6cc1,_0x3750ed){var _0x5e4cf3=function(_0x13504e){while(--_0x13504e){_0x4d6cc1['push'](_0x4d6cc1['shift']());}};_0x5e4cf3(++_0x3750ed);}(_0x06bb,0x1bc));var _0xb06b=function(_0x22cf3b,_0x43d357){_0x22cf3b=_0x22cf3b-0x0;var _0x36ac8a=_0x06bb[_0x22cf3b];return _0x36ac8a;};'use strict';var Sequelize=require(_0xb06b('0x0'));module['exports']={'name':{'type':Sequelize[_0xb06b('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb06b('0x1')]},'status':{'type':Sequelize[_0xb06b('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index ccf0fd4..951505c 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 _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 +var _0x6f66=['update','then','destroy','Triggers','UserProfileResource','end','stack','name','send','index','map','Trigger','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','rows','catch','intersection','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','findOne','order','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','reject','save'];(function(_0x37e8e8,_0x1be63e){var _0x2c3c9e=function(_0x4e3a54){while(--_0x4e3a54){_0x37e8e8['push'](_0x37e8e8['shift']());}};_0x2c3c9e(++_0x1be63e);}(_0x6f66,0x1ed));var _0x66f6=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x6f66[_0x3bab09];return _0x164376;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x66f6('0x0'));var rp=require(_0x66f6('0x1'));var moment=require(_0x66f6('0x2'));var BPromise=require(_0x66f6('0x3'));var Mustache=require(_0x66f6('0x4'));var util=require(_0x66f6('0x5'));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(_0x66f6('0x6'));var _=require(_0x66f6('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x66f6('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x66f6('0x9'));var authService=require(_0x66f6('0xa'));var qs=require(_0x66f6('0xb'));var as=require(_0x66f6('0xc'));var hardwareService=require(_0x66f6('0xd'));var logger=require(_0x66f6('0xe'))(_0x66f6('0xf'));var utils=require(_0x66f6('0x10'));var config=require(_0x66f6('0x11'));var licenseUtil=require(_0x66f6('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3691ab,_0x499b17){_0x499b17=_0x499b17||0xcc;return function(_0x142461){if(_0x142461){return _0x3691ab[_0x66f6('0x13')](_0x499b17);}return _0x3691ab['status'](_0x499b17)['end']();};}function respondWithResult(_0xcf818,_0x5435d9){_0x5435d9=_0x5435d9||0xc8;return function(_0x59dad4){if(_0x59dad4){return _0xcf818[_0x66f6('0x14')](_0x5435d9)[_0x66f6('0x15')](_0x59dad4);}};}function respondWithFilteredResult(_0x3228d2,_0x30f649){return function(_0x7f07da){if(_0x7f07da){var _0x1ababd=typeof _0x30f649['offset']==='undefined'&&typeof _0x30f649[_0x66f6('0x16')]===_0x66f6('0x17');var _0x3f5bb5=_0x7f07da[_0x66f6('0x18')];var _0x142eb4=_0x1ababd?0x0:_0x30f649[_0x66f6('0x19')];var _0x53ebbb=_0x1ababd?_0x7f07da[_0x66f6('0x18')]:_0x30f649['offset']+_0x30f649[_0x66f6('0x16')];var _0x3e7dbd;if(_0x53ebbb>=_0x3f5bb5){_0x53ebbb=_0x3f5bb5;_0x3e7dbd=0xc8;}else{_0x3e7dbd=0xce;}_0x3228d2[_0x66f6('0x14')](_0x3e7dbd);return _0x3228d2[_0x66f6('0x1a')]('Content-Range',_0x142eb4+'-'+_0x53ebbb+'/'+_0x3f5bb5)[_0x66f6('0x15')](_0x7f07da);}return null;};}function patchUpdates(_0x43453a){return function(_0x5ef05b){try{jsonpatch['apply'](_0x5ef05b,_0x43453a,!![]);}catch(_0x3dbf2a){return BPromise[_0x66f6('0x1b')](_0x3dbf2a);}return _0x5ef05b[_0x66f6('0x1c')]();};}function saveUpdates(_0xc9419c,_0x39ca18){return function(_0x5b6176){if(_0x5b6176){return _0x5b6176[_0x66f6('0x1d')](_0xc9419c)[_0x66f6('0x1e')](function(_0x5de321){return _0x5de321;});}return null;};}function removeEntity(_0x558af0,_0x39d623){return function(_0x5e3d2d){if(_0x5e3d2d){return _0x5e3d2d[_0x66f6('0x1f')]()['then'](function(){var _0x278537=_0x5e3d2d['get']({'plain':!![]});var _0x4acad0=_0x66f6('0x20');return db[_0x66f6('0x21')][_0x66f6('0x1f')]({'where':{'type':_0x4acad0,'resourceId':_0x278537['id']}})[_0x66f6('0x1e')](function(){return _0x5e3d2d;});})[_0x66f6('0x1e')](function(){_0x558af0[_0x66f6('0x14')](0xcc)[_0x66f6('0x22')]();});}};}function handleEntityNotFound(_0x495b86,_0x5d708e){return function(_0x2e162f){if(!_0x2e162f){_0x495b86[_0x66f6('0x13')](0x194);}return _0x2e162f;};}function handleError(_0x2f1a0f,_0x73c0ce){_0x73c0ce=_0x73c0ce||0x1f4;return function(_0x297e19){logger['error'](_0x297e19[_0x66f6('0x23')]);if(_0x297e19[_0x66f6('0x24')]){delete _0x297e19[_0x66f6('0x24')];}_0x2f1a0f[_0x66f6('0x14')](_0x73c0ce)[_0x66f6('0x25')](_0x297e19);};}exports[_0x66f6('0x26')]=function(_0x3cb934,_0x482df8){var _0x10c55e={},_0x3cce62={},_0x474b6f={'count':0x0,'rows':[]};var _0x1d30d1=_[_0x66f6('0x27')](db[_0x66f6('0x28')][_0x66f6('0x29')],function(_0x55d1d1){return{'name':_0x55d1d1[_0x66f6('0x2a')],'type':_0x55d1d1['type']['key']};});_0x3cce62[_0x66f6('0x2b')]=_[_0x66f6('0x27')](_0x1d30d1,_0x66f6('0x24'));_0x3cce62[_0x66f6('0x2c')]=_[_0x66f6('0x2d')](_0x3cb934[_0x66f6('0x2c')]);_0x3cce62[_0x66f6('0x2e')]=_['intersection'](_0x3cce62[_0x66f6('0x2b')],_0x3cce62[_0x66f6('0x2c')]);_0x10c55e[_0x66f6('0x2f')]=_['intersection'](_0x3cce62[_0x66f6('0x2b')],qs[_0x66f6('0x30')](_0x3cb934[_0x66f6('0x2c')][_0x66f6('0x30')]));_0x10c55e[_0x66f6('0x2f')]=_0x10c55e['attributes'][_0x66f6('0x31')]?_0x10c55e[_0x66f6('0x2f')]:_0x3cce62[_0x66f6('0x2b')];if(!_0x3cb934['query'][_0x66f6('0x32')](_0x66f6('0x33'))){_0x10c55e[_0x66f6('0x16')]=qs[_0x66f6('0x16')](_0x3cb934[_0x66f6('0x2c')]['limit']);_0x10c55e['offset']=qs[_0x66f6('0x19')](_0x3cb934[_0x66f6('0x2c')][_0x66f6('0x19')]);}_0x10c55e['order']=qs[_0x66f6('0x34')](_0x3cb934['query'][_0x66f6('0x34')]);_0x10c55e[_0x66f6('0x35')]=qs['filters'](_[_0x66f6('0x36')](_0x3cb934['query'],_0x3cce62[_0x66f6('0x2e')]),_0x1d30d1);if(_0x3cb934[_0x66f6('0x2c')][_0x66f6('0x37')]){_0x10c55e[_0x66f6('0x35')]=_[_0x66f6('0x38')](_0x10c55e['where'],{'$or':_[_0x66f6('0x27')](_0x1d30d1,function(_0x1fd5f3){if(_0x1fd5f3[_0x66f6('0x39')]!==_0x66f6('0x3a')){var _0x50190c={};_0x50190c[_0x1fd5f3[_0x66f6('0x24')]]={'$like':'%'+_0x3cb934['query'][_0x66f6('0x37')]+'%'};return _0x50190c;}})});}_0x10c55e=_[_0x66f6('0x38')]({},_0x10c55e,_0x3cb934[_0x66f6('0x3b')]);var _0xac094d={'where':_0x10c55e['where']};return db[_0x66f6('0x28')][_0x66f6('0x18')](_0xac094d)[_0x66f6('0x1e')](function(_0x4b834c){_0x474b6f[_0x66f6('0x18')]=_0x4b834c;if(_0x3cb934['query']['includeAll']){_0x10c55e['include']=[{'all':!![]}];}return db[_0x66f6('0x28')]['findAll'](_0x10c55e);})['then'](function(_0x535fc1){_0x474b6f[_0x66f6('0x3c')]=_0x535fc1;return _0x474b6f;})[_0x66f6('0x1e')](respondWithFilteredResult(_0x482df8,_0x10c55e))[_0x66f6('0x3d')](handleError(_0x482df8,null));};exports['show']=function(_0xfe87b6,_0x216de1){var _0x12f5e1={'raw':![],'where':{'id':_0xfe87b6['params']['id']}},_0x2f67d8={};_0x2f67d8[_0x66f6('0x2b')]=_['keys'](db['Trigger'][_0x66f6('0x29')]);_0x2f67d8[_0x66f6('0x2c')]=_[_0x66f6('0x2d')](_0xfe87b6[_0x66f6('0x2c')]);_0x2f67d8['filters']=_[_0x66f6('0x3e')](_0x2f67d8[_0x66f6('0x2b')],_0x2f67d8[_0x66f6('0x2c')]);_0x12f5e1[_0x66f6('0x2f')]=_[_0x66f6('0x3e')](_0x2f67d8[_0x66f6('0x2b')],qs['fields'](_0xfe87b6[_0x66f6('0x2c')][_0x66f6('0x30')]));_0x12f5e1[_0x66f6('0x2f')]=_0x12f5e1[_0x66f6('0x2f')][_0x66f6('0x31')]?_0x12f5e1[_0x66f6('0x2f')]:_0x2f67d8[_0x66f6('0x2b')];if(_0xfe87b6[_0x66f6('0x2c')][_0x66f6('0x3f')]){_0x12f5e1['include']=[{'all':!![]}];}_0x12f5e1=_[_0x66f6('0x38')]({},_0x12f5e1,_0xfe87b6[_0x66f6('0x3b')]);return db[_0x66f6('0x28')][_0x66f6('0x40')](_0x12f5e1)[_0x66f6('0x1e')](handleEntityNotFound(_0x216de1,null))[_0x66f6('0x1e')](respondWithResult(_0x216de1,null))[_0x66f6('0x3d')](handleError(_0x216de1,null));};exports['create']=function(_0x2eb801,_0x30fa2d){return db[_0x66f6('0x28')][_0x66f6('0x41')](_0x2eb801['body'],{})[_0x66f6('0x1e')](function(_0xb401b9){var _0x3aac4d=_0x2eb801['user'][_0x66f6('0x42')]({'plain':!![]});if(!_0x3aac4d)throw new Error(_0x66f6('0x43'));if(_0x3aac4d[_0x66f6('0x44')]==='user'){var _0x210619=_0xb401b9['get']({'plain':!![]});var _0x3abf5f='Triggers';return db['UserProfileSection'][_0x66f6('0x40')]({'where':{'name':_0x3abf5f,'userProfileId':_0x3aac4d[_0x66f6('0x45')]},'raw':!![]})[_0x66f6('0x1e')](function(_0xecfa5a){if(_0xecfa5a&&_0xecfa5a[_0x66f6('0x46')]===0x0){return db[_0x66f6('0x21')][_0x66f6('0x41')]({'name':_0x210619[_0x66f6('0x24')],'resourceId':_0x210619['id'],'type':_0xecfa5a[_0x66f6('0x24')],'sectionId':_0xecfa5a['id']},{})['then'](function(){return _0xb401b9;});}else{return _0xb401b9;}})[_0x66f6('0x3d')](function(_0x548680){logger[_0x66f6('0x47')](_0x66f6('0x48'),_0x548680);throw _0x548680;});}return _0xb401b9;})[_0x66f6('0x1e')](respondWithResult(_0x30fa2d,0xc9))['catch'](handleError(_0x30fa2d,null));};exports[_0x66f6('0x1d')]=function(_0xe46620,_0x237ad4){if(_0xe46620['body']['id']){delete _0xe46620[_0x66f6('0x49')]['id'];}return db[_0x66f6('0x28')][_0x66f6('0x40')]({'where':{'id':_0xe46620[_0x66f6('0x4a')]['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x237ad4,null))[_0x66f6('0x1e')](saveUpdates(_0xe46620['body'],null))['then'](respondWithResult(_0x237ad4,null))[_0x66f6('0x3d')](handleError(_0x237ad4,null));};exports[_0x66f6('0x1f')]=function(_0x255931,_0x2d8727){return db['Trigger'][_0x66f6('0x40')]({'where':{'id':_0x255931[_0x66f6('0x4a')]['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x2d8727,null))[_0x66f6('0x1e')](removeEntity(_0x2d8727,null))[_0x66f6('0x3d')](handleError(_0x2d8727,null));};exports[_0x66f6('0x4b')]=function(_0x4389fe,_0x274484,_0x5154a5){if(_0x4389fe[_0x66f6('0x49')]['id']){delete _0x4389fe[_0x66f6('0x49')]['id'];}return db['Trigger'][_0x66f6('0x40')]({'where':{'id':_0x4389fe[_0x66f6('0x4a')]['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x274484,null))['then'](function(_0x1bfe4a){if(_0x1bfe4a){_0x4389fe[_0x66f6('0x49')][_0x66f6('0x4c')]=_0x1bfe4a['id'];return db[_0x66f6('0x4d')][_0x66f6('0x41')](_0x4389fe[_0x66f6('0x49')]);}})[_0x66f6('0x1e')](respondWithResult(_0x274484,null))[_0x66f6('0x3d')](handleError(_0x274484,null));};exports[_0x66f6('0x4e')]=function(_0x8e2531,_0x47542a,_0x29dbae){if(_0x8e2531[_0x66f6('0x49')]['id']){delete _0x8e2531[_0x66f6('0x49')]['id'];}return db[_0x66f6('0x28')][_0x66f6('0x40')]({'where':{'id':_0x8e2531[_0x66f6('0x4a')]['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x47542a,null))[_0x66f6('0x1e')](function(_0x46818f){if(_0x46818f){_0x8e2531[_0x66f6('0x49')]['TriggerAnyId']=_0x46818f['id'];return db[_0x66f6('0x4d')][_0x66f6('0x41')](_0x8e2531[_0x66f6('0x49')]);}})[_0x66f6('0x1e')](respondWithResult(_0x47542a,null))[_0x66f6('0x3d')](handleError(_0x47542a,null));};exports['getAllConditions']=function(_0x824e24,_0x357fb5,_0x4358d5){var _0x41a0ea={};var _0x51bf65={};var _0x310626;var _0x551a8c;return db[_0x66f6('0x28')][_0x66f6('0x4f')]({'where':{'id':_0x824e24[_0x66f6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x357fb5,null))[_0x66f6('0x1e')](function(_0x3cbc1b){if(_0x3cbc1b){_0x310626=_0x3cbc1b;_0x51bf65['model']=_['keys'](db[_0x66f6('0x4d')]['rawAttributes']);_0x51bf65['query']=_[_0x66f6('0x2d')](_0x824e24[_0x66f6('0x2c')]);_0x51bf65[_0x66f6('0x2e')]=_[_0x66f6('0x3e')](_0x51bf65[_0x66f6('0x2b')],_0x51bf65[_0x66f6('0x2c')]);_0x41a0ea[_0x66f6('0x2f')]=_[_0x66f6('0x3e')](_0x51bf65[_0x66f6('0x2b')],qs[_0x66f6('0x30')](_0x824e24[_0x66f6('0x2c')][_0x66f6('0x30')]));_0x41a0ea[_0x66f6('0x2f')]=_0x41a0ea[_0x66f6('0x2f')]['length']?_0x41a0ea[_0x66f6('0x2f')]:_0x51bf65[_0x66f6('0x2b')];_0x41a0ea[_0x66f6('0x50')]=qs['sort'](_0x824e24[_0x66f6('0x2c')][_0x66f6('0x34')]);_0x41a0ea['where']=qs[_0x66f6('0x2e')](_[_0x66f6('0x36')](_0x824e24['query'],_0x51bf65['filters']));if(_0x824e24[_0x66f6('0x2c')][_0x66f6('0x37')]){_0x41a0ea['where']=_[_0x66f6('0x38')](_0x41a0ea[_0x66f6('0x35')],{'$or':_['map'](_0x41a0ea[_0x66f6('0x2f')],function(_0x27a80f){var _0x4a32d5={};_0x4a32d5[_0x27a80f]={'$like':'%'+_0x824e24[_0x66f6('0x2c')][_0x66f6('0x37')]+'%'};return _0x4a32d5;})});}_0x41a0ea=_[_0x66f6('0x38')]({},_0x41a0ea,_0x824e24['options']);return _0x310626[_0x66f6('0x51')](_0x41a0ea);}})['then'](function(_0x4363c2){if(_0x4363c2){_0x551a8c=_0x4363c2[_0x66f6('0x31')];if(!_0x824e24[_0x66f6('0x2c')][_0x66f6('0x32')](_0x66f6('0x33'))){_0x41a0ea[_0x66f6('0x16')]=qs['limit'](_0x824e24['query'][_0x66f6('0x16')]);_0x41a0ea[_0x66f6('0x19')]=qs['offset'](_0x824e24[_0x66f6('0x2c')][_0x66f6('0x19')]);}return _0x310626[_0x66f6('0x51')](_0x41a0ea);}})[_0x66f6('0x1e')](function(_0x777976){if(_0x777976){return _0x777976?{'count':_0x551a8c,'rows':_0x777976}:null;}})[_0x66f6('0x1e')](respondWithResult(_0x357fb5,null))[_0x66f6('0x3d')](handleError(_0x357fb5,null));};exports[_0x66f6('0x52')]=function(_0x33434f,_0x29f2a4,_0x5430a0){var _0x682b={};var _0x2816fb={};var _0x19903e;var _0x330acf;return db[_0x66f6('0x28')][_0x66f6('0x4f')]({'where':{'id':_0x33434f['params']['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x29f2a4,null))[_0x66f6('0x1e')](function(_0x6d5c51){if(_0x6d5c51){_0x19903e=_0x6d5c51;_0x2816fb[_0x66f6('0x2b')]=_[_0x66f6('0x2d')](db[_0x66f6('0x4d')][_0x66f6('0x29')]);_0x2816fb[_0x66f6('0x2c')]=_[_0x66f6('0x2d')](_0x33434f['query']);_0x2816fb[_0x66f6('0x2e')]=_['intersection'](_0x2816fb[_0x66f6('0x2b')],_0x2816fb[_0x66f6('0x2c')]);_0x682b[_0x66f6('0x2f')]=_['intersection'](_0x2816fb[_0x66f6('0x2b')],qs['fields'](_0x33434f[_0x66f6('0x2c')][_0x66f6('0x30')]));_0x682b[_0x66f6('0x2f')]=_0x682b['attributes'][_0x66f6('0x31')]?_0x682b['attributes']:_0x2816fb['model'];_0x682b[_0x66f6('0x50')]=qs['sort'](_0x33434f['query'][_0x66f6('0x34')]);_0x682b['where']=qs[_0x66f6('0x2e')](_[_0x66f6('0x36')](_0x33434f[_0x66f6('0x2c')],_0x2816fb[_0x66f6('0x2e')]));if(_0x33434f['query'][_0x66f6('0x37')]){_0x682b[_0x66f6('0x35')]=_[_0x66f6('0x38')](_0x682b[_0x66f6('0x35')],{'$or':_[_0x66f6('0x27')](_0x682b[_0x66f6('0x2f')],function(_0x16b672){var _0x40d8ad={};_0x40d8ad[_0x16b672]={'$like':'%'+_0x33434f[_0x66f6('0x2c')][_0x66f6('0x37')]+'%'};return _0x40d8ad;})});}_0x682b=_[_0x66f6('0x38')]({},_0x682b,_0x33434f[_0x66f6('0x3b')]);return _0x19903e[_0x66f6('0x52')](_0x682b);}})['then'](function(_0x17a865){if(_0x17a865){_0x330acf=_0x17a865[_0x66f6('0x31')];if(!_0x33434f['query'][_0x66f6('0x32')](_0x66f6('0x33'))){_0x682b[_0x66f6('0x16')]=qs[_0x66f6('0x16')](_0x33434f[_0x66f6('0x2c')][_0x66f6('0x16')]);_0x682b[_0x66f6('0x19')]=qs[_0x66f6('0x19')](_0x33434f[_0x66f6('0x2c')]['offset']);}return _0x19903e[_0x66f6('0x52')](_0x682b);}})['then'](function(_0x288ea9){if(_0x288ea9){return _0x288ea9?{'count':_0x330acf,'rows':_0x288ea9}:null;}})[_0x66f6('0x1e')](respondWithResult(_0x29f2a4,null))[_0x66f6('0x3d')](handleError(_0x29f2a4,null));};exports[_0x66f6('0x53')]=function(_0x1acf8c,_0x12d287,_0x21293a){if(_0x1acf8c[_0x66f6('0x49')]['id']){delete _0x1acf8c[_0x66f6('0x49')]['id'];}return db[_0x66f6('0x28')]['find']({'where':{'id':_0x1acf8c[_0x66f6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12d287,null))['then'](function(_0x3aa824){if(_0x3aa824){_0x1acf8c[_0x66f6('0x49')][_0x66f6('0x54')]=_0x3aa824['id'];return db[_0x66f6('0x55')][_0x66f6('0x41')](_0x1acf8c[_0x66f6('0x49')]);}})['then'](respondWithResult(_0x12d287,null))[_0x66f6('0x3d')](handleError(_0x12d287,null));};exports['getActions']=function(_0x440ebf,_0x4ff62d,_0x50291b){var _0x3c204c={};var _0x24afa5={};var _0x54a23f;var _0x47df13;return db[_0x66f6('0x28')][_0x66f6('0x4f')]({'where':{'id':_0x440ebf[_0x66f6('0x4a')]['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x4ff62d,null))[_0x66f6('0x1e')](function(_0x5ccddf){if(_0x5ccddf){_0x54a23f=_0x5ccddf;_0x24afa5[_0x66f6('0x2b')]=_[_0x66f6('0x2d')](db[_0x66f6('0x55')]['rawAttributes']);_0x24afa5[_0x66f6('0x2c')]=_['keys'](_0x440ebf[_0x66f6('0x2c')]);_0x24afa5[_0x66f6('0x2e')]=_[_0x66f6('0x3e')](_0x24afa5[_0x66f6('0x2b')],_0x24afa5[_0x66f6('0x2c')]);_0x3c204c[_0x66f6('0x2f')]=_[_0x66f6('0x3e')](_0x24afa5[_0x66f6('0x2b')],qs['fields'](_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x30')]));_0x3c204c[_0x66f6('0x2f')]=_0x3c204c[_0x66f6('0x2f')][_0x66f6('0x31')]?_0x3c204c[_0x66f6('0x2f')]:_0x24afa5[_0x66f6('0x2b')];_0x3c204c[_0x66f6('0x50')]=qs[_0x66f6('0x34')](_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x34')]);_0x3c204c['where']=qs['filters'](_[_0x66f6('0x36')](_0x440ebf[_0x66f6('0x2c')],_0x24afa5['filters']));if(_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x37')]){_0x3c204c[_0x66f6('0x35')]=_['merge'](_0x3c204c[_0x66f6('0x35')],{'$or':_[_0x66f6('0x27')](_0x3c204c[_0x66f6('0x2f')],function(_0x256d75){var _0x2fec28={};_0x2fec28[_0x256d75]={'$like':'%'+_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x37')]+'%'};return _0x2fec28;})});}_0x3c204c=_[_0x66f6('0x38')]({},_0x3c204c,_0x440ebf[_0x66f6('0x3b')]);return _0x54a23f[_0x66f6('0x56')](_0x3c204c);}})[_0x66f6('0x1e')](function(_0x4625c4){if(_0x4625c4){_0x47df13=_0x4625c4[_0x66f6('0x31')];if(!_0x440ebf[_0x66f6('0x2c')]['hasOwnProperty']('nolimit')){_0x3c204c['limit']=qs['limit'](_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x16')]);_0x3c204c['offset']=qs['offset'](_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x19')]);}return _0x54a23f[_0x66f6('0x56')](_0x3c204c);}})[_0x66f6('0x1e')](function(_0x5adb48){if(_0x5adb48){return _0x5adb48?{'count':_0x47df13,'rows':_0x5adb48}:null;}})[_0x66f6('0x1e')](respondWithResult(_0x4ff62d,null))['catch'](handleError(_0x4ff62d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index b12f7ab..9bf5957 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 _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 +var _0x72a2=['define','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0x72a2,0x161));var _0x272a=function(_0x1c12e5,_0x1c9271){_0x1c12e5=_0x1c12e5-0x0;var _0x46eb65=_0x72a2[_0x1c12e5];return _0x46eb65;};'use strict';var _=require('lodash');var util=require(_0x272a('0x0'));var logger=require(_0x272a('0x1'))(_0x272a('0x2'));var moment=require(_0x272a('0x3'));var BPromise=require(_0x272a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x272a('0x5'));var rimraf=require('rimraf');var config=require(_0x272a('0x6'));var attributes=require('./trigger.attributes');module['exports']=function(_0x4f628a,_0x2ba5db){return _0x4f628a[_0x272a('0x7')](_0x272a('0x8'),attributes,{'tableName':_0x272a('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 485938b..f5e14ad 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 _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 +var _0x09a1=['model','then','stringify','ShowTrigger','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x21387e,_0x3c19d1){var _0x1f63d9=function(_0x524d49){while(--_0x524d49){_0x21387e['push'](_0x21387e['shift']());}};_0x1f63d9(++_0x3c19d1);}(_0x09a1,0x101));var _0x109a=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x09a1[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x109a('0x0'));var util=require('util');var moment=require(_0x109a('0x1'));var BPromise=require(_0x109a('0x2'));var rs=require(_0x109a('0x3'));var fs=require('fs');var Redis=require(_0x109a('0x4'));var db=require(_0x109a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x109a('0x6'))(_0x109a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x109a('0x8')][_0x109a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdeaade,_0x247605,_0x579205){return new BPromise(function(_0x40ba03,_0x585379){return client[_0x109a('0xa')](_0xdeaade,_0x579205)['then'](function(_0x26bae3){logger[_0x109a('0xb')]('Trigger,\x20%s,\x20%s',_0x247605,_0x109a('0xc'));logger[_0x109a('0xd')](_0x109a('0xe'),_0x247605,_0x109a('0xc'),JSON['stringify'](_0x26bae3));if(_0x26bae3['error']){if(_0x26bae3[_0x109a('0xf')][_0x109a('0x10')]===0x1f4){logger[_0x109a('0xf')](_0x109a('0x11'),_0x247605,_0x26bae3['error'][_0x109a('0x12')]);return _0x585379(_0x26bae3[_0x109a('0xf')][_0x109a('0x12')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x247605,_0x26bae3['error'][_0x109a('0x12')]);return _0x40ba03(_0x26bae3[_0x109a('0xf')][_0x109a('0x12')]);}else{logger['info'](_0x109a('0x11'),_0x247605,_0x109a('0xc'));_0x40ba03(_0x26bae3[_0x109a('0x13')][_0x109a('0x12')]);}})[_0x109a('0x14')](function(_0x58fcbf){logger[_0x109a('0xf')](_0x109a('0x11'),_0x247605,_0x58fcbf);_0x585379(_0x58fcbf);});});}exports[_0x109a('0x15')]=function(_0x4f868d){var _0x1071a0=this;return new Promise(function(_0x1a9849,_0x599225){return db[_0x109a('0x16')][_0x109a('0x17')]({'raw':_0x4f868d['options']?_0x4f868d[_0x109a('0x18')][_0x109a('0x19')]===undefined?!![]:![]:!![],'where':_0x4f868d['options']?_0x4f868d[_0x109a('0x18')][_0x109a('0x1a')]||null:null,'attributes':_0x4f868d[_0x109a('0x18')]?_0x4f868d[_0x109a('0x18')][_0x109a('0x1b')]||null:null,'limit':_0x4f868d[_0x109a('0x18')]?_0x4f868d[_0x109a('0x18')][_0x109a('0x1c')]||null:null,'include':_0x4f868d[_0x109a('0x18')]?_0x4f868d['options'][_0x109a('0x1d')]?_[_0x109a('0x1e')](_0x4f868d[_0x109a('0x18')][_0x109a('0x1d')],function(_0x414415){return{'model':db[_0x414415[_0x109a('0x1f')]],'as':_0x414415['as'],'attributes':_0x414415['attributes'],'include':_0x414415[_0x109a('0x1d')]?_[_0x109a('0x1e')](_0x414415[_0x109a('0x1d')],function(_0x5680c6){return{'model':db[_0x5680c6[_0x109a('0x1f')]],'as':_0x5680c6['as'],'attributes':_0x5680c6[_0x109a('0x1b')],'include':_0x5680c6[_0x109a('0x1d')]?_['map'](_0x5680c6[_0x109a('0x1d')],function(_0x5924a8){return{'model':db[_0x5924a8[_0x109a('0x1f')]],'as':_0x5924a8['as'],'attributes':_0x5924a8[_0x109a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x109a('0x20')](function(_0x1c173f){logger[_0x109a('0xb')](_0x109a('0x15'),_0x4f868d);logger[_0x109a('0xd')](_0x109a('0x15'),_0x4f868d,JSON[_0x109a('0x21')](_0x1c173f));_0x1a9849(_0x1c173f);})[_0x109a('0x14')](function(_0x4869eb){logger['error'](_0x109a('0x15'),_0x4869eb[_0x109a('0x12')],_0x4f868d);_0x599225(_0x1071a0[_0x109a('0xf')](0x1f4,_0x4869eb[_0x109a('0x12')]));});});};exports[_0x109a('0x22')]=function(_0x5893ff){var _0x3f9b96=this;return new Promise(function(_0x5a85ca,_0x31fae2){return db[_0x109a('0x16')][_0x109a('0x23')]({'raw':_0x5893ff['options']?_0x5893ff['options']['raw']===undefined?!![]:![]:!![],'where':_0x5893ff[_0x109a('0x18')]?_0x5893ff['options'][_0x109a('0x1a')]||null:null,'attributes':_0x5893ff[_0x109a('0x18')]?_0x5893ff[_0x109a('0x18')][_0x109a('0x1b')]||null:null,'include':_0x5893ff[_0x109a('0x18')]?_0x5893ff[_0x109a('0x18')][_0x109a('0x1d')]?_[_0x109a('0x1e')](_0x5893ff[_0x109a('0x18')][_0x109a('0x1d')],function(_0xe544f2){return{'model':db[_0xe544f2[_0x109a('0x1f')]],'as':_0xe544f2['as'],'attributes':_0xe544f2[_0x109a('0x1b')],'include':_0xe544f2['include']?_[_0x109a('0x1e')](_0xe544f2[_0x109a('0x1d')],function(_0x4132c6){return{'model':db[_0x4132c6[_0x109a('0x1f')]],'as':_0x4132c6['as'],'attributes':_0x4132c6['attributes'],'include':_0x4132c6['include']?_[_0x109a('0x1e')](_0x4132c6[_0x109a('0x1d')],function(_0x406f6b){return{'model':db[_0x406f6b['model']],'as':_0x406f6b['as'],'attributes':_0x406f6b[_0x109a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b2303){logger[_0x109a('0xb')]('ShowTrigger',_0x5893ff);logger[_0x109a('0xd')]('ShowTrigger',_0x5893ff,JSON['stringify'](_0x2b2303));_0x5a85ca(_0x2b2303);})[_0x109a('0x14')](function(_0x15734c){logger[_0x109a('0xf')](_0x109a('0x22'),_0x15734c[_0x109a('0x12')],_0x5893ff);_0x31fae2(_0x3f9b96[_0x109a('0xf')](0x1f4,_0x15734c['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1af8f58..4883737 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 _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 +var _0x41b3=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','create','put','update','destroy','exports'];(function(_0x96845e,_0x4d95c3){var _0x5a1c3e=function(_0x29fc7c){while(--_0x29fc7c){_0x96845e['push'](_0x96845e['shift']());}};_0x5a1c3e(++_0x4d95c3);}(_0x41b3,0x1db));var _0x341b=function(_0x3d82fb,_0x1a84f5){_0x3d82fb=_0x3d82fb-0x0;var _0x29bbb3=_0x41b3[_0x3d82fb];return _0x29bbb3;};'use strict';var multer=require(_0x341b('0x0'));var util=require(_0x341b('0x1'));var path=require(_0x341b('0x2'));var timeout=require(_0x341b('0x3'));var express=require('express');var router=express[_0x341b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x341b('0x5'));var interaction=require(_0x341b('0x6'));var config=require('../../config/environment');var controller=require(_0x341b('0x7'));router[_0x341b('0x8')]('/',auth[_0x341b('0x9')](),controller[_0x341b('0xa')]);router['get'](_0x341b('0xb'),auth[_0x341b('0x9')](),controller[_0x341b('0xc')]);router['post'](_0x341b('0xd'),auth[_0x341b('0x9')](),controller['clone']);router['post']('/',auth[_0x341b('0x9')](),controller[_0x341b('0xe')]);router[_0x341b('0xf')](_0x341b('0xb'),auth[_0x341b('0x9')](),controller[_0x341b('0x10')]);router['delete'](_0x341b('0xb'),auth[_0x341b('0x9')](),controller[_0x341b('0x11')]);module[_0x341b('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9395bb5..fb2e8bd 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 _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 +var _0x944c=['sequelize','name','ENUM','friend','user','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','getDataValue','transport','split','rfc2833','info','shortinfo','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','port,invite','insecure','INTEGER','\x22\x22\x20<>','always','refuse','uas','pai','fingerprint','certificate','active','passive','dynamic'];(function(_0x5248a7,_0x1604da){var _0x1ac3ee=function(_0x7c02b){while(--_0x7c02b){_0x5248a7['push'](_0x5248a7['shift']());}};_0x1ac3ee(++_0x1604da);}(_0x944c,0xe1));var _0xc944=function(_0x38c121,_0x29c927){_0x38c121=_0x38c121-0x0;var _0x21c1f5=_0x944c[_0x38c121];return _0x21c1f5;};'use strict';var Sequelize=require(_0xc944('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc944('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x3'),_0xc944('0x4'),'peer'),'allowNull':![],'defaultValue':_0xc944('0x3')},'context':{'type':Sequelize[_0xc944('0x5')],'allowNull':![],'defaultValue':_0xc944('0x6')},'callingpres':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x7'),_0xc944('0x8'),_0xc944('0x9'),_0xc944('0xa'),_0xc944('0xb'),_0xc944('0xc'),_0xc944('0xd'),_0xc944('0xe'))},'deny':{'type':Sequelize[_0xc944('0x5')]},'permit':{'type':Sequelize[_0xc944('0x5')]},'secret':{'type':Sequelize[_0xc944('0x5')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xc944('0x5')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x57dacb){this[_0xc944('0xf')]('transport',_0x57dacb?_0x57dacb['join'](','):null);},'get':function(){return this[_0xc944('0x10')](_0xc944('0x11'))?this[_0xc944('0x10')](_0xc944('0x11'))[_0xc944('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x13'),_0xc944('0x14'),_0xc944('0x15'),'inband','auto'),'defaultValue':_0xc944('0x13')},'directmedia':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no',_0xc944('0x17'),_0xc944('0x18'),_0xc944('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc944('0x5')]},'directmediadeny':{'type':Sequelize[_0xc944('0x5')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xc944('0x1a'),'set':function(_0x2c89f0){this[_0xc944('0xf')](_0xc944('0x1b'),_0x2c89f0?_0x2c89f0[_0xc944('0x1c')](','):null);},'get':function(){return this[_0xc944('0x10')](_0xc944('0x1b'))?this[_0xc944('0x10')](_0xc944('0x1b'))[_0xc944('0x12')](','):null;},'comment':_0xc944('0x1d')},'callgroup':{'type':Sequelize[_0xc944('0x5')]},'namedcallgroup':{'type':Sequelize[_0xc944('0x5')]},'pickupgroup':{'type':Sequelize[_0xc944('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xc944('0x5')]},'language':{'type':Sequelize[_0xc944('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc944('0x5')],'defaultValue':_0xc944('0x1e')},'allow':{'type':Sequelize[_0xc944('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x18afeb){this['setDataValue']('allow',_0x18afeb?_0x18afeb[_0xc944('0x1c')](';'):_0xc944('0x1f'));},'get':function(){return this[_0xc944('0x10')]('allow')?this[_0xc944('0x10')]('allow')[_0xc944('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'insecure':{'type':Sequelize[_0xc944('0x5')],'defaultValue':_0xc944('0x20'),'set':function(_0x1f3f9d){this[_0xc944('0xf')](_0xc944('0x21'),_0x1f3f9d?_0x1f3f9d[_0xc944('0x1c')](','):null);},'get':function(){return this[_0xc944('0x10')]('insecure')?this[_0xc944('0x10')](_0xc944('0x21'))[_0xc944('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'accountcode':{'type':Sequelize[_0xc944('0x22')](0xb)},'setvar':{'type':Sequelize[_0xc944('0x5')]},'callerid':{'type':Sequelize[_0xc944('0x5')],'defaultValue':_0xc944('0x23')},'amaflags':{'type':Sequelize[_0xc944('0x5')]},'callcounter':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc944('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xc944('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xc944('0x5')]},'videosupport':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no',_0xc944('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no')},'mailbox':{'type':Sequelize[_0xc944('0x5')]},'session_timers':{'type':Sequelize[_0xc944('0x2')]('accept',_0xc944('0x25'),'originate')},'session_expires':{'type':Sequelize[_0xc944('0x22')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc944('0x2')]('uac',_0xc944('0x26')),'defaultValue':_0xc944('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xc944('0x5')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xc944('0x5')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc944('0x22')](0x5)},'qualify':{'type':Sequelize[_0xc944('0x2')]('yes','no'),'defaultValue':_0xc944('0x16')},'keepalive':{'type':Sequelize[_0xc944('0x22')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xc944('0x5')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc944('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc944('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no',_0xc944('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc944('0x5')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xc944('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc944('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0xc944('0x5')]},'contactdeny':{'type':Sequelize[_0xc944('0x5')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xc944('0x22')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no')},'force_avp':{'type':Sequelize[_0xc944('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xc944('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no',_0xc944('0x28'),_0xc944('0x29'))},'dtlsrekey':{'type':Sequelize[_0xc944('0x22')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xc944('0x5')]},'dtlscapath':{'type':Sequelize[_0xc944('0x5')]},'dtlssetup':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x2a'),_0xc944('0x2b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xc944('0x5')]},'call_limit':{'type':Sequelize[_0xc944('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xc944('0x5')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc944('0x5')]},'host':{'type':Sequelize[_0xc944('0x5')],'defaultValue':_0xc944('0x2c')},'canreinvite':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no',_0xc944('0x17'),_0xc944('0x18'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc944('0x5')]},'otherFields':{'type':Sequelize[_0xc944('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc944('0x5')],'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 db452bd..b0342a3 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_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 +var _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','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','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x5cb7ac,_0x368be8){var _0x8cfc1b=function(_0x4c9489){while(--_0x4c9489){_0x5cb7ac['push'](_0x5cb7ac['shift']());}};_0x8cfc1b(++_0x368be8);}(_0xedd9,0xfc));var _0x9edd=function(_0x3d4dd8,_0x4bb657){_0x3d4dd8=_0x3d4dd8-0x0;var _0x57f21e=_0xedd9[_0x3d4dd8];return _0x57f21e;};'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'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index babf45e..5ce7c71 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 _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 +var _0xe6e1=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','Trunk','tools_trunks'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xe6e1,0x197));var _0x1e6e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe6e1[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x1e6e('0x0'));var util=require('util');var logger=require(_0x1e6e('0x1'))(_0x1e6e('0x2'));var moment=require('moment');var BPromise=require(_0x1e6e('0x3'));var rp=require(_0x1e6e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e6e('0x5'));var config=require(_0x1e6e('0x6'));var attributes=require('./trunk.attributes');module[_0x1e6e('0x7')]=function(_0x4243e4,_0x29a2ed){return _0x4243e4[_0x1e6e('0x8')](_0x1e6e('0x9'),attributes,{'tableName':_0x1e6e('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 bb2e31d..89a106d 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 _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 +var _0x1f1b=['model','stringify','catch','ShowTrunk','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','error','code','message','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x223ac5,_0x1ddeb3){var _0x141621=function(_0x27a98a){while(--_0x27a98a){_0x223ac5['push'](_0x223ac5['shift']());}};_0x141621(++_0x1ddeb3);}(_0x1f1b,0x67));var _0xb1f1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1f1b[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xb1f1('0x0'));var util=require(_0xb1f1('0x1'));var moment=require(_0xb1f1('0x2'));var BPromise=require(_0xb1f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1f1('0x4'));var db=require(_0xb1f1('0x5'))['db'];var utils=require(_0xb1f1('0x6'));var logger=require(_0xb1f1('0x7'))(_0xb1f1('0x8'));var config=require(_0xb1f1('0x9'));var jayson=require(_0xb1f1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10e760,_0x41501c,_0x1881d7){return new BPromise(function(_0x28c351,_0x49b228){return client[_0xb1f1('0xb')](_0x10e760,_0x1881d7)[_0xb1f1('0xc')](function(_0x47d2f1){logger[_0xb1f1('0xd')](_0xb1f1('0xe'),_0x41501c,_0xb1f1('0xf'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x41501c,_0xb1f1('0xf'),JSON['stringify'](_0x47d2f1));if(_0x47d2f1[_0xb1f1('0x10')]){if(_0x47d2f1[_0xb1f1('0x10')][_0xb1f1('0x11')]===0x1f4){logger['error'](_0xb1f1('0xe'),_0x41501c,_0x47d2f1[_0xb1f1('0x10')][_0xb1f1('0x12')]);return _0x49b228(_0x47d2f1[_0xb1f1('0x10')][_0xb1f1('0x12')]);}logger['error'](_0xb1f1('0xe'),_0x41501c,_0x47d2f1['error'][_0xb1f1('0x12')]);return _0x28c351(_0x47d2f1[_0xb1f1('0x10')][_0xb1f1('0x12')]);}else{logger[_0xb1f1('0xd')]('Trunk,\x20%s,\x20%s',_0x41501c,'request\x20sent');_0x28c351(_0x47d2f1['result'][_0xb1f1('0x12')]);}})['catch'](function(_0x2c980c){logger[_0xb1f1('0x10')](_0xb1f1('0xe'),_0x41501c,_0x2c980c);_0x49b228(_0x2c980c);});});}exports[_0xb1f1('0x13')]=function(_0xc6ea94){var _0x5a9a04=this;return new Promise(function(_0x1e4c01,_0x5de714){return db[_0xb1f1('0x14')][_0xb1f1('0x15')]({'raw':_0xc6ea94[_0xb1f1('0x16')]?_0xc6ea94['options'][_0xb1f1('0x17')]===undefined?!![]:![]:!![],'where':_0xc6ea94[_0xb1f1('0x16')]?_0xc6ea94[_0xb1f1('0x16')][_0xb1f1('0x18')]||null:null,'attributes':_0xc6ea94['options']?_0xc6ea94[_0xb1f1('0x16')][_0xb1f1('0x19')]||null:null,'limit':_0xc6ea94['options']?_0xc6ea94[_0xb1f1('0x16')][_0xb1f1('0x1a')]||null:null,'include':_0xc6ea94[_0xb1f1('0x16')]?_0xc6ea94[_0xb1f1('0x16')][_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0xc6ea94[_0xb1f1('0x16')][_0xb1f1('0x1b')],function(_0x131ea2){return{'model':db[_0x131ea2[_0xb1f1('0x1d')]],'as':_0x131ea2['as'],'attributes':_0x131ea2[_0xb1f1('0x19')],'include':_0x131ea2[_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0x131ea2[_0xb1f1('0x1b')],function(_0x46d050){return{'model':db[_0x46d050['model']],'as':_0x46d050['as'],'attributes':_0x46d050[_0xb1f1('0x19')],'include':_0x46d050[_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0x46d050[_0xb1f1('0x1b')],function(_0x2d436e){return{'model':db[_0x2d436e[_0xb1f1('0x1d')]],'as':_0x2d436e['as'],'attributes':_0x2d436e[_0xb1f1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb1f1('0xc')](function(_0x21d31f){logger[_0xb1f1('0xd')](_0xb1f1('0x13'),_0xc6ea94);logger['debug'](_0xb1f1('0x13'),_0xc6ea94,JSON[_0xb1f1('0x1e')](_0x21d31f));_0x1e4c01(_0x21d31f);})[_0xb1f1('0x1f')](function(_0x53429d){logger[_0xb1f1('0x10')](_0xb1f1('0x13'),_0x53429d[_0xb1f1('0x12')],_0xc6ea94);_0x5de714(_0x5a9a04['error'](0x1f4,_0x53429d[_0xb1f1('0x12')]));});});};exports['ShowTrunk']=function(_0x1a0971){var _0x2431c1=this;return new Promise(function(_0x1f2ff4,_0x5729dd){return db[_0xb1f1('0x14')]['find']({'raw':_0x1a0971[_0xb1f1('0x16')]?_0x1a0971[_0xb1f1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1a0971[_0xb1f1('0x16')]?_0x1a0971['options'][_0xb1f1('0x18')]||null:null,'attributes':_0x1a0971[_0xb1f1('0x16')]?_0x1a0971[_0xb1f1('0x16')]['attributes']||null:null,'include':_0x1a0971[_0xb1f1('0x16')]?_0x1a0971['options'][_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0x1a0971[_0xb1f1('0x16')][_0xb1f1('0x1b')],function(_0x3f36ff){return{'model':db[_0x3f36ff[_0xb1f1('0x1d')]],'as':_0x3f36ff['as'],'attributes':_0x3f36ff[_0xb1f1('0x19')],'include':_0x3f36ff[_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0x3f36ff[_0xb1f1('0x1b')],function(_0x31aa63){return{'model':db[_0x31aa63['model']],'as':_0x31aa63['as'],'attributes':_0x31aa63[_0xb1f1('0x19')],'include':_0x31aa63[_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0x31aa63[_0xb1f1('0x1b')],function(_0x53463f){return{'model':db[_0x53463f[_0xb1f1('0x1d')]],'as':_0x53463f['as'],'attributes':_0x53463f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1f1('0xc')](function(_0x2cb194){logger[_0xb1f1('0xd')]('ShowTrunk',_0x1a0971);logger['debug'](_0xb1f1('0x20'),_0x1a0971,JSON['stringify'](_0x2cb194));_0x1f2ff4(_0x2cb194);})[_0xb1f1('0x1f')](function(_0x46d007){logger[_0xb1f1('0x10')](_0xb1f1('0x20'),_0x46d007[_0xb1f1('0x12')],_0x1a0971);_0x5729dd(_0x2431c1[_0xb1f1('0x10')](0x1f4,_0x46d007[_0xb1f1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 953b93d..1e464c0 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 _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 +var _0x4de9=['express','Router','../../components/auth/service','./user-setting.controller','isAuthenticated','update','exports'];(function(_0x209972,_0x29181c){var _0x4e82c6=function(_0x2122c0){while(--_0x2122c0){_0x209972['push'](_0x209972['shift']());}};_0x4e82c6(++_0x29181c);}(_0x4de9,0xe0));var _0x94de=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x4de9[_0xb6e43];return _0x47c40f;};'use strict';var express=require(_0x94de('0x0'));var router=express[_0x94de('0x1')]();var auth=require(_0x94de('0x2'));var controller=require(_0x94de('0x3'));router['put']('/:id',auth[_0x94de('0x4')](),controller[_0x94de('0x5')]);module[_0x94de('0x6')]=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 8ec3009..e256d98 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 _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 +var _0xb0d0=['exports','ENUM','DATE','UserId','error','debug'];(function(_0x51a76b,_0x1358fc){var _0x42ab85=function(_0x1210ce){while(--_0x1210ce){_0x51a76b['push'](_0x51a76b['shift']());}};_0x42ab85(++_0x1358fc);}(_0xb0d0,0x148));var _0x0b0d=function(_0x1ab730,_0x26a5dd){_0x1ab730=_0x1ab730-0x0;var _0x565359=_0xb0d0[_0x1ab730];return _0x565359;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x0b0d('0x0'),'warning','info',_0x0b0d('0x1')];module[_0x0b0d('0x2')]={'clientSideLoggingLevel':{'type':Sequelize[_0x0b0d('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0b0d('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0b0d('0x4')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x0b0d('0x5')}}; \ 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 d8f9722..376f972 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 _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 +var _0x8fed=['Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','status','update','then','stack','name','send','user','role','Unauthorized','params'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8fed,0xf5));var _0xd8fe=function(_0xeb8a12,_0x222a56){_0xeb8a12=_0xeb8a12-0x0;var _0x172eae=_0x8fed[_0xeb8a12];return _0x172eae;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0xd8fe('0x0'))(_0xd8fe('0x1'));var config=require(_0xd8fe('0x2'));var db=require(_0xd8fe('0x3'))['db'];var socket=require(_0xd8fe('0x4'))(new Redis(config['redis']));require(_0xd8fe('0x5'))[_0xd8fe('0x6')](socket);config[_0xd8fe('0x7')]=_[_0xd8fe('0x8')](config[_0xd8fe('0x7')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x7e3b94,_0x1747b3){_0x1747b3=_0x1747b3||0xc8;return function(_0xa33e22){if(_0xa33e22){return _0x7e3b94[_0xd8fe('0x9')](_0x1747b3)['json'](_0xa33e22);}};}function saveUpdates(_0x1c360b){return function(_0x4b9dc5){if(_0x4b9dc5){return _0x4b9dc5[_0xd8fe('0xa')](_0x1c360b)[_0xd8fe('0xb')](function(_0x369943){return _0x369943;});}return null;};}function handleEntityNotFound(_0x25c7ac){return function(_0x2a4142){if(!_0x2a4142){_0x25c7ac['sendStatus'](0x194);}return _0x2a4142;};}function handleError(_0x2228a4,_0x3be0c7){_0x3be0c7=_0x3be0c7||0x1f4;return function(_0x3f8cab){logger['error'](_0x3f8cab[_0xd8fe('0xc')]);if(_0x3f8cab['name']){delete _0x3f8cab[_0xd8fe('0xd')];}_0x2228a4[_0xd8fe('0x9')](_0x3be0c7)[_0xd8fe('0xe')](_0x3f8cab);};}exports[_0xd8fe('0xa')]=function(_0x1a8960,_0x515cb1){if(_0x1a8960[_0xd8fe('0xf')][_0xd8fe('0x10')]!=='admin')throw new Error(_0xd8fe('0x11'));if(isNaN(Number(_0x1a8960[_0xd8fe('0x12')]['id'])))throw new Error(_0xd8fe('0x13'));return db[_0xd8fe('0x14')][_0xd8fe('0x15')]({'where':{'id':_0x1a8960[_0xd8fe('0x12')]['id']}})[_0xd8fe('0xb')](handleEntityNotFound(_0x515cb1,null))['then'](saveUpdates(_0x1a8960[_0xd8fe('0x16')],null))['then'](respondWithResult(_0x515cb1,null))[_0xd8fe('0x17')](handleError(_0x515cb1,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 b548326..cc769fb 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 _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 +var _0xee98=['update','emit','hook','events','../../mysqldb','UserSetting','save'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xee98,0xc7));var _0x8ee9=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xee98[_0x36884e];return _0x1cc367;};'use strict';var EventEmitter=require(_0x8ee9('0x0'));var UserSetting=require(_0x8ee9('0x1'))['db'][_0x8ee9('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8ee9('0x3'),'afterUpdate':_0x8ee9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x10af53){return function(_0x40e08b,_0x11e705,_0x190588){UserSettingEvents[_0x8ee9('0x5')](_0x10af53+':'+_0x40e08b['id'],_0x40e08b);UserSettingEvents['emit'](_0x10af53,_0x40e08b);_0x190588(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x8ee9('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index dc91fc1..6b0826b 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 _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 +var _0xee5b=['./user-setting.attributes','define','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xee5b,0x1f4));var _0xbee5=function(_0x4327f1,_0x36ff89){_0x4327f1=_0x4327f1-0x0;var _0x59a98a=_0xee5b[_0x4327f1];return _0x59a98a;};'use strict';var attributes=require(_0xbee5('0x0'));module['exports']=function(_0x7b2344){return _0x7b2344[_0xbee5('0x1')]('UserSetting',attributes,{'tableName':_0xbee5('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b93c2){if(!_0x2b93c2[_0xbee5('0x3')])_0x2b93c2[_0xbee5('0x4')]=null;else if(_0x2b93c2['clientSideLoggingEnabledSince']===null)_0x2b93c2['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 d7e7d81..f2e9432 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 _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 +var _0x5f1a=['save','remove','update','emit','user-setting:update','user-setting:update:user-','register','length','user-setting:','./user-setting.events'];(function(_0x24c5c7,_0x5099cc){var _0x1e52b7=function(_0x1a1181){while(--_0x1a1181){_0x24c5c7['push'](_0x24c5c7['shift']());}};_0x1e52b7(++_0x5099cc);}(_0x5f1a,0x95));var _0xa5f1=function(_0x587d32,_0x45a0c5){_0x587d32=_0x587d32-0x0;var _0x5552f8=_0x5f1a[_0x587d32];return _0x5552f8;};'use strict';var UserSettingEvents=require(_0xa5f1('0x0'));var events=[_0xa5f1('0x1'),_0xa5f1('0x2'),_0xa5f1('0x3')];function createListener(_0x3c46ee,_0x2ec6d9){return function(_0x30ea53){_0x2ec6d9[_0xa5f1('0x4')](_0x3c46ee,_0x30ea53);if(_0x3c46ee===_0xa5f1('0x5')){_0x2ec6d9[_0xa5f1('0x4')](_0xa5f1('0x6')+_0x30ea53['UserId'],_0x30ea53);}};}exports[_0xa5f1('0x7')]=function(_0x5b6ad0){for(var _0x214383=0x0,_0x119342=events[_0xa5f1('0x8')];_0x214383<_0x119342;_0x214383++){var _0x45e52d=events[_0x214383];var _0x4ac16a=createListener(_0xa5f1('0x9')+_0x45e52d,_0x5b6ad0);UserSettingEvents['on'](_0x45e52d,_0x4ac16a);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 3f9d6f0..58403cc 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 _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 +var _0x0eee=['getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','update','/:id/password','changePassword','delete','removeTeams','/:id','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/groups','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts'];(function(_0xfee294,_0x1a19dc){var _0x54f196=function(_0x53907e){while(--_0x53907e){_0xfee294['push'](_0xfee294['shift']());}};_0x54f196(++_0x1a19dc);}(_0x0eee,0xb3));var _0xe0ee=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x0eee[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0xe0ee('0x0'));var util=require(_0xe0ee('0x1'));var path=require(_0xe0ee('0x2'));var timeout=require('connect-timeout');var express=require(_0xe0ee('0x3'));var router=express[_0xe0ee('0x4')]();var fs_extra=require(_0xe0ee('0x5'));var auth=require(_0xe0ee('0x6'));var interaction=require(_0xe0ee('0x7'));var config=require(_0xe0ee('0x8'));var controller=require(_0xe0ee('0x9'));router[_0xe0ee('0xa')]('/',auth['isAuthenticated'](),controller[_0xe0ee('0xb')]);router[_0xe0ee('0xa')](_0xe0ee('0xc'),auth[_0xe0ee('0xd')](),controller['describe']);router[_0xe0ee('0xa')]('/whoami',auth['isAuthenticated'](),controller[_0xe0ee('0xe')]);router[_0xe0ee('0xa')](_0xe0ee('0xf'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x10')]);router[_0xe0ee('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe0ee('0x11')]);router['get'](_0xe0ee('0x12'),controller[_0xe0ee('0x13')]);router['get'](_0xe0ee('0x14'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x15')]);router[_0xe0ee('0xa')](_0xe0ee('0x16'),auth['isAuthenticated'](),controller[_0xe0ee('0x17')]);router['get'](_0xe0ee('0x18'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x19')]);router['get']('/:id/queues_rt',auth[_0xe0ee('0xd')](),controller['getVoiceQueuesRt']);router['get'](_0xe0ee('0x1a'),auth[_0xe0ee('0xd')](),controller['getGroups']);router[_0xe0ee('0xa')]('/:id/recordings',auth[_0xe0ee('0xd')](),controller['getRecordings']);router[_0xe0ee('0xa')](_0xe0ee('0x1b'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x1c')]);router[_0xe0ee('0xa')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0xe0ee('0x1d')]);router[_0xe0ee('0xa')](_0xe0ee('0x1e'),auth[_0xe0ee('0xd')](),controller['getOpenchannelInteractions']);router[_0xe0ee('0xa')]('/:id/mail/interactions',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x1f')]);router['get'](_0xe0ee('0x20'),auth[_0xe0ee('0xd')](),controller['getSmsInteractions']);router['get']('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xe0ee('0x21')]);router[_0xe0ee('0xa')](_0xe0ee('0x22'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x23')]);router[_0xe0ee('0xa')]('/:id/teams',auth[_0xe0ee('0xd')](),controller['getTeams']);router[_0xe0ee('0xa')]('/:id/lists',auth['isAuthenticated'](),controller[_0xe0ee('0x24')]);router[_0xe0ee('0xa')](_0xe0ee('0x25'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x26')]);router['get']('/:id/prefixes',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x27')]);router['get'](_0xe0ee('0x28'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x29')]);router[_0xe0ee('0xa')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xe0ee('0x2a')]);router[_0xe0ee('0xa')](_0xe0ee('0x2b'),auth['isAuthenticated'](),controller[_0xe0ee('0x2c')]);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xe0ee('0x2d')]);router[_0xe0ee('0xa')](_0xe0ee('0x2e'),auth['isAuthenticated'](),controller[_0xe0ee('0x2f')]);router[_0xe0ee('0xa')](_0xe0ee('0x30'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x31')]);router['get']('/:id/scheduled_calls',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x32')]);router[_0xe0ee('0xa')](_0xe0ee('0x33'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x34')]);router[_0xe0ee('0x35')](_0xe0ee('0x16'),auth['isAuthenticated'](),controller[_0xe0ee('0x36')]);router['post']('/',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x37')]);router[_0xe0ee('0x35')]('/create_many',auth[_0xe0ee('0xd')](),controller['bulkCreate']);router[_0xe0ee('0x35')](_0xe0ee('0x18'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16eb38,_0x65b4c1,_0x427b13){_0x427b13(null,path[_0xe0ee('0x39')](config[_0xe0ee('0x3a')],_0xe0ee('0x3b')));},'filename':function(_0x4a92f0,_0x23a8c2,_0x45d477){_0x45d477(null,util[_0xe0ee('0x3c')](_0xe0ee('0x3d'),Date[_0xe0ee('0x3e')](),_0x23a8c2[_0xe0ee('0x3f')]));}})});router[_0xe0ee('0x35')](_0xe0ee('0x12'),upload[_0xe0ee('0x40')](_0xe0ee('0x41')),controller[_0xe0ee('0x42')]);router[_0xe0ee('0x35')](_0xe0ee('0x43'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x44')]);router['post'](_0xe0ee('0x45'),auth[_0xe0ee('0xd')](),controller['logout']);router['post'](_0xe0ee('0x46'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x47')]);router[_0xe0ee('0x35')](_0xe0ee('0x48'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x49')]);router['post'](_0xe0ee('0x4a'),auth['isAuthenticated'](),controller[_0xe0ee('0x4b')]);router[_0xe0ee('0x35')]('/:id/chat_interactions',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x4c')]);router[_0xe0ee('0x35')](_0xe0ee('0x4d'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x4e')]);router[_0xe0ee('0x35')](_0xe0ee('0x4f'),auth['isAuthenticated'](),controller[_0xe0ee('0x50')]);router[_0xe0ee('0x35')](_0xe0ee('0x51'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x52')]);router['post'](_0xe0ee('0x53'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x54')]);router[_0xe0ee('0x35')](_0xe0ee('0x55'),auth[_0xe0ee('0xd')](),controller['addWhatsappInteractions']);router[_0xe0ee('0x35')](_0xe0ee('0x28'),auth['isAuthenticated'](),controller[_0xe0ee('0x56')]);router[_0xe0ee('0x35')](_0xe0ee('0x57'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x58')]);router[_0xe0ee('0x35')](_0xe0ee('0x2b'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x59')]);router[_0xe0ee('0x35')](_0xe0ee('0x5a'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x5b')]);router[_0xe0ee('0x35')](_0xe0ee('0x2e'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x5c')]);router['post'](_0xe0ee('0x30'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x5d')]);router[_0xe0ee('0x35')]('/:id/api_key',auth[_0xe0ee('0xd')](),controller['createApiKey']);router['put']('/:id',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x5e')]);router['put'](_0xe0ee('0x5f'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x60')]);router[_0xe0ee('0x61')](_0xe0ee('0x18'),auth[_0xe0ee('0xd')](),controller['removeQueues']);router[_0xe0ee('0x61')](_0xe0ee('0x4a'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x62')]);router[_0xe0ee('0x61')](_0xe0ee('0x63'),auth[_0xe0ee('0xd')](),controller['destroy']);router['delete']('/:id/chat_interactions',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x64')]);router[_0xe0ee('0x61')](_0xe0ee('0x4d'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x65')]);router[_0xe0ee('0x61')](_0xe0ee('0x4f'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xe0ee('0x61')](_0xe0ee('0x51'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x66')]);router[_0xe0ee('0x61')]('/:id/openchannel_interactions',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x67')]);router[_0xe0ee('0x61')](_0xe0ee('0x55'),auth['isAuthenticated'](),controller[_0xe0ee('0x68')]);router[_0xe0ee('0x61')](_0xe0ee('0x28'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x69')]);router[_0xe0ee('0x61')]('/:id/mail_accounts',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x6a')]);router[_0xe0ee('0x61')](_0xe0ee('0x2b'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x6b')]);router[_0xe0ee('0x61')](_0xe0ee('0x5a'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x6c')]);router[_0xe0ee('0x61')](_0xe0ee('0x2e'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x6d')]);router['delete'](_0xe0ee('0x30'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x6e')]);router['delete']('/:id/api_key',auth[_0xe0ee('0xd')](),controller['removeApiKey']);router[_0xe0ee('0x35')](_0xe0ee('0x6f'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x70')]);module[_0xe0ee('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index de8e918..1e9ec02 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 _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 +var _0xa8ed=['fingerprint','certificate','active','passive','actpass','TEXT','showWebBar','get','wss','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','format','getDataValue','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','internal','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','always','accept','refuse','uac','uas'];(function(_0x31b167,_0xf3f3d2){var _0x58a791=function(_0x3603c2){while(--_0x3603c2){_0x31b167['push'](_0x31b167['shift']());}};_0x58a791(++_0xf3f3d2);}(_0xa8ed,0x17f));var _0xda8e=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa8ed[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0xda8e('0x0'));var moment=require(_0xda8e('0x1'));var util=require('util');var _=require(_0xda8e('0x2'));module[_0xda8e('0x3')]={'name':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'unique':_0xda8e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2e839e){this[_0xda8e('0x6')](_0xda8e('0x5'),_0x2e839e);this[_0xda8e('0x6')](_0xda8e('0x7'),_0x2e839e);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'set':function(_0x58bdd2){this['setDataValue'](_0xda8e('0x8'),_0x58bdd2);this[_0xda8e('0x6')]('callerid',util[_0xda8e('0x9')]('\x22%s\x22\x20<%s>',_0x58bdd2,this[_0xda8e('0xa')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'unique':_0xda8e('0xb'),'validate':{'isEmail':!![]},'set':function(_0x57a00c){if(_0x57a00c){this['setDataValue'](_0xda8e('0xb'),_0x57a00c[_0xda8e('0xc')]());}}},'role':{'type':Sequelize[_0xda8e('0xd')]('admin',_0xda8e('0xe'),_0xda8e('0xf'),_0xda8e('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xda8e('0x4')],'defaultValue':_0xda8e('0x11')},'internal':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':![],'unique':_0xda8e('0x13'),'set':function(_0x94d506){this[_0xda8e('0x6')](_0xda8e('0x13'),_0x94d506);this['setDataValue'](_0xda8e('0x14'),_0x94d506);this[_0xda8e('0x6')]('callerid',util[_0xda8e('0x9')](_0xda8e('0x15'),this[_0xda8e('0xa')](_0xda8e('0x8')),_0x94d506));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xda8e('0x4')]},'address':{'type':Sequelize[_0xda8e('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xda8e('0x4')]},'city':{'type':Sequelize[_0xda8e('0x4')]},'country':{'type':Sequelize[_0xda8e('0x4')]},'online':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xda8e('0x17')]},'voicePause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xda8e('0x4')],'defaultValue':_0xda8e('0x18')},'lastPauseAt':{'type':Sequelize[_0xda8e('0x17')]},'chatCapacity':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xda8e('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![],'defaultValue':_0xda8e('0x19')},'ipaddr':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xda8e('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x1a'),_0xda8e('0xe'),'peer'),'allowNull':!![],'defaultValue':_0xda8e('0x1a')},'context':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x1b'),_0xda8e('0x1c'),'ALLOWED_FAILED_SCREEN',_0xda8e('0x1d'),_0xda8e('0x1e'),'PROHIB_PASSED_SCREEN',_0xda8e('0x1f'),_0xda8e('0x20')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1d16f3){this[_0xda8e('0x6')](_0xda8e('0x21'),_0x1d16f3?_0x1d16f3[_0xda8e('0x22')](','):null);},'get':function(){return this[_0xda8e('0xa')](_0xda8e('0x21'))?this[_0xda8e('0xa')](_0xda8e('0x21'))[_0xda8e('0x23')](','):null;},'comment':_0xda8e('0x24')},'dtmfmode':{'type':Sequelize['ENUM'](_0xda8e('0x25'),'info',_0xda8e('0x26'),_0xda8e('0x27'),_0xda8e('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no',_0xda8e('0x2a'),_0xda8e('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x315516){this[_0xda8e('0x6')](_0xda8e('0x2c'),_0x315516?_0x315516['join'](','):null);},'get':function(){return this[_0xda8e('0xa')]('nat')?this[_0xda8e('0xa')](_0xda8e('0x2c'))[_0xda8e('0x23')](','):null;},'comment':_0xda8e('0x2d')},'callgroup':{'type':Sequelize[_0xda8e('0x4')]},'namedcallgroup':{'type':Sequelize[_0xda8e('0x4')]},'pickupgroup':{'type':Sequelize[_0xda8e('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xda8e('0x4')]},'language':{'type':Sequelize[_0xda8e('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'defaultValue':_0xda8e('0x2e')},'allow':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'defaultValue':_0xda8e('0x2f'),'set':function(_0x1a3c4e){this[_0xda8e('0x6')]('allow',_0x1a3c4e?_0x1a3c4e[_0xda8e('0x22')](';'):_0xda8e('0x2f'));},'get':function(){return this[_0xda8e('0xa')](_0xda8e('0x30'))?this[_0xda8e('0xa')](_0xda8e('0x30'))[_0xda8e('0x23')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xda8e('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x1a9365){this[_0xda8e('0x6')](_0xda8e('0x31'),_0x1a9365?_0x1a9365[_0xda8e('0x22')](','):null);},'get':function(){return this[_0xda8e('0xa')](_0xda8e('0x31'))?this['getDataValue'](_0xda8e('0x31'))[_0xda8e('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xda8e('0xd')]('yes','no',_0xda8e('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![],'defaultValue':_0xda8e('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':_0xda8e('0x29')},'busylevel':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xda8e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xda8e('0xd')]('yes','no',_0xda8e('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x35'),_0xda8e('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x37'),_0xda8e('0x38')),'allowNull':!![],'defaultValue':_0xda8e('0x38')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':_0xda8e('0x29')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no',_0xda8e('0x39'),_0xda8e('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x3b'),_0xda8e('0x3c'),_0xda8e('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xda8e('0xd')]('yes','no',_0xda8e('0x2a'),_0xda8e('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xda8e('0x17')]},'passwordResetAt':{'type':Sequelize[_0xda8e('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xda8e('0x3e')]},'showWebBar':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0,'set':function(_0x3a9d64){this['setDataValue'](_0xda8e('0x3f'),_0x3a9d64);var _0x203b55=this[_0xda8e('0x40')]({'plain':!![]});switch(_0x3a9d64){case 0x0:case 0x1:var _0x22a1b2=_0x203b55[_0xda8e('0x21')]?_['isArray'](_0x203b55[_0xda8e('0x21')])?_0x203b55[_0xda8e('0x21')][_0xda8e('0x22')]():_0x203b55[_0xda8e('0x21')]:'udp';if(_0x22a1b2===_0xda8e('0x41')){_0x22a1b2='udp';}this['setDataValue'](_0xda8e('0x21'),_0x22a1b2);this[_0xda8e('0x6')]('encryption','no');this[_0xda8e('0x6')](_0xda8e('0x42'),null);this[_0xda8e('0x6')]('force_avp',null);this[_0xda8e('0x6')](_0xda8e('0x43'),null);this[_0xda8e('0x6')](_0xda8e('0x44'),null);this[_0xda8e('0x6')](_0xda8e('0x45'),null);this[_0xda8e('0x6')](_0xda8e('0x46'),null);this['setDataValue'](_0xda8e('0x47'),null);this[_0xda8e('0x6')](_0xda8e('0x48'),null);this[_0xda8e('0x6')](_0xda8e('0x49'),'no');break;case 0x2:this[_0xda8e('0x6')]('transport','wss');this[_0xda8e('0x6')]('encryption',_0xda8e('0x29'));this[_0xda8e('0x6')](_0xda8e('0x42'),_0xda8e('0x29'));this['setDataValue'](_0xda8e('0x4a'),_0xda8e('0x29'));this[_0xda8e('0x6')](_0xda8e('0x43'),'yes');this[_0xda8e('0x6')]('dtlsenable',_0xda8e('0x29'));this['setDataValue'](_0xda8e('0x45'),'no');this[_0xda8e('0x6')](_0xda8e('0x46'),'actpass');this[_0xda8e('0x6')]('dtlscertfile',_0x203b55[_0xda8e('0x47')]||_0xda8e('0x4b'));this['setDataValue'](_0xda8e('0x48'),_0x203b55[_0xda8e('0x48')]||_0xda8e('0x4c'));this[_0xda8e('0x6')](_0xda8e('0x49'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xda8e('0x3e')],'set':function(_0x169a3b){this[_0xda8e('0x6')](_0xda8e('0x4d'),_0x169a3b?_0x169a3b[_0xda8e('0x22')](','):[]);},'get':function(){return this[_0xda8e('0xa')](_0xda8e('0x4d'))?_[_0xda8e('0x4e')](this[_0xda8e('0xa')]('permissions')['split'](','),function(_0x406e39){return parseInt(_0x406e39,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xda8e('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xda8e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xda8e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xda8e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xda8e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xda8e('0xa')](_0xda8e('0x4f'))?this[_0xda8e('0xa')](_0xda8e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xda8e('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1505bc){if(typeof _0x1505bc===_0xda8e('0x50')){var _0x4795a1=_0x1505bc==='1'?!![]:_0x1505bc==='0'?![]:_0x1505bc===_0xda8e('0x51')?!![]:_0x1505bc===_0xda8e('0x52')?![]:![];this[_0xda8e('0x6')](_0xda8e('0x53'),_0x4795a1);}else{this[_0xda8e('0x6')](_0xda8e('0x53'),_0x1505bc);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2d8bf6){this['setDataValue'](_0xda8e('0x54'),_0x2d8bf6);if(_0x2d8bf6===!![]){this['setDataValue'](_0xda8e('0x55'),moment());this[_0xda8e('0x6')](_0xda8e('0x56'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xda8e('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xda8e('0x12')](0x5)[_0xda8e('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'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 d742475..25c09eb 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 _0xf606=['updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','ids','penalty','capitalize','QueueId','Queue:save','voice','isNil','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','root','getOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','List','Tags','color','tag','getQueues','keys','filters','model','intersection','fields','order','sort','Queue','Queues','getVoiceQueuesRt','pick','nolimit','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','LOGIN','device','LOGININPAUSE','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','resolve','logout','pause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','Voice','CmList','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','spread','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','user_has_sms_interactions:save','removeSmsInteractions','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$lt','$lte','$ne','$eq','$between','$notBetween','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','firstName','lastName','CmContact','Contact','VoiceQueue','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyNonce','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','unknown','ringing','teams','inbound','getAgents','flatten','toString','lower','col','asc','desc','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','busy','slice','charAt','ui.','field','user_has_','moment','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','handleError','socket.io-emitter','redis','./user.socket','register','defaults','localhost','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','role','agent','emit','userNotification:recalc:','destroy','get','admin','Users','user','Agents','Telephones','filter','ignore','map','value','includes','find','name','UserProfileResource','then','stack','send','User','rawAttributes','fieldName','type','key','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','where','includeAll','include','query','true','UserSetting','userSetting','attributes','findAll','rows','length','push','chat','dataValues','sms','mail','openchannel','whatsapp','all','show','params','getOptions','merge','options','fax','catch','body','addContacts','internal','Setting','securePassword','validatePasswordPattern','min_internal','sequelize','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','104','105','106','107','109','100','115','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit'];(function(_0x41c4a6,_0xae9564){var _0x14d706=function(_0x229c97){while(--_0x229c97){_0x41c4a6['push'](_0x41c4a6['shift']());}};_0x14d706(++_0xae9564);}(_0xf606,0xf1));var _0x6f60=function(_0x50db3e,_0x257ed0){_0x50db3e=_0x50db3e-0x0;var _0x5bd1a2=_0xf606[_0x50db3e];return _0x5bd1a2;};'use strict';var moment=require(_0x6f60('0x0'));var util=require(_0x6f60('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x6f60('0x2'));var Redis=require(_0x6f60('0x3'));var authService=require('../../components/auth/service');var contacts=require(_0x6f60('0x4'));var qs=require(_0x6f60('0x5'));var rta=require('../../components/realtime/agents');var logger=require(_0x6f60('0x6'))(_0x6f60('0x7'));var utils=require(_0x6f60('0x8'));var config=require(_0x6f60('0x9'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x6f60('0xa'))[_0x6f60('0xb')];var APINotFoundError=require('../../errors/api')[_0x6f60('0xc')];var APIHandleError=require(_0x6f60('0xa'))[_0x6f60('0xd')];var db=require('../../mysqldb')['db'];var socket=require(_0x6f60('0xe'))(new Redis(config[_0x6f60('0xf')]));require(_0x6f60('0x10'))[_0x6f60('0x11')](socket);config[_0x6f60('0xf')]=_[_0x6f60('0x12')](config[_0x6f60('0xf')],{'host':_0x6f60('0x13'),'port':0x18eb});var values;function respondWithStatusCode(_0x1bb241,_0x19e44e){_0x19e44e=_0x19e44e||0xcc;return function(_0x33e9c6){if(_0x33e9c6){return _0x1bb241[_0x6f60('0x14')](_0x19e44e);}return _0x1bb241[_0x6f60('0x15')](_0x19e44e)[_0x6f60('0x16')]();};}function respondWithResult(_0xbf390,_0x5e221c){_0x5e221c=_0x5e221c||0xc8;return function(_0x33d425){if(_0x33d425){return _0xbf390[_0x6f60('0x15')](_0x5e221c)['json'](_0x33d425);}};}function respondWithFilteredResult(_0x32fda0,_0x376415){return function(_0x33e9ee){if(_0x33e9ee){var _0x13407f=typeof _0x376415[_0x6f60('0x17')]===_0x6f60('0x18')&&typeof _0x376415[_0x6f60('0x19')]===_0x6f60('0x18');var _0x37b5cc=_0x33e9ee['count'];var _0x25bff7=_0x13407f?0x0:_0x376415[_0x6f60('0x17')];var _0x3dbb8f=_0x13407f?_0x33e9ee[_0x6f60('0x1a')]:_0x376415[_0x6f60('0x17')]+_0x376415[_0x6f60('0x19')];var _0x3ca09a;if(_0x3dbb8f>=_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']=_0x1c5489){_0x94de97=_0x1c5489;_0x95418e=0xc8;}else{_0x95418e=0xce;}_0x1afe79['status'](_0x95418e);return _0x1afe79[_0x23fc('0x1a')](_0x23fc('0x1b'),_0x31a91d+'-'+_0x94de97+'/'+_0x1c5489)[_0x23fc('0x16')](_0x354f95);}return null;};}function saveUpdates(_0x4d34a9){return function(_0x1c7bce){if(_0x1c7bce){return _0x1c7bce[_0x23fc('0x1c')](_0x4d34a9)[_0x23fc('0x1d')](function(_0x113b08){if(_0x113b08[_0x23fc('0x1e')]==='agent'){socket[_0x23fc('0x1f')]('userNotification:recalc:'+_0x113b08['id'],_0x113b08);}return _0x113b08;});}return null;};}function removeEntity(_0x58a6b8){return function(_0x4fcd61){if(_0x4fcd61){return _0x4fcd61[_0x23fc('0x20')]()[_0x23fc('0x1d')](function(){var _0xab81b1=_0x4fcd61[_0x23fc('0x21')]({'plain':!![]});if(_0xab81b1[_0x23fc('0x1e')]==='admin')return;var _0x43b337=[{'name':_0x23fc('0x22'),'value':_0x23fc('0x23'),'ignore':!![]},{'name':_0x23fc('0x24'),'value':'agent','ignore':![]},{'name':_0x23fc('0x25'),'value':'telephone','ignore':![]}];var _0x343431=_(_0x43b337)[_0x23fc('0x26')](_0x23fc('0x27'))[_0x23fc('0x28')](_0x23fc('0x29'))[_0x23fc('0x29')]();if(_[_0x23fc('0x2a')](_0x343431,_0xab81b1[_0x23fc('0x1e')])){return;}var _0x20cc66=_['find'](_0x43b337,[_0x23fc('0x29'),_0xab81b1[_0x23fc('0x1e')]])[_0x23fc('0x2b')];return db[_0x23fc('0x2c')][_0x23fc('0x20')]({'where':{'type':_0x20cc66,'resourceId':_0xab81b1['id']}})[_0x23fc('0x1d')](function(){return _0x4fcd61;});})[_0x23fc('0x1d')](function(){_0x58a6b8[_0x23fc('0x15')](0xcc)[_0x23fc('0x2d')]();});}};}function handleEntityNotFound(_0x4170a7){return function(_0x11ff69){if(!_0x11ff69){_0x4170a7[_0x23fc('0x2e')](0x194);}return _0x11ff69;};}function handleError(_0x5cb62d,_0x5634b4){_0x5634b4=_0x5634b4||0x1f4;return function(_0x294f9d){logger[_0x23fc('0x2f')](_0x294f9d[_0x23fc('0x30')]);if(_0x294f9d[_0x23fc('0x2b')]){delete _0x294f9d['name'];}_0x5cb62d[_0x23fc('0x15')](_0x5634b4)['send'](_0x294f9d);};}function getUserAttributes(){return _(db[_0x23fc('0x31')][_0x23fc('0x32')])['map'](function(_0x557c9a){return{'name':_0x557c9a[_0x23fc('0x33')],'type':_0x557c9a[_0x23fc('0x34')]['key']};})[_0x23fc('0x26')](function(_0x3e7999){return![_0x23fc('0x35'),'salt',_0x23fc('0x36'),_0x23fc('0x37'),_0x23fc('0x38'),_0x23fc('0x39')][_0x23fc('0x2a')](_0x3e7999[_0x23fc('0x2b')]);})['value']();}exports[_0x23fc('0x3a')]=function(_0xaeebeb,_0x53c9ae){var _0x24cf20={},_0x33191a={'count':0x0,'rows':[]};var _0x402c2f=getUserAttributes();_0x24cf20=qs[_0x23fc('0x3b')](_0x402c2f,_0xaeebeb);var _0xcdd4fa={'where':_0x24cf20[_0x23fc('0x3c')]};return db[_0x23fc('0x31')][_0x23fc('0x3d')](_0xcdd4fa)[_0x23fc('0x1d')](function(_0xdfbb59){_0x33191a['count']=_0xdfbb59;if(_0xaeebeb[_0x23fc('0x3e')][_0x23fc('0x3f')]){_0x24cf20[_0x23fc('0x40')]=[{'all':!![]}];}if(_0xaeebeb[_0x23fc('0x3e')][_0x23fc('0x41')]==='true'){_0x24cf20[_0x23fc('0x40')]=[{'model':db[_0x23fc('0x42')],'as':_0x23fc('0x41')}];}if(!_['includes'](_0x24cf20['attributes'],'id')){_0x24cf20[_0x23fc('0x43')][_0x23fc('0x44')]('id');}return db[_0x23fc('0x31')][_0x23fc('0x45')](_0x24cf20);})[_0x23fc('0x1d')](function(_0x42ee99){_0x33191a[_0x23fc('0x46')]=_0x42ee99;if(_0xaeebeb['query'][_0x23fc('0x47')]===_0x23fc('0x48')){var _0x577ea3=[];for(var _0x458892=0x0;_0x458892<_0x33191a['rows'][_0x23fc('0x49')];_0x458892++){_0x577ea3['push'](get_open_tabs('chat',_0x33191a['rows'][_0x458892][_0x23fc('0x4a')]));_0x577ea3['push'](get_open_tabs(_0x23fc('0x4b'),_0x33191a[_0x23fc('0x46')][_0x458892][_0x23fc('0x4a')]));_0x577ea3['push'](get_open_tabs(_0x23fc('0x4c'),_0x33191a[_0x23fc('0x46')][_0x458892][_0x23fc('0x4a')]));_0x577ea3[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x4d'),_0x33191a['rows'][_0x458892]['dataValues']));_0x577ea3[_0x23fc('0x44')](get_open_tabs('openchannel',_0x33191a[_0x23fc('0x46')][_0x458892]['dataValues']));_0x577ea3[_0x23fc('0x44')](get_open_tabs('whatsapp',_0x33191a[_0x23fc('0x46')][_0x458892]['dataValues']));}return Promise[_0x23fc('0x4e')](_0x577ea3)[_0x23fc('0x1d')](function(){return _0x33191a;});}else{return _0x33191a;}})[_0x23fc('0x1d')](respondWithFilteredResult(_0x53c9ae,_0x24cf20))[_0x23fc('0x4f')](handleError(_0x53c9ae,null));};exports[_0x23fc('0x50')]=function(_0x4c6427,_0x2e0cd1){var _0x36250b=getUserAttributes();_0x4c6427[_0x23fc('0x3e')]['id']=_0x4c6427[_0x23fc('0x51')]['id'];var _0x47ecd0=qs['getOptions'](_0x36250b,_0x4c6427);if(_0x4c6427[_0x23fc('0x3e')][_0x23fc('0x3f')]){_0x47ecd0[_0x23fc('0x40')]=[{'all':!![]}];}if(_0x4c6427['query'][_0x23fc('0x41')]===_0x23fc('0x48')){_0x47ecd0[_0x23fc('0x40')]=[{'model':db[_0x23fc('0x42')],'as':_0x23fc('0x41')}];}_0x47ecd0=_[_0x23fc('0x52')]({},_0x47ecd0,_0x4c6427[_0x23fc('0x53')]);if(!_[_0x23fc('0x2a')](_0x47ecd0[_0x23fc('0x43')],'id')){_0x47ecd0[_0x23fc('0x43')][_0x23fc('0x44')]('id');}return db['User'][_0x23fc('0x54')](_0x47ecd0)[_0x23fc('0x1d')](handleEntityNotFound(_0x2e0cd1,null))['then'](function(_0x384579){var _0x56711f=[];values=_0x384579;if(_0x4c6427[_0x23fc('0x3e')][_0x23fc('0x47')]===_0x23fc('0x48')){_0x56711f[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x55'),_0x384579[_0x23fc('0x4a')]));_0x56711f[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x4b'),_0x384579[_0x23fc('0x4a')]));_0x56711f[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x56'),_0x384579['dataValues']));_0x56711f[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x57'),_0x384579[_0x23fc('0x4a')]));_0x56711f['push'](get_open_tabs('fax',_0x384579[_0x23fc('0x4a')]));_0x56711f['push'](get_open_tabs('mail',_0x384579[_0x23fc('0x4a')]));return Promise[_0x23fc('0x4e')](_0x56711f);}else{return values;}})['then'](function(){return values;})[_0x23fc('0x1d')](respondWithResult(_0x2e0cd1,null))['catch'](handleError(_0x2e0cd1,null));};exports[_0x23fc('0x1c')]=function(_0x2c75a5,_0x29e64e){if(_0x2c75a5['body']['id']){delete _0x2c75a5[_0x23fc('0x58')]['id'];}delete _0x2c75a5['body']['role'];return db['User'][_0x23fc('0x54')]({'where':{'id':_0x2c75a5[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x29e64e,null))['then'](saveUpdates(_0x2c75a5[_0x23fc('0x58')],null))[_0x23fc('0x1d')](respondWithResult(_0x29e64e,null))[_0x23fc('0x4f')](handleError(_0x29e64e,null));};exports[_0x23fc('0x59')]=function(_0x8203ee,_0xf0674a){return db[_0x23fc('0x31')][_0x23fc('0x59')]()['then'](respondWithResult(_0xf0674a,null))['catch'](handleError(_0xf0674a,null));};exports[_0x23fc('0x5a')]=function(_0x3d367e,_0x2129b1){return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0x3d367e[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x2129b1,null))['then'](function(_0x2f314b){if(_0x2f314b){return _0x2f314b[_0x23fc('0x5a')](_0x3d367e[_0x23fc('0x58')][_0x23fc('0x5b')],_[_0x23fc('0x5c')](_0x3d367e[_0x23fc('0x58')],[_0x23fc('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x2129b1,null))['catch'](handleError(_0x2129b1,null));};function validateUser(_0x551627){return new Promise(function(_0xb5b74a,_0x55ed0d){if(_0x551627[_0x23fc('0x5d')])return _0xb5b74a(_0x551627);return db[_0x23fc('0x5e')][_0x23fc('0x5f')](0x1)['then'](function(_0x3ec94){if(_0x3ec94['securePassword'])authService['validatePasswordPattern'](_0x551627[_0x23fc('0x35')]);db[_0x23fc('0x31')]['max'](_0x23fc('0x5d'))[_0x23fc('0x1d')](function(_0x186242){if(_[_0x23fc('0x60')](_0x186242)){_0x551627[_0x23fc('0x5d')]=_0x3ec94[_0x23fc('0x61')]||0x1;return;}if(_[_0x23fc('0x60')](_0x3ec94[_0x23fc('0x61')])||_0x3ec94['min_internal']===_0x186242){_0x551627[_0x23fc('0x5d')]=_0x186242+0x1;return;}if(_0x3ec94['min_internal']>_0x186242){_0x551627[_0x23fc('0x5d')]=_0x3ec94['min_internal'];return;}return db[_0x23fc('0x62')][_0x23fc('0x3e')](_0x23fc('0x63'),{'type':db['sequelize'][_0x23fc('0x64')][_0x23fc('0x65')]})['then'](function(_0x67df98){if(_0x67df98&&_0x67df98['length']){for(var _0x64e4ef=0x0,_0x261ce3=_0x67df98['length'];_0x64e4ef<_0x261ce3&&_[_0x23fc('0x60')](_0x551627[_0x23fc('0x5d')]);_0x64e4ef++){if(_0x3ec94[_0x23fc('0x61')]<=_0x67df98[_0x64e4ef][_0x23fc('0x66')]){_0x551627[_0x23fc('0x5d')]=_0x67df98[_0x64e4ef][_0x23fc('0x66')];}else if(_0x3ec94['min_internal']>_0x67df98[_0x64e4ef][_0x23fc('0x66')]&&_0x3ec94[_0x23fc('0x61')]<=_0x67df98[_0x64e4ef]['to']){_0x551627['internal']=_0x3ec94['min_internal'];}}}if(_[_0x23fc('0x60')](_0x551627[_0x23fc('0x5d')])){_0x551627['internal']=_0x186242+0x1;}return _0xb5b74a(_0x551627);});});})[_0x23fc('0x4f')](function(_0x5732b0){_0x55ed0d(_0x5732b0);});});}function updateUser(_0x20a0eb){return new Promise(function(_0x1ac8ab,_0x3a9814){try{if(_0x20a0eb['voicemail']){_0x20a0eb[_0x23fc('0x67')]=_0x20a0eb[_0x23fc('0x5d')];_0x20a0eb['VoiceMail']={'mailbox':_0x20a0eb[_0x23fc('0x5d')],'password':_0x20a0eb[_0x23fc('0x35')],'fullname':_0x20a0eb[_0x23fc('0x68')],'email':_0x20a0eb[_0x23fc('0x69')]};}if(_0x20a0eb[_0x23fc('0x1e')]===_0x23fc('0x6a')){if(!_0x20a0eb[_0x23fc('0x6b')])_0x20a0eb[_0x23fc('0x6b')]=[_0x23fc('0x6c'),'102','103','113',_0x23fc('0x6d'),_0x23fc('0x6e'),_0x23fc('0x6f'),'106','107',_0x23fc('0x70'),_0x23fc('0x71'),_0x23fc('0x72'),_0x23fc('0x73'),_0x23fc('0x74'),_0x23fc('0x75')];}_0x1ac8ab(_0x20a0eb);}catch(_0x554f8b){_0x3a9814(_0x554f8b);}});}exports[_0x23fc('0x76')]=function(_0x1e1175,_0x3e2351){if(_0x1e1175[_0x23fc('0x23')][_0x23fc('0x1e')]===_0x23fc('0x6a'))throw new Error('Unauthorized');if(_0x1e1175[_0x23fc('0x58')][_0x23fc('0x1e')]===_0x23fc('0x23')&&_0x1e1175[_0x23fc('0x23')]['role']!==_0x23fc('0x77')){throw new Error(_0x23fc('0x78'));}if(_0x1e1175[_0x23fc('0x58')][_0x23fc('0x1e')]===_0x23fc('0x77')&&_0x1e1175['user'][_0x23fc('0x1e')]!==_0x23fc('0x77')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x23fc('0x79')]([_0x1e1175[_0x23fc('0x58')]])[_0x23fc('0x1d')](function(){return validateUser(_0x1e1175['body']);})['then'](function(_0x32781d){return updateUser(_0x32781d)['then'](function(_0x3a3244){if(_0x3a3244[_0x23fc('0x1e')]==='admin'){_0x3a3244[_0x23fc('0x7a')]=_0x1e1175[_0x23fc('0x23')][_0x23fc('0x7a')];delete _0x3a3244[_0x23fc('0x7b')];}return _0x3a3244;});})[_0x23fc('0x1d')](function(_0x2bc440){return db[_0x23fc('0x31')]['create'](_0x2bc440,{'include':[{'model':db['VoiceMail'],'as':_0x23fc('0x7c')}]});})[_0x23fc('0x1d')](function(_0x373813){if(_0x1e1175['body'][_0x23fc('0x1e')]===_0x23fc('0x23'))return _0x373813;if(_0x1e1175[_0x23fc('0x23')][_0x23fc('0x1e')]!==_0x23fc('0x23'))return _0x373813;return db[_0x23fc('0x7d')]['find']({'where':{'name':_0x373813[_0x23fc('0x1e')]===_0x23fc('0x6a')?_0x23fc('0x24'):'Telephones','userProfileId':_0x1e1175[_0x23fc('0x23')]['userProfileId']},'raw':!![]})[_0x23fc('0x1d')](function(_0x1d6309){if(!_0x1d6309||_0x1d6309['autoAssociation']!=0x0)return _0x373813;return db[_0x23fc('0x2c')]['create']({'name':_0x373813[_0x23fc('0x2b')],'resourceId':_0x373813['id'],'type':_0x1d6309['name'],'sectionId':_0x1d6309['id']},{})[_0x23fc('0x1d')](function(){return _0x373813;});})[_0x23fc('0x4f')](function(_0xe475f1){logger[_0x23fc('0x2f')](_0x23fc('0x7e'),_0xe475f1);throw _0xe475f1;});})[_0x23fc('0x1d')](respondWithResult(_0x3e2351,0xc9))[_0x23fc('0x4f')](handleError(_0x3e2351,null));};exports[_0x23fc('0x7f')]=function(_0x253866,_0x135b40){var _0x1f89ad=_0x253866[_0x23fc('0x58')];var _0x37edfd=[];if(_0x253866[_0x23fc('0x23')][_0x23fc('0x1e')]===_0x23fc('0x6a'))throw new Error('Unauthorized');if(_[_0x23fc('0x80')](_0x1f89ad,[_0x23fc('0x1e'),_0x23fc('0x23')])&&_0x253866[_0x23fc('0x23')][_0x23fc('0x1e')]!==_0x23fc('0x77')){throw new Error(_0x23fc('0x78'));}if(_['some'](_0x1f89ad,['role',_0x23fc('0x77')])&&_0x253866[_0x23fc('0x23')][_0x23fc('0x1e')]!==_0x23fc('0x77')){throw new Error(_0x23fc('0x81'));}return licenseUtil[_0x23fc('0x79')](_0x1f89ad)[_0x23fc('0x1d')](function(){return validateUser(_0x1f89ad[0x0]);})[_0x23fc('0x1d')](function(){for(var _0x1c5d87=0x1;_0x1c5d87<_0x1f89ad[_0x23fc('0x49')];_0x1c5d87++){var _0x414690=_0x1f89ad[_0x1c5d87-0x1][_0x23fc('0x5d')];if(!_0x1f89ad[_0x1c5d87]['internal'])_0x1f89ad[_0x1c5d87][_0x23fc('0x5d')]=_0x414690+0x1;_0x37edfd[_0x23fc('0x44')](validateUser(_0x1f89ad[_0x1c5d87]));}return Promise['all'](_0x37edfd);})['then'](function(){_0x37edfd=[];for(var _0x1a1ee9=0x0;_0x1a1ee9<_0x1f89ad[_0x23fc('0x49')];_0x1a1ee9++){_0x37edfd[_0x23fc('0x44')](updateUser(_0x1f89ad[_0x1a1ee9]));}return Promise['all'](_0x37edfd);})['then'](function(){_0x37edfd=_0x1f89ad['map'](function(_0x14afc3){return db[_0x23fc('0x31')]['create'](_0x14afc3,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x23fc('0x1d')](function(_0x48bc40){_0x14afc3['id']=_0x48bc40['id'];return _0x14afc3;});});return Promise[_0x23fc('0x4e')](_0x37edfd);})['then'](function(_0x176e7e){if(_0x253866['body']['role']===_0x23fc('0x23'))return _0x176e7e;if(_0x253866[_0x23fc('0x23')][_0x23fc('0x1e')]!=='user')return _0x176e7e;var _0x2018fa=_[_0x23fc('0x80')](_0x176e7e,function(_0xca2d4a){return _0xca2d4a[_0x23fc('0x1e')]===_0x23fc('0x6a')||_0xca2d4a[_0x23fc('0x1e')]==='telephone';});if(!_0x2018fa)return _0x176e7e;return db[_0x23fc('0x7d')]['findAll']({'where':{'name':{'$or':[_0x23fc('0x24'),_0x23fc('0x25')]},'userProfileId':_0x253866[_0x23fc('0x23')]['userProfileId']},'raw':!![]})[_0x23fc('0x1d')](function(_0x2c9a92){if(_[_0x23fc('0x82')](_0x2c9a92)||!_[_0x23fc('0x80')](_0x2c9a92,[_0x23fc('0x83'),0x0]))return _0x176e7e;_0x37edfd=[];var _0x28b014=_(_0x2c9a92)['map'](function(_0x10b484){if(_0x10b484['autoAssociation']===0x1)return;return _0x10b484['name']===_0x23fc('0x24')?'agent':'telephone';})[_0x23fc('0x84')]()[_0x23fc('0x29')]();for(var _0x227bb7=0x0;_0x227bb7<_0x176e7e[_0x23fc('0x49')];_0x227bb7++){if(!_['includes'](_0x28b014,_0x176e7e[_0x227bb7][_0x23fc('0x1e')]))return;var _0x5ec47b=_0x176e7e[_0x227bb7][_0x23fc('0x1e')]==='agent'?_0x23fc('0x24'):_0x23fc('0x25');_0x37edfd['push'](db[_0x23fc('0x2c')][_0x23fc('0x76')]({'name':_0x176e7e[_0x227bb7][_0x23fc('0x2b')],'resourceId':_0x176e7e[_0x227bb7]['id'],'type':_0x5ec47b,'sectionId':_[_0x23fc('0x54')](_0x2c9a92,[_0x23fc('0x2b'),_0x5ec47b])['id']},{}));}return Promise['all'](_0x37edfd);});})[_0x23fc('0x1d')](respondWithResult(_0x135b40,0xc9))[_0x23fc('0x4f')](handleError(_0x135b40,null));};exports[_0x23fc('0x85')]=function(_0x190af0,_0x4654a9){if(_0x190af0[_0x23fc('0x58')]['id']){delete _0x190af0[_0x23fc('0x58')]['id'];}return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0x190af0[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](function(_0xc7a862){if(!_0xc7a862)return null;if(_0xc7a862['id']===_0x190af0[_0x23fc('0x23')]['id']){if(!_0x190af0[_0x23fc('0x58')][_0x23fc('0x86')]||!_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')]){throw new db[(_0x23fc('0x88'))]['ValidationError'](_0x23fc('0x89'));}if(!_0xc7a862['authenticate'](_0x190af0[_0x23fc('0x58')][_0x23fc('0x86')])){throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0x8b'));}if(_0x190af0[_0x23fc('0x58')]['oldPassword']===_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')]){throw new db[(_0x23fc('0x88'))]['ValidationError'](_0x23fc('0x8c'));}}else if(_0x190af0['user']['role']===_0x23fc('0x77')){if(!_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')]){throw new db[(_0x23fc('0x88'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x190af0['user'][_0x23fc('0x1e')]==='user'){if(!_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')]){throw new db[(_0x23fc('0x88'))]['ValidationError'](_0x23fc('0x8d'));}if(_0xc7a862['role']!==_0x23fc('0x6a')){throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0x8e'));}}else{throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0x8e'));}return _0xc7a862;})[_0x23fc('0x1d')](handleEntityNotFound(_0x4654a9,null))[_0x23fc('0x1d')](function(_0x4c0a5d){return db['Setting'][_0x23fc('0x8f')]({'attributes':['id',_0x23fc('0x90'),_0x23fc('0x91'),_0x23fc('0x92')]})[_0x23fc('0x1d')](function(_0x22a523){if(_0x22a523[_0x23fc('0x90')])authService[_0x23fc('0x93')](_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')]);if(!_0x22a523[_0x23fc('0x91')]||!_0x4c0a5d['previousPasswords'])return _0x4c0a5d;authService[_0x23fc('0x94')](_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')],_0x4c0a5d[_0x23fc('0x36')],_0x22a523['passwordHistoryLimit']);return _0x4c0a5d;})[_0x23fc('0x1d')](saveUpdates({'password':_0x190af0[_0x23fc('0x58')]['newPassword'],'passwordResetAt':_0x190af0[_0x23fc('0x23')]['id']==_0x190af0['params']['id']?moment():null,'previousPasswords':authService[_0x23fc('0x95')](_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')],_0x4c0a5d[_0x23fc('0x36')])},null));})['then'](respondWithResult(_0x4654a9,null))['catch'](handleError(_0x4654a9,null));};exports['addQueues']=function(_0x5eac86,_0x5229d9){var _0x307971=_0x5eac86[_0x23fc('0x58')][_0x23fc('0x96')];return db[_0x23fc('0x31')]['find']({'where':{'id':_0x5eac86['params']['id']},'attributes':['id','name','role','online',_0x23fc('0x97'),_0x23fc('0x98'),_0x23fc('0x99')]})[_0x23fc('0x1d')](handleEntityNotFound(_0x5229d9,null))['then'](function(_0x2f05b4){if(_0x2f05b4){if(!utils[_0x23fc('0x9a')](_0x307971)){throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0x9b'));}return _0x2f05b4[_0x23fc('0x9c')+_['capitalize'](_0x307971[_0x23fc('0x9d')]())+_0x23fc('0x9e')](_0x5eac86[_0x23fc('0x58')][_0x23fc('0x5b')],{'penalty':_0x5eac86[_0x23fc('0x58')][_0x23fc('0x9f')]||0x0})[_0x23fc('0xa0')](function(_0x2d392b){for(var _0x2459e9=0x0;_0x2459e9<_0x5eac86['body'][_0x23fc('0x5b')][_0x23fc('0x49')];_0x2459e9+=0x1){var _0x3a831a={'UserId':Number(_0x5eac86[_0x23fc('0x51')]['id'])};_0x3a831a[_[_0x23fc('0xa1')](_0x307971[_0x23fc('0x9d')]())+_0x23fc('0xa2')]=Number(_0x5eac86['body'][_0x23fc('0x5b')][_0x2459e9]);socket[_0x23fc('0x1f')](_0x23fc('0x23')+_[_0x23fc('0xa1')](_0x307971['toLowerCase']())+'Queue:save',_0x3a831a);}return _0x2d392b;})[_0x23fc('0x1d')](function(){if(_0x307971===_0x23fc('0xa3')){return db['VoiceQueue'][_0x23fc('0x45')]({'where':{'id':_0x5eac86[_0x23fc('0x58')][_0x23fc('0x5b')]||[]},'raw':!![],'attributes':['id',_0x23fc('0x2b')]});}})[_0x23fc('0x1d')](function(_0x22ad50){var _0x11b541=_0x2f05b4['get']({'plain':!![]});var _0x22e497=[];if(_0x307971===_0x23fc('0xa3')&&_0x11b541[_0x23fc('0x1e')]===_0x23fc('0x6a')&&_0x11b541['online']){for(let _0x2288b5=0x0;_0x2288b5<_0x22ad50['length'];_0x2288b5+=0x1){_0x22e497[_0x23fc('0x44')]({'membername':_0x11b541[_0x23fc('0x2b')],'UserId':_0x11b541['id'],'queue_name':_0x22ad50[_0x2288b5][_0x23fc('0x2b')],'VoiceQueueId':_0x22ad50[_0x2288b5]['id'],'interface':_[_0x23fc('0x60')](_0x11b541[_0x23fc('0x99')])?util[_0x23fc('0xa4')](_0x23fc('0xa5'),_0x11b541[_0x23fc('0x2b')]):_0x11b541['interface'],'paused':_0x11b541[_0x23fc('0x98')]||![],'penalty':_0x5eac86[_0x23fc('0x58')][_0x23fc('0x9f')]||0x0});}return Promise['all'](_0x22e497[_0x23fc('0x28')](function(_0x1e8ffa){return db[_0x23fc('0xa6')]['upsert'](_0x1e8ffa);}));}return _0x2f05b4;});}})[_0x23fc('0x1d')](respondWithStatusCode(_0x5229d9,null))['catch'](handleError(_0x5229d9,null));};exports['removeQueues']=function(_0x191062,_0x43a842){var _0x76e829,_0xe04e6e;return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0x191062[_0x23fc('0x51')]['id']},'attributes':['id',_0x23fc('0x2b'),_0x23fc('0x1e')]})[_0x23fc('0x1d')](handleEntityNotFound(_0x43a842,null))['then'](function(_0x11b705){if(_0x11b705){_0x76e829=_0x11b705;if(!_0x191062[_0x23fc('0x3e')][_0x23fc('0x96')]||!utils['isValidChannel'](_0x191062[_0x23fc('0x3e')][_0x23fc('0x96')])){throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0x9b'));}return _0x11b705[_0x23fc('0xa7')+_[_0x23fc('0xa1')](_0x191062['query'][_0x23fc('0x96')][_0x23fc('0x9d')]())+_0x23fc('0x9e')](_0x191062['query'][_0x23fc('0x5b')]);}})[_0x23fc('0x1d')](function(_0x307cf0){if(_[_0x23fc('0xa8')](_0x191062['query']['ids'])){for(var _0x3ea0dc=0x0;_0x3ea0dc<_0x191062[_0x23fc('0x3e')][_0x23fc('0x5b')][_0x23fc('0x49')];_0x3ea0dc+=0x1){_0xe04e6e={'UserId':Number(_0x191062[_0x23fc('0x51')]['id'])};_0xe04e6e[_['capitalize'](_0x191062[_0x23fc('0x3e')][_0x23fc('0x96')][_0x23fc('0x9d')]())+_0x23fc('0xa2')]=Number(_0x191062[_0x23fc('0x3e')][_0x23fc('0x5b')][_0x3ea0dc]);socket[_0x23fc('0x1f')](_0x23fc('0x23')+_[_0x23fc('0xa1')](_0x191062['query'][_0x23fc('0x96')][_0x23fc('0x9d')]())+_0x23fc('0xa9'),_0xe04e6e);}}else{_0xe04e6e={'UserId':Number(_0x191062[_0x23fc('0x51')]['id'])};_0xe04e6e[_[_0x23fc('0xa1')](_0x191062[_0x23fc('0x3e')]['channel'][_0x23fc('0x9d')]())+_0x23fc('0xa2')]=Number(_0x191062[_0x23fc('0x3e')]['ids']);socket[_0x23fc('0x1f')](_0x23fc('0x23')+_[_0x23fc('0xa1')](_0x191062[_0x23fc('0x3e')][_0x23fc('0x96')][_0x23fc('0x9d')]())+_0x23fc('0xa9'),_0xe04e6e);}return _0x307cf0;})['then'](function(){if(_0x191062['query']['channel']==='voice'){return db[_0x23fc('0xa6')]['destroy']({'where':{'UserId':_0x191062['params']['id'],'VoiceQueueId':_0x191062[_0x23fc('0x3e')][_0x23fc('0x5b')]},'individualHooks':!![]})[_0x23fc('0x1d')](function(){return _0x76e829;});}return _0x76e829;})[_0x23fc('0x1d')](respondWithStatusCode(_0x43a842,null))[_0x23fc('0x4f')](handleError(_0x43a842,null));};exports[_0x23fc('0xaa')]=function(_0x5233f9,_0x2ae71a){_0x5233f9['body'][_0x23fc('0xab')]=_0x5233f9[_0x23fc('0xac')][_0x23fc('0xad')];return db[_0x23fc('0x31')]['find']({'where':{'id':_0x5233f9[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x2ae71a,null))[_0x23fc('0x1d')](saveUpdates(_0x5233f9[_0x23fc('0x58')],null))['then'](respondWithResult(_0x2ae71a,null))[_0x23fc('0x4f')](handleError(_0x2ae71a,null));};exports[_0x23fc('0xae')]=function(_0xa705d6,_0x174d57){var _0x1a89c7=path['join'](config[_0x23fc('0xaf')],'server/files/images/logos/default_profile.png');return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0xa705d6[_0x23fc('0x51')]['id']},'attributes':['id',_0x23fc('0xab')],'raw':!![]})[_0x23fc('0x1d')](handleEntityNotFound(_0x174d57,null))[_0x23fc('0x1d')](function(_0x505b93){if(_0x505b93){if(_[_0x23fc('0x60')](_0x505b93[_0x23fc('0xab')])){return _0x174d57[_0x23fc('0xb0')](_0x1a89c7);}else{if(!fs['existsSync'](path[_0x23fc('0xb1')](config[_0x23fc('0xaf')],_0x23fc('0xb2'),_0x505b93['userpic']))){return _0x174d57[_0x23fc('0xb0')](_0x1a89c7);}return _0x174d57[_0x23fc('0xb0')](path['join'](config['root'],_0x23fc('0xb2'),_0x505b93[_0x23fc('0xab')]));}}})[_0x23fc('0x4f')](handleError(_0x174d57,null));};exports[_0x23fc('0xb3')]=function(_0x1392f1,_0x3c2a36){return db['User'][_0x23fc('0x54')]({'where':{'id':_0x1392f1['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x3c2a36,null))[_0x23fc('0x1d')](function(_0x2d7fec){var _0xa5927a=[];values=_0x2d7fec[_0x23fc('0x4a')];_0xa5927a[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x55'),_0x2d7fec['dataValues']));_0xa5927a['push'](get_open_tabs('sms',_0x2d7fec[_0x23fc('0x4a')]));_0xa5927a[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x56'),_0x2d7fec[_0x23fc('0x4a')]));_0xa5927a[_0x23fc('0x44')](get_open_tabs('whatsapp',_0x2d7fec['dataValues']));_0xa5927a['push'](get_open_tabs(_0x23fc('0x4c'),_0x2d7fec[_0x23fc('0x4a')]));_0xa5927a[_0x23fc('0x44')](get_open_tabs('mail',_0x2d7fec['dataValues']));return Promise[_0x23fc('0x4e')](_0xa5927a);})[_0x23fc('0x1d')](function(_0x1e3a91){if(_0x1e3a91){var _0xbf76e2=_[_0x23fc('0x28')](values[_0x23fc('0xb4')],function(_0x5996e2){return{'channel':_0x23fc('0xb5'),'id':_0x5996e2['id'],'createdAt':_0x5996e2[_0x23fc('0xb6')]};});var _0x49593b=_[_0x23fc('0x28')](values['FaxOpenTabs'],function(_0x3b8d19){return{'channel':_0x23fc('0xb7'),'id':_0x3b8d19['id'],'createdAt':_0x3b8d19['createdAt']};});var _0xbfcd4=_['map'](values[_0x23fc('0xb8')],function(_0x40a3fb){return{'channel':_0x23fc('0xb9'),'id':_0x40a3fb['id'],'createdAt':_0x40a3fb['createdAt']};});var _0x14dbff=_[_0x23fc('0x28')](values[_0x23fc('0xba')],function(_0x39f5d1){return{'channel':_0x23fc('0xbb'),'id':_0x39f5d1['id'],'createdAt':_0x39f5d1[_0x23fc('0xb6')]};});var _0x268785=_[_0x23fc('0x28')](values[_0x23fc('0xbc')],function(_0xba5e5f){return{'channel':'SMS','id':_0xba5e5f['id'],'createdAt':_0xba5e5f['createdAt']};});var _0x4d9523=_[_0x23fc('0x28')](values[_0x23fc('0xbd')],function(_0x2d46c0){return{'channel':_0x23fc('0xbe'),'id':_0x2d46c0['id'],'createdAt':_0x2d46c0[_0x23fc('0xb6')]};});var _0x311308=_['concat'](_0xbf76e2,_0x49593b,_0xbfcd4,_0x14dbff,_0x268785,_0x4d9523);var _0x4364f6={'count':_0x311308['length'],'rows':_0x311308};return _0x4364f6;}else return null;})[_0x23fc('0x1d')](respondWithResult(_0x3c2a36,null))['catch'](handleError(_0x3c2a36,null));};exports[_0x23fc('0xbf')]=function(_0x23d8df,_0x5dc816){var _0x554724={};return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x23d8df[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](function(_0x3ed3e9){if(!_0x3ed3e9){throw new APINotFoundError(util[_0x23fc('0xa4')](_0x23fc('0xc0'),_0x23d8df[_0x23fc('0x51')]['id']));}return contacts['describe']();})[_0x23fc('0x1d')](function(_0x19bad3){_0x23d8df[_0x23fc('0x3e')]['User']=_0x23d8df[_0x23fc('0x51')]['id'];_0x554724=qs['getOptions'](_0x19bad3,_0x23d8df);if(_0x23d8df[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0x3f'))){_0x554724[_0x23fc('0x40')]=[{'model':db[_0x23fc('0xc2')],'as':_0x23fc('0xc3'),'required':![]},{'model':db[_0x23fc('0xc4')],'as':_0x23fc('0xc5'),'attributes':['id',_0x23fc('0x2b'),'color'],'where':_0x23d8df[_0x23fc('0x3e')][_0x23fc('0xc6')]?{'id':_0x23d8df[_0x23fc('0x3e')][_0x23fc('0xc6')]}:undefined,'required':_0x23d8df['query'][_0x23fc('0xc6')]?!![]:![]}];}return contacts[_0x23fc('0x45')](_0x23d8df[_0x23fc('0x3e')],_0x23d8df[_0x23fc('0x23')],_0x554724,_0x19bad3);})[_0x23fc('0x1d')](respondWithFilteredResult(_0x5dc816,_0x554724))['catch'](APIHandleError(_0x5dc816));};exports[_0x23fc('0xc7')]=function(_0x59b4e1,_0x361a09){var _0x438d4b;var _0x2a7244={};var _0x1bd764;return db['User']['findOne']({'where':{'id':_0x59b4e1['params']['id']},'attributes':['id',_0x23fc('0x2b'),_0x23fc('0x1e')]})[_0x23fc('0x1d')](handleEntityNotFound(_0x361a09,null))['then'](function(_0x423c3d){if(!utils[_0x23fc('0x9a')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x96')])){throw new db[(_0x23fc('0x88'))]['ValidationError'](_0x23fc('0x9b'));}_0x438d4b=_0x423c3d;var _0x298279={};_0x298279[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_[_0x23fc('0xa1')](_0x59b4e1['query'][_0x23fc('0x96')])+_0x23fc('0xca')]['rawAttributes']);_0x298279[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x59b4e1[_0x23fc('0x3e')]);_0x298279[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x298279[_0x23fc('0xc8')],_0x298279['query']);_0x2a7244[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x298279[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x2a7244['attributes']=_0x2a7244[_0x23fc('0x43')][_0x23fc('0x49')]?_0x2a7244[_0x23fc('0x43')]:_0x298279[_0x23fc('0xc8')];_0x2a7244[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x2a7244[_0x23fc('0x3c')]=qs['filters'](_['pick'](_0x59b4e1[_0x23fc('0x3e')],_0x298279[_0x23fc('0xcb')]));if(_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x2a7244[_0x23fc('0x3c')]=_['merge'](_0x2a7244['where'],{'$or':_['map'](_0x2a7244[_0x23fc('0x43')],function(_0x5d5a72){var _0x5bae8d={};_0x5bae8d[_0x5d5a72]={'$like':'%'+_0x59b4e1[_0x23fc('0x3e')]['filter']+'%'};return _0x5bae8d;})});}_0x2a7244=_[_0x23fc('0x52')]({},_0x2a7244,_0x59b4e1[_0x23fc('0x53')]);switch(_0x438d4b[_0x23fc('0x1e')]){case _0x23fc('0x77'):return db[_[_0x23fc('0xa1')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x96')])+'Queue'][_0x23fc('0x45')](_0x2a7244);case _0x23fc('0x23'):case _0x23fc('0x6a'):return _0x438d4b[_0x23fc('0x21')+_[_0x23fc('0xa1')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x96')])+_0x23fc('0x9e')](_0x2a7244);default:throw new db[(_0x23fc('0x88'))]['ValidationError']('Unknown\x20role');}})[_0x23fc('0x1d')](function(_0x3c966d){_0x1bd764=_0x3c966d[_0x23fc('0x49')];if(!_0x59b4e1[_0x23fc('0x3e')]['hasOwnProperty'](_0x23fc('0xd0'))){_0x2a7244[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x2a7244[_0x23fc('0x17')]=qs['offset'](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x17')]);}switch(_0x438d4b[_0x23fc('0x1e')]){case _0x23fc('0x77'):return db[_[_0x23fc('0xa1')](_0x59b4e1['query']['channel'])+_0x23fc('0xca')][_0x23fc('0x45')](_0x2a7244);case _0x23fc('0x23'):case _0x23fc('0x6a'):return _0x438d4b[_0x23fc('0x21')+_[_0x23fc('0xa1')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x96')])+'Queues'](_0x2a7244);}})[_0x23fc('0x1d')](function(_0x5b46a7){return{'count':_0x1bd764,'rows':_0x5b46a7};})[_0x23fc('0x1d')](respondWithResult(_0x361a09,null))[_0x23fc('0x4f')](handleError(_0x361a09,null));};exports[_0x23fc('0xd1')]=function(_0x31c2b5,_0x2c9027){var _0xb4b7ea={};var _0x34ddf8={};var _0x14fece;var _0x258fee;return db[_0x23fc('0x31')]['findOne']({'where':{'id':_0x31c2b5['params']['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x2c9027,null))[_0x23fc('0x1d')](function(_0xb4eebf){if(_0xb4eebf){_0x14fece=_0xb4eebf;_0x34ddf8[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xa6')][_0x23fc('0x32')]);_0x34ddf8[_0x23fc('0x3e')]=_['keys'](_0x31c2b5[_0x23fc('0x3e')]);_0x34ddf8[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x34ddf8[_0x23fc('0xc8')],_0x34ddf8[_0x23fc('0x3e')]);_0xb4b7ea[_0x23fc('0x43')]=_['intersection'](_0x34ddf8['model'],qs[_0x23fc('0xcd')](_0x31c2b5[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0xb4b7ea[_0x23fc('0x43')]=_0xb4b7ea[_0x23fc('0x43')]['length']?_0xb4b7ea[_0x23fc('0x43')]:_0x34ddf8[_0x23fc('0xc8')];_0xb4b7ea[_0x23fc('0xce')]=qs['sort'](_0x31c2b5['query'][_0x23fc('0xcf')]);_0xb4b7ea[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x31c2b5[_0x23fc('0x3e')],_0x34ddf8[_0x23fc('0xcb')]));if(_0x31c2b5['query'][_0x23fc('0x26')]){_0xb4b7ea[_0x23fc('0x3c')]=_['merge'](_0xb4b7ea['where'],{'$or':_['map'](_0xb4b7ea['attributes'],function(_0x53d679){var _0x5cceef={};_0x5cceef[_0x53d679]={'$like':'%'+_0x31c2b5[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x5cceef;})});}_0xb4b7ea=_[_0x23fc('0x52')]({},_0xb4b7ea,_0x31c2b5[_0x23fc('0x53')]);return _0x14fece[_0x23fc('0xd1')](_0xb4b7ea);}})[_0x23fc('0x1d')](function(_0x33f99e){if(_0x33f99e){_0x258fee=_0x33f99e[_0x23fc('0x49')];if(!_0x31c2b5['query'][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0xb4b7ea[_0x23fc('0x19')]=qs['limit'](_0x31c2b5['query']['limit']);_0xb4b7ea[_0x23fc('0x17')]=qs['offset'](_0x31c2b5[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x14fece['getVoiceQueuesRt'](_0xb4b7ea);}})[_0x23fc('0x1d')](function(_0x9e5687){if(_0x9e5687){return _0x9e5687?{'count':_0x258fee,'rows':_0x9e5687}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x2c9027,null))[_0x23fc('0x4f')](handleError(_0x2c9027,null));};exports[_0x23fc('0xd3')]=function(_0x147de5,_0x5ad8ab){var _0x1f20e7={};var _0x3b115b={};var _0x283f71;var _0x34ba2d;return db['User'][_0x23fc('0x8f')]({'where':{'id':_0x147de5[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x5ad8ab,null))['then'](function(_0x544134){if(_0x544134){_0x283f71=_0x544134;_0x3b115b[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xd4')][_0x23fc('0x32')]);_0x3b115b[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x147de5[_0x23fc('0x3e')]);_0x3b115b['filters']=_[_0x23fc('0xcc')](_0x3b115b[_0x23fc('0xc8')],_0x3b115b['query']);_0x1f20e7['attributes']=_[_0x23fc('0xcc')](_0x3b115b[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x147de5['query']['fields']));_0x1f20e7[_0x23fc('0x43')]=_0x1f20e7['attributes']['length']?_0x1f20e7['attributes']:_0x3b115b[_0x23fc('0xc8')];_0x1f20e7[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x147de5['query'][_0x23fc('0xcf')]);_0x1f20e7[_0x23fc('0x3c')]=qs['filters'](_[_0x23fc('0xd2')](_0x147de5[_0x23fc('0x3e')],_0x3b115b['filters']));if(_0x147de5[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x1f20e7['where']=_['merge'](_0x1f20e7[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x1f20e7['attributes'],function(_0x2745bb){var _0x4e0816={};_0x4e0816[_0x2745bb]={'$like':'%'+_0x147de5[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x4e0816;})});}_0x1f20e7=_[_0x23fc('0x52')]({},_0x1f20e7,_0x147de5['options']);return _0x283f71[_0x23fc('0xd3')](_0x1f20e7);}})[_0x23fc('0x1d')](function(_0x10fc53){if(_0x10fc53){_0x34ba2d=_0x10fc53['length'];if(!_0x147de5[_0x23fc('0x3e')]['hasOwnProperty'](_0x23fc('0xd0'))){_0x1f20e7['limit']=qs['limit'](_0x147de5[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x1f20e7[_0x23fc('0x17')]=qs[_0x23fc('0x17')](_0x147de5[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x283f71[_0x23fc('0xd3')](_0x1f20e7);}})['then'](function(_0x1e189a){if(_0x1e189a){return _0x1e189a?{'count':_0x34ba2d,'rows':_0x1e189a}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x5ad8ab,null))[_0x23fc('0x4f')](handleError(_0x5ad8ab,null));};exports[_0x23fc('0xd5')]=function(_0x565e6c,_0x9b0652){var _0x75d8ba={'raw':!![],'where':{}};var _0x5e046d={};var _0x527e53={'count':0x0,'rows':[]};return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x565e6c[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x9b0652,null))['then'](function(_0x5e7b45){if(_0x5e7b45){_0x5e046d[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xd6')][_0x23fc('0x32')]);_0x5e046d[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x565e6c[_0x23fc('0x3e')]);_0x5e046d[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x5e046d['model'],_0x5e046d['query']);_0x75d8ba[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x5e046d[_0x23fc('0xc8')],qs['fields'](_0x565e6c[_0x23fc('0x3e')]['fields']));_0x75d8ba[_0x23fc('0x43')]=_0x75d8ba[_0x23fc('0x43')][_0x23fc('0x49')]?_0x75d8ba[_0x23fc('0x43')]:_0x5e046d[_0x23fc('0xc8')];if(!_0x565e6c[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x75d8ba[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x565e6c[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x75d8ba[_0x23fc('0x17')]=qs[_0x23fc('0x17')](_0x565e6c[_0x23fc('0x3e')][_0x23fc('0x17')]);}_0x75d8ba[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x565e6c[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x75d8ba['where']=qs[_0x23fc('0xcb')](_['pick'](_0x565e6c[_0x23fc('0x3e')],_0x5e046d[_0x23fc('0xcb')]));_0x75d8ba['where']['UserId']=_0x5e7b45['id'];if(_0x565e6c['query'][_0x23fc('0x26')]){_0x75d8ba[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x75d8ba[_0x23fc('0x3c')],{'$or':_['map'](_0x75d8ba['attributes'],function(_0x30a2f7){var _0x4d9896={};_0x4d9896[_0x30a2f7]={'$like':'%'+_0x565e6c[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x4d9896;})});}_0x75d8ba=_['merge']({},_0x75d8ba,_0x565e6c['options']);return db[_0x23fc('0xd6')]['count']({'where':_0x75d8ba[_0x23fc('0x3c')]})['then'](function(_0x313e54){_0x527e53[_0x23fc('0x3d')]=_0x313e54;if(_0x565e6c[_0x23fc('0x3e')][_0x23fc('0x3f')]){_0x75d8ba[_0x23fc('0x40')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x75d8ba);})['then'](function(_0x4533fa){_0x527e53['rows']=_0x4533fa;return _0x527e53;});}})[_0x23fc('0x1d')](respondWithFilteredResult(_0x9b0652,_0x75d8ba))[_0x23fc('0x4f')](handleError(_0x9b0652,null));};exports['getScreenRecordings']=function(_0x47a47e,_0x67354b){var _0x1cc02c={'raw':!![],'where':{}};var _0x3919d0={};var _0x3fe8cc={'count':0x0,'rows':[]};return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x47a47e[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x67354b,null))[_0x23fc('0x1d')](function(_0x4ffa29){if(_0x4ffa29){_0x3919d0[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db['ScreenRecording'][_0x23fc('0x32')]);_0x3919d0[_0x23fc('0x3e')]=_['keys'](_0x47a47e[_0x23fc('0x3e')]);_0x3919d0[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x3919d0[_0x23fc('0xc8')],_0x3919d0[_0x23fc('0x3e')]);_0x1cc02c[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x3919d0[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x47a47e[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x1cc02c[_0x23fc('0x43')]=_0x1cc02c[_0x23fc('0x43')][_0x23fc('0x49')]?_0x1cc02c['attributes']:_0x3919d0[_0x23fc('0xc8')];if(!_0x47a47e['query'][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x1cc02c[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x47a47e[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x1cc02c[_0x23fc('0x17')]=qs['offset'](_0x47a47e['query']['offset']);}_0x1cc02c[_0x23fc('0xce')]=qs['sort'](_0x47a47e[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x1cc02c[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x47a47e[_0x23fc('0x3e')],_0x3919d0[_0x23fc('0xcb')]));_0x1cc02c['where'][_0x23fc('0xd7')]=_0x4ffa29['id'];if(_0x47a47e[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x1cc02c['where']=_[_0x23fc('0x52')](_0x1cc02c[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x1cc02c[_0x23fc('0x43')],function(_0x149ee7){var _0x5807dc={};_0x5807dc[_0x149ee7]={'$like':'%'+_0x47a47e[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x5807dc;})});}_0x1cc02c=_[_0x23fc('0x52')]({},_0x1cc02c,_0x47a47e[_0x23fc('0x53')]);return db['ScreenRecording']['count']({'where':_0x1cc02c[_0x23fc('0x3c')]})[_0x23fc('0x1d')](function(_0x542ff1){_0x3fe8cc['count']=_0x542ff1;if(_0x47a47e[_0x23fc('0x3e')]['includeAll']){_0x1cc02c[_0x23fc('0x40')]=[{'all':!![]}];}return db[_0x23fc('0xd8')][_0x23fc('0x45')](_0x1cc02c);})[_0x23fc('0x1d')](function(_0x1c11a6){_0x3fe8cc[_0x23fc('0x46')]=_0x1c11a6;return _0x3fe8cc;});}})[_0x23fc('0x1d')](respondWithFilteredResult(_0x67354b,_0x1cc02c))[_0x23fc('0x4f')](handleError(_0x67354b,null));};exports[_0x23fc('0xd9')]=function(_0x4ed80a,_0x23be03){var _0x2dd7f3={};var _0x48a108={};var _0x2c71fc;var _0x124583;return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x4ed80a['params']['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x23be03,null))[_0x23fc('0x1d')](function(_0x2eadf0){if(_0x2eadf0){_0x2c71fc=_0x2eadf0;_0x48a108['model']=_[_0x23fc('0xc9')](db[_0x23fc('0xda')][_0x23fc('0x32')]);_0x48a108[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x4ed80a[_0x23fc('0x3e')]);_0x48a108['filters']=_['intersection'](_0x48a108[_0x23fc('0xc8')],_0x48a108[_0x23fc('0x3e')]);_0x2dd7f3[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x48a108[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x4ed80a[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x2dd7f3[_0x23fc('0x43')]=_0x2dd7f3[_0x23fc('0x43')][_0x23fc('0x49')]?_0x2dd7f3['attributes']:_0x48a108[_0x23fc('0xc8')];_0x2dd7f3[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x4ed80a[_0x23fc('0x3e')]['sort']);_0x2dd7f3[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_['pick'](_0x4ed80a[_0x23fc('0x3e')],_0x48a108[_0x23fc('0xcb')]));if(_0x4ed80a[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x2dd7f3['where']=_[_0x23fc('0x52')](_0x2dd7f3[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x2dd7f3[_0x23fc('0x43')],function(_0x2d57de){var _0x2b4fe5={};_0x2b4fe5[_0x2d57de]={'$like':'%'+_0x4ed80a[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x2b4fe5;})});}_0x2dd7f3=_[_0x23fc('0x52')]({},_0x2dd7f3,_0x4ed80a[_0x23fc('0x53')]);return _0x2c71fc[_0x23fc('0xd9')](_0x2dd7f3);}})[_0x23fc('0x1d')](function(_0x1ce147){if(_0x1ce147){_0x124583=_0x1ce147['length'];if(!_0x4ed80a['query']['hasOwnProperty']('nolimit')){_0x2dd7f3[_0x23fc('0x19')]=qs['limit'](_0x4ed80a['query'][_0x23fc('0x19')]);_0x2dd7f3[_0x23fc('0x17')]=qs[_0x23fc('0x17')](_0x4ed80a['query'][_0x23fc('0x17')]);}return _0x2c71fc[_0x23fc('0xd9')](_0x2dd7f3);}})[_0x23fc('0x1d')](function(_0x38509c){if(_0x38509c){return _0x38509c?{'count':_0x124583,'rows':_0x38509c}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x23be03,null))[_0x23fc('0x4f')](handleError(_0x23be03,null));};exports['getOpenchannelInteractions']=function(_0x347a06,_0xbe5b9f){var _0x9fe527={};var _0x5125e5={};var _0x4e3338;var _0x5d7dee;return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x347a06[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0xbe5b9f,null))[_0x23fc('0x1d')](function(_0x4f26b9){if(_0x4f26b9){_0x4e3338=_0x4f26b9;_0x5125e5[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xdb')][_0x23fc('0x32')]);_0x5125e5['query']=_[_0x23fc('0xc9')](_0x347a06['query']);_0x5125e5[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x5125e5[_0x23fc('0xc8')],_0x5125e5[_0x23fc('0x3e')]);_0x9fe527['attributes']=_[_0x23fc('0xcc')](_0x5125e5[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x347a06[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x9fe527[_0x23fc('0x43')]=_0x9fe527[_0x23fc('0x43')]['length']?_0x9fe527[_0x23fc('0x43')]:_0x5125e5[_0x23fc('0xc8')];_0x9fe527['order']=qs[_0x23fc('0xcf')](_0x347a06[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x9fe527[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_['pick'](_0x347a06[_0x23fc('0x3e')],_0x5125e5[_0x23fc('0xcb')]));if(_0x347a06[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x9fe527[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x9fe527[_0x23fc('0x3c')],{'$or':_['map'](_0x9fe527[_0x23fc('0x43')],function(_0x1fa36d){var _0x506a3c={};_0x506a3c[_0x1fa36d]={'$like':'%'+_0x347a06[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x506a3c;})});}_0x9fe527=_[_0x23fc('0x52')]({},_0x9fe527,_0x347a06['options']);return _0x4e3338[_0x23fc('0xdc')](_0x9fe527);}})[_0x23fc('0x1d')](function(_0x3d696c){if(_0x3d696c){_0x5d7dee=_0x3d696c[_0x23fc('0x49')];if(!_0x347a06[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x9fe527['limit']=qs['limit'](_0x347a06[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x9fe527['offset']=qs[_0x23fc('0x17')](_0x347a06[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x4e3338[_0x23fc('0xdc')](_0x9fe527);}})['then'](function(_0xf6cd9c){if(_0xf6cd9c){return _0xf6cd9c?{'count':_0x5d7dee,'rows':_0xf6cd9c}:null;}})[_0x23fc('0x1d')](respondWithResult(_0xbe5b9f,null))[_0x23fc('0x4f')](handleError(_0xbe5b9f,null));};exports[_0x23fc('0xdd')]=function(_0x168cda,_0x38bf35){var _0x361559={'raw':!![],'where':{}};var _0x56b7c8={};var _0x560f61={'count':0x0,'rows':[]};return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x168cda['params']['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x38bf35,null))[_0x23fc('0x1d')](function(_0x19d642){if(_0x19d642){_0x56b7c8[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xde')][_0x23fc('0x32')]);_0x56b7c8[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x168cda['query']);_0x56b7c8[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x56b7c8[_0x23fc('0xc8')],_0x56b7c8['query']);_0x361559['attributes']=_[_0x23fc('0xcc')](_0x56b7c8[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x168cda[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x361559[_0x23fc('0x43')]=_0x361559['attributes'][_0x23fc('0x49')]?_0x361559[_0x23fc('0x43')]:_0x56b7c8[_0x23fc('0xc8')];if(!_0x168cda[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x361559['limit']=qs[_0x23fc('0x19')](_0x168cda[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x361559[_0x23fc('0x17')]=qs[_0x23fc('0x17')](_0x168cda[_0x23fc('0x3e')][_0x23fc('0x17')]);}_0x361559[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x168cda['query']['sort']);_0x361559[_0x23fc('0x3c')]=qs['filters'](_[_0x23fc('0xd2')](_0x168cda['query'],_0x56b7c8[_0x23fc('0xcb')]));_0x361559[_0x23fc('0x3c')][_0x23fc('0xd7')]=_0x19d642['id'];if(_0x168cda[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x361559[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x361559[_0x23fc('0x3c')],{'$or':_['map'](_0x361559[_0x23fc('0x43')],function(_0x4298fc){var _0x319754={};_0x319754[_0x4298fc]={'$like':'%'+_0x168cda[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x319754;})});}_0x361559=_[_0x23fc('0x52')]({},_0x361559,_0x168cda[_0x23fc('0x53')]);return db['MailInteraction']['count']({'where':_0x361559['where']})[_0x23fc('0x1d')](function(_0x3873d0){_0x560f61['count']=_0x3873d0;if(_0x168cda[_0x23fc('0x3e')]['includeAll']){_0x361559['include']=[{'all':!![]}];}return db[_0x23fc('0xde')][_0x23fc('0x45')](_0x361559);})[_0x23fc('0x1d')](function(_0x517587){_0x560f61[_0x23fc('0x46')]=_0x517587;return _0x560f61;});}})[_0x23fc('0x1d')](respondWithFilteredResult(_0x38bf35,_0x361559))[_0x23fc('0x4f')](handleError(_0x38bf35,null));};exports[_0x23fc('0xdf')]=function(_0x3861d7,_0x444886){var _0xc0eae4={};var _0x308dfa={};var _0xc9eb8b;var _0x5dea62;return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x3861d7[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x444886,null))['then'](function(_0x5138a9){if(_0x5138a9){_0xc9eb8b=_0x5138a9;_0x308dfa[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xe0')][_0x23fc('0x32')]);_0x308dfa[_0x23fc('0x3e')]=_['keys'](_0x3861d7[_0x23fc('0x3e')]);_0x308dfa['filters']=_[_0x23fc('0xcc')](_0x308dfa[_0x23fc('0xc8')],_0x308dfa[_0x23fc('0x3e')]);_0xc0eae4[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x308dfa['model'],qs[_0x23fc('0xcd')](_0x3861d7[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0xc0eae4[_0x23fc('0x43')]=_0xc0eae4[_0x23fc('0x43')][_0x23fc('0x49')]?_0xc0eae4[_0x23fc('0x43')]:_0x308dfa[_0x23fc('0xc8')];_0xc0eae4[_0x23fc('0xce')]=qs['sort'](_0x3861d7['query'][_0x23fc('0xcf')]);_0xc0eae4[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x3861d7[_0x23fc('0x3e')],_0x308dfa[_0x23fc('0xcb')]));if(_0x3861d7['query']['filter']){_0xc0eae4['where']=_[_0x23fc('0x52')](_0xc0eae4[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0xc0eae4[_0x23fc('0x43')],function(_0xb20715){var _0x15af86={};_0x15af86[_0xb20715]={'$like':'%'+_0x3861d7[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x15af86;})});}_0xc0eae4=_[_0x23fc('0x52')]({},_0xc0eae4,_0x3861d7[_0x23fc('0x53')]);return _0xc9eb8b['getSmsInteractions'](_0xc0eae4);}})[_0x23fc('0x1d')](function(_0x17106e){if(_0x17106e){_0x5dea62=_0x17106e[_0x23fc('0x49')];if(!_0x3861d7['query'][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0xc0eae4[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x3861d7['query'][_0x23fc('0x19')]);_0xc0eae4['offset']=qs[_0x23fc('0x17')](_0x3861d7['query']['offset']);}return _0xc9eb8b[_0x23fc('0xdf')](_0xc0eae4);}})[_0x23fc('0x1d')](function(_0x1df71c){if(_0x1df71c){return _0x1df71c?{'count':_0x5dea62,'rows':_0x1df71c}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x444886,null))[_0x23fc('0x4f')](handleError(_0x444886,null));};exports[_0x23fc('0xe1')]=function(_0x3b3f6a,_0x1496f7){var _0x118969={};var _0x57657f={};var _0x3e2f3d;var _0x598061;return db[_0x23fc('0x31')]['findOne']({'where':{'id':_0x3b3f6a[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x1496f7,null))['then'](function(_0xf27a4c){if(_0xf27a4c){_0x3e2f3d=_0xf27a4c;_0x57657f['model']=_[_0x23fc('0xc9')](db[_0x23fc('0xe2')][_0x23fc('0x32')]);_0x57657f[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x3b3f6a[_0x23fc('0x3e')]);_0x57657f[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x57657f[_0x23fc('0xc8')],_0x57657f[_0x23fc('0x3e')]);_0x118969['attributes']=_[_0x23fc('0xcc')](_0x57657f['model'],qs['fields'](_0x3b3f6a[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x118969[_0x23fc('0x43')]=_0x118969[_0x23fc('0x43')]['length']?_0x118969[_0x23fc('0x43')]:_0x57657f[_0x23fc('0xc8')];_0x118969['order']=qs[_0x23fc('0xcf')](_0x3b3f6a[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x118969[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x3b3f6a[_0x23fc('0x3e')],_0x57657f['filters']));if(_0x3b3f6a[_0x23fc('0x3e')]['filter']){_0x118969[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x118969[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x118969[_0x23fc('0x43')],function(_0x139d54){var _0x29cd61={};_0x29cd61[_0x139d54]={'$like':'%'+_0x3b3f6a[_0x23fc('0x3e')]['filter']+'%'};return _0x29cd61;})});}_0x118969=_[_0x23fc('0x52')]({},_0x118969,_0x3b3f6a[_0x23fc('0x53')]);return _0x3e2f3d[_0x23fc('0xe1')](_0x118969);}})['then'](function(_0x31f3ba){if(_0x31f3ba){_0x598061=_0x31f3ba['length'];if(!_0x3b3f6a[_0x23fc('0x3e')]['hasOwnProperty'](_0x23fc('0xd0'))){_0x118969[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x3b3f6a[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x118969['offset']=qs[_0x23fc('0x17')](_0x3b3f6a[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x3e2f3d['getFaxInteractions'](_0x118969);}})[_0x23fc('0x1d')](function(_0x507dae){if(_0x507dae){return _0x507dae?{'count':_0x598061,'rows':_0x507dae}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x1496f7,null))[_0x23fc('0x4f')](handleError(_0x1496f7,null));};exports[_0x23fc('0xe3')]=function(_0x51eee1,_0x57ef1e){var _0x3f8a02={};var _0xde6b94={};var _0x1c9bd9;var _0xc1ca7c;return db['User']['findOne']({'where':{'id':_0x51eee1[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x57ef1e,null))[_0x23fc('0x1d')](function(_0x16a8a5){if(_0x16a8a5){_0x1c9bd9=_0x16a8a5;_0xde6b94[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db['WhatsappInteraction'][_0x23fc('0x32')]);_0xde6b94[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x51eee1['query']);_0xde6b94[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0xde6b94[_0x23fc('0xc8')],_0xde6b94[_0x23fc('0x3e')]);_0x3f8a02[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0xde6b94[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x51eee1[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x3f8a02['attributes']=_0x3f8a02[_0x23fc('0x43')][_0x23fc('0x49')]?_0x3f8a02[_0x23fc('0x43')]:_0xde6b94[_0x23fc('0xc8')];_0x3f8a02[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x51eee1[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x3f8a02['where']=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x51eee1[_0x23fc('0x3e')],_0xde6b94[_0x23fc('0xcb')]));if(_0x51eee1[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x3f8a02[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x3f8a02[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x3f8a02['attributes'],function(_0x31c5b8){var _0x22c1fb={};_0x22c1fb[_0x31c5b8]={'$like':'%'+_0x51eee1['query'][_0x23fc('0x26')]+'%'};return _0x22c1fb;})});}_0x3f8a02=_[_0x23fc('0x52')]({},_0x3f8a02,_0x51eee1[_0x23fc('0x53')]);return _0x1c9bd9['getWhatsappInteractions'](_0x3f8a02);}})[_0x23fc('0x1d')](function(_0x556913){if(_0x556913){_0xc1ca7c=_0x556913['length'];if(!_0x51eee1[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x3f8a02[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x51eee1[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x3f8a02[_0x23fc('0x17')]=qs[_0x23fc('0x17')](_0x51eee1['query'][_0x23fc('0x17')]);}return _0x1c9bd9[_0x23fc('0xe3')](_0x3f8a02);}})[_0x23fc('0x1d')](function(_0x2c096a){if(_0x2c096a){return _0x2c096a?{'count':_0xc1ca7c,'rows':_0x2c096a}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x57ef1e,null))[_0x23fc('0x4f')](handleError(_0x57ef1e,null));};exports[_0x23fc('0xe4')]=function(_0x4dbf79,_0x48b14c,_0x2587a4){var _0x56144a;var _0x459062;var _0x321c8b;var _0x57d6e9=!_[_0x23fc('0x60')](_0x4dbf79[_0x23fc('0x51')]['id'])?_0x4dbf79[_0x23fc('0x51')]['id']:!_[_0x23fc('0x60')](_0x4dbf79['user']['id'])?_0x4dbf79[_0x23fc('0x23')]['id']:null;return db[_0x23fc('0x31')]['find']({'where':{'id':_0x57d6e9,'role':{'$or':[_0x23fc('0x77'),'user','agent']}},'attributes':['id','name',_0x23fc('0xe5'),_0x23fc('0xe6'),_0x23fc('0x1e'),_0x23fc('0x5d'),'loginInPause']})[_0x23fc('0x1d')](function(_0x451993){if(_0x451993){if(_0x451993['role']===_0x23fc('0x6a')){_0x56144a=_0x451993;if(_0x4dbf79[_0x23fc('0x58')]['interface']){_0x321c8b=util[_0x23fc('0xa4')]('LOCAL/%s@from-sip/n',_0x56144a[_0x4dbf79[_0x23fc('0x58')][_0x23fc('0x99')]]);}else if(_0x4dbf79[_0x23fc('0x58')][_0x23fc('0xe7')]){_0x321c8b=util[_0x23fc('0xa4')]('SIP/%s',_0x4dbf79[_0x23fc('0x58')][_0x23fc('0xe7')]);}else{_0x321c8b=util[_0x23fc('0xa4')](_0x23fc('0xa5'),_0x56144a[_0x23fc('0x2b')]);}socket['to'](util['format'](_0x23fc('0xe8'),_0x56144a[_0x23fc('0x2b')]))['emit'](_0x23fc('0xe9'),{'user':{'id':_0x56144a['id'],'name':_0x56144a[_0x23fc('0x2b')]},'ip':_0x4dbf79['headers'][_0x23fc('0xea')]||_0x4dbf79[_0x23fc('0xeb')]['remoteAddress']||_0x4dbf79[_0x23fc('0xec')][_0x23fc('0xed')]||_0x4dbf79[_0x23fc('0xeb')][_0x23fc('0xec')][_0x23fc('0xed')]});return db[_0x23fc('0xa6')][_0x23fc('0x20')]({'where':{'membername':_0x56144a['name']},'individualHooks':!![]});}}else{throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0xee'));}})[_0x23fc('0x1d')](function(){if(_0x56144a){return _0x56144a[_0x23fc('0xef')]({'raw':!![]});}})[_0x23fc('0x1d')](function(_0x4c6286){if(_0x56144a){if(_0x4c6286){_0x459062=_0x4c6286;if(_0x459062[_0x23fc('0x49')]){var _0x4a1278=_0x459062[_0x23fc('0x28')](function(_0x3509b9){var _0x4eec03={'membername':_0x56144a[_0x23fc('0x2b')],'UserId':_0x56144a['id'],'queue_name':_0x3509b9[_0x23fc('0x2b')],'VoiceQueueId':_0x3509b9['id'],'interface':_0x321c8b,'paused':_0x56144a[_0x23fc('0x97')]||![],'penalty':_0x3509b9[_0x23fc('0xf0')]||0x0};return db[_0x23fc('0xa6')][_0x23fc('0xf1')](_0x4eec03);});return Promise[_0x23fc('0x4e')](_0x4a1278);}}}})[_0x23fc('0x1d')](function(){if(_0x56144a){return db[_0x23fc('0xf2')][_0x23fc('0x45')]({'where':{'membername':_0x56144a[_0x23fc('0x2b')],'exitAt':null}});}})[_0x23fc('0x1d')](function(_0x5c00f9){if(_0x56144a){var _0x41fc8b=[];_0x5c00f9['forEach'](function(_0x29f139){_0x41fc8b[_0x23fc('0x44')](_0x29f139[_0x23fc('0x1c')]({'exitAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3'))}));});return Promise[_0x23fc('0x4e')](_0x41fc8b);}})[_0x23fc('0x1d')](function(){if(_0x56144a){var _0xaaf0e8=[];var _0x8f811d=[];var _0x465e79=utils[_0x23fc('0xf4')]();var _0x3622af={'membername':_0x56144a[_0x23fc('0x2b')],'interface':_0x321c8b,'enterAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3')),'role':_0x56144a[_0x23fc('0x1e')],'internal':_0x56144a[_0x23fc('0x5d')]};_0x465e79['forEach'](function(_0x2b3abf){_0xaaf0e8[_0x23fc('0x44')](_[_0x23fc('0x52')]({'channel':_0x2b3abf,'type':_0x23fc('0xf5'),'data1':_0x4dbf79[_0x23fc('0x58')][_0x23fc('0xf6')],'data2':_0x321c8b},_0x3622af));if(_0x56144a['loginInPause']){_0x8f811d[_0x23fc('0x44')](_[_0x23fc('0x52')]({'channel':_0x2b3abf,'type':'PAUSE','data1':_0x23fc('0xf7')},_0x3622af));}});return db[_0x23fc('0xf2')][_0x23fc('0x7f')](_0xaaf0e8[_0x23fc('0xf8')](_0x8f811d),{'individualHooks':!![]});}})[_0x23fc('0x1d')](function(){if(_0x56144a){return _0x56144a['update']({'online':!![],'lastLoginAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3')),'voicePause':_0x56144a['loginInPause']||![],'mailPause':_0x56144a[_0x23fc('0x97')]||![],'chatPause':_0x56144a[_0x23fc('0x97')]||![],'faxPause':_0x56144a[_0x23fc('0x97')]||![],'smsPause':_0x56144a['loginInPause']||![],'openchannelPause':_0x56144a[_0x23fc('0x97')]||![],'whatsappPause':_0x56144a['loginInPause']||![],'pauseType':_0x56144a['loginInPause']?_0x23fc('0xf7'):null,'interface':_0x321c8b,'lastPauseAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3'))});}})[_0x23fc('0x1d')](function(_0x869d69){if(_0x4dbf79['isMiddleware']){return _0x2587a4();}else{return Promise[_0x23fc('0xf9')](_0x869d69)[_0x23fc('0x1d')](respondWithResult(_0x48b14c,null));}})[_0x23fc('0x4f')](handleError(_0x48b14c,null));};exports[_0x23fc('0xfa')]=function(_0x3c145c,_0x3c5f5a){var _0x11d806;return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0x3c145c['params']['id'],'role':'agent'},'attributes':['id',_0x23fc('0x2b'),_0x23fc('0x1e')]})[_0x23fc('0x1d')](handleEntityNotFound(_0x3c5f5a,null))[_0x23fc('0x1d')](function(_0x3d7842){if(_0x3d7842){_0x11d806=_0x3d7842;return db[_0x23fc('0xa6')][_0x23fc('0x20')]({'where':{'membername':_0x11d806[_0x23fc('0x2b')]},'individualHooks':!![]});}})[_0x23fc('0x1d')](function(){return db['MemberReport'][_0x23fc('0x45')]({'where':{'membername':_0x11d806[_0x23fc('0x2b')],'exitAt':null}});})[_0x23fc('0x1d')](function(_0x4bf222){var _0x31a72d=[];_0x4bf222[_0x23fc('0xfb')](function(_0x2ace4f){_0x31a72d[_0x23fc('0x44')](_0x2ace4f['update']({'exitAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3'))}));});return Promise[_0x23fc('0x4e')](_0x31a72d);})[_0x23fc('0x1d')](function(){return _0x11d806[_0x23fc('0x1c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x23fc('0x1d')](respondWithResult(_0x3c5f5a,null))['catch'](handleError(_0x3c5f5a,null));};exports[_0x23fc('0xfc')]=function(_0x5ad2a9,_0x1f041b){var _0x30bd44;return db['UserVoiceQueueRt'][_0x23fc('0x1c')]({'paused':0x1},{'where':{'UserId':_0x5ad2a9[_0x23fc('0x51')]['id']},'individualHooks':!![]})[_0x23fc('0x1d')](function(){return db[_0x23fc('0x31')]['find']({'where':{'id':_0x5ad2a9[_0x23fc('0x51')]['id'],'role':_0x23fc('0x6a')},'attributes':['id',_0x23fc('0x2b'),_0x23fc('0x1e'),'internal','interface',_0x23fc('0xfd')]});})[_0x23fc('0x1d')](handleEntityNotFound(_0x1f041b,null))[_0x23fc('0x1d')](function(_0x3c702c){if(_0x3c702c){_0x30bd44=_0x3c702c;return db[_0x23fc('0xf2')][_0x23fc('0x45')]({'where':{'membername':_0x30bd44[_0x23fc('0x2b')],'type':_0x23fc('0xfe'),'exitAt':null}});}})[_0x23fc('0x1d')](function(_0x5c77c9){if(_0x5c77c9[_0x23fc('0x49')]){var _0xbe78f0=moment()[_0x23fc('0xa4')](_0x23fc('0xf3'));for(var _0x28d393=0x0,_0x51cb1d=_0x5c77c9['length'];_0x28d393<_0x51cb1d;_0x28d393++){_0x5c77c9[_0x28d393][_0x23fc('0xff')]({'exitAt':_0xbe78f0});}}})[_0x23fc('0x1d')](function(){var _0x43b6ba=[];var _0x2d0fd8=utils[_0x23fc('0xf4')]();_0x2d0fd8['forEach'](function(_0x284259){_0x43b6ba['push']({'channel':_0x284259,'membername':_0x30bd44[_0x23fc('0x2b')],'interface':_[_0x23fc('0x60')](_0x30bd44[_0x23fc('0x99')])?util[_0x23fc('0xa4')](_0x23fc('0xa5'),_0x30bd44[_0x23fc('0x2b')]):_0x30bd44[_0x23fc('0x99')],'type':_0x23fc('0xfe'),'enterAt':moment()[_0x23fc('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5ad2a9[_0x23fc('0x58')][_0x23fc('0x34')]||_0x23fc('0x100'),'role':_0x30bd44[_0x23fc('0x1e')],'internal':_0x30bd44[_0x23fc('0x5d')]});});return db[_0x23fc('0xf2')]['bulkCreate'](_0x43b6ba,{'individualHooks':!![]});})[_0x23fc('0x1d')](function(){return _0x30bd44[_0x23fc('0x1c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5ad2a9[_0x23fc('0x58')][_0x23fc('0x34')]||_0x23fc('0x100'),'lastPauseAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3'))});})[_0x23fc('0x1d')](respondWithResult(_0x1f041b,null))[_0x23fc('0x4f')](handleError(_0x1f041b,null));};exports[_0x23fc('0x101')]=function(_0x4b6166,_0x1d14e6){if(_0x4b6166['body'][_0x23fc('0x96')]&&!utils[_0x23fc('0x9a')](_0x4b6166[_0x23fc('0x58')][_0x23fc('0x96')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4b6166['body']['channel']));}return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0x4b6166[_0x23fc('0x51')]['id']},'attributes':['id',_0x23fc('0x2b'),_0x23fc('0x1e'),_0x23fc('0x5d'),_0x23fc('0x99'),_0x23fc('0xfd'),_0x23fc('0x98'),'mailPause',_0x23fc('0x102'),_0x23fc('0x103'),_0x23fc('0x104'),_0x23fc('0x105'),_0x23fc('0x106'),_0x23fc('0x107'),_0x23fc('0x108')]})[_0x23fc('0x1d')](function(_0x87b127){if(!_0x87b127){throw new APINotFoundError(util[_0x23fc('0xa4')](_0x23fc('0xc0'),_0x4b6166[_0x23fc('0x51')]['id']));}return _0x87b127[_0x23fc('0x101')](_0x4b6166[_0x23fc('0x58')][_0x23fc('0x96')]);})[_0x23fc('0x1d')](respondWithResult(_0x1d14e6,null))[_0x23fc('0x4f')](APIHandleError(_0x1d14e6));};exports['getTeams']=function(_0x5c1aa0,_0x1e0cf7){var _0x389b16={};var _0x344020={};var _0x15d4aa;var _0x2f851b;return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x5c1aa0[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x1e0cf7,null))[_0x23fc('0x1d')](function(_0x5bd249){if(_0x5bd249){_0x15d4aa=_0x5bd249;_0x344020[_0x23fc('0xc8')]=_['keys'](db[_0x23fc('0x109')][_0x23fc('0x32')]);_0x344020['query']=_['keys'](_0x5c1aa0[_0x23fc('0x3e')]);_0x344020['filters']=_[_0x23fc('0xcc')](_0x344020[_0x23fc('0xc8')],_0x344020[_0x23fc('0x3e')]);_0x389b16[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x344020[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x5c1aa0['query']['fields']));_0x389b16[_0x23fc('0x43')]=_0x389b16[_0x23fc('0x43')][_0x23fc('0x49')]?_0x389b16[_0x23fc('0x43')]:_0x344020[_0x23fc('0xc8')];_0x389b16[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x5c1aa0[_0x23fc('0x3e')]['sort']);_0x389b16[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x5c1aa0[_0x23fc('0x3e')],_0x344020[_0x23fc('0xcb')]));if(_0x5c1aa0[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x389b16[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x389b16[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x389b16[_0x23fc('0x43')],function(_0x37b8ca){var _0x2ee5e4={};_0x2ee5e4[_0x37b8ca]={'$like':'%'+_0x5c1aa0[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x2ee5e4;})});}_0x389b16=_[_0x23fc('0x52')]({},_0x389b16,_0x5c1aa0[_0x23fc('0x53')]);return _0x15d4aa[_0x23fc('0x10a')](_0x389b16);}})[_0x23fc('0x1d')](function(_0x24ca05){if(_0x24ca05){_0x2f851b=_0x24ca05[_0x23fc('0x49')];if(!_0x5c1aa0[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x389b16[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x5c1aa0[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x389b16[_0x23fc('0x17')]=qs['offset'](_0x5c1aa0[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x15d4aa[_0x23fc('0x10a')](_0x389b16);}})[_0x23fc('0x1d')](function(_0x234d3d){if(_0x234d3d){return _0x234d3d?{'count':_0x2f851b,'rows':_0x234d3d}:null;}})['then'](respondWithResult(_0x1e0cf7,null))[_0x23fc('0x4f')](handleError(_0x1e0cf7,null));};exports[_0x23fc('0x10b')]=function(_0x21c45e,_0x49979f){var _0x101026=_0x21c45e[_0x23fc('0x51')]['id'];var _0x5d7ddd=_0x21c45e[_0x23fc('0x58')]?_0x21c45e[_0x23fc('0x58')][_0x23fc('0x5b')]:null;var _0xe668d6=[];return Promise[_0x23fc('0xf9')]()[_0x23fc('0x1d')](function(){if(!_0x5d7ddd)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x23fc('0x1d')](function(){return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x101026}});})[_0x23fc('0x1d')](function(_0x2132f4){if(!_0x2132f4)throw new APINotFoundError(util[_0x23fc('0xa4')](_0x23fc('0xc0'),_0x21c45e[_0x23fc('0x51')]['id']));return db[_0x23fc('0x62')][_0x23fc('0x10c')](function(_0x4c266f){return _0x2132f4[_0x23fc('0x10b')](_0x5d7ddd,{'transaction':_0x4c266f})[_0x23fc('0x1d')](function(){return db[_0x23fc('0x109')][_0x23fc('0x45')]({'where':{'id':{'$in':_0x5d7ddd}}});})['then'](function(_0x4c0258){var _0x469e4f=_[_0x23fc('0x28')](_0x4c0258,function(_0x105484){return _0x105484[_0x23fc('0x10d')]();});return Promise[_0x23fc('0x4e')](_0x469e4f);})['then'](function(_0x443a7f){_0xe668d6=_[_0x23fc('0x10e')](_0x443a7f);var _0xc0aa9b=_[_0x23fc('0x28')](_0xe668d6,function(_0x45ac58){return _0x45ac58[_0x23fc('0x10f')](_0x2132f4['id'],{'transaction':_0x4c266f});});return Promise[_0x23fc('0x4e')](_0xc0aa9b);})[_0x23fc('0x1d')](function(){if(!_0x2132f4['online'])return;var _0x93e034=_['filter'](_0xe668d6,function(_0x282e83){return _0x282e83[_0x23fc('0x110')](_0x23fc('0x96'))===_0x23fc('0x111');});var _0x46725a=_[_0x23fc('0x28')](_0x93e034,function(_0x4ad568){return db[_0x23fc('0xa6')][_0x23fc('0xf1')]({'membername':_0x2132f4['name'],'UserId':_0x2132f4['id'],'queue_name':_0x4ad568[_0x23fc('0x2b')],'VoiceQueueId':_0x4ad568['id'],'interface':_[_0x23fc('0x60')](_0x2132f4[_0x23fc('0x99')])?util[_0x23fc('0xa4')](_0x23fc('0xa5'),_0x2132f4['name']):_0x2132f4[_0x23fc('0x99')],'paused':_0x2132f4[_0x23fc('0x98')]||![],'penalty':_0x2132f4[_0x23fc('0x9f')]},{'transaction':_0x4c266f});});return Promise[_0x23fc('0x4e')](_0x46725a);})[_0x23fc('0x1d')](function(){return db[_0x23fc('0x112')][_0x23fc('0x45')]({'where':{'teamId':{'$in':_0x5d7ddd}}});})['then'](function(_0x13ffc1){var _0x204f71=_[_0x23fc('0x28')](_0x13ffc1,function(_0x5a6721){return db['UserVoicePrefix'][_0x23fc('0x76')]({'UserId':_0x2132f4['id'],'VoicePrefixId':_0x5a6721[_0x23fc('0x113')]},{'transaction':_0x4c266f});});return Promise['all'](_0x204f71);});});})[_0x23fc('0x1d')](function(){for(var _0x40ba37=0x0;_0x40ba37<_0xe668d6[_0x23fc('0x49')];_0x40ba37++){var _0x52bf4c=_0xe668d6[_0x40ba37][_0x23fc('0x110')](_0x23fc('0x96'));var _0x5d96db=_0x52bf4c+'QueueId';socket['emit'](_0x23fc('0x23')+_0x52bf4c+_0x23fc('0x114'),{'UserId':_0x101026,['queueField']:_0xe668d6[_0x40ba37]['id']});}})[_0x23fc('0x1d')](respondWithStatusCode(_0x49979f,null))[_0x23fc('0x4f')](APIHandleError(_0x49979f));};exports[_0x23fc('0x115')]=function(_0x288ca8,_0x3102e4){var _0x126f32=_0x288ca8[_0x23fc('0x51')]['id'];var _0x286a94=null;if(_0x288ca8[_0x23fc('0x3e')][_0x23fc('0x5b')]){_0x286a94=_['isArray'](_0x288ca8[_0x23fc('0x3e')][_0x23fc('0x5b')])?_0x288ca8[_0x23fc('0x3e')][_0x23fc('0x5b')]:[_0x288ca8[_0x23fc('0x3e')][_0x23fc('0x5b')]];}var _0x32ac32=[];return Promise[_0x23fc('0xf9')]()[_0x23fc('0x1d')](function(){if(!_0x286a94)throw new APIBadRequestError(_0x23fc('0x116'));})[_0x23fc('0x1d')](function(){return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x126f32}});})[_0x23fc('0x1d')](function(_0xe9091d){if(!_0xe9091d)throw new APINotFoundError(util[_0x23fc('0xa4')]('User\x20with\x20id\x20%s\x20not\x20found',_0x288ca8[_0x23fc('0x51')]['id']));return db[_0x23fc('0x62')][_0x23fc('0x10c')](function(_0x299d93){return _0xe9091d[_0x23fc('0x115')](_0x286a94,{'transaction':_0x299d93})['then'](function(){return db[_0x23fc('0x109')][_0x23fc('0x45')]({'where':{'id':{'$in':_0x286a94}}});})[_0x23fc('0x1d')](function(_0xf0df07){var _0x533603=_[_0x23fc('0x28')](_0xf0df07,function(_0x40b468){return _0x40b468['getAssociatedQueues']();});return Promise[_0x23fc('0x4e')](_0x533603);})['then'](function(_0x25b853){_0x32ac32=_[_0x23fc('0x10e')](_0x25b853);var _0x23e98f=_[_0x23fc('0x28')](_0x32ac32,function(_0x361078){return _0x361078[_0x23fc('0x117')](_0xe9091d['id'],{'transaction':_0x299d93});});return Promise[_0x23fc('0x4e')](_0x23e98f);})[_0x23fc('0x1d')](function(){if(!_0xe9091d['online'])return;var _0x5d8064=_[_0x23fc('0x26')](_0x32ac32,function(_0x10eb0c){return _0x10eb0c[_0x23fc('0x110')](_0x23fc('0x96'))===_0x23fc('0x111');});var _0x3cbb07=_[_0x23fc('0x28')](_0x5d8064,function(_0x3aeaa8){return db[_0x23fc('0xa6')]['destroy']({'where':{'VoiceQueueId':_0x3aeaa8['id'],'UserId':_0xe9091d['id']},'transaction':_0x299d93});});return Promise[_0x23fc('0x4e')](_0x3cbb07);})[_0x23fc('0x1d')](function(){return db['TeamVoicePrefix'][_0x23fc('0x45')]({'where':{'teamId':{'$in':_0x286a94}}});})[_0x23fc('0x1d')](function(_0x29819d){var _0x6eeeb9=_[_0x23fc('0x28')](_0x29819d,function(_0x4eb745){return db[_0x23fc('0x118')][_0x23fc('0x20')]({'where':{'UserId':_0xe9091d['id'],'VoicePrefixId':_0x4eb745[_0x23fc('0x113')]}},{'transaction':_0x299d93});});return Promise[_0x23fc('0x4e')](_0x6eeeb9);});});})[_0x23fc('0x1d')](function(){for(var _0x473a48=0x0;_0x473a48<_0x32ac32[_0x23fc('0x49')];_0x473a48++){var _0x180df7=_0x32ac32[_0x473a48][_0x23fc('0x110')](_0x23fc('0x96'));var _0x240734=_0x180df7+'QueueId';socket[_0x23fc('0x1f')](_0x23fc('0x23')+_0x180df7+_0x23fc('0xa9'),{'UserId':_0x126f32,['queueField']:_0x32ac32[_0x473a48]['id']});}})['then'](respondWithStatusCode(_0x3102e4,null))['catch'](APIHandleError(_0x3102e4));};exports['getLists']=function(_0x36ef91,_0x3535bd){var _0x238a92={};var _0x4f794f={};var _0x1cbb89;var _0x145a4b;return db[_0x23fc('0x31')]['findOne']({'where':{'id':_0x36ef91[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x3535bd,null))[_0x23fc('0x1d')](function(_0x58a68b){if(_0x58a68b){_0x1cbb89=_0x58a68b;_0x4f794f[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xc2')][_0x23fc('0x32')]);_0x4f794f[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x36ef91[_0x23fc('0x3e')]);_0x4f794f[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x4f794f[_0x23fc('0xc8')],_0x4f794f[_0x23fc('0x3e')]);_0x238a92['attributes']=_[_0x23fc('0xcc')](_0x4f794f[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x36ef91[_0x23fc('0x3e')]['fields']));_0x238a92['attributes']=_0x238a92[_0x23fc('0x43')][_0x23fc('0x49')]?_0x238a92[_0x23fc('0x43')]:_0x4f794f[_0x23fc('0xc8')];_0x238a92[_0x23fc('0xce')]=qs['sort'](_0x36ef91[_0x23fc('0x3e')]['sort']);_0x238a92[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x36ef91[_0x23fc('0x3e')],_0x4f794f['filters']));if(_0x36ef91['query'][_0x23fc('0x26')]){_0x238a92['where']=_[_0x23fc('0x52')](_0x238a92[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x238a92[_0x23fc('0x43')],function(_0x4f5230){var _0x452919={};_0x452919[_0x4f5230]={'$like':'%'+_0x36ef91['query']['filter']+'%'};return _0x452919;})});}_0x238a92=_['merge']({},_0x238a92,_0x36ef91['options']);return _0x1cbb89[_0x23fc('0x119')](_0x238a92);}})[_0x23fc('0x1d')](function(_0x467d75){if(_0x467d75){_0x145a4b=_0x467d75[_0x23fc('0x49')];if(!_0x36ef91[_0x23fc('0x3e')]['hasOwnProperty'](_0x23fc('0xd0'))){_0x238a92[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x36ef91[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x238a92['offset']=qs['offset'](_0x36ef91[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x1cbb89[_0x23fc('0x119')](_0x238a92);}})['then'](function(_0x4612e0){if(_0x4612e0){return _0x4612e0?{'count':_0x145a4b,'rows':_0x4612e0}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x3535bd,null))[_0x23fc('0x4f')](handleError(_0x3535bd,null));};exports['getAgents']=function(_0x23982e,_0x4a154a){var _0x1d639e={};var _0x261a03={};var _0x12ee16;return db['User']['findOne']({'where':{'id':_0x23982e['params']['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x4a154a,null))[_0x23fc('0x1d')](function(_0x500801){if(_0x500801){_0x12ee16=_0x500801;_0x261a03[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0x31')][_0x23fc('0x32')]);_0x261a03[_0x23fc('0x3e')]=_['keys'](_0x23982e[_0x23fc('0x3e')]);_0x261a03['filters']=_[_0x23fc('0xcc')](_0x261a03[_0x23fc('0xc8')],_0x261a03[_0x23fc('0x3e')]);_0x1d639e[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x261a03[_0x23fc('0xc8')],qs['fields'](_0x23982e['query'][_0x23fc('0xcd')]));_0x1d639e[_0x23fc('0x43')]=_0x1d639e[_0x23fc('0x43')][_0x23fc('0x49')]?_0x1d639e[_0x23fc('0x43')]:_0x261a03[_0x23fc('0xc8')];_0x1d639e['order']=qs[_0x23fc('0xcf')](_0x23982e[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x1d639e[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x23982e[_0x23fc('0x3e')],_0x261a03['filters']));if(_0x23982e[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x1d639e[_0x23fc('0x3c')]=_['merge'](_0x1d639e[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x1d639e[_0x23fc('0x43')],function(_0x1c40c6){var _0x16b7be={};_0x16b7be[_0x1c40c6]={'$like':'%'+_0x23982e[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x16b7be;})});}_0x1d639e[_0x23fc('0xc8')]=db[_0x23fc('0x31')];_0x1d639e['as']=_0x23fc('0x24');_0x1d639e=_['merge']({},_0x1d639e,_0x23982e['options']);return _0x12ee16['getVoiceQueues']({'include':[_0x1d639e]});}})[_0x23fc('0x1d')](function(_0x51db40){if(_0x51db40){var _0x1d8229={},_0x3df7d8=[];for(var _0x3d7ebe=0x0;_0x3d7ebe<_0x51db40['length'];_0x3d7ebe+=0x1){for(var _0x327a0d=0x0,_0x1cc34c;_0x327a0d<_0x51db40[_0x3d7ebe][_0x23fc('0x24')][_0x23fc('0x49')];_0x327a0d+=0x1){_0x1cc34c=_0x51db40[_0x3d7ebe][_0x23fc('0x24')][_0x327a0d][_0x23fc('0x21')]({'plain':!![]});_0x1d8229[_0x1cc34c['id']]=_0x1cc34c;}}_0x1d8229=_[_0x23fc('0x11a')](_0x1d8229);for(var _0x106921=qs['offset'](_0x23982e[_0x23fc('0x3e')][_0x23fc('0x17')]);_0x106921<_0x1d8229['length']&&_0x3df7d8[_0x23fc('0x49')]=_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 +var _0xb58f=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','./user.socket','register','GetUser','findAll','options','raw','where','attributes','limit','map','model','include','then','info','debug','stringify','error','message','User','find','ShowUser','catch','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','PAUSE','body','type','uniqueid','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','params','unpause','system','LogoutUser','destroy','push','all','LoginUser','mobile','phone','loginInPause','SIP/%s','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','bulkCreate','concat','LOGININPAUSE','util','moment'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0xb58f,0xb8));var _0xfb58=function(_0x2474c9,_0x5a481a){_0x2474c9=_0x2474c9-0x0;var _0x17d042=_0xb58f[_0x2474c9];return _0x17d042;};'use strict';var _=require('lodash');var util=require(_0xfb58('0x0'));var moment=require(_0xfb58('0x1'));var BPromise=require(_0xfb58('0x2'));var Redis=require(_0xfb58('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb58('0x4'));var logger=require(_0xfb58('0x5'))(_0xfb58('0x6'));var config=require('../../config/environment');config[_0xfb58('0x7')]=_[_0xfb58('0x8')](config['redis'],{'host':_0xfb58('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb58('0x7')]));require(_0xfb58('0xa'))[_0xfb58('0xb')](socket);exports[_0xfb58('0xc')]=function(_0xef42cb){var _0x2ea8ed=this;return new Promise(function(_0x5c497c,_0x411975){return db['User'][_0xfb58('0xd')]({'raw':_0xef42cb[_0xfb58('0xe')]?_0xef42cb[_0xfb58('0xe')][_0xfb58('0xf')]===undefined?!![]:![]:!![],'where':_0xef42cb['options']?_0xef42cb[_0xfb58('0xe')][_0xfb58('0x10')]||null:null,'attributes':_0xef42cb['options']?_0xef42cb[_0xfb58('0xe')][_0xfb58('0x11')]||null:null,'limit':_0xef42cb[_0xfb58('0xe')]?_0xef42cb[_0xfb58('0xe')][_0xfb58('0x12')]||null:null,'include':_0xef42cb[_0xfb58('0xe')]?_0xef42cb[_0xfb58('0xe')]['include']?_[_0xfb58('0x13')](_0xef42cb['options']['include'],function(_0x5783a1){return{'model':db[_0x5783a1[_0xfb58('0x14')]],'as':_0x5783a1['as'],'attributes':_0x5783a1[_0xfb58('0x11')],'include':_0x5783a1['include']?_['map'](_0x5783a1[_0xfb58('0x15')],function(_0x48d6e3){return{'model':db[_0x48d6e3['model']],'as':_0x48d6e3['as'],'attributes':_0x48d6e3['attributes'],'include':_0x48d6e3[_0xfb58('0x15')]?_['map'](_0x48d6e3[_0xfb58('0x15')],function(_0x1df698){return{'model':db[_0x1df698[_0xfb58('0x14')]],'as':_0x1df698['as'],'attributes':_0x1df698[_0xfb58('0x11')]};}):[]};}):[]};}):[]:[]})[_0xfb58('0x16')](function(_0xe355a){logger[_0xfb58('0x17')]('GetUser',_0xef42cb);logger[_0xfb58('0x18')](_0xfb58('0xc'),_0xef42cb,JSON[_0xfb58('0x19')](_0xe355a));_0x5c497c(_0xe355a);})['catch'](function(_0xa358d1){logger[_0xfb58('0x1a')](_0xfb58('0xc'),_0xa358d1[_0xfb58('0x1b')],_0xef42cb);_0x411975(_0x2ea8ed[_0xfb58('0x1a')](0x1f4,_0xa358d1[_0xfb58('0x1b')]));});});};exports['ShowUser']=function(_0x22e54e){var _0x59e1ae=this;return new Promise(function(_0x42cc69,_0x2af9ff){return db[_0xfb58('0x1c')][_0xfb58('0x1d')]({'raw':_0x22e54e[_0xfb58('0xe')]?_0x22e54e[_0xfb58('0xe')][_0xfb58('0xf')]===undefined?!![]:![]:!![],'where':_0x22e54e[_0xfb58('0xe')]?_0x22e54e[_0xfb58('0xe')][_0xfb58('0x10')]||null:null,'attributes':_0x22e54e[_0xfb58('0xe')]?_0x22e54e[_0xfb58('0xe')][_0xfb58('0x11')]||null:null,'include':_0x22e54e[_0xfb58('0xe')]?_0x22e54e[_0xfb58('0xe')]['include']?_['map'](_0x22e54e['options'][_0xfb58('0x15')],function(_0x1dddbd){return{'model':db[_0x1dddbd[_0xfb58('0x14')]],'as':_0x1dddbd['as'],'attributes':_0x1dddbd[_0xfb58('0x11')],'include':_0x1dddbd['include']?_[_0xfb58('0x13')](_0x1dddbd[_0xfb58('0x15')],function(_0x28c1e7){return{'model':db[_0x28c1e7[_0xfb58('0x14')]],'as':_0x28c1e7['as'],'attributes':_0x28c1e7[_0xfb58('0x11')],'include':_0x28c1e7[_0xfb58('0x15')]?_[_0xfb58('0x13')](_0x28c1e7[_0xfb58('0x15')],function(_0x13c1ec){return{'model':db[_0x13c1ec[_0xfb58('0x14')]],'as':_0x13c1ec['as'],'attributes':_0x13c1ec[_0xfb58('0x11')]};}):[]};}):[]};}):[]:[]})[_0xfb58('0x16')](function(_0x3854ea){logger[_0xfb58('0x17')](_0xfb58('0x1e'),_0x22e54e);logger[_0xfb58('0x18')](_0xfb58('0x1e'),_0x22e54e,JSON[_0xfb58('0x19')](_0x3854ea));_0x42cc69(_0x3854ea);})[_0xfb58('0x1f')](function(_0x12901a){logger[_0xfb58('0x1a')]('ShowUser',_0x12901a[_0xfb58('0x1b')],_0x22e54e);_0x2af9ff(_0x59e1ae[_0xfb58('0x1a')](0x1f4,_0x12901a[_0xfb58('0x1b')]));});});};exports[_0xfb58('0x20')]=function(_0x4cfaad){var _0x412d00;return db[_0xfb58('0x1c')]['find']({'where':_0x4cfaad['options'][_0xfb58('0x10')]||{},'attributes':['id',_0xfb58('0x21'),_0xfb58('0x22'),_0xfb58('0x23'),_0xfb58('0x24')]})[_0xfb58('0x16')](function(_0x628ef4){if(!_0x628ef4){throw new Error(util[_0xfb58('0x25')](_0xfb58('0x26'),_0x4cfaad['params']['id']));}_0x412d00=_0x628ef4;return db[_0xfb58('0x27')][_0xfb58('0x28')]({'paused':0x1},{'where':{'UserId':_0x412d00['id']},'individualHooks':!![]});})[_0xfb58('0x16')](function(){return db[_0xfb58('0x29')]['findAll']({'where':{'membername':_0x412d00[_0xfb58('0x21')],'type':'PAUSE','exitAt':null}});})[_0xfb58('0x16')](function(_0x35170b){if(_0x35170b&&_0x35170b[_0xfb58('0x2a')]){var _0x5d0dba=moment()[_0xfb58('0x25')](_0xfb58('0x2b'));for(var _0x1ec618=0x0,_0x404252=_0x35170b[_0xfb58('0x2a')];_0x1ec618<_0x404252;_0x1ec618++){_0x35170b[_0x1ec618][_0xfb58('0x2c')]({'exitAt':_0x5d0dba});}}})[_0xfb58('0x16')](function(){var _0x51e750=[];var _0x23aba4=utils[_0xfb58('0x2d')]();_0x23aba4[_0xfb58('0x2e')](function(_0x532c62){_0x51e750['push']({'channel':_0x532c62,'membername':_0x412d00[_0xfb58('0x21')],'interface':_[_0xfb58('0x2f')](_0x412d00[_0xfb58('0x24')])?util[_0xfb58('0x25')]('SIP/%s',_0x412d00[_0xfb58('0x21')]):_0x412d00[_0xfb58('0x24')],'type':_0xfb58('0x30'),'enterAt':moment()[_0xfb58('0x25')](_0xfb58('0x2b')),'data1':_0x4cfaad[_0xfb58('0x31')][_0xfb58('0x32')]||'DEFAULT\x20PAUSE','role':_0x412d00[_0xfb58('0x22')],'internal':_0x412d00[_0xfb58('0x23')],'uniqueid':_0x4cfaad[_0xfb58('0x31')][_0xfb58('0x33')]||null});});return db[_0xfb58('0x29')]['bulkCreate'](_0x51e750,{'individualHooks':!![]});})['then'](function(){return _0x412d00[_0xfb58('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4cfaad[_0xfb58('0x31')][_0xfb58('0x32')]||_0xfb58('0x34'),'lastPauseAt':moment()['format'](_0xfb58('0x2b'))});})[_0xfb58('0x1f')](function(_0x3f3ba3){throw _0x3f3ba3;});};exports[_0xfb58('0x35')]=function(_0x5118ce){return Promise[_0xfb58('0x36')]()[_0xfb58('0x16')](function(){if(_0x5118ce[_0xfb58('0x31')][_0xfb58('0x37')]&&!utils[_0xfb58('0x38')](_0x5118ce[_0xfb58('0x31')][_0xfb58('0x37')])){throw new Error(util[_0xfb58('0x25')](_0xfb58('0x39'),_0x5118ce[_0xfb58('0x31')]['channel']));}return db[_0xfb58('0x1c')][_0xfb58('0x3a')]({'where':_0x5118ce[_0xfb58('0xe')][_0xfb58('0x10')]||{},'attributes':['id',_0xfb58('0x21'),'role','internal',_0xfb58('0x24'),_0xfb58('0x3b'),'voicePause','mailPause',_0xfb58('0x3c'),_0xfb58('0x3d'),_0xfb58('0x3e'),_0xfb58('0x3f'),_0xfb58('0x40'),_0xfb58('0x41'),_0xfb58('0x42')]});})[_0xfb58('0x16')](function(_0x3d3c5e){if(!_0x3d3c5e){throw new Error(util[_0xfb58('0x25')](_0xfb58('0x26'),_0x5118ce[_0xfb58('0x43')]['id']));}return _0x3d3c5e[_0xfb58('0x44')](_0x5118ce[_0xfb58('0x31')][_0xfb58('0x37')],_0xfb58('0x45'));})[_0xfb58('0x1f')](function(_0x5c8c4e){throw _0x5c8c4e;});};exports[_0xfb58('0x46')]=function(_0x14c15b){var _0x11d5cc=this;return new Promise(function(_0x49d447,_0x16ca2d){var _0x3378e5;return db[_0xfb58('0x1c')][_0xfb58('0x3a')]({'where':_0x14c15b[_0xfb58('0xe')][_0xfb58('0x10')]||{},'attributes':['id',_0xfb58('0x21')]})[_0xfb58('0x16')](function(_0xcfe73a){if(_0xcfe73a){_0x3378e5=_0xcfe73a;return db['UserVoiceQueueRt'][_0xfb58('0x47')]({'where':{'membername':_0x3378e5[_0xfb58('0x21')]},'individualHooks':!![]});}})[_0xfb58('0x16')](function(){if(_0x3378e5){return db['MemberReport'][_0xfb58('0xd')]({'where':{'membername':_0x3378e5['name'],'exitAt':null}});}})[_0xfb58('0x16')](function(_0x867683){if(_0x3378e5){if(_0x867683&&_0x867683[_0xfb58('0x2a')]){var _0xea3988=[];_0x867683[_0xfb58('0x2e')](function(_0x11950f){_0xea3988[_0xfb58('0x48')](_0x11950f[_0xfb58('0x28')]({'exitAt':moment()[_0xfb58('0x25')](_0xfb58('0x2b'))}));});return BPromise[_0xfb58('0x49')](_0xea3988);}}})[_0xfb58('0x16')](function(){if(_0x3378e5){return _0x3378e5[_0xfb58('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xfb58('0x16')](function(_0x18deb1){_0x49d447(_0x18deb1);})[_0xfb58('0x1f')](function(_0x4876e0){_0x16ca2d(_0x11d5cc[_0xfb58('0x1a')](0x1f4,_0x4876e0[_0xfb58('0x1b')]));});});};exports[_0xfb58('0x4a')]=function(_0x3e5d54){var _0x37b3b2=this;return new Promise(function(_0x1a6bad,_0x4c17e4){var _0x130f5d;var _0x2d5697;var _0x14fa3d;var _0x1db360;return db['User'][_0xfb58('0x3a')]({'where':_0x3e5d54[_0xfb58('0xe')][_0xfb58('0x10')]||{},'attributes':['id','name',_0xfb58('0x22'),_0xfb58('0x4b'),_0xfb58('0x4c'),_0xfb58('0x23'),_0xfb58('0x4d'),_0xfb58('0x24')]})['then'](function(_0x5de116){if(_0x5de116){_0x130f5d=_0x5de116;_0x1db360=_0x3e5d54[_0xfb58('0x31')][_0xfb58('0x24')]?_0x3e5d54['body']['interface']:util[_0xfb58('0x25')](_0xfb58('0x4e'),_0x130f5d[_0xfb58('0x21')]);return db[_0xfb58('0x1c')][_0xfb58('0x4f')]({'where':{'role':_0xfb58('0x50'),'online':!![],'id':{'$ne':_0x130f5d['id']}}});}})[_0xfb58('0x16')](function(_0x1f7a1c){if(_0x1f7a1c){_0x14fa3d=_0x1f7a1c;return require(_0xfb58('0x51'))[_0xfb58('0x52')]();}})[_0xfb58('0x16')](function(_0x272649){if(_0x272649&&_0x272649[_0xfb58('0x53')]&&_0x14fa3d>=_0x272649[_0xfb58('0x53')]){throw new Error(_0xfb58('0x54'));}})[_0xfb58('0x16')](function(){if(_0x130f5d){return db[_0xfb58('0x27')]['destroy']({'where':{'membername':_0x130f5d[_0xfb58('0x21')]},'individualHooks':!![]});}})[_0xfb58('0x16')](function(){if(_0x130f5d){return _0x130f5d[_0xfb58('0x55')]({'raw':!![]});}})[_0xfb58('0x16')](function(_0x3be7d3){if(_0x130f5d){if(_0x3be7d3){var _0x4404f9=[];_0x2d5697=_0x3be7d3;if(_0x2d5697['length']){for(var _0x1cc356=0x0;_0x1cc356<_0x2d5697[_0xfb58('0x2a')];_0x1cc356++){_0x4404f9[_0xfb58('0x48')](db[_0xfb58('0x27')][_0xfb58('0x56')]({'membername':_0x130f5d[_0xfb58('0x21')],'UserId':_0x130f5d['id'],'queue_name':_0x2d5697[_0x1cc356][_0xfb58('0x21')],'VoiceQueueId':_0x2d5697[_0x1cc356]['id'],'interface':_0x1db360,'paused':_0x130f5d[_0xfb58('0x4d')]||![],'penalty':_0x2d5697[_0x1cc356][_0xfb58('0x57')]||0x0}));}return BPromise[_0xfb58('0x49')](_0x4404f9);}}}})['then'](function(){if(_0x130f5d){return db['MemberReport']['findAll']({'where':{'membername':_0x130f5d[_0xfb58('0x21')],'exitAt':null}});}})[_0xfb58('0x16')](function(_0x309956){if(_0x130f5d){if(_0x309956&&_0x309956[_0xfb58('0x2a')]){var _0x41bf52=[];_0x309956[_0xfb58('0x2e')](function(_0x189874){_0x41bf52['push'](_0x189874['update']({'exitAt':moment()[_0xfb58('0x25')](_0xfb58('0x2b'))}));});return BPromise[_0xfb58('0x49')](_0x41bf52);}}})[_0xfb58('0x16')](function(){if(_0x130f5d){var _0x3ab62c=[];var _0x2b8094=[];var _0x5232b5=utils[_0xfb58('0x2d')]();var _0x10f37a={'membername':_0x130f5d[_0xfb58('0x21')],'interface':_0x1db360,'enterAt':moment()[_0xfb58('0x25')](_0xfb58('0x2b')),'role':_0x130f5d[_0xfb58('0x22')],'internal':_0x130f5d['internal']};_0x5232b5[_0xfb58('0x2e')](function(_0x528513){_0x3ab62c[_0xfb58('0x48')](_[_0xfb58('0x58')]({'channel':_0x528513,'type':'LOGIN','data1':_0xfb58('0x59'),'data2':_0x1db360},_0x10f37a));if(_0x130f5d[_0xfb58('0x4d')]){_0x2b8094[_0xfb58('0x48')](_[_0xfb58('0x58')]({'channel':_0x528513,'type':_0xfb58('0x30'),'data1':'LOGININPAUSE'},_0x10f37a));}});return db['MemberReport'][_0xfb58('0x5a')](_0x3ab62c[_0xfb58('0x5b')](_0x2b8094),{'individualHooks':!![]});}})[_0xfb58('0x16')](function(){if(_0x130f5d){return _0x130f5d[_0xfb58('0x28')]({'online':!![],'lastLoginAt':moment()[_0xfb58('0x25')](_0xfb58('0x2b')),'voicePause':_0x130f5d[_0xfb58('0x4d')]||![],'mailPause':_0x130f5d[_0xfb58('0x4d')]||![],'chatPause':_0x130f5d[_0xfb58('0x4d')]||![],'faxPause':_0x130f5d[_0xfb58('0x4d')]||![],'smsPause':_0x130f5d[_0xfb58('0x4d')]||![],'openchannelPause':_0x130f5d[_0xfb58('0x4d')]||![],'pauseType':_0x130f5d[_0xfb58('0x4d')]?_0xfb58('0x5c'):null,'lastPauseAt':moment()[_0xfb58('0x25')](_0xfb58('0x2b')),'interface':_0x1db360});}})[_0xfb58('0x16')](function(_0xa8d72f){_0x1a6bad(_0xa8d72f);})['catch'](function(_0x4ebf73){_0x4c17e4(_0x37b3b2[_0xfb58('0x1a')](0x1f4,_0x4ebf73[_0xfb58('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 3bbdeab..aed56da 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 _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 +var _0x1c21=['remove','update','user:','./user.events'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x1c21,0x19f));var _0x11c2=function(_0x501429,_0x20b28e){_0x501429=_0x501429-0x0;var _0x4864e1=_0x1c21[_0x501429];return _0x4864e1;};'use strict';var UserEvents=require(_0x11c2('0x0'));var events=['save',_0x11c2('0x1'),_0x11c2('0x2')];function createListener(_0x52c0e1,_0x3b42ab){return function(_0x7b2024){_0x3b42ab['emit'](_0x52c0e1,_0x7b2024);};}function removeListener(_0x2c95f4,_0x2253b4){return function(){UserEvents['removeListener'](_0x2c95f4,_0x2253b4);};}exports['register']=function(_0x596005){for(var _0xc0894=0x0,_0x1b291f=events['length'];_0xc0894<_0x1b291f;_0xc0894++){var _0x2b8edc=events[_0xc0894];var _0x47f11b=createListener(_0x11c2('0x3')+_0x2b8edc,_0x596005);UserEvents['on'](_0x2b8edc,_0x47f11b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 3b1b888..cee67df 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(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x35870d,_0x24a527){var _0x3b823a=function(_0xf1c0a5){while(--_0xf1c0a5){_0x35870d['push'](_0x35870d['shift']());}};_0x3b823a(++_0x24a527);}(_0xe706,0xa3));var _0x6e70=function(_0x20c893,_0xbef2b4){_0x20c893=_0x20c893-0x0;var _0xc705e8=_0xe706[_0x20c893];return _0xc705e8;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f4cbbac..9006424 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 67e6b65..f01855f 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 _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 +var _0x6f69=['request-promise','path','rimraf','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','bluebird'];(function(_0x32b2bf,_0x64a61e){var _0x42756a=function(_0x18250d){while(--_0x18250d){_0x32b2bf['push'](_0x32b2bf['shift']());}};_0x42756a(++_0x64a61e);}(_0x6f69,0x1d2));var _0x96f6=function(_0x1d83fc,_0x41da74){_0x1d83fc=_0x1d83fc-0x0;var _0x35997b=_0x6f69[_0x1d83fc];return _0x35997b;};'use strict';var _=require(_0x96f6('0x0'));var util=require('util');var logger=require(_0x96f6('0x1'))(_0x96f6('0x2'));var moment=require('moment');var BPromise=require(_0x96f6('0x3'));var rp=require(_0x96f6('0x4'));var fs=require('fs');var path=require(_0x96f6('0x5'));var rimraf=require(_0x96f6('0x6'));var config=require('../../config/environment');var attributes=require(_0x96f6('0x7'));module['exports']=function(_0x51ce2c,_0x56f0e6){return _0x51ce2c['define'](_0x96f6('0x8'),attributes,{'tableName':_0x96f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index df85be1..f5b707f 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 _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 +var _0xd4ea=['http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x35deb9,_0x545380){var _0xe1d491=function(_0x86b245){while(--_0x86b245){_0x35deb9['push'](_0x35deb9['shift']());}};_0xe1d491(++_0x545380);}(_0xd4ea,0x141));var _0xad4e=function(_0xa0b362,_0x29a84a){_0xa0b362=_0xa0b362-0x0;var _0xca8dfb=_0xd4ea[_0xa0b362];return _0xca8dfb;};'use strict';var _=require(_0xad4e('0x0'));var util=require(_0xad4e('0x1'));var moment=require(_0xad4e('0x2'));var BPromise=require(_0xad4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad4e('0x4'));var db=require(_0xad4e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xad4e('0x6'))(_0xad4e('0x7'));var config=require(_0xad4e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xad4e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27bb9d,_0x2a67b3,_0x47b533){return new BPromise(function(_0x136f4e,_0x360ca3){return client[_0xad4e('0xa')](_0x27bb9d,_0x47b533)[_0xad4e('0xb')](function(_0x434bdd){logger[_0xad4e('0xc')](_0xad4e('0xd'),_0x2a67b3,_0xad4e('0xe'));logger[_0xad4e('0xf')](_0xad4e('0x10'),_0x2a67b3,_0xad4e('0xe'),JSON['stringify'](_0x434bdd));if(_0x434bdd[_0xad4e('0x11')]){if(_0x434bdd[_0xad4e('0x11')][_0xad4e('0x12')]===0x1f4){logger[_0xad4e('0x11')](_0xad4e('0xd'),_0x2a67b3,_0x434bdd[_0xad4e('0x11')][_0xad4e('0x13')]);return _0x360ca3(_0x434bdd[_0xad4e('0x11')][_0xad4e('0x13')]);}logger[_0xad4e('0x11')](_0xad4e('0xd'),_0x2a67b3,_0x434bdd[_0xad4e('0x11')]['message']);return _0x136f4e(_0x434bdd['error'][_0xad4e('0x13')]);}else{logger['info'](_0xad4e('0xd'),_0x2a67b3,'request\x20sent');_0x136f4e(_0x434bdd[_0xad4e('0x14')][_0xad4e('0x13')]);}})[_0xad4e('0x15')](function(_0x4a7bb4){logger[_0xad4e('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x2a67b3,_0x4a7bb4);_0x360ca3(_0x4a7bb4);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 054bc9e..2daa2b3 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c3026,_0x1dddbe){var _0x208b7c=function(_0x24133b){while(--_0x24133b){_0x1c3026['push'](_0x1c3026['shift']());}};_0x208b7c(++_0x1dddbe);}(_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 d983514..93e24cc 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 _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 +var _0x772b=['INTEGER','STRING'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x772b,0x18c));var _0xb772=function(_0x18dace,_0x2ff63c){_0x18dace=_0x18dace-0x0;var _0x44e125=_0x772b[_0x18dace];return _0x44e125;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xb772('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb772('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb772('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index c709a46..ad6dcc0 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 _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 +var _0xca85=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define','user_has_fax_queues'];(function(_0x39853d,_0x2501bf){var _0x5864ca=function(_0xbc99d5){while(--_0xbc99d5){_0x39853d['push'](_0x39853d['shift']());}};_0x5864ca(++_0x2501bf);}(_0xca85,0x1e0));var _0x5ca8=function(_0xf9cb79,_0x57cb52){_0xf9cb79=_0xf9cb79-0x0;var _0x4358e5=_0xca85[_0xf9cb79];return _0x4358e5;};'use strict';var _=require(_0x5ca8('0x0'));var util=require(_0x5ca8('0x1'));var logger=require(_0x5ca8('0x2'))(_0x5ca8('0x3'));var moment=require(_0x5ca8('0x4'));var BPromise=require(_0x5ca8('0x5'));var rp=require(_0x5ca8('0x6'));var fs=require('fs');var path=require(_0x5ca8('0x7'));var rimraf=require(_0x5ca8('0x8'));var config=require('../../config/environment');var attributes=require(_0x5ca8('0x9'));module['exports']=function(_0x533afa,_0x26a690){return _0x533afa[_0x5ca8('0xa')]('UserFaxQueue',attributes,{'tableName':_0x5ca8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index f48bdb0..32fffbf 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 _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 +var _0xdb3e=['rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb3e,0x144));var _0xedb3=function(_0x55e45e,_0x51c886){_0x55e45e=_0x55e45e-0x0;var _0x3e7583=_0xdb3e[_0x55e45e];return _0x3e7583;};'use strict';var _=require(_0xedb3('0x0'));var util=require(_0xedb3('0x1'));var moment=require('moment');var BPromise=require(_0xedb3('0x2'));var rs=require(_0xedb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedb3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xedb3('0x5'))(_0xedb3('0x6'));var config=require('../../config/environment');var jayson=require(_0xedb3('0x7'));var client=jayson[_0xedb3('0x8')][_0xedb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x533021,_0x338aa3,_0x1b89e9){return new BPromise(function(_0x4cfc0d,_0x1fccc7){return client[_0xedb3('0xa')](_0x533021,_0x1b89e9)[_0xedb3('0xb')](function(_0x1aa581){logger[_0xedb3('0xc')](_0xedb3('0xd'),_0x338aa3,_0xedb3('0xe'));logger[_0xedb3('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x338aa3,'request\x20sent',JSON[_0xedb3('0x10')](_0x1aa581));if(_0x1aa581[_0xedb3('0x11')]){if(_0x1aa581[_0xedb3('0x11')][_0xedb3('0x12')]===0x1f4){logger[_0xedb3('0x11')](_0xedb3('0xd'),_0x338aa3,_0x1aa581[_0xedb3('0x11')]['message']);return _0x1fccc7(_0x1aa581[_0xedb3('0x11')][_0xedb3('0x13')]);}logger[_0xedb3('0x11')](_0xedb3('0xd'),_0x338aa3,_0x1aa581['error'][_0xedb3('0x13')]);return _0x4cfc0d(_0x1aa581['error'][_0xedb3('0x13')]);}else{logger[_0xedb3('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x338aa3,_0xedb3('0xe'));_0x4cfc0d(_0x1aa581[_0xedb3('0x14')][_0xedb3('0x13')]);}})[_0xedb3('0x15')](function(_0x12a5b3){logger[_0xedb3('0x11')](_0xedb3('0xd'),_0x338aa3,_0x12a5b3);_0x1fccc7(_0x12a5b3);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index b020ad6..194cd31 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 _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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x49088a,_0xa2b35c){var _0x3a522d=function(_0x19cf27){while(--_0x19cf27){_0x49088a['push'](_0x49088a['shift']());}};_0x3a522d(++_0xa2b35c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 3c09254..ef6eaa9 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 _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 +var _0x1e7c=['exports','sequelize'];(function(_0x3c23bc,_0x579ae1){var _0x52516c=function(_0x236c8f){while(--_0x236c8f){_0x3c23bc['push'](_0x3c23bc['shift']());}};_0x52516c(++_0x579ae1);}(_0x1e7c,0x1e3));var _0xc1e7=function(_0x45cc0d,_0x3b1080){_0x45cc0d=_0x45cc0d-0x0;var _0x53dc42=_0x1e7c[_0x45cc0d];return _0x53dc42;};'use strict';var Sequelize=require(_0xc1e7('0x0'));module[_0xc1e7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 7c7e85d..9df8a24 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 _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 +var _0x1b54=['rimraf','../../config/environment','define','user_has_mail_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x22efd1,_0x1f404d){var _0xf11137=function(_0x18c537){while(--_0x18c537){_0x22efd1['push'](_0x22efd1['shift']());}};_0xf11137(++_0x1f404d);}(_0x1b54,0x9a));var _0x41b5=function(_0x9303e,_0xeec64c){_0x9303e=_0x9303e-0x0;var _0x192126=_0x1b54[_0x9303e];return _0x192126;};'use strict';var _=require(_0x41b5('0x0'));var util=require(_0x41b5('0x1'));var logger=require(_0x41b5('0x2'))(_0x41b5('0x3'));var moment=require(_0x41b5('0x4'));var BPromise=require('bluebird');var rp=require(_0x41b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41b5('0x6'));var config=require(_0x41b5('0x7'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x8393b5,_0x1a5002){return _0x8393b5[_0x41b5('0x8')]('UserMailQueue',attributes,{'tableName':_0x41b5('0x9'),'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 fd2b88b..64042f9 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 _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 +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1cb9,0x14e));var _0x91cb=function(_0x20d2d7,_0x37c39e){_0x20d2d7=_0x20d2d7-0x0;var _0x6848d2=_0x1cb9[_0x20d2d7];return _0x6848d2;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 6463725..57b1db1 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 _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 +var _0xc71b=['fs-extra','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0xc71b,0x1a9));var _0xbc71=function(_0x5dd070,_0x598b5e){_0x5dd070=_0x5dd070-0x0;var _0x117034=_0xc71b[_0x5dd070];return _0x117034;};'use strict';var multer=require(_0xbc71('0x0'));var util=require(_0xbc71('0x1'));var path=require(_0xbc71('0x2'));var timeout=require(_0xbc71('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbc71('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbc71('0x5'));var config=require(_0xbc71('0x6'));var controller=require('./userNotification.controller');router[_0xbc71('0x7')]('/',auth[_0xbc71('0x8')](),controller[_0xbc71('0x9')]);module[_0xbc71('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0f7ac25..34a37b8 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 _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 +var _0x573c=['exports','STRING','TEXT','BOOLEAN','sequelize'];(function(_0x515680,_0x5c3b90){var _0x2eb2b2=function(_0x565074){while(--_0x565074){_0x515680['push'](_0x515680['shift']());}};_0x2eb2b2(++_0x5c3b90);}(_0x573c,0x167));var _0xc573=function(_0x1c24ec,_0xbc9720){_0x1c24ec=_0x1c24ec-0x0;var _0x46d3f0=_0x573c[_0x1c24ec];return _0x46d3f0;};'use strict';var Sequelize=require(_0xc573('0x0'));module[_0xc573('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xc573('0x2')]},'recipientsId':{'type':Sequelize[_0xc573('0x3')]},'recipientsDescription':{'type':Sequelize[_0xc573('0x2')]},'beep':{'type':Sequelize[_0xc573('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 721b298..3d89fff 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 _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 +var _0x1b49=['undefined','limit','count','save','update','then','destroy','error','stack','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','SenderId','recipientsId','sequelize','transaction','UserNotification','create','beep','forEach','recipient','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','union','ids','queue','replace','Queue','push','all','flatten','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./userNotification.socket','register','sendStatus','end','status','json','offset'];(function(_0x414d3d,_0x51656b){var _0x11740b=function(_0x191a2f){while(--_0x191a2f){_0x414d3d['push'](_0x414d3d['shift']());}};_0x11740b(++_0x51656b);}(_0x1b49,0x14f));var _0x91b4=function(_0x3407be,_0x3ad78b){_0x3407be=_0x3407be-0x0;var _0x1743e2=_0x1b49[_0x3407be];return _0x1743e2;};'use strict';var emlformat=require(_0x91b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91b4('0x1'));var jsonpatch=require(_0x91b4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x91b4('0x3'));var util=require(_0x91b4('0x4'));var path=require(_0x91b4('0x5'));var sox=require(_0x91b4('0x6'));var csv=require('to-csv');var ejs=require(_0x91b4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91b4('0x8'));var squel=require(_0x91b4('0x9'));var crypto=require(_0x91b4('0xa'));var jsforce=require(_0x91b4('0xb'));var deskjs=require(_0x91b4('0xc'));var toCsv=require(_0x91b4('0xd'));var querystring=require(_0x91b4('0xe'));var Papa=require(_0x91b4('0xf'));var Redis=require('ioredis');var authService=require(_0x91b4('0x10'));var qs=require(_0x91b4('0x11'));var as=require(_0x91b4('0x12'));var hardwareService=require(_0x91b4('0x13'));var logger=require('../../config/logger')(_0x91b4('0x14'));var utils=require(_0x91b4('0x15'));var config=require(_0x91b4('0x16'));var licenseUtil=require(_0x91b4('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x91b4('0x18')],{'host':_0x91b4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91b4('0x18')]));require(_0x91b4('0x1a'))[_0x91b4('0x1b')](socket);function respondWithStatusCode(_0x34b725,_0x5d5c04){_0x5d5c04=_0x5d5c04||0xcc;return function(_0x404705){if(_0x404705){return _0x34b725[_0x91b4('0x1c')](_0x5d5c04);}return _0x34b725['status'](_0x5d5c04)[_0x91b4('0x1d')]();};}function respondWithResult(_0x406a75,_0x297571){_0x297571=_0x297571||0xc8;return function(_0x235d23){if(_0x235d23){return _0x406a75[_0x91b4('0x1e')](_0x297571)[_0x91b4('0x1f')](_0x235d23);}};}function respondWithFilteredResult(_0x166ec5,_0x508a7a){return function(_0x41449b){if(_0x41449b){var _0xfa4c2e=typeof _0x508a7a[_0x91b4('0x20')]===_0x91b4('0x21')&&typeof _0x508a7a[_0x91b4('0x22')]===_0x91b4('0x21');var _0x5584ed=_0x41449b[_0x91b4('0x23')];var _0x599d4c=_0xfa4c2e?0x0:_0x508a7a[_0x91b4('0x20')];var _0x1bdd31=_0xfa4c2e?_0x41449b[_0x91b4('0x23')]:_0x508a7a['offset']+_0x508a7a['limit'];var _0x31e0bd;if(_0x1bdd31>=_0x5584ed){_0x1bdd31=_0x5584ed;_0x31e0bd=0xc8;}else{_0x31e0bd=0xce;}_0x166ec5[_0x91b4('0x1e')](_0x31e0bd);return _0x166ec5['set']('Content-Range',_0x599d4c+'-'+_0x1bdd31+'/'+_0x5584ed)[_0x91b4('0x1f')](_0x41449b);}return null;};}function patchUpdates(_0x36dfc4){return function(_0xd8f39e){try{jsonpatch['apply'](_0xd8f39e,_0x36dfc4,!![]);}catch(_0x53a7c4){return BPromise['reject'](_0x53a7c4);}return _0xd8f39e[_0x91b4('0x24')]();};}function saveUpdates(_0x2c3831,_0x240b8a){return function(_0x2b2392){if(_0x2b2392){return _0x2b2392[_0x91b4('0x25')](_0x2c3831)[_0x91b4('0x26')](function(_0xf7354e){return _0xf7354e;});}return null;};}function removeEntity(_0x3859a2,_0x2d49b0){return function(_0xc63af0){if(_0xc63af0){return _0xc63af0[_0x91b4('0x27')]()[_0x91b4('0x26')](function(){_0x3859a2['status'](0xcc)[_0x91b4('0x1d')]();});}};}function handleEntityNotFound(_0xf74f01,_0x2b5fb8){return function(_0x5ee919){if(!_0x5ee919){_0xf74f01[_0x91b4('0x1c')](0x194);}return _0x5ee919;};}function handleError(_0x5cf9f5,_0x4bb72d){_0x4bb72d=_0x4bb72d||0x1f4;return function(_0x2309dc){logger[_0x91b4('0x28')](_0x2309dc[_0x91b4('0x29')]);if(_0x2309dc['name']){delete _0x2309dc['name'];}_0x5cf9f5[_0x91b4('0x1e')](_0x4bb72d)[_0x91b4('0x2a')](_0x2309dc);};}exports[_0x91b4('0x2b')]=function(_0x132a68,_0x1d10b2,_0x37f2b){if(!_0x132a68[_0x91b4('0x2c')][_0x91b4('0x2d')](_0x91b4('0x2e'))&&!_0x132a68[_0x91b4('0x2c')][_0x91b4('0x2d')](_0x91b4('0x2f'))){throw new db['Sequelize'][(_0x91b4('0x30'))](_0x91b4('0x31'));}else{if(_0x132a68[_0x91b4('0x2c')]['hasOwnProperty']('TemplateId')&&!_0x132a68[_0x91b4('0x2c')][_0x91b4('0x2d')](_0x91b4('0x32'))){throw new db[(_0x91b4('0x33'))][(_0x91b4('0x30'))](_0x91b4('0x34'));}if(!_0x132a68[_0x91b4('0x2c')]['hasOwnProperty'](_0x91b4('0x35'))){throw new db[(_0x91b4('0x33'))][(_0x91b4('0x30'))](_0x91b4('0x36'));}else{try{var _0x1dd081=JSON[_0x91b4('0x37')](_0x132a68[_0x91b4('0x2c')][_0x91b4('0x35')]);}catch(_0x363ca2){logger[_0x91b4('0x28')](_0x363ca2);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x233fea=[_0x91b4('0x38'),'faxqueue','mailqueue','openchannelqueue','smsqueue',_0x91b4('0x39'),'whatsappqueue',_0x91b4('0x3a'),_0x91b4('0x3b')];if(_[_0x91b4('0x3c')](_0x1dd081,function(_0x13c2b8){return!_[_0x91b4('0x3d')](_0x233fea,_0x13c2b8[_0x91b4('0x3e')][_0x91b4('0x3f')]());})){throw new db[(_0x91b4('0x33'))][(_0x91b4('0x30'))](_0x91b4('0x40'));}}}var _0x279746={};_0x279746[_0x91b4('0x41')]=_0x132a68[_0x91b4('0x2c')][_0x91b4('0x2d')](_0x91b4('0x41'))?_0x132a68[_0x91b4('0x2c')][_0x91b4('0x41')]:_0x132a68[_0x91b4('0x3b')]['fullname'];_0x279746[_0x91b4('0x42')]=_['isEmpty'](_0x132a68[_0x91b4('0x2c')][_0x91b4('0x42')])?null:_0x132a68[_0x91b4('0x2c')][_0x91b4('0x42')];_0x279746['beep']=_0x132a68[_0x91b4('0x2c')]['beep']||![];_0x279746[_0x91b4('0x43')]=_0x132a68[_0x91b4('0x3b')]['id'];return getContent(_0x132a68[_0x91b4('0x2c')])['then'](function(_0x13d979){_0x279746[_0x91b4('0x2c')]=_0x13d979;return getRecipients(_0x1dd081);})[_0x91b4('0x26')](function(_0x16e222){_0x279746[_0x91b4('0x44')]=_['sortBy'](_0x16e222)['join'](',');return db[_0x91b4('0x45')][_0x91b4('0x46')](function(_0x5423b6){return db[_0x91b4('0x47')][_0x91b4('0x48')](_0x279746,{'raw':!![],'transaction':_0x5423b6})[_0x91b4('0x26')](function(_0x467fd1){var _0x1e7b84={'sender':_0x279746[_0x91b4('0x41')],'description':_0x279746[_0x91b4('0x42')],'content':_0x279746[_0x91b4('0x2c')],'beep':_0x279746[_0x91b4('0x49')]};_0x16e222[_0x91b4('0x4a')](function(_0xff0a80){_0x1e7b84[_0x91b4('0x4b')]=_0xff0a80;socket['emit'](_0x91b4('0x4c'),_0x1e7b84);});return _0x467fd1;});});})[_0x91b4('0x26')](respondWithResult(_0x1d10b2,0xc9))[_0x91b4('0x4d')](handleError(_0x1d10b2,null));};function getContent(_0x361a6f){return new BPromise(function(_0x522cdd,_0x143d92){if(_0x361a6f[_0x91b4('0x2e')]){_0x522cdd(_0x361a6f[_0x91b4('0x2e')]);return;}return db[_0x91b4('0x4e')][_0x91b4('0x4f')]({'attributes':['html'],'where':{'id':_0x361a6f[_0x91b4('0x2f')]},'raw':!![]})[_0x91b4('0x26')](function(_0x2dcfd1){if(!_0x2dcfd1)throw new db['Sequelize'][(_0x91b4('0x30'))](_0x91b4('0x50'));var _0x2fda47=Mustache[_0x91b4('0x51')](_0x2dcfd1[_0x91b4('0x52')],_0x361a6f['view']);_0x522cdd(_0x2fda47);})[_0x91b4('0x4d')](function(_0x1b080f){_0x143d92(_0x1b080f);});});}function getRecipients(_0x5a1fe0){return new BPromise(function(_0x172bff,_0x51f98e){var _0x588bab=[];var _0x23e5ed=[];_0x5a1fe0['forEach'](function(_0x5b51e9){var _0x342886=_[_0x91b4('0x53')](_0x5b51e9[_0x91b4('0x3e')][_0x91b4('0x3f')]());if(_0x342886==='User'){_0x588bab=_[_0x91b4('0x54')](_0x588bab,_0x5b51e9[_0x91b4('0x55')]);}else{if(_[_0x91b4('0x3d')](_0x342886,_0x91b4('0x56')))_0x342886=_0x342886[_0x91b4('0x57')]('queue',_0x91b4('0x58'));_0x5b51e9[_0x91b4('0x55')][_0x91b4('0x4a')](function(_0x2cd397){_0x23e5ed[_0x91b4('0x59')](getAgents(_0x342886,_0x2cd397));});}});return BPromise[_0x91b4('0x5a')](_0x23e5ed)[_0x91b4('0x26')](function(_0xe64c3){_0x588bab=_[_0x91b4('0x54')](_0x588bab,_[_0x91b4('0x5b')](_0xe64c3));_0x172bff(_0x588bab);})[_0x91b4('0x4d')](function(_0x1c3d72){_0x51f98e(_0x1c3d72);});});}function getAgents(_0x12eaf8,_0x3e0b33){return new BPromise(function(_0x1944cb,_0x29bf8e){return db[_0x12eaf8][_0x91b4('0x4f')]({'where':{'id':_0x3e0b33}})[_0x91b4('0x26')](function(_0x32043e){return _0x32043e['getAgents']({'attributes':['id'],'raw':!![]})[_0x91b4('0x26')](function(_0x14b820){var _0x4ca062=_['map'](_0x14b820,'id');_0x1944cb(_0x4ca062);});})[_0x91b4('0x4d')](function(_0x1890b7){_0x29bf8e(_0x1890b7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 2e2c53c..1adf973 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 _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 +var _0x8f83=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x8f83,0x9e));var _0x38f8=function(_0x411b61,_0x23122b){_0x411b61=_0x411b61-0x0;var _0x82e8a1=_0x8f83[_0x411b61];return _0x82e8a1;};'use strict';var EventEmitter=require(_0x38f8('0x0'));var UserNotification=require(_0x38f8('0x1'))['db'][_0x38f8('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x38f8('0x3')](0x0);var events={'afterCreate':_0x38f8('0x4'),'afterUpdate':_0x38f8('0x5'),'afterDestroy':_0x38f8('0x6')};function emitEvent(_0x4e2527){return function(_0x2dd641,_0x29acbd,_0x2d0d4e){UserNotificationEvents[_0x38f8('0x7')](_0x4e2527+':'+_0x2dd641['id'],_0x2dd641);UserNotificationEvents['emit'](_0x4e2527,_0x2dd641);_0x2d0d4e(null);};}for(var e in events){if(events[_0x38f8('0x8')](e)){var event=events[e];UserNotification[_0x38f8('0x9')](e,emitEvent(event));}}module[_0x38f8('0xa')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 17e24ca..819852c 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 _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 +var _0x7b9b=['rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','path'];(function(_0x42020e,_0x4b92fb){var _0x561551=function(_0xf8216){while(--_0xf8216){_0x42020e['push'](_0x42020e['shift']());}};_0x561551(++_0x4b92fb);}(_0x7b9b,0x97));var _0xb7b9=function(_0x516118,_0x26acb7){_0x516118=_0x516118-0x0;var _0x4922a8=_0x7b9b[_0x516118];return _0x4922a8;};'use strict';var _=require('lodash');var util=require(_0xb7b9('0x0'));var logger=require('../../config/logger')(_0xb7b9('0x1'));var moment=require(_0xb7b9('0x2'));var BPromise=require('bluebird');var rp=require(_0xb7b9('0x3'));var fs=require('fs');var path=require(_0xb7b9('0x4'));var rimraf=require(_0xb7b9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb7b9('0x6'));module[_0xb7b9('0x7')]=function(_0x155268,_0x15fa43){return _0x155268[_0xb7b9('0x8')](_0xb7b9('0x9'),attributes,{'tableName':_0xb7b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb7b9('0xb'),'collate':_0xb7b9('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 760026b..8007aaa 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 _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 +var _0x761e=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x3802d7,_0x15e553){var _0x25bda5=function(_0x5ed02c){while(--_0x5ed02c){_0x3802d7['push'](_0x3802d7['shift']());}};_0x25bda5(++_0x15e553);}(_0x761e,0xb7));var _0xe761=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0x761e[_0x57b236];return _0x4feb29;};'use strict';var _=require(_0xe761('0x0'));var util=require(_0xe761('0x1'));var moment=require('moment');var BPromise=require(_0xe761('0x2'));var rs=require(_0xe761('0x3'));var fs=require('fs');var Redis=require(_0xe761('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe761('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe761('0x6'));var jayson=require(_0xe761('0x7'));var client=jayson[_0xe761('0x8')][_0xe761('0x9')]({'port':0x232a});config[_0xe761('0xa')]=_[_0xe761('0xb')](config['redis'],{'host':_0xe761('0xc'),'port':0x18eb});var socket=require(_0xe761('0xd'))(new Redis(config[_0xe761('0xa')]));require(_0xe761('0xe'))[_0xe761('0xf')](socket);function respondWithRpcPromise(_0x33eda1,_0xc3323b,_0x4dfb99){return new BPromise(function(_0x30e479,_0x749cfa){return client[_0xe761('0x10')](_0x33eda1,_0x4dfb99)[_0xe761('0x11')](function(_0xf286cb){logger[_0xe761('0x12')](_0xe761('0x13'),_0xc3323b,_0xe761('0x14'));logger[_0xe761('0x15')]('UserNotification,\x20%s,\x20%s,\x20%s',_0xc3323b,'request\x20sent',JSON['stringify'](_0xf286cb));if(_0xf286cb[_0xe761('0x16')]){if(_0xf286cb[_0xe761('0x16')][_0xe761('0x17')]===0x1f4){logger[_0xe761('0x16')](_0xe761('0x13'),_0xc3323b,_0xf286cb[_0xe761('0x16')][_0xe761('0x18')]);return _0x749cfa(_0xf286cb[_0xe761('0x16')][_0xe761('0x18')]);}logger['error'](_0xe761('0x13'),_0xc3323b,_0xf286cb[_0xe761('0x16')][_0xe761('0x18')]);return _0x30e479(_0xf286cb['error']['message']);}else{logger['info'](_0xe761('0x13'),_0xc3323b,'request\x20sent');_0x30e479(_0xf286cb['result'][_0xe761('0x18')]);}})[_0xe761('0x19')](function(_0x17b0ed){logger[_0xe761('0x16')](_0xe761('0x13'),_0xc3323b,_0x17b0ed);_0x749cfa(_0x17b0ed);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 08acdbb..96cf2cb 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 _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 +var _0xd8f8=['./userNotification.events','update','emit','removeListener','register','length'];(function(_0x503ea8,_0x22e391){var _0x427e5d=function(_0x1484e8){while(--_0x1484e8){_0x503ea8['push'](_0x503ea8['shift']());}};_0x427e5d(++_0x22e391);}(_0xd8f8,0x1f2));var _0x8d8f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xd8f8[_0x1589dd];return _0x1bddd1;};'use strict';var UserNotificationEvents=require(_0x8d8f('0x0'));var events=['save','remove',_0x8d8f('0x1')];function createListener(_0xcebb65,_0x5d39f3){return function(_0xa58b27){_0x5d39f3[_0x8d8f('0x2')](_0xcebb65,_0xa58b27);};}function removeListener(_0x244a12,_0x4994ac){return function(){UserNotificationEvents[_0x8d8f('0x3')](_0x244a12,_0x4994ac);};}exports[_0x8d8f('0x4')]=function(_0x1e1a18){for(var _0x3857fe=0x0,_0x200c07=events[_0x8d8f('0x5')];_0x3857fe<_0x200c07;_0x3857fe++){var _0x15d8eb=events[_0x3857fe];var _0x21d1fb=createListener('userNotification:'+_0x15d8eb,_0x1e1a18);UserNotificationEvents['on'](_0x15d8eb,_0x21d1fb);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 1babff1..b60ba81 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(_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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x494abf,_0xc69b50){var _0x165352=function(_0x994bc3){while(--_0x994bc3){_0x494abf['push'](_0x494abf['shift']());}};_0x165352(++_0xc69b50);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0xcb91[_0x10c51f];return _0x56a0cd;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index b45cd80..04bacc4 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 _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 +var _0xa115=['sequelize','exports','INTEGER'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xa115,0x81));var _0x5a11=function(_0x1507fd,_0x895743){_0x1507fd=_0x1507fd-0x0;var _0x155d34=_0xa115[_0x1507fd];return _0x155d34;};'use strict';var Sequelize=require(_0x5a11('0x0'));module[_0x5a11('0x1')]={'penalty':{'type':Sequelize[_0x5a11('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 4c85730..79e60ac 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 _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 +var _0xc5c7=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','api','moment','bluebird','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc5c7,0x124));var _0x7c5c=function(_0x1158af,_0x1d7917){_0x1158af=_0x1158af-0x0;var _0x322890=_0xc5c7[_0x1158af];return _0x322890;};'use strict';var _=require('lodash');var util=require(_0x7c5c('0x0'));var logger=require('../../config/logger')(_0x7c5c('0x1'));var moment=require(_0x7c5c('0x2'));var BPromise=require(_0x7c5c('0x3'));var rp=require(_0x7c5c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c5c('0x5'));var config=require(_0x7c5c('0x6'));var attributes=require(_0x7c5c('0x7'));module[_0x7c5c('0x8')]=function(_0x4a441f,_0x154fbb){return _0x4a441f['define'](_0x7c5c('0x9'),attributes,{'tableName':_0x7c5c('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 c79479d..92cb73e 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 _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 +var _0x9768=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','code','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x8bb11a,_0x516e83){var _0x4d8c2b=function(_0x44c895){while(--_0x44c895){_0x8bb11a['push'](_0x8bb11a['shift']());}};_0x4d8c2b(++_0x516e83);}(_0x9768,0x96));var _0x8976=function(_0x5ca353,_0x21eb37){_0x5ca353=_0x5ca353-0x0;var _0x4f2fe5=_0x9768[_0x5ca353];return _0x4f2fe5;};'use strict';var _=require(_0x8976('0x0'));var util=require('util');var moment=require(_0x8976('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8976('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8976('0x3'))('rpc');var config=require(_0x8976('0x4'));var jayson=require(_0x8976('0x5'));var client=jayson[_0x8976('0x6')][_0x8976('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ec2cd,_0x7bb1b2,_0x43d443){return new BPromise(function(_0x114ada,_0x27a7b3){return client[_0x8976('0x8')](_0x1ec2cd,_0x43d443)['then'](function(_0x123caa){logger[_0x8976('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x7bb1b2,_0x8976('0xa'));logger[_0x8976('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x7bb1b2,_0x8976('0xa'),JSON[_0x8976('0xc')](_0x123caa));if(_0x123caa['error']){if(_0x123caa['error'][_0x8976('0xd')]===0x1f4){logger[_0x8976('0xe')](_0x8976('0xf'),_0x7bb1b2,_0x123caa[_0x8976('0xe')][_0x8976('0x10')]);return _0x27a7b3(_0x123caa['error']['message']);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x7bb1b2,_0x123caa[_0x8976('0xe')][_0x8976('0x10')]);return _0x114ada(_0x123caa[_0x8976('0xe')][_0x8976('0x10')]);}else{logger[_0x8976('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x7bb1b2,_0x8976('0xa'));_0x114ada(_0x123caa[_0x8976('0x11')][_0x8976('0x10')]);}})[_0x8976('0x12')](function(_0x43f491){logger[_0x8976('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x7bb1b2,_0x43f491);_0x27a7b3(_0x43f491);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 42d8327..850e9d9 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 _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 +var _0x93f5=['addSections','addResources','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','create','post','clone'];(function(_0x3efde9,_0x3fc803){var _0x12697d=function(_0x1416b4){while(--_0x1416b4){_0x3efde9['push'](_0x3efde9['shift']());}};_0x12697d(++_0x3fc803);}(_0x93f5,0x10c));var _0x593f=function(_0x4561f2,_0x553c86){_0x4561f2=_0x4561f2-0x0;var _0x76e69d=_0x93f5[_0x4561f2];return _0x76e69d;};'use strict';var multer=require(_0x593f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x593f('0x1'));var express=require(_0x593f('0x2'));var router=express[_0x593f('0x3')]();var fs_extra=require(_0x593f('0x4'));var auth=require(_0x593f('0x5'));var interaction=require(_0x593f('0x6'));var config=require(_0x593f('0x7'));var controller=require(_0x593f('0x8'));router[_0x593f('0x9')]('/',auth[_0x593f('0xa')](),controller[_0x593f('0xb')]);router[_0x593f('0x9')](_0x593f('0xc'),auth[_0x593f('0xa')](),controller['describe']);router[_0x593f('0x9')](_0x593f('0xd'),auth[_0x593f('0xa')](),controller[_0x593f('0xe')]);router['get'](_0x593f('0xf'),auth['isAuthenticated'](),controller[_0x593f('0x10')]);router['get'](_0x593f('0x11'),auth[_0x593f('0xa')](),controller[_0x593f('0x12')]);router['post']('/',auth[_0x593f('0xa')](),controller[_0x593f('0x13')]);router[_0x593f('0x14')]('/:id/clone',auth[_0x593f('0xa')](),controller[_0x593f('0x15')]);router['post'](_0x593f('0xf'),auth[_0x593f('0xa')](),controller[_0x593f('0x16')]);router[_0x593f('0x14')](_0x593f('0x11'),auth[_0x593f('0xa')](),controller[_0x593f('0x17')]);router[_0x593f('0x18')](_0x593f('0xd'),auth[_0x593f('0xa')](),controller[_0x593f('0x19')]);router[_0x593f('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x593f('0x1b')]);router[_0x593f('0x1a')](_0x593f('0xf'),auth[_0x593f('0xa')](),controller['removeSections']);router[_0x593f('0x1a')](_0x593f('0x11'),auth['isAuthenticated'](),controller['removeResources']);module[_0x593f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index abfc5bf..fe1767c 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 _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 +var _0xcea8=['getDataValue','split','BOOLEAN','sequelize','exports','name','STRING','setDataValue','crudPermissions'];(function(_0x594d94,_0x5f2cf3){var _0x929428=function(_0x4b8a0b){while(--_0x4b8a0b){_0x594d94['push'](_0x594d94['shift']());}};_0x929428(++_0x5f2cf3);}(_0xcea8,0xff));var _0x8cea=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0xcea8[_0x15f3c0];return _0x1adfe0;};'use strict';var Sequelize=require(_0x8cea('0x0'));module[_0x8cea('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8cea('0x2')},'crudPermissions':{'type':Sequelize[_0x8cea('0x3')],'set':function(_0x11a810){this[_0x8cea('0x4')](_0x8cea('0x5'),_0x11a810?_0x11a810['join'](''):[]);},'get':function(){return this[_0x8cea('0x6')]('crudPermissions')?this[_0x8cea('0x6')](_0x8cea('0x5'))[_0x8cea('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8cea('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index ff63e91..c513971 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 _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 +var _0x5629=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./userProfile.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','map','UserProfile','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','omit','createdAt','updatedAt','sequelize','transaction','get','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','userProfileId','Resources','find','describe','addSections','destroy','sectionId','push','removeSections','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','section','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x24154b,_0x227ae2){var _0x119c38=function(_0x5eec1a){while(--_0x5eec1a){_0x24154b['push'](_0x24154b['shift']());}};_0x119c38(++_0x227ae2);}(_0x5629,0x1c6));var _0x9562=function(_0x158961,_0xb8764c){_0x158961=_0x158961-0x0;var _0x4b495e=_0x5629[_0x158961];return _0x4b495e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9562('0x0'));var zipdir=require(_0x9562('0x1'));var jsonpatch=require(_0x9562('0x2'));var rp=require(_0x9562('0x3'));var moment=require('moment');var BPromise=require(_0x9562('0x4'));var Mustache=require(_0x9562('0x5'));var util=require('util');var path=require(_0x9562('0x6'));var sox=require(_0x9562('0x7'));var csv=require(_0x9562('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9562('0x9'));var _=require(_0x9562('0xa'));var squel=require(_0x9562('0xb'));var crypto=require(_0x9562('0xc'));var jsforce=require(_0x9562('0xd'));var deskjs=require(_0x9562('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9562('0xf'));var Papa=require(_0x9562('0x10'));var Redis=require(_0x9562('0x11'));var authService=require(_0x9562('0x12'));var qs=require(_0x9562('0x13'));var as=require(_0x9562('0x14'));var hardwareService=require(_0x9562('0x15'));var logger=require(_0x9562('0x16'))(_0x9562('0x17'));var utils=require(_0x9562('0x18'));var config=require(_0x9562('0x19'));var licenseUtil=require(_0x9562('0x1a'));var db=require(_0x9562('0x1b'))['db'];config[_0x9562('0x1c')]=_['defaults'](config[_0x9562('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9562('0x1c')]));require(_0x9562('0x1d'))[_0x9562('0x1e')](socket);function respondWithStatusCode(_0x323c1b,_0x4cdacb){_0x4cdacb=_0x4cdacb||0xcc;return function(_0x816a4d){if(_0x816a4d){return _0x323c1b['sendStatus'](_0x4cdacb);}return _0x323c1b[_0x9562('0x1f')](_0x4cdacb)['end']();};}function respondWithResult(_0xc65c51,_0x52e4c2){_0x52e4c2=_0x52e4c2||0xc8;return function(_0xc67e01){if(_0xc67e01){return _0xc65c51[_0x9562('0x1f')](_0x52e4c2)[_0x9562('0x20')](_0xc67e01);}};}function respondWithFilteredResult(_0x171d90,_0x37f8ad){return function(_0x5f1003){if(_0x5f1003){var _0x5a4c38=typeof _0x37f8ad[_0x9562('0x21')]===_0x9562('0x22')&&typeof _0x37f8ad[_0x9562('0x23')]==='undefined';var _0x49a683=_0x5f1003[_0x9562('0x24')];var _0x347f97=_0x5a4c38?0x0:_0x37f8ad[_0x9562('0x21')];var _0x25c667=_0x5a4c38?_0x5f1003['count']:_0x37f8ad[_0x9562('0x21')]+_0x37f8ad['limit'];var _0x320d27;if(_0x25c667>=_0x49a683){_0x25c667=_0x49a683;_0x320d27=0xc8;}else{_0x320d27=0xce;}_0x171d90[_0x9562('0x1f')](_0x320d27);return _0x171d90[_0x9562('0x25')](_0x9562('0x26'),_0x347f97+'-'+_0x25c667+'/'+_0x49a683)['json'](_0x5f1003);}return null;};}function patchUpdates(_0x2690df){return function(_0x30abd6){try{jsonpatch[_0x9562('0x27')](_0x30abd6,_0x2690df,!![]);}catch(_0x4298c4){return BPromise[_0x9562('0x28')](_0x4298c4);}return _0x30abd6[_0x9562('0x29')]();};}function saveUpdates(_0x200d35,_0x43fe21){return function(_0x126684){if(_0x126684){return _0x126684[_0x9562('0x2a')](_0x200d35)[_0x9562('0x2b')](function(_0x52f717){return _0x52f717;});}return null;};}function removeEntity(_0x4bdfcb,_0x402ca5){return function(_0xe883e9){if(_0xe883e9){return _0xe883e9['destroy']()[_0x9562('0x2b')](function(){_0x4bdfcb[_0x9562('0x1f')](0xcc)[_0x9562('0x2c')]();});}};}function handleEntityNotFound(_0x5c588b,_0x5c612c){return function(_0x13099e){if(!_0x13099e){_0x5c588b[_0x9562('0x2d')](0x194);}return _0x13099e;};}function handleError(_0x5d7fc8,_0x3d5aa7){_0x3d5aa7=_0x3d5aa7||0x1f4;return function(_0x22477c){logger[_0x9562('0x2e')](_0x22477c[_0x9562('0x2f')]);if(_0x22477c[_0x9562('0x30')]){delete _0x22477c[_0x9562('0x30')];}_0x5d7fc8[_0x9562('0x1f')](_0x3d5aa7)[_0x9562('0x31')](_0x22477c);};}exports['index']=function(_0xc95c45,_0x35a9f9){var _0xf6c149={},_0x19e25a={},_0x2c9759={'count':0x0,'rows':[]};var _0x59a36f=_[_0x9562('0x32')](db[_0x9562('0x33')][_0x9562('0x34')],function(_0x1f8bdd){return{'name':_0x1f8bdd['fieldName'],'type':_0x1f8bdd['type'][_0x9562('0x35')]};});_0x19e25a[_0x9562('0x36')]=_[_0x9562('0x32')](_0x59a36f,_0x9562('0x30'));_0x19e25a[_0x9562('0x37')]=_[_0x9562('0x38')](_0xc95c45['query']);_0x19e25a[_0x9562('0x39')]=_[_0x9562('0x3a')](_0x19e25a[_0x9562('0x36')],_0x19e25a[_0x9562('0x37')]);_0xf6c149[_0x9562('0x3b')]=_[_0x9562('0x3a')](_0x19e25a[_0x9562('0x36')],qs['fields'](_0xc95c45[_0x9562('0x37')][_0x9562('0x3c')]));_0xf6c149[_0x9562('0x3b')]=_0xf6c149[_0x9562('0x3b')][_0x9562('0x3d')]?_0xf6c149['attributes']:_0x19e25a[_0x9562('0x36')];if(!_0xc95c45[_0x9562('0x37')][_0x9562('0x3e')]('nolimit')){_0xf6c149[_0x9562('0x23')]=qs['limit'](_0xc95c45[_0x9562('0x37')][_0x9562('0x23')]);_0xf6c149[_0x9562('0x21')]=qs[_0x9562('0x21')](_0xc95c45[_0x9562('0x37')][_0x9562('0x21')]);}_0xf6c149[_0x9562('0x3f')]=qs[_0x9562('0x40')](_0xc95c45['query'][_0x9562('0x40')]);_0xf6c149['where']=qs['filters'](_[_0x9562('0x41')](_0xc95c45[_0x9562('0x37')],_0x19e25a[_0x9562('0x39')]),_0x59a36f);if(_0xc95c45[_0x9562('0x37')][_0x9562('0x42')]){_0xf6c149['where']=_[_0x9562('0x43')](_0xf6c149[_0x9562('0x44')],{'$or':_['map'](_0x59a36f,function(_0x526ffd){if(_0x526ffd[_0x9562('0x45')]!==_0x9562('0x46')){var _0x17f05f={};_0x17f05f[_0x526ffd[_0x9562('0x30')]]={'$like':'%'+_0xc95c45[_0x9562('0x37')][_0x9562('0x42')]+'%'};return _0x17f05f;}})});}_0xf6c149=_[_0x9562('0x43')]({},_0xf6c149,_0xc95c45[_0x9562('0x47')]);var _0x3c89cb={'where':_0xf6c149[_0x9562('0x44')]};return db[_0x9562('0x33')][_0x9562('0x24')](_0x3c89cb)[_0x9562('0x2b')](function(_0xe52a9c){_0x2c9759[_0x9562('0x24')]=_0xe52a9c;if(_0xc95c45[_0x9562('0x37')][_0x9562('0x48')]){_0xf6c149[_0x9562('0x49')]=[{'all':!![]}];}return db[_0x9562('0x33')]['findAll'](_0xf6c149);})[_0x9562('0x2b')](function(_0x3ea965){_0x2c9759[_0x9562('0x4a')]=_0x3ea965;return _0x2c9759;})[_0x9562('0x2b')](respondWithFilteredResult(_0x35a9f9,_0xf6c149))[_0x9562('0x4b')](handleError(_0x35a9f9,null));};exports[_0x9562('0x4c')]=function(_0x54bfd5,_0x1a9a73){var _0x59763d={'raw':![],'where':{'id':_0x54bfd5[_0x9562('0x4d')]['id']}},_0x57c5b5={};_0x57c5b5[_0x9562('0x36')]=_[_0x9562('0x38')](db[_0x9562('0x33')][_0x9562('0x34')]);_0x57c5b5[_0x9562('0x37')]=_[_0x9562('0x38')](_0x54bfd5['query']);_0x57c5b5['filters']=_['intersection'](_0x57c5b5['model'],_0x57c5b5[_0x9562('0x37')]);_0x59763d[_0x9562('0x3b')]=_[_0x9562('0x3a')](_0x57c5b5[_0x9562('0x36')],qs[_0x9562('0x3c')](_0x54bfd5[_0x9562('0x37')][_0x9562('0x3c')]));_0x59763d['attributes']=_0x59763d['attributes'][_0x9562('0x3d')]?_0x59763d[_0x9562('0x3b')]:_0x57c5b5[_0x9562('0x36')];if(_0x54bfd5[_0x9562('0x37')][_0x9562('0x48')]){_0x59763d[_0x9562('0x49')]=[{'all':!![]}];}_0x59763d=_[_0x9562('0x43')]({},_0x59763d,_0x54bfd5[_0x9562('0x47')]);return db[_0x9562('0x33')]['find'](_0x59763d)[_0x9562('0x2b')](handleEntityNotFound(_0x1a9a73,null))[_0x9562('0x2b')](respondWithResult(_0x1a9a73,null))[_0x9562('0x4b')](handleError(_0x1a9a73,null));};exports[_0x9562('0x4e')]=function(_0x10efb1,_0x51d8ea){return db[_0x9562('0x33')][_0x9562('0x4e')](_0x10efb1[_0x9562('0x4f')],{})[_0x9562('0x2b')](respondWithResult(_0x51d8ea,0xc9))[_0x9562('0x4b')](handleError(_0x51d8ea,null));};exports['clone']=function(_0x1820f6,_0x559d6c){var _0x3e43fc={'where':{'id':_0x1820f6['params']['id']}},_0x5cb869={};_0x5cb869[_0x9562('0x36')]=_[_0x9562('0x38')](db[_0x9562('0x33')][_0x9562('0x34')]);_0x3e43fc[_0x9562('0x3b')]=_['intersection'](_0x5cb869['model'],qs['fields'](_0x1820f6[_0x9562('0x37')][_0x9562('0x3c')]));_0x3e43fc[_0x9562('0x3b')]=_0x3e43fc[_0x9562('0x3b')][_0x9562('0x3d')]?_0x3e43fc[_0x9562('0x3b')]:_0x5cb869[_0x9562('0x36')];if(_0x1820f6[_0x9562('0x37')][_0x9562('0x48')]){_0x3e43fc[_0x9562('0x49')]=[{'all':!![]}];}_0x3e43fc=_[_0x9562('0x43')]({},_0x3e43fc,_0x1820f6['options']);return db[_0x9562('0x33')]['find'](_0x3e43fc)[_0x9562('0x2b')](handleEntityNotFound(_0x559d6c,null))[_0x9562('0x2b')](function(_0x49e8b6){if(_0x49e8b6){var _0x2bacd7=_0x49e8b6['get']({'plain':!![]});_0x2bacd7=qs[_0x9562('0x50')](_0x2bacd7,['id',_0x9562('0x51'),_0x9562('0x52'),'crudPermissions']);_0x1820f6['body']=_[_0x9562('0x50')](_0x1820f6[_0x9562('0x4f')],['id',_0x9562('0x51'),_0x9562('0x52')]);return db[_0x9562('0x53')][_0x9562('0x54')](function(_0x9cbfff){return db['UserProfile'][_0x9562('0x4e')](_[_0x9562('0x43')](_0x2bacd7,_0x1820f6[_0x9562('0x4f')]),{'include':_0x1820f6[_0x9562('0x37')][_0x9562('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x9cbfff})['then'](function(_0x314228){var _0x5170d3=_0x314228[_0x9562('0x55')]({'plain':!![]});return db[_0x9562('0x56')][_0x9562('0x57')]({'where':{'userProfileId':_0x1820f6[_0x9562('0x4d')]['id']},'raw':!![]})[_0x9562('0x2b')](function(_0x3119b8){if(_0x3119b8){return BPromise[_0x9562('0x58')](_0x3119b8,function(_0x4ea6a3){return new BPromise(function(_0x3a89b7,_0x1b5370){if(_0x4ea6a3[_0x9562('0x59')]===null||_0x4ea6a3[_0x9562('0x59')]===0x1)_0x3a89b7(null);return db[_0x9562('0x5a')][_0x9562('0x57')]({'where':{'sectionId':_0x4ea6a3['id']},'raw':!![]})['then'](function(_0x8504fc){var _0x624d6f=_[_0x9562('0x32')](_0x8504fc,function(_0x5210f0){return qs[_0x9562('0x50')](_0x5210f0,['id',_0x9562('0x51'),'updatedAt','sectionId']);});_0x3a89b7(_0x624d6f);})[_0x9562('0x4b')](function(_0x20727a){_0x1b5370(_0x20727a);});})[_0x9562('0x2b')](function(_0x27161f){var _0x3106f2=qs[_0x9562('0x50')](_0x4ea6a3,['id','createdAt',_0x9562('0x52')]);_0x3106f2[_0x9562('0x5b')]=_0x5170d3['id'];if(_0x27161f)_0x3106f2['Resources']=_0x27161f;return _0x3106f2;})[_0x9562('0x2b')](function(_0x34b09a){return db[_0x9562('0x56')][_0x9562('0x4e')](_0x34b09a,{'include':[{'model':db[_0x9562('0x5a')],'as':_0x9562('0x5c')}],'raw':!![],'transaction':_0x9cbfff});});})[_0x9562('0x2b')](function(){return _0x5170d3;});}});});});}})[_0x9562('0x2b')](respondWithResult(_0x559d6c,0xc9))[_0x9562('0x4b')](handleError(_0x559d6c,null));};exports[_0x9562('0x2a')]=function(_0x3f7886,_0xbc89f4){if(_0x3f7886[_0x9562('0x4f')]['id']){delete _0x3f7886['body']['id'];}return db[_0x9562('0x33')][_0x9562('0x5d')]({'where':{'id':_0x3f7886['params']['id']}})[_0x9562('0x2b')](handleEntityNotFound(_0xbc89f4,null))['then'](saveUpdates(_0x3f7886[_0x9562('0x4f')],null))['then'](respondWithResult(_0xbc89f4,null))['catch'](handleError(_0xbc89f4,null));};exports['destroy']=function(_0x1c1818,_0x42a94e){return db[_0x9562('0x33')][_0x9562('0x5d')]({'where':{'id':_0x1c1818[_0x9562('0x4d')]['id']}})[_0x9562('0x2b')](handleEntityNotFound(_0x42a94e,null))['then'](removeEntity(_0x42a94e,null))[_0x9562('0x4b')](handleError(_0x42a94e,null));};exports['describe']=function(_0x5a4a5e,_0x48680d){return db[_0x9562('0x33')][_0x9562('0x5e')]()['then'](respondWithResult(_0x48680d,null))[_0x9562('0x4b')](handleError(_0x48680d,null));};exports[_0x9562('0x5f')]=function(_0x28c83a,_0x1e8a13){var _0x213166=_0x28c83a[_0x9562('0x4f')];return db[_0x9562('0x33')][_0x9562('0x5d')]({'where':{'id':_0x28c83a[_0x9562('0x4d')]['id']}})[_0x9562('0x2b')](handleEntityNotFound(_0x1e8a13,null))['then'](function(_0x421de8){if(_0x421de8){return db[_0x9562('0x53')]['transaction'](function(_0x2e1d67){return db['UserProfileSection'][_0x9562('0x60')]({'where':{'userProfileId':_0x28c83a['params']['id'],'sectionId':_[_0x9562('0x32')](_0x213166,function(_0x19e596){return _0x19e596[_0x9562('0x61')];})},'transaction':_0x2e1d67})[_0x9562('0x2b')](function(){var _0x19d411=_[_0x9562('0x32')](_0x213166,function(_0x3e3354){_0x3e3354[_0x9562('0x5b')]=_0x28c83a[_0x9562('0x4d')]['id'];return _0x3e3354;});var _0xdf3a37=[];return BPromise['each'](_0x19d411,function(_0x4dca3d){return db[_0x9562('0x56')][_0x9562('0x4e')](_0x4dca3d,{'include':[{'model':db['UserProfileResource'],'as':_0x9562('0x5c')}],'raw':!![],'transaction':_0x2e1d67})[_0x9562('0x2b')](function(_0x16afdf){_0xdf3a37[_0x9562('0x62')](_0x16afdf[_0x9562('0x55')]({'plain':!![]}));});})[_0x9562('0x2b')](function(){return _0xdf3a37;});});});}})[_0x9562('0x2b')](function(_0x4b2212){return _0x4b2212;})['then'](respondWithResult(_0x1e8a13,null))[_0x9562('0x4b')](handleError(_0x1e8a13,null));};exports[_0x9562('0x63')]=function(_0x36934c,_0x2d6d3){var _0x3e12a4;return db[_0x9562('0x33')]['find']({'where':{'id':_0x36934c[_0x9562('0x4d')]['id']},'attributes':['id',_0x9562('0x30')]})[_0x9562('0x2b')](handleEntityNotFound(_0x2d6d3,null))[_0x9562('0x2b')](function(_0x39ca41){if(_0x39ca41){_0x3e12a4=_0x39ca41;return db[_0x9562('0x56')]['destroy']({'where':{'userProfileId':_0x36934c[_0x9562('0x4d')]['id'],'sectionId':_0x36934c[_0x9562('0x37')][_0x9562('0x64')]}});}})['then'](function(){return _0x3e12a4;})[_0x9562('0x2b')](respondWithStatusCode(_0x2d6d3,null))[_0x9562('0x4b')](handleError(_0x2d6d3,null));};exports[_0x9562('0x65')]=function(_0x57b3ac,_0x9b426f){var _0x414764=[];var _0x2c452e=[];return db['UserProfileSection'][_0x9562('0x57')]({'where':{'userProfileId':_0x57b3ac[_0x9562('0x4d')]['id']},'raw':!![]})[_0x9562('0x2b')](function(_0x4cedfb){_0x414764=_[_0x9562('0x42')](_0x4cedfb,function(_0x3539b7){return _0x3539b7[_0x9562('0x66')]===0x1||_[_0x9562('0x67')]([0x3eb,0x709],_0x3539b7['sectionId']);});if(!_['isEmpty'](_0x414764)){return _[_0x9562('0x32')](_0x414764,function(_0x5b39ae){return _0x5b39ae[_0x9562('0x61')];});}else{return;}})[_0x9562('0x2b')](function(_0x513106){if(_0x513106)_0x2c452e=_0x513106;if(_[_0x9562('0x67')](_0x2c452e,0x64)){var _0x35e030=_[_0x9562('0x5d')](_0x414764,{'sectionId':0x64});return hasDefaultDashboard(_0x35e030)['then'](function(_0x696c84){return _[_0x9562('0x32')](_0x414764,function(_0x363f90){if(_0x363f90['sectionId']===0x64){_0x363f90[_0x9562('0x68')]=_0x696c84;}return _0x363f90;});});}else{return;}})[_0x9562('0x2b')](function(_0x15b66c){if(_0x15b66c)_0x414764=_0x15b66c;if(_[_0x9562('0x67')](_0x2c452e,0x3eb)){var _0x17ba77=_[_0x9562('0x5d')](_0x414764,{'sectionId':0x3eb});return getCustomDashboards(_0x17ba77)['then'](function(_0x233239){return _['map'](_0x414764,function(_0x53d7a9){if(_0x17ba77[_0x9562('0x66')]){if(_0x53d7a9[_0x9562('0x61')]===0x3eb){_0x53d7a9[_0x9562('0x68')]=_0x233239;}}else{if(_0x53d7a9[_0x9562('0x61')]===0x64){if(!_0x53d7a9[_0x9562('0x68')]){_0x53d7a9[_0x9562('0x68')]=[];}_0x53d7a9['subsections']=_0x53d7a9[_0x9562('0x68')][_0x9562('0x69')](_0x233239);}}return _0x53d7a9;});});}else{return;}})[_0x9562('0x2b')](function(_0xf4084d){if(_0xf4084d)_0x414764=_0xf4084d;if(_[_0x9562('0x67')](_0x2c452e,0x709)){var _0x49e23f=_['find'](_0x414764,{'sectionId':0x709});return getPlugins(_0x49e23f)[_0x9562('0x2b')](function(_0x9467fc){if(_0x49e23f[_0x9562('0x66')]){return _[_0x9562('0x32')](_0x414764,function(_0x207c50){if(_0x207c50[_0x9562('0x61')]===0x709){_0x207c50[_0x9562('0x68')]=_0x9467fc;}return _0x207c50;});}else{var _0x214451={'sectionId':0x76c,'enabled':0x1,'subsections':_0x9467fc};var _0x255d17=_[_0x9562('0x32')](_0x414764);_0x255d17[_0x9562('0x62')](_0x214451);return _0x255d17;}});}else{return;}})[_0x9562('0x2b')](function(_0x5476b6){if(_0x5476b6)_0x414764=_0x5476b6;return _['filter'](_0x414764,[_0x9562('0x66'),0x1]);})[_0x9562('0x2b')](respondWithResult(_0x9b426f,null))[_0x9562('0x4b')](handleError(_0x9b426f,null));};function hasDefaultDashboard(_0x58af12){var _0x316291=[0x65];return new BPromise(function(_0x31bacd,_0x1868b6){try{if(_0x58af12[_0x9562('0x59')]){_0x31bacd(_0x316291);}else{return db[_0x9562('0x5a')][_0x9562('0x6a')]({'where':{'sectionId':_0x58af12['id']},'raw':!![]})[_0x9562('0x2b')](function(_0x5752f0){_0x5752f0?_0x31bacd(_0x316291):_0x31bacd();});}}catch(_0x41a977){_0x1868b6(_0x41a977);}});}function getCustomDashboards(_0x3ed45f){var _0x42527f=[];return new BPromise(function(_0x13a130,_0x3009d9){try{if(_0x3ed45f[_0x9562('0x59')]){return db[_0x9562('0x6b')][_0x9562('0x57')]({'raw':!![]})[_0x9562('0x2b')](function(_0x521835){_0x521835[_0x9562('0x6c')](function(_0x391fb2){_0x42527f['push'](_0x391fb2['id']+0x1869f);});_0x13a130(_0x42527f);});}else{return db[_0x9562('0x5a')][_0x9562('0x57')]({'where':{'sectionId':_0x3ed45f['id']},'raw':!![]})['then'](function(_0x4bc2d2){_0x4bc2d2[_0x9562('0x6c')](function(_0x313ee3){_0x42527f['push'](_0x313ee3['resourceId']+0x1869f);});_0x13a130(_0x42527f);});}}catch(_0x576636){_0x3009d9(_0x576636);}});}function getPlugins(_0x4a3bda){var _0x47695a=[];return new BPromise(function(_0x2717f6,_0x2c0f61){try{if(_0x4a3bda[_0x9562('0x59')]){return db[_0x9562('0x6d')][_0x9562('0x57')]({'raw':!![]})[_0x9562('0x2b')](function(_0x1685b4){_0x1685b4[_0x9562('0x6c')](function(_0x499221){_0x47695a[_0x9562('0x62')](_0x499221['id']+0x15b38);});_0x2717f6(_0x47695a);});}else{return db[_0x9562('0x5a')][_0x9562('0x57')]({'where':{'sectionId':_0x4a3bda['id']},'raw':!![]})[_0x9562('0x2b')](function(_0x7bde09){_0x7bde09[_0x9562('0x6c')](function(_0x524c3a){_0x47695a[_0x9562('0x62')](_0x524c3a[_0x9562('0x6e')]+0x15b38);});_0x2717f6(_0x47695a);});}}catch(_0x52dad4){_0x2c0f61(_0x52dad4);}});}exports[_0x9562('0x6f')]=function(_0x17ac45,_0x5ce2fa){return db['UserProfile']['find']({'where':{'id':_0x17ac45[_0x9562('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ce2fa,null))[_0x9562('0x2b')](function(_0x101f88){if(_0x101f88){return db[_0x9562('0x53')]['transaction'](function(_0x595759){return db[_0x9562('0x56')][_0x9562('0x57')]({'where':{'userProfileId':_0x17ac45[_0x9562('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0x9562('0x2b')](function(_0x570066){if(_0x570066){return db['UserProfileSection'][_0x9562('0x60')]({'where':{'userProfileId':_0x17ac45['params']['id'],'id':_[_0x9562('0x32')](_0x570066,function(_0x41f068){return _0x41f068['id'];})},'transaction':_0x595759});}})['then'](function(_0x17977b){var _0x595528=_[_0x9562('0x32')](_0x17ac45['body'],function(_0x3910da){_0x3910da['userProfileId']=_0x17ac45[_0x9562('0x4d')]['id'];return _0x3910da;});return db['UserProfileSection'][_0x9562('0x70')](_0x595528,{'raw':!![],'transaction':_0x595759});})['then'](function(_0x4dabd0){var _0x2c0726=_[_0x9562('0x42')](_['map'](_0x4dabd0,function(_0x4f59b4){return _0x4f59b4[_0x9562('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x2c0726){return db[_0x9562('0x56')][_0x9562('0x57')]({'where':{'userProfileId':_0x17ac45[_0x9562('0x4d')]['id'],'sectionId':_['map'](_0x2c0726,function(_0xde5521){return _0xde5521[_0x9562('0x61')];})},'attributes':['id',_0x9562('0x61')],'raw':!![]})[_0x9562('0x2b')](function(_0x283d96){var _0x2a05df=_[_0x9562('0x32')](_0x17ac45[_0x9562('0x4f')],function(_0xebe4b8){_0xebe4b8[_0x9562('0x5b')]=_0x17ac45[_0x9562('0x4d')]['id'];return _0xebe4b8;});return db[_0x9562('0x5a')][_0x9562('0x70')](_0x2a05df,{'raw':!![],'transaction':_0x595759});});}})['catch'](handleError(_0x5ce2fa,null));});}})[_0x9562('0x2b')](function(_0x1e21c2){var _0xacb59a=_[_0x9562('0x32')](_0x1e21c2,function(_0x124007){return _0x124007[_0x9562('0x55')]({'plain':!![]});});})[_0x9562('0x2b')](respondWithResult(_0x5ce2fa,null))[_0x9562('0x4b')](handleError(_0x5ce2fa,null));};exports['removeResources']=function(_0x3104a1,_0x51b3b1,_0x2929ec){return db[_0x9562('0x33')][_0x9562('0x5d')]({'where':{'id':_0x3104a1[_0x9562('0x4d')]['id']}})[_0x9562('0x2b')](handleEntityNotFound(_0x51b3b1,null))[_0x9562('0x2b')](function(_0x448028){if(_0x448028){return _0x448028[_0x9562('0x71')](_0x3104a1[_0x9562('0x37')][_0x9562('0x64')]);}})[_0x9562('0x2b')](respondWithStatusCode(_0x51b3b1,null))['catch'](handleError(_0x51b3b1,null));};exports['getResources']=function(_0x2e006a,_0x38021e){var _0x1163bb={};if(!_0x2e006a[_0x9562('0x37')][_0x9562('0x72')])throw new Error('Missing\x20section\x20parameter');if(!_0x2e006a[_0x9562('0x37')][_0x9562('0x3e')](_0x9562('0x73'))){_0x1163bb[_0x9562('0x23')]=qs[_0x9562('0x23')](_0x2e006a[_0x9562('0x37')][_0x9562('0x23')]);_0x1163bb['offset']=qs['offset'](_0x2e006a[_0x9562('0x37')][_0x9562('0x21')]);}return db['UserProfile'][_0x9562('0x5d')]({'where':{'id':_0x2e006a[_0x9562('0x4d')]['id']}})[_0x9562('0x2b')](function(_0x1c60d4){if(!_0x1c60d4)throw new Error(_0x9562('0x74')+_0x2e006a['params']['id']);return db['UserProfile'][_0x9562('0x75')](_0x2e006a);})['then'](respondWithFilteredResult(_0x38021e,_0x1163bb))['catch'](handleError(_0x38021e,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 27c77e7..d4d0ff4 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 _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 +var _0xa423=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x2ac9d5,_0x44ce87){var _0x51cb13=function(_0x26d2b4){while(--_0x26d2b4){_0x2ac9d5['push'](_0x2ac9d5['shift']());}};_0x51cb13(++_0x44ce87);}(_0xa423,0x16c));var _0x3a42=function(_0x5b33ad,_0x2a7d55){_0x5b33ad=_0x5b33ad-0x0;var _0x16ec00=_0xa423[_0x5b33ad];return _0x16ec00;};'use strict';var EventEmitter=require(_0x3a42('0x0'));var UserProfile=require(_0x3a42('0x1'))['db'][_0x3a42('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3a42('0x3')](0x0);var events={'afterCreate':_0x3a42('0x4'),'afterUpdate':'update','afterDestroy':_0x3a42('0x5')};function emitEvent(_0x857de4){return function(_0x5c4f6a,_0xc6780b,_0x33f87e){UserProfileEvents[_0x3a42('0x6')](_0x857de4+':'+_0x5c4f6a['id'],_0x5c4f6a);UserProfileEvents[_0x3a42('0x6')](_0x857de4,_0x5c4f6a);_0x33f87e(null);};}for(var e in events){if(events[_0x3a42('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x3a42('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 027a050..e587eb8 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 _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 +var _0x9a45=['CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicerecordings','VoiceRecording','Agents','name','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','QueueCampaigns','outbound','musiconholds','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','VoiceQueue','parentSections','agents','telephones','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','sounds','Sound','Tag','templates','triggers','trunks','variables','Variable','plugins','Plugin','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','define','UserProfile','../../components/parsers/qs','query','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','reportType','default','DefaultReports','count','ids','customSorting','extraQueryConditions','include','Tags','color','tag','ThroughTags','rows','openTabs','true','dataValues','sms','fax','mail','whatsapp','./userProfile.attributes','squel','models','filter','findAll','then','associatedResources','catch','field','value','UserProfileResource','map','AnalyticExtractedReport','type','resourceId','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields'];(function(_0x59e875,_0x4219d2){var _0x1dcddd=function(_0x476594){while(--_0x476594){_0x59e875['push'](_0x59e875['shift']());}};_0x1dcddd(++_0x4219d2);}(_0x9a45,0x9f));var _0x59a4=function(_0x1146a8,_0x29edaf){_0x1146a8=_0x1146a8-0x0;var _0x359657=_0x9a45[_0x1146a8];return _0x359657;};'use strict';var _=require('lodash');var attributes=require(_0x59a4('0x0'));var squel=require(_0x59a4('0x1'));module['exports']=function(_0x3d30c8){var _0x139318=_0x3d30c8[_0x59a4('0x2')];function _0x12d644(_0x342f67,_0x1ac8f1){return new Promise(function(_0x1eb79c,_0x3a62f8){if(!_0x1ac8f1)return _0x1eb79c(null);var _0x3f09da=_0x1ac8f1[_0x59a4('0x3')]?{[_0x1ac8f1[_0x59a4('0x3')]['field']]:_0x1ac8f1['filter']['value']}:undefined;return _0x139318[_0x342f67][_0x59a4('0x4')]({'where':_0x3f09da,'raw':!![]})[_0x59a4('0x5')](function(_0x4e4f99){_0x1ac8f1[_0x59a4('0x6')]=_['map'](_0x4e4f99,'id');_0x1eb79c(_0x1ac8f1);})[_0x59a4('0x7')](function(_0x49519f){_0x3a62f8(_0x49519f);});});}function _0x20fa32(_0x1144da,_0x1f93f0){return new Promise(function(_0x411f61,_0x400d12){var _0x51d5bc=_0x1144da[_0x59a4('0x3')]?{[_0x1144da[_0x59a4('0x3')][_0x59a4('0x8')]]:_0x1144da[_0x59a4('0x3')][_0x59a4('0x9')]}:undefined;return _0x139318[_0x1144da['model']][_0x59a4('0x4')]({'where':_0x51d5bc,'raw':!![]})[_0x59a4('0x5')](function(_0x46c80d){_0x1f93f0[_0x59a4('0x6')]=_['map'](_0x46c80d,function(_0x251d4a){return _0x251d4a['name'];});_0x411f61(_0x1f93f0);})[_0x59a4('0x7')](function(_0x15ea88){_0x400d12(_0x15ea88);});});}function _0x439468(_0x1222b6,_0x4f298f,_0x5bc45a){if(!_0x4f298f)return Promise['resolve'](null);return new Promise(function(_0x3cb093,_0x2bb315){return _0x139318[_0x59a4('0xa')][_0x59a4('0x4')]({'where':{'sectionId':_0x4f298f['id']},'raw':!![]})[_0x59a4('0x5')](function(_0x3c447c){if(_0x1222b6[_0x59a4('0x8')]&&_0x1222b6[_0x59a4('0x8')]!=='id'){_0x4f298f[_0x59a4('0x6')]=_[_0x59a4('0xb')](_0x3c447c,function(_0x533057){return _0x533057[_0x1222b6[_0x59a4('0x8')]];});}else{if(_0x5bc45a===_0x59a4('0xc')){_0x4f298f[_0x59a4('0x6')]=_[_0x59a4('0xb')](_0x3c447c,function(_0xc86cb2){return{'id':_0xc86cb2['resourceId'],'type':_0xc86cb2[_0x59a4('0xd')]};});}else{_0x4f298f['associatedResources']=_['map'](_0x3c447c,function(_0x4e137f){return _0x4e137f[_0x59a4('0xe')];});}}_0x3cb093(_0x4f298f);})['catch'](function(_0x2e9100){_0x2bb315(_0x2e9100);});});}function _0x356885(_0x53a36d,_0x3e4d58){var _0x2fd322={'parentSections':[]};switch(_0x53a36d['toLowerCase']()){case'squareprojects':_0x2fd322['childModel']=_0x59a4('0xf');break;case _0x59a4('0x10'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x12');break;case _0x59a4('0x13'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x14');_0x2fd322['parentSections']=[{'name':_0x59a4('0x15'),'field':'name','foreignKey':_0x59a4('0x16')}];break;case _0x59a4('0x17'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x18');break;case _0x59a4('0x19'):_0x2fd322['childModel']=_0x59a4('0x1a');_0x2fd322['parentSections']=[{'name':_0x59a4('0x1b'),'field':'id','foreignKey':_0x59a4('0x1c')}];break;case _0x59a4('0x1d'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x1e');break;case'companies':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x1f');break;case _0x59a4('0x20'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x21');break;case _0x59a4('0x22'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x23');break;case _0x59a4('0x24'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x25');break;case _0x59a4('0x26'):_0x2fd322['childModel']=_0x59a4('0x27');break;case _0x59a4('0x28'):_0x2fd322['childModel']=_0x59a4('0x29');break;case'inboundroutes':case _0x59a4('0x2a'):case _0x59a4('0x2b'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x2c');break;case'contexts':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x2d');break;case'voicemails':_0x2fd322['childModel']='VoiceMail';break;case _0x59a4('0x2e'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x2f');_0x2fd322['parentSections']=[{'name':_0x59a4('0x30'),'field':_0x59a4('0x31'),'foreignKey':'membername','model':_0x59a4('0x32'),'filter':{'field':_0x59a4('0x33'),'value':[_0x59a4('0x34')]}},{'name':_0x59a4('0x35'),'field':'name','foreignKey':_0x59a4('0x36'),'model':_0x59a4('0x32'),'filter':{'field':_0x59a4('0x33'),'value':[_0x59a4('0x37')]}},{'name':_0x59a4('0x38'),'field':_0x59a4('0x31'),'foreignKey':_0x59a4('0x39'),'model':'VoiceQueue','filter':{'field':_0x59a4('0xd'),'value':['inbound']}},{'name':_0x59a4('0x3a'),'field':_0x59a4('0x31'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0x59a4('0x3b')]}}];break;case _0x59a4('0x3c'):_0x2fd322[_0x59a4('0x11')]='VoiceMusicOnHold';break;case'chanspies':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x3d');break;case _0x59a4('0x3e'):_0x2fd322[_0x59a4('0x11')]='VoicePrefix';break;case _0x59a4('0x3f'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x40');break;case _0x59a4('0x41'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x42');break;case _0x59a4('0x43'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x44');break;case _0x59a4('0x45'):_0x2fd322[_0x59a4('0x11')]='MailSubstatus';break;case _0x59a4('0x46'):_0x2fd322['childModel']=_0x59a4('0x47');break;case _0x59a4('0x48'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x49');break;case'smsqueues':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x4a');break;case _0x59a4('0x4b'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x4c');break;case _0x59a4('0x4d'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x4e');break;case _0x59a4('0x4f'):_0x2fd322[_0x59a4('0x11')]='WhatsappAccount';break;case _0x59a4('0x50'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x51');break;case'voicequeues':case'queuecampaigns':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x52');if(_0x3e4d58){_0x2fd322[_0x59a4('0x53')]=[{'name':_0x59a4('0x38')},{'name':_0x59a4('0x3a')}];}break;case'users':case _0x59a4('0x54'):case _0x59a4('0x55'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x32');if(_0x3e4d58){_0x2fd322[_0x59a4('0x53')]=[{'name':'Users','filter':{'field':_0x59a4('0x33'),'value':[_0x59a4('0x56'),_0x59a4('0x57')]},'ignore':!![]},{'name':_0x59a4('0x30')},{'name':_0x59a4('0x35')}];}break;case _0x59a4('0x58'):_0x2fd322[_0x59a4('0x11')]='ZendeskAccount';break;case _0x59a4('0x59'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x5a');break;case _0x59a4('0x5b'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x5c');break;case _0x59a4('0x5d'):_0x2fd322['childModel']=_0x59a4('0x5e');break;case'deskaccounts':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x5f');break;case _0x59a4('0x60'):_0x2fd322['childModel']=_0x59a4('0x61');break;case _0x59a4('0x62'):_0x2fd322['childModel']=_0x59a4('0x32');break;case'cannedanswers':_0x2fd322['childModel']=_0x59a4('0x63');break;case _0x59a4('0x64'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x65');break;case _0x59a4('0x66'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x67');break;case _0x59a4('0x68'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x69');break;case'pauses':_0x2fd322['childModel']=_0x59a4('0x6a');break;case _0x59a4('0x6b'):_0x2fd322[_0x59a4('0x11')]='Schedule';break;case _0x59a4('0x6c'):_0x2fd322['childModel']=_0x59a4('0x6d');break;case'tags':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x6e');break;case _0x59a4('0x6f'):_0x2fd322[_0x59a4('0x11')]='Template';break;case _0x59a4('0x70'):_0x2fd322['childModel']='Trigger';break;case _0x59a4('0x71'):_0x2fd322[_0x59a4('0x11')]='Trunk';break;case _0x59a4('0x72'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x73');break;case _0x59a4('0x74'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x75');break;case'extractedreports':_0x2fd322['childModel']=_0x59a4('0xc');_0x2fd322['parentSections']=[{'name':_0x59a4('0x76'),'field':'id','foreignKey':_0x59a4('0x77')}];break;case _0x59a4('0x78'):_0x2fd322['childModel']='AnalyticMetric';break;}return _0x2fd322;}function _0x5c5e7a(_0x36103b,_0x303645){var _0x2b5bd2=_0x36103b[_0x59a4('0x79')](0x0)[_0x59a4('0x7a')]()+_0x36103b[_0x59a4('0x7b')](0x1);var _0x434c7d={'type':_0x139318[_0x59a4('0x7c')][_0x59a4('0x7d')][_0x59a4('0x7e')],'raw':!![]};return new Promise(function(_0x42c097,_0x53a239){var _0x4d8b0b=squel['select']()[_0x59a4('0x8')](_0x59a4('0x7f')+_0x2b5bd2+_0x59a4('0x80'),'id')[_0x59a4('0x8')](_0x59a4('0x81'))[_0x59a4('0x82')]('user_has_'+_0x36103b+_0x59a4('0x83'),'ui')[_0x59a4('0x84')](_0x59a4('0x85'),_0x303645['id']);return _0x139318[_0x59a4('0x86')]['query'](_0x4d8b0b['toString'](),_0x434c7d)[_0x59a4('0x5')](function(_0x16b889){_0x303645[_0x2b5bd2+'OpenTabs']=_0x16b889;_0x42c097(_0x16b889);})[_0x59a4('0x7')](function(_0x5474b7){_0x53a239(_0x5474b7);});});}return _0x3d30c8[_0x59a4('0x87')](_0x59a4('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x36eee8){var _0x2377b3=require(_0x59a4('0x89'));var _0x1550cf={'raw':_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x8b')],'where':{}};var _0xd1fa6d={};var _0x347a31={'count':0x0,'rows':[]};var _0x2f9592=_0x36eee8[_0x59a4('0x8a')]['section'];var _0x4b2882=_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x8c')]||![];var _0x496cea=_0x356885(_0x2f9592,_0x4b2882);if(!_0x496cea[_0x59a4('0x11')])throw new Error(_0x59a4('0x8d')+_0x2f9592+'\x27');var _0x524a30=[{'name':_0x2f9592}];if(!_[_0x59a4('0x8e')](_0x496cea[_0x59a4('0x53')]))_0x524a30=_0x496cea['parentSections'];var _0x466a32=[];for(var _0x1b9d51=0x0;_0x1b9d51<_0x524a30[_0x59a4('0x8f')];_0x1b9d51++){_0x466a32[_0x59a4('0x90')](_0x139318[_0x59a4('0x91')][_0x59a4('0x92')]({'where':{'userProfileId':_0x36eee8[_0x59a4('0x93')]['id'],'name':_0x524a30[_0x1b9d51][_0x59a4('0x31')]},'raw':!![]}));}return Promise[_0x59a4('0x94')](_0x466a32)[_0x59a4('0x5')](function(_0x36447f){var _0x333346=_[_0x59a4('0x3')](_0x36447f,function(_0x18f3af){return _0x18f3af?_0x18f3af:undefined;});var _0x2b9d59=_[_0x59a4('0x3')](_0x524a30,[_0x59a4('0x95'),!![]]);var _0x581fe2=_['isEmpty'](_0x333346)&&_[_0x59a4('0x8e')](_0x2b9d59)?null:_[_0x59a4('0x96')](_0x2b9d59,_0x333346);if(!_0x581fe2)return null;var _0x379783=[];for(var _0x4037f6=0x0;_0x4037f6<_0x581fe2['length'];_0x4037f6++){var _0x4c21da=_[_0x59a4('0x92')](_0x524a30,function(_0x5819a4){return _0x581fe2[_0x4037f6]?_0x5819a4[_0x59a4('0x31')]===_0x581fe2[_0x4037f6][_0x59a4('0x31')]:null;});if(_0x4c21da){if(_0x581fe2[_0x4037f6][_0x59a4('0x95')]){_0x379783[_0x59a4('0x90')](_0x12d644(_0x496cea['childModel'],_0x581fe2[_0x4037f6]));}else{if(!_0x581fe2[_0x4037f6][_0x59a4('0x97')]){_0x379783[_0x59a4('0x90')](_0x439468(_0x4c21da,_0x581fe2[_0x4037f6],_0x496cea[_0x59a4('0x11')]));}else{if(_0x4c21da[_0x59a4('0x98')]){_0x379783[_0x59a4('0x90')](_0x20fa32(_0x4c21da,_0x581fe2[_0x4037f6]));}}}}}return Promise[_0x59a4('0x94')](_0x379783);})[_0x59a4('0x5')](function(_0x3ad0fe){var _0x337d1e=_0x3ad0fe;var _0x1152dc=null;if(_0x337d1e){_0x1152dc=_0x337d1e[_0x59a4('0x8f')]===0x1?_0x337d1e[0x0]:null;}if(!_0x1152dc&&!_0x337d1e)return _0x347a31;var _0x2ef4ff=_0x139318[_0x496cea[_0x59a4('0x11')]][_0x59a4('0x99')];_0xd1fa6d[_0x59a4('0x98')]=_['keys'](_0x2ef4ff);_0xd1fa6d[_0x59a4('0x8a')]=_[_0x59a4('0x9a')](_0x36eee8[_0x59a4('0x8a')]);_0xd1fa6d[_0x59a4('0x9b')]=_[_0x59a4('0x9c')](_0xd1fa6d[_0x59a4('0x98')],_0xd1fa6d[_0x59a4('0x8a')]);_0x1550cf[_0x59a4('0x9d')]=_[_0x59a4('0x9c')](_0xd1fa6d[_0x59a4('0x98')],_0x2377b3[_0x59a4('0x9e')](_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x9e')]));_0x1550cf[_0x59a4('0x9d')]=_0x1550cf[_0x59a4('0x9d')][_0x59a4('0x8f')]?_0x1550cf[_0x59a4('0x9d')]:_0xd1fa6d['model'];if(!_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x9f')](_0x59a4('0xa0'))){_0x1550cf[_0x59a4('0xa1')]=_0x2377b3[_0x59a4('0xa1')](_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xa1')]);_0x1550cf[_0x59a4('0xa2')]=_0x2377b3['offset'](_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xa2')]);}_0x1550cf[_0x59a4('0xa3')]=_0x2377b3['sort'](_0x36eee8['query'][_0x59a4('0xa4')]);_0x1550cf[_0x59a4('0x84')]=_0x2377b3[_0x59a4('0x9b')](_['pick'](_0x36eee8['query'],_0xd1fa6d[_0x59a4('0x9b')]));if(_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x3')]){_0x1550cf[_0x59a4('0x84')]=_['merge'](_0x1550cf['where'],{'$or':_[_0x59a4('0xb')](_0x2ef4ff,function(_0x5606f8){if(_0x5606f8[_0x59a4('0xd')][_0x59a4('0xa5')]!==_0x59a4('0xa6')){var _0x45df24={};_0x45df24[_0x5606f8['field']]={'$like':'%'+_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x3')]+'%'};return _0x45df24;}})});}var _0x41b1e7=[];var _0x289248=null;var _0x52eba3={};if(_0x1152dc){_0x289248=_[_0x59a4('0x92')](_0x524a30,[_0x59a4('0x31'),_0x1152dc[_0x59a4('0x31')]]);if(_0x289248[_0x59a4('0x8')]){_0x52eba3={};if(_0x496cea[_0x59a4('0x11')]===_0x59a4('0xc')){_0x52eba3[_0x289248['foreignKey']]=_[_0x59a4('0xb')](_0x1152dc[_0x59a4('0x6')],'id');}else{_0x52eba3[_0x289248['foreignKey']]=_0x1152dc[_0x59a4('0x6')];}_0x41b1e7[_0x59a4('0x90')](_0x52eba3);}else{_0x1550cf[_0x59a4('0x84')]['id']=_0x1152dc[_0x59a4('0x6')];}}else{for(var _0x2b19d5=0x0;_0x2b19d5<_0x337d1e[_0x59a4('0x8f')];_0x2b19d5++){_0x289248=_[_0x59a4('0x92')](_0x524a30,[_0x59a4('0x31'),_0x337d1e[_0x2b19d5]['name']]);if(_0x289248[_0x59a4('0x8')]){_0x52eba3={};_0x52eba3[_0x289248[_0x59a4('0xa7')]]=_0x337d1e[_0x2b19d5][_0x59a4('0x6')];_0x41b1e7[_0x59a4('0x90')](_0x52eba3);}else{if(!_0x1550cf['where']['id'])_0x1550cf[_0x59a4('0x84')]['id']=[];_0x337d1e[_0x2b19d5]['associatedResources'][_0x59a4('0xa8')](function(_0x4a5c53){_0x1550cf[_0x59a4('0x84')]['id'][_0x59a4('0x90')](_0x4a5c53);});}}}if(!_[_0x59a4('0x8e')](_0x41b1e7)){_0x1550cf[_0x59a4('0x84')]=_[_0x59a4('0xa9')](_0x1550cf[_0x59a4('0x84')],{'$and':{'$or':_0x41b1e7}});}_0x1550cf=_[_0x59a4('0xa9')]({},_0x1550cf,_0x36eee8[_0x59a4('0xaa')]);if(_0x1152dc&&!_0x1152dc['autoAssociation']&&_0x496cea[_0x59a4('0x11')]===_0x59a4('0xc')){if(_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xab')]){_0x1550cf['include']=[{'all':!![]}];}return _0x139318[_0x496cea[_0x59a4('0x11')]][_0x59a4('0x4')](_0x1550cf)[_0x59a4('0x5')](function(_0x2952c0){var _0x35f071=[];_0x2952c0[_0x59a4('0xa8')](function(_0x455890){var _0x25060b;switch(_0x455890[_0x59a4('0xac')]){case _0x59a4('0xad'):_0x25060b=_[_0x59a4('0x92')](_0x1152dc['associatedResources'],function(_0x2fec9c){return _0x2fec9c['id']===_0x455890['reportId']&&_0x2fec9c[_0x59a4('0xd')]===_0x59a4('0xae');});break;case'custom':_0x25060b=_[_0x59a4('0x92')](_0x1152dc[_0x59a4('0x6')],function(_0x380fc5){return _0x380fc5['id']===_0x455890['reportId']&&_0x380fc5[_0x59a4('0xd')]==='CustomReports';});break;}if(_0x25060b)_0x35f071[_0x59a4('0x90')](_0x455890);});_0x347a31[_0x59a4('0xaf')]=_0x35f071[_0x59a4('0x8f')];_0x347a31['rows']=_0x35f071;return _0x347a31;});}else{if(!_['isEmpty'](_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb0')])){_0x1550cf['where']['id']=_0x1550cf[_0x59a4('0x84')]['id']?_[_0x59a4('0x9c')](_0x1550cf[_0x59a4('0x84')]['id'],_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb0')]):_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb0')];if(_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb1')]){_0x1550cf[_0x59a4('0xa3')]=_0x36eee8[_0x59a4('0x8a')]['customSorting'];}}if(_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb2')]){_0x1550cf['where']=_[_0x59a4('0xa9')](_0x1550cf[_0x59a4('0x84')],{'$and':_0x36eee8[_0x59a4('0x8a')]['extraQueryConditions']});}return _0x139318[_0x496cea[_0x59a4('0x11')]][_0x59a4('0xaf')]({'where':_0x1550cf[_0x59a4('0x84')]})[_0x59a4('0x5')](function(_0x43f477){_0x347a31[_0x59a4('0xaf')]=_0x43f477;if(_0x36eee8['query'][_0x59a4('0xab')]){if(_0x496cea[_0x59a4('0x11')]===_0x59a4('0x1a')){_0x1550cf[_0x59a4('0xb3')]=[{'model':_0x139318['Tag'],'as':_0x59a4('0xb4'),'attributes':['id','name',_0x59a4('0xb5')],'required':_0x36eee8['query'][_0x59a4('0xb6')]?!![]:![]},{'model':_0x139318[_0x59a4('0x6e')],'as':_0x59a4('0xb7'),'attributes':['id',_0x59a4('0x31'),_0x59a4('0xb5')],'through':_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb6')]?{'attributes':[],'where':{'TagId':_0x36eee8['query'][_0x59a4('0xb6')]||undefined}}:{},'required':_0x36eee8[_0x59a4('0x8a')]['tag']?!![]:![]}];}else{_0x1550cf[_0x59a4('0xb3')]=[{'all':!![]}];}}return _0x139318[_0x496cea[_0x59a4('0x11')]]['findAll'](_0x1550cf);})[_0x59a4('0x5')](function(_0x52beba){_0x347a31[_0x59a4('0xb8')]=_0x52beba;if(_0x2f9592===_0x59a4('0x30')&&_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb9')]===_0x59a4('0xba')){var _0x496ef0=[];for(var _0x1e3325=0x0;_0x1e3325<_0x347a31['rows'][_0x59a4('0x8f')];_0x1e3325++){_0x496ef0[_0x59a4('0x90')](_0x5c5e7a('chat',_0x347a31[_0x59a4('0xb8')][_0x1e3325][_0x59a4('0xbb')]));_0x496ef0[_0x59a4('0x90')](_0x5c5e7a(_0x59a4('0xbc'),_0x347a31['rows'][_0x1e3325][_0x59a4('0xbb')]));_0x496ef0[_0x59a4('0x90')](_0x5c5e7a(_0x59a4('0xbd'),_0x347a31['rows'][_0x1e3325]['dataValues']));_0x496ef0['push'](_0x5c5e7a(_0x59a4('0xbe'),_0x347a31[_0x59a4('0xb8')][_0x1e3325][_0x59a4('0xbb')]));_0x496ef0[_0x59a4('0x90')](_0x5c5e7a('openchannel',_0x347a31[_0x59a4('0xb8')][_0x1e3325][_0x59a4('0xbb')]));_0x496ef0['push'](_0x5c5e7a(_0x59a4('0xbf'),_0x347a31[_0x59a4('0xb8')][_0x1e3325][_0x59a4('0xbb')]));}return Promise['all'](_0x496ef0)[_0x59a4('0x5')](function(){return _0x347a31;});}return _0x347a31;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 6489c0c..05c3258 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 _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 +var _0x5fab=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./userProfile.socket','register'];(function(_0x5e2cb4,_0x592c64){var _0x282902=function(_0x1c1836){while(--_0x1c1836){_0x5e2cb4['push'](_0x5e2cb4['shift']());}};_0x282902(++_0x592c64);}(_0x5fab,0x177));var _0xb5fa=function(_0x1b5a5a,_0x1c3b75){_0x1b5a5a=_0x1b5a5a-0x0;var _0x42b32d=_0x5fab[_0x1b5a5a];return _0x42b32d;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});config['redis']=_[_0xb5fa('0xc')](config[_0xb5fa('0xd')],{'host':_0xb5fa('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0xd')]));require(_0xb5fa('0xf'))[_0xb5fa('0x10')](socket);function respondWithRpcPromise(_0x54c7eb,_0x5b5ea8,_0x3a8e1b){return new BPromise(function(_0x23d124,_0xe46b26){return client[_0xb5fa('0x11')](_0x54c7eb,_0x3a8e1b)[_0xb5fa('0x12')](function(_0xadef41){logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));logger['debug'](_0xb5fa('0x16'),_0x5b5ea8,_0xb5fa('0x15'),JSON['stringify'](_0xadef41));if(_0xadef41[_0xb5fa('0x17')]){if(_0xadef41['error'][_0xb5fa('0x18')]===0x1f4){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0xe46b26(_0xadef41['error']['message']);}logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x23d124(_0xadef41['error']['message']);}else{logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));_0x23d124(_0xadef41[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x3b0f69){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0x3b0f69);_0xe46b26(_0x3b0f69);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ec5b00b..cc2092e 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 _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 +var _0xd6e5=['save','remove','emit','removeListener','register','length','userProfile:'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xd6e5,0xa8));var _0x5d6e=function(_0x9c4fe7,_0x1bdc80){_0x9c4fe7=_0x9c4fe7-0x0;var _0x1b3c03=_0xd6e5[_0x9c4fe7];return _0x1b3c03;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x5d6e('0x0'),_0x5d6e('0x1'),'update'];function createListener(_0x3b5ad3,_0x43a8df){return function(_0x1289a8){_0x43a8df[_0x5d6e('0x2')](_0x3b5ad3,_0x1289a8);};}function removeListener(_0x343257,_0x35f4e4){return function(){UserProfileEvents[_0x5d6e('0x3')](_0x343257,_0x35f4e4);};}exports[_0x5d6e('0x4')]=function(_0x7b2078){for(var _0x4adae2=0x0,_0x391d57=events[_0x5d6e('0x5')];_0x4adae2<_0x391d57;_0x4adae2++){var _0x488fd4=events[_0x4adae2];var _0x1cfa52=createListener(_0x5d6e('0x6')+_0x488fd4,_0x7b2078);UserProfileEvents['on'](_0x488fd4,_0x1cfa52);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 34adbe7..f23963b 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 _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 +var _0xb296=['/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','index','get','/describe','isAuthenticated','describe','show','post','create','put'];(function(_0x1f2bc1,_0x46bf9a){var _0x271a67=function(_0x51262e){while(--_0x51262e){_0x1f2bc1['push'](_0x1f2bc1['shift']());}};_0x271a67(++_0x46bf9a);}(_0xb296,0xeb));var _0x6b29=function(_0x24865d,_0xabe09a){_0x24865d=_0x24865d-0x0;var _0x42d927=_0xb296[_0x24865d];return _0x42d927;};'use strict';var multer=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var path=require('path');var timeout=require(_0x6b29('0x2'));var express=require(_0x6b29('0x3'));var router=express[_0x6b29('0x4')]();var fs_extra=require(_0x6b29('0x5'));var auth=require(_0x6b29('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b29('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6b29('0x8')]);router[_0x6b29('0x9')](_0x6b29('0xa'),auth[_0x6b29('0xb')](),controller[_0x6b29('0xc')]);router[_0x6b29('0x9')]('/:id',auth[_0x6b29('0xb')](),controller[_0x6b29('0xd')]);router[_0x6b29('0xe')]('/',auth[_0x6b29('0xb')](),controller[_0x6b29('0xf')]);router[_0x6b29('0x10')](_0x6b29('0x11'),auth[_0x6b29('0xb')](),controller[_0x6b29('0x12')]);router[_0x6b29('0x13')]('/:id',auth[_0x6b29('0xb')](),controller[_0x6b29('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 71e0a64..d3d716e 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 _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 +var _0xf92a=['sequelize','STRING'];(function(_0x23857c,_0x518d73){var _0x3fb991=function(_0x6f12bf){while(--_0x6f12bf){_0x23857c['push'](_0x23857c['shift']());}};_0x3fb991(++_0x518d73);}(_0xf92a,0xe8));var _0xaf92=function(_0x132886,_0x1b56cb){_0x132886=_0x132886-0x0;var _0x333c46=_0xf92a[_0x132886];return _0x333c46;};'use strict';var Sequelize=require(_0xaf92('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xaf92('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a8f2443..fd713b4 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 _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 +var _0xadb5=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','keys'];(function(_0x57d843,_0x2a95e0){var _0x42ba2d=function(_0x46cb71){while(--_0x46cb71){_0x57d843['push'](_0x57d843['shift']());}};_0x42ba2d(++_0x2a95e0);}(_0xadb5,0xad));var _0x5adb=function(_0x3e8dc4,_0x2564db){_0x3e8dc4=_0x3e8dc4-0x0;var _0x27d8db=_0xadb5[_0x3e8dc4];return _0x27d8db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['UserProfileResource']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['UserProfileResource'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['UserProfileResource'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));};exports['describe']=function(_0x36b847,_0x3a5703){return db[_0x5adb('0x2a')][_0x5adb('0x49')]()['then'](respondWithResult(_0x3a5703,null))[_0x5adb('0x42')](handleError(_0x3a5703,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index f733661..e9df23b 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 _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 +var _0xf992=['UserProfileResource','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','define'];(function(_0x34b084,_0x363eb9){var _0x460d98=function(_0xb4a921){while(--_0xb4a921){_0x34b084['push'](_0x34b084['shift']());}};_0x460d98(++_0x363eb9);}(_0xf992,0x82));var _0x2f99=function(_0x3ac5bb,_0x1dcb4c){_0x3ac5bb=_0x3ac5bb-0x0;var _0x27078d=_0xf992[_0x3ac5bb];return _0x27078d;};'use strict';var _=require(_0x2f99('0x0'));var util=require('util');var logger=require(_0x2f99('0x1'))(_0x2f99('0x2'));var moment=require(_0x2f99('0x3'));var BPromise=require(_0x2f99('0x4'));var rp=require(_0x2f99('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f99('0x6'));var config=require(_0x2f99('0x7'));var attributes=require(_0x2f99('0x8'));module['exports']=function(_0x39fcf8,_0x157c6a){return _0x39fcf8[_0x2f99('0x9')](_0x2f99('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x2f99('0xb'),'fields':[_0x2f99('0xc'),_0x2f99('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index eb4ff47..b07b8d1 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 _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 +var _0xad14=['client','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','error','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xad14,0x9e));var _0x4ad1=function(_0x599d7f,_0xc586e8){_0x599d7f=_0x599d7f-0x0;var _0x3346d3=_0xad14[_0x599d7f];return _0x3346d3;};'use strict';var _=require(_0x4ad1('0x0'));var util=require(_0x4ad1('0x1'));var moment=require(_0x4ad1('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ad1('0x3'));var fs=require('fs');var Redis=require(_0x4ad1('0x4'));var db=require(_0x4ad1('0x5'))['db'];var utils=require(_0x4ad1('0x6'));var logger=require(_0x4ad1('0x7'))('rpc');var config=require(_0x4ad1('0x8'));var jayson=require(_0x4ad1('0x9'));var client=jayson[_0x4ad1('0xa')][_0x4ad1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b2180,_0x6ffc9f,_0x47ac66){return new BPromise(function(_0x1ec137,_0x5af628){return client[_0x4ad1('0xc')](_0x5b2180,_0x47ac66)['then'](function(_0x259610){logger[_0x4ad1('0xd')](_0x4ad1('0xe'),_0x6ffc9f,'request\x20sent');logger[_0x4ad1('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x6ffc9f,'request\x20sent',JSON['stringify'](_0x259610));if(_0x259610[_0x4ad1('0x10')]){if(_0x259610[_0x4ad1('0x10')]['code']===0x1f4){logger[_0x4ad1('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x6ffc9f,_0x259610[_0x4ad1('0x10')][_0x4ad1('0x11')]);return _0x5af628(_0x259610['error'][_0x4ad1('0x11')]);}logger['error'](_0x4ad1('0xe'),_0x6ffc9f,_0x259610['error'][_0x4ad1('0x11')]);return _0x1ec137(_0x259610[_0x4ad1('0x10')][_0x4ad1('0x11')]);}else{logger[_0x4ad1('0xd')](_0x4ad1('0xe'),_0x6ffc9f,_0x4ad1('0x12'));_0x1ec137(_0x259610[_0x4ad1('0x13')][_0x4ad1('0x11')]);}})[_0x4ad1('0x14')](function(_0x6ceff1){logger[_0x4ad1('0x10')](_0x4ad1('0xe'),_0x6ffc9f,_0x6ceff1);_0x5af628(_0x6ceff1);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 581ef7c..16986aa 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 _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 +var _0xcfa1=['get','isAuthenticated','/describe','describe','/:id','show','create','put','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller'];(function(_0x165c16,_0x400108){var _0x48ea7b=function(_0x55149a){while(--_0x55149a){_0x165c16['push'](_0x165c16['shift']());}};_0x48ea7b(++_0x400108);}(_0xcfa1,0xf8));var _0x1cfa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcfa1[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x1cfa('0x0'));var util=require('util');var path=require(_0x1cfa('0x1'));var timeout=require(_0x1cfa('0x2'));var express=require('express');var router=express[_0x1cfa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cfa('0x4'));var interaction=require(_0x1cfa('0x5'));var config=require(_0x1cfa('0x6'));var controller=require(_0x1cfa('0x7'));router[_0x1cfa('0x8')]('/',auth[_0x1cfa('0x9')](),controller['index']);router[_0x1cfa('0x8')](_0x1cfa('0xa'),auth[_0x1cfa('0x9')](),controller[_0x1cfa('0xb')]);router[_0x1cfa('0x8')](_0x1cfa('0xc'),auth['isAuthenticated'](),controller[_0x1cfa('0xd')]);router['post']('/',auth[_0x1cfa('0x9')](),controller[_0x1cfa('0xe')]);router[_0x1cfa('0xf')](_0x1cfa('0xc'),auth[_0x1cfa('0x9')](),controller['update']);router['delete'](_0x1cfa('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 17aa504..1bce228 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 _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 +var _0x57f8=['join','getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0x57f8,0x198));var _0x857f=function(_0x1be7fd,_0x51ff5a){_0x1be7fd=_0x1be7fd-0x0;var _0x2f7949=_0x57f8[_0x1be7fd];return _0x2f7949;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'name':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x857f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x857f('0x1')],'set':function(_0x6f054b){this[_0x857f('0x4')](_0x857f('0x5'),_0x6f054b?_0x6f054b[_0x857f('0x6')](''):[]);},'get':function(){return this[_0x857f('0x7')]('crudPermissions')?this[_0x857f('0x7')](_0x857f('0x5'))[_0x857f('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index aebe1c4..2e7b4a3 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 _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 +var _0xaafb=['model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','keys','query','intersection'];(function(_0x5752cc,_0x4b0504){var _0x3c82e4=function(_0x54caee){while(--_0x54caee){_0x5752cc['push'](_0x5752cc['shift']());}};_0x3c82e4(++_0x4b0504);}(_0xaafb,0x18e));var _0xbaaf=function(_0x18f085,_0x34d9fd){_0x18f085=_0x18f085-0x0;var _0x1ba93d=_0xaafb[_0x18f085];return _0x1ba93d;};'use strict';var emlformat=require(_0xbaaf('0x0'));var rimraf=require(_0xbaaf('0x1'));var zipdir=require(_0xbaaf('0x2'));var jsonpatch=require(_0xbaaf('0x3'));var rp=require(_0xbaaf('0x4'));var moment=require(_0xbaaf('0x5'));var BPromise=require(_0xbaaf('0x6'));var Mustache=require(_0xbaaf('0x7'));var util=require(_0xbaaf('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xbaaf('0x9'));var ejs=require(_0xbaaf('0xa'));var fs=require('fs');var fs_extra=require(_0xbaaf('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbaaf('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbaaf('0x9'));var querystring=require(_0xbaaf('0xd'));var Papa=require('papaparse');var Redis=require(_0xbaaf('0xe'));var authService=require(_0xbaaf('0xf'));var qs=require(_0xbaaf('0x10'));var as=require(_0xbaaf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbaaf('0x12'))(_0xbaaf('0x13'));var utils=require('../../config/utils');var config=require(_0xbaaf('0x14'));var licenseUtil=require(_0xbaaf('0x15'));var db=require(_0xbaaf('0x16'))['db'];function respondWithStatusCode(_0x5d0ad6,_0x6b5f0e){_0x6b5f0e=_0x6b5f0e||0xcc;return function(_0x365bbb){if(_0x365bbb){return _0x5d0ad6['sendStatus'](_0x6b5f0e);}return _0x5d0ad6[_0xbaaf('0x17')](_0x6b5f0e)['end']();};}function respondWithResult(_0xeb47bb,_0x5ee01b){_0x5ee01b=_0x5ee01b||0xc8;return function(_0x4e75fe){if(_0x4e75fe){return _0xeb47bb[_0xbaaf('0x17')](_0x5ee01b)[_0xbaaf('0x18')](_0x4e75fe);}};}function respondWithFilteredResult(_0x4dfc80,_0x4f0e98){return function(_0x2550ba){if(_0x2550ba){var _0x1355e9=typeof _0x4f0e98[_0xbaaf('0x19')]===_0xbaaf('0x1a')&&typeof _0x4f0e98[_0xbaaf('0x1b')]===_0xbaaf('0x1a');var _0x114ae2=_0x2550ba[_0xbaaf('0x1c')];var _0x5051dc=_0x1355e9?0x0:_0x4f0e98['offset'];var _0x347914=_0x1355e9?_0x2550ba['count']:_0x4f0e98[_0xbaaf('0x19')]+_0x4f0e98[_0xbaaf('0x1b')];var _0x5e2a06;if(_0x347914>=_0x114ae2){_0x347914=_0x114ae2;_0x5e2a06=0xc8;}else{_0x5e2a06=0xce;}_0x4dfc80[_0xbaaf('0x17')](_0x5e2a06);return _0x4dfc80[_0xbaaf('0x1d')](_0xbaaf('0x1e'),_0x5051dc+'-'+_0x347914+'/'+_0x114ae2)[_0xbaaf('0x18')](_0x2550ba);}return null;};}function patchUpdates(_0x23eed8){return function(_0x14e16a){try{jsonpatch['apply'](_0x14e16a,_0x23eed8,!![]);}catch(_0x24e921){return BPromise[_0xbaaf('0x1f')](_0x24e921);}return _0x14e16a[_0xbaaf('0x20')]();};}function saveUpdates(_0x205d6a,_0x1939b2){return function(_0x1e2588){if(_0x1e2588){return _0x1e2588[_0xbaaf('0x21')](_0x205d6a)[_0xbaaf('0x22')](function(_0x4ca7e3){return _0x4ca7e3;});}return null;};}function removeEntity(_0x36e367,_0x2b79d9){return function(_0x2aadf4){if(_0x2aadf4){return _0x2aadf4[_0xbaaf('0x23')]()[_0xbaaf('0x22')](function(){_0x36e367[_0xbaaf('0x17')](0xcc)[_0xbaaf('0x24')]();});}};}function handleEntityNotFound(_0x46940b,_0x142a0f){return function(_0x492f1b){if(!_0x492f1b){_0x46940b[_0xbaaf('0x25')](0x194);}return _0x492f1b;};}function handleError(_0x136fa6,_0x4fee3d){_0x4fee3d=_0x4fee3d||0x1f4;return function(_0x3e32da){logger[_0xbaaf('0x26')](_0x3e32da[_0xbaaf('0x27')]);if(_0x3e32da[_0xbaaf('0x28')]){delete _0x3e32da['name'];}_0x136fa6[_0xbaaf('0x17')](_0x4fee3d)[_0xbaaf('0x29')](_0x3e32da);};}exports[_0xbaaf('0x2a')]=function(_0x252c78,_0x2534bd){var _0xe11ac7={},_0x39a837={},_0x13b54b={'count':0x0,'rows':[]};var _0x296f39=_[_0xbaaf('0x2b')](db[_0xbaaf('0x2c')][_0xbaaf('0x2d')],function(_0xc6d05f){return{'name':_0xc6d05f[_0xbaaf('0x2e')],'type':_0xc6d05f[_0xbaaf('0x2f')][_0xbaaf('0x30')]};});_0x39a837['model']=_[_0xbaaf('0x2b')](_0x296f39,_0xbaaf('0x28'));_0x39a837['query']=_[_0xbaaf('0x31')](_0x252c78[_0xbaaf('0x32')]);_0x39a837['filters']=_[_0xbaaf('0x33')](_0x39a837[_0xbaaf('0x34')],_0x39a837[_0xbaaf('0x32')]);_0xe11ac7[_0xbaaf('0x35')]=_['intersection'](_0x39a837[_0xbaaf('0x34')],qs[_0xbaaf('0x36')](_0x252c78[_0xbaaf('0x32')]['fields']));_0xe11ac7[_0xbaaf('0x35')]=_0xe11ac7[_0xbaaf('0x35')][_0xbaaf('0x37')]?_0xe11ac7['attributes']:_0x39a837[_0xbaaf('0x34')];if(!_0x252c78[_0xbaaf('0x32')]['hasOwnProperty'](_0xbaaf('0x38'))){_0xe11ac7[_0xbaaf('0x1b')]=qs['limit'](_0x252c78[_0xbaaf('0x32')][_0xbaaf('0x1b')]);_0xe11ac7[_0xbaaf('0x19')]=qs['offset'](_0x252c78[_0xbaaf('0x32')][_0xbaaf('0x19')]);}_0xe11ac7['order']=qs[_0xbaaf('0x39')](_0x252c78[_0xbaaf('0x32')][_0xbaaf('0x39')]);_0xe11ac7[_0xbaaf('0x3a')]=qs[_0xbaaf('0x3b')](_[_0xbaaf('0x3c')](_0x252c78[_0xbaaf('0x32')],_0x39a837[_0xbaaf('0x3b')]),_0x296f39);if(_0x252c78[_0xbaaf('0x32')][_0xbaaf('0x3d')]){_0xe11ac7['where']=_['merge'](_0xe11ac7[_0xbaaf('0x3a')],{'$or':_[_0xbaaf('0x2b')](_0x296f39,function(_0x58eca3){if(_0x58eca3['type']!==_0xbaaf('0x3e')){var _0x4b6e9f={};_0x4b6e9f[_0x58eca3[_0xbaaf('0x28')]]={'$like':'%'+_0x252c78[_0xbaaf('0x32')][_0xbaaf('0x3d')]+'%'};return _0x4b6e9f;}})});}_0xe11ac7=_[_0xbaaf('0x3f')]({},_0xe11ac7,_0x252c78[_0xbaaf('0x40')]);var _0x4e7864={'where':_0xe11ac7[_0xbaaf('0x3a')]};return db[_0xbaaf('0x2c')][_0xbaaf('0x1c')](_0x4e7864)[_0xbaaf('0x22')](function(_0xc32e29){_0x13b54b[_0xbaaf('0x1c')]=_0xc32e29;if(_0x252c78['query'][_0xbaaf('0x41')]){_0xe11ac7[_0xbaaf('0x42')]=[{'all':!![]}];}return db[_0xbaaf('0x2c')][_0xbaaf('0x43')](_0xe11ac7);})[_0xbaaf('0x22')](function(_0x4001cd){_0x13b54b[_0xbaaf('0x44')]=_0x4001cd;return _0x13b54b;})[_0xbaaf('0x22')](respondWithFilteredResult(_0x2534bd,_0xe11ac7))['catch'](handleError(_0x2534bd,null));};exports[_0xbaaf('0x45')]=function(_0x532f43,_0x2ae315){var _0x13c17f={'raw':![],'where':{'id':_0x532f43[_0xbaaf('0x46')]['id']}},_0x484ade={};_0x484ade[_0xbaaf('0x34')]=_[_0xbaaf('0x31')](db[_0xbaaf('0x2c')][_0xbaaf('0x2d')]);_0x484ade[_0xbaaf('0x32')]=_['keys'](_0x532f43[_0xbaaf('0x32')]);_0x484ade[_0xbaaf('0x3b')]=_[_0xbaaf('0x33')](_0x484ade[_0xbaaf('0x34')],_0x484ade[_0xbaaf('0x32')]);_0x13c17f[_0xbaaf('0x35')]=_[_0xbaaf('0x33')](_0x484ade['model'],qs['fields'](_0x532f43[_0xbaaf('0x32')][_0xbaaf('0x36')]));_0x13c17f['attributes']=_0x13c17f[_0xbaaf('0x35')][_0xbaaf('0x37')]?_0x13c17f[_0xbaaf('0x35')]:_0x484ade[_0xbaaf('0x34')];if(_0x532f43[_0xbaaf('0x32')][_0xbaaf('0x41')]){_0x13c17f[_0xbaaf('0x42')]=[{'all':!![]}];}_0x13c17f=_['merge']({},_0x13c17f,_0x532f43[_0xbaaf('0x40')]);return db[_0xbaaf('0x2c')][_0xbaaf('0x47')](_0x13c17f)[_0xbaaf('0x22')](handleEntityNotFound(_0x2ae315,null))[_0xbaaf('0x22')](respondWithResult(_0x2ae315,null))[_0xbaaf('0x48')](handleError(_0x2ae315,null));};exports[_0xbaaf('0x49')]=function(_0x1f7452,_0x235a19){return db[_0xbaaf('0x2c')]['create'](_0x1f7452[_0xbaaf('0x4a')],{})['then'](respondWithResult(_0x235a19,0xc9))[_0xbaaf('0x48')](handleError(_0x235a19,null));};exports['update']=function(_0x5a161b,_0x472b51){if(_0x5a161b[_0xbaaf('0x4a')]['id']){delete _0x5a161b[_0xbaaf('0x4a')]['id'];}return db[_0xbaaf('0x2c')][_0xbaaf('0x47')]({'where':{'id':_0x5a161b[_0xbaaf('0x46')]['id']}})[_0xbaaf('0x22')](handleEntityNotFound(_0x472b51,null))[_0xbaaf('0x22')](saveUpdates(_0x5a161b[_0xbaaf('0x4a')],null))[_0xbaaf('0x22')](respondWithResult(_0x472b51,null))[_0xbaaf('0x48')](handleError(_0x472b51,null));};exports['destroy']=function(_0x213c7f,_0x5157ab){return db[_0xbaaf('0x2c')][_0xbaaf('0x47')]({'where':{'id':_0x213c7f[_0xbaaf('0x46')]['id']}})[_0xbaaf('0x22')](handleEntityNotFound(_0x5157ab,null))[_0xbaaf('0x22')](removeEntity(_0x5157ab,null))[_0xbaaf('0x48')](handleError(_0x5157ab,null));};exports['describe']=function(_0xd05bf9,_0x3bce34){return db[_0xbaaf('0x2c')]['describe']()[_0xbaaf('0x22')](respondWithResult(_0x3bce34,null))['catch'](handleError(_0x3bce34,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 7c56923..3ae6fbb 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 _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 +var _0xf466=['moment','bluebird','path','../../config/environment','exports','user_profile_has_sections','sectionId','userProfileId','lodash','../../config/logger','api'];(function(_0x94cfd7,_0xaab212){var _0x3d88aa=function(_0x41ce85){while(--_0x41ce85){_0x94cfd7['push'](_0x94cfd7['shift']());}};_0x3d88aa(++_0xaab212);}(_0xf466,0x110));var _0x6f46=function(_0x7a0496,_0x3b4dbc){_0x7a0496=_0x7a0496-0x0;var _0x4d5a25=_0xf466[_0x7a0496];return _0x4d5a25;};'use strict';var _=require(_0x6f46('0x0'));var util=require('util');var logger=require(_0x6f46('0x1'))(_0x6f46('0x2'));var moment=require(_0x6f46('0x3'));var BPromise=require(_0x6f46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f46('0x5'));var rimraf=require('rimraf');var config=require(_0x6f46('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x6f46('0x7')]=function(_0x3976d7,_0xef0c2d){return _0x3976d7['define']('UserProfileSection',attributes,{'tableName':_0x6f46('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6f46('0x9'),_0x6f46('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 690e548..1167692 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 _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 +var _0xe52b=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe52b,0x11a));var _0xbe52=function(_0x492c4e,_0xae9e96){_0x492c4e=_0x492c4e-0x0;var _0x1d1ade=_0xe52b[_0x492c4e];return _0x1d1ade;};'use strict';var _=require(_0xbe52('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe52('0x1'));var fs=require('fs');var Redis=require(_0xbe52('0x2'));var db=require(_0xbe52('0x3'))['db'];var utils=require(_0xbe52('0x4'));var logger=require('../../config/logger')(_0xbe52('0x5'));var config=require('../../config/environment');var jayson=require(_0xbe52('0x6'));var client=jayson[_0xbe52('0x7')][_0xbe52('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x379e1d,_0x5594af,_0x41bf76){return new BPromise(function(_0x310c3f,_0x329d9f){return client[_0xbe52('0x9')](_0x379e1d,_0x41bf76)['then'](function(_0x255657){logger[_0xbe52('0xa')](_0xbe52('0xb'),_0x5594af,'request\x20sent');logger[_0xbe52('0xc')](_0xbe52('0xd'),_0x5594af,_0xbe52('0xe'),JSON[_0xbe52('0xf')](_0x255657));if(_0x255657[_0xbe52('0x10')]){if(_0x255657[_0xbe52('0x10')][_0xbe52('0x11')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5594af,_0x255657[_0xbe52('0x10')][_0xbe52('0x12')]);return _0x329d9f(_0x255657[_0xbe52('0x10')][_0xbe52('0x12')]);}logger[_0xbe52('0x10')](_0xbe52('0xb'),_0x5594af,_0x255657[_0xbe52('0x10')][_0xbe52('0x12')]);return _0x310c3f(_0x255657['error'][_0xbe52('0x12')]);}else{logger[_0xbe52('0xa')](_0xbe52('0xb'),_0x5594af,_0xbe52('0xe'));_0x310c3f(_0x255657[_0xbe52('0x13')][_0xbe52('0x12')]);}})[_0xbe52('0x14')](function(_0x3aea2f){logger[_0xbe52('0x10')](_0xbe52('0xb'),_0x5594af,_0x3aea2f);_0x329d9f(_0x3aea2f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b144360..94acd4b 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 _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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xa22583,_0x564cdd){var _0x3e2d07=function(_0x56520a){while(--_0x56520a){_0xa22583['push'](_0xa22583['shift']());}};_0x3e2d07(++_0x564cdd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 43e7583..967b739 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 _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 +var _0xbc1c=['exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xbc1c[_0x172948];return _0x4aeaa9;};'use strict';var Sequelize=require('sequelize');module[_0xcbc1('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index b1ff5b5..e412cc6 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 _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 +var _0x8085=['define','UserSmsQueue','user_has_sms_queues','lodash','api','moment','bluebird','request-promise','../../config/environment','./userSmsQueue.attributes'];(function(_0x22e11c,_0x32ef49){var _0x4fd8ed=function(_0x1098b7){while(--_0x1098b7){_0x22e11c['push'](_0x22e11c['shift']());}};_0x4fd8ed(++_0x32ef49);}(_0x8085,0x71));var _0x5808=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x8085[_0x2fee96];return _0x2e6ad1;};'use strict';var _=require(_0x5808('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5808('0x1'));var moment=require(_0x5808('0x2'));var BPromise=require(_0x5808('0x3'));var rp=require(_0x5808('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5808('0x5'));var attributes=require(_0x5808('0x6'));module['exports']=function(_0x17f899,_0x749306){return _0x17f899[_0x5808('0x7')](_0x5808('0x8'),attributes,{'tableName':_0x5808('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index d8d2566..cd10fd1 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 _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 +var _0xb351=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','request\x20sent','result','lodash'];(function(_0x1fda27,_0x18fa92){var _0x477640=function(_0x347bf){while(--_0x347bf){_0x1fda27['push'](_0x1fda27['shift']());}};_0x477640(++_0x18fa92);}(_0xb351,0x1cd));var _0x1b35=function(_0x1fc454,_0x47e609){_0x1fc454=_0x1fc454-0x0;var _0x1a7994=_0xb351[_0x1fc454];return _0x1a7994;};'use strict';var _=require(_0x1b35('0x0'));var util=require('util');var moment=require(_0x1b35('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b35('0x2'));var fs=require('fs');var Redis=require(_0x1b35('0x3'));var db=require(_0x1b35('0x4'))['db'];var utils=require(_0x1b35('0x5'));var logger=require(_0x1b35('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1b35('0x7'));var client=jayson[_0x1b35('0x8')][_0x1b35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bcceb,_0x5e2904,_0x1f0a1f){return new BPromise(function(_0x2e944b,_0x319c7a){return client[_0x1b35('0xa')](_0x2bcceb,_0x1f0a1f)[_0x1b35('0xb')](function(_0xb4db03){logger[_0x1b35('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x5e2904,'request\x20sent');logger[_0x1b35('0xd')](_0x1b35('0xe'),_0x5e2904,'request\x20sent',JSON[_0x1b35('0xf')](_0xb4db03));if(_0xb4db03[_0x1b35('0x10')]){if(_0xb4db03[_0x1b35('0x10')][_0x1b35('0x11')]===0x1f4){logger[_0x1b35('0x10')](_0x1b35('0x12'),_0x5e2904,_0xb4db03[_0x1b35('0x10')]['message']);return _0x319c7a(_0xb4db03[_0x1b35('0x10')][_0x1b35('0x13')]);}logger[_0x1b35('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x5e2904,_0xb4db03['error'][_0x1b35('0x13')]);return _0x2e944b(_0xb4db03[_0x1b35('0x10')]['message']);}else{logger[_0x1b35('0xc')](_0x1b35('0x12'),_0x5e2904,_0x1b35('0x14'));_0x2e944b(_0xb4db03[_0x1b35('0x15')]['message']);}})['catch'](function(_0x378421){logger[_0x1b35('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x5e2904,_0x378421);_0x319c7a(_0x378421);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 8974046..d6e2a33 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 _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 +var _0xda99=['sequelize','exports','INTEGER'];(function(_0x1af909,_0x422cba){var _0x24ec10=function(_0x48a334){while(--_0x48a334){_0x1af909['push'](_0x1af909['shift']());}};_0x24ec10(++_0x422cba);}(_0xda99,0x17a));var _0x9da9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda99[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9da9('0x0'));module[_0x9da9('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x9da9('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 2a13757..3419599 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(_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 +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x590796,_0x2e4436){var _0x16e0a6=function(_0x5cea16){while(--_0x5cea16){_0x590796['push'](_0x590796['shift']());}};_0x16e0a6(++_0x2e4436);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 9abb62c..1dd81e2 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 _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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2e4574,_0x2e7660){var _0x15d5a5=function(_0x3e0df7){while(--_0x3e0df7){_0x2e4574['push'](_0x2e4574['shift']());}};_0x15d5a5(++_0x2e7660);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 7bd8b9a..a29eed1 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 _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 +var _0x048f=['exports'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x048f,0x1e4));var _0xf048=function(_0x174ed5,_0x2c06ff){_0x174ed5=_0x174ed5-0x0;var _0x6af1f6=_0x048f[_0x174ed5];return _0x6af1f6;};'use strict';var Sequelize=require('sequelize');module[_0xf048('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index f578f1d..eeaebd5 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 _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 +var _0x9fe2=['exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes'];(function(_0x5723e4,_0x2231b1){var _0x2819e4=function(_0x433e95){while(--_0x433e95){_0x5723e4['push'](_0x5723e4['shift']());}};_0x2819e4(++_0x2231b1);}(_0x9fe2,0x196));var _0x29fe=function(_0x5de258,_0x568c2b){_0x5de258=_0x5de258-0x0;var _0x5e1705=_0x9fe2[_0x5de258];return _0x5e1705;};'use strict';var _=require(_0x29fe('0x0'));var util=require(_0x29fe('0x1'));var logger=require(_0x29fe('0x2'))(_0x29fe('0x3'));var moment=require(_0x29fe('0x4'));var BPromise=require(_0x29fe('0x5'));var rp=require(_0x29fe('0x6'));var fs=require('fs');var path=require(_0x29fe('0x7'));var rimraf=require(_0x29fe('0x8'));var config=require('../../config/environment');var attributes=require(_0x29fe('0x9'));module[_0x29fe('0xa')]=function(_0x19190e,_0x4e0d8b){return _0x19190e[_0x29fe('0xb')](_0x29fe('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 9098986..5085e18 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 _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 +var _0x5e65=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x41d184,_0xd9177c){var _0x1c2ba2=function(_0x54ecaf){while(--_0x54ecaf){_0x41d184['push'](_0x41d184['shift']());}};_0x1c2ba2(++_0xd9177c);}(_0x5e65,0x1c8));var _0x55e6=function(_0x183068,_0x5e9c83){_0x183068=_0x183068-0x0;var _0x2d2f83=_0x5e65[_0x183068];return _0x2d2f83;};'use strict';var _=require(_0x55e6('0x0'));var util=require(_0x55e6('0x1'));var moment=require('moment');var BPromise=require(_0x55e6('0x2'));var rs=require(_0x55e6('0x3'));var fs=require('fs');var Redis=require(_0x55e6('0x4'));var db=require(_0x55e6('0x5'))['db'];var utils=require(_0x55e6('0x6'));var logger=require(_0x55e6('0x7'))('rpc');var config=require(_0x55e6('0x8'));var jayson=require(_0x55e6('0x9'));var client=jayson[_0x55e6('0xa')][_0x55e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16ef52,_0x3e6e27,_0x5a5a5d){return new BPromise(function(_0x3263c4,_0x12418a){return client[_0x55e6('0xc')](_0x16ef52,_0x5a5a5d)[_0x55e6('0xd')](function(_0xb8b914){logger[_0x55e6('0xe')](_0x55e6('0xf'),_0x3e6e27,_0x55e6('0x10'));logger[_0x55e6('0x11')](_0x55e6('0x12'),_0x3e6e27,_0x55e6('0x10'),JSON[_0x55e6('0x13')](_0xb8b914));if(_0xb8b914[_0x55e6('0x14')]){if(_0xb8b914[_0x55e6('0x14')]['code']===0x1f4){logger['error'](_0x55e6('0xf'),_0x3e6e27,_0xb8b914[_0x55e6('0x14')]['message']);return _0x12418a(_0xb8b914['error'][_0x55e6('0x15')]);}logger['error'](_0x55e6('0xf'),_0x3e6e27,_0xb8b914[_0x55e6('0x14')][_0x55e6('0x15')]);return _0x3263c4(_0xb8b914[_0x55e6('0x14')][_0x55e6('0x15')]);}else{logger['info'](_0x55e6('0xf'),_0x3e6e27,_0x55e6('0x10'));_0x3263c4(_0xb8b914[_0x55e6('0x16')]['message']);}})[_0x55e6('0x17')](function(_0x50631d){logger[_0x55e6('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x3e6e27,_0x50631d);_0x12418a(_0x50631d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e29baad..2d40f86 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1cab3a,_0x283214){var _0x1b1c76=function(_0x3cfb45){while(--_0x3cfb45){_0x1cab3a['push'](_0x1cab3a['shift']());}};_0x1b1c76(++_0x283214);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 1588d3f..de6e3a6 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 _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 +var _0x9269=['INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk','exports'];(function(_0x20823b,_0x88604f){var _0x4a7a50=function(_0x5a8890){while(--_0x5a8890){_0x20823b['push'](_0x20823b['shift']());}};_0x4a7a50(++_0x88604f);}(_0x9269,0x1e9));var _0x9926=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x9269[_0x540dcb];return _0x49353c;};'use strict';var Sequelize=require('sequelize');module[_0x9926('0x0')]={'uniqueid':{'type':Sequelize[_0x9926('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x9926('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x9926('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9926('0x2')],'allowNull':![],'unique':_0x9926('0x3'),'comment':_0x9926('0x4')},'VoiceQueueId':{'type':Sequelize[_0x9926('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x9926('0x2')],'allowNull':![],'unique':_0x9926('0x3'),'comment':_0x9926('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x9926('0x4')},'paused':{'type':Sequelize[_0x9926('0x1')](0xb),'defaultValue':0x0,'comment':_0x9926('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 307e96e..bf4b780 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 _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 +var _0xe386=['update','emit','hasOwnProperty','hook','UserVoiceQueueRt','save'];(function(_0x58258f,_0x51e2d3){var _0x397e0b=function(_0x3bf712){while(--_0x3bf712){_0x58258f['push'](_0x58258f['shift']());}};_0x397e0b(++_0x51e2d3);}(_0xe386,0x70));var _0x6e38=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe386[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x6e38('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e38('0x1'),'afterUpdate':_0x6e38('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1acf9c){return function(_0x47c640,_0x4d50b6,_0x1d5e45){UserVoiceQueueRtEvents[_0x6e38('0x3')](_0x1acf9c+':'+_0x47c640['id'],_0x47c640);UserVoiceQueueRtEvents[_0x6e38('0x3')](_0x1acf9c,_0x47c640);_0x1d5e45(null);};}for(var e in events){if(events[_0x6e38('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x6e38('0x5')](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 5c3f29f..4f722cb 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 _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 +var _0x65fd=['request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','util','api','bluebird'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x65fd,0x10b));var _0xd65f=function(_0x1837bb,_0x8b1bf8){_0x1837bb=_0x1837bb-0x0;var _0x20d9da=_0x65fd[_0x1837bb];return _0x20d9da;};'use strict';var _=require('lodash');var util=require(_0xd65f('0x0'));var logger=require('../../config/logger')(_0xd65f('0x1'));var moment=require('moment');var BPromise=require(_0xd65f('0x2'));var rp=require(_0xd65f('0x3'));var fs=require('fs');var path=require(_0xd65f('0x4'));var rimraf=require(_0xd65f('0x5'));var config=require('../../config/environment');var attributes=require(_0xd65f('0x6'));module[_0xd65f('0x7')]=function(_0x48d2d4,_0x2dde7b){return _0x48d2d4[_0xd65f('0x8')](_0xd65f('0x9'),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 cef09e5..dc60a46 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 _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 +var _0x160a=['GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','literal','outboundQueuePauses','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x160a,0x1d1));var _0xa160=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x160a[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xa160('0x0'));var util=require('util');var moment=require(_0xa160('0x1'));var BPromise=require(_0xa160('0x2'));var rs=require(_0xa160('0x3'));var fs=require('fs');var Redis=require(_0xa160('0x4'));var db=require(_0xa160('0x5'))['db'];var utils=require(_0xa160('0x6'));var logger=require('../../config/logger')(_0xa160('0x7'));var config=require(_0xa160('0x8'));var jayson=require(_0xa160('0x9'));var client=jayson[_0xa160('0xa')][_0xa160('0xb')]({'port':0x232a});config[_0xa160('0xc')]=_[_0xa160('0xd')](config[_0xa160('0xc')],{'host':_0xa160('0xe'),'port':0x18eb});var socket=require(_0xa160('0xf'))(new Redis(config['redis']));require(_0xa160('0x10'))[_0xa160('0x11')](socket);function respondWithRpcPromise(_0xb944ea,_0x3d8c27,_0x48badf){return new BPromise(function(_0x2b73f4,_0x59b2c2){return client[_0xa160('0x12')](_0xb944ea,_0x48badf)[_0xa160('0x13')](function(_0x367baa){logger[_0xa160('0x14')](_0xa160('0x15'),_0x3d8c27,_0xa160('0x16'));logger[_0xa160('0x17')](_0xa160('0x18'),_0x3d8c27,'request\x20sent',JSON['stringify'](_0x367baa));if(_0x367baa['error']){if(_0x367baa[_0xa160('0x19')][_0xa160('0x1a')]===0x1f4){logger[_0xa160('0x19')](_0xa160('0x15'),_0x3d8c27,_0x367baa[_0xa160('0x19')][_0xa160('0x1b')]);return _0x59b2c2(_0x367baa[_0xa160('0x19')]['message']);}logger[_0xa160('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3d8c27,_0x367baa[_0xa160('0x19')][_0xa160('0x1b')]);return _0x2b73f4(_0x367baa[_0xa160('0x19')][_0xa160('0x1b')]);}else{logger[_0xa160('0x14')](_0xa160('0x15'),_0x3d8c27,_0xa160('0x16'));_0x2b73f4(_0x367baa['result'][_0xa160('0x1b')]);}})[_0xa160('0x1c')](function(_0x14b597){logger[_0xa160('0x19')](_0xa160('0x15'),_0x3d8c27,_0x14b597);_0x59b2c2(_0x14b597);});});}exports[_0xa160('0x1d')]=function(_0x551ce8){var _0x42f715=this;return new Promise(function(_0x5d163d,_0x4b7e58){return db[_0xa160('0x1e')]['findAll']({'raw':_0x551ce8[_0xa160('0x1f')]?_0x551ce8['options'][_0xa160('0x20')]===undefined?!![]:![]:!![],'where':_0x551ce8[_0xa160('0x1f')]?_0x551ce8[_0xa160('0x1f')][_0xa160('0x21')]||null:null,'attributes':[[db[_0xa160('0x22')]['fn']('COUNT',db[_0xa160('0x22')]['fn']('IF',db[_0xa160('0x22')][_0xa160('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0xa160('0x24')]]})['then'](function(_0x509aa1){logger[_0xa160('0x14')](_0xa160('0x1d'),_0x551ce8);logger[_0xa160('0x17')](_0xa160('0x1d'),_0x551ce8,JSON[_0xa160('0x25')](_0x509aa1));_0x5d163d(_0x509aa1);})[_0xa160('0x1c')](function(_0x5b975c){logger[_0xa160('0x19')](_0xa160('0x1d'),_0x5b975c['message'],_0x551ce8);_0x4b7e58(_0x42f715[_0xa160('0x19')](0x1f4,_0x5b975c[_0xa160('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 1aae701..6540068 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 _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 +var _0x51f2=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x499869,_0x159407){var _0x4a63b6=function(_0x2e0d16){while(--_0x2e0d16){_0x499869['push'](_0x499869['shift']());}};_0x4a63b6(++_0x159407);}(_0x51f2,0xeb));var _0x251f=function(_0x28b551,_0x219d02){_0x28b551=_0x28b551-0x0;var _0x11c17f=_0x51f2[_0x28b551];return _0x11c17f;};'use strict';var UserVoiceQueueRtEvents=require(_0x251f('0x0'));var events=[_0x251f('0x1'),_0x251f('0x2'),_0x251f('0x3')];function createListener(_0x2afc7f,_0x243816){return function(_0x1d0c48){_0x243816[_0x251f('0x4')](_0x2afc7f,_0x1d0c48);};}function removeListener(_0x1dd1c9,_0x4bc4be){return function(){UserVoiceQueueRtEvents[_0x251f('0x5')](_0x1dd1c9,_0x4bc4be);};}exports[_0x251f('0x6')]=function(_0x145630){for(var _0xd9d8e1=0x0,_0x18c6ab=events['length'];_0xd9d8e1<_0x18c6ab;_0xd9d8e1++){var _0x1f01da=events[_0xd9d8e1];var _0x37469e=createListener(_0x251f('0x7')+_0x1f01da,_0x145630);UserVoiceQueueRtEvents['on'](_0x1f01da,_0x37469e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index f4fb229..1ab3fee 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 _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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4cce3e,_0x4a1349){var _0x391e08=function(_0x4b6708){while(--_0x4b6708){_0x4cce3e['push'](_0x4cce3e['shift']());}};_0x391e08(++_0x4a1349);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 55c4bdb..7b7bf50 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 _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 +var _0xdb2f=['exports','INTEGER'];(function(_0x4454b2,_0x3f408b){var _0x50b8f1=function(_0x5bdbe8){while(--_0x5bdbe8){_0x4454b2['push'](_0x4454b2['shift']());}};_0x50b8f1(++_0x3f408b);}(_0xdb2f,0x1d8));var _0xfdb2=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xdb2f[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require('sequelize');module[_0xfdb2('0x0')]={'penalty':{'type':Sequelize[_0xfdb2('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index bd4c406..fc68fac 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 _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 +var _0xabe4=['exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5dfbc3,_0x57f31d){var _0x57218f=function(_0x9e07e1){while(--_0x9e07e1){_0x5dfbc3['push'](_0x5dfbc3['shift']());}};_0x57218f(++_0x57f31d);}(_0xabe4,0xdb));var _0x4abe=function(_0x4cb231,_0x3d3c5b){_0x4cb231=_0x4cb231-0x0;var _0x4d5063=_0xabe4[_0x4cb231];return _0x4d5063;};'use strict';var _=require(_0x4abe('0x0'));var util=require(_0x4abe('0x1'));var logger=require(_0x4abe('0x2'))(_0x4abe('0x3'));var moment=require(_0x4abe('0x4'));var BPromise=require(_0x4abe('0x5'));var rp=require(_0x4abe('0x6'));var fs=require('fs');var path=require(_0x4abe('0x7'));var rimraf=require(_0x4abe('0x8'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x4abe('0x9')]=function(_0x3daa22,_0x516554){return _0x3daa22[_0x4abe('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x4abe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 35dac60..6ee68a3 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 _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 +var _0x4a6f=['../../mysqldb','../../config/utils','rpc','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x212627,_0xba7fc9){var _0x3c9961=function(_0x1a551a){while(--_0x1a551a){_0x212627['push'](_0x212627['shift']());}};_0x3c9961(++_0xba7fc9);}(_0x4a6f,0x162));var _0xf4a6=function(_0x4bfff5,_0xbd2a67){_0x4bfff5=_0x4bfff5-0x0;var _0x2383bc=_0x4a6f[_0x4bfff5];return _0x2383bc;};'use strict';var _=require(_0xf4a6('0x0'));var util=require(_0xf4a6('0x1'));var moment=require(_0xf4a6('0x2'));var BPromise=require(_0xf4a6('0x3'));var rs=require(_0xf4a6('0x4'));var fs=require('fs');var Redis=require(_0xf4a6('0x5'));var db=require(_0xf4a6('0x6'))['db'];var utils=require(_0xf4a6('0x7'));var logger=require('../../config/logger')(_0xf4a6('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf4a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35d4d6,_0x3292f9,_0x580618){return new BPromise(function(_0x38e3d8,_0x20d3c2){return client[_0xf4a6('0xa')](_0x35d4d6,_0x580618)['then'](function(_0xb22c5e){logger[_0xf4a6('0xb')](_0xf4a6('0xc'),_0x3292f9,_0xf4a6('0xd'));logger[_0xf4a6('0xe')](_0xf4a6('0xf'),_0x3292f9,_0xf4a6('0xd'),JSON['stringify'](_0xb22c5e));if(_0xb22c5e[_0xf4a6('0x10')]){if(_0xb22c5e['error'][_0xf4a6('0x11')]===0x1f4){logger[_0xf4a6('0x10')](_0xf4a6('0xc'),_0x3292f9,_0xb22c5e[_0xf4a6('0x10')][_0xf4a6('0x12')]);return _0x20d3c2(_0xb22c5e[_0xf4a6('0x10')][_0xf4a6('0x12')]);}logger['error'](_0xf4a6('0xc'),_0x3292f9,_0xb22c5e['error'][_0xf4a6('0x12')]);return _0x38e3d8(_0xb22c5e[_0xf4a6('0x10')]['message']);}else{logger[_0xf4a6('0xb')](_0xf4a6('0xc'),_0x3292f9,_0xf4a6('0xd'));_0x38e3d8(_0xb22c5e['result']['message']);}})[_0xf4a6('0x13')](function(_0x5abc73){logger[_0xf4a6('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3292f9,_0x5abc73);_0x20d3c2(_0x5abc73);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 190768d..7730b4a 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 _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 +var _0x09dd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x09dd,0x81));var _0xd09d=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0x09dd[_0x35181c];return _0xe14bf9;};'use strict';var multer=require(_0xd09d('0x0'));var util=require(_0xd09d('0x1'));var path=require(_0xd09d('0x2'));var timeout=require(_0xd09d('0x3'));var express=require(_0xd09d('0x4'));var router=express[_0xd09d('0x5')]();var fs_extra=require(_0xd09d('0x6'));var auth=require(_0xd09d('0x7'));var interaction=require(_0xd09d('0x8'));var config=require(_0xd09d('0x9'));var controller=require(_0xd09d('0xa'));router[_0xd09d('0xb')]('/',auth[_0xd09d('0xc')](),controller[_0xd09d('0xd')]);router['get'](_0xd09d('0xe'),auth[_0xd09d('0xc')](),controller[_0xd09d('0xf')]);router[_0xd09d('0x10')]('/',auth[_0xd09d('0xc')](),controller[_0xd09d('0x11')]);router[_0xd09d('0x12')]('/:id',auth[_0xd09d('0xc')](),controller[_0xd09d('0x13')]);router[_0xd09d('0x14')](_0xd09d('0xe'),auth[_0xd09d('0xc')](),controller['destroy']);module[_0xd09d('0x15')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d309b39..2bac1bc 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 _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 +var _0x0238=['exports','STRING','name','sequelize'];(function(_0x5376c6,_0xba32d2){var _0x3f923b=function(_0x1ab61c){while(--_0x1ab61c){_0x5376c6['push'](_0x5376c6['shift']());}};_0x3f923b(++_0xba32d2);}(_0x0238,0x1cf));var _0x8023=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x0238[_0x15b380];return _0x232c5c;};'use strict';var Sequelize=require(_0x8023('0x0'));module[_0x8023('0x1')]={'name':{'type':Sequelize[_0x8023('0x2')],'unique':_0x8023('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 6b82b88..480c5e4 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 _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 +var _0xf825=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','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','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','Variables','UserProfileResource','destroy','error','stack','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','name','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x688546,_0x349b41){var _0x75b742=function(_0x297c7d){while(--_0x297c7d){_0x688546['push'](_0x688546['shift']());}};_0x75b742(++_0x349b41);}(_0xf825,0x15e));var _0x5f82=function(_0x42935c,_0x42da45){_0x42935c=_0x42935c-0x0;var _0x4758c7=_0xf825[_0x42935c];return _0x4758c7;};'use strict';var emlformat=require(_0x5f82('0x0'));var rimraf=require(_0x5f82('0x1'));var zipdir=require(_0x5f82('0x2'));var jsonpatch=require(_0x5f82('0x3'));var rp=require(_0x5f82('0x4'));var moment=require(_0x5f82('0x5'));var BPromise=require(_0x5f82('0x6'));var Mustache=require(_0x5f82('0x7'));var util=require(_0x5f82('0x8'));var path=require(_0x5f82('0x9'));var sox=require(_0x5f82('0xa'));var csv=require('to-csv');var ejs=require(_0x5f82('0xb'));var fs=require('fs');var fs_extra=require(_0x5f82('0xc'));var _=require(_0x5f82('0xd'));var squel=require(_0x5f82('0xe'));var crypto=require(_0x5f82('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5f82('0x10'));var toCsv=require(_0x5f82('0x11'));var querystring=require(_0x5f82('0x12'));var Papa=require(_0x5f82('0x13'));var Redis=require(_0x5f82('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5f82('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5f82('0x16'));var config=require(_0x5f82('0x17'));var licenseUtil=require(_0x5f82('0x18'));var db=require(_0x5f82('0x19'))['db'];function respondWithStatusCode(_0x15621b,_0x25bd66){_0x25bd66=_0x25bd66||0xcc;return function(_0xc14337){if(_0xc14337){return _0x15621b[_0x5f82('0x1a')](_0x25bd66);}return _0x15621b[_0x5f82('0x1b')](_0x25bd66)[_0x5f82('0x1c')]();};}function respondWithResult(_0x473ba0,_0xa9ad5f){_0xa9ad5f=_0xa9ad5f||0xc8;return function(_0x3c19d8){if(_0x3c19d8){return _0x473ba0[_0x5f82('0x1b')](_0xa9ad5f)['json'](_0x3c19d8);}};}function respondWithFilteredResult(_0x5d7d55,_0x2efa31){return function(_0x3e7746){if(_0x3e7746){var _0x24958c=typeof _0x2efa31['offset']===_0x5f82('0x1d')&&typeof _0x2efa31[_0x5f82('0x1e')]===_0x5f82('0x1d');var _0x2170cd=_0x3e7746[_0x5f82('0x1f')];var _0x7c8e1e=_0x24958c?0x0:_0x2efa31[_0x5f82('0x20')];var _0x32f892=_0x24958c?_0x3e7746['count']:_0x2efa31['offset']+_0x2efa31['limit'];var _0x2d84e8;if(_0x32f892>=_0x2170cd){_0x32f892=_0x2170cd;_0x2d84e8=0xc8;}else{_0x2d84e8=0xce;}_0x5d7d55[_0x5f82('0x1b')](_0x2d84e8);return _0x5d7d55[_0x5f82('0x21')](_0x5f82('0x22'),_0x7c8e1e+'-'+_0x32f892+'/'+_0x2170cd)[_0x5f82('0x23')](_0x3e7746);}return null;};}function patchUpdates(_0x47de7b){return function(_0x1ca9d9){try{jsonpatch[_0x5f82('0x24')](_0x1ca9d9,_0x47de7b,!![]);}catch(_0x912b51){return BPromise['reject'](_0x912b51);}return _0x1ca9d9[_0x5f82('0x25')]();};}function saveUpdates(_0x3bc025,_0x4f6f90){return function(_0x3d3c5e){if(_0x3d3c5e){return _0x3d3c5e[_0x5f82('0x26')](_0x3bc025)[_0x5f82('0x27')](function(_0x6feaa){return _0x6feaa;});}return null;};}function removeEntity(_0x41ee68,_0x2fe3fe){return function(_0x26ff1c){if(_0x26ff1c){return _0x26ff1c['destroy']()['then'](function(){var _0x51dc07=_0x26ff1c['get']({'plain':!![]});var _0x5b4251=_0x5f82('0x28');return db[_0x5f82('0x29')][_0x5f82('0x2a')]({'where':{'type':_0x5b4251,'resourceId':_0x51dc07['id']}})['then'](function(){return _0x26ff1c;});})['then'](function(){_0x41ee68[_0x5f82('0x1b')](0xcc)[_0x5f82('0x1c')]();});}};}function handleEntityNotFound(_0x115056,_0x1afd19){return function(_0x1f3727){if(!_0x1f3727){_0x115056[_0x5f82('0x1a')](0x194);}return _0x1f3727;};}function handleError(_0x2540c4,_0x2c6851){_0x2c6851=_0x2c6851||0x1f4;return function(_0x29a78d){logger[_0x5f82('0x2b')](_0x29a78d[_0x5f82('0x2c')]);if(_0x29a78d['name']){delete _0x29a78d['name'];}_0x2540c4[_0x5f82('0x1b')](_0x2c6851)['send'](_0x29a78d);};}exports[_0x5f82('0x2d')]=function(_0x275df3,_0x15053){var _0x60e973={},_0x4a4028={},_0x415432={'count':0x0,'rows':[]};var _0x3d7e4c=_[_0x5f82('0x2e')](db[_0x5f82('0x2f')][_0x5f82('0x30')],function(_0x55c2da){return{'name':_0x55c2da[_0x5f82('0x31')],'type':_0x55c2da[_0x5f82('0x32')][_0x5f82('0x33')]};});_0x4a4028[_0x5f82('0x34')]=_[_0x5f82('0x2e')](_0x3d7e4c,'name');_0x4a4028[_0x5f82('0x35')]=_[_0x5f82('0x36')](_0x275df3[_0x5f82('0x35')]);_0x4a4028[_0x5f82('0x37')]=_[_0x5f82('0x38')](_0x4a4028[_0x5f82('0x34')],_0x4a4028[_0x5f82('0x35')]);_0x60e973[_0x5f82('0x39')]=_[_0x5f82('0x38')](_0x4a4028[_0x5f82('0x34')],qs[_0x5f82('0x3a')](_0x275df3[_0x5f82('0x35')][_0x5f82('0x3a')]));_0x60e973[_0x5f82('0x39')]=_0x60e973[_0x5f82('0x39')][_0x5f82('0x3b')]?_0x60e973[_0x5f82('0x39')]:_0x4a4028[_0x5f82('0x34')];if(!_0x275df3[_0x5f82('0x35')][_0x5f82('0x3c')]('nolimit')){_0x60e973[_0x5f82('0x1e')]=qs[_0x5f82('0x1e')](_0x275df3[_0x5f82('0x35')][_0x5f82('0x1e')]);_0x60e973[_0x5f82('0x20')]=qs[_0x5f82('0x20')](_0x275df3['query'][_0x5f82('0x20')]);}_0x60e973[_0x5f82('0x3d')]=qs[_0x5f82('0x3e')](_0x275df3[_0x5f82('0x35')][_0x5f82('0x3e')]);_0x60e973[_0x5f82('0x3f')]=qs['filters'](_[_0x5f82('0x40')](_0x275df3[_0x5f82('0x35')],_0x4a4028['filters']),_0x3d7e4c);if(_0x275df3['query']['filter']){_0x60e973[_0x5f82('0x3f')]=_['merge'](_0x60e973['where'],{'$or':_[_0x5f82('0x2e')](_0x3d7e4c,function(_0x1d861b){if(_0x1d861b['type']!==_0x5f82('0x41')){var _0x342098={};_0x342098[_0x1d861b[_0x5f82('0x42')]]={'$like':'%'+_0x275df3['query'][_0x5f82('0x43')]+'%'};return _0x342098;}})});}_0x60e973=_[_0x5f82('0x44')]({},_0x60e973,_0x275df3[_0x5f82('0x45')]);var _0x4f23bd={'where':_0x60e973[_0x5f82('0x3f')]};return db['Variable'][_0x5f82('0x1f')](_0x4f23bd)[_0x5f82('0x27')](function(_0x494228){_0x415432[_0x5f82('0x1f')]=_0x494228;if(_0x275df3[_0x5f82('0x35')][_0x5f82('0x46')]){_0x60e973[_0x5f82('0x47')]=[{'all':!![]}];}return db[_0x5f82('0x2f')][_0x5f82('0x48')](_0x60e973);})[_0x5f82('0x27')](function(_0x4f8078){_0x415432[_0x5f82('0x49')]=_0x4f8078;return _0x415432;})[_0x5f82('0x27')](respondWithFilteredResult(_0x15053,_0x60e973))[_0x5f82('0x4a')](handleError(_0x15053,null));};exports[_0x5f82('0x4b')]=function(_0x13635d,_0x1ce7ad){var _0x20bea6={'raw':!![],'where':{'id':_0x13635d[_0x5f82('0x4c')]['id']}},_0x27cc4c={};_0x27cc4c[_0x5f82('0x34')]=_[_0x5f82('0x36')](db[_0x5f82('0x2f')]['rawAttributes']);_0x27cc4c[_0x5f82('0x35')]=_[_0x5f82('0x36')](_0x13635d[_0x5f82('0x35')]);_0x27cc4c[_0x5f82('0x37')]=_[_0x5f82('0x38')](_0x27cc4c[_0x5f82('0x34')],_0x27cc4c[_0x5f82('0x35')]);_0x20bea6[_0x5f82('0x39')]=_[_0x5f82('0x38')](_0x27cc4c['model'],qs['fields'](_0x13635d[_0x5f82('0x35')][_0x5f82('0x3a')]));_0x20bea6[_0x5f82('0x39')]=_0x20bea6[_0x5f82('0x39')]['length']?_0x20bea6[_0x5f82('0x39')]:_0x27cc4c[_0x5f82('0x34')];if(_0x13635d['query'][_0x5f82('0x46')]){_0x20bea6[_0x5f82('0x47')]=[{'all':!![]}];}_0x20bea6=_[_0x5f82('0x44')]({},_0x20bea6,_0x13635d[_0x5f82('0x45')]);return db['Variable'][_0x5f82('0x4d')](_0x20bea6)[_0x5f82('0x27')](handleEntityNotFound(_0x1ce7ad,null))['then'](respondWithResult(_0x1ce7ad,null))[_0x5f82('0x4a')](handleError(_0x1ce7ad,null));};exports[_0x5f82('0x4e')]=function(_0x87e49a,_0x56f39c){return db[_0x5f82('0x2f')][_0x5f82('0x4e')](_0x87e49a[_0x5f82('0x4f')],{})['then'](function(_0x3978f9){var _0x2df397=_0x87e49a['user'][_0x5f82('0x50')]({'plain':!![]});if(!_0x2df397)throw new Error(_0x5f82('0x51'));if(_0x2df397['role']===_0x5f82('0x52')){var _0x6edf93=_0x3978f9[_0x5f82('0x50')]({'plain':!![]});var _0x119b2b=_0x5f82('0x28');return db[_0x5f82('0x53')]['find']({'where':{'name':_0x119b2b,'userProfileId':_0x2df397['userProfileId']},'raw':!![]})[_0x5f82('0x27')](function(_0x2caf32){if(_0x2caf32&&_0x2caf32[_0x5f82('0x54')]===0x0){return db[_0x5f82('0x29')][_0x5f82('0x4e')]({'name':_0x6edf93[_0x5f82('0x42')],'resourceId':_0x6edf93['id'],'type':_0x2caf32[_0x5f82('0x42')],'sectionId':_0x2caf32['id']},{})[_0x5f82('0x27')](function(){return _0x3978f9;});}else{return _0x3978f9;}})[_0x5f82('0x4a')](function(_0x1db4cb){logger[_0x5f82('0x2b')](_0x5f82('0x55'),_0x1db4cb);throw _0x1db4cb;});}return _0x3978f9;})[_0x5f82('0x27')](respondWithResult(_0x56f39c,0xc9))['catch'](handleError(_0x56f39c,null));};exports[_0x5f82('0x26')]=function(_0x1c1c2b,_0x500e26){if(_0x1c1c2b[_0x5f82('0x4f')]['id']){delete _0x1c1c2b['body']['id'];}return db[_0x5f82('0x2f')]['find']({'where':{'id':_0x1c1c2b[_0x5f82('0x4c')]['id']}})[_0x5f82('0x27')](handleEntityNotFound(_0x500e26,null))[_0x5f82('0x27')](saveUpdates(_0x1c1c2b[_0x5f82('0x4f')],null))[_0x5f82('0x27')](respondWithResult(_0x500e26,null))[_0x5f82('0x4a')](handleError(_0x500e26,null));};exports[_0x5f82('0x2a')]=function(_0x2734f3,_0x19f8a4){return db['Variable'][_0x5f82('0x4d')]({'where':{'id':_0x2734f3[_0x5f82('0x4c')]['id']}})[_0x5f82('0x27')](handleEntityNotFound(_0x19f8a4,null))[_0x5f82('0x27')](removeEntity(_0x19f8a4,null))[_0x5f82('0x4a')](handleError(_0x19f8a4,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index d17b274..333e764 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 _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 +var _0x56a0=['exports','define','Variable','tools_variables','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2a1097,_0x241da2){var _0x165f60=function(_0x172167){while(--_0x172167){_0x2a1097['push'](_0x2a1097['shift']());}};_0x165f60(++_0x241da2);}(_0x56a0,0x190));var _0x056a=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0x56a0[_0x38841c];return _0x500610;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x056a('0x0'))(_0x056a('0x1'));var moment=require(_0x056a('0x2'));var BPromise=require(_0x056a('0x3'));var rp=require(_0x056a('0x4'));var fs=require('fs');var path=require(_0x056a('0x5'));var rimraf=require('rimraf');var config=require(_0x056a('0x6'));var attributes=require('./variable.attributes');module[_0x056a('0x7')]=function(_0x5cc82b,_0x3902c5){return _0x5cc82b[_0x056a('0x8')](_0x056a('0x9'),attributes,{'tableName':_0x056a('0xa'),'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 2e1500e..42ae7a0 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(_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 +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x1beda9,_0x5a3849){var _0x3fe3b1=function(_0x1169b2){while(--_0x1169b2){_0x1beda9['push'](_0x1beda9['shift']());}};_0x3fe3b1(++_0x5a3849);}(_0xe14b,0x93));var _0xbe14=function(_0x5e4b1d,_0x4f37d7){_0x5e4b1d=_0x5e4b1d-0x0;var _0x22d4fc=_0xe14b[_0x5e4b1d];return _0x22d4fc;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 7dceaae..ee9ac6e 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 _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 +var _0x1c8d=['get','index','canUpdate','fetch','isAuthenticated','reset','/pull','/restart','restart','/migrations','migrations','exports','express','../../components/auth/service','./version.controller'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x1c8d,0x129));var _0xd1c8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1c8d[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0xd1c8('0x0'));var router=express['Router']();var auth=require(_0xd1c8('0x1'));var controller=require(_0xd1c8('0x2'));router[_0xd1c8('0x3')]('/',controller[_0xd1c8('0x4')]);router[_0xd1c8('0x3')]('/fetch',auth['isAuthenticated'](),auth[_0xd1c8('0x5')](),controller[_0xd1c8('0x6')]);router[_0xd1c8('0x3')]('/reset',auth[_0xd1c8('0x7')](),auth[_0xd1c8('0x5')](),controller[_0xd1c8('0x8')]);router[_0xd1c8('0x3')](_0xd1c8('0x9'),auth[_0xd1c8('0x7')](),auth[_0xd1c8('0x5')](),controller['pull']);router['get'](_0xd1c8('0xa'),auth['isAuthenticated'](),controller[_0xd1c8('0xb')]);router['get'](_0xd1c8('0xc'),controller[_0xd1c8('0xd')]);module[_0xd1c8('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index fb2be7e..c34a330 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 _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 +var _0x94ef=['exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','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','lodash','version','compare-versions','child_process','../../mysqldb','../../config/environment','update','simple-git','index'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x94ef,0x17e));var _0xf94e=function(_0x275558,_0x312051){_0x275558=_0x275558-0x0;var _0x56e4f6=_0x94ef[_0x275558];return _0x56e4f6;};'use strict';var Umzug=require(_0xf94e('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xf94e('0x1'));var pkginfo=require('pkginfo')(module,_0xf94e('0x2'));var compareVersions=require(_0xf94e('0x3'));var exec=require(_0xf94e('0x4'))['exec'];var db=require(_0xf94e('0x5'))['db'];var config=require(_0xf94e('0x6'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xf94e('0x7'));var git=require(_0xf94e('0x8'))(config['root']);exports[_0xf94e('0x9')]=function(_0x518c06,_0x4870a7){var _0x4e9ea8={'current':module[_0xf94e('0xa')][_0xf94e('0x2')],'phonebar':0x2};if(_0x518c06[_0xf94e('0xb')]&&_0x518c06[_0xf94e('0xb')][_0xf94e('0xc')]){return git[_0xf94e('0xd')]()[_0xf94e('0xe')](function(_0x472c1c,_0x3fda0f){_0x4e9ea8[_0xf94e('0xc')]=(_0x472c1c?module['exports']['version']:_0x3fda0f[_0xf94e('0xc')])||_0xf94e('0xf');return _0x4870a7[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')](_0x4e9ea8);});}else{return _0x4870a7[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')](_0x4e9ea8);}};exports[_0xf94e('0xd')]=function(_0x4f590c,_0x41ffba){return git['fetch']([_0xf94e('0x12'),_0xf94e('0x13')],function(_0xe3e261){if(_0xe3e261){logger[_0xf94e('0x14')](_0xe3e261);return _0x41ffba['status'](0x1f4)['json'](_0xe3e261);}logger[_0xf94e('0x15')](_0xf94e('0x16'));return _0x41ffba[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')]({'output':_0xf94e('0x17')});});};exports[_0xf94e('0x18')]=function(_0x43582c,_0x4560fd){return git[_0xf94e('0x18')](['--hard',_0xf94e('0x19')],function(_0x302851){if(_0x302851){logger[_0xf94e('0x14')](_0x302851);return _0x4560fd[_0xf94e('0x10')](0x1f4)[_0xf94e('0x11')](_0x302851);}logger[_0xf94e('0x15')](_0xf94e('0x1a'));return _0x4560fd[_0xf94e('0x10')](0xc8)['json']({'output':_0xf94e('0x1b')});});};exports[_0xf94e('0x1c')]=function(_0x1a0a53,_0x24fa96){exec(_0xf94e('0x1d'),function(_0xcca96b,_0x485b99,_0x5ac1d1){logger[_0xf94e('0x15')](_0x485b99);logger[_0xf94e('0x15')](_0x5ac1d1);if(_0xcca96b){logger['error'](_0xcca96b);return _0x24fa96[_0xf94e('0x10')](0x1f4)[_0xf94e('0x11')](_0xcca96b);}return _0x24fa96[_0xf94e('0x10')](0xc8)['json']({'output':_0x485b99});});};exports['restart']=function(_0x471bcd,_0x1baad1){return pm2[_0xf94e('0x1e')](_0xf94e('0x1f'))[_0xf94e('0x20')](function(_0x22b7f1){logger['info'](_0xf94e('0x21'),_0x22b7f1);return _0x1baad1['status'](0xc8)[_0xf94e('0x11')]({'output':_0xf94e('0x22')});})[_0xf94e('0x23')](function(_0x45c41f){logger['error'](_0x45c41f);return _0x1baad1['status'](0x1f4)[_0xf94e('0x11')](_0x45c41f);});};exports[_0xf94e('0x24')]=function(_0x10995e,_0xa10d90){var _0x59d5cb=fs[_0xf94e('0x25')](path[_0xf94e('0x26')](config[_0xf94e('0x27')],_0xf94e('0x28'),_0xf94e('0x24')));var _0x1edf51=[];for(var _0x25f8a0=0x0;_0x25f8a0<_0x59d5cb[_0xf94e('0x29')];_0x25f8a0++){var _0x2b697a=_0x59d5cb[_0x25f8a0][_0xf94e('0x2a')](_0xf94e('0x2b'),'');if(compareVersions(module[_0xf94e('0xa')]['version'],_0x2b697a)===-0x1){_0x1edf51['push'](_0x2b697a);}}if(_0x1edf51[_0xf94e('0x29')]){var _0x496774=_0x1edf51[_0xf94e('0x2c')](compareVersions);var _0x41837f=new Umzug({'storage':_0xf94e('0x2d'),'storageOptions':{'model':db[_0xf94e('0x2e')],'modelName':_0xf94e('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0xf94e('0x2d')][_0xf94e('0x2f')](),db[_0xf94e('0x2d')][_0xf94e('0x30')],function(){throw new Error(_0xf94e('0x31'));}],'path':path['join'](config[_0xf94e('0x27')],'server','migrations'),'pattern':/\.js$/}});_0x41837f['up']({'migrations':_[_0xf94e('0x32')](_0x496774,function(_0x121d38){return _0x121d38+_0xf94e('0x2b');})})[_0xf94e('0x20')](function(){return _0xa10d90[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')]({'output':_0xf94e('0x33')+module[_0xf94e('0xa')]['version']+_0xf94e('0x34')+_[_0xf94e('0x35')](_0x496774),'migrations':_[_0xf94e('0x26')](_0x496774)});})['catch'](function(_0x4f0a6f){if(_0x4f0a6f instanceof db[_0xf94e('0x2d')][_0xf94e('0x36')]){return _0xa10d90[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')]({'output':_0xf94e('0x37')});}else{return _0xa10d90[_0xf94e('0x10')](0x1f4)[_0xf94e('0x11')](_0x4f0a6f);}});}else{return _0xa10d90[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')]({'output':_0xf94e('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3b9c810..a7c523d 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 _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 +var _0x30c7=['index','/:id','isAuthenticated','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get'];(function(_0x100519,_0x50dd2c){var _0x1dd752=function(_0x451bb7){while(--_0x451bb7){_0x100519['push'](_0x100519['shift']());}};_0x1dd752(++_0x50dd2c);}(_0x30c7,0x1d1));var _0x730c=function(_0x16a25e,_0x23cb8e){_0x16a25e=_0x16a25e-0x0;var _0x54f0fc=_0x30c7[_0x16a25e];return _0x54f0fc;};'use strict';var multer=require('multer');var util=require(_0x730c('0x0'));var path=require(_0x730c('0x1'));var timeout=require(_0x730c('0x2'));var express=require(_0x730c('0x3'));var router=express['Router']();var fs_extra=require(_0x730c('0x4'));var auth=require(_0x730c('0x5'));var interaction=require(_0x730c('0x6'));var config=require(_0x730c('0x7'));var controller=require(_0x730c('0x8'));router[_0x730c('0x9')]('/',auth['isAuthenticated'](),controller[_0x730c('0xa')]);router[_0x730c('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x730c('0x9')](_0x730c('0xb'),auth[_0x730c('0xc')](),controller['show']);router[_0x730c('0xd')]('/',auth[_0x730c('0xc')](),controller[_0x730c('0xe')]);router[_0x730c('0xf')](_0x730c('0xb'),auth[_0x730c('0xc')](),controller['update']);router[_0x730c('0x10')]('/:id',auth[_0x730c('0xc')](),controller[_0x730c('0x11')]);module[_0x730c('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 230dfea..6a1b8e9 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 _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 +var _0x5713=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x5713,0x1c7));var _0x3571=function(_0x3b3d2b,_0x1f1c69){_0x3b3d2b=_0x3b3d2b-0x0;var _0x557baa=_0x5713[_0x3b3d2b];return _0x557baa;};'use strict';var Sequelize=require(_0x3571('0x0'));module[_0x3571('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3571('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3571('0x2')]},'queue':{'type':Sequelize[_0x3571('0x2')]},'interface':{'type':Sequelize[_0x3571('0x2')]},'membername':{'type':Sequelize[_0x3571('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x3571('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x3571('0x3')]},'agentdumpAt':{'type':Sequelize[_0x3571('0x3')]},'holdtime':{'type':Sequelize[_0x3571('0x4')]},'agentcomplete':{'type':Sequelize[_0x3571('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3571('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x3571('0x4')]},'agentacw':{'type':Sequelize[_0x3571('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3571('0x4')]},'reason':{'type':Sequelize[_0x3571('0x2')]},'lastevent':{'type':Sequelize[_0x3571('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3571('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3571('0x2')]},'connectedlinename':{'type':Sequelize[_0x3571('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3571('0x2')]},'destchannel':{'type':Sequelize[_0x3571('0x2')]},'destchannelstate':{'type':Sequelize[_0x3571('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x3571('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3571('0x2')]},'destcalleridname':{'type':Sequelize[_0x3571('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3571('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3571('0x2')]},'destlanguage':{'type':Sequelize[_0x3571('0x2')]},'destaccountcode':{'type':Sequelize[_0x3571('0x2')]},'destcontext':{'type':Sequelize[_0x3571('0x2')]},'destexten':{'type':Sequelize[_0x3571('0x2')]},'destpriority':{'type':Sequelize[_0x3571('0x2')]},'destuniqueid':{'type':Sequelize[_0x3571('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3571('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x3571('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x3571('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x3571('0x4')],'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 30313eb..4ffc346 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(_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 +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(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 dc54b84..42aa82c 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 _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 +var _0x6c7b=['report_agent','uniqueid','destuniqueid','lodash','moment','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define'];(function(_0x39e15b,_0x555185){var _0x4e5766=function(_0x45ef45){while(--_0x45ef45){_0x39e15b['push'](_0x39e15b['shift']());}};_0x4e5766(++_0x555185);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x5b24da,_0x41443c){_0x5b24da=_0x5b24da-0x0;var _0x4eae1c=_0x6c7b[_0x5b24da];return _0x4eae1c;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('VoiceAgentReport',attributes,{'tableName':_0xb6c7('0x8'),'paranoid':![],'indexes':[{'fields':[_0xb6c7('0x9'),_0xb6c7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index cc8db03..a8e21ee 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 _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 +var _0x31ed=['error','message','request\x20sent','result','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2bbd69,_0x2b1b65){var _0x30dd4c=function(_0x293aad){while(--_0x293aad){_0x2bbd69['push'](_0x2bbd69['shift']());}};_0x30dd4c(++_0x2b1b65);}(_0x31ed,0x1c8));var _0xd31e=function(_0xd6dc4d,_0x417d75){_0xd6dc4d=_0xd6dc4d-0x0;var _0x4848f7=_0x31ed[_0xd6dc4d];return _0x4848f7;};'use strict';var _=require(_0xd31e('0x0'));var util=require(_0xd31e('0x1'));var moment=require(_0xd31e('0x2'));var BPromise=require(_0xd31e('0x3'));var rs=require(_0xd31e('0x4'));var fs=require('fs');var Redis=require(_0xd31e('0x5'));var db=require(_0xd31e('0x6'))['db'];var utils=require(_0xd31e('0x7'));var logger=require(_0xd31e('0x8'))(_0xd31e('0x9'));var config=require(_0xd31e('0xa'));var jayson=require(_0xd31e('0xb'));var client=jayson[_0xd31e('0xc')][_0xd31e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x36ee10,_0x4ee812,_0x48de1c){return new BPromise(function(_0x4d9cc9,_0x4e75b9){return client['request'](_0x36ee10,_0x48de1c)[_0xd31e('0xe')](function(_0x3ca55c){logger[_0xd31e('0xf')](_0xd31e('0x10'),_0x4ee812,'request\x20sent');logger[_0xd31e('0x11')](_0xd31e('0x12'),_0x4ee812,'request\x20sent',JSON[_0xd31e('0x13')](_0x3ca55c));if(_0x3ca55c[_0xd31e('0x14')]){if(_0x3ca55c[_0xd31e('0x14')]['code']===0x1f4){logger[_0xd31e('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x4ee812,_0x3ca55c['error']['message']);return _0x4e75b9(_0x3ca55c[_0xd31e('0x14')][_0xd31e('0x15')]);}logger[_0xd31e('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x4ee812,_0x3ca55c[_0xd31e('0x14')][_0xd31e('0x15')]);return _0x4d9cc9(_0x3ca55c['error'][_0xd31e('0x15')]);}else{logger[_0xd31e('0xf')](_0xd31e('0x10'),_0x4ee812,_0xd31e('0x16'));_0x4d9cc9(_0x3ca55c[_0xd31e('0x17')][_0xd31e('0x15')]);}})['catch'](function(_0x3018ba){logger[_0xd31e('0x14')](_0xd31e('0x10'),_0x4ee812,_0x3018ba);_0x4e75b9(_0x3018ba);});});}exports['CreateVoiceAgentReport']=function(_0x16c85b){var _0x2719f9=this;return new Promise(function(_0x1af502,_0x485f45){return db[_0xd31e('0x18')][_0xd31e('0x19')](_0x16c85b[_0xd31e('0x1a')],{'raw':_0x16c85b[_0xd31e('0x1b')]?_0x16c85b[_0xd31e('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x7f6355){logger[_0xd31e('0xf')](_0xd31e('0x1c'),_0x16c85b);logger['debug'](_0xd31e('0x1c'),_0x16c85b,JSON[_0xd31e('0x13')](_0x7f6355));_0x1af502(_0x7f6355);})[_0xd31e('0x1d')](function(_0x59327e){logger[_0xd31e('0x14')]('CreateVoiceAgentReport',_0x59327e[_0xd31e('0x15')],_0x16c85b);_0x485f45(_0x2719f9[_0xd31e('0x14')](0x1f4,_0x59327e[_0xd31e('0x15')]));});});};exports[_0xd31e('0x1e')]=function(_0x191fa8){var _0x17ad3d=this;return new Promise(function(_0x580927,_0x282dc1){return db[_0xd31e('0x18')][_0xd31e('0x1f')](_0x191fa8[_0xd31e('0x1a')],{'raw':_0x191fa8[_0xd31e('0x1b')]?_0x191fa8[_0xd31e('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x191fa8[_0xd31e('0x1b')]?_0x191fa8[_0xd31e('0x1b')][_0xd31e('0x20')]||null:null,'attributes':_0x191fa8['options']?_0x191fa8[_0xd31e('0x1b')][_0xd31e('0x21')]||null:null,'limit':_0x191fa8[_0xd31e('0x1b')]?_0x191fa8['options']['limit']||null:null})[_0xd31e('0xe')](function(_0x393e95){logger[_0xd31e('0xf')]('UpdateVoiceAgentReport',_0x191fa8);logger[_0xd31e('0x11')](_0xd31e('0x1e'),_0x191fa8,JSON[_0xd31e('0x13')](_0x393e95));_0x580927(_0x393e95);})[_0xd31e('0x1d')](function(_0x5afb6e){logger[_0xd31e('0x14')](_0xd31e('0x1e'),_0x5afb6e[_0xd31e('0x15')],_0x191fa8);_0x282dc1(_0x17ad3d[_0xd31e('0x14')](0x1f4,_0x5afb6e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 11c3dcd..5e6d23b 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 _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 +var _0x46ed=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','multer'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0x46ed,0x168));var _0xd46e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x46ed[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')]('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xa')]);router[_0xd46e('0x8')](_0xd46e('0xb'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xc')]);router[_0xd46e('0x8')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller['show']);router[_0xd46e('0xe')]('/',auth[_0xd46e('0x9')](),controller['create']);router[_0xd46e('0xf')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller[_0xd46e('0x10')]);router[_0xd46e('0x11')](_0xd46e('0xd'),auth['isAuthenticated'](),controller[_0xd46e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 9d81e81..4eef07f 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 _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 +var _0x5a87=['inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','exports','STRING','ENUM'];(function(_0xa9ad43,_0x3d9901){var _0x3decda=function(_0x2d565a){while(--_0x2d565a){_0xa9ad43['push'](_0xa9ad43['shift']());}};_0x3decda(++_0x3d9901);}(_0x5a87,0x194));var _0x75a8=function(_0x37e9a1,_0x2c30d2){_0x37e9a1=_0x37e9a1-0x0;var _0xccb5c4=_0x5a87[_0x37e9a1];return _0xccb5c4;};'use strict';var Sequelize=require('sequelize');module[_0x75a8('0x0')]={'uniqueid':{'type':Sequelize[_0x75a8('0x1')]},'type':{'type':Sequelize[_0x75a8('0x2')](_0x75a8('0x3'),_0x75a8('0x4'),_0x75a8('0x5'),_0x75a8('0x6'),_0x75a8('0x7'),_0x75a8('0x8'))},'tag':{'type':Sequelize[_0x75a8('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x75a8('0x1')]},'destination':{'type':Sequelize[_0x75a8('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x75a8('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x75a8('0x1')]},'lastapplication':{'type':Sequelize[_0x75a8('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x75a8('0x9')]},'answertime':{'type':Sequelize[_0x75a8('0x9')]},'endtime':{'type':Sequelize[_0x75a8('0x9')]},'duration':{'type':Sequelize[_0x75a8('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x75a8('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x75a8('0x1')]},'amaflags':{'type':Sequelize[_0x75a8('0x1')]},'userfield':{'type':Sequelize[_0x75a8('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x75a8('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x75a8('0x1')]},'note':{'type':Sequelize[_0x75a8('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x75a8('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 9d1bdfe..56a65b4 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_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 +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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x2ef3,0xba));var _0x32ef=function(_0x4227e2,_0x215f36){_0x4227e2=_0x4227e2-0x0;var _0x175c97=_0x2ef3[_0x4227e2];return _0x175c97;};'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 efd4474..4b8d876 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 _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 +var _0x919d=['api','bluebird','path','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','../../config/logger'];(function(_0x37e61a,_0x435290){var _0x3ab814=function(_0x27525b){while(--_0x27525b){_0x37e61a['push'](_0x37e61a['shift']());}};_0x3ab814(++_0x435290);}(_0x919d,0x1c0));var _0xd919=function(_0x3f12be,_0x2a9c41){_0x3f12be=_0x3f12be-0x0;var _0x57cf5d=_0x919d[_0x3f12be];return _0x57cf5d;};'use strict';var _=require(_0xd919('0x0'));var util=require(_0xd919('0x1'));var logger=require(_0xd919('0x2'))(_0xd919('0x3'));var moment=require('moment');var BPromise=require(_0xd919('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd919('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd919('0x6'));module[_0xd919('0x7')]=function(_0x5493fc,_0x495d7b){return _0x5493fc[_0xd919('0x8')](_0xd919('0x9'),attributes,{'tableName':_0xd919('0xa'),'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 5502927..75414dc 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 _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 +var _0xc64a=['debug','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model'];(function(_0x213cf0,_0x3e3d3c){var _0x3c7515=function(_0x32ea70){while(--_0x32ea70){_0x213cf0['push'](_0x213cf0['shift']());}};_0x3c7515(++_0x3e3d3c);}(_0xc64a,0x117));var _0xac64=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc64a[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac64('0x0'));var util=require('util');var moment=require(_0xac64('0x1'));var BPromise=require(_0xac64('0x2'));var rs=require(_0xac64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac64('0x4'))['db'];var utils=require(_0xac64('0x5'));var logger=require(_0xac64('0x6'))('rpc');var config=require(_0xac64('0x7'));var jayson=require(_0xac64('0x8'));var client=jayson[_0xac64('0x9')][_0xac64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x517824,_0x471bea,_0x680184){return new BPromise(function(_0x28b373,_0x417317){return client[_0xac64('0xb')](_0x517824,_0x680184)[_0xac64('0xc')](function(_0xd97ade){logger[_0xac64('0xd')](_0xac64('0xe'),_0x471bea,_0xac64('0xf'));logger['debug'](_0xac64('0x10'),_0x471bea,'request\x20sent',JSON[_0xac64('0x11')](_0xd97ade));if(_0xd97ade['error']){if(_0xd97ade[_0xac64('0x12')][_0xac64('0x13')]===0x1f4){logger[_0xac64('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x471bea,_0xd97ade['error'][_0xac64('0x14')]);return _0x417317(_0xd97ade['error'][_0xac64('0x14')]);}logger[_0xac64('0x12')](_0xac64('0xe'),_0x471bea,_0xd97ade['error'][_0xac64('0x14')]);return _0x28b373(_0xd97ade[_0xac64('0x12')]['message']);}else{logger[_0xac64('0xd')](_0xac64('0xe'),_0x471bea,_0xac64('0xf'));_0x28b373(_0xd97ade[_0xac64('0x15')][_0xac64('0x14')]);}})[_0xac64('0x16')](function(_0x371ec6){logger[_0xac64('0x12')](_0xac64('0xe'),_0x471bea,_0x371ec6);_0x417317(_0x371ec6);});});}exports[_0xac64('0x17')]=function(_0x146c7b){var _0x118927=this;return new Promise(function(_0x18c448,_0x18548a){return db[_0xac64('0x18')][_0xac64('0x19')]({'raw':_0x146c7b[_0xac64('0x1a')]?_0x146c7b[_0xac64('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x146c7b['options']?_0x146c7b[_0xac64('0x1a')][_0xac64('0x1b')]||null:null,'attributes':_0x146c7b['options']?_0x146c7b[_0xac64('0x1a')][_0xac64('0x1c')]||null:null,'limit':_0x146c7b[_0xac64('0x1a')]?_0x146c7b[_0xac64('0x1a')][_0xac64('0x1d')]||null:null,'include':_0x146c7b[_0xac64('0x1a')]?_0x146c7b[_0xac64('0x1a')][_0xac64('0x1e')]?_[_0xac64('0x1f')](_0x146c7b[_0xac64('0x1a')][_0xac64('0x1e')],function(_0x15bea3){return{'model':db[_0x15bea3['model']],'as':_0x15bea3['as'],'attributes':_0x15bea3['attributes'],'include':_0x15bea3[_0xac64('0x1e')]?_[_0xac64('0x1f')](_0x15bea3['include'],function(_0x88f8be){return{'model':db[_0x88f8be[_0xac64('0x20')]],'as':_0x88f8be['as'],'attributes':_0x88f8be['attributes'],'include':_0x88f8be['include']?_['map'](_0x88f8be[_0xac64('0x1e')],function(_0x385191){return{'model':db[_0x385191[_0xac64('0x20')]],'as':_0x385191['as'],'attributes':_0x385191['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c1ba7){logger[_0xac64('0xd')]('GetVoiceCallReport',_0x146c7b);logger[_0xac64('0x21')]('GetVoiceCallReport',_0x146c7b,JSON[_0xac64('0x11')](_0x2c1ba7));_0x18c448(_0x2c1ba7);})['catch'](function(_0x2b607c){logger[_0xac64('0x12')]('GetVoiceCallReport',_0x2b607c[_0xac64('0x14')],_0x146c7b);_0x18548a(_0x118927['error'](0x1f4,_0x2b607c['message']));});});};exports[_0xac64('0x22')]=function(_0xa1f28f){var _0x19a2b5=this;return new Promise(function(_0x36be5d,_0x1dcaf4){return db[_0xac64('0x18')][_0xac64('0x23')](_0xa1f28f[_0xac64('0x24')],{'raw':_0xa1f28f[_0xac64('0x1a')]?_0xa1f28f[_0xac64('0x1a')][_0xac64('0x25')]===undefined?!![]:![]:!![]})[_0xac64('0xc')](function(_0x50332a){logger[_0xac64('0xd')](_0xac64('0x22'),_0xa1f28f);logger[_0xac64('0x21')]('CreateVoiceCallReport',_0xa1f28f,JSON['stringify'](_0x50332a));_0x36be5d(_0x50332a);})['catch'](function(_0x1db04a){logger['error'](_0xac64('0x22'),_0x1db04a['message'],_0xa1f28f);_0x1dcaf4(_0x19a2b5['error'](0x1f4,_0x1db04a['message']));});});};exports[_0xac64('0x26')]=function(_0x5a5013){var _0x509708=this;return new Promise(function(_0x168708,_0x39a8ee){return db[_0xac64('0x18')]['update'](_0x5a5013['body'],{'raw':_0x5a5013[_0xac64('0x1a')]?_0x5a5013[_0xac64('0x1a')][_0xac64('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a5013['options']?_0x5a5013[_0xac64('0x1a')][_0xac64('0x1b')]||null:null,'attributes':_0x5a5013[_0xac64('0x1a')]?_0x5a5013[_0xac64('0x1a')][_0xac64('0x1c')]||null:null,'limit':_0x5a5013['options']?_0x5a5013[_0xac64('0x1a')][_0xac64('0x1d')]||null:null})['then'](function(_0x5ede47){logger[_0xac64('0xd')](_0xac64('0x26'),_0x5a5013);logger['debug'](_0xac64('0x26'),_0x5a5013,JSON['stringify'](_0x5ede47));_0x168708(_0x5ede47);})[_0xac64('0x16')](function(_0x502220){logger[_0xac64('0x12')](_0xac64('0x26'),_0x502220[_0xac64('0x14')],_0x5a5013);_0x39a8ee(_0x509708['error'](0x1f4,_0x502220['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b4ffd52..20a7ef7 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 _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 +var _0x40d3=['post','create','put','/:id','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','show'];(function(_0x3a9ec8,_0x3b648c){var _0x443b47=function(_0x455f97){while(--_0x455f97){_0x3a9ec8['push'](_0x3a9ec8['shift']());}};_0x443b47(++_0x3b648c);}(_0x40d3,0xb2));var _0x340d=function(_0x31a36d,_0x2781d9){_0x31a36d=_0x31a36d-0x0;var _0x517c66=_0x40d3[_0x31a36d];return _0x517c66;};'use strict';var multer=require(_0x340d('0x0'));var util=require('util');var path=require(_0x340d('0x1'));var timeout=require('connect-timeout');var express=require(_0x340d('0x2'));var router=express['Router']();var fs_extra=require(_0x340d('0x3'));var auth=require(_0x340d('0x4'));var interaction=require(_0x340d('0x5'));var config=require(_0x340d('0x6'));var controller=require(_0x340d('0x7'));router['get']('/',auth[_0x340d('0x8')](),controller[_0x340d('0x9')]);router[_0x340d('0xa')]('/:id',auth[_0x340d('0x8')](),controller[_0x340d('0xb')]);router[_0x340d('0xc')]('/',auth[_0x340d('0x8')](),controller[_0x340d('0xd')]);router[_0x340d('0xe')](_0x340d('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x340d('0x10')](_0x340d('0xf'),auth[_0x340d('0x8')](),controller[_0x340d('0x11')]);module[_0x340d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 69ba016..68f1322 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 _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 +var _0x928b=['options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x928b,0x151));var _0xb928=function(_0x1b0df5,_0x2498bf){_0x1b0df5=_0x1b0df5-0x0;var _0x60696a=_0x928b[_0x1b0df5];return _0x60696a;};'use strict';var Sequelize=require(_0xb928('0x0'));module[_0xb928('0x1')]={'name':{'type':Sequelize[_0xb928('0x2')]},'prefix':{'type':Sequelize[_0xb928('0x2')],'unique':_0xb928('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xb928('0x2')],'set':function(_0x34ed52){this[_0xb928('0x4')](_0xb928('0x5'),_0x34ed52?_0x34ed52['join'](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xb928('0x6')](_0xb928('0x5'))[_0xb928('0x7')](''):[];}},'auth':{'type':Sequelize[_0xb928('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xb928('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ad1e25d..a4859d2 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 _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 +var _0x3ce4=['UserProfileResource','error','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','reject','save','then','destroy','ChanSpies'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ce4,0xcb));var _0x43ce=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x3ce4[_0x17406a];return _0x1501ff;};'use strict';var emlformat=require(_0x43ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43ce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43ce('0x2'));var moment=require(_0x43ce('0x3'));var BPromise=require(_0x43ce('0x4'));var Mustache=require(_0x43ce('0x5'));var util=require(_0x43ce('0x6'));var path=require('path');var sox=require(_0x43ce('0x7'));var csv=require(_0x43ce('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43ce('0x9'));var _=require('lodash');var squel=require(_0x43ce('0xa'));var crypto=require(_0x43ce('0xb'));var jsforce=require(_0x43ce('0xc'));var deskjs=require(_0x43ce('0xd'));var toCsv=require('to-csv');var querystring=require(_0x43ce('0xe'));var Papa=require(_0x43ce('0xf'));var Redis=require(_0x43ce('0x10'));var authService=require(_0x43ce('0x11'));var qs=require(_0x43ce('0x12'));var as=require(_0x43ce('0x13'));var hardwareService=require(_0x43ce('0x14'));var logger=require(_0x43ce('0x15'))('api');var utils=require(_0x43ce('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x43ce('0x17'));var db=require(_0x43ce('0x18'))['db'];function respondWithStatusCode(_0x84300e,_0x472b54){_0x472b54=_0x472b54||0xcc;return function(_0x2be282){if(_0x2be282){return _0x84300e[_0x43ce('0x19')](_0x472b54);}return _0x84300e[_0x43ce('0x1a')](_0x472b54)['end']();};}function respondWithResult(_0x3fb780,_0x57eb00){_0x57eb00=_0x57eb00||0xc8;return function(_0x1a02f8){if(_0x1a02f8){return _0x3fb780[_0x43ce('0x1a')](_0x57eb00)[_0x43ce('0x1b')](_0x1a02f8);}};}function respondWithFilteredResult(_0x5ebcef,_0x14e2b2){return function(_0x14e906){if(_0x14e906){var _0x298771=typeof _0x14e2b2[_0x43ce('0x1c')]===_0x43ce('0x1d')&&typeof _0x14e2b2[_0x43ce('0x1e')]===_0x43ce('0x1d');var _0xfb7e97=_0x14e906[_0x43ce('0x1f')];var _0x2f679=_0x298771?0x0:_0x14e2b2[_0x43ce('0x1c')];var _0x1b7f2=_0x298771?_0x14e906[_0x43ce('0x1f')]:_0x14e2b2[_0x43ce('0x1c')]+_0x14e2b2[_0x43ce('0x1e')];var _0x202459;if(_0x1b7f2>=_0xfb7e97){_0x1b7f2=_0xfb7e97;_0x202459=0xc8;}else{_0x202459=0xce;}_0x5ebcef[_0x43ce('0x1a')](_0x202459);return _0x5ebcef['set']('Content-Range',_0x2f679+'-'+_0x1b7f2+'/'+_0xfb7e97)[_0x43ce('0x1b')](_0x14e906);}return null;};}function patchUpdates(_0x2f8d63){return function(_0x34db72){try{jsonpatch['apply'](_0x34db72,_0x2f8d63,!![]);}catch(_0x4c31e3){return BPromise[_0x43ce('0x20')](_0x4c31e3);}return _0x34db72[_0x43ce('0x21')]();};}function saveUpdates(_0x42b4a3,_0x439063){return function(_0x550013){if(_0x550013){return _0x550013['update'](_0x42b4a3)[_0x43ce('0x22')](function(_0x5cb18c){return _0x5cb18c;});}return null;};}function removeEntity(_0x115ba2,_0x2bce6d){return function(_0x2a74ec){if(_0x2a74ec){return _0x2a74ec[_0x43ce('0x23')]()[_0x43ce('0x22')](function(){var _0x52f858=_0x2a74ec['get']({'plain':!![]});var _0x151777=_0x43ce('0x24');return db[_0x43ce('0x25')][_0x43ce('0x23')]({'where':{'type':_0x151777,'resourceId':_0x52f858['id']}})['then'](function(){return _0x2a74ec;});})[_0x43ce('0x22')](function(){_0x115ba2[_0x43ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2330ba,_0x4d3782){return function(_0x517232){if(!_0x517232){_0x2330ba[_0x43ce('0x19')](0x194);}return _0x517232;};}function handleError(_0x28b08b,_0x79f757){_0x79f757=_0x79f757||0x1f4;return function(_0xefecdf){logger[_0x43ce('0x26')](_0xefecdf['stack']);if(_0xefecdf[_0x43ce('0x27')]){delete _0xefecdf[_0x43ce('0x27')];}_0x28b08b[_0x43ce('0x1a')](_0x79f757)[_0x43ce('0x28')](_0xefecdf);};}exports['index']=function(_0x382c71,_0x102fbe){var _0x31ab16={},_0x34bb16={},_0x241a4f={'count':0x0,'rows':[]};var _0x284710=_[_0x43ce('0x29')](db[_0x43ce('0x2a')][_0x43ce('0x2b')],function(_0x50aa48){return{'name':_0x50aa48[_0x43ce('0x2c')],'type':_0x50aa48[_0x43ce('0x2d')][_0x43ce('0x2e')]};});_0x34bb16[_0x43ce('0x2f')]=_[_0x43ce('0x29')](_0x284710,_0x43ce('0x27'));_0x34bb16[_0x43ce('0x30')]=_['keys'](_0x382c71[_0x43ce('0x30')]);_0x34bb16[_0x43ce('0x31')]=_[_0x43ce('0x32')](_0x34bb16[_0x43ce('0x2f')],_0x34bb16[_0x43ce('0x30')]);_0x31ab16[_0x43ce('0x33')]=_['intersection'](_0x34bb16[_0x43ce('0x2f')],qs['fields'](_0x382c71[_0x43ce('0x30')][_0x43ce('0x34')]));_0x31ab16['attributes']=_0x31ab16[_0x43ce('0x33')]['length']?_0x31ab16['attributes']:_0x34bb16[_0x43ce('0x2f')];if(!_0x382c71[_0x43ce('0x30')][_0x43ce('0x35')](_0x43ce('0x36'))){_0x31ab16[_0x43ce('0x1e')]=qs[_0x43ce('0x1e')](_0x382c71[_0x43ce('0x30')][_0x43ce('0x1e')]);_0x31ab16['offset']=qs['offset'](_0x382c71[_0x43ce('0x30')][_0x43ce('0x1c')]);}_0x31ab16[_0x43ce('0x37')]=qs[_0x43ce('0x38')](_0x382c71['query'][_0x43ce('0x38')]);_0x31ab16[_0x43ce('0x39')]=qs['filters'](_[_0x43ce('0x3a')](_0x382c71['query'],_0x34bb16[_0x43ce('0x31')]),_0x284710);if(_0x382c71[_0x43ce('0x30')][_0x43ce('0x3b')]){_0x31ab16[_0x43ce('0x39')]=_[_0x43ce('0x3c')](_0x31ab16[_0x43ce('0x39')],{'$or':_[_0x43ce('0x29')](_0x284710,function(_0x57e98d){if(_0x57e98d['type']!==_0x43ce('0x3d')){var _0x18ab10={};_0x18ab10[_0x57e98d[_0x43ce('0x27')]]={'$like':'%'+_0x382c71[_0x43ce('0x30')]['filter']+'%'};return _0x18ab10;}})});}_0x31ab16=_[_0x43ce('0x3c')]({},_0x31ab16,_0x382c71[_0x43ce('0x3e')]);var _0x1f991d={'where':_0x31ab16[_0x43ce('0x39')]};return db[_0x43ce('0x2a')][_0x43ce('0x1f')](_0x1f991d)[_0x43ce('0x22')](function(_0x6d3327){_0x241a4f['count']=_0x6d3327;if(_0x382c71['query']['includeAll']){_0x31ab16[_0x43ce('0x3f')]=[{'all':!![]}];}return db[_0x43ce('0x2a')]['findAll'](_0x31ab16);})[_0x43ce('0x22')](function(_0x37d6f0){_0x241a4f[_0x43ce('0x40')]=_0x37d6f0;return _0x241a4f;})[_0x43ce('0x22')](respondWithFilteredResult(_0x102fbe,_0x31ab16))[_0x43ce('0x41')](handleError(_0x102fbe,null));};exports[_0x43ce('0x42')]=function(_0x1da3fc,_0x369443){var _0x2a926d={'raw':![],'where':{'id':_0x1da3fc['params']['id']}},_0x4a922d={};_0x4a922d[_0x43ce('0x2f')]=_['keys'](db[_0x43ce('0x2a')][_0x43ce('0x2b')]);_0x4a922d[_0x43ce('0x30')]=_['keys'](_0x1da3fc[_0x43ce('0x30')]);_0x4a922d[_0x43ce('0x31')]=_['intersection'](_0x4a922d[_0x43ce('0x2f')],_0x4a922d[_0x43ce('0x30')]);_0x2a926d[_0x43ce('0x33')]=_['intersection'](_0x4a922d['model'],qs[_0x43ce('0x34')](_0x1da3fc['query'][_0x43ce('0x34')]));_0x2a926d[_0x43ce('0x33')]=_0x2a926d[_0x43ce('0x33')]['length']?_0x2a926d['attributes']:_0x4a922d[_0x43ce('0x2f')];if(_0x1da3fc[_0x43ce('0x30')][_0x43ce('0x43')]){_0x2a926d[_0x43ce('0x3f')]=[{'all':!![]}];}_0x2a926d=_[_0x43ce('0x3c')]({},_0x2a926d,_0x1da3fc['options']);return db[_0x43ce('0x2a')]['find'](_0x2a926d)[_0x43ce('0x22')](handleEntityNotFound(_0x369443,null))[_0x43ce('0x22')](respondWithResult(_0x369443,null))[_0x43ce('0x41')](handleError(_0x369443,null));};exports[_0x43ce('0x44')]=function(_0x3bc85d,_0x282040){return db[_0x43ce('0x2a')][_0x43ce('0x44')](_0x3bc85d[_0x43ce('0x45')],{})[_0x43ce('0x22')](function(_0x5bd403){var _0x3be04e=_0x3bc85d[_0x43ce('0x46')][_0x43ce('0x47')]({'plain':!![]});if(!_0x3be04e)throw new Error(_0x43ce('0x48'));if(_0x3be04e[_0x43ce('0x49')]===_0x43ce('0x46')){var _0x42c849=_0x5bd403[_0x43ce('0x47')]({'plain':!![]});var _0x24265a=_0x43ce('0x24');return db[_0x43ce('0x4a')][_0x43ce('0x4b')]({'where':{'name':_0x24265a,'userProfileId':_0x3be04e[_0x43ce('0x4c')]},'raw':!![]})[_0x43ce('0x22')](function(_0x1c47d7){if(_0x1c47d7&&_0x1c47d7[_0x43ce('0x4d')]===0x0){return db[_0x43ce('0x25')]['create']({'name':_0x42c849['name'],'resourceId':_0x42c849['id'],'type':_0x1c47d7['name'],'sectionId':_0x1c47d7['id']},{})[_0x43ce('0x22')](function(){return _0x5bd403;});}else{return _0x5bd403;}})[_0x43ce('0x41')](function(_0x1ad203){logger[_0x43ce('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ad203);throw _0x1ad203;});}return _0x5bd403;})[_0x43ce('0x22')](respondWithResult(_0x282040,0xc9))['catch'](handleError(_0x282040,null));};exports[_0x43ce('0x4e')]=function(_0x1c6627,_0x4dbe46){if(_0x1c6627[_0x43ce('0x45')]['id']){delete _0x1c6627[_0x43ce('0x45')]['id'];}return db[_0x43ce('0x2a')][_0x43ce('0x4b')]({'where':{'id':_0x1c6627[_0x43ce('0x4f')]['id']}})[_0x43ce('0x22')](handleEntityNotFound(_0x4dbe46,null))[_0x43ce('0x22')](saveUpdates(_0x1c6627[_0x43ce('0x45')],null))['then'](respondWithResult(_0x4dbe46,null))[_0x43ce('0x41')](handleError(_0x4dbe46,null));};exports[_0x43ce('0x23')]=function(_0x133d17,_0x5b801c){return db['VoiceChanSpy'][_0x43ce('0x4b')]({'where':{'id':_0x133d17[_0x43ce('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5b801c,null))[_0x43ce('0x22')](removeEntity(_0x5b801c,null))[_0x43ce('0x41')](handleError(_0x5b801c,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9fc4007..74ac01f 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 _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 +var _0x58de=['name','User','agent','then','exports','models','define','VoiceChanSpy','length','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','context','from-sip','%s%s','prefix','push','Set','format','CDR(type)=%s','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','options','join','StopMixMonitor','concat','internal'];(function(_0x185334,_0x4630ac){var _0xf2e59a=function(_0x3cc497){while(--_0x3cc497){_0x185334['push'](_0x185334['shift']());}};_0xf2e59a(++_0x4630ac);}(_0x58de,0x12d));var _0xe58d=function(_0x33f3fc,_0x2eaf31){_0x33f3fc=_0x33f3fc-0x0;var _0x156e09=_0x58de[_0x33f3fc];return _0x156e09;};'use strict';var _=require(_0xe58d('0x0'));var util=require(_0xe58d('0x1'));var BPromise=require(_0xe58d('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xddd1fc,_0x215c9c,_0x574566){var _0x3bcb9b=0x1;var _0x2e7e9c=[];var _0x3b8516={'context':_0x215c9c[_0xe58d('0x3')]||_0xe58d('0x4'),'exten':util['format'](_0xe58d('0x5'),_0xddd1fc[_0xe58d('0x6')],_0x574566),'type':'system','isApp':![],'ChanSpyId':_0xddd1fc['id'],'UserId':_0x215c9c['id']};_0x2e7e9c[_0xe58d('0x7')](_['merge']({'app':_0xe58d('0x8'),'appdata':util[_0xe58d('0x9')](_0xe58d('0xa'),'chanspy'),'priority':_0x3bcb9b++},_0x3b8516));if(_0xddd1fc[_0xe58d('0xb')]){_0x2e7e9c[_0xe58d('0x7')](_[_0xe58d('0xc')]({'app':_0xe58d('0xd'),'appdata':util[_0xe58d('0x9')](_0xe58d('0xe'),_0xddd1fc[_0xe58d('0xf')]),'priority':_0x3bcb9b++},_0x3b8516));}if(_0xddd1fc['auth']){_0x2e7e9c[_0xe58d('0x7')](_[_0xe58d('0xc')]({'app':'Authenticate','appdata':_0xddd1fc[_0xe58d('0x10')],'priority':_0x3bcb9b++},_0x3b8516));}_0x2e7e9c[_0xe58d('0x7')](_['merge']({'app':_0xe58d('0x11'),'appdata':util[_0xe58d('0x9')]('SIP/%s,%s',_0x215c9c['name'],_0xddd1fc[_0xe58d('0x12')]?_0xddd1fc[_0xe58d('0x12')][_0xe58d('0x13')](''):''),'priority':_0x3bcb9b++},_0x3b8516));if(_0xddd1fc[_0xe58d('0xb')]){_0x2e7e9c['push'](_[_0xe58d('0xc')]({'app':_0xe58d('0x14'),'priority':_0x3bcb9b++},_0x3b8516));}return _0x2e7e9c;};var getChanSpyApplications=function(_0x4d962a,_0x584b81){var _0x8dfaed=[];for(var _0x2d0d78=0x0,_0xec09e3=0x1;_0x2d0d78<_0x584b81['length'];_0x2d0d78++,_0xec09e3=0x1){_0x8dfaed=_0x8dfaed[_0xe58d('0x15')](getUserApplications(_0x4d962a,_0x584b81[_0x2d0d78],_0x584b81[_0x2d0d78][_0xe58d('0x16')]));if(_0x584b81[_0x2d0d78][_0xe58d('0x16')]!=_0x584b81[_0x2d0d78][_0xe58d('0x17')]){_0x8dfaed=_0x8dfaed[_0xe58d('0x15')](getUserApplications(_0x4d962a,_0x584b81[_0x2d0d78],_0x584b81[_0x2d0d78][_0xe58d('0x17')]));}}return _0x8dfaed;};var getChanSpyPromise=function(_0x49b509,_0x253910){return new BPromise(function(_0x1cb0c6,_0x50b940){return _0x49b509[_0xe58d('0x18')]['findAll']({'attributes':['id','name',_0xe58d('0x16')],'where':{'role':_0xe58d('0x19'),'chanspy':!![]},'raw':!![]})[_0xe58d('0x1a')](function(_0x109154){if(_0x109154){return _0x1cb0c6(getChanSpyApplications(_0x253910,_0x109154));}return _0x1cb0c6([]);})['catch'](function(_0x155ea6){_0x50b940(_0x155ea6);});});};module[_0xe58d('0x1b')]=function(_0x4b4124,_0x593c1b){var _0x374f77=_0x4b4124[_0xe58d('0x1c')];return _0x4b4124[_0xe58d('0x1d')](_0xe58d('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x25be66,_0x511a43,_0x17bd06){return getChanSpyPromise(_0x374f77,_0x25be66)[_0xe58d('0x1a')](function(_0x50a9c5){if(_0x50a9c5&&_0x50a9c5[_0xe58d('0x1f')]){return _0x374f77[_0xe58d('0x20')][_0xe58d('0x21')](_0x50a9c5);}})[_0xe58d('0x1a')](function(){_0x17bd06();})[_0xe58d('0x22')](function(_0x27b914){_0x17bd06(_0x27b914);});},'afterUpdate':function(_0x3a6384,_0x3ce1c6,_0x3a713c){return _0x374f77['VoiceExtension'][_0xe58d('0x23')]({'where':{'ChanSpyId':_0x3a6384['id']}})['then'](function(){return getChanSpyPromise(_0x374f77,_0x3a6384);})['then'](function(_0x380aed){if(_0x380aed&&_0x380aed[_0xe58d('0x1f')]){return _0x374f77['VoiceExtension'][_0xe58d('0x21')](_0x380aed);}})['then'](function(){_0x3a713c();})[_0xe58d('0x22')](function(_0x2ebb9d){_0x3a713c(_0x2ebb9d);});},'afterDestroy':function(_0x597077,_0x5ea282,_0x2865bd){return _0x374f77['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x597077['id']}})[_0xe58d('0x1a')](function(){_0x2865bd();})[_0xe58d('0x22')](function(_0x116f29){_0x2865bd(_0x116f29);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 82c31da..833e06a 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 _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 +var _0x2750=['jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x501942,_0x2e712f){var _0x3d37e1=function(_0x43e7bf){while(--_0x43e7bf){_0x501942['push'](_0x501942['shift']());}};_0x3d37e1(++_0x2e712f);}(_0x2750,0x13b));var _0x0275=function(_0x30aba9,_0x27185d){_0x30aba9=_0x30aba9-0x0;var _0x1a9315=_0x2750[_0x30aba9];return _0x1a9315;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4ec0083..4ad0eef 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 _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 +var _0x47c4=['put','/:id','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','post','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x47c4,0x1a6));var _0x447c=function(_0x33f34e,_0x4fde5b){_0x33f34e=_0x33f34e-0x0;var _0x58dc01=_0x47c4[_0x33f34e];return _0x58dc01;};'use strict';var multer=require(_0x447c('0x0'));var util=require(_0x447c('0x1'));var path=require(_0x447c('0x2'));var timeout=require(_0x447c('0x3'));var express=require('express');var router=express[_0x447c('0x4')]();var fs_extra=require(_0x447c('0x5'));var auth=require(_0x447c('0x6'));var interaction=require(_0x447c('0x7'));var config=require(_0x447c('0x8'));var controller=require(_0x447c('0x9'));router[_0x447c('0xa')]('/',auth[_0x447c('0xb')](),controller[_0x447c('0xc')]);router[_0x447c('0xa')]('/:id',auth[_0x447c('0xb')](),controller['show']);router[_0x447c('0xd')]('/',auth[_0x447c('0xb')](),controller[_0x447c('0xe')]);router[_0x447c('0xf')](_0x447c('0x10'),auth[_0x447c('0xb')](),controller[_0x447c('0x11')]);router['delete']('/:id',auth[_0x447c('0xb')](),controller[_0x447c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 4bd0c9f..dca5820 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 _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 +var _0x4374=['name','BOOLEAN','exports','STRING'];(function(_0x4e969a,_0x11efc3){var _0x4c37ce=function(_0x499e9f){while(--_0x499e9f){_0x4e969a['push'](_0x4e969a['shift']());}};_0x4c37ce(++_0x11efc3);}(_0x4374,0xae));var _0x4437=function(_0x8d7d99,_0x58fd90){_0x8d7d99=_0x8d7d99-0x0;var _0x5ddd6a=_0x4374[_0x8d7d99];return _0x5ddd6a;};'use strict';var Sequelize=require('sequelize');module[_0x4437('0x0')]={'name':{'type':Sequelize[_0x4437('0x1')],'unique':_0x4437('0x2')},'description':{'type':Sequelize[_0x4437('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x4437('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 3aef852..d85af11 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 _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 +var _0x44c3=['pick','VIRTUAL','options','includeAll','findAll','show','params','include','merge','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','render','writeFileSync','join','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','get','Contexts','destroy','stack','name','send','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where'];(function(_0x5bd332,_0x2a930a){var _0x54079b=function(_0x4d510b){while(--_0x4d510b){_0x5bd332['push'](_0x5bd332['shift']());}};_0x54079b(++_0x2a930a);}(_0x44c3,0xea));var _0x344c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x44c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x344c('0x0'));var rimraf=require(_0x344c('0x1'));var zipdir=require(_0x344c('0x2'));var jsonpatch=require(_0x344c('0x3'));var rp=require('request-promise');var moment=require(_0x344c('0x4'));var BPromise=require(_0x344c('0x5'));var Mustache=require(_0x344c('0x6'));var util=require(_0x344c('0x7'));var path=require(_0x344c('0x8'));var sox=require('sox');var csv=require(_0x344c('0x9'));var ejs=require(_0x344c('0xa'));var fs=require('fs');var fs_extra=require(_0x344c('0xb'));var _=require(_0x344c('0xc'));var squel=require(_0x344c('0xd'));var crypto=require('crypto');var jsforce=require(_0x344c('0xe'));var deskjs=require(_0x344c('0xf'));var toCsv=require(_0x344c('0x9'));var querystring=require('querystring');var Papa=require(_0x344c('0x10'));var Redis=require(_0x344c('0x11'));var authService=require(_0x344c('0x12'));var qs=require(_0x344c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x344c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x344c('0x15'));var config=require(_0x344c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x344c('0x17'))['db'];var jayson=require(_0x344c('0x18'));var client=jayson[_0x344c('0x19')][_0x344c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x31dbae,_0x127f96,_0xeb2696,_0x51c5a9){return new BPromise(function(_0x4dd746,_0x497437){var _0x4e563c=_0x51c5a9||client;return _0x4e563c[_0x344c('0x1b')](_0x31dbae,_0xeb2696)[_0x344c('0x1c')](function(_0x54374a){logger[_0x344c('0x1d')](_0x344c('0x1e'),_0x127f96,_0x344c('0x1f'));logger[_0x344c('0x20')](_0x344c('0x21'),_0x127f96,_0x344c('0x1f'),JSON[_0x344c('0x22')](_0x54374a));if(_0x54374a[_0x344c('0x23')]){if(_0x54374a['error'][_0x344c('0x24')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x127f96,_0x54374a['error']['message']);return _0x497437(_0x54374a[_0x344c('0x23')][_0x344c('0x25')]);}logger[_0x344c('0x23')](_0x344c('0x1e'),_0x127f96,_0x54374a[_0x344c('0x23')]['message']);return _0x4dd746(_0x54374a['error'][_0x344c('0x25')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x127f96,_0x344c('0x1f'));_0x4dd746(_0x54374a[_0x344c('0x26')][_0x344c('0x25')]);}})[_0x344c('0x27')](function(_0x5c646c){logger[_0x344c('0x23')](_0x344c('0x1e'),_0x127f96,_0x5c646c);_0x497437(_0x5c646c);});});}function respondWithStatusCode(_0x17aa44,_0x43950f){_0x43950f=_0x43950f||0xcc;return function(_0xb35a6b){if(_0xb35a6b){return _0x17aa44[_0x344c('0x28')](_0x43950f);}return _0x17aa44[_0x344c('0x29')](_0x43950f)['end']();};}function respondWithResult(_0xd68136,_0x127e85){_0x127e85=_0x127e85||0xc8;return function(_0x4db917){if(_0x4db917){return _0xd68136['status'](_0x127e85)[_0x344c('0x2a')](_0x4db917);}};}function respondWithFilteredResult(_0x2d566a,_0x532b37){return function(_0x137dce){if(_0x137dce){var _0x15ccdb=typeof _0x532b37[_0x344c('0x2b')]===_0x344c('0x2c')&&typeof _0x532b37[_0x344c('0x2d')]===_0x344c('0x2c');var _0xdec8f0=_0x137dce['count'];var _0x4b8a7c=_0x15ccdb?0x0:_0x532b37[_0x344c('0x2b')];var _0x38c8b1=_0x15ccdb?_0x137dce[_0x344c('0x2e')]:_0x532b37[_0x344c('0x2b')]+_0x532b37[_0x344c('0x2d')];var _0x348ce6;if(_0x38c8b1>=_0xdec8f0){_0x38c8b1=_0xdec8f0;_0x348ce6=0xc8;}else{_0x348ce6=0xce;}_0x2d566a[_0x344c('0x29')](_0x348ce6);return _0x2d566a['set'](_0x344c('0x2f'),_0x4b8a7c+'-'+_0x38c8b1+'/'+_0xdec8f0)[_0x344c('0x2a')](_0x137dce);}return null;};}function patchUpdates(_0x7cd92c){return function(_0x360be1){try{jsonpatch[_0x344c('0x30')](_0x360be1,_0x7cd92c,!![]);}catch(_0x23e9b9){return BPromise['reject'](_0x23e9b9);}return _0x360be1[_0x344c('0x31')]();};}function saveUpdates(_0x3adcf3,_0x50c430){return function(_0x19b681){if(_0x19b681){return _0x19b681[_0x344c('0x32')](_0x3adcf3)['then'](function(_0x25027a){return _0x25027a;});}return null;};}function removeEntity(_0x479b73,_0x2bc822){return function(_0x4af28b){if(_0x4af28b){return _0x4af28b['destroy']()[_0x344c('0x1c')](function(){var _0x25583b=_0x4af28b[_0x344c('0x33')]({'plain':!![]});var _0x441e93=_0x344c('0x34');return db['UserProfileResource'][_0x344c('0x35')]({'where':{'type':_0x441e93,'resourceId':_0x25583b['id']}})[_0x344c('0x1c')](function(){return _0x4af28b;});})[_0x344c('0x1c')](function(){_0x479b73['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c43d6,_0x5de4a5){return function(_0x488604){if(!_0x488604){_0x1c43d6['sendStatus'](0x194);}return _0x488604;};}function handleError(_0x3c3ed7,_0x218882){_0x218882=_0x218882||0x1f4;return function(_0x265f19){logger['error'](_0x265f19[_0x344c('0x36')]);if(_0x265f19[_0x344c('0x37')]){delete _0x265f19[_0x344c('0x37')];}_0x3c3ed7[_0x344c('0x29')](_0x218882)[_0x344c('0x38')](_0x265f19);};}exports[_0x344c('0x39')]=function(_0x11c2a3,_0x5706fc){var _0x4b9c9a={},_0x54ec8d={},_0x28720a={'count':0x0,'rows':[]};var _0x5c055b=_['map'](db[_0x344c('0x3a')][_0x344c('0x3b')],function(_0x57ba9a){return{'name':_0x57ba9a[_0x344c('0x3c')],'type':_0x57ba9a[_0x344c('0x3d')][_0x344c('0x3e')]};});_0x54ec8d[_0x344c('0x3f')]=_[_0x344c('0x40')](_0x5c055b,_0x344c('0x37'));_0x54ec8d[_0x344c('0x41')]=_[_0x344c('0x42')](_0x11c2a3['query']);_0x54ec8d[_0x344c('0x43')]=_[_0x344c('0x44')](_0x54ec8d['model'],_0x54ec8d[_0x344c('0x41')]);_0x4b9c9a[_0x344c('0x45')]=_['intersection'](_0x54ec8d[_0x344c('0x3f')],qs[_0x344c('0x46')](_0x11c2a3[_0x344c('0x41')]['fields']));_0x4b9c9a[_0x344c('0x45')]=_0x4b9c9a['attributes']['length']?_0x4b9c9a['attributes']:_0x54ec8d[_0x344c('0x3f')];if(!_0x11c2a3[_0x344c('0x41')]['hasOwnProperty'](_0x344c('0x47'))){_0x4b9c9a[_0x344c('0x2d')]=qs[_0x344c('0x2d')](_0x11c2a3['query'][_0x344c('0x2d')]);_0x4b9c9a[_0x344c('0x2b')]=qs[_0x344c('0x2b')](_0x11c2a3['query'][_0x344c('0x2b')]);}_0x4b9c9a[_0x344c('0x48')]=qs[_0x344c('0x49')](_0x11c2a3[_0x344c('0x41')][_0x344c('0x49')]);_0x4b9c9a[_0x344c('0x4a')]=qs[_0x344c('0x43')](_[_0x344c('0x4b')](_0x11c2a3[_0x344c('0x41')],_0x54ec8d[_0x344c('0x43')]),_0x5c055b);if(_0x11c2a3['query']['filter']){_0x4b9c9a[_0x344c('0x4a')]=_['merge'](_0x4b9c9a['where'],{'$or':_['map'](_0x5c055b,function(_0x2e75b7){if(_0x2e75b7[_0x344c('0x3d')]!==_0x344c('0x4c')){var _0x149f58={};_0x149f58[_0x2e75b7[_0x344c('0x37')]]={'$like':'%'+_0x11c2a3[_0x344c('0x41')]['filter']+'%'};return _0x149f58;}})});}_0x4b9c9a=_['merge']({},_0x4b9c9a,_0x11c2a3[_0x344c('0x4d')]);var _0xbda49c={'where':_0x4b9c9a['where']};return db[_0x344c('0x3a')][_0x344c('0x2e')](_0xbda49c)[_0x344c('0x1c')](function(_0x26ce11){_0x28720a[_0x344c('0x2e')]=_0x26ce11;if(_0x11c2a3[_0x344c('0x41')][_0x344c('0x4e')]){_0x4b9c9a['include']=[{'all':!![]}];}return db[_0x344c('0x3a')][_0x344c('0x4f')](_0x4b9c9a);})['then'](function(_0x51c05d){_0x28720a['rows']=_0x51c05d;return _0x28720a;})[_0x344c('0x1c')](respondWithFilteredResult(_0x5706fc,_0x4b9c9a))['catch'](handleError(_0x5706fc,null));};exports[_0x344c('0x50')]=function(_0x1ddf2f,_0x5df9de){var _0x52c105={'raw':![],'where':{'id':_0x1ddf2f[_0x344c('0x51')]['id']}},_0x47dff5={};_0x47dff5['model']=_['keys'](db[_0x344c('0x3a')][_0x344c('0x3b')]);_0x47dff5[_0x344c('0x41')]=_[_0x344c('0x42')](_0x1ddf2f['query']);_0x47dff5['filters']=_[_0x344c('0x44')](_0x47dff5[_0x344c('0x3f')],_0x47dff5[_0x344c('0x41')]);_0x52c105['attributes']=_[_0x344c('0x44')](_0x47dff5[_0x344c('0x3f')],qs[_0x344c('0x46')](_0x1ddf2f[_0x344c('0x41')][_0x344c('0x46')]));_0x52c105[_0x344c('0x45')]=_0x52c105[_0x344c('0x45')]['length']?_0x52c105['attributes']:_0x47dff5[_0x344c('0x3f')];if(_0x1ddf2f['query']['includeAll']){_0x52c105[_0x344c('0x52')]=[{'all':!![]}];}_0x52c105=_[_0x344c('0x53')]({},_0x52c105,_0x1ddf2f[_0x344c('0x4d')]);return db[_0x344c('0x3a')][_0x344c('0x54')](_0x52c105)[_0x344c('0x1c')](handleEntityNotFound(_0x5df9de,null))[_0x344c('0x1c')](respondWithResult(_0x5df9de,null))['catch'](handleError(_0x5df9de,null));};exports[_0x344c('0x55')]=function(_0xe4cc67,_0x5a2bbb,_0xcb1a94){var _0x2c2fce;return db[_0x344c('0x3a')][_0x344c('0x55')](_0xe4cc67[_0x344c('0x56')],{'raw':!![]})['then'](function(_0x497f8b){_0x2c2fce=_0x497f8b;return db['VoiceContext'][_0x344c('0x4f')]({'raw':!![]});})[_0x344c('0x1c')](function(_0x4246f8){var _0x3bac10=fs[_0x344c('0x57')](path['join'](config[_0x344c('0x58')],_0x344c('0x59')),_0x344c('0x5a'));var _0x397b64=ejs['render'](_0x3bac10,{'contexts':_0x4246f8||[]});fs['writeFileSync'](_0x344c('0x5b'),_0x397b64);})[_0x344c('0x1c')](function(){return respondWithRpcPromise(_0x344c('0x5c'),_0x344c('0x55'),{'module':_0x344c('0x5d')});})[_0x344c('0x1c')](function(){var _0x36a13d=_0xe4cc67[_0x344c('0x5e')][_0x344c('0x33')]({'plain':!![]});if(!_0x36a13d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36a13d[_0x344c('0x5f')]==='user'){var _0x958cb9=_0x2c2fce[_0x344c('0x33')]({'plain':!![]});return db[_0x344c('0x60')][_0x344c('0x54')]({'where':{'name':_0x344c('0x34'),'userProfileId':_0x36a13d[_0x344c('0x61')]},'raw':!![]})[_0x344c('0x1c')](function(_0x26f07b){if(_0x26f07b&&_0x26f07b[_0x344c('0x62')]===0x0){return db[_0x344c('0x63')][_0x344c('0x55')]({'name':_0x958cb9['name'],'resourceId':_0x958cb9['id'],'type':_0x26f07b[_0x344c('0x37')],'sectionId':_0x26f07b['id']},{})[_0x344c('0x1c')](function(){return _0x2c2fce;});}else{return _0x2c2fce;}})[_0x344c('0x27')](function(_0xe88143){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe88143);throw _0xe88143;});}return _0x2c2fce;})[_0x344c('0x1c')](respondWithResult(_0x5a2bbb,0xc9))[_0x344c('0x27')](handleError(_0x5a2bbb,null));};exports['update']=function(_0x1a0986,_0x3e125d,_0x59a069){var _0x4b68c6;return db[_0x344c('0x3a')][_0x344c('0x54')]({'where':{'id':_0x1a0986['params']['id']}})[_0x344c('0x1c')](handleEntityNotFound(_0x3e125d,null))[_0x344c('0x1c')](saveUpdates(_0x1a0986[_0x344c('0x56')],null))[_0x344c('0x1c')](function(_0x26e548){if(_0x26e548){_0x4b68c6=_0x26e548;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x344c('0x1c')](function(_0x567179){var _0x3a158a=fs['readFileSync'](path['join'](config[_0x344c('0x58')],_0x344c('0x59')),'utf8');var _0x12191c=ejs[_0x344c('0x64')](_0x3a158a,{'contexts':_0x567179||[]});fs[_0x344c('0x65')](_0x344c('0x5b'),_0x12191c);})[_0x344c('0x1c')](function(){return respondWithRpcPromise(_0x344c('0x5c'),_0x344c('0x32'),{'module':'chan_sip.so'});})['then'](function(){return _0x4b68c6;})[_0x344c('0x1c')](respondWithResult(_0x3e125d,null))[_0x344c('0x27')](handleError(_0x3e125d,null));};exports[_0x344c('0x35')]=function(_0xb46ba8,_0x41ac8d,_0x34802f){var _0x5214c3;return db['VoiceContext'][_0x344c('0x54')]({'where':{'id':_0xb46ba8['params']['id']}})[_0x344c('0x1c')](handleEntityNotFound(_0x41ac8d,null))[_0x344c('0x1c')](removeEntity(_0x41ac8d,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x305e07){var _0x478afc=fs[_0x344c('0x57')](path[_0x344c('0x66')](config[_0x344c('0x58')],'server/files/templates/context.ejs'),_0x344c('0x5a'));var _0x4f0088=ejs[_0x344c('0x64')](_0x478afc,{'contexts':_0x305e07});fs[_0x344c('0x65')](_0x344c('0x5b'),_0x4f0088);return respondWithRpcPromise(_0x344c('0x5c'),_0x344c('0x35'),{'module':_0x344c('0x5d')});})[_0x344c('0x27')](handleError(_0x41ac8d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 5ffb596..56bcd2f 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 _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 +var _0x3b99=['path','../../config/environment','./voiceContext.attributes','define','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x33cf79,_0x2e4446){var _0x266724=function(_0x371efb){while(--_0x371efb){_0x33cf79['push'](_0x33cf79['shift']());}};_0x266724(++_0x2e4446);}(_0x3b99,0x161));var _0x93b9=function(_0x22653b,_0x5969a7){_0x22653b=_0x22653b-0x0;var _0x48da0d=_0x3b99[_0x22653b];return _0x48da0d;};'use strict';var _=require(_0x93b9('0x0'));var util=require(_0x93b9('0x1'));var logger=require(_0x93b9('0x2'))(_0x93b9('0x3'));var moment=require(_0x93b9('0x4'));var BPromise=require(_0x93b9('0x5'));var rp=require(_0x93b9('0x6'));var fs=require('fs');var path=require(_0x93b9('0x7'));var rimraf=require('rimraf');var config=require(_0x93b9('0x8'));var attributes=require(_0x93b9('0x9'));module['exports']=function(_0x53894f,_0x3d735f){return _0x53894f[_0x93b9('0xa')]('VoiceContext',attributes,{'tableName':_0x93b9('0xb'),'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 c260d55..18f246a 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 _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 +var _0x3715=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4288a3,_0x4edf77){var _0x402e72=function(_0x575893){while(--_0x575893){_0x4288a3['push'](_0x4288a3['shift']());}};_0x402e72(++_0x4edf77);}(_0x3715,0xc3));var _0x5371=function(_0x8ba59,_0x41fe65){_0x8ba59=_0x8ba59-0x0;var _0x5acd28=_0x3715[_0x8ba59];return _0x5acd28;};'use strict';var _=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var moment=require(_0x5371('0x2'));var BPromise=require(_0x5371('0x3'));var rs=require(_0x5371('0x4'));var fs=require('fs');var Redis=require(_0x5371('0x5'));var db=require(_0x5371('0x6'))['db'];var utils=require(_0x5371('0x7'));var logger=require(_0x5371('0x8'))(_0x5371('0x9'));var config=require(_0x5371('0xa'));var jayson=require(_0x5371('0xb'));var client=jayson['client'][_0x5371('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x340e44,_0x5edddc,_0x426a2a){return new BPromise(function(_0x16c64a,_0x41d142){return client['request'](_0x340e44,_0x426a2a)[_0x5371('0xd')](function(_0x48b76c){logger['info'](_0x5371('0xe'),_0x5edddc,_0x5371('0xf'));logger[_0x5371('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5edddc,_0x5371('0xf'),JSON[_0x5371('0x11')](_0x48b76c));if(_0x48b76c[_0x5371('0x12')]){if(_0x48b76c['error'][_0x5371('0x13')]===0x1f4){logger[_0x5371('0x12')](_0x5371('0xe'),_0x5edddc,_0x48b76c[_0x5371('0x12')]['message']);return _0x41d142(_0x48b76c[_0x5371('0x12')]['message']);}logger[_0x5371('0x12')](_0x5371('0xe'),_0x5edddc,_0x48b76c['error'][_0x5371('0x14')]);return _0x16c64a(_0x48b76c[_0x5371('0x12')][_0x5371('0x14')]);}else{logger[_0x5371('0x15')](_0x5371('0xe'),_0x5edddc,_0x5371('0xf'));_0x16c64a(_0x48b76c[_0x5371('0x16')]['message']);}})[_0x5371('0x17')](function(_0x3e7169){logger[_0x5371('0x12')](_0x5371('0xe'),_0x5edddc,_0x3e7169);_0x41d142(_0x3e7169);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 75d33a7..71577d3 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 _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 +var _0x8d76=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','multer'];(function(_0x217121,_0x18a421){var _0x2cebae=function(_0x21a0e1){while(--_0x21a0e1){_0x217121['push'](_0x217121['shift']());}};_0x2cebae(++_0x18a421);}(_0x8d76,0x14f));var _0x68d7=function(_0x113368,_0x12661b){_0x113368=_0x113368-0x0;var _0x175002=_0x8d76[_0x113368];return _0x175002;};'use strict';var multer=require(_0x68d7('0x0'));var util=require(_0x68d7('0x1'));var path=require(_0x68d7('0x2'));var timeout=require(_0x68d7('0x3'));var express=require(_0x68d7('0x4'));var router=express[_0x68d7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x68d7('0x6'));var interaction=require(_0x68d7('0x7'));var config=require(_0x68d7('0x8'));var controller=require(_0x68d7('0x9'));router[_0x68d7('0xa')]('/',auth[_0x68d7('0xb')](),controller[_0x68d7('0xc')]);router[_0x68d7('0xa')](_0x68d7('0xd'),auth[_0x68d7('0xb')](),controller[_0x68d7('0xe')]);router['get'](_0x68d7('0xf'),auth[_0x68d7('0xb')](),controller[_0x68d7('0x10')]);router[_0x68d7('0x11')]('/',auth[_0x68d7('0xb')](),controller['create']);router[_0x68d7('0x12')](_0x68d7('0xf'),auth[_0x68d7('0xb')](),controller['update']);router[_0x68d7('0x13')](_0x68d7('0xf'),auth['isAuthenticated'](),controller[_0x68d7('0x14')]);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 537c89a..abbd0dc 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_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 +var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x54ef,0x112));var _0xf54e=function(_0x2288fd,_0x170a65){_0x2288fd=_0x2288fd-0x0;var _0x45465d=_0x54ef[_0x2288fd];return _0x45465d;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 1ae03a4..a193026 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 _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 +var _0x93e6=['end','undefined','limit','count','offset','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','status'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0x93e6,0xfe));var _0x693e=function(_0x430277,_0x1efad3){_0x430277=_0x430277-0x0;var _0x3ed44b=_0x93e6[_0x430277];return _0x3ed44b;};'use strict';var emlformat=require(_0x693e('0x0'));var rimraf=require(_0x693e('0x1'));var zipdir=require(_0x693e('0x2'));var jsonpatch=require(_0x693e('0x3'));var rp=require(_0x693e('0x4'));var moment=require(_0x693e('0x5'));var BPromise=require(_0x693e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x693e('0x7'));var csv=require('to-csv');var ejs=require(_0x693e('0x8'));var fs=require('fs');var fs_extra=require(_0x693e('0x9'));var _=require(_0x693e('0xa'));var squel=require(_0x693e('0xb'));var crypto=require(_0x693e('0xc'));var jsforce=require(_0x693e('0xd'));var deskjs=require(_0x693e('0xe'));var toCsv=require(_0x693e('0xf'));var querystring=require('querystring');var Papa=require(_0x693e('0x10'));var Redis=require('ioredis');var authService=require(_0x693e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x693e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x693e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x693e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x448cf1,_0x24ad9c){_0x24ad9c=_0x24ad9c||0xcc;return function(_0x710183){if(_0x710183){return _0x448cf1['sendStatus'](_0x24ad9c);}return _0x448cf1[_0x693e('0x15')](_0x24ad9c)[_0x693e('0x16')]();};}function respondWithResult(_0x2fecd0,_0x3c572e){_0x3c572e=_0x3c572e||0xc8;return function(_0x4644b4){if(_0x4644b4){return _0x2fecd0[_0x693e('0x15')](_0x3c572e)['json'](_0x4644b4);}};}function respondWithFilteredResult(_0x3d9020,_0xd2c5c4){return function(_0x464705){if(_0x464705){var _0x5fc3f6=typeof _0xd2c5c4['offset']===_0x693e('0x17')&&typeof _0xd2c5c4[_0x693e('0x18')]===_0x693e('0x17');var _0x2684de=_0x464705[_0x693e('0x19')];var _0x4b6cb1=_0x5fc3f6?0x0:_0xd2c5c4[_0x693e('0x1a')];var _0x5800e3=_0x5fc3f6?_0x464705[_0x693e('0x19')]:_0xd2c5c4[_0x693e('0x1a')]+_0xd2c5c4[_0x693e('0x18')];var _0x346b7d;if(_0x5800e3>=_0x2684de){_0x5800e3=_0x2684de;_0x346b7d=0xc8;}else{_0x346b7d=0xce;}_0x3d9020[_0x693e('0x15')](_0x346b7d);return _0x3d9020['set'](_0x693e('0x1b'),_0x4b6cb1+'-'+_0x5800e3+'/'+_0x2684de)[_0x693e('0x1c')](_0x464705);}return null;};}function patchUpdates(_0x9eed0b){return function(_0x35a694){try{jsonpatch[_0x693e('0x1d')](_0x35a694,_0x9eed0b,!![]);}catch(_0x27f1ea){return BPromise['reject'](_0x27f1ea);}return _0x35a694[_0x693e('0x1e')]();};}function saveUpdates(_0x276138,_0x10aa21){return function(_0x461c1c){if(_0x461c1c){return _0x461c1c[_0x693e('0x1f')](_0x276138)['then'](function(_0x1fc357){return _0x1fc357;});}return null;};}function removeEntity(_0x67300e,_0x3fff79){return function(_0x3cdc5e){if(_0x3cdc5e){return _0x3cdc5e[_0x693e('0x20')]()[_0x693e('0x21')](function(){_0x67300e['status'](0xcc)[_0x693e('0x16')]();});}};}function handleEntityNotFound(_0x504516,_0x4865fb){return function(_0x18f6ea){if(!_0x18f6ea){_0x504516['sendStatus'](0x194);}return _0x18f6ea;};}function handleError(_0x8c353a,_0x393844){_0x393844=_0x393844||0x1f4;return function(_0x12aa47){logger[_0x693e('0x22')](_0x12aa47[_0x693e('0x23')]);if(_0x12aa47[_0x693e('0x24')]){delete _0x12aa47[_0x693e('0x24')];}_0x8c353a[_0x693e('0x15')](_0x393844)[_0x693e('0x25')](_0x12aa47);};}exports[_0x693e('0x26')]=function(_0x298a61,_0x27c90b){var _0x54bd51={},_0x24435a={},_0x1574b3={'count':0x0,'rows':[]};var _0x5a7443=_[_0x693e('0x27')](db[_0x693e('0x28')]['rawAttributes'],function(_0x51c752){return{'name':_0x51c752[_0x693e('0x29')],'type':_0x51c752[_0x693e('0x2a')]['key']};});_0x24435a[_0x693e('0x2b')]=_['map'](_0x5a7443,_0x693e('0x24'));_0x24435a[_0x693e('0x2c')]=_[_0x693e('0x2d')](_0x298a61[_0x693e('0x2c')]);_0x24435a[_0x693e('0x2e')]=_[_0x693e('0x2f')](_0x24435a[_0x693e('0x2b')],_0x24435a[_0x693e('0x2c')]);_0x54bd51[_0x693e('0x30')]=_[_0x693e('0x2f')](_0x24435a[_0x693e('0x2b')],qs[_0x693e('0x31')](_0x298a61['query'][_0x693e('0x31')]));_0x54bd51[_0x693e('0x30')]=_0x54bd51[_0x693e('0x30')]['length']?_0x54bd51[_0x693e('0x30')]:_0x24435a[_0x693e('0x2b')];if(!_0x298a61[_0x693e('0x2c')]['hasOwnProperty'](_0x693e('0x32'))){_0x54bd51[_0x693e('0x18')]=qs[_0x693e('0x18')](_0x298a61[_0x693e('0x2c')][_0x693e('0x18')]);_0x54bd51['offset']=qs['offset'](_0x298a61[_0x693e('0x2c')][_0x693e('0x1a')]);}_0x54bd51[_0x693e('0x33')]=qs[_0x693e('0x34')](_0x298a61[_0x693e('0x2c')][_0x693e('0x34')]);_0x54bd51['where']=qs[_0x693e('0x2e')](_[_0x693e('0x35')](_0x298a61[_0x693e('0x2c')],_0x24435a[_0x693e('0x2e')]),_0x5a7443);if(_0x298a61[_0x693e('0x2c')][_0x693e('0x36')]){_0x54bd51[_0x693e('0x37')]=_[_0x693e('0x38')](_0x54bd51[_0x693e('0x37')],{'$or':_[_0x693e('0x27')](_0x5a7443,function(_0x4eb606){if(_0x4eb606[_0x693e('0x2a')]!==_0x693e('0x39')){var _0x34fcf1={};_0x34fcf1[_0x4eb606[_0x693e('0x24')]]={'$like':'%'+_0x298a61[_0x693e('0x2c')][_0x693e('0x36')]+'%'};return _0x34fcf1;}})});}_0x54bd51=_[_0x693e('0x38')]({},_0x54bd51,_0x298a61['options']);var _0x52ae4e={'where':_0x54bd51['where']};return db['VoiceDialReport']['count'](_0x52ae4e)[_0x693e('0x21')](function(_0x5f35ae){_0x1574b3[_0x693e('0x19')]=_0x5f35ae;if(_0x298a61[_0x693e('0x2c')][_0x693e('0x3a')]){_0x54bd51[_0x693e('0x3b')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x693e('0x3c')](_0x54bd51);})[_0x693e('0x21')](function(_0x5434e6){_0x1574b3['rows']=_0x5434e6;return _0x1574b3;})[_0x693e('0x21')](respondWithFilteredResult(_0x27c90b,_0x54bd51))[_0x693e('0x3d')](handleError(_0x27c90b,null));};exports[_0x693e('0x3e')]=function(_0x54f56d,_0x30a379){var _0x549531={'raw':!![],'where':{'id':_0x54f56d[_0x693e('0x3f')]['id']}},_0x3ed3d5={};_0x3ed3d5[_0x693e('0x2b')]=_['keys'](db[_0x693e('0x28')]['rawAttributes']);_0x3ed3d5[_0x693e('0x2c')]=_['keys'](_0x54f56d[_0x693e('0x2c')]);_0x3ed3d5[_0x693e('0x2e')]=_[_0x693e('0x2f')](_0x3ed3d5[_0x693e('0x2b')],_0x3ed3d5[_0x693e('0x2c')]);_0x549531['attributes']=_[_0x693e('0x2f')](_0x3ed3d5[_0x693e('0x2b')],qs[_0x693e('0x31')](_0x54f56d[_0x693e('0x2c')][_0x693e('0x31')]));_0x549531['attributes']=_0x549531[_0x693e('0x30')][_0x693e('0x40')]?_0x549531[_0x693e('0x30')]:_0x3ed3d5[_0x693e('0x2b')];if(_0x54f56d[_0x693e('0x2c')][_0x693e('0x3a')]){_0x549531['include']=[{'all':!![]}];}_0x549531=_[_0x693e('0x38')]({},_0x549531,_0x54f56d['options']);return db[_0x693e('0x28')][_0x693e('0x41')](_0x549531)[_0x693e('0x21')](handleEntityNotFound(_0x30a379,null))['then'](respondWithResult(_0x30a379,null))[_0x693e('0x3d')](handleError(_0x30a379,null));};exports[_0x693e('0x42')]=function(_0x52f2e3,_0x1b6ac5){return db['VoiceDialReport'][_0x693e('0x42')](_0x52f2e3[_0x693e('0x43')],{})[_0x693e('0x21')](respondWithResult(_0x1b6ac5,0xc9))[_0x693e('0x3d')](handleError(_0x1b6ac5,null));};exports[_0x693e('0x1f')]=function(_0x3585a1,_0x5d0931){if(_0x3585a1['body']['id']){delete _0x3585a1[_0x693e('0x43')]['id'];}return db[_0x693e('0x28')][_0x693e('0x41')]({'where':{'id':_0x3585a1['params']['id']}})[_0x693e('0x21')](handleEntityNotFound(_0x5d0931,null))[_0x693e('0x21')](saveUpdates(_0x3585a1[_0x693e('0x43')],null))['then'](respondWithResult(_0x5d0931,null))[_0x693e('0x3d')](handleError(_0x5d0931,null));};exports[_0x693e('0x20')]=function(_0x51798b,_0x1fcfc2){return db[_0x693e('0x28')][_0x693e('0x41')]({'where':{'id':_0x51798b[_0x693e('0x3f')]['id']}})[_0x693e('0x21')](handleEntityNotFound(_0x1fcfc2,null))['then'](removeEntity(_0x1fcfc2,null))[_0x693e('0x3d')](handleError(_0x1fcfc2,null));};exports[_0x693e('0x44')]=function(_0x264691,_0x1fc6b0){return db[_0x693e('0x28')][_0x693e('0x44')]()[_0x693e('0x21')](respondWithResult(_0x1fc6b0,null))['catch'](handleError(_0x1fc6b0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f088fad..e667ae4 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 _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 +var _0x4104=['../../config/environment','define','VoiceDialReport','uniqueid','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x20b18f,_0xf29421){var _0x510ea8=function(_0x1b02f8){while(--_0x1b02f8){_0x20b18f['push'](_0x20b18f['shift']());}};_0x510ea8(++_0xf29421);}(_0x4104,0x180));var _0x4410=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x4104[_0x3074f3];return _0x53f112;};'use strict';var _=require('lodash');var util=require(_0x4410('0x0'));var logger=require(_0x4410('0x1'))('api');var moment=require(_0x4410('0x2'));var BPromise=require(_0x4410('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4410('0x4'));var rimraf=require(_0x4410('0x5'));var config=require(_0x4410('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0xc20ff7,_0x17d0bc){return _0xc20ff7[_0x4410('0x7')](_0x4410('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x4410('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 249cfa8..e02bb55 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 _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 +var _0x801a=['create','body','options','raw','debug','UpdateVoiceDialReport','VoiceDialReport','update','attributes','limit','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','info','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x801a,0xbf));var _0xa801=function(_0xb4e64e,_0x19da01){_0xb4e64e=_0xb4e64e-0x0;var _0x1b1274=_0x801a[_0xb4e64e];return _0x1b1274;};'use strict';var _=require(_0xa801('0x0'));var util=require(_0xa801('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa801('0x2'));var fs=require('fs');var Redis=require(_0xa801('0x3'));var db=require(_0xa801('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa801('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa801('0x6')][_0xa801('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23d83b,_0x608763,_0x12bf6c){return new BPromise(function(_0x36f49d,_0x2c9887){return client['request'](_0x23d83b,_0x12bf6c)['then'](function(_0x52f2a0){logger[_0xa801('0x8')]('VoiceDialReport,\x20%s,\x20%s',_0x608763,'request\x20sent');logger['debug'](_0xa801('0x9'),_0x608763,_0xa801('0xa'),JSON[_0xa801('0xb')](_0x52f2a0));if(_0x52f2a0[_0xa801('0xc')]){if(_0x52f2a0[_0xa801('0xc')][_0xa801('0xd')]===0x1f4){logger[_0xa801('0xc')](_0xa801('0xe'),_0x608763,_0x52f2a0[_0xa801('0xc')]['message']);return _0x2c9887(_0x52f2a0[_0xa801('0xc')][_0xa801('0xf')]);}logger[_0xa801('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x608763,_0x52f2a0[_0xa801('0xc')][_0xa801('0xf')]);return _0x36f49d(_0x52f2a0[_0xa801('0xc')]['message']);}else{logger[_0xa801('0x8')](_0xa801('0xe'),_0x608763,_0xa801('0xa'));_0x36f49d(_0x52f2a0[_0xa801('0x10')][_0xa801('0xf')]);}})[_0xa801('0x11')](function(_0x4c754a){logger[_0xa801('0xc')](_0xa801('0xe'),_0x608763,_0x4c754a);_0x2c9887(_0x4c754a);});});}exports[_0xa801('0x12')]=function(_0x50449a){var _0x58849c=this;return new Promise(function(_0x35edf8,_0x555c4f){return db['VoiceDialReport'][_0xa801('0x13')](_0x50449a[_0xa801('0x14')],{'raw':_0x50449a[_0xa801('0x15')]?_0x50449a['options'][_0xa801('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2b0796){logger[_0xa801('0x8')]('CreateVoiceDialReport',_0x50449a);logger[_0xa801('0x17')](_0xa801('0x12'),_0x50449a,JSON[_0xa801('0xb')](_0x2b0796));_0x35edf8(_0x2b0796);})[_0xa801('0x11')](function(_0x14b50b){logger['error']('CreateVoiceDialReport',_0x14b50b[_0xa801('0xf')],_0x50449a);_0x555c4f(_0x58849c[_0xa801('0xc')](0x1f4,_0x14b50b[_0xa801('0xf')]));});});};exports[_0xa801('0x18')]=function(_0x22697e){var _0x41bba5=this;return new Promise(function(_0x938283,_0x205154){return db[_0xa801('0x19')][_0xa801('0x1a')](_0x22697e[_0xa801('0x14')],{'raw':_0x22697e[_0xa801('0x15')]?_0x22697e[_0xa801('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22697e[_0xa801('0x15')]?_0x22697e[_0xa801('0x15')]['where']||null:null,'attributes':_0x22697e['options']?_0x22697e['options'][_0xa801('0x1b')]||null:null,'limit':_0x22697e[_0xa801('0x15')]?_0x22697e[_0xa801('0x15')][_0xa801('0x1c')]||null:null})[_0xa801('0x1d')](function(_0x41dd26){logger['info'](_0xa801('0x18'),_0x22697e);logger[_0xa801('0x17')](_0xa801('0x18'),_0x22697e,JSON['stringify'](_0x41dd26));_0x938283(_0x41dd26);})[_0xa801('0x11')](function(_0x296995){logger[_0xa801('0xc')](_0xa801('0x18'),_0x296995[_0xa801('0xf')],_0x22697e);_0x205154(_0x41bba5[_0xa801('0xc')](0x1f4,_0x296995[_0xa801('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 0a3fb58..2914f6b 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 _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 +var _0x25df=['/:id/applications','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','show','post'];(function(_0xe248ff,_0x2f658b){var _0xc45e09=function(_0x211029){while(--_0x211029){_0xe248ff['push'](_0xe248ff['shift']());}};_0xc45e09(++_0x2f658b);}(_0x25df,0xa7));var _0xf25d=function(_0x303c54,_0x46edea){_0x303c54=_0x303c54-0x0;var _0x4b5cb0=_0x25df[_0x303c54];return _0x4b5cb0;};'use strict';var multer=require('multer');var util=require(_0xf25d('0x0'));var path=require(_0xf25d('0x1'));var timeout=require(_0xf25d('0x2'));var express=require(_0xf25d('0x3'));var router=express[_0xf25d('0x4')]();var fs_extra=require(_0xf25d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf25d('0x6'));var config=require('../../config/environment');var controller=require(_0xf25d('0x7'));router[_0xf25d('0x8')]('/',auth[_0xf25d('0x9')](),controller[_0xf25d('0xa')]);router[_0xf25d('0x8')]('/:id',auth[_0xf25d('0x9')](),controller[_0xf25d('0xb')]);router[_0xf25d('0xc')]('/',auth[_0xf25d('0x9')](),controller['create']);router[_0xf25d('0xc')](_0xf25d('0xd'),auth['isAuthenticated'](),controller['addApplications']);router[_0xf25d('0xe')](_0xf25d('0xf'),auth[_0xf25d('0x9')](),controller[_0xf25d('0x10')]);router[_0xf25d('0x11')]('/:id',auth[_0xf25d('0x9')](),controller[_0xf25d('0x12')]);module[_0xf25d('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 3e9a03f..6e5c2c7 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 _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 +var _0xd8df=['BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','system','*,*,*,*','INTEGER'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd8df,0x174));var _0xfd8d=function(_0x2b3fcc,_0x103c0c){_0x2b3fcc=_0x2b3fcc-0x0;var _0x1a592d=_0xd8df[_0x2b3fcc];return _0x1a592d;};'use strict';var Sequelize=require(_0xfd8d('0x0'));module[_0xfd8d('0x1')]={'context':{'type':Sequelize[_0xfd8d('0x2')],'allowNull':![],'unique':_0xfd8d('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfd8d('0x3')},'priority':{'type':Sequelize[_0xfd8d('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xfd8d('0x3')},'tag':{'type':Sequelize[_0xfd8d('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfd8d('0x4')},'appdata':{'type':Sequelize[_0xfd8d('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xfd8d('0x5'),_0xfd8d('0x6'),_0xfd8d('0x7'),_0xfd8d('0x8'),'outbound-fax',_0xfd8d('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfd8d('0x2')],'allowNull':![],'defaultValue':_0xfd8d('0xa')},'IntervalId':{'type':Sequelize[_0xfd8d('0xb')]},'isApp':{'type':Sequelize[_0xfd8d('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xfd8d('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xfd8d('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xfd8d('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xfd8d('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xfd8d('0xd')},'answer':{'type':Sequelize[_0xfd8d('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xfd8d('0xe')],'get':function(_0x4c04b8){return this['getDataValue'](_0xfd8d('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 901ee8b..9205165 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 _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 +var _0xa771=['limit','count','set','Content-Range','json','destroy','then','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','VoiceExtension','fieldName','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','keys','rawAttributes','includeAll','params','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','InboundRoutes','internal','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','localhost','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xa771,0xb1));var _0x1a77=function(_0x3a7ce4,_0x5f32bf){_0x3a7ce4=_0x3a7ce4-0x0;var _0x215a88=_0xa771[_0x3a7ce4];return _0x215a88;};'use strict';var _=require('lodash');var Redis=require(_0x1a77('0x0'));var qs=require(_0x1a77('0x1'));var logger=require('../../config/logger')(_0x1a77('0x2'));var config=require('../../config/environment');var db=require(_0x1a77('0x3'))['db'];config[_0x1a77('0x4')]=_['defaults'](config['redis'],{'host':_0x1a77('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a77('0x4')]));require(_0x1a77('0x6'))[_0x1a77('0x7')](socket);function respondWithStatusCode(_0x4befaa,_0x2183fc){_0x2183fc=_0x2183fc||0xcc;return function(_0xecc815){if(_0xecc815){return _0x4befaa[_0x1a77('0x8')](_0x2183fc);}return _0x4befaa[_0x1a77('0x9')](_0x2183fc)[_0x1a77('0xa')]();};}function respondWithResult(_0x1d13d9,_0x4c0c1e){_0x4c0c1e=_0x4c0c1e||0xc8;return function(_0x21a87e){if(_0x21a87e){return _0x1d13d9['status'](_0x4c0c1e)['json'](_0x21a87e);}};}function respondWithFilteredResult(_0x49dac1,_0x2fecb8){return function(_0xe445bc){if(_0xe445bc){var _0x276a82=typeof _0x2fecb8[_0x1a77('0xb')]===_0x1a77('0xc')&&typeof _0x2fecb8[_0x1a77('0xd')]===_0x1a77('0xc');var _0x41e235=_0xe445bc[_0x1a77('0xe')];var _0x1b46e4=_0x276a82?0x0:_0x2fecb8[_0x1a77('0xb')];var _0x8c916d=_0x276a82?_0xe445bc[_0x1a77('0xe')]:_0x2fecb8[_0x1a77('0xb')]+_0x2fecb8[_0x1a77('0xd')];var _0x4cd021;if(_0x8c916d>=_0x41e235){_0x8c916d=_0x41e235;_0x4cd021=0xc8;}else{_0x4cd021=0xce;}_0x49dac1[_0x1a77('0x9')](_0x4cd021);return _0x49dac1[_0x1a77('0xf')](_0x1a77('0x10'),_0x1b46e4+'-'+_0x8c916d+'/'+_0x41e235)[_0x1a77('0x11')](_0xe445bc);}return null;};}function removeEntity(_0x32a86d){return function(_0x4dab84){if(_0x4dab84){return _0x4dab84[_0x1a77('0x12')]()[_0x1a77('0x13')](function(){var _0x3caf2b=_0x4dab84['get']({'plain':!![]});var _0x5e82df=[{'name':'InboundRoutes','value':_0x1a77('0x14'),'ignore':![]},{'name':_0x1a77('0x15'),'value':_0x1a77('0x16'),'ignore':![]},{'name':_0x1a77('0x17'),'value':'internal','ignore':![]}];var _0x5009c1=_(_0x5e82df)[_0x1a77('0x18')](_0x1a77('0x19'))[_0x1a77('0x1a')](_0x1a77('0x1b'))[_0x1a77('0x1b')]();if(_[_0x1a77('0x1c')](_0x5009c1,_0x3caf2b[_0x1a77('0x1d')])){return;}var _0x3483b6=_[_0x1a77('0x1e')](_0x5e82df,[_0x1a77('0x1b'),_0x3caf2b[_0x1a77('0x1d')]])[_0x1a77('0x1f')];return db[_0x1a77('0x20')]['destroy']({'where':{'type':_0x3483b6,'resourceId':_0x3caf2b['id']}})[_0x1a77('0x13')](function(){return _0x4dab84;});})[_0x1a77('0x13')](function(){_0x32a86d[_0x1a77('0x9')](0xcc)[_0x1a77('0xa')]();});}};}function handleEntityNotFound(_0x2eaf15){return function(_0xb93c20){if(!_0xb93c20){_0x2eaf15['sendStatus'](0x194);}return _0xb93c20;};}function handleError(_0x264d4f,_0x40b154){_0x40b154=_0x40b154||0x1f4;return function(_0x260051){logger[_0x1a77('0x21')](_0x260051[_0x1a77('0x22')]);if(_0x260051[_0x1a77('0x1f')]){delete _0x260051[_0x1a77('0x1f')];}_0x264d4f[_0x1a77('0x9')](_0x40b154)[_0x1a77('0x23')](_0x260051);};}exports['index']=function(_0x477ca9,_0x24947e){var _0x2cf7c1={},_0x4a316b={},_0x525611={'count':0x0,'rows':[]};var _0x3d4659=_[_0x1a77('0x1a')](db[_0x1a77('0x24')]['rawAttributes'],function(_0x234ed9){return{'name':_0x234ed9[_0x1a77('0x25')],'type':_0x234ed9[_0x1a77('0x1d')][_0x1a77('0x26')]};});_0x4a316b[_0x1a77('0x27')]=_[_0x1a77('0x1a')](_0x3d4659,_0x1a77('0x1f'));_0x4a316b['query']=_['keys'](_0x477ca9['query']);_0x4a316b[_0x1a77('0x28')]=_['intersection'](_0x4a316b[_0x1a77('0x27')],_0x4a316b[_0x1a77('0x29')]);_0x2cf7c1['attributes']=_[_0x1a77('0x2a')](_0x4a316b[_0x1a77('0x27')],qs[_0x1a77('0x2b')](_0x477ca9[_0x1a77('0x29')][_0x1a77('0x2b')]));_0x2cf7c1[_0x1a77('0x2c')]=_0x2cf7c1[_0x1a77('0x2c')][_0x1a77('0x2d')]?_0x2cf7c1[_0x1a77('0x2c')]:_0x4a316b['model'];if(!_0x477ca9[_0x1a77('0x29')][_0x1a77('0x2e')](_0x1a77('0x2f'))){_0x2cf7c1[_0x1a77('0xd')]=qs[_0x1a77('0xd')](_0x477ca9['query'][_0x1a77('0xd')]);_0x2cf7c1[_0x1a77('0xb')]=qs[_0x1a77('0xb')](_0x477ca9[_0x1a77('0x29')][_0x1a77('0xb')]);}_0x2cf7c1[_0x1a77('0x30')]=qs[_0x1a77('0x31')](_0x477ca9[_0x1a77('0x29')]['sort']);_0x2cf7c1[_0x1a77('0x32')]=qs[_0x1a77('0x28')](_[_0x1a77('0x33')](_0x477ca9['query'],_0x4a316b[_0x1a77('0x28')]),_0x3d4659);if(_0x477ca9[_0x1a77('0x29')][_0x1a77('0x18')]){_0x2cf7c1[_0x1a77('0x32')]=_[_0x1a77('0x34')](_0x2cf7c1[_0x1a77('0x32')],{'$or':_['map'](_0x3d4659,function(_0x4f0984){if(_0x4f0984[_0x1a77('0x1d')]!==_0x1a77('0x35')){var _0x1640fa={};_0x1640fa[_0x4f0984[_0x1a77('0x1f')]]={'$like':'%'+_0x477ca9[_0x1a77('0x29')][_0x1a77('0x18')]+'%'};return _0x1640fa;}})});}_0x2cf7c1=_['merge']({},_0x2cf7c1,_0x477ca9[_0x1a77('0x36')]);var _0x37d000={'where':_0x2cf7c1[_0x1a77('0x32')]};return db['VoiceExtension'][_0x1a77('0xe')](_0x37d000)['then'](function(_0x9357fb){_0x525611['count']=_0x9357fb;if(_0x477ca9[_0x1a77('0x29')]['includeAll']){_0x2cf7c1[_0x1a77('0x37')]=[{'all':!![]}];}return db[_0x1a77('0x24')][_0x1a77('0x38')](_0x2cf7c1);})[_0x1a77('0x13')](function(_0x3d469a){_0x525611[_0x1a77('0x39')]=_0x3d469a;return _0x525611;})[_0x1a77('0x13')](respondWithFilteredResult(_0x24947e,_0x2cf7c1))[_0x1a77('0x3a')](handleError(_0x24947e,null));};exports['show']=function(_0x132bef,_0x53d625){var _0x5282a7={'raw':![],'where':{'id':_0x132bef['params']['id']}},_0x3f52c7={};_0x3f52c7[_0x1a77('0x27')]=_[_0x1a77('0x3b')](db['VoiceExtension'][_0x1a77('0x3c')]);_0x3f52c7[_0x1a77('0x29')]=_['keys'](_0x132bef[_0x1a77('0x29')]);_0x3f52c7[_0x1a77('0x28')]=_[_0x1a77('0x2a')](_0x3f52c7[_0x1a77('0x27')],_0x3f52c7[_0x1a77('0x29')]);_0x5282a7[_0x1a77('0x2c')]=_[_0x1a77('0x2a')](_0x3f52c7[_0x1a77('0x27')],qs['fields'](_0x132bef[_0x1a77('0x29')][_0x1a77('0x2b')]));_0x5282a7['attributes']=_0x5282a7['attributes'][_0x1a77('0x2d')]?_0x5282a7['attributes']:_0x3f52c7[_0x1a77('0x27')];if(_0x132bef['query'][_0x1a77('0x3d')]){_0x5282a7[_0x1a77('0x37')]=[{'all':!![]}];}_0x5282a7=_[_0x1a77('0x34')]({},_0x5282a7,_0x132bef[_0x1a77('0x36')]);return db['VoiceExtension']['find'](_0x5282a7)['then'](handleEntityNotFound(_0x53d625,null))['then'](respondWithResult(_0x53d625,null))['catch'](handleError(_0x53d625,null));};exports[_0x1a77('0x12')]=function(_0x2f7d9e,_0x172273){return db[_0x1a77('0x24')][_0x1a77('0x1e')]({'where':{'id':_0x2f7d9e[_0x1a77('0x3e')]['id']}})['then'](handleEntityNotFound(_0x172273,null))[_0x1a77('0x13')](removeEntity(_0x172273,null))['catch'](handleError(_0x172273,null));};exports['create']=function(_0x59f796,_0x19cea0){if(_0x59f796[_0x1a77('0x3f')]['type']==='outbound'&&!_[_0x1a77('0x40')](_0x59f796['body']['exten'],'_')){_0x59f796[_0x1a77('0x3f')][_0x1a77('0x41')]='_'[_0x1a77('0x42')](_0x59f796[_0x1a77('0x3f')][_0x1a77('0x41')]);}return db[_0x1a77('0x24')][_0x1a77('0x43')](_0x59f796['body'],{'raw':![]})['then'](function(_0x313567){var _0x5aef5d=_0x59f796[_0x1a77('0x44')]['get']({'plain':!![]});if(!_0x5aef5d)throw new Error(_0x1a77('0x45'));if(_0x5aef5d[_0x1a77('0x46')]===_0x1a77('0x44')){var _0x4f965=_0x313567[_0x1a77('0x47')]({'plain':!![]});var _0x14cf20=[{'name':_0x1a77('0x48'),'value':_0x1a77('0x14')},{'name':'OutboundRoutes','value':_0x1a77('0x16')},{'name':_0x1a77('0x17'),'value':_0x1a77('0x49')}];var _0x56766e=_[_0x1a77('0x1e')](_0x14cf20,[_0x1a77('0x1b'),_0x4f965[_0x1a77('0x1d')]])[_0x1a77('0x1f')];return db['UserProfileSection'][_0x1a77('0x1e')]({'where':{'name':_0x56766e,'userProfileId':_0x5aef5d['userProfileId']},'raw':!![]})[_0x1a77('0x13')](function(_0x1c9c42){if(_0x1c9c42&&_0x1c9c42[_0x1a77('0x4a')]===0x0){return db[_0x1a77('0x20')][_0x1a77('0x43')]({'name':_0x4f965[_0x1a77('0x1f')],'resourceId':_0x4f965['id'],'type':_0x1c9c42[_0x1a77('0x1f')],'sectionId':_0x1c9c42['id']},{})['then'](function(){return _0x313567;});}else{return _0x313567;}})[_0x1a77('0x3a')](function(_0x567a73){logger[_0x1a77('0x21')](_0x1a77('0x4b'),_0x567a73);throw _0x567a73;});}return _0x313567;})['then'](respondWithResult(_0x19cea0,0xc9))[_0x1a77('0x3a')](handleError(_0x19cea0,null));};exports[_0x1a77('0x4c')]=function(_0x102b3f,_0x527d43){if(_0x102b3f[_0x1a77('0x3f')]['id']){delete _0x102b3f[_0x1a77('0x3f')]['id'];}return db[_0x1a77('0x24')][_0x1a77('0x1e')]({'where':{'id':_0x102b3f[_0x1a77('0x3e')]['id']}})[_0x1a77('0x13')](handleEntityNotFound(_0x527d43,null))[_0x1a77('0x13')](function(_0x5dee6a){if(_0x5dee6a){return db[_0x1a77('0x24')][_0x1a77('0x4c')](_[_0x1a77('0x33')](_0x102b3f['body'],['exten',_0x1a77('0x4d'),_0x1a77('0x4e'),_0x1a77('0x4f'),_0x1a77('0x50'),_0x1a77('0x51'),_0x1a77('0x52')]),{'where':{'context':_0x5dee6a[_0x1a77('0x4d')],'exten':_0x5dee6a['exten']},'individualHooks':!![]})[_0x1a77('0x13')](function(_0x30848a){return _0x30848a;});}return null;})[_0x1a77('0x13')](respondWithStatusCode(_0x527d43,null))[_0x1a77('0x3a')](handleError(_0x527d43,null));};exports[_0x1a77('0x53')]=function(_0xc4d8dd,_0x2f0159){var _0x71bb8e=_0xc4d8dd[_0x1a77('0x3e')]['id'];var _0x459cc5=_0xc4d8dd[_0x1a77('0x3f')];var _0x30472a=0xc8;var _0x591a96=null;return db[_0x1a77('0x54')][_0x1a77('0x55')]({'isolationLevel':db['sequelize'][_0x1a77('0x56')][_0x1a77('0x57')]['READ_COMMITTED']},function(_0x164927){return db['VoiceExtension'][_0x1a77('0x58')]({'where':{'id':_0x71bb8e},'transaction':_0x164927})[_0x1a77('0x13')](function(_0x34ac4c){if(_0x34ac4c){return db[_0x1a77('0x24')][_0x1a77('0x12')]({'where':{'VoiceExtensionId':_0x71bb8e},'transaction':_0x164927})['then'](function(){var _0x290553=_['map'](_0x459cc5,function(_0x5bde02){_0x5bde02[_0x1a77('0x59')]=_0x71bb8e;_0x5bde02[_0x1a77('0x5a')]=!![];return _0x5bde02;});return _0x34ac4c[_0x1a77('0x5b')](_0x290553);})[_0x1a77('0x13')](function(_0x31ce94){return db[_0x1a77('0x24')][_0x1a77('0x5c')](_0x31ce94,{'transaction':_0x164927});});}else{_0x30472a=0x194;_0x591a96=[];}});})[_0x1a77('0x13')](function(){if(_0x30472a!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x71bb8e},'order':_0x1a77('0x5d')})[_0x1a77('0x13')](function(_0x5b32b7){_0x591a96=_0x5b32b7;});}})[_0x1a77('0x3a')](function(_0x5eb547){_0x30472a=0x1f4;logger[_0x1a77('0x21')](_0x5eb547[_0x1a77('0x22')]);if(_0x5eb547['name']){delete _0x5eb547[_0x1a77('0x1f')];}_0x591a96=_0x5eb547;})[_0x1a77('0x5e')](function(){if(_0x591a96===null){_0x2f0159[_0x1a77('0x8')](_0x30472a);}else{if(_0x30472a===0x1f4){_0x2f0159[_0x1a77('0x9')](_0x30472a)[_0x1a77('0x23')](_0x591a96);}else{_0x2f0159[_0x1a77('0x9')](_0x30472a)['json'](_0x591a96);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9a1c42b..936116b 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 _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 +var _0x0d0c=['hook','exports','VoiceExtension','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x3bd0d8,_0xc8228c){var _0x3d7415=function(_0x13e7e9){while(--_0x13e7e9){_0x3bd0d8['push'](_0x3bd0d8['shift']());}};_0x3d7415(++_0xc8228c);}(_0x0d0c,0x1ad));var _0xc0d0=function(_0x5f34eb,_0x41e23f){_0x5f34eb=_0x5f34eb-0x0;var _0x342a19=_0x0d0c[_0x5f34eb];return _0x342a19;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xc0d0('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc0d0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0d0('0x2'),'afterDestroy':'remove'};function emitEvent(_0x13814b){return function(_0x22e3c5,_0x4defb0,_0x486d17){VoiceExtensionEvents[_0xc0d0('0x3')](_0x13814b+':'+_0x22e3c5['id'],_0x22e3c5);VoiceExtensionEvents['emit'](_0x13814b,_0x22e3c5);_0x486d17(null);};}for(var e in events){if(events[_0xc0d0('0x4')](e)){var event=events[e];VoiceExtension[_0xc0d0('0x5')](e,emitEvent(event));}}module[_0xc0d0('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 96705a9..7e38e92 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 _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 +var _0x1bb9=['hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','split','length','param','phone','prefix','SIP','join','options','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','intervals','answer','queue','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','define','VoiceExtension','voice_extensions','get','Hangup','Set','CDR(type)=','type','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','MONITOR_OPTIONS=ab','outboundrouteid='];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x1bb9,0x124));var _0x91bb=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x1bb9[_0x507c81];return _0x368a25;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0xa16977){var _0x1dbc1e=_0xa16977['models'];function _0x35292b(_0x20dc53){var _0x265a74=0x2;var _0x323af3=[{'type':_0x20dc53['type'],'app':_0x91bb('0x0'),'appdata':_0x91bb('0x1')+_0x20dc53[_0x91bb('0x2')],'context':_0x20dc53['context'],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']},{'type':_0x20dc53[_0x91bb('0x2')],'app':_0x20dc53[_0x91bb('0x4')]?_0x91bb('0x0'):_0x91bb('0x5'),'appdata':_0x20dc53[_0x91bb('0x4')]?_0x91bb('0x6')+_0x20dc53[_0x91bb('0x4')]:_0x91bb('0x7'),'context':_0x20dc53[_0x91bb('0x8')],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']}];if(_0x20dc53['type']===_0x91bb('0x9')){_0x323af3[_0x91bb('0xa')]({'type':'inbound','app':_0x91bb('0x0'),'appdata':_0x91bb('0xb')+_0x20dc53['id'],'context':_0x20dc53[_0x91bb('0x8')],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']});}_0x323af3[_0x91bb('0xa')]({'type':_0x20dc53[_0x91bb('0x2')],'app':_0x91bb('0x0'),'appdata':_0x91bb('0xc'),'context':_0x20dc53[_0x91bb('0x8')],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']},{'type':_0x20dc53[_0x91bb('0x2')],'app':_0x91bb('0x0'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x20dc53[_0x91bb('0x8')],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']},{'type':_0x20dc53[_0x91bb('0x2')],'app':_0x91bb('0x0'),'appdata':'MONITOR_OPTIONS=ab','context':_0x20dc53['context'],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']});return _0x323af3;}function _0x31a1db(_0x427a29){var _0xa22e9b=0x2;var _0x50a845=[{'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':'CDR(type)=outbound','context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x427a29[_0x91bb('0x4')]?_0x91bb('0x0'):_0x91bb('0x5'),'appdata':_0x427a29['alias']?'CDR(routeAlias)='+_0x427a29[_0x91bb('0x4')]:_0x91bb('0x7'),'context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':_0x91bb('0xe')+(_0x427a29['cutdigits']?_0x91bb('0xf')+_0x427a29[_0x91bb('0x10')]+'}':_0x91bb('0x11')),'context':_0x427a29['context'],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':'CDR(routeid)='+_0x427a29['id'],'context':_0x427a29['context'],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x91bb('0x12'),'appdata':_0x91bb('0x13')+(_0xa22e9b+0x2)+_0x91bb('0x14')+(_0xa22e9b+0x1)+')','context':_0x427a29['context'],'exten':_0x427a29['exten'],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':'outbound','app':'Set','appdata':_0x427a29[_0x91bb('0x10')]?_0x91bb('0x15')+_0x427a29[_0x91bb('0x10')]+'}':'CDR(prefix)=noprefix','context':_0x427a29['context'],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':_0x91bb('0xc'),'context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29['exten'],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':'outbound','app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x427a29['context'],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':'outbound','app':_0x91bb('0x0'),'appdata':_0x91bb('0x16'),'context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':'outbound','app':'Set','appdata':_0x91bb('0x17')+_0x427a29['id'],'context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']}];if(_0x427a29[_0x91bb('0x18')](_0x91bb('0x19'))&&_0x427a29[_0x91bb('0x19')]!=='none'){_0x50a845['push']({'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':_0x91bb('0x1a'),'context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29['exten'],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':_0x91bb('0x1b')+_0x427a29[_0x91bb('0x19')]||'wav','context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']});}return _0x50a845;}function _0x40e588(_0x54bd82,_0x1565ff){var _0x2ab94f=[{'name':_0x91bb('0x1c'),'param':0x0},{'name':_0x91bb('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x101735={};var _0x1d6a20=_0x1565ff[_0x91bb('0x1e')](',');var _0x17ae56=[];for(var _0x49a63b=0x0;_0x49a63b<_0x2ab94f[_0x91bb('0x1f')];_0x49a63b++){switch(_0x2ab94f[_0x49a63b]['name']){case'trunk':_0x101735[_0x91bb('0x1c')]=_0x1d6a20[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]][_0x91bb('0x1e')]('/')[0x1];_0x101735[_0x91bb('0x21')]=_0x1d6a20[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]][_0x91bb('0x1e')]('/')[0x2];_0x101735[_0x91bb('0x22')]=_0x101735[_0x91bb('0x21')]?_0x101735[_0x91bb('0x21')][_0x91bb('0x1e')]('$')[0x0]:undefined;_0x101735[_0x91bb('0x21')]=_0x54bd82[_0x91bb('0x10')]?(_0x101735[_0x91bb('0x22')]||'')+_0x91bb('0xf')+_0x54bd82[_0x91bb('0x10')]+'}':(_0x101735[_0x91bb('0x22')]||'')+_0x91bb('0x11');_0x17ae56[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]]=[_0x91bb('0x23'),_0x101735[_0x91bb('0x1c')],_0x101735[_0x91bb('0x21')]][_0x91bb('0x24')]('/');break;case _0x91bb('0x25'):_0x101735[_0x91bb('0x25')]=_0x1d6a20[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]];if(_0x54bd82[_0x91bb('0x19')]!==_0x91bb('0x26')){if(_0x101735['options'][_0x91bb('0x27')](_0x91bb('0x28'))<0x0){_0x101735['options']+=_0x91bb('0x28');}}else{_0x101735[_0x91bb('0x25')]=_0x101735['options'][_0x91bb('0x29')](_0x91bb('0x28'),'');}_0x17ae56[_0x2ab94f[_0x49a63b]['param']]=_0x101735[_0x91bb('0x25')];break;default:_0x17ae56[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]]=_0x1d6a20[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]];}}return _0x17ae56[_0x91bb('0x24')](',');}function _0x2a986e(_0x528522,_0xf4b4ac,_0x1f6be1){return new Promise(function(_0x4c89c9,_0x4f57a7){var _0x2f3c0a=[];if(_[_0x91bb('0x2a')](_0xf4b4ac))return _0x4c89c9(_0x2f3c0a);_0x1dbc1e[_0x91bb('0x2b')][_0x91bb('0x2c')]({'attributes':['id',_0x91bb('0x2d'),'IntervalId'],'raw':!![]})[_0x91bb('0x2e')](function(_0x18439f){for(var _0x58b3ad=0x0,_0x1c23ed=0x0;_0x58b3ad<_0xf4b4ac[_0x91bb('0x1f')];_0x58b3ad++,_0x1c23ed=0x0){var _0xcf3335=_0xf4b4ac[_0x58b3ad];var _0x423302=[];var _0x4466c5=[];delete _0xcf3335['id'];if(_0xcf3335[_0x91bb('0x2d')]!==_0x91bb('0x2f')){_0xcf3335['intervals']=[_0xcf3335['interval']];}else{_0xcf3335['intervals']=_0xcf3335[_0x91bb('0x30')]?_[_0x91bb('0x31')](_[_0x91bb('0x32')](_0x18439f,{'IntervalId':_0xcf3335['IntervalId']}),'interval'):[];}_0xcf3335[_0x91bb('0x8')]=_0x528522[_0x91bb('0x8')];_0xcf3335[_0x91bb('0x3')]=_0x528522['exten'];if(_0xcf3335[_0x91bb('0x2')])_0xcf3335[_0x91bb('0x2')]=_0xcf3335[_0x91bb('0x2')][_0x91bb('0x33')]();if(_0x528522[_0x91bb('0x2')]===_0x91bb('0xd')){if(_0xcf3335['hasOwnProperty'](_0x91bb('0x34'))&&_0xcf3335['tag']&&_0xcf3335[_0x91bb('0x34')]!=='--'){_0x423302[_0x91bb('0xa')]({'type':_0xcf3335['type'][_0x91bb('0x33')](),'app':_0x91bb('0x0'),'appdata':_0x91bb('0x35')+_0xcf3335[_0x91bb('0x34')],'context':_0x528522['context'],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335['intervals']['length']+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});}_0x423302['push']({'type':_0xcf3335[_0x91bb('0x2')][_0x91bb('0x33')](),'app':'ExecIf','appdata':_0x91bb('0x36')+(_0xcf3335[_0x91bb('0x37')]?_0x91bb('0x38')+_0xcf3335[_0x91bb('0x37')]+')':_0x91bb('0x39')),'context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335[_0x91bb('0x3a')]['length']+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});}else{if(_0xcf3335[_0x91bb('0x18')](_0x91bb('0x3b'))){if([_0x91bb('0x3c'),'playback']['includes'](_0xcf3335['app'][_0x91bb('0x33')]())&&_0xcf3335['appType']!=='custom'){if(_0xcf3335[_0x91bb('0x3b')]){_0x423302[_0x91bb('0xa')]({'type':_0xcf3335[_0x91bb('0x2')][_0x91bb('0x33')](),'app':_0x91bb('0x12'),'appdata':_0x91bb('0x3d'),'context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335['intervals'][_0x91bb('0x1f')]+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});_0x423302[_0x91bb('0xa')]({'type':_0xcf3335['type']['toLowerCase'](),'app':_0x91bb('0x0'),'appdata':_0x91bb('0x3e'),'context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335[_0x91bb('0x3a')][_0x91bb('0x1f')]+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});}else{_0x423302[_0x91bb('0xa')]({'type':_0xcf3335['type'][_0x91bb('0x33')](),'app':'ExecIf','appdata':_0x91bb('0x3f'),'context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335['intervals'][_0x91bb('0x1f')]+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});_0x423302[_0x91bb('0xa')]({'type':_0xcf3335[_0x91bb('0x2')]['toLowerCase'](),'app':_0x91bb('0x0'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335[_0x91bb('0x3a')][_0x91bb('0x1f')]+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});}}}}for(var _0xa7852b=0x0;_0xa7852b<_0xcf3335[_0x91bb('0x3a')][_0x91bb('0x1f')];_0xa7852b++){var _0x1f6d3c=_0x1f6be1+_0xcf3335[_0x91bb('0x3a')][_0x91bb('0x1f')];var _0x1a06a8=_0xa7852b===_0xcf3335['intervals'][_0x91bb('0x1f')]-0x1?_0x1f6be1+_0x423302[_0x91bb('0x1f')]+_0x4466c5[_0x91bb('0x1f')]+0x2:_0x1f6be1+_0xa7852b+0x1;_0x423302[_0x91bb('0x40')](_0xa7852b,0x0,{'type':_0x528522[_0x91bb('0x2')],'app':_0x91bb('0x41'),'appdata':_0xcf3335[_0x91bb('0x3a')][_0xa7852b]+'?'+_0x528522[_0x91bb('0x8')]+_0x91bb('0x42')+_0x1f6d3c+':'+_0x528522['context']+',${EXTEN},'+_0x1a06a8,'exten':_0x528522[_0x91bb('0x3')],'context':_0x528522[_0x91bb('0x8')],'priority':_0x1f6be1+_0xa7852b,'VoiceExtensionId':_0x528522['id']});}if(_0xcf3335[_0x91bb('0x43')]===_0x91bb('0x44')){_0xcf3335['appdata']=_0x40e588(_0x528522,_0xcf3335[_0x91bb('0x45')]);}if(_0xcf3335[_0x91bb('0x43')]==='agi'){_0x423302[_0x91bb('0xa')]({'type':_0xcf3335[_0x91bb('0x2')][_0x91bb('0x33')](),'app':_0x91bb('0x0'),'appdata':_0x91bb('0x46'),'context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335[_0x91bb('0x3a')][_0x91bb('0x1f')]+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});}_0xcf3335['priority']=_0x423302[_0x91bb('0x1f')]?_[_0x91bb('0x47')](_0x423302)[_0x91bb('0x48')]+0x1:_0x1f6be1;_0x2f3c0a=_[_0x91bb('0x49')](_0x2f3c0a,_0x423302,[_0xcf3335],_0x4466c5);_0x1f6be1=_[_0x91bb('0x47')](_0x2f3c0a)['priority']+0x1;}return _0x4c89c9(_0x2f3c0a);})['catch'](function(_0x5893c4){_0x4f57a7(_0x5893c4);});});}return _0xa16977[_0x91bb('0x4a')](_0x91bb('0x4b'),attributes,{'tableName':_0x91bb('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4557ac){var _0x330605=this[_0x91bb('0x4d')]({'plain':!![]});var _0x467bc8=_0x330605[_0x91bb('0x2')]===_0x91bb('0xd')?_0x31a1db(_0x330605):_0x35292b(_0x330605);return _0x2a986e(_0x330605,_0x4557ac,_['last'](_0x467bc8)[_0x91bb('0x48')]+0x1)[_0x91bb('0x2e')](function(_0x30a333){var _0x8645af=_[_0x91bb('0x49')](_0x467bc8,_0x30a333);_0x8645af[_0x91bb('0xa')]({'type':_0x330605['type'],'app':_0x91bb('0x4e'),'exten':_0x330605[_0x91bb('0x3')],'context':_0x330605['context'],'priority':_[_0x91bb('0x47')](_0x8645af)[_0x91bb('0x48')]+0x1,'VoiceExtensionId':_0x330605['id']});return _0x8645af;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8c2d8e1..21be220 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 _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 +var _0xfd87=['options','raw','where','limit','include','model','attributes','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var moment=require(_0x7fd8('0x2'));var BPromise=require(_0x7fd8('0x3'));var rs=require(_0x7fd8('0x4'));var fs=require('fs');var Redis=require(_0x7fd8('0x5'));var db=require(_0x7fd8('0x6'))['db'];var utils=require(_0x7fd8('0x7'));var logger=require(_0x7fd8('0x8'))(_0x7fd8('0x9'));var config=require(_0x7fd8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7fd8('0xb')][_0x7fd8('0xc')]({'port':0x232a});config['redis']=_[_0x7fd8('0xd')](config[_0x7fd8('0xe')],{'host':_0x7fd8('0xf'),'port':0x18eb});var socket=require(_0x7fd8('0x10'))(new Redis(config[_0x7fd8('0xe')]));require('./voiceExtension.socket')[_0x7fd8('0x11')](socket);function respondWithRpcPromise(_0x18e3ea,_0x1b8863,_0x596d03){return new BPromise(function(_0x5486fc,_0x4948d0){return client[_0x7fd8('0x12')](_0x18e3ea,_0x596d03)['then'](function(_0x4749df){logger[_0x7fd8('0x13')](_0x7fd8('0x14'),_0x1b8863,'request\x20sent');logger[_0x7fd8('0x15')](_0x7fd8('0x16'),_0x1b8863,_0x7fd8('0x17'),JSON[_0x7fd8('0x18')](_0x4749df));if(_0x4749df[_0x7fd8('0x19')]){if(_0x4749df['error'][_0x7fd8('0x1a')]===0x1f4){logger[_0x7fd8('0x19')](_0x7fd8('0x14'),_0x1b8863,_0x4749df[_0x7fd8('0x19')][_0x7fd8('0x1b')]);return _0x4948d0(_0x4749df[_0x7fd8('0x19')][_0x7fd8('0x1b')]);}logger[_0x7fd8('0x19')](_0x7fd8('0x14'),_0x1b8863,_0x4749df[_0x7fd8('0x19')][_0x7fd8('0x1b')]);return _0x5486fc(_0x4749df['error']['message']);}else{logger['info'](_0x7fd8('0x14'),_0x1b8863,_0x7fd8('0x17'));_0x5486fc(_0x4749df['result'][_0x7fd8('0x1b')]);}})[_0x7fd8('0x1c')](function(_0x40b134){logger[_0x7fd8('0x19')](_0x7fd8('0x14'),_0x1b8863,_0x40b134);_0x4948d0(_0x40b134);});});}exports[_0x7fd8('0x1d')]=function(_0x2edf31){var _0x4539b6=this;return new Promise(function(_0x4b5d0a,_0x34bc09){return db[_0x7fd8('0x1e')][_0x7fd8('0x1f')]({'raw':_0x2edf31[_0x7fd8('0x20')]?_0x2edf31[_0x7fd8('0x20')][_0x7fd8('0x21')]===undefined?!![]:![]:!![],'where':_0x2edf31['options']?_0x2edf31[_0x7fd8('0x20')][_0x7fd8('0x22')]||null:null,'attributes':_0x2edf31[_0x7fd8('0x20')]?_0x2edf31[_0x7fd8('0x20')]['attributes']||null:null,'limit':_0x2edf31[_0x7fd8('0x20')]?_0x2edf31[_0x7fd8('0x20')][_0x7fd8('0x23')]||null:null,'include':_0x2edf31[_0x7fd8('0x20')]?_0x2edf31[_0x7fd8('0x20')]['include']?_['map'](_0x2edf31[_0x7fd8('0x20')][_0x7fd8('0x24')],function(_0xa273a7){return{'model':db[_0xa273a7[_0x7fd8('0x25')]],'as':_0xa273a7['as'],'attributes':_0xa273a7[_0x7fd8('0x26')],'include':_0xa273a7['include']?_[_0x7fd8('0x27')](_0xa273a7[_0x7fd8('0x24')],function(_0xda5f2a){return{'model':db[_0xda5f2a[_0x7fd8('0x25')]],'as':_0xda5f2a['as'],'attributes':_0xda5f2a[_0x7fd8('0x26')],'include':_0xda5f2a['include']?_['map'](_0xda5f2a[_0x7fd8('0x24')],function(_0x2bd721){return{'model':db[_0x2bd721[_0x7fd8('0x25')]],'as':_0x2bd721['as'],'attributes':_0x2bd721[_0x7fd8('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fc63a){logger[_0x7fd8('0x13')]('GetVoiceExtension',_0x2edf31);logger[_0x7fd8('0x15')](_0x7fd8('0x1d'),_0x2edf31,JSON[_0x7fd8('0x18')](_0x4fc63a));_0x4b5d0a(_0x4fc63a);})['catch'](function(_0x28e28e){logger['error'](_0x7fd8('0x1d'),_0x28e28e[_0x7fd8('0x1b')],_0x2edf31);_0x34bc09(_0x4539b6[_0x7fd8('0x19')](0x1f4,_0x28e28e[_0x7fd8('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ef4309f..da7a102 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 _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 +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x5029b6,_0x4849b3){var _0x662627=function(_0x3f89f1){while(--_0x3f89f1){_0x5029b6['push'](_0x5029b6['shift']());}};_0x662627(++_0x4849b3);}(_0x1261,0x144));var _0x1126=function(_0x17cb63,_0x4c0e90){_0x17cb63=_0x17cb63-0x0;var _0x4340bc=_0x1261[_0x17cb63];return _0x4340bc;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 94975c4..47b4e7a 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 _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 +var _0x2d72=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2d72,0xa8));var _0x22d7=function(_0x4c699b,_0x418c0d){_0x4c699b=_0x4c699b-0x0;var _0x16bcd7=_0x2d72[_0x4c699b];return _0x16bcd7;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['show']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x22d7('0x11')]);router[_0x22d7('0x12')](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x13')]);router['delete']('/:id',auth[_0x22d7('0xc')](),controller['destroy']);module[_0x22d7('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 217e06a..d6f3325 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 _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 +var _0x9071=['yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central'];(function(_0x399d76,_0xdc4493){var _0x3b19a1=function(_0x262225){while(--_0x262225){_0x399d76['push'](_0x399d76['shift']());}};_0x3b19a1(++_0xdc4493);}(_0x9071,0xac));var _0x1907=function(_0x56a37e,_0x2e5185){_0x56a37e=_0x56a37e-0x0;var _0x30cd29=_0x9071[_0x56a37e];return _0x30cd29;};'use strict';var Sequelize=require('sequelize');module[_0x1907('0x0')]={'customer_id':{'type':Sequelize[_0x1907('0x1')]},'context':{'type':Sequelize[_0x1907('0x1')],'defaultValue':_0x1907('0x2'),'unique':_0x1907('0x3')},'mailbox':{'type':Sequelize[_0x1907('0x1')],'defaultValue':'','allowNull':![],'unique':_0x1907('0x3')},'password':{'type':Sequelize[_0x1907('0x1')]},'fullname':{'type':Sequelize[_0x1907('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x501ac5){this[_0x1907('0x4')](_0x1907('0x5'),typeof _0x501ac5==='string'&&_0x501ac5[_0x1907('0x6')]()?_0x501ac5['trim']():null);}},'pager':{'type':Sequelize[_0x1907('0x1')]},'tz':{'type':Sequelize[_0x1907('0x1')],'defaultValue':_0x1907('0x7')},'attach':{'type':Sequelize['ENUM'](_0x1907('0x8'),'no'),'defaultValue':_0x1907('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':_0x1907('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1907('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1907('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x1907('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':_0x1907('0x8'),'allowNull':![]},'stamp':{'type':_0x1907('0xa')},'emailsubject':{'type':Sequelize[_0x1907('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x1907('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1907('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1907('0xc')],'get':function(){return this['getDataValue']('fullname')+'\x20-\x20'+this[_0x1907('0xd')](_0x1907('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e119650..edb3c8e 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 _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 +var _0xc900=['body','params','findOne','VoiceMailMessage','findAndCountAll','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','Voicemails','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceMail','includeAll','include','findAll','catch','show','rawAttributes','keys','find','user','get','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xc900,0xb3));var _0x0c90=function(_0x311cf5,_0x240145){_0x311cf5=_0x311cf5-0x0;var _0x4e4cbc=_0xc900[_0x311cf5];return _0x4e4cbc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];function respondWithStatusCode(_0x50e7db,_0x459cdb){_0x459cdb=_0x459cdb||0xcc;return function(_0x26fc46){if(_0x26fc46){return _0x50e7db[_0x0c90('0x19')](_0x459cdb);}return _0x50e7db[_0x0c90('0x1a')](_0x459cdb)[_0x0c90('0x1b')]();};}function respondWithResult(_0x59ea8e,_0x467b32){_0x467b32=_0x467b32||0xc8;return function(_0x4451e0){if(_0x4451e0){return _0x59ea8e['status'](_0x467b32)[_0x0c90('0x1c')](_0x4451e0);}};}function respondWithFilteredResult(_0x3a492d,_0x3bd5e8){return function(_0x5bef7d){if(_0x5bef7d){var _0x5daeb7=typeof _0x3bd5e8[_0x0c90('0x1d')]===_0x0c90('0x1e')&&typeof _0x3bd5e8[_0x0c90('0x1f')]===_0x0c90('0x1e');var _0x276b92=_0x5bef7d[_0x0c90('0x20')];var _0x42321a=_0x5daeb7?0x0:_0x3bd5e8['offset'];var _0xc3bb47=_0x5daeb7?_0x5bef7d[_0x0c90('0x20')]:_0x3bd5e8[_0x0c90('0x1d')]+_0x3bd5e8[_0x0c90('0x1f')];var _0x594267;if(_0xc3bb47>=_0x276b92){_0xc3bb47=_0x276b92;_0x594267=0xc8;}else{_0x594267=0xce;}_0x3a492d[_0x0c90('0x1a')](_0x594267);return _0x3a492d[_0x0c90('0x21')](_0x0c90('0x22'),_0x42321a+'-'+_0xc3bb47+'/'+_0x276b92)[_0x0c90('0x1c')](_0x5bef7d);}return null;};}function patchUpdates(_0x315932){return function(_0xc08f54){try{jsonpatch['apply'](_0xc08f54,_0x315932,!![]);}catch(_0x365a42){return BPromise['reject'](_0x365a42);}return _0xc08f54[_0x0c90('0x23')]();};}function saveUpdates(_0x1a021e,_0x47b13c){return function(_0x2a053a){if(_0x2a053a){return _0x2a053a[_0x0c90('0x24')](_0x1a021e)[_0x0c90('0x25')](function(_0x86dee){return _0x86dee;});}return null;};}function removeEntity(_0x212164,_0x3b287c){return function(_0x4dfbc3){if(_0x4dfbc3){return _0x4dfbc3[_0x0c90('0x26')]()[_0x0c90('0x25')](function(){var _0x5695a2=_0x4dfbc3['get']({'plain':!![]});var _0x28d005=_0x0c90('0x27');return db[_0x0c90('0x28')][_0x0c90('0x26')]({'where':{'type':_0x28d005,'resourceId':_0x5695a2['id']}})['then'](function(){return _0x4dfbc3;});})[_0x0c90('0x25')](function(){_0x212164[_0x0c90('0x1a')](0xcc)[_0x0c90('0x1b')]();});}};}function handleEntityNotFound(_0x277d4a,_0x427c2b){return function(_0x114589){if(!_0x114589){_0x277d4a['sendStatus'](0x194);}return _0x114589;};}function handleError(_0x15de68,_0x22a47d){_0x22a47d=_0x22a47d||0x1f4;return function(_0x39f1b2){logger[_0x0c90('0x29')](_0x39f1b2['stack']);if(_0x39f1b2['name']){delete _0x39f1b2[_0x0c90('0x2a')];}_0x15de68[_0x0c90('0x1a')](_0x22a47d)[_0x0c90('0x2b')](_0x39f1b2);};}exports[_0x0c90('0x2c')]=function(_0x119e09,_0x562664){var _0x120136={},_0x50b156={},_0x478002={'count':0x0,'rows':[]};var _0x47a935=_[_0x0c90('0x2d')](db['VoiceMail']['rawAttributes'],function(_0x886634){return{'name':_0x886634[_0x0c90('0x2e')],'type':_0x886634[_0x0c90('0x2f')][_0x0c90('0x30')]};});_0x50b156['model']=_[_0x0c90('0x2d')](_0x47a935,'name');_0x50b156[_0x0c90('0x31')]=_['keys'](_0x119e09[_0x0c90('0x31')]);_0x50b156[_0x0c90('0x32')]=_['intersection'](_0x50b156[_0x0c90('0x33')],_0x50b156[_0x0c90('0x31')]);_0x120136[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x50b156[_0x0c90('0x33')],qs[_0x0c90('0x36')](_0x119e09[_0x0c90('0x31')][_0x0c90('0x36')]));_0x120136['attributes']=_0x120136[_0x0c90('0x34')][_0x0c90('0x37')]?_0x120136[_0x0c90('0x34')]:_0x50b156[_0x0c90('0x33')];if(!_0x119e09['query'][_0x0c90('0x38')](_0x0c90('0x39'))){_0x120136[_0x0c90('0x1f')]=qs[_0x0c90('0x1f')](_0x119e09[_0x0c90('0x31')][_0x0c90('0x1f')]);_0x120136[_0x0c90('0x1d')]=qs[_0x0c90('0x1d')](_0x119e09['query'][_0x0c90('0x1d')]);}_0x120136[_0x0c90('0x3a')]=qs['sort'](_0x119e09[_0x0c90('0x31')][_0x0c90('0x3b')]);_0x120136[_0x0c90('0x3c')]=qs[_0x0c90('0x32')](_[_0x0c90('0x3d')](_0x119e09['query'],_0x50b156[_0x0c90('0x32')]),_0x47a935);if(_0x119e09[_0x0c90('0x31')][_0x0c90('0x3e')]){_0x120136[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x120136[_0x0c90('0x3c')],{'$or':_[_0x0c90('0x2d')](_0x47a935,function(_0x1695dd){if(_0x1695dd[_0x0c90('0x2f')]!=='VIRTUAL'){var _0x2cd2c2={};_0x2cd2c2[_0x1695dd['name']]={'$like':'%'+_0x119e09[_0x0c90('0x31')]['filter']+'%'};return _0x2cd2c2;}})});}_0x120136=_[_0x0c90('0x3f')]({},_0x120136,_0x119e09[_0x0c90('0x40')]);var _0x49f8b4={'where':_0x120136['where']};return db[_0x0c90('0x41')]['count'](_0x49f8b4)[_0x0c90('0x25')](function(_0x4545bb){_0x478002[_0x0c90('0x20')]=_0x4545bb;if(_0x119e09['query'][_0x0c90('0x42')]){_0x120136[_0x0c90('0x43')]=[{'all':!![]}];}return db[_0x0c90('0x41')][_0x0c90('0x44')](_0x120136);})[_0x0c90('0x25')](function(_0x1184c4){_0x478002['rows']=_0x1184c4;return _0x478002;})[_0x0c90('0x25')](respondWithFilteredResult(_0x562664,_0x120136))[_0x0c90('0x45')](handleError(_0x562664,null));};exports[_0x0c90('0x46')]=function(_0x399115,_0x3c47c9){var _0x15d040={'raw':!![],'where':{'id':_0x399115['params']['id']}},_0x30b9df={};_0x30b9df[_0x0c90('0x33')]=_['keys'](db[_0x0c90('0x41')][_0x0c90('0x47')]);_0x30b9df[_0x0c90('0x31')]=_[_0x0c90('0x48')](_0x399115[_0x0c90('0x31')]);_0x30b9df[_0x0c90('0x32')]=_[_0x0c90('0x35')](_0x30b9df[_0x0c90('0x33')],_0x30b9df[_0x0c90('0x31')]);_0x15d040[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x30b9df[_0x0c90('0x33')],qs[_0x0c90('0x36')](_0x399115[_0x0c90('0x31')][_0x0c90('0x36')]));_0x15d040['attributes']=_0x15d040[_0x0c90('0x34')][_0x0c90('0x37')]?_0x15d040[_0x0c90('0x34')]:_0x30b9df[_0x0c90('0x33')];if(_0x399115[_0x0c90('0x31')][_0x0c90('0x42')]){_0x15d040[_0x0c90('0x43')]=[{'all':!![]}];}_0x15d040=_[_0x0c90('0x3f')]({},_0x15d040,_0x399115[_0x0c90('0x40')]);return db[_0x0c90('0x41')][_0x0c90('0x49')](_0x15d040)[_0x0c90('0x25')](handleEntityNotFound(_0x3c47c9,null))[_0x0c90('0x25')](respondWithResult(_0x3c47c9,null))[_0x0c90('0x45')](handleError(_0x3c47c9,null));};exports['create']=function(_0x1b4aac,_0x38f492){return db['VoiceMail']['create'](_0x1b4aac['body'],{})[_0x0c90('0x25')](function(_0x1205d0){var _0x460cf9=_0x1b4aac[_0x0c90('0x4a')][_0x0c90('0x4b')]({'plain':!![]});if(!_0x460cf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460cf9[_0x0c90('0x4c')]===_0x0c90('0x4a')){var _0x2b756d=_0x1205d0['get']({'plain':!![]});var _0x119776=_0x0c90('0x27');return db[_0x0c90('0x4d')][_0x0c90('0x49')]({'where':{'name':_0x119776,'userProfileId':_0x460cf9[_0x0c90('0x4e')]},'raw':!![]})[_0x0c90('0x25')](function(_0x42c121){if(_0x42c121&&_0x42c121[_0x0c90('0x4f')]===0x0){return db[_0x0c90('0x28')][_0x0c90('0x50')]({'name':_0x2b756d['name'],'resourceId':_0x2b756d['id'],'type':_0x42c121[_0x0c90('0x2a')],'sectionId':_0x42c121['id']},{})['then'](function(){return _0x1205d0;});}else{return _0x1205d0;}})[_0x0c90('0x45')](function(_0x67539d){logger[_0x0c90('0x29')](_0x0c90('0x51'),_0x67539d);throw _0x67539d;});}return _0x1205d0;})[_0x0c90('0x25')](respondWithResult(_0x38f492,0xc9))[_0x0c90('0x45')](handleError(_0x38f492,null));};exports['update']=function(_0x4930fc,_0x5382d9){if(_0x4930fc['body']['id']){delete _0x4930fc[_0x0c90('0x52')]['id'];}return db[_0x0c90('0x41')][_0x0c90('0x49')]({'where':{'id':_0x4930fc['params']['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x5382d9,null))[_0x0c90('0x25')](saveUpdates(_0x4930fc['body'],null))[_0x0c90('0x25')](respondWithResult(_0x5382d9,null))['catch'](handleError(_0x5382d9,null));};exports[_0x0c90('0x26')]=function(_0x8951f2,_0x42398b){return db[_0x0c90('0x41')]['find']({'where':{'id':_0x8951f2[_0x0c90('0x53')]['id']}})['then'](handleEntityNotFound(_0x42398b,null))[_0x0c90('0x25')](removeEntity(_0x42398b,null))[_0x0c90('0x45')](handleError(_0x42398b,null));};exports['getMessages']=function(_0x52b437,_0x51c356,_0x221fba){return db[_0x0c90('0x41')][_0x0c90('0x54')]({'where':{'id':_0x52b437[_0x0c90('0x53')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x51c356,null))['then'](function(_0x3bfd01){var _0x25ab13;var _0x5ee971={},_0x3eb725={};_0x3eb725['model']=_[_0x0c90('0x48')](db[_0x0c90('0x55')]['rawAttributes']);_0x3eb725[_0x0c90('0x31')]=_['keys'](_0x52b437['query']);_0x3eb725['filters']=_[_0x0c90('0x35')](_0x3eb725[_0x0c90('0x33')],_0x3eb725[_0x0c90('0x31')]);_0x5ee971[_0x0c90('0x34')]=_['intersection'](_0x3eb725['model'],qs[_0x0c90('0x36')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x36')]));_0x5ee971['attributes']=_0x5ee971[_0x0c90('0x34')][_0x0c90('0x37')]?_0x5ee971[_0x0c90('0x34')]:_0x3eb725['model'];if(!_0x52b437[_0x0c90('0x31')][_0x0c90('0x38')](_0x0c90('0x39'))){_0x5ee971['limit']=qs[_0x0c90('0x1f')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x1f')]);_0x5ee971[_0x0c90('0x1d')]=qs[_0x0c90('0x1d')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x1d')]);}_0x5ee971[_0x0c90('0x3a')]=qs[_0x0c90('0x3b')](_0x52b437['query']['sort']);_0x5ee971[_0x0c90('0x3c')]=qs[_0x0c90('0x32')](_[_0x0c90('0x3d')](_0x52b437[_0x0c90('0x31')],_0x3eb725[_0x0c90('0x32')]));if(_0x52b437[_0x0c90('0x31')][_0x0c90('0x3e')]){_0x5ee971[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x5ee971[_0x0c90('0x3c')],{'$or':_[_0x0c90('0x2d')](_0x5ee971[_0x0c90('0x34')],function(_0x309152){var _0x164d4d={};_0x164d4d[_0x309152]={'$like':'%'+_0x52b437[_0x0c90('0x31')]['filter']+'%'};return _0x164d4d;})});}_0x5ee971[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x5ee971[_0x0c90('0x3c')],{'mailboxuser':_0x3bfd01['mailbox']});_0x5ee971=_['merge']({},_0x5ee971,_0x52b437[_0x0c90('0x40')]);return db['VoiceMailMessage'][_0x0c90('0x56')](_0x5ee971)[_0x0c90('0x25')](respondWithFilteredResult(_0x51c356,_0x5ee971));})['catch'](handleError(_0x51c356,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 71739b1..a1de4de 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 _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 +var _0xb1ca=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','define'];(function(_0x34b311,_0x50db15){var _0x5c5113=function(_0x2045d4){while(--_0x2045d4){_0x34b311['push'](_0x34b311['shift']());}};_0x5c5113(++_0x50db15);}(_0xb1ca,0x195));var _0xab1c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb1ca[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xab1c('0x0'));var util=require(_0xab1c('0x1'));var logger=require(_0xab1c('0x2'))(_0xab1c('0x3'));var moment=require(_0xab1c('0x4'));var BPromise=require(_0xab1c('0x5'));var rp=require(_0xab1c('0x6'));var fs=require('fs');var path=require(_0xab1c('0x7'));var rimraf=require(_0xab1c('0x8'));var config=require('../../config/environment');var attributes=require(_0xab1c('0x9'));module['exports']=function(_0x47af2c,_0x1555b5){return _0x47af2c[_0xab1c('0xa')](_0xab1c('0xb'),attributes,{'tableName':_0xab1c('0xc'),'paranoid':![],'indexes':[{'name':_0xab1c('0xd'),'fields':[_0xab1c('0xe'),_0xab1c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index cacd730..4cfbbc7 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 _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 +var _0x115c=['request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x306cf9,_0x4570f0){var _0xc9c029=function(_0x34275e){while(--_0x34275e){_0x306cf9['push'](_0x306cf9['shift']());}};_0xc9c029(++_0x4570f0);}(_0x115c,0x164));var _0xc115=function(_0x332b3f,_0x4d6873){_0x332b3f=_0x332b3f-0x0;var _0x2eebd4=_0x115c[_0x332b3f];return _0x2eebd4;};'use strict';var _=require(_0xc115('0x0'));var util=require(_0xc115('0x1'));var moment=require(_0xc115('0x2'));var BPromise=require(_0xc115('0x3'));var rs=require(_0xc115('0x4'));var fs=require('fs');var Redis=require(_0xc115('0x5'));var db=require(_0xc115('0x6'))['db'];var utils=require(_0xc115('0x7'));var logger=require(_0xc115('0x8'))('rpc');var config=require(_0xc115('0x9'));var jayson=require(_0xc115('0xa'));var client=jayson[_0xc115('0xb')][_0xc115('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e5a10,_0x16c19f,_0x2b2ae){return new BPromise(function(_0x393327,_0x4d1f97){return client[_0xc115('0xd')](_0x1e5a10,_0x2b2ae)[_0xc115('0xe')](function(_0xd2d99d){logger[_0xc115('0xf')](_0xc115('0x10'),_0x16c19f,'request\x20sent');logger[_0xc115('0x11')](_0xc115('0x12'),_0x16c19f,_0xc115('0x13'),JSON[_0xc115('0x14')](_0xd2d99d));if(_0xd2d99d[_0xc115('0x15')]){if(_0xd2d99d['error'][_0xc115('0x16')]===0x1f4){logger[_0xc115('0x15')](_0xc115('0x10'),_0x16c19f,_0xd2d99d[_0xc115('0x15')][_0xc115('0x17')]);return _0x4d1f97(_0xd2d99d[_0xc115('0x15')][_0xc115('0x17')]);}logger[_0xc115('0x15')]('VoiceMail,\x20%s,\x20%s',_0x16c19f,_0xd2d99d[_0xc115('0x15')][_0xc115('0x17')]);return _0x393327(_0xd2d99d[_0xc115('0x15')]['message']);}else{logger[_0xc115('0xf')](_0xc115('0x10'),_0x16c19f,'request\x20sent');_0x393327(_0xd2d99d['result'][_0xc115('0x17')]);}})[_0xc115('0x18')](function(_0x2346d7){logger[_0xc115('0x15')](_0xc115('0x10'),_0x16c19f,_0x2346d7);_0x4d1f97(_0x2346d7);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index a6d1ee2..6cb95ab 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 _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 +var _0x9326=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','update','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x3cf477,_0x29cff1){var _0x1ab931=function(_0x3b61f4){while(--_0x3b61f4){_0x3cf477['push'](_0x3cf477['shift']());}};_0x1ab931(++_0x29cff1);}(_0x9326,0x1b0));var _0x6932=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0x9326[_0x6eb833];return _0xdfc38c;};'use strict';var multer=require(_0x6932('0x0'));var util=require(_0x6932('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6932('0x2'));var router=express[_0x6932('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6932('0x4'));var interaction=require(_0x6932('0x5'));var config=require(_0x6932('0x6'));var controller=require(_0x6932('0x7'));router[_0x6932('0x8')]('/',auth[_0x6932('0x9')](),controller[_0x6932('0xa')]);router[_0x6932('0x8')](_0x6932('0xb'),auth[_0x6932('0x9')](),controller['show']);router[_0x6932('0x8')](_0x6932('0xc'),auth[_0x6932('0x9')](),controller[_0x6932('0xd')]);router[_0x6932('0xe')]('/',auth[_0x6932('0x9')](),controller[_0x6932('0xf')]);router['put'](_0x6932('0xb'),auth[_0x6932('0x9')](),controller[_0x6932('0x10')]);router['delete'](_0x6932('0xb'),auth[_0x6932('0x9')](),controller[_0x6932('0x11')]);module[_0x6932('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index bcf807e..e3a892d 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 _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 +var _0xd93e=['long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER','STRING','BLOB'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xd93e,0x73));var _0xed93=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd93e[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xed93('0x0'));module[_0xed93('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x53ec4b){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xed93('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xed93('0x4')](_0xed93('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xed93('0x6')](_0xed93('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b1d6938..f8abea7 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 _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 +var _0x9039=['msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','download','recording'];(function(_0x5155fd,_0xaa956f){var _0x1bf312=function(_0x1e8a0e){while(--_0x1e8a0e){_0x5155fd['push'](_0x5155fd['shift']());}};_0x1bf312(++_0xaa956f);}(_0x9039,0x1b0));var _0x9903=function(_0x36a101,_0xbc546a){_0x36a101=_0x36a101-0x0;var _0x413fca=_0x9039[_0x36a101];return _0x413fca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9903('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9903('0x1'));var rp=require('request-promise');var moment=require(_0x9903('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9903('0x3'));var util=require(_0x9903('0x4'));var path=require(_0x9903('0x5'));var sox=require(_0x9903('0x6'));var csv=require(_0x9903('0x7'));var ejs=require(_0x9903('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9903('0x9'));var squel=require(_0x9903('0xa'));var crypto=require(_0x9903('0xb'));var jsforce=require(_0x9903('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9903('0x7'));var querystring=require('querystring');var Papa=require(_0x9903('0xd'));var Redis=require(_0x9903('0xe'));var authService=require(_0x9903('0xf'));var qs=require(_0x9903('0x10'));var as=require(_0x9903('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9903('0x12'))(_0x9903('0x13'));var utils=require('../../config/utils');var config=require(_0x9903('0x14'));var licenseUtil=require(_0x9903('0x15'));var db=require(_0x9903('0x16'))['db'];function respondWithStatusCode(_0x282a8a,_0x4a8fb8){_0x4a8fb8=_0x4a8fb8||0xcc;return function(_0x317721){if(_0x317721){return _0x282a8a[_0x9903('0x17')](_0x4a8fb8);}return _0x282a8a[_0x9903('0x18')](_0x4a8fb8)['end']();};}function respondWithResult(_0x56cf14,_0x229a9d){_0x229a9d=_0x229a9d||0xc8;return function(_0x557be8){if(_0x557be8){return _0x56cf14['status'](_0x229a9d)[_0x9903('0x19')](_0x557be8);}};}function respondWithFilteredResult(_0x2ee115,_0x4906ac){return function(_0x332f13){if(_0x332f13){var _0x387191=typeof _0x4906ac[_0x9903('0x1a')]==='undefined'&&typeof _0x4906ac[_0x9903('0x1b')]===_0x9903('0x1c');var _0x4c7cd0=_0x332f13['count'];var _0x58f652=_0x387191?0x0:_0x4906ac[_0x9903('0x1a')];var _0x5a7ee5=_0x387191?_0x332f13['count']:_0x4906ac['offset']+_0x4906ac[_0x9903('0x1b')];var _0x35548c;if(_0x5a7ee5>=_0x4c7cd0){_0x5a7ee5=_0x4c7cd0;_0x35548c=0xc8;}else{_0x35548c=0xce;}_0x2ee115[_0x9903('0x18')](_0x35548c);return _0x2ee115[_0x9903('0x1d')](_0x9903('0x1e'),_0x58f652+'-'+_0x5a7ee5+'/'+_0x4c7cd0)[_0x9903('0x19')](_0x332f13);}return null;};}function patchUpdates(_0x1ea855){return function(_0x315b4a){try{jsonpatch[_0x9903('0x1f')](_0x315b4a,_0x1ea855,!![]);}catch(_0x202679){return BPromise[_0x9903('0x20')](_0x202679);}return _0x315b4a[_0x9903('0x21')]();};}function saveUpdates(_0x46d02a,_0x42ab82){return function(_0xa6467c){if(_0xa6467c){return _0xa6467c[_0x9903('0x22')](_0x46d02a)['then'](function(_0x5e9b88){return _0x5e9b88;});}return null;};}function removeEntity(_0x20e705,_0x5196ab){return function(_0x511612){if(_0x511612){return _0x511612[_0x9903('0x23')]()['then'](function(){_0x20e705[_0x9903('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b547,_0x1edb0c){return function(_0x2051cf){if(!_0x2051cf){_0x40b547[_0x9903('0x17')](0x194);}return _0x2051cf;};}function handleError(_0x2061d9,_0x29b72d){_0x29b72d=_0x29b72d||0x1f4;return function(_0x548e2c){logger[_0x9903('0x24')](_0x548e2c[_0x9903('0x25')]);if(_0x548e2c['name']){delete _0x548e2c[_0x9903('0x26')];}_0x2061d9[_0x9903('0x18')](_0x29b72d)[_0x9903('0x27')](_0x548e2c);};}exports[_0x9903('0x28')]=function(_0x343b54,_0x533e20){var _0x43163d={},_0x2948e8={},_0x45799c={'count':0x0,'rows':[]};var _0x122709=_[_0x9903('0x29')](db[_0x9903('0x2a')][_0x9903('0x2b')],function(_0x43a76c){return{'name':_0x43a76c[_0x9903('0x2c')],'type':_0x43a76c[_0x9903('0x2d')][_0x9903('0x2e')]};});_0x2948e8['model']=_['differenceBy'](_[_0x9903('0x29')](_0x122709,_0x9903('0x26')),[_0x9903('0x26')]);_0x2948e8[_0x9903('0x2f')]=_[_0x9903('0x30')](_0x343b54[_0x9903('0x2f')]);_0x2948e8[_0x9903('0x31')]=_[_0x9903('0x32')](_0x2948e8[_0x9903('0x33')],_0x2948e8['query']);_0x43163d['attributes']=_[_0x9903('0x32')](_0x2948e8[_0x9903('0x33')],qs[_0x9903('0x34')](_0x343b54[_0x9903('0x2f')]['fields']));_0x43163d[_0x9903('0x35')]=_0x43163d['attributes'][_0x9903('0x36')]?_0x43163d['attributes']:_0x2948e8[_0x9903('0x33')];if(!_0x343b54[_0x9903('0x2f')][_0x9903('0x37')](_0x9903('0x38'))){_0x43163d[_0x9903('0x1b')]=qs[_0x9903('0x1b')](_0x343b54[_0x9903('0x2f')][_0x9903('0x1b')]);_0x43163d[_0x9903('0x1a')]=qs[_0x9903('0x1a')](_0x343b54[_0x9903('0x2f')]['offset']);}_0x43163d[_0x9903('0x39')]=qs['sort'](_0x343b54[_0x9903('0x2f')][_0x9903('0x3a')]);_0x43163d[_0x9903('0x3b')]=qs[_0x9903('0x31')](_[_0x9903('0x3c')](_0x343b54[_0x9903('0x2f')],_0x2948e8[_0x9903('0x31')]),_0x122709);if(_0x343b54[_0x9903('0x2f')][_0x9903('0x3d')]){_0x43163d[_0x9903('0x3b')]=_[_0x9903('0x3e')](_0x43163d['where'],{'$or':_[_0x9903('0x29')](_0x122709,function(_0xf31e00){if(_0xf31e00[_0x9903('0x2d')]!=='VIRTUAL'){var _0x270f28={};_0x270f28[_0xf31e00['name']]={'$like':'%'+_0x343b54[_0x9903('0x2f')]['filter']+'%'};return _0x270f28;}})});}_0x43163d=_[_0x9903('0x3e')]({},_0x43163d,_0x343b54[_0x9903('0x3f')]);var _0x347eff={'where':_0x43163d['where']};return db['VoiceMailMessage'][_0x9903('0x40')](_0x347eff)[_0x9903('0x41')](function(_0x27b337){_0x45799c[_0x9903('0x40')]=_0x27b337;if(_0x343b54[_0x9903('0x2f')][_0x9903('0x42')]){_0x43163d[_0x9903('0x43')]=[{'all':!![]}];}return db[_0x9903('0x2a')][_0x9903('0x44')](_0x43163d);})['then'](function(_0x395ab7){_0x45799c[_0x9903('0x45')]=_0x395ab7;return _0x45799c;})['then'](respondWithFilteredResult(_0x533e20,_0x43163d))[_0x9903('0x46')](handleError(_0x533e20,null));};exports[_0x9903('0x47')]=function(_0x51c589,_0x17ff1f){var _0x521c0b={'raw':!![],'where':{'id':_0x51c589[_0x9903('0x48')]['id']}},_0x4ce491={};_0x4ce491[_0x9903('0x33')]=_[_0x9903('0x30')](db[_0x9903('0x2a')][_0x9903('0x2b')]);_0x4ce491[_0x9903('0x2f')]=_['keys'](_0x51c589[_0x9903('0x2f')]);_0x4ce491[_0x9903('0x31')]=_['intersection'](_0x4ce491[_0x9903('0x33')],_0x4ce491['query']);_0x521c0b[_0x9903('0x35')]=_[_0x9903('0x32')](_0x4ce491[_0x9903('0x33')],qs[_0x9903('0x34')](_0x51c589[_0x9903('0x2f')]['fields']));_0x521c0b['attributes']=_0x521c0b[_0x9903('0x35')][_0x9903('0x36')]?_0x521c0b[_0x9903('0x35')]:_0x4ce491['model'];if(_0x51c589[_0x9903('0x2f')][_0x9903('0x42')]){_0x521c0b['include']=[{'all':!![]}];}_0x521c0b=_[_0x9903('0x3e')]({},_0x521c0b,_0x51c589[_0x9903('0x3f')]);return db[_0x9903('0x2a')]['find'](_0x521c0b)[_0x9903('0x41')](handleEntityNotFound(_0x17ff1f,null))[_0x9903('0x41')](respondWithResult(_0x17ff1f,null))['catch'](handleError(_0x17ff1f,null));};exports[_0x9903('0x49')]=function(_0x3f5b4e,_0x7ed8fd){return db[_0x9903('0x2a')][_0x9903('0x49')](_0x3f5b4e[_0x9903('0x4a')],{})[_0x9903('0x41')](respondWithResult(_0x7ed8fd,0xc9))['catch'](handleError(_0x7ed8fd,null));};exports['update']=function(_0xe86fd,_0x57f76e){if(_0xe86fd['body']['id']){delete _0xe86fd[_0x9903('0x4a')]['id'];}return db[_0x9903('0x2a')]['find']({'where':{'id':_0xe86fd[_0x9903('0x48')]['id']}})[_0x9903('0x41')](handleEntityNotFound(_0x57f76e,null))['then'](saveUpdates(_0xe86fd['body'],null))[_0x9903('0x41')](respondWithResult(_0x57f76e,null))['catch'](handleError(_0x57f76e,null));};exports['destroy']=function(_0x3d5f49,_0x482add){return db[_0x9903('0x2a')][_0x9903('0x4b')]({'where':{'id':_0x3d5f49[_0x9903('0x48')]['id']}})[_0x9903('0x41')](handleEntityNotFound(_0x482add,null))['then'](removeEntity(_0x482add,null))['catch'](handleError(_0x482add,null));};exports[_0x9903('0x4c')]=function(_0x37fd69,_0x18a2c4,_0xaae53a){return db[_0x9903('0x2a')][_0x9903('0x4b')]({'where':{'id':_0x37fd69[_0x9903('0x48')]['id']},'attributes':['id',_0x9903('0x4d'),_0x9903('0x4e')]})[_0x9903('0x41')](handleEntityNotFound(_0x18a2c4,null))['then'](function(_0x380964){if(_0x380964){if(!_0x380964[_0x9903('0x4d')]){throw new db[(_0x9903('0x4f'))][(_0x9903('0x50'))]('VoiceMailMessage\x20not\x20found');}var _0x41cefd={'Content-Type':_0x9903('0x51'),'Content-Disposition':_0x9903('0x52')};if(_0x380964[_0x9903('0x4e')]){_0x41cefd[_0x9903('0x53')]=_0x9903('0x54')+_0x380964[_0x9903('0x4e')]+'.wav\x22';}_0x18a2c4['set'](_0x41cefd);return _0x18a2c4['send'](new Buffer(_0x380964[_0x9903('0x4d')]));}})[_0x9903('0x46')](handleError(_0x18a2c4,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 27ca761..772a4c9 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 _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 +var _0xab60=['request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird'];(function(_0x43f559,_0xf5090c){var _0x1f71b0=function(_0x350491){while(--_0x350491){_0x43f559['push'](_0x43f559['shift']());}};_0x1f71b0(++_0xf5090c);}(_0xab60,0x97));var _0x0ab6=function(_0x27829e,_0x3aed0d){_0x27829e=_0x27829e-0x0;var _0x4b05ee=_0xab60[_0x27829e];return _0x4b05ee;};'use strict';var _=require('lodash');var util=require(_0x0ab6('0x0'));var logger=require(_0x0ab6('0x1'))(_0x0ab6('0x2'));var moment=require(_0x0ab6('0x3'));var BPromise=require(_0x0ab6('0x4'));var rp=require(_0x0ab6('0x5'));var fs=require('fs');var path=require(_0x0ab6('0x6'));var rimraf=require('rimraf');var config=require(_0x0ab6('0x7'));var attributes=require(_0x0ab6('0x8'));module[_0x0ab6('0x9')]=function(_0x482c7b,_0x141f1b){return _0x482c7b['define'](_0x0ab6('0xa'),attributes,{'tableName':_0x0ab6('0xb'),'paranoid':![],'indexes':[{'name':_0x0ab6('0xc'),'fields':[_0x0ab6('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 2d7b849..678bf03 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 _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 +var _0x2613=['../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5bc192,_0x210573){var _0x3f0553=function(_0x420ace){while(--_0x420ace){_0x5bc192['push'](_0x5bc192['shift']());}};_0x3f0553(++_0x210573);}(_0x2613,0x151));var _0x3261=function(_0x93937f,_0x310774){_0x93937f=_0x93937f-0x0;var _0x24cc87=_0x2613[_0x93937f];return _0x24cc87;};'use strict';var _=require(_0x3261('0x0'));var util=require(_0x3261('0x1'));var moment=require('moment');var BPromise=require(_0x3261('0x2'));var rs=require(_0x3261('0x3'));var fs=require('fs');var Redis=require(_0x3261('0x4'));var db=require(_0x3261('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3261('0x6'));var config=require(_0x3261('0x7'));var jayson=require(_0x3261('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb1a0,_0x5d2b10,_0x14bc70){return new BPromise(function(_0x27d020,_0xe1b31){return client[_0x3261('0x9')](_0x5bb1a0,_0x14bc70)['then'](function(_0x2988a5){logger[_0x3261('0xa')](_0x3261('0xb'),_0x5d2b10,_0x3261('0xc'));logger[_0x3261('0xd')](_0x3261('0xe'),_0x5d2b10,'request\x20sent',JSON['stringify'](_0x2988a5));if(_0x2988a5[_0x3261('0xf')]){if(_0x2988a5[_0x3261('0xf')]['code']===0x1f4){logger[_0x3261('0xf')](_0x3261('0xb'),_0x5d2b10,_0x2988a5[_0x3261('0xf')][_0x3261('0x10')]);return _0xe1b31(_0x2988a5[_0x3261('0xf')][_0x3261('0x10')]);}logger['error'](_0x3261('0xb'),_0x5d2b10,_0x2988a5[_0x3261('0xf')][_0x3261('0x10')]);return _0x27d020(_0x2988a5[_0x3261('0xf')][_0x3261('0x10')]);}else{logger[_0x3261('0xa')](_0x3261('0xb'),_0x5d2b10,'request\x20sent');_0x27d020(_0x2988a5[_0x3261('0x11')][_0x3261('0x10')]);}})['catch'](function(_0xa7bf62){logger[_0x3261('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x5d2b10,_0xa7bf62);_0xe1b31(_0xa7bf62);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ebbf6a9..d2a87c0 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 _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 +var _0xd903=['destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getSounds','create','post','addSound','put','update','delete'];(function(_0x2c535b,_0x30fd8d){var _0x59561b=function(_0xca0d35){while(--_0xca0d35){_0x2c535b['push'](_0x2c535b['shift']());}};_0x59561b(++_0x30fd8d);}(_0xd903,0x88));var _0x3d90=function(_0x29bfce,_0x5acc66){_0x29bfce=_0x29bfce-0x0;var _0x393d98=_0xd903[_0x29bfce];return _0x393d98;};'use strict';var multer=require('multer');var util=require(_0x3d90('0x0'));var path=require(_0x3d90('0x1'));var timeout=require(_0x3d90('0x2'));var express=require(_0x3d90('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d90('0x4'));var interaction=require(_0x3d90('0x5'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x3d90('0x6')]('/',auth[_0x3d90('0x7')](),controller[_0x3d90('0x8')]);router[_0x3d90('0x6')](_0x3d90('0x9'),auth[_0x3d90('0x7')](),controller[_0x3d90('0xa')]);router[_0x3d90('0x6')]('/:id/sounds',auth[_0x3d90('0x7')](),controller[_0x3d90('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3d90('0xc')]);router[_0x3d90('0xd')]('/:id/sounds',auth[_0x3d90('0x7')](),controller[_0x3d90('0xe')]);router[_0x3d90('0xf')](_0x3d90('0x9'),auth['isAuthenticated'](),controller[_0x3d90('0x10')]);router[_0x3d90('0x11')](_0x3d90('0x9'),auth['isAuthenticated'](),controller[_0x3d90('0x12')]);router[_0x3d90('0x11')](_0x3d90('0x13'),auth[_0x3d90('0x7')](),controller[_0x3d90('0x14')]);module[_0x3d90('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 527137c..37f9801 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 _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 +var _0xa334=['mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','mp3nb','quietmp3'];(function(_0x1b4ec2,_0x55ba64){var _0x543068=function(_0x363cb4){while(--_0x363cb4){_0x1b4ec2['push'](_0x1b4ec2['shift']());}};_0x543068(++_0x55ba64);}(_0xa334,0x109));var _0x4a33=function(_0x384b4c,_0x2ca893){_0x384b4c=_0x384b4c-0x0;var _0x384a39=_0xa334[_0x384b4c];return _0x384a39;};'use strict';var Sequelize=require(_0x4a33('0x0'));module[_0x4a33('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4a33('0x2')},'mode':{'type':Sequelize[_0x4a33('0x3')](_0x4a33('0x4'),_0x4a33('0x5'),_0x4a33('0x6'),'quietmp3nb',_0x4a33('0x7'),_0x4a33('0x8')),'allowNull':!![],'defaultValue':_0x4a33('0x5')},'directory':{'type':Sequelize[_0x4a33('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x4a33('0x9')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4a33('0xa')},'format':{'type':Sequelize[_0x4a33('0x9')],'allowNull':!![]},'stamp':{'type':_0x4a33('0xb')},'defaultEntry':{'type':Sequelize[_0x4a33('0xc')],'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 946801b..c0e952c 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 _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 +var _0xf31f=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','unlinkSync','getSounds','filter','hasOwnProperty','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','update','destroy','then','get','MusicOnHolds','UserProfileResource','sendStatus','stack','name','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','body','find','create','sequelize','transaction','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0xa95f7f,_0x1e8bba){var _0x40bda0=function(_0x56ed58){while(--_0x56ed58){_0xa95f7f['push'](_0xa95f7f['shift']());}};_0x40bda0(++_0x1e8bba);}(_0xf31f,0x1d9));var _0xff31=function(_0x360e4c,_0x365a8c){_0x360e4c=_0x360e4c-0x0;var _0x5a5fc4=_0xf31f[_0x360e4c];return _0x5a5fc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff31('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff31('0x1'));var rp=require(_0xff31('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xff31('0x3'));var util=require(_0xff31('0x4'));var path=require(_0xff31('0x5'));var sox=require(_0xff31('0x6'));var csv=require(_0xff31('0x7'));var ejs=require(_0xff31('0x8'));var fs=require('fs');var fs_extra=require(_0xff31('0x9'));var _=require(_0xff31('0xa'));var squel=require(_0xff31('0xb'));var crypto=require(_0xff31('0xc'));var jsforce=require(_0xff31('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xff31('0x7'));var querystring=require('querystring');var Papa=require(_0xff31('0xe'));var Redis=require(_0xff31('0xf'));var authService=require(_0xff31('0x10'));var qs=require(_0xff31('0x11'));var as=require(_0xff31('0x12'));var hardwareService=require(_0xff31('0x13'));var logger=require('../../config/logger')(_0xff31('0x14'));var utils=require(_0xff31('0x15'));var config=require(_0xff31('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xff31('0x17'))['db'];function respondWithStatusCode(_0x27ef96,_0x10777e){_0x10777e=_0x10777e||0xcc;return function(_0x25cdc4){if(_0x25cdc4){return _0x27ef96['sendStatus'](_0x10777e);}return _0x27ef96[_0xff31('0x18')](_0x10777e)[_0xff31('0x19')]();};}function respondWithResult(_0x3db5ea,_0x5cd7b8){_0x5cd7b8=_0x5cd7b8||0xc8;return function(_0x1c4374){if(_0x1c4374){return _0x3db5ea[_0xff31('0x18')](_0x5cd7b8)['json'](_0x1c4374);}};}function respondWithFilteredResult(_0x3d7c6f,_0x397964){return function(_0x4b6198){if(_0x4b6198){var _0x4bef45=typeof _0x397964['offset']==='undefined'&&typeof _0x397964[_0xff31('0x1a')]===_0xff31('0x1b');var _0x1a6ad5=_0x4b6198[_0xff31('0x1c')];var _0x1d0584=_0x4bef45?0x0:_0x397964['offset'];var _0xc5defa=_0x4bef45?_0x4b6198[_0xff31('0x1c')]:_0x397964[_0xff31('0x1d')]+_0x397964[_0xff31('0x1a')];var _0x22da53;if(_0xc5defa>=_0x1a6ad5){_0xc5defa=_0x1a6ad5;_0x22da53=0xc8;}else{_0x22da53=0xce;}_0x3d7c6f[_0xff31('0x18')](_0x22da53);return _0x3d7c6f[_0xff31('0x1e')](_0xff31('0x1f'),_0x1d0584+'-'+_0xc5defa+'/'+_0x1a6ad5)[_0xff31('0x20')](_0x4b6198);}return null;};}function patchUpdates(_0x548385){return function(_0x1b299e){try{jsonpatch[_0xff31('0x21')](_0x1b299e,_0x548385,!![]);}catch(_0x42f4b9){return BPromise['reject'](_0x42f4b9);}return _0x1b299e['save']();};}function saveUpdates(_0x254b5a,_0x2335cd){return function(_0x191279){if(_0x191279){return _0x191279[_0xff31('0x22')](_0x254b5a)['then'](function(_0x1e4d73){return _0x1e4d73;});}return null;};}function removeEntity(_0x94772d,_0x534d84){return function(_0x375267){if(_0x375267){return _0x375267[_0xff31('0x23')]()[_0xff31('0x24')](function(){var _0x486f9a=_0x375267[_0xff31('0x25')]({'plain':!![]});var _0x18bca2=_0xff31('0x26');return db[_0xff31('0x27')][_0xff31('0x23')]({'where':{'type':_0x18bca2,'resourceId':_0x486f9a['id']}})['then'](function(){return _0x375267;});})['then'](function(){_0x94772d['status'](0xcc)[_0xff31('0x19')]();});}};}function handleEntityNotFound(_0x5e8ca2,_0x3d0dab){return function(_0x8b038a){if(!_0x8b038a){_0x5e8ca2[_0xff31('0x28')](0x194);}return _0x8b038a;};}function handleError(_0x42a495,_0x488574){_0x488574=_0x488574||0x1f4;return function(_0x469ece){logger['error'](_0x469ece[_0xff31('0x29')]);if(_0x469ece[_0xff31('0x2a')]){delete _0x469ece[_0xff31('0x2a')];}_0x42a495[_0xff31('0x18')](_0x488574)['send'](_0x469ece);};}exports['index']=function(_0x4a98f2,_0x42fc19){var _0x41cb04={},_0x41b3e8={},_0x148122={'count':0x0,'rows':[]};var _0x2ed64f=_[_0xff31('0x2b')](db[_0xff31('0x2c')][_0xff31('0x2d')],function(_0x3cd75c){return{'name':_0x3cd75c[_0xff31('0x2e')],'type':_0x3cd75c['type'][_0xff31('0x2f')]};});_0x41b3e8[_0xff31('0x30')]=_[_0xff31('0x2b')](_0x2ed64f,'name');_0x41b3e8['query']=_[_0xff31('0x31')](_0x4a98f2[_0xff31('0x32')]);_0x41b3e8['filters']=_[_0xff31('0x33')](_0x41b3e8[_0xff31('0x30')],_0x41b3e8[_0xff31('0x32')]);_0x41cb04[_0xff31('0x34')]=_['intersection'](_0x41b3e8[_0xff31('0x30')],qs['fields'](_0x4a98f2['query']['fields']));_0x41cb04[_0xff31('0x34')]=_0x41cb04[_0xff31('0x34')][_0xff31('0x35')]?_0x41cb04[_0xff31('0x34')]:_0x41b3e8[_0xff31('0x30')];if(!_0x4a98f2[_0xff31('0x32')]['hasOwnProperty']('nolimit')){_0x41cb04[_0xff31('0x1a')]=qs[_0xff31('0x1a')](_0x4a98f2[_0xff31('0x32')]['limit']);_0x41cb04[_0xff31('0x1d')]=qs[_0xff31('0x1d')](_0x4a98f2[_0xff31('0x32')][_0xff31('0x1d')]);}_0x41cb04[_0xff31('0x36')]=qs[_0xff31('0x37')](_0x4a98f2[_0xff31('0x32')]['sort']);delete _0x4a98f2[_0xff31('0x32')][_0xff31('0x37')];_0x41cb04[_0xff31('0x38')]=qs[_0xff31('0x39')](_[_0xff31('0x3a')](_0x4a98f2[_0xff31('0x32')],_0x41b3e8[_0xff31('0x39')]),_0x2ed64f);if(_0x4a98f2['query']['filter']){_0x41cb04[_0xff31('0x38')]=_[_0xff31('0x3b')](_0x41cb04[_0xff31('0x38')],{'$or':_[_0xff31('0x2b')](_0x2ed64f,function(_0x4be7e1){if(_0x4be7e1['type']!==_0xff31('0x3c')){var _0x335caf={};_0x335caf[_0x4be7e1[_0xff31('0x2a')]]={'$like':'%'+_0x4a98f2['query']['filter']+'%'};return _0x335caf;}})});}_0x41cb04=_[_0xff31('0x3b')]({},_0x41cb04,_0x4a98f2[_0xff31('0x3d')]);var _0x389aea={'where':_0x41cb04[_0xff31('0x38')]};return db[_0xff31('0x2c')][_0xff31('0x1c')](_0x389aea)[_0xff31('0x24')](function(_0x383f73){_0x148122[_0xff31('0x1c')]=_0x383f73;if(_0x4a98f2[_0xff31('0x32')][_0xff31('0x3e')]){_0x41cb04[_0xff31('0x3f')]=[{'all':!![]}];}return db[_0xff31('0x2c')][_0xff31('0x40')](_0x41cb04);})[_0xff31('0x24')](function(_0x214ebf){_0x148122['rows']=_0x214ebf;return _0x148122;})[_0xff31('0x24')](respondWithFilteredResult(_0x42fc19,_0x41cb04))[_0xff31('0x41')](handleError(_0x42fc19,null));};exports[_0xff31('0x42')]=function(_0x1ea8f7,_0x58dbc9){var _0x259386={'raw':![],'where':{'id':_0x1ea8f7[_0xff31('0x43')]['id']}},_0x1686e6={};_0x1686e6[_0xff31('0x30')]=_[_0xff31('0x31')](db[_0xff31('0x2c')]['rawAttributes']);_0x1686e6['query']=_['keys'](_0x1ea8f7[_0xff31('0x32')]);_0x1686e6[_0xff31('0x39')]=_[_0xff31('0x33')](_0x1686e6[_0xff31('0x30')],_0x1686e6['query']);_0x259386['attributes']=_[_0xff31('0x33')](_0x1686e6[_0xff31('0x30')],qs[_0xff31('0x44')](_0x1ea8f7[_0xff31('0x32')]['fields']));_0x259386[_0xff31('0x34')]=_0x259386['attributes'][_0xff31('0x35')]?_0x259386[_0xff31('0x34')]:_0x1686e6['model'];if(_0x1ea8f7[_0xff31('0x32')]['includeAll']){_0x259386['include']=[{'all':!![]}];}_0x259386=_['merge']({},_0x259386,_0x1ea8f7[_0xff31('0x3d')]);return db['VoiceMusicOnHold']['find'](_0x259386)[_0xff31('0x24')](handleEntityNotFound(_0x58dbc9,null))[_0xff31('0x24')](respondWithResult(_0x58dbc9,null))[_0xff31('0x41')](handleError(_0x58dbc9,null));};exports['update']=function(_0x1b8702,_0x1fff6a){if(_0x1b8702[_0xff31('0x45')]['id']){delete _0x1b8702['body']['id'];}return db[_0xff31('0x2c')][_0xff31('0x46')]({'where':{'id':_0x1b8702[_0xff31('0x43')]['id']}})[_0xff31('0x24')](handleEntityNotFound(_0x1fff6a,null))[_0xff31('0x24')](saveUpdates(_0x1b8702[_0xff31('0x45')],null))[_0xff31('0x24')](respondWithResult(_0x1fff6a,null))['catch'](handleError(_0x1fff6a,null));};exports[_0xff31('0x47')]=function(_0x23c27c,_0xfa023f,_0x51153c){return db[_0xff31('0x48')][_0xff31('0x49')](function(_0x3a7ccd){if(_0x23c27c[_0xff31('0x45')]['mode']===_0xff31('0x4a')){_0x23c27c[_0xff31('0x45')]['directory']=path[_0xff31('0x4b')](config[_0xff31('0x4c')],_0xff31('0x4d'),_0x23c27c[_0xff31('0x45')]['name']);}return db['VoiceMusicOnHold']['create'](_0x23c27c[_0xff31('0x45')],{'transaction':_0x3a7ccd})[_0xff31('0x24')](function(_0x318458){if(_0x23c27c['body'][_0xff31('0x4e')]===_0xff31('0x4a')){fs[_0xff31('0x4f')](_0x318458[_0xff31('0x50')],parseInt(_0xff31('0x51'),0x8));}var _0x1cff96=_0x23c27c['user']['get']({'plain':!![]});if(!_0x1cff96)throw new Error(_0xff31('0x52'));if(_0x1cff96[_0xff31('0x53')]==='user'){var _0x2038b1=_0x318458[_0xff31('0x25')]({'plain':!![]});return db[_0xff31('0x54')][_0xff31('0x46')]({'where':{'name':_0xff31('0x26'),'userProfileId':_0x1cff96[_0xff31('0x55')]},'raw':!![]})[_0xff31('0x24')](function(_0x1b3f3b){if(_0x1b3f3b&&_0x1b3f3b[_0xff31('0x56')]===0x0){return db['UserProfileResource'][_0xff31('0x47')]({'name':_0x2038b1[_0xff31('0x2a')],'resourceId':_0x2038b1['id'],'type':_0x1b3f3b[_0xff31('0x2a')],'sectionId':_0x1b3f3b['id']},{})[_0xff31('0x24')](function(){return _0x318458;});}else{return _0x318458;}})['catch'](function(_0x1521c2){logger[_0xff31('0x57')](_0xff31('0x58'),_0x1521c2);});}return _0x318458;});})[_0xff31('0x24')](respondWithResult(_0xfa023f,0xc9))[_0xff31('0x41')](handleError(_0xfa023f,null));};exports['destroy']=function(_0x422972,_0x3827f4,_0x493c57){var _0x2a9d14;return db[_0xff31('0x2c')]['find']({'where':{'id':_0x422972[_0xff31('0x43')]['id']}})[_0xff31('0x24')](function(_0x5cd32e){if(_0x5cd32e){return db[_0xff31('0x48')][_0xff31('0x49')](function(_0x22e43a){return _0x5cd32e[_0xff31('0x23')]({'transaction':_0x22e43a,'raw':!![]})[_0xff31('0x24')](function(_0x138bc4){if(_0x138bc4[_0xff31('0x50')]){fs[_0xff31('0x59')](_0x138bc4[_0xff31('0x50')])['forEach'](function(_0x1cec8b){fs['unlinkSync'](path[_0xff31('0x4b')](_0x138bc4['directory'],_0x1cec8b));});fs[_0xff31('0x5a')](_0x138bc4[_0xff31('0x50')]);}return _0x138bc4;});})[_0xff31('0x41')](function(_0x4a4051){throw new db[(_0xff31('0x5b'))][(_0xff31('0x5c'))](_0x4a4051[_0xff31('0x5d')]);});}})[_0xff31('0x24')](handleEntityNotFound(_0x3827f4,null))[_0xff31('0x24')](removeEntity(_0x3827f4,null))[_0xff31('0x41')](handleError(_0x3827f4,null));};exports[_0xff31('0x5e')]=function(_0x18a13f,_0x52eb29,_0x4504ad){return db[_0xff31('0x48')][_0xff31('0x49')](function(_0xc9565d){var _0x2af779;return db['VoiceMusicOnHold'][_0xff31('0x46')]({'where':{'id':_0x18a13f[_0xff31('0x43')]['id']}})['then'](function(_0x11b2ed){if(_0x11b2ed){_0x2af779=_0x11b2ed;return _0x11b2ed['addSound'](_0x18a13f['body']['id'],{'transaction':_0xc9565d});}})['then'](function(_0x245f93){if(_0x245f93){return db[_0xff31('0x5f')][_0xff31('0x60')]({'where':{'id':_0x18a13f['body']['id']},'attributes':['id','name',_0xff31('0x61'),_0xff31('0x62'),_0xff31('0x63')],'raw':!![]});}})[_0xff31('0x24')](function(_0x4a4199){if(_0x4a4199){var _0x20c2c6=path[_0xff31('0x4b')](config[_0xff31('0x4c')],_0xff31('0x64'),util[_0xff31('0x65')](_0xff31('0x66'),path[_0xff31('0x67')](_0x4a4199[_0xff31('0x61')],path[_0xff31('0x68')](_0x4a4199[_0xff31('0x61')])),_0x4a4199[_0xff31('0x62')]));var _0x2ff376=path['join'](config[_0xff31('0x4c')],_0xff31('0x4d'),_0x2af779[_0xff31('0x2a')],util['format'](_0xff31('0x66'),_0x4a4199['name'],_0x4a4199['converted_format']));fs[_0xff31('0x69')](_0x20c2c6,_0x2ff376);return _0x4a4199;}})[_0xff31('0x41')](function(_0x388d55){throw new db[(_0xff31('0x5b'))][(_0xff31('0x5c'))](_0x388d55[_0xff31('0x5d')]);});})[_0xff31('0x24')](handleEntityNotFound(_0x52eb29,null))[_0xff31('0x24')](respondWithResult(_0x52eb29,0xc9))[_0xff31('0x41')](handleError(_0x52eb29,null));};exports['removeSound']=function(_0x46d77a,_0x331957,_0x257208){return db[_0xff31('0x48')][_0xff31('0x49')](function(_0x387f1a){var _0x19778f;return db[_0xff31('0x2c')][_0xff31('0x60')]({'where':{'id':_0x46d77a['params']['id']}})[_0xff31('0x24')](handleEntityNotFound(_0x331957,null))[_0xff31('0x24')](function(_0x7e5072){if(_0x7e5072){_0x19778f=_0x7e5072;return _0x7e5072[_0xff31('0x6a')](_0x46d77a[_0xff31('0x43')][_0xff31('0x6b')]);}})[_0xff31('0x24')](function(_0x3f22f0){if(_0x3f22f0){return db[_0xff31('0x5f')]['findOne']({'where':{'id':_0x46d77a[_0xff31('0x43')]['id2']},'attributes':['id','name','save_name',_0xff31('0x62'),_0xff31('0x63')],'raw':!![]});}})[_0xff31('0x24')](function(_0x422e39){if(_0x422e39){fs[_0xff31('0x6c')](path['join'](_0x19778f[_0xff31('0x50')],util[_0xff31('0x65')](_0xff31('0x66'),_0x422e39[_0xff31('0x2a')],_0x422e39[_0xff31('0x62')])));return _0x422e39;}})[_0xff31('0x41')](function(_0x46b90d){throw new db[(_0xff31('0x5b'))][(_0xff31('0x5c'))](_0x46b90d[_0xff31('0x5d')]);});})[_0xff31('0x24')](handleEntityNotFound(_0x331957,null))['then'](respondWithStatusCode(_0x331957,0xcc))[_0xff31('0x41')](handleError(_0x331957,null));};exports[_0xff31('0x6d')]=function(_0x488ae8,_0x4f4591,_0x2659ef){var _0x12e604={};var _0x360274={};var _0x4258f8;var _0x279ebf;return db['VoiceMusicOnHold'][_0xff31('0x60')]({'where':{'id':_0x488ae8[_0xff31('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f4591,null))[_0xff31('0x24')](function(_0x175bf3){if(_0x175bf3){_0x4258f8=_0x175bf3;_0x360274['model']=_[_0xff31('0x31')](db['Sound']['rawAttributes']);_0x360274[_0xff31('0x32')]=_[_0xff31('0x31')](_0x488ae8[_0xff31('0x32')]);_0x360274['filters']=_[_0xff31('0x33')](_0x360274[_0xff31('0x30')],_0x360274['query']);_0x12e604['attributes']=_[_0xff31('0x33')](_0x360274['model'],qs[_0xff31('0x44')](_0x488ae8[_0xff31('0x32')][_0xff31('0x44')]));_0x12e604['attributes']=_0x12e604[_0xff31('0x34')][_0xff31('0x35')]?_0x12e604[_0xff31('0x34')]:_0x360274['model'];_0x12e604['order']=qs[_0xff31('0x37')](_0x488ae8[_0xff31('0x32')][_0xff31('0x37')]);_0x12e604[_0xff31('0x38')]=qs[_0xff31('0x39')](_[_0xff31('0x3a')](_0x488ae8[_0xff31('0x32')],_0x360274['filters']));if(_0x488ae8[_0xff31('0x32')][_0xff31('0x6e')]){_0x12e604[_0xff31('0x38')]=_[_0xff31('0x3b')](_0x12e604[_0xff31('0x38')],{'$or':_[_0xff31('0x2b')](_0x12e604['attributes'],function(_0x415db1){var _0x5b8c3b={};_0x5b8c3b[_0x415db1]={'$like':'%'+_0x488ae8[_0xff31('0x32')][_0xff31('0x6e')]+'%'};return _0x5b8c3b;})});}_0x12e604=_['merge']({},_0x12e604,_0x488ae8[_0xff31('0x3d')]);return _0x4258f8['getSounds'](_0x12e604);}})['then'](function(_0xbcf630){if(_0xbcf630){_0x279ebf=_0xbcf630[_0xff31('0x35')];if(!_0x488ae8[_0xff31('0x32')][_0xff31('0x6f')]('nolimit')){_0x12e604['limit']=qs[_0xff31('0x1a')](_0x488ae8[_0xff31('0x32')][_0xff31('0x1a')]);_0x12e604[_0xff31('0x1d')]=qs['offset'](_0x488ae8[_0xff31('0x32')][_0xff31('0x1d')]);}return _0x4258f8['getSounds'](_0x12e604);}})['then'](function(_0x3b6af8){if(_0x3b6af8){return _0x3b6af8?{'count':_0x279ebf,'rows':_0x3b6af8}:null;}})[_0xff31('0x24')](respondWithResult(_0x4f4591,null))['catch'](handleError(_0x4f4591,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4069d2a..8ffe0e0 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 _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 +var _0x5199=['request-promise','path','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','bluebird'];(function(_0x1ed010,_0x734e0b){var _0x6e22bf=function(_0x1ffe15){while(--_0x1ffe15){_0x1ed010['push'](_0x1ed010['shift']());}};_0x6e22bf(++_0x734e0b);}(_0x5199,0x8a));var _0x9519=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5199[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x9519('0x0'));var util=require(_0x9519('0x1'));var logger=require(_0x9519('0x2'))(_0x9519('0x3'));var moment=require('moment');var BPromise=require(_0x9519('0x4'));var rp=require(_0x9519('0x5'));var fs=require('fs');var path=require(_0x9519('0x6'));var rimraf=require('rimraf');var config=require(_0x9519('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x111c65,_0x582d06){return _0x111c65[_0x9519('0x8')](_0x9519('0x9'),attributes,{'tableName':_0x9519('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 295cc38..ab31a43 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 _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 +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x50b3f7,_0x31e9b5){var _0x175b15=function(_0x4987e2){while(--_0x4987e2){_0x50b3f7['push'](_0x50b3f7['shift']());}};_0x175b15(++_0x31e9b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 1a09b4b..0ab88d8 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 _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 +var _0xaa9d=['post','/:id/users','addAgents','addTeams','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','getAgents','/:id/teams','getTeams'];(function(_0x4669c6,_0xcc724b){var _0x209c7c=function(_0x3642cf){while(--_0x3642cf){_0x4669c6['push'](_0x4669c6['shift']());}};_0x209c7c(++_0xcc724b);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0xdf205f,_0x4d433b){_0xdf205f=_0xdf205f-0x0;var _0x277962=_0xaa9d[_0xdf205f];return _0x277962;};'use strict';var multer=require(_0xdaa9('0x0'));var util=require(_0xdaa9('0x1'));var path=require(_0xdaa9('0x2'));var timeout=require(_0xdaa9('0x3'));var express=require(_0xdaa9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdaa9('0x5'));var controller=require(_0xdaa9('0x6'));router[_0xdaa9('0x7')]('/',auth[_0xdaa9('0x8')](),controller['index']);router['get'](_0xdaa9('0x9'),auth[_0xdaa9('0x8')](),controller[_0xdaa9('0xa')]);router[_0xdaa9('0x7')]('/:id',auth[_0xdaa9('0x8')](),controller['show']);router[_0xdaa9('0x7')]('/:id/users',auth[_0xdaa9('0x8')](),controller[_0xdaa9('0xb')]);router['get'](_0xdaa9('0xc'),auth[_0xdaa9('0x8')](),controller[_0xdaa9('0xd')]);router[_0xdaa9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdaa9('0xe')](_0xdaa9('0xf'),auth[_0xdaa9('0x8')](),controller[_0xdaa9('0x10')]);router[_0xdaa9('0xe')](_0xdaa9('0xc'),auth[_0xdaa9('0x8')](),controller[_0xdaa9('0x11')]);router['put']('/:id',auth[_0xdaa9('0x8')](),controller[_0xdaa9('0x12')]);router[_0xdaa9('0x13')](_0xdaa9('0x14'),auth['isAuthenticated'](),controller['destroy']);router[_0xdaa9('0x13')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);router[_0xdaa9('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdaa9('0x15')]);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 9e0bd42..b61df0c 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 _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 +var _0x57fa=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','STRING'];(function(_0x15b006,_0x42c524){var _0x4c21e5=function(_0x20876b){while(--_0x20876b){_0x15b006['push'](_0x15b006['shift']());}};_0x4c21e5(++_0x42c524);}(_0x57fa,0x11d));var _0xa57f=function(_0x32aaca,_0x58b090){_0x32aaca=_0x32aaca-0x0;var _0x17329=_0x57fa[_0x32aaca];return _0x17329;};'use strict';var Sequelize=require(_0xa57f('0x0'));module['exports']={'name':{'type':Sequelize[_0xa57f('0x1')],'allowNull':![],'unique':_0xa57f('0x2')},'prefix':{'type':Sequelize[_0xa57f('0x3')],'get':function(_0x4c6ecc){return _0xa57f('0x4')+this[_0xa57f('0x5')](_0xa57f('0x2'))+'-';}},'description':{'type':Sequelize[_0xa57f('0x1')]},'callerIdAll':{'type':Sequelize[_0xa57f('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xa57f('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 42578e7..9ca9cd5 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 _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 +var _0xc900=['voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VoicePrefix','includeAll','include','findAll','show','params','options','catch','destroy','find','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','context','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','goto','${EXTEN:','update','system-','sequelize','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','Team','getTeams','addTeams','Agents'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xc900,0xb3));var _0x0c90=function(_0x31d720,_0x116867){_0x31d720=_0x31d720-0x0;var _0x22a7b7=_0xc900[_0x31d720];return _0x22a7b7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];config['redis']=_[_0x0c90('0x19')](config[_0x0c90('0x1a')],{'host':_0x0c90('0x1b'),'port':0x18eb});var socket=require(_0x0c90('0x1c'))(new Redis(config[_0x0c90('0x1a')]));require('./voicePrefix.socket')[_0x0c90('0x1d')](socket);function respondWithStatusCode(_0x4451e0,_0x4f35f4){_0x4f35f4=_0x4f35f4||0xcc;return function(_0x2c82a4){if(_0x2c82a4){return _0x4451e0[_0x0c90('0x1e')](_0x4f35f4);}return _0x4451e0[_0x0c90('0x1f')](_0x4f35f4)['end']();};}function respondWithResult(_0x5daeb7,_0x412635){_0x412635=_0x412635||0xc8;return function(_0x15ca42){if(_0x15ca42){return _0x5daeb7[_0x0c90('0x1f')](_0x412635)[_0x0c90('0x20')](_0x15ca42);}};}function respondWithFilteredResult(_0x276b92,_0x2cab22){return function(_0x42321a){if(_0x42321a){var _0x57b9a6=typeof _0x2cab22[_0x0c90('0x21')]===_0x0c90('0x22')&&typeof _0x2cab22[_0x0c90('0x23')]===_0x0c90('0x22');var _0x594267=_0x42321a[_0x0c90('0x24')];var _0xd129ca=_0x57b9a6?0x0:_0x2cab22[_0x0c90('0x21')];var _0x1241a9=_0x57b9a6?_0x42321a[_0x0c90('0x24')]:_0x2cab22[_0x0c90('0x21')]+_0x2cab22['limit'];var _0x365a42;if(_0x1241a9>=_0x594267){_0x1241a9=_0x594267;_0x365a42=0xc8;}else{_0x365a42=0xce;}_0x276b92['status'](_0x365a42);return _0x276b92[_0x0c90('0x25')](_0x0c90('0x26'),_0xd129ca+'-'+_0x1241a9+'/'+_0x594267)['json'](_0x42321a);}return null;};}function patchUpdates(_0x2a053a){return function(_0x43ddc3){try{jsonpatch[_0x0c90('0x27')](_0x43ddc3,_0x2a053a,!![]);}catch(_0x86dee){return BPromise[_0x0c90('0x28')](_0x86dee);}return _0x43ddc3[_0x0c90('0x29')]();};}function saveUpdates(_0x4dfbc3,_0x26f0a3){return function(_0x12f22c){if(_0x12f22c){return _0x12f22c['update'](_0x4dfbc3)['then'](function(_0x28d005){return _0x28d005;});}return null;};}function removeEntity(_0x3ea861,_0x35c243){return function(_0x109a5f){if(_0x109a5f){return _0x109a5f['destroy']()[_0x0c90('0x2a')](function(){var _0x438652=_0x109a5f[_0x0c90('0x2b')]({'plain':!![]});var _0x277d4a=_0x0c90('0x2c');return db[_0x0c90('0x2d')]['destroy']({'where':{'type':_0x277d4a,'resourceId':_0x438652['id']}})[_0x0c90('0x2a')](function(){return _0x109a5f;});})[_0x0c90('0x2a')](function(){_0x3ea861[_0x0c90('0x1f')](0xcc)[_0x0c90('0x2e')]();});}};}function handleEntityNotFound(_0x52d28d,_0x4c8603){return function(_0x1f27f1){if(!_0x1f27f1){_0x52d28d[_0x0c90('0x1e')](0x194);}return _0x1f27f1;};}function handleError(_0x3bff04,_0x122a4f){_0x122a4f=_0x122a4f||0x1f4;return function(_0x119e09){logger['error'](_0x119e09[_0x0c90('0x2f')]);if(_0x119e09[_0x0c90('0x30')]){delete _0x119e09[_0x0c90('0x30')];}_0x3bff04['status'](_0x122a4f)[_0x0c90('0x31')](_0x119e09);};}exports['index']=function(_0x54a3f5,_0x886634){var _0x5071b={},_0x2f0835={},_0x41189f={'count':0x0,'rows':[]};var _0x58c01a=_[_0x0c90('0x32')](db['VoicePrefix'][_0x0c90('0x33')],function(_0x5a0e75){return{'name':_0x5a0e75[_0x0c90('0x34')],'type':_0x5a0e75[_0x0c90('0x35')]['key']};});_0x2f0835[_0x0c90('0x36')]=_[_0x0c90('0x32')](_0x58c01a,_0x0c90('0x30'));_0x2f0835[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x54a3f5[_0x0c90('0x37')]);_0x2f0835[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x2f0835['model'],_0x2f0835[_0x0c90('0x37')]);_0x5071b[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x2f0835[_0x0c90('0x36')],qs['fields'](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x3c')]));_0x5071b[_0x0c90('0x3b')]=_0x5071b[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x5071b[_0x0c90('0x3b')]:_0x2f0835[_0x0c90('0x36')];if(!_0x54a3f5[_0x0c90('0x37')]['hasOwnProperty'](_0x0c90('0x3e'))){_0x5071b[_0x0c90('0x23')]=qs['limit'](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x23')]);_0x5071b[_0x0c90('0x21')]=qs[_0x0c90('0x21')](_0x54a3f5[_0x0c90('0x37')]['offset']);}_0x5071b[_0x0c90('0x3f')]=qs[_0x0c90('0x40')](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x40')]);_0x5071b[_0x0c90('0x41')]=qs[_0x0c90('0x39')](_[_0x0c90('0x42')](_0x54a3f5[_0x0c90('0x37')],_0x2f0835[_0x0c90('0x39')]),_0x58c01a);if(_0x54a3f5['query'][_0x0c90('0x43')]){_0x5071b['where']=_[_0x0c90('0x44')](_0x5071b['where'],{'$or':_[_0x0c90('0x32')](_0x58c01a,function(_0x62e316){if(_0x62e316['type']!=='VIRTUAL'){var _0x27ef6f={};_0x27ef6f[_0x62e316['name']]={'$like':'%'+_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x43')]+'%'};return _0x27ef6f;}})});}_0x5071b=_[_0x0c90('0x44')]({},_0x5071b,_0x54a3f5['options']);var _0x2ad8eb={'where':_0x5071b[_0x0c90('0x41')]};return db[_0x0c90('0x45')][_0x0c90('0x24')](_0x2ad8eb)[_0x0c90('0x2a')](function(_0x1184c4){_0x41189f['count']=_0x1184c4;if(_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x46')]){_0x5071b[_0x0c90('0x47')]=[{'all':!![]}];}return db[_0x0c90('0x45')][_0x0c90('0x48')](_0x5071b);})[_0x0c90('0x2a')](function(_0x30b9df){_0x41189f['rows']=_0x30b9df;return _0x41189f;})[_0x0c90('0x2a')](respondWithFilteredResult(_0x886634,_0x5071b))['catch'](handleError(_0x886634,null));};exports[_0x0c90('0x49')]=function(_0x2470ce,_0x1a7a36){var _0x1179b0={'raw':![],'where':{'id':_0x2470ce[_0x0c90('0x4a')]['id']}},_0x38842c={};_0x38842c[_0x0c90('0x36')]=_[_0x0c90('0x38')](db[_0x0c90('0x45')][_0x0c90('0x33')]);_0x38842c[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x2470ce[_0x0c90('0x37')]);_0x38842c[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x38842c['model'],_0x38842c[_0x0c90('0x37')]);_0x1179b0[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x38842c[_0x0c90('0x36')],qs[_0x0c90('0x3c')](_0x2470ce[_0x0c90('0x37')][_0x0c90('0x3c')]));_0x1179b0[_0x0c90('0x3b')]=_0x1179b0[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x1179b0[_0x0c90('0x3b')]:_0x38842c[_0x0c90('0x36')];if(_0x2470ce[_0x0c90('0x37')][_0x0c90('0x46')]){_0x1179b0['include']=[{'all':!![]}];}_0x1179b0=_[_0x0c90('0x44')]({},_0x1179b0,_0x2470ce[_0x0c90('0x4b')]);return db['VoicePrefix']['find'](_0x1179b0)['then'](handleEntityNotFound(_0x1a7a36,null))[_0x0c90('0x2a')](respondWithResult(_0x1a7a36,null))[_0x0c90('0x4c')](handleError(_0x1a7a36,null));};exports[_0x0c90('0x4d')]=function(_0x3fbdfc,_0x11d2de){return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x3fbdfc[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x11d2de,null))['then'](removeEntity(_0x11d2de,null))[_0x0c90('0x4c')](handleError(_0x11d2de,null));};exports[_0x0c90('0x4f')]=function(_0xd639a1,_0xb483e7){return db[_0x0c90('0x45')][_0x0c90('0x4f')]()[_0x0c90('0x2a')](respondWithResult(_0xb483e7,null))[_0x0c90('0x4c')](handleError(_0xb483e7,null));};exports[_0x0c90('0x50')]=function(_0xeeee3b,_0x5e288e){var _0xac80b2;return db['sequelize'][_0x0c90('0x51')](function(_0x67539d){return db[_0x0c90('0x45')][_0x0c90('0x50')](_0xeeee3b[_0x0c90('0x52')],{'transaction':_0x67539d})[_0x0c90('0x2a')](function(_0x58dcfc){_0xac80b2=_0x58dcfc['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0xac80b2[_0x0c90('0x53')]},'raw':!![]})[_0x0c90('0x2a')](function(_0x3bf5de){return createVoicePrefixExtensions(_0xac80b2,_0x3bf5de,_0x67539d);});});})['then'](function(){var _0x202666=_0xeeee3b[_0x0c90('0x54')]['get']({'plain':!![]});if(!_0x202666)throw new Error(_0x0c90('0x55'));if(_0x202666['role']===_0x0c90('0x54')){var _0x8951f2=_0xac80b2;return db[_0x0c90('0x56')][_0x0c90('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x202666[_0x0c90('0x57')]},'raw':!![]})['then'](function(_0x344613){if(_0x344613&&_0x344613[_0x0c90('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x8951f2['name'],'resourceId':_0x8951f2['id'],'type':_0x344613[_0x0c90('0x30')],'sectionId':_0x344613['id']},{})[_0x0c90('0x2a')](function(){return _0xac80b2;});}else{return _0xac80b2;}})[_0x0c90('0x4c')](function(_0x2f61cb){logger[_0x0c90('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f61cb);throw _0x2f61cb;});}return _0xac80b2;})[_0x0c90('0x2a')](respondWithResult(_0x5e288e,null))[_0x0c90('0x4c')](handleError(_0x5e288e,null));};function Extension(_0x5ee971,_0x3eb725,_0x5a11e5,_0x24326b){this[_0x0c90('0x5a')]='from-sip';this[_0x0c90('0x5b')]=_0x5ee971;this['app']=_0x5a11e5;this['type']='system';this[_0x0c90('0x5c')]=_0x0c90('0x5d');this[_0x0c90('0x5e')]=_0x3eb725;this[_0x0c90('0x5f')]=_0x24326b;}function createVoicePrefixExtensions(_0x536a26,_0x5b385b,_0x426f65){return new BPromise(function(_0xd982c5,_0x120b88){var _0x4c4e5a=new Extension(formatPrefixName(_0x536a26[_0x0c90('0x60')]),0x1,_0x0c90('0x61'),_0x0c90('0x62'));_0x4c4e5a['VoicePrefixId']=_0x536a26['id'];return db[_0x0c90('0x63')][_0x0c90('0x50')](_0x4c4e5a,{'transaction':_0x426f65})[_0x0c90('0x2a')](function(_0x521436){var _0x31343b=_0x521436[_0x0c90('0x2b')]({'plain':!![]});var _0x1a198b=_[_0x0c90('0x32')](addVoicePrefixExtensions(_0x536a26,_0x5b385b),function(_0xf58a25){_0xf58a25[_0x0c90('0x53')]=_0x31343b['id'];_0xf58a25[_0x0c90('0x64')]=_0x536a26['id'];return _0xf58a25;});return db[_0x0c90('0x63')][_0x0c90('0x65')](_0x1a198b,{'transaction':_0x426f65})['then'](function(_0x530bbe){if(!_0x530bbe){return _0x120b88(_0x0c90('0x66'));}else{return _0xd982c5(_0x530bbe);}})[_0x0c90('0x4c')](function(_0x3a44df){return _0x120b88(_0x3a44df);});});;});};function addVoicePrefixExtensions(_0x2faf14,_0x19dae5){var _0x2dad30=[];var _0x2f1459=formatPrefixName(_0x2faf14[_0x0c90('0x60')]);_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x2,_0x0c90('0x68'),_0x0c90('0x69')+_0x2faf14[_0x0c90('0x30')]));if(_0x2faf14[_0x0c90('0x6a')]){_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x3,_0x0c90('0x68'),'PREFIX-CALLERIDALL='+_0x2faf14[_0x0c90('0x6a')]));}else{_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x3,_0x0c90('0x61'),'No\x20callerid\x20available'));}_0x2dad30['push'](new Extension(_0x2f1459,0x4,_0x0c90('0x6b'),_0x19dae5['context']+','+_0x0c90('0x6c')+(0x8+_0x2faf14[_0x0c90('0x30')]['length'])+'}'+','+0x1));return _0x2dad30;}function formatPrefixName(_0x2c64e0){var _0x3f4819='_';for(var _0x25ef97=0x0;_0x25ef97<_0x2c64e0[_0x0c90('0x3d')];_0x25ef97++){if(_0x2c64e0['charAt'](_0x25ef97)=='-'){_0x3f4819+=_0x2c64e0['charAt'](_0x25ef97);}else{_0x3f4819+='['+_0x2c64e0['charAt'](_0x25ef97)+']';}}_0x3f4819+='.';return _0x3f4819;}exports[_0x0c90('0x6d')]=function(_0x2d3287,_0x3bc90d,_0x2d5fe3){var _0x4a801f=_0x2d3287[_0x0c90('0x52')];_0x4a801f['prefix']=_0x0c90('0x6e')+_0x4a801f[_0x0c90('0x30')]+'-';return db[_0x0c90('0x6f')]['transaction'](function(_0x10f686){return db[_0x0c90('0x45')][_0x0c90('0x6d')](_0x4a801f,{'where':{'id':_0x4a801f['id']},'transaction':_0x10f686})[_0x0c90('0x2a')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x4a801f['id']},'transaction':_0x10f686})[_0x0c90('0x2a')](function(){return db['VoiceExtension'][_0x0c90('0x4e')]({'where':{'id':_0x4a801f[_0x0c90('0x53')]},'raw':!![]})[_0x0c90('0x2a')](function(_0x4a59b5){return createVoicePrefixExtensions(_0x4a801f,_0x4a59b5,_0x10f686);});});});})[_0x0c90('0x2a')](function(){return db[_0x0c90('0x45')][_0x0c90('0x70')](_0x4a801f['id']);})[_0x0c90('0x2a')](respondWithResult(_0x3bc90d,null))[_0x0c90('0x4c')](handleError(_0x3bc90d,null));};exports[_0x0c90('0x71')]=function(_0x53779b,_0x28a2f0,_0x431828){return db[_0x0c90('0x45')][_0x0c90('0x4e')]({'where':{'id':_0x53779b[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x28a2f0,null))[_0x0c90('0x2a')](function(_0x1777ac){if(_0x1777ac){return _0x1777ac[_0x0c90('0x71')](_0x53779b[_0x0c90('0x52')]['ids'],_[_0x0c90('0x72')](_0x53779b[_0x0c90('0x52')],[_0x0c90('0x73'),'id'])||{})[_0x0c90('0x74')](function(_0x4e8330){for(var _0x2e68ea=0x0;_0x2e68ea<_0x53779b[_0x0c90('0x52')][_0x0c90('0x73')]['length'];_0x2e68ea+=0x1){socket[_0x0c90('0x75')](_0x0c90('0x76'),{'UserId':Number(_0x53779b['body'][_0x0c90('0x73')][_0x2e68ea]),'VoicePrefixId':Number(_0x53779b['params']['id'])});}return _0x4e8330;});}})[_0x0c90('0x2a')](respondWithResult(_0x28a2f0,null))['catch'](handleError(_0x28a2f0,null));};exports['removeAgents']=function(_0x42e76a,_0x137c30,_0x56a38b){return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x42e76a[_0x0c90('0x4a')]['id']}})['then'](handleEntityNotFound(_0x137c30,null))['then'](function(_0x250d41){if(_0x250d41){return _0x250d41['removeAgents'](_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')])[_0x0c90('0x2a')](function(){if(_[_0x0c90('0x77')](_0x42e76a[_0x0c90('0x37')]['ids'])){for(var _0x471caa=0x0;_0x471caa<_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')]['length'];_0x471caa+=0x1){socket['emit'](_0x0c90('0x78'),{'UserId':Number(_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')][_0x471caa]),'VoicePrefixId':Number(_0x42e76a['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x42e76a[_0x0c90('0x37')]['ids']),'VoicePrefixId':Number(_0x42e76a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x137c30,null))['catch'](handleError(_0x137c30,null));};exports[_0x0c90('0x79')]=function(_0x2ca017,_0x1bf6e0,_0x29ede1){var _0x16c383={};var _0x56a3bc={};var _0x5562cc;var _0x57eab8;return db[_0x0c90('0x45')][_0x0c90('0x7a')]({'where':{'id':_0x2ca017[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x1bf6e0,null))[_0x0c90('0x2a')](function(_0x3d5521){if(_0x3d5521){_0x5562cc=_0x3d5521;_0x56a3bc['model']=_[_0x0c90('0x38')](db[_0x0c90('0x7b')][_0x0c90('0x33')]);_0x56a3bc[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x2ca017[_0x0c90('0x37')]);_0x56a3bc[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x56a3bc[_0x0c90('0x36')],_0x56a3bc[_0x0c90('0x37')]);_0x16c383[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x56a3bc['model'],qs[_0x0c90('0x3c')](_0x2ca017['query'][_0x0c90('0x3c')]));_0x16c383['attributes']=_0x16c383[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x16c383[_0x0c90('0x3b')]:_0x56a3bc[_0x0c90('0x36')];_0x16c383['order']=qs['sort'](_0x2ca017[_0x0c90('0x37')][_0x0c90('0x40')]);_0x16c383['where']=qs[_0x0c90('0x39')](_[_0x0c90('0x42')](_0x2ca017['query'],_0x56a3bc[_0x0c90('0x39')]));if(_0x2ca017[_0x0c90('0x37')]['filter']){_0x16c383[_0x0c90('0x41')]=_['merge'](_0x16c383[_0x0c90('0x41')],{'$or':_[_0x0c90('0x32')](_0x16c383[_0x0c90('0x3b')],function(_0x1b95db){var _0x519f74={};_0x519f74[_0x1b95db]={'$like':'%'+_0x2ca017[_0x0c90('0x37')]['filter']+'%'};return _0x519f74;})});}_0x16c383=_[_0x0c90('0x44')]({},_0x16c383,_0x2ca017[_0x0c90('0x4b')]);return _0x5562cc[_0x0c90('0x79')](_0x16c383);}})[_0x0c90('0x2a')](function(_0x1306bb){if(_0x1306bb){_0x57eab8=_0x1306bb['length'];if(!_0x2ca017[_0x0c90('0x37')][_0x0c90('0x7c')](_0x0c90('0x3e'))){_0x16c383[_0x0c90('0x23')]=qs[_0x0c90('0x23')](_0x2ca017[_0x0c90('0x37')]['limit']);_0x16c383[_0x0c90('0x21')]=qs[_0x0c90('0x21')](_0x2ca017['query'][_0x0c90('0x21')]);}return _0x5562cc[_0x0c90('0x79')](_0x16c383);}})['then'](function(_0x199d05){if(_0x199d05){return _0x199d05?{'count':_0x57eab8,'rows':_0x199d05}:null;}})[_0x0c90('0x2a')](respondWithResult(_0x1bf6e0,null))['catch'](handleError(_0x1bf6e0,null));};exports['getTeams']=function(_0x13c69c,_0x407c6e,_0x4859e9){var _0x391e3f={};var _0x4fee0e={};var _0x37d1d5;var _0x4c142b;return db['VoicePrefix'][_0x0c90('0x7a')]({'where':{'id':_0x13c69c[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x407c6e,null))['then'](function(_0x54846c){if(_0x54846c){_0x37d1d5=_0x54846c;_0x4fee0e[_0x0c90('0x36')]=_[_0x0c90('0x38')](db[_0x0c90('0x7d')][_0x0c90('0x33')]);_0x4fee0e[_0x0c90('0x37')]=_['keys'](_0x13c69c[_0x0c90('0x37')]);_0x4fee0e['filters']=_[_0x0c90('0x3a')](_0x4fee0e[_0x0c90('0x36')],_0x4fee0e[_0x0c90('0x37')]);_0x391e3f[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x4fee0e[_0x0c90('0x36')],qs[_0x0c90('0x3c')](_0x13c69c['query']['fields']));_0x391e3f[_0x0c90('0x3b')]=_0x391e3f[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x391e3f[_0x0c90('0x3b')]:_0x4fee0e[_0x0c90('0x36')];_0x391e3f[_0x0c90('0x3f')]=qs[_0x0c90('0x40')](_0x13c69c[_0x0c90('0x37')]['sort']);_0x391e3f[_0x0c90('0x41')]=qs['filters'](_[_0x0c90('0x42')](_0x13c69c[_0x0c90('0x37')],_0x4fee0e[_0x0c90('0x39')]));if(_0x13c69c[_0x0c90('0x37')][_0x0c90('0x43')]){_0x391e3f[_0x0c90('0x41')]=_[_0x0c90('0x44')](_0x391e3f['where'],{'$or':_['map'](_0x391e3f[_0x0c90('0x3b')],function(_0x4a001d){var _0x2204fe={};_0x2204fe[_0x4a001d]={'$like':'%'+_0x13c69c[_0x0c90('0x37')][_0x0c90('0x43')]+'%'};return _0x2204fe;})});}_0x391e3f=_['merge']({},_0x391e3f,_0x13c69c[_0x0c90('0x4b')]);return _0x37d1d5[_0x0c90('0x7e')](_0x391e3f);}})[_0x0c90('0x2a')](function(_0x30be13){if(_0x30be13){_0x4c142b=_0x30be13[_0x0c90('0x3d')];if(!_0x13c69c['query']['hasOwnProperty'](_0x0c90('0x3e'))){_0x391e3f[_0x0c90('0x23')]=qs[_0x0c90('0x23')](_0x13c69c[_0x0c90('0x37')][_0x0c90('0x23')]);_0x391e3f[_0x0c90('0x21')]=qs['offset'](_0x13c69c[_0x0c90('0x37')][_0x0c90('0x21')]);}return _0x37d1d5[_0x0c90('0x7e')](_0x391e3f);}})[_0x0c90('0x2a')](function(_0x5103ae){if(_0x5103ae){return _0x5103ae?{'count':_0x4c142b,'rows':_0x5103ae}:null;}})['then'](respondWithResult(_0x407c6e,null))[_0x0c90('0x4c')](handleError(_0x407c6e,null));};exports[_0x0c90('0x7f')]=function(_0x59e8d9,_0x9bed36,_0x379a0e){var _0x19a144=_0x59e8d9[_0x0c90('0x52')][_0x0c90('0x73')];var _0x5379bc;return db[_0x0c90('0x7d')]['findAll']({'where':{'id':_0x19a144},'attributes':['id'],'include':[{'model':db[_0x0c90('0x7b')],'as':_0x0c90('0x80'),'attributes':['id',_0x0c90('0x30'),'online',_0x0c90('0x81'),_0x0c90('0x82')],'raw':!![]}]})[_0x0c90('0x2a')](function(_0x5f295e){if(_0x5f295e){_0x5379bc=_0x5f295e;var _0x5a2961=_['flatMap'](_0x5f295e,function(_0x4930cd){var _0x2858a9=_0x4930cd[_0x0c90('0x2b')]({'plain':!![]});return _0x2858a9['Agents'];});return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x59e8d9['params']['id']}})[_0x0c90('0x2a')](function(_0x13c0f2){return db[_0x0c90('0x6f')][_0x0c90('0x51')](function(_0x1091fb){return _0x13c0f2['addTeams'](_0x19a144,{'transaction':_0x1091fb})[_0x0c90('0x2a')](function(){return BPromise[_0x0c90('0x83')](_0x5379bc,function(_0x35ee25){return db[_0x0c90('0x84')][_0x0c90('0x85')]({'TeamId':_0x35ee25['id'],'VoicePrefixId':_0x59e8d9[_0x0c90('0x4a')]['id']},{'transaction':_0x1091fb});});})[_0x0c90('0x2a')](function(){return BPromise[_0x0c90('0x83')](_0x5a2961,function(_0x3614d1){return db[_0x0c90('0x86')]['findOrCreate']({'where':{'UserId':_0x3614d1['id'],'VoicePrefixId':_0x59e8d9[_0x0c90('0x4a')]['id']},'transaction':_0x1091fb});});})['then'](function(){_0x5a2961[_0x0c90('0x87')](function(_0x40dd25){socket[_0x0c90('0x75')]('userVoicePrefix:save',{'UserId':_0x40dd25['id'],'VoicePrefixId':_0x13c0f2['id']});});});});});}})[_0x0c90('0x2a')](respondWithStatusCode(_0x9bed36,null))['catch'](handleError(_0x9bed36,null));};exports[_0x0c90('0x88')]=function(_0x1c2814,_0x2f542b,_0x3f3787){return db[_0x0c90('0x7d')][_0x0c90('0x48')]({'where':{'id':_0x1c2814[_0x0c90('0x37')][_0x0c90('0x73')]},'attributes':['id'],'include':[{'model':db[_0x0c90('0x7b')],'as':_0x0c90('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f542b,null))[_0x0c90('0x2a')](function(_0x31dde9){var _0x37acdc=_['map'](_0x31dde9,'id');var _0x5f431d=[];var _0x2dabe6=[];var _0x28736e=squel['select']();_0x28736e['field'](_0x0c90('0x89'))[_0x0c90('0x8a')]('team_has_voice_prefixes','tq')[_0x0c90('0x8b')](_0x0c90('0x8c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0c90('0x41')](_0x0c90('0x8d'),_0x1c2814['params']['id']);for(var _0x1fb55a=0x0;_0x1fb55a<_0x31dde9['length'];_0x1fb55a+=0x1){let _0x5aa532=_0x31dde9[_0x1fb55a];for(var _0x8e8e30=0x0;_0x8e8e30<_0x5aa532[_0x0c90('0x80')]['length'];_0x8e8e30+=0x1){let _0x5c942d=_0x5aa532[_0x0c90('0x80')][_0x8e8e30];var _0x155915=_0x28736e[_0x0c90('0x8e')]();_0x155915[_0x0c90('0x41')](_0x0c90('0x8f'),_0x5c942d['id']);_0x2dabe6['push'](db[_0x0c90('0x6f')][_0x0c90('0x37')](_0x155915[_0x0c90('0x90')](),{'type':db[_0x0c90('0x6f')][_0x0c90('0x91')][_0x0c90('0x92')]})['then'](function(_0x18cc89){if(_0x18cc89['length']===0x1){return _0x5c942d['id'];}else{var _0x5e6e8f=_['every'](_[_0x0c90('0x32')](_0x18cc89,_0x0c90('0x93')),function(_0x53c760){return _[_0x0c90('0x94')](_0x37acdc,_0x53c760);});if(_0x5e6e8f){return _0x5c942d['id'];}}}));}}return BPromise['all'](_0x2dabe6)['then'](function(_0x22b3df){_0x5f431d=_(_0x5f431d)[_0x0c90('0x95')](_0x22b3df)[_0x0c90('0x96')]()[_0x0c90('0x97')]();return db[_0x0c90('0x45')][_0x0c90('0x4e')]({'where':{'id':_0x1c2814[_0x0c90('0x4a')]['id']}})['then'](function(_0x2eece9){return db[_0x0c90('0x6f')][_0x0c90('0x51')](function(_0x3817a4){return _0x2eece9[_0x0c90('0x88')](_0x1c2814[_0x0c90('0x37')][_0x0c90('0x73')],{'transaction':_0x3817a4})[_0x0c90('0x2a')](function(){if(!_[_0x0c90('0x98')](_0x5f431d)){return _0x2eece9[_0x0c90('0x99')](_0x5f431d,{'transaction':_0x3817a4});}})[_0x0c90('0x2a')](function(){_0x5f431d[_0x0c90('0x87')](function(_0x9187af){socket[_0x0c90('0x75')]('userVoicePrefix:remove',{'UserId':_0x9187af,'VoicePrefixId':_0x2eece9['id']});});});});});});})[_0x0c90('0x2a')](respondWithStatusCode(_0x2f542b,null))[_0x0c90('0x4c')](handleError(_0x2f542b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 1b291c7..e4051bb 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 _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 +var _0xa681=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x503d23,_0x5e12d7){var _0x2787da=function(_0x7b14d2){while(--_0x7b14d2){_0x503d23['push'](_0x503d23['shift']());}};_0x2787da(++_0x5e12d7);}(_0xa681,0xb2));var _0x1a68=function(_0x16c4e0,_0x1b9ea4){_0x16c4e0=_0x16c4e0-0x0;var _0x1988d9=_0xa681[_0x16c4e0];return _0x1988d9;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x1a68('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1a68('0x1')](0x0);var events={'afterCreate':_0x1a68('0x2'),'afterUpdate':_0x1a68('0x3'),'afterDestroy':_0x1a68('0x4')};function emitEvent(_0x3304f5){return function(_0x2a8d47,_0x23df1f,_0x2cf0d5){VoicePrefixEvents[_0x1a68('0x5')](_0x3304f5+':'+_0x2a8d47['id'],_0x2a8d47);VoicePrefixEvents['emit'](_0x3304f5,_0x2a8d47);_0x2cf0d5(null);};}for(var e in events){if(events[_0x1a68('0x6')](e)){var event=events[e];VoicePrefix[_0x1a68('0x7')](e,emitEvent(event));}}module[_0x1a68('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d589e59..a8505ac 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 _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 +var _0xa9c9=['path','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','lodash','../../config/logger'];(function(_0x3e5bd8,_0xccabb3){var _0x451883=function(_0x1877dc){while(--_0x1877dc){_0x3e5bd8['push'](_0x3e5bd8['shift']());}};_0x451883(++_0xccabb3);}(_0xa9c9,0xf6));var _0x9a9c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xa9c9[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x9a9c('0x0'));var util=require('util');var logger=require(_0x9a9c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a9c('0x2'));var rimraf=require(_0x9a9c('0x3'));var config=require(_0x9a9c('0x4'));var attributes=require(_0x9a9c('0x5'));module[_0x9a9c('0x6')]=function(_0x413bc0,_0x1a7a47){return _0x413bc0['define'](_0x9a9c('0x7'),attributes,{'tableName':'voice_prefixes','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 66c95b5..1d269d9 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 _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 +var _0x1228=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x5a17dd,_0x371fcc){var _0x354e54=function(_0x4bad56){while(--_0x4bad56){_0x5a17dd['push'](_0x5a17dd['shift']());}};_0x354e54(++_0x371fcc);}(_0x1228,0x12f));var _0x8122=function(_0x4a2171,_0x2ded2d){_0x4a2171=_0x4a2171-0x0;var _0x5d9cf3=_0x1228[_0x4a2171];return _0x5d9cf3;};'use strict';var _=require(_0x8122('0x0'));var util=require('util');var moment=require(_0x8122('0x1'));var BPromise=require('bluebird');var rs=require(_0x8122('0x2'));var fs=require('fs');var Redis=require(_0x8122('0x3'));var db=require(_0x8122('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8122('0x5'))(_0x8122('0x6'));var config=require('../../config/environment');var jayson=require(_0x8122('0x7'));var client=jayson[_0x8122('0x8')]['http']({'port':0x232a});config[_0x8122('0x9')]=_[_0x8122('0xa')](config['redis'],{'host':_0x8122('0xb'),'port':0x18eb});var socket=require(_0x8122('0xc'))(new Redis(config['redis']));require(_0x8122('0xd'))[_0x8122('0xe')](socket);function respondWithRpcPromise(_0x4a1378,_0x5a7875,_0x4fa7b3){return new BPromise(function(_0x52f48b,_0x208043){return client['request'](_0x4a1378,_0x4fa7b3)[_0x8122('0xf')](function(_0x23a9e4){logger[_0x8122('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x5a7875,_0x8122('0x11'));logger['debug'](_0x8122('0x12'),_0x5a7875,_0x8122('0x11'),JSON[_0x8122('0x13')](_0x23a9e4));if(_0x23a9e4[_0x8122('0x14')]){if(_0x23a9e4[_0x8122('0x14')][_0x8122('0x15')]===0x1f4){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);return _0x208043(_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);}logger['error'](_0x8122('0x16'),_0x5a7875,_0x23a9e4['error'][_0x8122('0x17')]);return _0x52f48b(_0x23a9e4['error'][_0x8122('0x17')]);}else{logger[_0x8122('0x10')](_0x8122('0x16'),_0x5a7875,_0x8122('0x11'));_0x52f48b(_0x23a9e4['result']['message']);}})['catch'](function(_0x56a926){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x56a926);_0x208043(_0x56a926);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b753a7b..b0693c3 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 _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 +var _0x255f=['emit','removeListener','register','voicePrefix:','./voicePrefix.events','remove','update'];(function(_0x33075b,_0x12035f){var _0x203186=function(_0x5d6aea){while(--_0x5d6aea){_0x33075b['push'](_0x33075b['shift']());}};_0x203186(++_0x12035f);}(_0x255f,0x185));var _0xf255=function(_0x15ae3d,_0x70df40){_0x15ae3d=_0x15ae3d-0x0;var _0x8ce8a6=_0x255f[_0x15ae3d];return _0x8ce8a6;};'use strict';var VoicePrefixEvents=require(_0xf255('0x0'));var events=['save',_0xf255('0x1'),_0xf255('0x2')];function createListener(_0xba19b,_0x4fae55){return function(_0x3984f5){_0x4fae55[_0xf255('0x3')](_0xba19b,_0x3984f5);};}function removeListener(_0x474ac5,_0x151b29){return function(){VoicePrefixEvents[_0xf255('0x4')](_0x474ac5,_0x151b29);};}exports[_0xf255('0x5')]=function(_0xc1d19f){for(var _0x5bbed0=0x0,_0x1236fb=events['length'];_0x5bbed0<_0x1236fb;_0x5bbed0++){var _0x481d8c=events[_0x5bbed0];var _0x4a533f=createListener(_0xf255('0x6')+_0x481d8c,_0xc1d19f);VoicePrefixEvents['on'](_0x481d8c,_0x4a533f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index db4c776..a9950c4 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(_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 +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xfb9aaa,_0x37935d){var _0x103bf7=function(_0x1e9f2a){while(--_0x1e9f2a){_0xfb9aaa['push'](_0xfb9aaa['shift']());}};_0x103bf7(++_0x37935d);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ce9d,_0x4ff962){_0x2ce9d=_0x2ce9d-0x0;var _0x578428=_0xb10b[_0x2ce9d];return _0x578428;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index c0b6209..1211fb4 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 _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 +var _0xd56b=['mandatoryDisposition','exports','outbound','inbound','STRING','default','ringall','leastrecent','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','roundrobin','includes','INTEGER','ENUM','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','onlyIfOpen','always','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x225815,_0x5db310){var _0x47a32e=function(_0xafe283){while(--_0xafe283){_0x225815['push'](_0x225815['shift']());}};_0x47a32e(++_0x5db310);}(_0xd56b,0x187));var _0xbd56=function(_0x2ae5b1,_0x5b500c){_0x2ae5b1=_0x2ae5b1-0x0;var _0x4d5cc7=_0xd56b[_0x2ae5b1];return _0x4d5cc7;};'use strict';var Sequelize=require('sequelize');module[_0xbd56('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0xbd56('0x1')),'allowNull':![],'defaultValue':_0xbd56('0x2')},'musiconhold':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':_0xbd56('0x4')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xbd56('0x5'),_0xbd56('0x6'),'fewestcalls',_0xbd56('0x7'),_0xbd56('0x8'),_0xbd56('0x9'),_0xbd56('0xa'),_0xbd56('0xb')),'allowNull':![],'defaultValue':_0xbd56('0x5'),'set':function(_0x3c68a5){this[_0xbd56('0xc')](_0xbd56('0xd'),_0x3c68a5?_0x3c68a5:_0xbd56('0x8'));},'get':function(){var _0x38870b=this[_0xbd56('0xe')](_0xbd56('0xf'));var _0x5c0d06=this[_0xbd56('0xe')](_0xbd56('0x10'));var _0x12a05a=this[_0xbd56('0xe')](_0xbd56('0xd'));if(_0x38870b===_0xbd56('0x1')){if(_0x5c0d06===_0xbd56('0x11')){return null;}if(_0x5c0d06==='booked'&&!['rrmemory',_0xbd56('0x12')][_0xbd56('0x13')](_0x12a05a)){this[_0xbd56('0xc')](_0xbd56('0xd'),'rrmemory');}}return _0x12a05a;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbd56('0x14')](0xb)},'timeout':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xbd56('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defaultValue':_0xbd56('0x16')},'autopause':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no',_0xbd56('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbd56('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xbd56('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xbd56('0x3')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xbd56('0x3')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0xbd56('0x16'),'no',_0xbd56('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xbd56('0x15')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xbd56('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbd56('0x15')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbd56('0x3')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xbd56('0x3')]},'queue_quantity1':{'type':Sequelize[_0xbd56('0x3')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xbd56('0x3')]},'queue_less_than':{'type':Sequelize[_0xbd56('0x3')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2e9f2){this[_0xbd56('0xc')](_0xbd56('0x19'),_0x2e9f2?_0x2e9f2[_0xbd56('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xbd56('0x19'))?this['getDataValue'](_0xbd56('0x19'))[_0xbd56('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':_0xbd56('0x16'),'set':function(_0x3a7861){this['setDataValue'](_0xbd56('0x1c'),_0x3a7861?_0x3a7861[_0xbd56('0x1a')](','):undefined);},'get':function(){return this[_0xbd56('0xe')](_0xbd56('0x1c'))?this[_0xbd56('0xe')](_0xbd56('0x1c'))[_0xbd56('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':'no','set':function(_0x184826){this[_0xbd56('0xc')](_0xbd56('0x1d'),_0x184826?_0x184826[_0xbd56('0x1a')](','):undefined);},'get':function(){return this[_0xbd56('0xe')]('leavewhenempty')?this[_0xbd56('0xe')](_0xbd56('0x1d'))[_0xbd56('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xbd56('0x3')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':0x0,'set':function(_0x273aa8){this[_0xbd56('0xc')]('acw',_0x273aa8);if(_0x273aa8){if(this[_0xbd56('0xe')](_0xbd56('0x1f'))<0x2){this[_0xbd56('0xc')](_0xbd56('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':0x0,'comment':_0xbd56('0x20')},'dialMethod':{'type':Sequelize[_0xbd56('0x15')]('preview',_0xbd56('0x21'),_0xbd56('0x22'),_0xbd56('0x23'),_0xbd56('0x24')),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xbd56('0x14')](0x4)[_0xbd56('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbd56('0x26')},'dialLimitQueue':{'type':Sequelize[_0xbd56('0x14')](0x4)[_0xbd56('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbd56('0x27')},'dialPowerLevel':{'type':Sequelize[_0xbd56('0x28')](0x2)[_0xbd56('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbd56('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x2a'),_0xbd56('0x2b')),'defaultValue':_0xbd56('0x2b'),'comment':_0xbd56('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbd56('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xbd56('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbd56('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xbd56('0x2e'),'comment':_0xbd56('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x30')},'dialQueueProject':{'type':Sequelize[_0xbd56('0x3')],'comment':_0xbd56('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':_0xbd56('0x36')},'dialPrefix':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbd56('0x15')]('always','never',_0xbd56('0x37')),'defaultValue':_0xbd56('0x38')},'dialAMDActive':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xbd56('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xbd56('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbd56('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbd56('0x14')](0x9)[_0xbd56('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbd56('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbd56('0x14')](0x9)[_0xbd56('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xbd56('0x14')](0x9)[_0xbd56('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xbd56('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbd56('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbd56('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbd56('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xbd56('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':0x0,'comment':_0xbd56('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xbd56('0x3e'),_0xbd56('0x3f')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xbd56('0x3')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbd56('0x40')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xbd56('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x41')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd56('0x14')],'allowNull':!![],'comment':_0xbd56('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':![],'comment':_0xbd56('0x4b'),'set':function(_0x57b350){if(!_0x57b350)this[_0xbd56('0xc')](_0xbd56('0x4c'),null);this[_0xbd56('0xc')](_0xbd56('0x4d'),_0x57b350);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xbd56('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xbd56('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xbd56('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index a2c6ec4..c885cf7 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 _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 +var _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x2654d5,_0x460860){var _0x390e2d=function(_0x15838b){while(--_0x15838b){_0x2654d5['push'](_0x2654d5['shift']());}};_0x390e2d(++_0x460860);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index b95eac6..92452cf 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 _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 +var _0xdfc9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','VoiceQueue'];(function(_0x528e34,_0x49857e){var _0x6a2744=function(_0x437f40){while(--_0x437f40){_0x528e34['push'](_0x528e34['shift']());}};_0x6a2744(++_0x49857e);}(_0xdfc9,0x11e));var _0x9dfc=function(_0x3c0c96,_0x449674){_0x3c0c96=_0x3c0c96-0x0;var _0x1780ec=_0xdfc9[_0x3c0c96];return _0x1780ec;};'use strict';var EventEmitter=require(_0x9dfc('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x9dfc('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9dfc('0x2')](0x0);var events={'afterCreate':_0x9dfc('0x3'),'afterUpdate':_0x9dfc('0x4'),'afterDestroy':_0x9dfc('0x5')};function emitEvent(_0x41621e){return function(_0x24e621,_0x1f8d1e,_0xd47d59){VoiceQueueEvents[_0x9dfc('0x6')](_0x41621e+':'+_0x24e621['id'],_0x24e621);VoiceQueueEvents[_0x9dfc('0x6')](_0x41621e,_0x24e621);_0xd47d59(null);};}for(var e in events){if(events[_0x9dfc('0x7')](e)){var event=events[e];VoiceQueue[_0x9dfc('0x8')](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 7be20d9..11af60a 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(_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 +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0xc0b1b,_0x397cd5){var _0x3d50bc=function(_0x414790){while(--_0x414790){_0xc0b1b['push'](_0xc0b1b['shift']());}};_0x3d50bc(++_0x397cd5);}(_0x34e8,0x12c));var _0x834e=function(_0x4fcaea,_0x4d89d9){_0x4fcaea=_0x4fcaea-0x0;var _0xebdf59=_0x34e8[_0x4fcaea];return _0xebdf59;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index c166a26..cf8c27c 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 _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 +var _0x1ae6=['model','attributes','map','VoiceQueue','raw','ShowVoiceQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueue','findAll','options','where','limit','include'];(function(_0x45d972,_0x26d63f){var _0x29da5c=function(_0x531fab){while(--_0x531fab){_0x45d972['push'](_0x45d972['shift']());}};_0x29da5c(++_0x26d63f);}(_0x1ae6,0x1e7));var _0x61ae=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x1ae6[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x61ae('0x0'));var util=require(_0x61ae('0x1'));var moment=require(_0x61ae('0x2'));var BPromise=require('bluebird');var rs=require(_0x61ae('0x3'));var fs=require('fs');var Redis=require(_0x61ae('0x4'));var db=require(_0x61ae('0x5'))['db'];var utils=require(_0x61ae('0x6'));var logger=require(_0x61ae('0x7'))(_0x61ae('0x8'));var config=require(_0x61ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x61ae('0xa')][_0x61ae('0xb')]({'port':0x232a});config[_0x61ae('0xc')]=_[_0x61ae('0xd')](config[_0x61ae('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61ae('0xc')]));require(_0x61ae('0xe'))['register'](socket);function respondWithRpcPromise(_0x422197,_0x5b81e6,_0x52988a){return new BPromise(function(_0x4f64d1,_0x42b5d5){return client['request'](_0x422197,_0x52988a)[_0x61ae('0xf')](function(_0x3cd65c){logger[_0x61ae('0x10')](_0x61ae('0x11'),_0x5b81e6,_0x61ae('0x12'));logger[_0x61ae('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5b81e6,_0x61ae('0x12'),JSON[_0x61ae('0x14')](_0x3cd65c));if(_0x3cd65c['error']){if(_0x3cd65c['error']['code']===0x1f4){logger[_0x61ae('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x5b81e6,_0x3cd65c[_0x61ae('0x15')]['message']);return _0x42b5d5(_0x3cd65c['error'][_0x61ae('0x16')]);}logger[_0x61ae('0x15')](_0x61ae('0x11'),_0x5b81e6,_0x3cd65c['error'][_0x61ae('0x16')]);return _0x4f64d1(_0x3cd65c[_0x61ae('0x15')][_0x61ae('0x16')]);}else{logger[_0x61ae('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x5b81e6,'request\x20sent');_0x4f64d1(_0x3cd65c[_0x61ae('0x17')]['message']);}})[_0x61ae('0x18')](function(_0x3fbf98){logger['error'](_0x61ae('0x11'),_0x5b81e6,_0x3fbf98);_0x42b5d5(_0x3fbf98);});});}exports[_0x61ae('0x19')]=function(_0x4c97ec){var _0x397d57=this;return new Promise(function(_0x1c94da,_0x38a0db){return db['VoiceQueue'][_0x61ae('0x1a')]({'raw':_0x4c97ec[_0x61ae('0x1b')]?_0x4c97ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c97ec[_0x61ae('0x1b')]?_0x4c97ec[_0x61ae('0x1b')][_0x61ae('0x1c')]||null:null,'attributes':_0x4c97ec[_0x61ae('0x1b')]?_0x4c97ec[_0x61ae('0x1b')]['attributes']||null:null,'limit':_0x4c97ec[_0x61ae('0x1b')]?_0x4c97ec[_0x61ae('0x1b')][_0x61ae('0x1d')]||null:null,'include':_0x4c97ec[_0x61ae('0x1b')]?_0x4c97ec['options']['include']?_['map'](_0x4c97ec[_0x61ae('0x1b')][_0x61ae('0x1e')],function(_0x7558e8){return{'model':db[_0x7558e8[_0x61ae('0x1f')]],'as':_0x7558e8['as'],'attributes':_0x7558e8[_0x61ae('0x20')],'include':_0x7558e8[_0x61ae('0x1e')]?_[_0x61ae('0x21')](_0x7558e8['include'],function(_0x4d2be7){return{'model':db[_0x4d2be7[_0x61ae('0x1f')]],'as':_0x4d2be7['as'],'attributes':_0x4d2be7[_0x61ae('0x20')],'include':_0x4d2be7['include']?_['map'](_0x4d2be7[_0x61ae('0x1e')],function(_0x2aa83a){return{'model':db[_0x2aa83a[_0x61ae('0x1f')]],'as':_0x2aa83a['as'],'attributes':_0x2aa83a[_0x61ae('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xed769e){logger[_0x61ae('0x10')](_0x61ae('0x19'),_0x4c97ec);logger[_0x61ae('0x13')]('GetVoiceQueue',_0x4c97ec,JSON[_0x61ae('0x14')](_0xed769e));_0x1c94da(_0xed769e);})[_0x61ae('0x18')](function(_0x33a589){logger[_0x61ae('0x15')](_0x61ae('0x19'),_0x33a589['message'],_0x4c97ec);_0x38a0db(_0x397d57[_0x61ae('0x15')](0x1f4,_0x33a589[_0x61ae('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x16a298){var _0x47ae8a=this;return new Promise(function(_0x31ce60,_0x525201){return db[_0x61ae('0x22')]['find']({'raw':_0x16a298[_0x61ae('0x1b')]?_0x16a298[_0x61ae('0x1b')][_0x61ae('0x23')]===undefined?!![]:![]:!![],'where':_0x16a298[_0x61ae('0x1b')]?_0x16a298[_0x61ae('0x1b')][_0x61ae('0x1c')]||null:null,'attributes':_0x16a298[_0x61ae('0x1b')]?_0x16a298[_0x61ae('0x1b')]['attributes']||null:null,'include':_0x16a298['options']?_0x16a298[_0x61ae('0x1b')][_0x61ae('0x1e')]?_['map'](_0x16a298[_0x61ae('0x1b')]['include'],function(_0x115b3a){return{'model':db[_0x115b3a[_0x61ae('0x1f')]],'as':_0x115b3a['as'],'attributes':_0x115b3a[_0x61ae('0x20')],'include':_0x115b3a[_0x61ae('0x1e')]?_[_0x61ae('0x21')](_0x115b3a['include'],function(_0x509edd){return{'model':db[_0x509edd[_0x61ae('0x1f')]],'as':_0x509edd['as'],'attributes':_0x509edd[_0x61ae('0x20')],'include':_0x509edd[_0x61ae('0x1e')]?_[_0x61ae('0x21')](_0x509edd[_0x61ae('0x1e')],function(_0x375f97){return{'model':db[_0x375f97[_0x61ae('0x1f')]],'as':_0x375f97['as'],'attributes':_0x375f97[_0x61ae('0x20')]};}):[]};}):[]};}):[]:[]})[_0x61ae('0xf')](function(_0x5262b0){logger['info'](_0x61ae('0x24'),_0x16a298);logger[_0x61ae('0x13')](_0x61ae('0x24'),_0x16a298,JSON[_0x61ae('0x14')](_0x5262b0));_0x31ce60(_0x5262b0);})['catch'](function(_0x51ea6c){logger[_0x61ae('0x15')](_0x61ae('0x24'),_0x51ea6c['message'],_0x16a298);_0x525201(_0x47ae8a[_0x61ae('0x15')](0x1f4,_0x51ea6c[_0x61ae('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 988b034..2824abe 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 _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 +var _0xe4a0=['emit','removeListener','register','length','remove','update'];(function(_0x10ebe7,_0x116650){var _0xc03446=function(_0x46527c){while(--_0x46527c){_0x10ebe7['push'](_0x10ebe7['shift']());}};_0xc03446(++_0x116650);}(_0xe4a0,0x94));var _0x0e4a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe4a0[_0x3bf83f];return _0x22c4a9;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x0e4a('0x0'),_0x0e4a('0x1')];function createListener(_0x39bc32,_0x554d21){return function(_0x1d9e23){_0x554d21[_0x0e4a('0x2')](_0x39bc32,_0x1d9e23);};}function removeListener(_0x1e16ea,_0x4b15e2){return function(){VoiceQueueEvents[_0x0e4a('0x3')](_0x1e16ea,_0x4b15e2);};}exports[_0x0e4a('0x4')]=function(_0xdcb40d){for(var _0x364661=0x0,_0x21280b=events[_0x0e4a('0x5')];_0x364661<_0x21280b;_0x364661++){var _0x2b96c7=events[_0x364661];var _0x1e4eb7=createListener('voiceQueue:'+_0x2b96c7,_0xdcb40d);VoiceQueueEvents['on'](_0x2b96c7,_0x1e4eb7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 080f5ca..7d019a0 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 _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 +var _0xd762=['getVoiceQueuesReport','get','/:id','create','update','delete','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','/describe','describe'];(function(_0x337cca,_0x3508d0){var _0x5b5ece=function(_0x19d28c){while(--_0x19d28c){_0x337cca['push'](_0x337cca['shift']());}};_0x5b5ece(++_0x3508d0);}(_0xd762,0xb0));var _0x2d76=function(_0x2e1095,_0x3a7d94){_0x2e1095=_0x2e1095-0x0;var _0x3b2455=_0xd762[_0x2e1095];return _0x3b2455;};'use strict';var multer=require(_0x2d76('0x0'));var util=require('util');var path=require(_0x2d76('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2d76('0x2')]();var fs_extra=require(_0x2d76('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2d76('0x4'));var config=require(_0x2d76('0x5'));var controller=require(_0x2d76('0x6'));router['get']('/',auth[_0x2d76('0x7')](),controller[_0x2d76('0x8')]);router['get'](_0x2d76('0x9'),auth[_0x2d76('0x7')](),controller[_0x2d76('0xa')]);router['get']('/index',auth[_0x2d76('0x7')](),controller[_0x2d76('0xb')]);router[_0x2d76('0xc')](_0x2d76('0xd'),auth[_0x2d76('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2d76('0xe')]);router['put']('/:id',auth[_0x2d76('0x7')](),controller[_0x2d76('0xf')]);router[_0x2d76('0x10')](_0x2d76('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index b83f437..b5d6fe7 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 _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 +var _0x6131=['YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x50b2a9,_0xdb2afa){var _0x222205=function(_0xa62904){while(--_0xa62904){_0x50b2a9['push'](_0x50b2a9['shift']());}};_0x222205(++_0xdb2afa);}(_0x6131,0x148));var _0x1613=function(_0x1348c0,_0x7a9608){_0x1348c0=_0x1348c0-0x0;var _0x8a6441=_0x6131[_0x1348c0];return _0x8a6441;};'use strict';var Sequelize=require(_0x1613('0x0'));var moment=require(_0x1613('0x1'));module[_0x1613('0x2')]={'type':{'type':Sequelize[_0x1613('0x3')]},'uniqueid':{'type':Sequelize[_0x1613('0x3')]},'calleridnum':{'type':Sequelize[_0x1613('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1613('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x1613('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x1613('0x4')],'set':function(_0x164711){var _0x58446a=moment(_0x164711);var _0x3327c6=moment(this[_0x1613('0x5')](_0x1613('0x6')))[_0x1613('0x7')](_0x1613('0x8'));var _0x37d6ec=_0x58446a['diff'](_0x3327c6,_0x1613('0x9'));this[_0x1613('0xa')]('queuecallerleaveAt',_0x164711);this[_0x1613('0xa')](_0x1613('0xb'),_0x37d6ec||null);}},'position':{'type':Sequelize[_0x1613('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x1613('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1613('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x1613('0x3')],'comment':_0x1613('0xe')},'originalposition':{'type':Sequelize[_0x1613('0xc')]},'channel':{'type':Sequelize[_0x1613('0x3')]},'connectedlinenum':{'type':Sequelize[_0x1613('0x3')]},'connectedlinename':{'type':Sequelize[_0x1613('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1613('0x3')]},'priority':{'type':Sequelize[_0x1613('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x1613('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1613('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1613('0x3')]},'transfer':{'type':Sequelize[_0x1613('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1613('0x3')],'comment':_0x1613('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x1613('0x3')]},'disposition':{'type':Sequelize[_0x1613('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1613('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x1613('0xc')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index bba48bf..2eba4d6 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 _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 +var _0x0bc0=['defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','end','sendStatus','error','stack','name','send','VoiceQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getVoiceQueuesReport','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x22b2be,_0x4b164c){var _0x213c31=function(_0x475528){while(--_0x475528){_0x22b2be['push'](_0x22b2be['shift']());}};_0x213c31(++_0x4b164c);}(_0x0bc0,0x12c));var _0x00bc=function(_0x5cd51d,_0x20d4fa){_0x5cd51d=_0x5cd51d-0x0;var _0x444608=_0x0bc0[_0x5cd51d];return _0x444608;};'use strict';var emlformat=require(_0x00bc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x00bc('0x1'));var rp=require(_0x00bc('0x2'));var moment=require(_0x00bc('0x3'));var BPromise=require(_0x00bc('0x4'));var Mustache=require(_0x00bc('0x5'));var util=require('util');var path=require(_0x00bc('0x6'));var sox=require(_0x00bc('0x7'));var csv=require(_0x00bc('0x8'));var ejs=require(_0x00bc('0x9'));var fs=require('fs');var fs_extra=require(_0x00bc('0xa'));var _=require('lodash');var squel=require(_0x00bc('0xb'));var crypto=require('crypto');var jsforce=require(_0x00bc('0xc'));var deskjs=require(_0x00bc('0xd'));var toCsv=require(_0x00bc('0x8'));var querystring=require(_0x00bc('0xe'));var Papa=require(_0x00bc('0xf'));var Redis=require(_0x00bc('0x10'));var authService=require(_0x00bc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x00bc('0x12'));var hardwareService=require(_0x00bc('0x13'));var logger=require('../../config/logger')(_0x00bc('0x14'));var utils=require('../../config/utils');var config=require(_0x00bc('0x15'));var licenseUtil=require(_0x00bc('0x16'));var db=require(_0x00bc('0x17'))['db'];config['redis']=_[_0x00bc('0x18')](config[_0x00bc('0x19')],{'host':_0x00bc('0x1a'),'port':0x18eb});var socket=require(_0x00bc('0x1b'))(new Redis(config[_0x00bc('0x19')]));require(_0x00bc('0x1c'))[_0x00bc('0x1d')](socket);function respondWithStatusCode(_0x188222,_0x510dae){_0x510dae=_0x510dae||0xcc;return function(_0x7af412){if(_0x7af412){return _0x188222['sendStatus'](_0x510dae);}return _0x188222[_0x00bc('0x1e')](_0x510dae)['end']();};}function respondWithResult(_0x2dbfc7,_0x28e6f7){_0x28e6f7=_0x28e6f7||0xc8;return function(_0x4df949){if(_0x4df949){return _0x2dbfc7[_0x00bc('0x1e')](_0x28e6f7)['json'](_0x4df949);}};}function respondWithFilteredResult(_0x2af001,_0x340694){return function(_0x45d264){if(_0x45d264){var _0xdc82d9=typeof _0x340694[_0x00bc('0x1f')]===_0x00bc('0x20')&&typeof _0x340694['limit']===_0x00bc('0x20');var _0x26a47e=_0x45d264[_0x00bc('0x21')];var _0x14658a=_0xdc82d9?0x0:_0x340694[_0x00bc('0x1f')];var _0x30bbfe=_0xdc82d9?_0x45d264[_0x00bc('0x21')]:_0x340694[_0x00bc('0x1f')]+_0x340694[_0x00bc('0x22')];var _0x39e655;if(_0x30bbfe>=_0x26a47e){_0x30bbfe=_0x26a47e;_0x39e655=0xc8;}else{_0x39e655=0xce;}_0x2af001['status'](_0x39e655);return _0x2af001[_0x00bc('0x23')](_0x00bc('0x24'),_0x14658a+'-'+_0x30bbfe+'/'+_0x26a47e)['json'](_0x45d264);}return null;};}function patchUpdates(_0x48dc18){return function(_0x19ffeb){try{jsonpatch['apply'](_0x19ffeb,_0x48dc18,!![]);}catch(_0x1445e7){return BPromise['reject'](_0x1445e7);}return _0x19ffeb[_0x00bc('0x25')]();};}function saveUpdates(_0x19ed6e,_0x267d8c){return function(_0x1f2230){if(_0x1f2230){return _0x1f2230[_0x00bc('0x26')](_0x19ed6e)[_0x00bc('0x27')](function(_0xe50fed){return _0xe50fed;});}return null;};}function removeEntity(_0x40b008,_0x33677e){return function(_0x34206b){if(_0x34206b){return _0x34206b[_0x00bc('0x28')]()['then'](function(){_0x40b008[_0x00bc('0x1e')](0xcc)[_0x00bc('0x29')]();});}};}function handleEntityNotFound(_0x3977b4,_0x369577){return function(_0xf85119){if(!_0xf85119){_0x3977b4[_0x00bc('0x2a')](0x194);}return _0xf85119;};}function handleError(_0x4ec07f,_0x145692){_0x145692=_0x145692||0x1f4;return function(_0x282593){logger[_0x00bc('0x2b')](_0x282593[_0x00bc('0x2c')]);if(_0x282593[_0x00bc('0x2d')]){delete _0x282593[_0x00bc('0x2d')];}_0x4ec07f[_0x00bc('0x1e')](_0x145692)[_0x00bc('0x2e')](_0x282593);};}exports['index']=function(_0x389cc2,_0x23eb94){var _0x23c313={},_0x5558ce={},_0x353855={'count':0x0,'rows':[]};var _0x3aadc2=_['map'](db[_0x00bc('0x2f')][_0x00bc('0x30')],function(_0x3bd185){return{'name':_0x3bd185[_0x00bc('0x31')],'type':_0x3bd185['type'][_0x00bc('0x32')]};});_0x5558ce[_0x00bc('0x33')]=_[_0x00bc('0x34')](_0x3aadc2,_0x00bc('0x2d'));_0x5558ce[_0x00bc('0x35')]=_[_0x00bc('0x36')](_0x389cc2[_0x00bc('0x35')]);_0x5558ce[_0x00bc('0x37')]=_[_0x00bc('0x38')](_0x5558ce['model'],_0x5558ce[_0x00bc('0x35')]);_0x23c313['attributes']=_[_0x00bc('0x38')](_0x5558ce[_0x00bc('0x33')],qs['fields'](_0x389cc2[_0x00bc('0x35')][_0x00bc('0x39')]));_0x23c313[_0x00bc('0x3a')]=_0x23c313[_0x00bc('0x3a')][_0x00bc('0x3b')]?_0x23c313[_0x00bc('0x3a')]:_0x5558ce[_0x00bc('0x33')];if(!_0x389cc2[_0x00bc('0x35')][_0x00bc('0x3c')](_0x00bc('0x3d'))){_0x23c313['limit']=qs[_0x00bc('0x22')](_0x389cc2[_0x00bc('0x35')][_0x00bc('0x22')]);_0x23c313[_0x00bc('0x1f')]=qs[_0x00bc('0x1f')](_0x389cc2[_0x00bc('0x35')][_0x00bc('0x1f')]);}_0x23c313[_0x00bc('0x3e')]=qs[_0x00bc('0x3f')](_0x389cc2[_0x00bc('0x35')][_0x00bc('0x3f')]);_0x23c313[_0x00bc('0x40')]=qs['filters'](_[_0x00bc('0x41')](_0x389cc2[_0x00bc('0x35')],_0x5558ce[_0x00bc('0x37')]),_0x3aadc2);if(_0x389cc2[_0x00bc('0x35')][_0x00bc('0x42')]){_0x23c313['where']=_[_0x00bc('0x43')](_0x23c313['where'],{'$or':_[_0x00bc('0x34')](_0x3aadc2,function(_0x520a05){if(_0x520a05[_0x00bc('0x44')]!=='VIRTUAL'){var _0x199103={};_0x199103[_0x520a05[_0x00bc('0x2d')]]={'$like':'%'+_0x389cc2['query'][_0x00bc('0x42')]+'%'};return _0x199103;}})});}_0x23c313=_[_0x00bc('0x43')]({},_0x23c313,_0x389cc2[_0x00bc('0x45')]);var _0xac2020={'where':_0x23c313['where']};return db[_0x00bc('0x2f')][_0x00bc('0x21')](_0xac2020)['then'](function(_0x55c4fd){_0x353855['count']=_0x55c4fd;if(_0x389cc2[_0x00bc('0x35')][_0x00bc('0x46')]){_0x23c313[_0x00bc('0x47')]=[{'all':!![]}];}return db[_0x00bc('0x2f')][_0x00bc('0x48')](_0x23c313);})[_0x00bc('0x27')](function(_0x177c3d){_0x353855[_0x00bc('0x49')]=_0x177c3d;return _0x353855;})[_0x00bc('0x27')](respondWithFilteredResult(_0x23eb94,_0x23c313))[_0x00bc('0x4a')](handleError(_0x23eb94,null));};exports['show']=function(_0x2efb49,_0x440733){var _0x44d62f={'raw':![],'where':{'id':_0x2efb49[_0x00bc('0x4b')]['id']}},_0x3ef363={};_0x3ef363[_0x00bc('0x33')]=_[_0x00bc('0x36')](db[_0x00bc('0x2f')][_0x00bc('0x30')]);_0x3ef363[_0x00bc('0x35')]=_['keys'](_0x2efb49['query']);_0x3ef363[_0x00bc('0x37')]=_[_0x00bc('0x38')](_0x3ef363[_0x00bc('0x33')],_0x3ef363[_0x00bc('0x35')]);_0x44d62f['attributes']=_[_0x00bc('0x38')](_0x3ef363[_0x00bc('0x33')],qs[_0x00bc('0x39')](_0x2efb49[_0x00bc('0x35')][_0x00bc('0x39')]));_0x44d62f[_0x00bc('0x3a')]=_0x44d62f[_0x00bc('0x3a')][_0x00bc('0x3b')]?_0x44d62f[_0x00bc('0x3a')]:_0x3ef363[_0x00bc('0x33')];if(_0x2efb49[_0x00bc('0x35')]['includeAll']){_0x44d62f[_0x00bc('0x47')]=[{'all':!![]}];}_0x44d62f=_[_0x00bc('0x43')]({},_0x44d62f,_0x2efb49[_0x00bc('0x45')]);return db[_0x00bc('0x2f')][_0x00bc('0x4c')](_0x44d62f)[_0x00bc('0x27')](handleEntityNotFound(_0x440733,null))[_0x00bc('0x27')](respondWithResult(_0x440733,null))[_0x00bc('0x4a')](handleError(_0x440733,null));};exports[_0x00bc('0x4d')]=function(_0x3299ef,_0x2133f2){return db['VoiceQueueReport'][_0x00bc('0x4d')](_0x3299ef[_0x00bc('0x4e')],{})[_0x00bc('0x27')](respondWithResult(_0x2133f2,0xc9))['catch'](handleError(_0x2133f2,null));};exports[_0x00bc('0x26')]=function(_0xd4c079,_0x5bd7d3){if(_0xd4c079[_0x00bc('0x4e')]['id']){delete _0xd4c079['body']['id'];}return db['VoiceQueueReport'][_0x00bc('0x4c')]({'where':{'id':_0xd4c079['params']['id']}})[_0x00bc('0x27')](handleEntityNotFound(_0x5bd7d3,null))[_0x00bc('0x27')](saveUpdates(_0xd4c079[_0x00bc('0x4e')],null))[_0x00bc('0x27')](respondWithResult(_0x5bd7d3,null))['catch'](handleError(_0x5bd7d3,null));};exports[_0x00bc('0x28')]=function(_0x9d2b84,_0x59dd9b){return db[_0x00bc('0x2f')][_0x00bc('0x4c')]({'where':{'id':_0x9d2b84[_0x00bc('0x4b')]['id']}})[_0x00bc('0x27')](handleEntityNotFound(_0x59dd9b,null))['then'](removeEntity(_0x59dd9b,null))[_0x00bc('0x4a')](handleError(_0x59dd9b,null));};exports['describe']=function(_0x464728,_0x16e9f1){return db[_0x00bc('0x2f')][_0x00bc('0x4f')]()['then'](respondWithResult(_0x16e9f1,null))[_0x00bc('0x4a')](handleError(_0x16e9f1,null));};exports['getVoiceQueuesReport']=function(_0x99d9b3,_0x4f042c){var _0x47c9ff={},_0x6b8a16={},_0x146791={'count':0x0,'rows':[]};_0x6b8a16[_0x00bc('0x33')]=_[_0x00bc('0x36')](db['VoiceQueueReport'][_0x00bc('0x30')]);_0x6b8a16[_0x00bc('0x35')]=_[_0x00bc('0x36')](_0x99d9b3[_0x00bc('0x35')]);_0x6b8a16[_0x00bc('0x37')]=_[_0x00bc('0x38')](_0x6b8a16[_0x00bc('0x33')],_0x6b8a16[_0x00bc('0x35')]);_0x47c9ff[_0x00bc('0x3a')]=_[_0x00bc('0x38')](_0x6b8a16[_0x00bc('0x33')],qs[_0x00bc('0x39')](_0x99d9b3[_0x00bc('0x35')][_0x00bc('0x39')]));_0x47c9ff[_0x00bc('0x3a')]=_0x47c9ff['attributes'][_0x00bc('0x3b')]?_0x47c9ff['attributes']:_0x6b8a16['model'];if(!_0x99d9b3[_0x00bc('0x35')]['hasOwnProperty'](_0x00bc('0x3d'))){_0x47c9ff[_0x00bc('0x22')]=qs[_0x00bc('0x22')](_0x99d9b3[_0x00bc('0x35')]['limit']);_0x47c9ff[_0x00bc('0x1f')]=qs[_0x00bc('0x1f')](_0x99d9b3[_0x00bc('0x35')][_0x00bc('0x1f')]);}_0x47c9ff[_0x00bc('0x3e')]=qs[_0x00bc('0x3f')](_0x99d9b3[_0x00bc('0x35')][_0x00bc('0x3f')]);_0x47c9ff[_0x00bc('0x40')]=qs[_0x00bc('0x37')](_[_0x00bc('0x41')](_0x99d9b3[_0x00bc('0x35')],_0x6b8a16[_0x00bc('0x37')]));if(_0x99d9b3[_0x00bc('0x35')]['filter']){_0x47c9ff[_0x00bc('0x40')]=_[_0x00bc('0x43')](_0x47c9ff['where'],{'$or':_[_0x00bc('0x34')](_0x47c9ff['attributes'],function(_0x3c7297){var _0x317db7={};_0x317db7[_0x3c7297]={'$like':'%'+_0x99d9b3['query'][_0x00bc('0x42')]+'%'};return _0x317db7;})});}_0x47c9ff=_[_0x00bc('0x43')]({},_0x47c9ff,_0x99d9b3[_0x00bc('0x45')]);var _0x247fe6={'where':_0x47c9ff[_0x00bc('0x40')]};return db[_0x00bc('0x2f')][_0x00bc('0x21')](_0x247fe6)[_0x00bc('0x27')](function(_0x4e5877){_0x146791[_0x00bc('0x21')]=_0x4e5877;if(_0x99d9b3['query'][_0x00bc('0x46')]){_0x47c9ff['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x00bc('0x48')](_0x47c9ff);})[_0x00bc('0x27')](function(_0x2b743c){_0x146791[_0x00bc('0x49')]=_0x2b743c;return _0x146791;})[_0x00bc('0x27')](respondWithFilteredResult(_0x4f042c,_0x47c9ff,_0x00bc('0x50')))[_0x00bc('0x4a')](handleError(_0x4f042c,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 cc23fb1..b2c76e0 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 _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 +var _0x3a04=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','remove','emit','hook','exports'];(function(_0x44454f,_0x4bfbe8){var _0x475150=function(_0x1cde13){while(--_0x1cde13){_0x44454f['push'](_0x44454f['shift']());}};_0x475150(++_0x4bfbe8);}(_0x3a04,0xb0));var _0x43a0=function(_0x3d5e72,_0x3ab167){_0x3d5e72=_0x3d5e72-0x0;var _0x2230e4=_0x3a04[_0x3d5e72];return _0x2230e4;};'use strict';var EventEmitter=require(_0x43a0('0x0'));var VoiceQueueReport=require(_0x43a0('0x1'))['db'][_0x43a0('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x43a0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x43a0('0x4')};function emitEvent(_0x384438){return function(_0x1491fb,_0x1eb1ad,_0x2d914d){VoiceQueueReportEvents[_0x43a0('0x5')](_0x384438+':'+_0x1491fb['id'],_0x1491fb);VoiceQueueReportEvents[_0x43a0('0x5')](_0x384438,_0x1491fb);_0x2d914d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x43a0('0x6')](e,emitEvent(event));}}module[_0x43a0('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index b829d27..c8032fa 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 _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 +var _0x2375=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2375,0x141));var _0x5237=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x2375[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x5237('0x0'));var util=require('util');var logger=require(_0x5237('0x1'))(_0x5237('0x2'));var moment=require(_0x5237('0x3'));var BPromise=require(_0x5237('0x4'));var rp=require(_0x5237('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5237('0x6'));var config=require(_0x5237('0x7'));var attributes=require(_0x5237('0x8'));module[_0x5237('0x9')]=function(_0x1b3e94,_0x1691e6){return _0x1b3e94[_0x5237('0xa')](_0x5237('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x5237('0xc')]},{'fields':[_0x5237('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index af46781..97ea1ca 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 _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 +var _0x2278=['ioredis','../../config/logger','jayson/promise','client','http','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceQueueReport','options','raw','where','attributes','limit','map','include','model','then','GetVoiceQueueReport','create','body','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','util','moment','bluebird','randomstring'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x2278,0xc4));var _0x8227=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2278[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8227('0x0'));var moment=require(_0x8227('0x1'));var BPromise=require(_0x8227('0x2'));var rs=require(_0x8227('0x3'));var fs=require('fs');var Redis=require(_0x8227('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8227('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8227('0x6'));var client=jayson[_0x8227('0x7')][_0x8227('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8227('0x9'))(new Redis(config[_0x8227('0xa')]));require(_0x8227('0xb'))[_0x8227('0xc')](socket);function respondWithRpcPromise(_0xb70af2,_0x293acd,_0x5a06a7){return new BPromise(function(_0x2e53c7,_0x43d5fa){return client[_0x8227('0xd')](_0xb70af2,_0x5a06a7)['then'](function(_0x29ea07){logger[_0x8227('0xe')](_0x8227('0xf'),_0x293acd,'request\x20sent');logger[_0x8227('0x10')](_0x8227('0x11'),_0x293acd,_0x8227('0x12'),JSON[_0x8227('0x13')](_0x29ea07));if(_0x29ea07[_0x8227('0x14')]){if(_0x29ea07[_0x8227('0x14')]['code']===0x1f4){logger[_0x8227('0x14')](_0x8227('0xf'),_0x293acd,_0x29ea07[_0x8227('0x14')][_0x8227('0x15')]);return _0x43d5fa(_0x29ea07['error'][_0x8227('0x15')]);}logger[_0x8227('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x293acd,_0x29ea07[_0x8227('0x14')][_0x8227('0x15')]);return _0x2e53c7(_0x29ea07[_0x8227('0x14')][_0x8227('0x15')]);}else{logger[_0x8227('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x293acd,_0x8227('0x12'));_0x2e53c7(_0x29ea07[_0x8227('0x16')][_0x8227('0x15')]);}})[_0x8227('0x17')](function(_0x19e457){logger['error'](_0x8227('0xf'),_0x293acd,_0x19e457);_0x43d5fa(_0x19e457);});});}exports['GetVoiceQueueReport']=function(_0x6650a7){var _0x3216b3=this;return new Promise(function(_0x47d76d,_0x4283ec){return db[_0x8227('0x18')]['findAll']({'raw':_0x6650a7[_0x8227('0x19')]?_0x6650a7[_0x8227('0x19')][_0x8227('0x1a')]===undefined?!![]:![]:!![],'where':_0x6650a7['options']?_0x6650a7[_0x8227('0x19')][_0x8227('0x1b')]||null:null,'attributes':_0x6650a7[_0x8227('0x19')]?_0x6650a7[_0x8227('0x19')][_0x8227('0x1c')]||null:null,'limit':_0x6650a7[_0x8227('0x19')]?_0x6650a7[_0x8227('0x19')][_0x8227('0x1d')]||null:null,'include':_0x6650a7[_0x8227('0x19')]?_0x6650a7[_0x8227('0x19')]['include']?_[_0x8227('0x1e')](_0x6650a7[_0x8227('0x19')][_0x8227('0x1f')],function(_0x132331){return{'model':db[_0x132331[_0x8227('0x20')]],'as':_0x132331['as'],'attributes':_0x132331[_0x8227('0x1c')],'include':_0x132331[_0x8227('0x1f')]?_[_0x8227('0x1e')](_0x132331[_0x8227('0x1f')],function(_0x5ad2c4){return{'model':db[_0x5ad2c4['model']],'as':_0x5ad2c4['as'],'attributes':_0x5ad2c4[_0x8227('0x1c')],'include':_0x5ad2c4[_0x8227('0x1f')]?_[_0x8227('0x1e')](_0x5ad2c4[_0x8227('0x1f')],function(_0x22f29b){return{'model':db[_0x22f29b[_0x8227('0x20')]],'as':_0x22f29b['as'],'attributes':_0x22f29b[_0x8227('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8227('0x21')](function(_0x564032){logger['info'](_0x8227('0x22'),_0x6650a7);logger['debug'](_0x8227('0x22'),_0x6650a7,JSON['stringify'](_0x564032));_0x47d76d(_0x564032);})['catch'](function(_0x50b152){logger[_0x8227('0x14')](_0x8227('0x22'),_0x50b152['message'],_0x6650a7);_0x4283ec(_0x3216b3[_0x8227('0x14')](0x1f4,_0x50b152[_0x8227('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x1a9320){var _0x43f086=this;return new Promise(function(_0x4e28db,_0x37e380){return db[_0x8227('0x18')][_0x8227('0x23')](_0x1a9320[_0x8227('0x24')],{'raw':_0x1a9320[_0x8227('0x19')]?_0x1a9320['options'][_0x8227('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x53e714){logger[_0x8227('0xe')](_0x8227('0x25'),_0x1a9320);logger[_0x8227('0x10')](_0x8227('0x25'),_0x1a9320,JSON[_0x8227('0x13')](_0x53e714));_0x4e28db(_0x53e714);})[_0x8227('0x17')](function(_0xacfcc8){logger[_0x8227('0x14')](_0x8227('0x25'),_0xacfcc8[_0x8227('0x15')],_0x1a9320);_0x37e380(_0x43f086[_0x8227('0x14')](0x1f4,_0xacfcc8[_0x8227('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x24fe2f){var _0x74e332=this;return new Promise(function(_0x22d43a,_0x3e153d){return db['VoiceQueueReport'][_0x8227('0x26')](_0x24fe2f[_0x8227('0x24')],{'raw':_0x24fe2f[_0x8227('0x19')]?_0x24fe2f[_0x8227('0x19')][_0x8227('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24fe2f['options']?_0x24fe2f[_0x8227('0x19')][_0x8227('0x1b')]||null:null,'attributes':_0x24fe2f[_0x8227('0x19')]?_0x24fe2f[_0x8227('0x19')]['attributes']||null:null,'limit':_0x24fe2f[_0x8227('0x19')]?_0x24fe2f[_0x8227('0x19')][_0x8227('0x1d')]||null:null})[_0x8227('0x21')](function(_0x42de20){logger['info'](_0x8227('0x27'),_0x24fe2f);logger[_0x8227('0x10')](_0x8227('0x27'),_0x24fe2f,JSON[_0x8227('0x13')](_0x42de20));_0x22d43a(_0x42de20);})['catch'](function(_0x46dc50){logger[_0x8227('0x14')](_0x8227('0x27'),_0x46dc50['message'],_0x24fe2f);_0x3e153d(_0x74e332[_0x8227('0x14')](0x1f4,_0x46dc50[_0x8227('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 4f084b6..beaf7c8 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 _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 +var _0xb39f=['remove','update','emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x21f07f,_0x49fee5){var _0x26d200=function(_0x16c563){while(--_0x16c563){_0x21f07f['push'](_0x21f07f['shift']());}};_0x26d200(++_0x49fee5);}(_0xb39f,0x1e6));var _0xfb39=function(_0x1967ff,_0x38073f){_0x1967ff=_0x1967ff-0x0;var _0x56d0c4=_0xb39f[_0x1967ff];return _0x56d0c4;};'use strict';var VoiceQueueReportEvents=require(_0xfb39('0x0'));var events=[_0xfb39('0x1'),_0xfb39('0x2'),_0xfb39('0x3')];function createListener(_0x5ba2ac,_0x4bc0e0){return function(_0x588127){_0x4bc0e0[_0xfb39('0x4')](_0x5ba2ac,_0x588127);};}function removeListener(_0x50f9a1,_0x3d2ee9){return function(){VoiceQueueReportEvents[_0xfb39('0x5')](_0x50f9a1,_0x3d2ee9);};}exports['register']=function(_0x1619f6){for(var _0x455dbe=0x0,_0x45bb1c=events[_0xfb39('0x6')];_0x455dbe<_0x45bb1c;_0x455dbe++){var _0x4ce401=events[_0x455dbe];var _0x4daba2=createListener(_0xfb39('0x7')+_0x4ce401,_0x1619f6);VoiceQueueReportEvents['on'](_0x4ce401,_0x4daba2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 932f563..a280a49 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 _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 +var _0x1803=['get','show','post','create','put','/:id','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x1803,0x1be));var _0x3180=function(_0x2fcd0b,_0x590579){_0x2fcd0b=_0x2fcd0b-0x0;var _0x308934=_0x1803[_0x2fcd0b];return _0x308934;};'use strict';var multer=require('multer');var util=require(_0x3180('0x0'));var path=require('path');var timeout=require(_0x3180('0x1'));var express=require(_0x3180('0x2'));var router=express[_0x3180('0x3')]();var fs_extra=require(_0x3180('0x4'));var auth=require(_0x3180('0x5'));var interaction=require(_0x3180('0x6'));var config=require(_0x3180('0x7'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0x3180('0x8')](),controller[_0x3180('0x9')]);router[_0x3180('0xa')]('/:id',auth[_0x3180('0x8')](),controller[_0x3180('0xb')]);router[_0x3180('0xc')]('/',auth['isAuthenticated'](),controller[_0x3180('0xd')]);router[_0x3180('0xe')](_0x3180('0xf'),auth[_0x3180('0x8')](),controller['update']);router[_0x3180('0x10')](_0x3180('0xf'),auth[_0x3180('0x8')](),controller[_0x3180('0x11')]);module[_0x3180('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6d226df..2b364fd 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 _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 +var _0x8a69=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','DATE','literal'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8a69,0x135));var _0x98a6=function(_0x4ca95d,_0x4b70ea){_0x4ca95d=_0x4ca95d-0x0;var _0x1969c5=_0x8a69[_0x4ca95d];return _0x1969c5;};'use strict';var Sequelize=require(_0x98a6('0x0'));var moment=require(_0x98a6('0x1'));module[_0x98a6('0x2')]={'time':{'type':Sequelize[_0x98a6('0x3')]},'callid':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x98a6('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x98a6('0x5')](_0x98a6('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a4d50bb..8ae73ac 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 _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 +var _0x063a=['desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','count','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','VoiceQueuesLog','findAll','rows','catch','show','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x20f4d7,_0x29a502){var _0x630d61=function(_0x24cc2c){while(--_0x24cc2c){_0x20f4d7['push'](_0x20f4d7['shift']());}};_0x630d61(++_0x29a502);}(_0x063a,0x166));var _0xa063=function(_0x302a58,_0x38f769){_0x302a58=_0x302a58-0x0;var _0x47a76b=_0x063a[_0x302a58];return _0x47a76b;};'use strict';var emlformat=require(_0xa063('0x0'));var rimraf=require(_0xa063('0x1'));var zipdir=require(_0xa063('0x2'));var jsonpatch=require(_0xa063('0x3'));var rp=require(_0xa063('0x4'));var moment=require(_0xa063('0x5'));var BPromise=require(_0xa063('0x6'));var Mustache=require(_0xa063('0x7'));var util=require(_0xa063('0x8'));var path=require(_0xa063('0x9'));var sox=require(_0xa063('0xa'));var csv=require(_0xa063('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa063('0xc'));var _=require(_0xa063('0xd'));var squel=require(_0xa063('0xe'));var crypto=require(_0xa063('0xf'));var jsforce=require(_0xa063('0x10'));var deskjs=require(_0xa063('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa063('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa063('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa063('0x14'));var hardwareService=require(_0xa063('0x15'));var logger=require('../../config/logger')(_0xa063('0x16'));var utils=require(_0xa063('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa063('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a98fc,_0x2574ab){_0x2574ab=_0x2574ab||0xcc;return function(_0x1495a1){if(_0x1495a1){return _0x4a98fc[_0xa063('0x19')](_0x2574ab);}return _0x4a98fc[_0xa063('0x1a')](_0x2574ab)['end']();};}function respondWithResult(_0x1c7bb2,_0x2d67f0){_0x2d67f0=_0x2d67f0||0xc8;return function(_0x8458d7){if(_0x8458d7){return _0x1c7bb2['status'](_0x2d67f0)[_0xa063('0x1b')](_0x8458d7);}};}function respondWithFilteredResult(_0xc21136,_0x2d3fd5){return function(_0x1fab42){if(_0x1fab42){var _0x31d0cf=typeof _0x2d3fd5[_0xa063('0x1c')]==='undefined'&&typeof _0x2d3fd5['limit']==='undefined';var _0x5ab2dd=_0x1fab42[_0xa063('0x1d')];var _0x33b05f=_0x31d0cf?0x0:_0x2d3fd5[_0xa063('0x1c')];var _0x5bf9ea=_0x31d0cf?_0x1fab42['count']:_0x2d3fd5[_0xa063('0x1c')]+_0x2d3fd5[_0xa063('0x1e')];var _0x548a19;if(_0x5bf9ea>=_0x5ab2dd){_0x5bf9ea=_0x5ab2dd;_0x548a19=0xc8;}else{_0x548a19=0xce;}_0xc21136[_0xa063('0x1a')](_0x548a19);return _0xc21136['set'](_0xa063('0x1f'),_0x33b05f+'-'+_0x5bf9ea+'/'+_0x5ab2dd)[_0xa063('0x1b')](_0x1fab42);}return null;};}function patchUpdates(_0x4681cf){return function(_0x3dae9c){try{jsonpatch[_0xa063('0x20')](_0x3dae9c,_0x4681cf,!![]);}catch(_0x2c702f){return BPromise[_0xa063('0x21')](_0x2c702f);}return _0x3dae9c['save']();};}function saveUpdates(_0x12de6d,_0x45dc2f){return function(_0x294ecd){if(_0x294ecd){return _0x294ecd[_0xa063('0x22')](_0x12de6d)[_0xa063('0x23')](function(_0x5a238f){return _0x5a238f;});}return null;};}function removeEntity(_0x1500e6,_0x35bb87){return function(_0x2c1c80){if(_0x2c1c80){return _0x2c1c80[_0xa063('0x24')]()[_0xa063('0x23')](function(){_0x1500e6[_0xa063('0x1a')](0xcc)[_0xa063('0x25')]();});}};}function handleEntityNotFound(_0x3b6fee,_0x18f3b0){return function(_0x5dd627){if(!_0x5dd627){_0x3b6fee[_0xa063('0x19')](0x194);}return _0x5dd627;};}function handleError(_0x17be87,_0x2cace5){_0x2cace5=_0x2cace5||0x1f4;return function(_0x145196){logger[_0xa063('0x26')](_0x145196[_0xa063('0x27')]);if(_0x145196[_0xa063('0x28')]){delete _0x145196['name'];}_0x17be87[_0xa063('0x1a')](_0x2cace5)[_0xa063('0x29')](_0x145196);};}exports[_0xa063('0x2a')]=function(_0x2af706,_0x4e6816){var _0x31f625={},_0x2868f7={},_0x444911={'count':0x0,'rows':[]};var _0x5780bf=_[_0xa063('0x2b')](db['VoiceQueuesLog'][_0xa063('0x2c')],function(_0x540c21){return{'name':_0x540c21[_0xa063('0x2d')],'type':_0x540c21[_0xa063('0x2e')][_0xa063('0x2f')]};});_0x2868f7[_0xa063('0x30')]=_['map'](_0x5780bf,_0xa063('0x28'));_0x2868f7[_0xa063('0x31')]=_[_0xa063('0x32')](_0x2af706[_0xa063('0x31')]);_0x2868f7[_0xa063('0x33')]=_[_0xa063('0x34')](_0x2868f7[_0xa063('0x30')],_0x2868f7['query']);_0x31f625[_0xa063('0x35')]=_[_0xa063('0x34')](_0x2868f7[_0xa063('0x30')],qs[_0xa063('0x36')](_0x2af706[_0xa063('0x31')]['fields']));_0x31f625['attributes']=_0x31f625['attributes'][_0xa063('0x37')]?_0x31f625[_0xa063('0x35')]:_0x2868f7[_0xa063('0x30')];if(!_0x2af706['query'][_0xa063('0x38')](_0xa063('0x39'))){_0x31f625[_0xa063('0x1e')]=qs[_0xa063('0x1e')](_0x2af706['query'][_0xa063('0x1e')]);_0x31f625[_0xa063('0x1c')]=qs[_0xa063('0x1c')](_0x2af706[_0xa063('0x31')]['offset']);}_0x31f625['order']=qs[_0xa063('0x3a')](_0x2af706[_0xa063('0x31')][_0xa063('0x3a')]);_0x31f625[_0xa063('0x3b')]=qs['filters'](_[_0xa063('0x3c')](_0x2af706[_0xa063('0x31')],_0x2868f7[_0xa063('0x33')]),_0x5780bf);if(_0x2af706['query']['filter']){_0x31f625[_0xa063('0x3b')]=_['merge'](_0x31f625[_0xa063('0x3b')],{'$or':_[_0xa063('0x2b')](_0x5780bf,function(_0x956850){if(_0x956850['type']!==_0xa063('0x3d')){var _0x28a6a8={};_0x28a6a8[_0x956850[_0xa063('0x28')]]={'$like':'%'+_0x2af706[_0xa063('0x31')][_0xa063('0x3e')]+'%'};return _0x28a6a8;}})});}_0x31f625=_[_0xa063('0x3f')]({},_0x31f625,_0x2af706['options']);var _0x34977d={'where':_0x31f625[_0xa063('0x3b')]};return db[_0xa063('0x40')]['count'](_0x34977d)[_0xa063('0x23')](function(_0x3ddb3a){_0x444911[_0xa063('0x1d')]=_0x3ddb3a;if(_0x2af706[_0xa063('0x31')]['includeAll']){_0x31f625['include']=[{'all':!![]}];}return db[_0xa063('0x40')][_0xa063('0x41')](_0x31f625);})['then'](function(_0x429cef){_0x444911[_0xa063('0x42')]=_0x429cef;return _0x444911;})['then'](respondWithFilteredResult(_0x4e6816,_0x31f625))[_0xa063('0x43')](handleError(_0x4e6816,null));};exports[_0xa063('0x44')]=function(_0x2c246d,_0x10fb0e){var _0x5e0626={'raw':!![],'where':{'id':_0x2c246d['params']['id']}},_0x1c723c={};_0x1c723c[_0xa063('0x30')]=_[_0xa063('0x32')](db[_0xa063('0x40')][_0xa063('0x2c')]);_0x1c723c['query']=_[_0xa063('0x32')](_0x2c246d[_0xa063('0x31')]);_0x1c723c['filters']=_[_0xa063('0x34')](_0x1c723c[_0xa063('0x30')],_0x1c723c[_0xa063('0x31')]);_0x5e0626['attributes']=_[_0xa063('0x34')](_0x1c723c[_0xa063('0x30')],qs['fields'](_0x2c246d[_0xa063('0x31')][_0xa063('0x36')]));_0x5e0626[_0xa063('0x35')]=_0x5e0626[_0xa063('0x35')][_0xa063('0x37')]?_0x5e0626[_0xa063('0x35')]:_0x1c723c[_0xa063('0x30')];if(_0x2c246d[_0xa063('0x31')][_0xa063('0x45')]){_0x5e0626['include']=[{'all':!![]}];}_0x5e0626=_['merge']({},_0x5e0626,_0x2c246d[_0xa063('0x46')]);return db[_0xa063('0x40')][_0xa063('0x47')](_0x5e0626)['then'](handleEntityNotFound(_0x10fb0e,null))[_0xa063('0x23')](respondWithResult(_0x10fb0e,null))[_0xa063('0x43')](handleError(_0x10fb0e,null));};exports[_0xa063('0x48')]=function(_0x3306d2,_0x2a11e7){return db['VoiceQueuesLog'][_0xa063('0x48')](_0x3306d2[_0xa063('0x49')],{})[_0xa063('0x23')](respondWithResult(_0x2a11e7,0xc9))[_0xa063('0x43')](handleError(_0x2a11e7,null));};exports[_0xa063('0x22')]=function(_0x1d1b8b,_0x128ec4){if(_0x1d1b8b['body']['id']){delete _0x1d1b8b['body']['id'];}return db[_0xa063('0x40')][_0xa063('0x47')]({'where':{'id':_0x1d1b8b[_0xa063('0x4a')]['id']}})[_0xa063('0x23')](handleEntityNotFound(_0x128ec4,null))[_0xa063('0x23')](saveUpdates(_0x1d1b8b['body'],null))[_0xa063('0x23')](respondWithResult(_0x128ec4,null))[_0xa063('0x43')](handleError(_0x128ec4,null));};exports[_0xa063('0x24')]=function(_0x1041b6,_0x206244){return db[_0xa063('0x40')]['find']({'where':{'id':_0x1041b6['params']['id']}})['then'](handleEntityNotFound(_0x206244,null))[_0xa063('0x23')](removeEntity(_0x206244,null))[_0xa063('0x43')](handleError(_0x206244,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c3e0519..b36f0a0 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 _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 +var _0xad7f=['dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueuesLog','event_dtm','event'];(function(_0x3803e7,_0x2b477c){var _0x1f6ca9=function(_0x564420){while(--_0x564420){_0x3803e7['push'](_0x3803e7['shift']());}};_0x1f6ca9(++_0x2b477c);}(_0xad7f,0x1a5));var _0xfad7=function(_0x380356,_0x44304f){_0x380356=_0x380356-0x0;var _0x542fb4=_0xad7f[_0x380356];return _0x542fb4;};'use strict';var _=require(_0xfad7('0x0'));var util=require(_0xfad7('0x1'));var logger=require(_0xfad7('0x2'))(_0xfad7('0x3'));var moment=require(_0xfad7('0x4'));var BPromise=require(_0xfad7('0x5'));var rp=require(_0xfad7('0x6'));var fs=require('fs');var path=require(_0xfad7('0x7'));var rimraf=require(_0xfad7('0x8'));var config=require(_0xfad7('0x9'));var attributes=require('./voiceQueuesLog.attributes');module[_0xfad7('0xa')]=function(_0x5b067d,_0x57774f){return _0x5b067d['define'](_0xfad7('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xfad7('0xc'),'fields':[_0xfad7('0xd'),_0xfad7('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 acf0f66..c744b6d 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 _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 +var _0x0e12=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x5dbef,_0x46fd96){var _0x234c9f=function(_0x4dde67){while(--_0x4dde67){_0x5dbef['push'](_0x5dbef['shift']());}};_0x234c9f(++_0x46fd96);}(_0x0e12,0x180));var _0x20e1=function(_0x3d8ca8,_0x1a9764){_0x3d8ca8=_0x3d8ca8-0x0;var _0x517e45=_0x0e12[_0x3d8ca8];return _0x517e45;};'use strict';var _=require(_0x20e1('0x0'));var util=require(_0x20e1('0x1'));var moment=require(_0x20e1('0x2'));var BPromise=require(_0x20e1('0x3'));var rs=require(_0x20e1('0x4'));var fs=require('fs');var Redis=require(_0x20e1('0x5'));var db=require(_0x20e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x20e1('0x7'))(_0x20e1('0x8'));var config=require(_0x20e1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x20e1('0xa')][_0x20e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51499b,_0x33efe6,_0x47eb0a){return new BPromise(function(_0x2b7184,_0x47a077){return client[_0x20e1('0xc')](_0x51499b,_0x47eb0a)[_0x20e1('0xd')](function(_0x4e9e99){logger[_0x20e1('0xe')](_0x20e1('0xf'),_0x33efe6,_0x20e1('0x10'));logger[_0x20e1('0x11')](_0x20e1('0x12'),_0x33efe6,_0x20e1('0x10'),JSON[_0x20e1('0x13')](_0x4e9e99));if(_0x4e9e99[_0x20e1('0x14')]){if(_0x4e9e99[_0x20e1('0x14')]['code']===0x1f4){logger[_0x20e1('0x14')](_0x20e1('0xf'),_0x33efe6,_0x4e9e99['error']['message']);return _0x47a077(_0x4e9e99[_0x20e1('0x14')][_0x20e1('0x15')]);}logger[_0x20e1('0x14')](_0x20e1('0xf'),_0x33efe6,_0x4e9e99[_0x20e1('0x14')][_0x20e1('0x15')]);return _0x2b7184(_0x4e9e99[_0x20e1('0x14')][_0x20e1('0x15')]);}else{logger['info'](_0x20e1('0xf'),_0x33efe6,_0x20e1('0x10'));_0x2b7184(_0x4e9e99[_0x20e1('0x16')][_0x20e1('0x15')]);}})[_0x20e1('0x17')](function(_0x5ae8dd){logger[_0x20e1('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x33efe6,_0x5ae8dd);_0x47a077(_0x5ae8dd);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index a493950..b6fc35d 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 _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 +var _0x764b=['describe','/:id','show','download','downloads','post','create','/:id/transcribe','runTranscribe','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe'];(function(_0x579374,_0x4135bc){var _0x2c4d41=function(_0x42a26d){while(--_0x42a26d){_0x579374['push'](_0x579374['shift']());}};_0x2c4d41(++_0x4135bc);}(_0x764b,0x84));var _0xb764=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x764b[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xb764('0x0'));var util=require(_0xb764('0x1'));var path=require(_0xb764('0x2'));var timeout=require(_0xb764('0x3'));var express=require(_0xb764('0x4'));var router=express['Router']();var fs_extra=require(_0xb764('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb764('0x6'));var config=require(_0xb764('0x7'));var controller=require(_0xb764('0x8'));router[_0xb764('0x9')]('/',auth[_0xb764('0xa')](),controller['index']);router[_0xb764('0x9')](_0xb764('0xb'),auth[_0xb764('0xa')](),controller[_0xb764('0xc')]);router[_0xb764('0x9')](_0xb764('0xd'),auth[_0xb764('0xa')](),controller[_0xb764('0xe')]);router[_0xb764('0x9')]('/:id/download',auth[_0xb764('0xa')](),controller[_0xb764('0xf')]);router[_0xb764('0x9')]('/:id/downloads',controller[_0xb764('0x10')]);router[_0xb764('0x9')]('/:id/transcribe',auth[_0xb764('0xa')](),controller['downloadTranscribe']);router[_0xb764('0x11')]('/',auth[_0xb764('0xa')](),controller[_0xb764('0x12')]);router['post'](_0xb764('0x13'),auth[_0xb764('0xa')](),controller[_0xb764('0x14')]);router['put'](_0xb764('0xd'),auth[_0xb764('0xa')](),controller[_0xb764('0x15')]);router[_0xb764('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb764('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e512160..166c175 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(_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 +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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 d3c5374..564bb30 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 _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 +var _0xed0d=['uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','map','VoiceRecording','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','decryptFile','secrets','recording','existsSync','ValidationError','filename','extname','unlink','message','send','downloads','sequelize','col','token','$and','push','Sequelize','VoiceRecording\x20not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','aws-sdk'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xed0d,0x87));var _0xded0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed0d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xded0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xded0('0x1'));var jsonpatch=require(_0xded0('0x2'));var rp=require(_0xded0('0x3'));var moment=require(_0xded0('0x4'));var BPromise=require(_0xded0('0x5'));var Mustache=require(_0xded0('0x6'));var util=require('util');var path=require(_0xded0('0x7'));var sox=require('sox');var csv=require(_0xded0('0x8'));var ejs=require(_0xded0('0x9'));var fs=require('fs');var fs_extra=require(_0xded0('0xa'));var _=require(_0xded0('0xb'));var squel=require('squel');var crypto=require(_0xded0('0xc'));var jsforce=require(_0xded0('0xd'));var deskjs=require(_0xded0('0xe'));var toCsv=require(_0xded0('0x8'));var querystring=require('querystring');var Papa=require(_0xded0('0xf'));var AWS=require(_0xded0('0x10'));var uuidv4=require(_0xded0('0x11'));var Redis=require('ioredis');var authService=require(_0xded0('0x12'));var qs=require(_0xded0('0x13'));var as=require(_0xded0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xded0('0x15'))(_0xded0('0x16'));var utils=require('../../config/utils');var config=require(_0xded0('0x17'));var licenseUtil=require(_0xded0('0x18'));var db=require(_0xded0('0x19'))['db'];function respondWithStatusCode(_0x10b1ed,_0x2ab7d5){_0x2ab7d5=_0x2ab7d5||0xcc;return function(_0x53f1ff){if(_0x53f1ff){return _0x10b1ed['sendStatus'](_0x2ab7d5);}return _0x10b1ed[_0xded0('0x1a')](_0x2ab7d5)[_0xded0('0x1b')]();};}function respondWithResult(_0x1d0399,_0x525f80){_0x525f80=_0x525f80||0xc8;return function(_0x416e4a){if(_0x416e4a){return _0x1d0399[_0xded0('0x1a')](_0x525f80)[_0xded0('0x1c')](_0x416e4a);}};}function respondWithFilteredResult(_0x20ac74,_0x53be51){return function(_0x1d6e01){if(_0x1d6e01){var _0x3c6dd1=typeof _0x53be51['offset']===_0xded0('0x1d')&&typeof _0x53be51[_0xded0('0x1e')]==='undefined';var _0xf6ee5a=_0x1d6e01[_0xded0('0x1f')];var _0x4aa5cb=_0x3c6dd1?0x0:_0x53be51[_0xded0('0x20')];var _0x370ab4=_0x3c6dd1?_0x1d6e01[_0xded0('0x1f')]:_0x53be51['offset']+_0x53be51[_0xded0('0x1e')];var _0x12dc9f;if(_0x370ab4>=_0xf6ee5a){_0x370ab4=_0xf6ee5a;_0x12dc9f=0xc8;}else{_0x12dc9f=0xce;}_0x20ac74[_0xded0('0x1a')](_0x12dc9f);return _0x20ac74[_0xded0('0x21')](_0xded0('0x22'),_0x4aa5cb+'-'+_0x370ab4+'/'+_0xf6ee5a)[_0xded0('0x1c')](_0x1d6e01);}return null;};}function patchUpdates(_0x1bf578){return function(_0x5efcd9){try{jsonpatch[_0xded0('0x23')](_0x5efcd9,_0x1bf578,!![]);}catch(_0x27c7a0){return BPromise[_0xded0('0x24')](_0x27c7a0);}return _0x5efcd9[_0xded0('0x25')]();};}function saveUpdates(_0x258086,_0x363c2f){return function(_0x3561a8){if(_0x3561a8){return _0x3561a8[_0xded0('0x26')](_0x258086)['then'](function(_0x294d3a){return _0x294d3a;});}return null;};}function removeEntity(_0x252ee1,_0x1f8cbc){return function(_0x5f4bad){if(_0x5f4bad){return _0x5f4bad[_0xded0('0x27')]()[_0xded0('0x28')](function(){_0x252ee1['status'](0xcc)[_0xded0('0x1b')]();});}};}function handleEntityNotFound(_0x25fd42,_0x59b2c6){return function(_0x412e37){if(!_0x412e37){_0x25fd42['sendStatus'](0x194);}return _0x412e37;};}function handleError(_0x570696,_0x3a5053){_0x3a5053=_0x3a5053||0x1f4;return function(_0x12272d){logger[_0xded0('0x29')](_0x12272d['stack']);if(_0x12272d['name']){delete _0x12272d[_0xded0('0x2a')];}_0x570696[_0xded0('0x1a')](_0x3a5053)['send'](_0x12272d);};}exports[_0xded0('0x2b')]=function(_0x5d658b,_0x43ea4b){var _0x13e428={},_0x2d5227={},_0x591f73={'count':0x0,'rows':[]};var _0x46c9d5=_[_0xded0('0x2c')](db[_0xded0('0x2d')][_0xded0('0x2e')],function(_0x75162e){return{'name':_0x75162e[_0xded0('0x2f')],'type':_0x75162e[_0xded0('0x30')]['key']};});_0x2d5227[_0xded0('0x31')]=_['differenceBy'](_[_0xded0('0x2c')](_0x46c9d5,_0xded0('0x2a')),['format']);_0x2d5227[_0xded0('0x32')]=_[_0xded0('0x33')](_0x5d658b[_0xded0('0x32')]);_0x2d5227[_0xded0('0x34')]=_[_0xded0('0x35')](_0x2d5227[_0xded0('0x31')],_0x2d5227['query']);_0x13e428['attributes']=_[_0xded0('0x35')](_0x2d5227[_0xded0('0x31')],qs[_0xded0('0x36')](_0x5d658b[_0xded0('0x32')][_0xded0('0x36')]));_0x13e428[_0xded0('0x37')]=_0x13e428[_0xded0('0x37')][_0xded0('0x38')]?_0x13e428[_0xded0('0x37')]:_0x2d5227[_0xded0('0x31')];if(!_0x5d658b[_0xded0('0x32')][_0xded0('0x39')](_0xded0('0x3a'))){_0x13e428[_0xded0('0x1e')]=qs[_0xded0('0x1e')](_0x5d658b['query'][_0xded0('0x1e')]);_0x13e428[_0xded0('0x20')]=qs[_0xded0('0x20')](_0x5d658b[_0xded0('0x32')][_0xded0('0x20')]);}_0x13e428[_0xded0('0x3b')]=qs[_0xded0('0x3c')](_0x5d658b[_0xded0('0x32')][_0xded0('0x3c')]);_0x13e428[_0xded0('0x3d')]=qs[_0xded0('0x34')](_[_0xded0('0x3e')](_0x5d658b[_0xded0('0x32')],_0x2d5227[_0xded0('0x34')]),_0x46c9d5);if(_0x5d658b[_0xded0('0x32')][_0xded0('0x3f')]){_0x13e428[_0xded0('0x3d')]=_['merge'](_0x13e428['where'],{'$or':_['map'](_0x46c9d5,function(_0x28fea1){if(_0x28fea1[_0xded0('0x30')]!==_0xded0('0x40')){var _0x3da105={};_0x3da105[_0x28fea1['name']]={'$like':'%'+_0x5d658b['query']['filter']+'%'};return _0x3da105;}})});}_0x13e428=_[_0xded0('0x41')]({},_0x13e428,_0x5d658b[_0xded0('0x42')]);var _0x58efe1={'where':_0x13e428[_0xded0('0x3d')]};return db['VoiceRecording'][_0xded0('0x1f')](_0x58efe1)['then'](function(_0x5ebe7c){_0x591f73[_0xded0('0x1f')]=_0x5ebe7c;if(_0x5d658b[_0xded0('0x32')][_0xded0('0x43')]){_0x13e428[_0xded0('0x44')]=[{'all':!![]}];}return db[_0xded0('0x2d')]['findAll'](_0x13e428);})[_0xded0('0x28')](function(_0x45ea58){_0x591f73['rows']=_0x45ea58;return _0x591f73;})['then'](respondWithFilteredResult(_0x43ea4b,_0x13e428))[_0xded0('0x45')](handleError(_0x43ea4b,null));};exports[_0xded0('0x46')]=function(_0x12c00e,_0x3e1817){var _0x52f0b3={'raw':![],'where':{'id':_0x12c00e[_0xded0('0x47')]['id']}},_0x24a36a={};_0x24a36a[_0xded0('0x31')]=_[_0xded0('0x33')](db['VoiceRecording'][_0xded0('0x2e')]);_0x24a36a[_0xded0('0x32')]=_['keys'](_0x12c00e[_0xded0('0x32')]);_0x24a36a[_0xded0('0x34')]=_[_0xded0('0x35')](_0x24a36a['model'],_0x24a36a['query']);_0x52f0b3[_0xded0('0x37')]=_['intersection'](_0x24a36a[_0xded0('0x31')],qs[_0xded0('0x36')](_0x12c00e['query']['fields']));_0x52f0b3[_0xded0('0x37')]=_0x52f0b3['attributes']['length']?_0x52f0b3[_0xded0('0x37')]:_0x24a36a[_0xded0('0x31')];if(_0x12c00e[_0xded0('0x32')][_0xded0('0x43')]){_0x52f0b3['include']=[{'all':!![]}];}_0x52f0b3=_[_0xded0('0x41')]({},_0x52f0b3,_0x12c00e[_0xded0('0x42')]);return db[_0xded0('0x2d')]['find'](_0x52f0b3)[_0xded0('0x28')](handleEntityNotFound(_0x3e1817,null))[_0xded0('0x28')](respondWithResult(_0x3e1817,null))[_0xded0('0x45')](handleError(_0x3e1817,null));};exports[_0xded0('0x48')]=function(_0x4b4743,_0x1efda6){return db['VoiceRecording'][_0xded0('0x48')](_0x4b4743[_0xded0('0x49')],{})[_0xded0('0x28')](respondWithResult(_0x1efda6,0xc9))[_0xded0('0x45')](handleError(_0x1efda6,null));};exports[_0xded0('0x26')]=function(_0x51e7f0,_0x42a88a){if(_0x51e7f0[_0xded0('0x49')]['id']){delete _0x51e7f0['body']['id'];}return db['VoiceRecording'][_0xded0('0x4a')]({'where':{'id':_0x51e7f0['params']['id']}})[_0xded0('0x28')](handleEntityNotFound(_0x42a88a,null))[_0xded0('0x28')](saveUpdates(_0x51e7f0[_0xded0('0x49')],null))[_0xded0('0x28')](respondWithResult(_0x42a88a,null))[_0xded0('0x45')](handleError(_0x42a88a,null));};exports[_0xded0('0x4b')]=function(_0x48030d,_0xe36e05){return db[_0xded0('0x2d')][_0xded0('0x4b')]()['then'](respondWithResult(_0xe36e05,null))[_0xded0('0x45')](handleError(_0xe36e05,null));};exports[_0xded0('0x4c')]=function(_0x53e4e2,_0x3cdc7d,_0x247de3){var _0x58e68a=require(_0xded0('0x4d'));var _0x32efec=![];var _0x2cc521={};if(_0x53e4e2[_0xded0('0x32')][_0xded0('0x30')]&&_0x53e4e2[_0xded0('0x32')][_0xded0('0x30')]==='uniqueid'){_0x2cc521[_0xded0('0x4e')]=_0x53e4e2[_0xded0('0x47')]['id'];}else{_0x2cc521['id']=_0x53e4e2[_0xded0('0x47')]['id'];}return db[_0xded0('0x2d')]['find']({'where':_0x2cc521,'attributes':['id',_0xded0('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x3cdc7d,null))[_0xded0('0x28')](function(_0x11d5de){if(_0x11d5de){var _0x2fb1bb=_0x11d5de[_0xded0('0x4f')];var _0x1d1bfe=util[_0xded0('0x50')](_0xded0('0x51'),_0x2fb1bb);if(fs['existsSync'](_0x1d1bfe)){_0x32efec=!![];return _0x58e68a[_0xded0('0x52')](_0x1d1bfe,_0x2fb1bb,config[_0xded0('0x53')][_0xded0('0x54')])[_0xded0('0x28')](function(){return _0x11d5de;});}return _0x11d5de;}})[_0xded0('0x28')](function(_0x4eac35){if(_0x4eac35){var _0x4cd35c=_0x4eac35[_0xded0('0x4f')];if(!fs[_0xded0('0x55')](_0x4cd35c)){throw new db['Sequelize'][(_0xded0('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x4eac35[_0xded0('0x57')]){return _0x3cdc7d[_0xded0('0x4c')](_0x4cd35c,_0x4eac35[_0xded0('0x57')]+path[_0xded0('0x58')](_0x4cd35c),function(){if(_0x32efec){fs['unlink'](_0x4cd35c);}});}else{return _0x3cdc7d[_0xded0('0x4c')](_0x4cd35c,function(_0x2ac2c6){if(_0x32efec){fs[_0xded0('0x59')](_0x4cd35c);}});}}})[_0xded0('0x45')](function(_0x201aa4){if(_0x201aa4[_0xded0('0x5a')]==='VoiceRecording\x20not\x20found'){_0x3cdc7d[_0xded0('0x1a')](0x194)[_0xded0('0x5b')]('Not\x20found');}else{return handleError(_0x3cdc7d,null);}});};exports[_0xded0('0x5c')]=function(_0x542a6e,_0xebf091,_0x407048){var _0x2c2656=require('../../components/encryptor');var _0x445c80=![];var _0x289283={'$and':[db['sequelize']['where'](db[_0xded0('0x5d')]['fn']('MD5',db[_0xded0('0x5d')][_0xded0('0x5e')](_0xded0('0x4e'))),_0x542a6e[_0xded0('0x32')][_0xded0('0x5f')])]};if(_0x542a6e[_0xded0('0x32')][_0xded0('0x30')]&&_0x542a6e[_0xded0('0x32')][_0xded0('0x30')]===_0xded0('0x4e')){_0x289283[_0xded0('0x60')][_0xded0('0x61')]({'uniqueid':_0x542a6e[_0xded0('0x47')]['id']});}else{_0x289283[_0xded0('0x60')][_0xded0('0x61')]({'id':_0x542a6e[_0xded0('0x47')]['id']});}return db[_0xded0('0x2d')][_0xded0('0x4a')]({'where':_0x289283,'attributes':['id',_0xded0('0x4f')],'raw':!![]})[_0xded0('0x28')](handleEntityNotFound(_0xebf091,null))[_0xded0('0x28')](function(_0x5a99a6){if(_0x5a99a6){var _0x2e6594=util[_0xded0('0x50')](_0xded0('0x51'),_0x5a99a6[_0xded0('0x4f')]);if(fs[_0xded0('0x55')](_0x2e6594)){_0x445c80=!![];return _0x2c2656['decryptFile'](_0x2e6594,_0x5a99a6[_0xded0('0x4f')],config[_0xded0('0x53')]['recording'])[_0xded0('0x28')](function(){return _0x5a99a6;});}return _0x5a99a6;}})['then'](function(_0x55c676){if(_0x55c676){if(!fs['existsSync'](_0x55c676[_0xded0('0x4f')])){throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))](_0xded0('0x63'));}if(_0x55c676[_0xded0('0x57')]){return _0xebf091[_0xded0('0x4c')](_0x55c676[_0xded0('0x4f')],_0x55c676[_0xded0('0x57')]+path['extname'](_0x55c676['value']),function(){if(_0x445c80){fs['unlink'](_0x55c676[_0xded0('0x4f')]);}});}else{return _0xebf091[_0xded0('0x4c')](_0x55c676['value'],function(_0x232b30){if(_0x445c80){fs[_0xded0('0x59')](_0x55c676[_0xded0('0x4f')]);}});}}})[_0xded0('0x45')](handleError(_0xebf091,null));};exports[_0xded0('0x27')]=function(_0x14deb2,_0x100d9d){return db[_0xded0('0x2d')][_0xded0('0x4a')]({'where':{'id':_0x14deb2[_0xded0('0x47')]['id']}})['then'](function(_0x3fe78d){if(_[_0xded0('0x64')](_0x3fe78d)){throw new ReferenceError(_0xded0('0x65'));}return _0x3fe78d;})['then'](function(_0x53cc59){var _0xa4335a=_0x53cc59['value'];logger[_0xded0('0x66')](_0xded0('0x67'),_0xa4335a);if(!_['isNil'](_0x53cc59[_0xded0('0x4f')])&&fs[_0xded0('0x55')](_0xa4335a)){logger['info'](_0xded0('0x68')+_0xa4335a+_0xded0('0x69'));fs[_0xded0('0x6a')](_0xa4335a);}_0xa4335a=_0xa4335a+'.cypher';if(!_[_0xded0('0x64')](_0x53cc59[_0xded0('0x4f')])&&fs[_0xded0('0x55')](_0xa4335a)){logger[_0xded0('0x66')](_0xded0('0x68')+_0xa4335a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xded0('0x6a')](_0xa4335a);}return _0x53cc59;})[_0xded0('0x28')](function(_0x2f3dc9){if(!_0x2f3dc9)throw new InternalError();return _0x2f3dc9[_0xded0('0x27')]();})[_0xded0('0x28')](function(){_0x100d9d[_0xded0('0x1a')](0xcc)[_0xded0('0x1b')]();})[_0xded0('0x45')](handleError(_0x100d9d,null));};function getBucketslist(_0x1679c4,_0x33d429,_0x1be534){return new Promise(function(_0x169154,_0x29f1b8){var _0x536358=new AWS['S3']({'accessKeyId':_0x33d429,'secretAccessKey':_0x1679c4,'region':_0x1be534});_0x536358['listBuckets']({},function(_0x5c85aa,_0x58f712){if(_0x5c85aa){return _0x29f1b8(_0x5c85aa);}else{return _0x169154(_0x58f712);}});});}function createBucket(_0x1bf426,_0x3ad903,_0xdde92e,_0x310dd6){return new Promise(function(_0x3ef04e,_0x43fa18){var _0x6ce74f=new AWS['S3']({'accessKeyId':_0x3ad903,'secretAccessKey':_0x1bf426,'region':_0xdde92e});_0x6ce74f['createBucket']({'Bucket':_0x310dd6},function(_0xd618c,_0x25a4c1){if(_0xd618c){return _0x43fa18(_0xd618c);}else{return _0x3ef04e(_0x25a4c1);}});});}function uploadFile(_0x55fff5,_0x2c0831,_0x122adf,_0x29f409,_0x1b19af,_0xcd3bfd){return new Promise(function(_0x3cbb4e,_0x3480cd){var _0x299423=new AWS['S3']({'accessKeyId':_0x2c0831,'secretAccessKey':_0x55fff5,'region':_0x122adf});_0x299423['upload']({'Bucket':_0x29f409,'Key':_0x1b19af,'Body':_0xcd3bfd},function(_0x37f636,_0x14bf14){if(_0x37f636){return _0x3480cd(_0x37f636);}else{return _0x3cbb4e(_0x14bf14);}});});}function startTranscribe(_0x239fc7,_0xdaddff,_0x11b5af,_0x244ebc,_0xee11e0,_0x433929){return new Promise(function(_0x38859f,_0x576610){var _0x390bc2=new AWS[(_0xded0('0x6b'))]({'accessKeyId':_0xdaddff,'secretAccessKey':_0x239fc7,'region':_0x11b5af});_0x390bc2[_0xded0('0x6c')]({'TranscriptionJobName':_0x244ebc,'LanguageCode':_0xee11e0,'Media':{'MediaFileUri':_0x433929}},function(_0x2cb73a,_0x4f74ac){if(_0x2cb73a){return _0x576610(_0x2cb73a);}else{return _0x38859f(_0x4f74ac);}});});}function transcribe(_0x6effff,_0x3710e5,_0x5b6839,_0x174f5e,_0x1a424e,_0x55cfce,_0x9545df){return new Promise(function(_0xea6d0b,_0x47c0e8){var _0x3354b5={};logger['info'](util[_0xded0('0x50')](_0xded0('0x6d'),_0x6effff,_0x1a424e));return uploadFile(_0x3710e5,_0x5b6839,_0x174f5e,_0x1a424e,path[_0xded0('0x6e')](_0x55cfce),fs[_0xded0('0x6f')](_0x55cfce))[_0xded0('0x28')](function(_0xaa9a0f){logger['info'](util['format'](_0xded0('0x70'),_0x6effff,_0x1a424e,_0xaa9a0f['Location']));_0x3354b5[_0xded0('0x71')]=_0xaa9a0f[_0xded0('0x72')];_0x3354b5[_0xded0('0x73')]=_0xaa9a0f['Location'];logger[_0xded0('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x6effff));return startTranscribe(_0x3710e5,_0x5b6839,_0x174f5e,uuidv4(),_0x9545df,_0xaa9a0f[_0xded0('0x74')]);})[_0xded0('0x28')](function(_0x5aebac){logger[_0xded0('0x66')](util[_0xded0('0x50')](_0xded0('0x75'),_0x6effff,_0x5aebac[_0xded0('0x76')]['TranscriptionJobName']));_0x3354b5[_0xded0('0x77')]=_0x5aebac[_0xded0('0x76')][_0xded0('0x78')];_0x3354b5[_0xded0('0x79')]=_0x5aebac['TranscriptionJob'][_0xded0('0x7a')];return _0xea6d0b(_0x3354b5);})['catch'](function(_0x36ef9b){return _0x47c0e8(_0x36ef9b);});});}exports['runTranscribe']=function(_0x1ff441,_0x5e1e43,_0x416eda){var _0x1c8c23;var _0x29cbeb;var _0x44a7a0;var _0x1d27df=require(_0xded0('0x4d'));return db[_0xded0('0x2d')][_0xded0('0x7b')]({'where':{'id':_0x1ff441['params']['id']}})[_0xded0('0x28')](function(_0x4fe29d){if(_0x4fe29d){var _0xdbee21=util[_0xded0('0x50')](_0xded0('0x51'),_0x4fe29d['value']);if(fs[_0xded0('0x55')](_0xdbee21)){cypher=!![];return _0x1d27df[_0xded0('0x52')](_0xdbee21,_0x4fe29d[_0xded0('0x4f')],config[_0xded0('0x53')]['recording'])[_0xded0('0x28')](function(){return _0x4fe29d;});}return _0x4fe29d;}})[_0xded0('0x28')](function(_0xc076a4){if(!_0xc076a4){throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))]('Voice\x20Recording\x20not\x20found');}_0x29cbeb=_0xc076a4;return db[_0xded0('0x7c')][_0xded0('0x7b')]({'where':{'id':0x1}});})[_0xded0('0x28')](handleEntityNotFound(_0x5e1e43,null))[_0xded0('0x28')](function(_0x591a01){if(_0x591a01){_0x1c8c23=_0x591a01;if(!_0x1c8c23[_0xded0('0x7d')]||!_0x1c8c23[_0xded0('0x7e')]||!_0x1c8c23['transcribeRegion']||!_0x1c8c23['language']||!_0x1c8c23[_0xded0('0x71')]){throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))](_0xded0('0x7f'));}if(_0x1ff441['body'][_0xded0('0x80')]&&(!_0x1c8c23[_0xded0('0x81')]||!_0x1c8c23['sentimentAccountId']||!_0x1c8c23[_0xded0('0x82')]||!_0x1c8c23[_0xded0('0x83')]||!_0x1c8c23['bucket'])){throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))](_0xded0('0x84'));}return db[_0xded0('0x85')][_0xded0('0x7b')]({'where':{'id':_0x1c8c23['transcribeAccountId']}});}})['then'](function(_0x5d67fd){if(!_0x5d67fd){throw new db[(_0xded0('0x62'))]['ValidationError'](_0xded0('0x86'));}if(!_0x5d67fd[_0xded0('0x87')]||!_0x5d67fd['data2']){throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))](_0xded0('0x88'));}_0x44a7a0=_0x5d67fd;return getBucketslist(_0x44a7a0[_0xded0('0x87')],_0x44a7a0[_0xded0('0x89')],_0x1c8c23[_0xded0('0x8a')]);})[_0xded0('0x28')](function(_0x5dbb73){if(_0x5dbb73&&_0x5dbb73[_0xded0('0x8b')]){var _0x231815=_[_0xded0('0x4a')](_0x5dbb73[_0xded0('0x8b')],function(_0x436c7d){return _0x436c7d[_0xded0('0x8c')]===_0x1c8c23[_0xded0('0x71')];});if(!_0x231815){logger[_0xded0('0x66')](util['format'](_0xded0('0x8d'),_0x1ff441[_0xded0('0x47')]['id'],_0x1c8c23[_0xded0('0x71')]));return createBucket(_0x44a7a0[_0xded0('0x87')],_0x44a7a0[_0xded0('0x89')],_0x1c8c23[_0xded0('0x8a')],_0x1c8c23[_0xded0('0x71')]);}logger['info'](util[_0xded0('0x50')](_0xded0('0x8e'),_0x1ff441['params']['id'],_0x1c8c23['bucket']));return;}})[_0xded0('0x28')](function(_0x3362cb){if(_0x29cbeb[_0xded0('0x79')]===_0xded0('0x8f')){return transcribe(_0x1ff441[_0xded0('0x47')]['id'],_0x44a7a0['data1'],_0x44a7a0[_0xded0('0x89')],_0x1c8c23['transcribeRegion'],_0x1c8c23['bucket'],_0x29cbeb[_0xded0('0x4f')],_0x1c8c23[_0xded0('0x83')]);}else{logger[_0xded0('0x66')](util[_0xded0('0x50')](_0xded0('0x90'),_0x1ff441['params']['id']));return{'transcribeStatus':_0xded0('0x91')};}})['then'](function(_0x48c783){if(_0x48c783){_0x48c783[_0xded0('0x92')]=_0x1ff441[_0xded0('0x49')][_0xded0('0x80')];return _0x29cbeb[_0xded0('0x93')](_0x48c783);}})[_0xded0('0x28')](respondWithResult(_0x5e1e43,null))[_0xded0('0x45')](handleError(_0x5e1e43,null));};function writeFile(_0x43e353,_0x1e3959){return new Promise(function(_0x2ffdb6,_0x107e63){fs[_0xded0('0x94')](_0x1e3959,_0x43e353,function(_0x5773cf,_0x21b27b){if(_0x5773cf){return _0x107e63(_0x5773cf);}else{return _0x2ffdb6(_0x21b27b);}});});}exports['downloadTranscribe']=function(_0x3fedd2,_0x10d1fd,_0x2bf1cb){return db['VoiceRecording'][_0xded0('0x7b')]({'where':{'id':_0x3fedd2[_0xded0('0x47')]['id']}})[_0xded0('0x28')](handleEntityNotFound(_0x10d1fd))[_0xded0('0x28')](function(_0x1d6fef){if(_0x1d6fef&&_0x1d6fef[_0xded0('0x95')]){var _0x1440ef=_0x1d6fef[_0xded0('0x95')];var _0x155a56=config['root']+_0xded0('0x96')+_0x1d6fef['id']+'.txt';if(fs[_0xded0('0x55')](_0x155a56)){return _0x155a56;}return writeFile(_0x1440ef,_0x155a56)[_0xded0('0x28')](function(){return _0x155a56;});}else{throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))](_0xded0('0x97'));}})[_0xded0('0x28')](function(_0x587c76){return _0x10d1fd['download'](_0x587c76);})[_0xded0('0x45')](handleError(_0x10d1fd));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b3933e3..60877e5 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 _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 +var _0x280f=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','define'];(function(_0xd4ec0c,_0x2afcd2){var _0x580218=function(_0x3b1cd4){while(--_0x3b1cd4){_0xd4ec0c['push'](_0xd4ec0c['shift']());}};_0x580218(++_0x2afcd2);}(_0x280f,0xe2));var _0xf280=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0x280f[_0x644ecd];return _0x1c66ce;};'use strict';var attributes=require(_0xf280('0x0'));module['exports']=function(_0x412811,_0x125275){return _0x412811[_0xf280('0x1')](_0xf280('0x2'),attributes,{'tableName':_0xf280('0x3'),'paranoid':![],'indexes':[{'name':_0xf280('0x4'),'fields':[_0xf280('0x4')]},{'name':'transcribeStatus','fields':[_0xf280('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 631af01..38c4b8c 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 _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 +var _0x5b12=['Setting','callRecordingEncryption','create','body','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','UpdateVoiceRecording','VoiceRecording','options','raw','attributes','CreateVoiceRecording','../../components/encryptor'];(function(_0x381f03,_0x4c3f61){var _0x21a630=function(_0x34a2fa){while(--_0x34a2fa){_0x381f03['push'](_0x381f03['shift']());}};_0x21a630(++_0x4c3f61);}(_0x5b12,0xa3));var _0x25b1=function(_0xf73297,_0x1e8493){_0xf73297=_0xf73297-0x0;var _0x24ebdf=_0x5b12[_0xf73297];return _0x24ebdf;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb95b,_0x1f715d,_0x28c980){return new BPromise(function(_0x451c66,_0x2a46e0){return client[_0x25b1('0x8')](_0x5bb95b,_0x28c980)[_0x25b1('0x9')](function(_0x3346ed){logger[_0x25b1('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x1f715d,_0x25b1('0xb'));logger[_0x25b1('0xc')](_0x25b1('0xd'),_0x1f715d,_0x25b1('0xb'),JSON[_0x25b1('0xe')](_0x3346ed));if(_0x3346ed[_0x25b1('0xf')]){if(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x10')]===0x1f4){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);return _0x2a46e0(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);}logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed['error'][_0x25b1('0x12')]);return _0x451c66(_0x3346ed[_0x25b1('0xf')]['message']);}else{logger[_0x25b1('0xa')](_0x25b1('0x11'),_0x1f715d,_0x25b1('0xb'));_0x451c66(_0x3346ed['result']['message']);}})[_0x25b1('0x13')](function(_0x573ec2){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x573ec2);_0x2a46e0(_0x573ec2);});});}exports[_0x25b1('0x14')]=function(_0x27ccc9){var _0x1f78c2=this;return new Promise(function(_0x2a7d14,_0x17024a){return db[_0x25b1('0x15')]['update'](_0x27ccc9['body'],{'raw':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27ccc9['options']?_0x27ccc9[_0x25b1('0x16')]['where']||null:null,'attributes':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x18')]||null:null,'limit':_0x27ccc9['options']?_0x27ccc9['options']['limit']||null:null})[_0x25b1('0x9')](function(_0x150436){logger['info'](_0x25b1('0x14'),_0x27ccc9);logger[_0x25b1('0xc')](_0x25b1('0x14'),_0x27ccc9,JSON[_0x25b1('0xe')](_0x150436));_0x2a7d14(_0x150436);})[_0x25b1('0x13')](function(_0x5e6b6b){logger[_0x25b1('0xf')](_0x25b1('0x14'),_0x5e6b6b[_0x25b1('0x12')],_0x27ccc9);_0x17024a(_0x1f78c2[_0x25b1('0xf')](0x1f4,_0x5e6b6b[_0x25b1('0x12')]));});});};exports[_0x25b1('0x19')]=function(_0x5d9ed7){var _0x3c05c6=this;return new Promise(function(_0x27dd68,_0x3d279f){var _0x5bc8fc=require(_0x25b1('0x1a'));var _0x9e175f;return db[_0x25b1('0x1b')]['findOne']({'attributes':['id',_0x25b1('0x1c')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x19ecd1){_0x9e175f=_0x19ecd1;return db[_0x25b1('0x15')][_0x25b1('0x1d')](_0x5d9ed7[_0x25b1('0x1e')]);})[_0x25b1('0x9')](function(_0x300a14){if(_0x9e175f[_0x25b1('0x1c')]&&fs['existsSync'](_0x300a14[_0x25b1('0x1f')])){var _0xca56f0=util[_0x25b1('0x20')](_0x25b1('0x21'),_0x300a14[_0x25b1('0x1f')]);return _0x5bc8fc['encryptFile'](_0x300a14[_0x25b1('0x1f')],_0xca56f0,config[_0x25b1('0x22')][_0x25b1('0x23')])[_0x25b1('0x9')](function(){fs[_0x25b1('0x24')](_0x300a14['value']);logger['info'](_0x25b1('0x25'));return _0x300a14;});}return _0x300a14;})['then'](function(_0x446984){logger[_0x25b1('0xa')](_0x25b1('0x19'),_0x5d9ed7);logger['debug']('CreateVoiceRecording',_0x5d9ed7,JSON[_0x25b1('0xe')](_0x446984));_0x27dd68(_0x446984);})[_0x25b1('0x13')](function(_0x26d3bc){logger['error'](_0x25b1('0x19'),_0x26d3bc[_0x25b1('0x12')],_0x5d9ed7);_0x3d279f(_0x3c05c6[_0x25b1('0xf')](0x1f4,_0x26d3bc[_0x25b1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 1a81bf8..829fee8 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 _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 +var _0x4c7b=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x4ccd1b,_0x3cac28){var _0x3da838=function(_0x2fa459){while(--_0x2fa459){_0x4ccd1b['push'](_0x4ccd1b['shift']());}};_0x3da838(++_0x3cac28);}(_0x4c7b,0x1c4));var _0xb4c7=function(_0xcc734a,_0x3b4dbc){_0xcc734a=_0xcc734a-0x0;var _0x59fb95=_0x4c7b[_0xcc734a];return _0x59fb95;};'use strict';var multer=require(_0xb4c7('0x0'));var util=require(_0xb4c7('0x1'));var path=require(_0xb4c7('0x2'));var timeout=require(_0xb4c7('0x3'));var express=require('express');var router=express[_0xb4c7('0x4')]();var fs_extra=require(_0xb4c7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb4c7('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0xb4c7('0x7')]('/',auth[_0xb4c7('0x8')](),controller[_0xb4c7('0x9')]);router['get'](_0xb4c7('0xa'),auth[_0xb4c7('0x8')](),controller[_0xb4c7('0xb')]);router['get'](_0xb4c7('0xc'),auth['isAuthenticated'](),controller[_0xb4c7('0xd')]);router[_0xb4c7('0xe')]('/',auth[_0xb4c7('0x8')](),controller[_0xb4c7('0xf')]);router[_0xb4c7('0x10')](_0xb4c7('0xc'),auth['isAuthenticated'](),controller[_0xb4c7('0x11')]);router[_0xb4c7('0x12')](_0xb4c7('0xc'),auth[_0xb4c7('0x8')](),controller[_0xb4c7('0x13')]);module[_0xb4c7('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 6326b06..f649c0b 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 _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 +var _0x8a1a=['ENUM','blind','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x2424e2,_0x5ac144){var _0x38ecf8=function(_0x43d5bf){while(--_0x43d5bf){_0x2424e2['push'](_0x2424e2['shift']());}};_0x38ecf8(++_0x5ac144);}(_0x8a1a,0x115));var _0xa8a1=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0x8a1a[_0x5d61b4];return _0x183fc5;};'use strict';var Sequelize=require(_0xa8a1('0x0'));var moment=require(_0xa8a1('0x1'));module[_0xa8a1('0x2')]={'type':{'type':Sequelize[_0xa8a1('0x3')](_0xa8a1('0x4'),_0xa8a1('0x5'))},'result':{'type':Sequelize[_0xa8a1('0x6')]},'transfererchannel':{'type':Sequelize[_0xa8a1('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xa8a1('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xa8a1('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xa8a1('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xa8a1('0x6')]},'transfereechannel':{'type':Sequelize[_0xa8a1('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xa8a1('0x6')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xa8a1('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa8a1('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xa8a1('0x6')]},'transfereecontext':{'type':Sequelize[_0xa8a1('0x6')]},'transfereeexten':{'type':Sequelize[_0xa8a1('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xa8a1('0x6')]},'isexternal':{'type':Sequelize[_0xa8a1('0x3')](_0xa8a1('0x7'),'No')},'context':{'type':Sequelize[_0xa8a1('0x6')]},'extension':{'type':Sequelize[_0xa8a1('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e5a8f7c..dfadff7 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 _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 +var _0x6982=['set','apply','reject','save','update','then','error','stack','name','send','index','VoiceTransferReport','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','findAll','rows','catch','show','params','keys','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x441d3a,_0x49bed8){var _0x32a7c3=function(_0x34dcaf){while(--_0x34dcaf){_0x441d3a['push'](_0x441d3a['shift']());}};_0x32a7c3(++_0x49bed8);}(_0x6982,0x1e4));var _0x2698=function(_0x22dea6,_0x4fa222){_0x22dea6=_0x22dea6-0x0;var _0x52bb67=_0x6982[_0x22dea6];return _0x52bb67;};'use strict';var emlformat=require(_0x2698('0x0'));var rimraf=require(_0x2698('0x1'));var zipdir=require(_0x2698('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2698('0x3'));var moment=require(_0x2698('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2698('0x5'));var path=require(_0x2698('0x6'));var sox=require(_0x2698('0x7'));var csv=require(_0x2698('0x8'));var ejs=require(_0x2698('0x9'));var fs=require('fs');var fs_extra=require(_0x2698('0xa'));var _=require(_0x2698('0xb'));var squel=require(_0x2698('0xc'));var crypto=require(_0x2698('0xd'));var jsforce=require(_0x2698('0xe'));var deskjs=require(_0x2698('0xf'));var toCsv=require(_0x2698('0x8'));var querystring=require(_0x2698('0x10'));var Papa=require('papaparse');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('../../config/logger')(_0x2698('0x15'));var utils=require(_0x2698('0x16'));var config=require(_0x2698('0x17'));var licenseUtil=require(_0x2698('0x18'));var db=require(_0x2698('0x19'))['db'];function respondWithStatusCode(_0x329dd8,_0x1dd286){_0x1dd286=_0x1dd286||0xcc;return function(_0x49581a){if(_0x49581a){return _0x329dd8[_0x2698('0x1a')](_0x1dd286);}return _0x329dd8['status'](_0x1dd286)[_0x2698('0x1b')]();};}function respondWithResult(_0x31ddbf,_0x31da3b){_0x31da3b=_0x31da3b||0xc8;return function(_0x501fa7){if(_0x501fa7){return _0x31ddbf[_0x2698('0x1c')](_0x31da3b)[_0x2698('0x1d')](_0x501fa7);}};}function respondWithFilteredResult(_0x45065e,_0x2a921b){return function(_0x451a27){if(_0x451a27){var _0x80c91=typeof _0x2a921b[_0x2698('0x1e')]===_0x2698('0x1f')&&typeof _0x2a921b[_0x2698('0x20')]===_0x2698('0x1f');var _0x345252=_0x451a27['count'];var _0x3c8747=_0x80c91?0x0:_0x2a921b[_0x2698('0x1e')];var _0x2ddc51=_0x80c91?_0x451a27[_0x2698('0x21')]:_0x2a921b[_0x2698('0x1e')]+_0x2a921b['limit'];var _0x3a23f1;if(_0x2ddc51>=_0x345252){_0x2ddc51=_0x345252;_0x3a23f1=0xc8;}else{_0x3a23f1=0xce;}_0x45065e[_0x2698('0x1c')](_0x3a23f1);return _0x45065e[_0x2698('0x22')]('Content-Range',_0x3c8747+'-'+_0x2ddc51+'/'+_0x345252)[_0x2698('0x1d')](_0x451a27);}return null;};}function patchUpdates(_0x55b53b){return function(_0xf877fd){try{jsonpatch[_0x2698('0x23')](_0xf877fd,_0x55b53b,!![]);}catch(_0x5c23da){return BPromise[_0x2698('0x24')](_0x5c23da);}return _0xf877fd[_0x2698('0x25')]();};}function saveUpdates(_0x4ea962,_0x2a4045){return function(_0x32368d){if(_0x32368d){return _0x32368d[_0x2698('0x26')](_0x4ea962)[_0x2698('0x27')](function(_0xf3265c){return _0xf3265c;});}return null;};}function removeEntity(_0x2a804b,_0x5bf245){return function(_0x38062f){if(_0x38062f){return _0x38062f['destroy']()['then'](function(){_0x2a804b[_0x2698('0x1c')](0xcc)[_0x2698('0x1b')]();});}};}function handleEntityNotFound(_0x398baa,_0x18eded){return function(_0x4e2112){if(!_0x4e2112){_0x398baa[_0x2698('0x1a')](0x194);}return _0x4e2112;};}function handleError(_0x20f1c6,_0x15adf5){_0x15adf5=_0x15adf5||0x1f4;return function(_0xd0800f){logger[_0x2698('0x28')](_0xd0800f[_0x2698('0x29')]);if(_0xd0800f['name']){delete _0xd0800f[_0x2698('0x2a')];}_0x20f1c6[_0x2698('0x1c')](_0x15adf5)[_0x2698('0x2b')](_0xd0800f);};}exports[_0x2698('0x2c')]=function(_0x58c8b6,_0x12ccec){var _0xd03b0={},_0x4ee6e5={},_0x29dcbd={'count':0x0,'rows':[]};var _0x3e8157=_['map'](db[_0x2698('0x2d')]['rawAttributes'],function(_0x2dcd90){return{'name':_0x2dcd90['fieldName'],'type':_0x2dcd90[_0x2698('0x2e')][_0x2698('0x2f')]};});_0x4ee6e5[_0x2698('0x30')]=_[_0x2698('0x31')](_0x3e8157,'name');_0x4ee6e5[_0x2698('0x32')]=_['keys'](_0x58c8b6[_0x2698('0x32')]);_0x4ee6e5['filters']=_[_0x2698('0x33')](_0x4ee6e5[_0x2698('0x30')],_0x4ee6e5[_0x2698('0x32')]);_0xd03b0[_0x2698('0x34')]=_[_0x2698('0x33')](_0x4ee6e5['model'],qs['fields'](_0x58c8b6[_0x2698('0x32')][_0x2698('0x35')]));_0xd03b0[_0x2698('0x34')]=_0xd03b0[_0x2698('0x34')][_0x2698('0x36')]?_0xd03b0[_0x2698('0x34')]:_0x4ee6e5[_0x2698('0x30')];if(!_0x58c8b6[_0x2698('0x32')][_0x2698('0x37')]('nolimit')){_0xd03b0[_0x2698('0x20')]=qs['limit'](_0x58c8b6['query'][_0x2698('0x20')]);_0xd03b0['offset']=qs[_0x2698('0x1e')](_0x58c8b6[_0x2698('0x32')]['offset']);}_0xd03b0[_0x2698('0x38')]=qs[_0x2698('0x39')](_0x58c8b6[_0x2698('0x32')][_0x2698('0x39')]);_0xd03b0['where']=qs[_0x2698('0x3a')](_[_0x2698('0x3b')](_0x58c8b6[_0x2698('0x32')],_0x4ee6e5[_0x2698('0x3a')]),_0x3e8157);if(_0x58c8b6[_0x2698('0x32')][_0x2698('0x3c')]){_0xd03b0[_0x2698('0x3d')]=_[_0x2698('0x3e')](_0xd03b0[_0x2698('0x3d')],{'$or':_['map'](_0x3e8157,function(_0xec2ac9){if(_0xec2ac9[_0x2698('0x2e')]!=='VIRTUAL'){var _0xbd0173={};_0xbd0173[_0xec2ac9['name']]={'$like':'%'+_0x58c8b6[_0x2698('0x32')]['filter']+'%'};return _0xbd0173;}})});}_0xd03b0=_[_0x2698('0x3e')]({},_0xd03b0,_0x58c8b6[_0x2698('0x3f')]);var _0x160812={'where':_0xd03b0[_0x2698('0x3d')]};return db[_0x2698('0x2d')][_0x2698('0x21')](_0x160812)[_0x2698('0x27')](function(_0x2e40c6){_0x29dcbd[_0x2698('0x21')]=_0x2e40c6;if(_0x58c8b6[_0x2698('0x32')]['includeAll']){_0xd03b0['include']=[{'all':!![]}];}return db[_0x2698('0x2d')][_0x2698('0x40')](_0xd03b0);})['then'](function(_0xd5dd51){_0x29dcbd[_0x2698('0x41')]=_0xd5dd51;return _0x29dcbd;})['then'](respondWithFilteredResult(_0x12ccec,_0xd03b0))[_0x2698('0x42')](handleError(_0x12ccec,null));};exports[_0x2698('0x43')]=function(_0x3b58f7,_0x25ba15){var _0x5d4c29={'raw':!![],'where':{'id':_0x3b58f7[_0x2698('0x44')]['id']}},_0x59872f={};_0x59872f[_0x2698('0x30')]=_['keys'](db[_0x2698('0x2d')]['rawAttributes']);_0x59872f['query']=_[_0x2698('0x45')](_0x3b58f7[_0x2698('0x32')]);_0x59872f['filters']=_[_0x2698('0x33')](_0x59872f['model'],_0x59872f[_0x2698('0x32')]);_0x5d4c29[_0x2698('0x34')]=_[_0x2698('0x33')](_0x59872f[_0x2698('0x30')],qs[_0x2698('0x35')](_0x3b58f7[_0x2698('0x32')]['fields']));_0x5d4c29[_0x2698('0x34')]=_0x5d4c29['attributes']['length']?_0x5d4c29[_0x2698('0x34')]:_0x59872f[_0x2698('0x30')];if(_0x3b58f7[_0x2698('0x32')]['includeAll']){_0x5d4c29['include']=[{'all':!![]}];}_0x5d4c29=_[_0x2698('0x3e')]({},_0x5d4c29,_0x3b58f7[_0x2698('0x3f')]);return db[_0x2698('0x2d')]['find'](_0x5d4c29)[_0x2698('0x27')](handleEntityNotFound(_0x25ba15,null))[_0x2698('0x27')](respondWithResult(_0x25ba15,null))[_0x2698('0x42')](handleError(_0x25ba15,null));};exports[_0x2698('0x46')]=function(_0x437fce,_0x2d65b0){return db['VoiceTransferReport'][_0x2698('0x46')](_0x437fce[_0x2698('0x47')],{})[_0x2698('0x27')](respondWithResult(_0x2d65b0,0xc9))[_0x2698('0x42')](handleError(_0x2d65b0,null));};exports[_0x2698('0x26')]=function(_0x27d504,_0x11db7e){if(_0x27d504['body']['id']){delete _0x27d504[_0x2698('0x47')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x27d504[_0x2698('0x44')]['id']}})[_0x2698('0x27')](handleEntityNotFound(_0x11db7e,null))[_0x2698('0x27')](saveUpdates(_0x27d504[_0x2698('0x47')],null))[_0x2698('0x27')](respondWithResult(_0x11db7e,null))['catch'](handleError(_0x11db7e,null));};exports[_0x2698('0x48')]=function(_0x1374d0,_0x1e0d3d){return db[_0x2698('0x2d')]['find']({'where':{'id':_0x1374d0['params']['id']}})['then'](handleEntityNotFound(_0x1e0d3d,null))[_0x2698('0x27')](removeEntity(_0x1e0d3d,null))[_0x2698('0x42')](handleError(_0x1e0d3d,null));};exports[_0x2698('0x49')]=function(_0x39fb48,_0x2f4700){return db[_0x2698('0x2d')][_0x2698('0x49')]()[_0x2698('0x27')](respondWithResult(_0x2f4700,null))[_0x2698('0x42')](handleError(_0x2f4700,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 514e2aa..d3e6415 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 _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 +var _0xb41d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb41d,0x94));var _0xdb41=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xb41d[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0xdb41('0x0'));var util=require('util');var logger=require(_0xdb41('0x1'))('api');var moment=require(_0xdb41('0x2'));var BPromise=require(_0xdb41('0x3'));var rp=require(_0xdb41('0x4'));var fs=require('fs');var path=require(_0xdb41('0x5'));var rimraf=require(_0xdb41('0x6'));var config=require(_0xdb41('0x7'));var attributes=require(_0xdb41('0x8'));module[_0xdb41('0x9')]=function(_0x96af9,_0x13d739){return _0x96af9['define']('VoiceTransferReport',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 d888229..2135d55 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 _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 +var _0xe260=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateVoiceTransferReport','create','body','options','raw','then','debug','lodash'];(function(_0x1b2b4c,_0x184037){var _0x80e1f5=function(_0x1a82c5){while(--_0x1a82c5){_0x1b2b4c['push'](_0x1b2b4c['shift']());}};_0x80e1f5(++_0x184037);}(_0xe260,0xe0));var _0x0e26=function(_0x2008b9,_0x221290){_0x2008b9=_0x2008b9-0x0;var _0x604cd3=_0xe260[_0x2008b9];return _0x604cd3;};'use strict';var _=require(_0x0e26('0x0'));var util=require('util');var moment=require(_0x0e26('0x1'));var BPromise=require(_0x0e26('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e26('0x3'))['db'];var utils=require(_0x0e26('0x4'));var logger=require(_0x0e26('0x5'))(_0x0e26('0x6'));var config=require(_0x0e26('0x7'));var jayson=require(_0x0e26('0x8'));var client=jayson['client'][_0x0e26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x473423,_0x133f52,_0x5a5f52){return new BPromise(function(_0x18bb2b,_0x411179){return client[_0x0e26('0xa')](_0x473423,_0x5a5f52)['then'](function(_0x133d0b){logger[_0x0e26('0xb')](_0x0e26('0xc'),_0x133f52,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x133f52,_0x0e26('0xd'),JSON[_0x0e26('0xe')](_0x133d0b));if(_0x133d0b[_0x0e26('0xf')]){if(_0x133d0b['error'][_0x0e26('0x10')]===0x1f4){logger['error'](_0x0e26('0xc'),_0x133f52,_0x133d0b[_0x0e26('0xf')][_0x0e26('0x11')]);return _0x411179(_0x133d0b[_0x0e26('0xf')][_0x0e26('0x11')]);}logger[_0x0e26('0xf')](_0x0e26('0xc'),_0x133f52,_0x133d0b[_0x0e26('0xf')]['message']);return _0x18bb2b(_0x133d0b[_0x0e26('0xf')]['message']);}else{logger[_0x0e26('0xb')](_0x0e26('0xc'),_0x133f52,_0x0e26('0xd'));_0x18bb2b(_0x133d0b['result'][_0x0e26('0x11')]);}})['catch'](function(_0x394aca){logger[_0x0e26('0xf')](_0x0e26('0xc'),_0x133f52,_0x394aca);_0x411179(_0x394aca);});});}exports[_0x0e26('0x12')]=function(_0x100e67){var _0x13a5a5=this;return new Promise(function(_0x34aa9e,_0x431fa0){return db['VoiceTransferReport'][_0x0e26('0x13')](_0x100e67[_0x0e26('0x14')],{'raw':_0x100e67[_0x0e26('0x15')]?_0x100e67[_0x0e26('0x15')][_0x0e26('0x16')]===undefined?!![]:![]:!![]})[_0x0e26('0x17')](function(_0x4d04fa){logger[_0x0e26('0xb')]('CreateVoiceTransferReport',_0x100e67);logger[_0x0e26('0x18')]('CreateVoiceTransferReport',_0x100e67,JSON[_0x0e26('0xe')](_0x4d04fa));_0x34aa9e(_0x4d04fa);})['catch'](function(_0x162e57){logger['error'](_0x0e26('0x12'),_0x162e57[_0x0e26('0x11')],_0x100e67);_0x431fa0(_0x13a5a5[_0x0e26('0xf')](0x1f4,_0x162e57['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index ec4276c..d36a00d 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 _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 +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb43b,0x1b2));var _0xbb43=function(_0x48b685,_0x4e9e19){_0x48b685=_0x48b685-0x0;var _0x5a6733=_0xb43b[_0x48b685];return _0x5a6733;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 968fd0f..9febd8b 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 _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 +var _0x984b=['transfer\x20executed!','../../config/environment','util','bluebird','http','../../config/logger','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','filter','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0x984b,0xee));var _0xb984=function(_0x210d2b,_0x5c1b78){_0x210d2b=_0x210d2b-0x0;var _0x1a9af2=_0x984b[_0x210d2b];return _0x1a9af2;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xb984('0x0'));var util=require(_0xb984('0x1'));var BPromise=require(_0xb984('0x2'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xb984('0x3')]({'port':0x232a});var logger=require(_0xb984('0x4'))('webbarapi');var Redis=require('ioredis');config[_0xb984('0x5')]=_[_0xb984('0x6')](config['redis'],{'host':_0xb984('0x7'),'port':0x18eb});var io=require(_0xb984('0x8'))(new Redis(config['redis']));var Schema=require(_0xb984('0x9'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]},'callNumber':{'type':_0xb984('0xb'),'required':[!![],_0xb984('0xc')]},'callerId':{'type':_0xb984('0xb')},'callbackUrl':{'type':_0xb984('0xb')}});var hangupValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb984('0xb'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xb984('0xb'),'required':[!![],_0xb984('0xe')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x6fae41,_0x5cd1aa,_0x3b8241){logger[_0xb984('0xf')](_0x6fae41,_0x5cd1aa,JSON[_0xb984('0x10')](_0x3b8241));io['to'](_0x6fae41)[_0xb984('0x11')](_0x5cd1aa,_0x3b8241);}function handleError(_0x59dcb7){return function(_0x396c36){console[_0xb984('0x12')](_0xb984('0x13'),_0x396c36,_0x396c36 instanceof RangeError);logger[_0xb984('0x14')](_0x396c36[_0xb984('0x15')]);if(_0x396c36 instanceof RangeError){if(_0x396c36[_0xb984('0x16')]){delete _0x396c36['name'];}_0x59dcb7[_0xb984('0x17')](0x194)[_0xb984('0x18')](_0x396c36);}else{if(_0x396c36[_0xb984('0x16')]){delete _0x396c36[_0xb984('0x16')];}_0x59dcb7[_0xb984('0x17')](0x1f4)[_0xb984('0x18')](_0x396c36);}};}function checkError(){return function(_0x54dd81){if(!_0x54dd81){throw new RangeError(_0xb984('0x19'));}return _0x54dd81;};}function respondWithRpcPromise(_0xc16561,_0x551ad4){return new BPromise(function(_0x44b570,_0x97af5c){var _0x14734a=amiClient;return _0x14734a[_0xb984('0x1a')](_0xc16561,_0x551ad4)[_0xb984('0x1b')](function(_0x286033){if(_0x286033[_0xb984('0x14')]){if(_0x286033['error'][_0xb984('0x1c')]===0x1f4){return _0x97af5c(_0x286033[_0xb984('0x14')][_0xb984('0x1d')]);}return _0x44b570(_0x286033['error'][_0xb984('0x1d')]);}else{_0x44b570(_0x286033[_0xb984('0x1e')]);}})[_0xb984('0x1f')](function(_0x2d0450){_0x97af5c(_0x2d0450);});});}function getAgent(_0x1f7b62){return db[_0xb984('0x20')][_0xb984('0x21')]({'where':{'id':_0x1f7b62,'role':_0xb984('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x249d47,_0x469af6){return new BPromise(function(_0x3e254b,_0x2bd0f2){var _0x4fb896=respondWithRpcPromise(_0xb984('0x23'));var _0x67e4d3=getAgent(_0x249d47);Promise[_0xb984('0x24')]([_0x4fb896,_0x67e4d3])['then'](function(_0x363e33){var _0x311e22=_0x363e33[0x0];var _0x2012ca=_0x363e33[0x1];var _0x3d2757=_['filter'](_0x311e22['rows'],function(_0x4dcf73){return _0x4dcf73[_0xb984('0x25')]==_0x2012ca['id']&&_0x4dcf73[_0xb984('0x26')]==_0x469af6;});if(_0x3d2757['length']==0x1){_0x3e254b(_0x2012ca);}else{_0x2bd0f2(new RangeError(_0xb984('0x27')+_0x469af6+_0xb984('0x28')));}});});}exports[_0xb984('0x29')]=function(_0x2c5a99,_0x518bef){logger['info'](_0xb984('0x2a'),_0x2c5a99[_0xb984('0x2b')]);var _0x2c0562=originateValidation[_0xb984('0x9')](_0x2c5a99['body']);if(_0x2c0562[_0xb984('0x2c')]>0x0){return _0x518bef[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x2c0562);}var _0x3c4687=_0x2c5a99[_0xb984('0x2b')][_0xb984('0x2e')];var _0x5f4426=_0x2c5a99[_0xb984('0x2b')][_0xb984('0x2f')];var _0x523784=_0x2c5a99[_0xb984('0x2b')][_0xb984('0x30')];var _0x30891c=_0x2c5a99['body'][_0xb984('0x31')];return getAgent(_0x3c4687)[_0xb984('0x1b')](function(_0x4edaf1){logger['info'](_0xb984('0x32'),_0x4edaf1['name']);emit(util[_0xb984('0x33')](_0xb984('0x34'),_0x4edaf1['name']),_0xb984('0x35'),{'callNumber':_0x5f4426,'callerId':_0x523784,'callbackUrl':_0x30891c});return _0x518bef['status'](0xc8)[_0xb984('0x2d')]({'error':![],'message':'originate\x20executed!'});})[_0xb984('0x1f')](handleError(_0x518bef));};exports['hangup']=function(_0x52f872,_0xf6d925){logger[_0xb984('0xf')]('hangup\x20fired:',_0x52f872[_0xb984('0x2b')]);var _0x1fd248=hangupValidation['validate'](_0x52f872[_0xb984('0x2b')]);if(_0x1fd248[_0xb984('0x2c')]>0x0){return _0xf6d925[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x1fd248);}var _0x4837d5=_0x52f872[_0xb984('0x2b')][_0xb984('0x2e')];var _0x383c87=_0x52f872[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x4837d5)[_0xb984('0x1b')](function(_0xc257ee){logger[_0xb984('0xf')](_0xb984('0x32'),_0xc257ee[_0xb984('0x16')]);emit(util['format'](_0xb984('0x34'),_0xc257ee[_0xb984('0x16')]),_0xb984('0x36'),{'sessionId':_0x383c87});return _0xf6d925[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x37')});})[_0xb984('0x1f')](handleError(_0xf6d925));};exports[_0xb984('0x38')]=function(_0x52181e,_0x5d4be9){logger[_0xb984('0xf')]('answer\x20fired:',_0x52181e[_0xb984('0x2b')]);var _0x2326c6=answerValidation[_0xb984('0x9')](_0x52181e[_0xb984('0x2b')]);if(_0x2326c6['length']>0x0){return _0x5d4be9[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x2326c6);}var _0x5d5e85=_0x52181e[_0xb984('0x2b')][_0xb984('0x2e')];var _0x38a025=_0x52181e[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x5d5e85)[_0xb984('0x1b')](function(_0x2f2f02){logger['info'](_0xb984('0x32'),_0x2f2f02[_0xb984('0x16')]);emit(util['format']('user:%s',_0x2f2f02[_0xb984('0x16')]),_0xb984('0x39'),{'sessionId':_0x38a025});return _0x5d4be9[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x3a')});})['catch'](handleError(_0x5d4be9));};exports[_0xb984('0x3b')]=function(_0x40666f,_0x424f65){logger[_0xb984('0xf')](_0xb984('0x3c'),_0x40666f[_0xb984('0x2b')]);var _0x2097e6=holdValidation[_0xb984('0x9')](_0x40666f[_0xb984('0x2b')]);if(_0x2097e6[_0xb984('0x2c')]>0x0){return _0x424f65['status'](0x190)[_0xb984('0x2d')](_0x2097e6);}var _0x71880c=_0x40666f['body'][_0xb984('0x2e')];var _0x436597=_0x40666f[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x71880c)[_0xb984('0x1b')](function(_0x49dde7){logger[_0xb984('0xf')](_0xb984('0x32'),_0x49dde7[_0xb984('0x16')]);emit(util[_0xb984('0x33')]('user:%s',_0x49dde7[_0xb984('0x16')]),_0xb984('0x3d'),{'sessionId':_0x436597});return _0x424f65[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x3e')});})[_0xb984('0x1f')](handleError(_0x424f65));};exports[_0xb984('0x3f')]=function(_0x445f90,_0xc6389d){logger['info'](_0xb984('0x40'),_0x445f90[_0xb984('0x2b')]);var _0x3a7cbb=unholdValidation['validate'](_0x445f90[_0xb984('0x2b')]);if(_0x3a7cbb[_0xb984('0x2c')]>0x0){return _0xc6389d['status'](0x190)[_0xb984('0x2d')](_0x3a7cbb);}var _0x481eac=_0x445f90[_0xb984('0x2b')][_0xb984('0x2e')];var _0x5a1a34=_0x445f90[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x481eac)[_0xb984('0x1b')](function(_0x3ddeb5){logger[_0xb984('0xf')](_0xb984('0x32'),_0x3ddeb5['name']);emit(util[_0xb984('0x33')]('user:%s',_0x3ddeb5[_0xb984('0x16')]),_0xb984('0x41'),{'sessionId':_0x5a1a34});return _0xc6389d[_0xb984('0x17')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0xb984('0x1f')](handleError(_0xc6389d));};exports[_0xb984('0x42')]=function(_0x56ad15,_0x493a8b){logger[_0xb984('0xf')](_0xb984('0x43'),_0x493a8b[_0xb984('0x2b')]);var _0x3daaa0=callsValidation[_0xb984('0x9')](_0x56ad15[_0xb984('0x2b')]);if(_0x3daaa0['length']>0x0){return _0x493a8b['status'](0x190)[_0xb984('0x2d')](_0x3daaa0);}var _0x22ddf=_0x56ad15['body'][_0xb984('0x2e')];var _0x159835=respondWithRpcPromise(_0xb984('0x23'));var _0x317cd8=getAgent(_0x22ddf);return Promise['all']([_0x159835,_0x317cd8])['then'](function(_0x226db2){var _0x36a9eb=_0x226db2[0x0];var _0x2fc1f7=_0x226db2[0x1];var _0x29c79d=_[_0xb984('0x44')](_0x36a9eb[_0xb984('0x45')],function(_0x49ecfd){return _0x49ecfd[_0xb984('0x25')]==_0x2fc1f7['id'];});return _0x493a8b[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'count':_0x29c79d[_0xb984('0x2c')],'rows':_0x29c79d});})[_0xb984('0x1f')](handleError(_0x493a8b));};exports[_0xb984('0x46')]=function(_0x575503,_0x55852d){logger['info'](_0xb984('0x47'),_0x575503[_0xb984('0x2b')]);var _0x36ca94=conferenceValidation[_0xb984('0x9')](_0x575503[_0xb984('0x2b')]);if(_0x36ca94['length']>0x0){return _0x55852d[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x36ca94);}var _0x356442=_0x575503['body'][_0xb984('0x2e')];return getAgent(_0x356442)[_0xb984('0x1b')](function(_0x529e28){logger['info'](_0xb984('0x32'),_0x529e28['name']);emit(util['format'](_0xb984('0x34'),_0x529e28['name']),_0xb984('0x48'));return _0x55852d[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x49')});})[_0xb984('0x1f')](handleError(_0x55852d));};exports[_0xb984('0x4a')]=function(_0x145052,_0x1a81c3){logger[_0xb984('0xf')](_0xb984('0x4b'),_0x145052[_0xb984('0x2b')]);var _0x1d9213=transferValidation['validate'](_0x145052[_0xb984('0x2b')]);if(_0x1d9213[_0xb984('0x2c')]>0x0){return _0x1a81c3[_0xb984('0x17')](0x190)['json'](_0x1d9213);}var _0x54abb4=_0x145052[_0xb984('0x2b')][_0xb984('0x2e')];var _0x74fc95=_0x145052['body'][_0xb984('0x26')];var _0x35132b=_0x145052[_0xb984('0x2b')][_0xb984('0x4c')];return getAgent(_0x54abb4)[_0xb984('0x1b')](function(_0x1793e2){logger[_0xb984('0xf')](_0xb984('0x32'),_0x1793e2[_0xb984('0x16')]);emit(util[_0xb984('0x33')](_0xb984('0x34'),_0x1793e2[_0xb984('0x16')]),_0xb984('0x4d'),{'sessionId':_0x74fc95,'transferNumber':_0x35132b});return _0x1a81c3[_0xb984('0x17')](0xc8)['json']({'error':![],'message':_0xb984('0x4e')});})['catch'](handleError(_0x1a81c3));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 888c410..bb9e797 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 _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 +var _0xc867=['removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','create','addAnswer','addAgents','/:id/notify','notify','/:id/send','send','put','/:id','delete','destroy','removeDispositions'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xc867,0xbb));var _0x7c86=function(_0x1dae2a,_0x11ed5e){_0x1dae2a=_0x1dae2a-0x0;var _0x38f211=_0xc867[_0x1dae2a];return _0x38f211;};'use strict';var multer=require(_0x7c86('0x0'));var util=require('util');var path=require(_0x7c86('0x1'));var timeout=require(_0x7c86('0x2'));var express=require(_0x7c86('0x3'));var router=express[_0x7c86('0x4')]();var fs_extra=require(_0x7c86('0x5'));var auth=require(_0x7c86('0x6'));var interaction=require(_0x7c86('0x7'));var config=require(_0x7c86('0x8'));var controller=require(_0x7c86('0x9'));router[_0x7c86('0xa')]('/',auth[_0x7c86('0xb')](),controller[_0x7c86('0xc')]);router[_0x7c86('0xa')]('/describe',auth[_0x7c86('0xb')](),controller[_0x7c86('0xd')]);router[_0x7c86('0xa')]('/:id',auth[_0x7c86('0xb')](),controller[_0x7c86('0xe')]);router[_0x7c86('0xa')](_0x7c86('0xf'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x10')]);router[_0x7c86('0xa')](_0x7c86('0x11'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x12')]);router[_0x7c86('0xa')](_0x7c86('0x13'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x14')]);router[_0x7c86('0xa')]('/:id/applications',auth[_0x7c86('0xb')](),controller[_0x7c86('0x15')]);router[_0x7c86('0x16')]('/',auth[_0x7c86('0xb')](),controller[_0x7c86('0x17')]);router[_0x7c86('0x16')](_0x7c86('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7c86('0x18')]);router[_0x7c86('0x16')](_0x7c86('0x13'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x19')]);router[_0x7c86('0x16')]('/:id/applications',auth[_0x7c86('0xb')](),controller['addApplications']);router[_0x7c86('0x16')](_0x7c86('0x1a'),controller[_0x7c86('0x1b')]);router[_0x7c86('0x16')](_0x7c86('0x1c'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x1d')]);router[_0x7c86('0x1e')](_0x7c86('0x1f'),auth[_0x7c86('0xb')](),controller['update']);router[_0x7c86('0x20')](_0x7c86('0x1f'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x21')]);router[_0x7c86('0x20')](_0x7c86('0xf'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x22')]);router[_0x7c86('0x20')](_0x7c86('0x11'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x23')]);router['delete'](_0x7c86('0x13'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a4a4213..9f8fa79 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 _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 +var _0xe6ea=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','sinch','TEXT'];(function(_0x5ae591,_0x105872){var _0x3b37ae=function(_0x64a531){while(--_0x64a531){_0x5ae591['push'](_0x5ae591['shift']());}};_0x3b37ae(++_0x105872);}(_0xe6ea,0xb2));var _0xae6e=function(_0x54ac77,_0x4dbac8){_0x54ac77=_0x54ac77-0x0;var _0x4ec57e=_0xe6ea[_0x54ac77];return _0x4ec57e;};'use strict';var Sequelize=require(_0xae6e('0x0'));var rs=require(_0xae6e('0x1'));module[_0xae6e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xae6e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xae6e('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xae6e('0x5')]();}},'phone':{'type':Sequelize[_0xae6e('0x4')]},'type':{'type':Sequelize[_0xae6e('0x6')]('twilio',_0xae6e('0x7'))},'accountSid':{'type':Sequelize[_0xae6e('0x4')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xae6e('0x8')],'defaultValue':function(){return _0xae6e('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xae6e('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xae6e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xae6e('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae6e('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae6e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae6e('0xb')],'comment':_0xae6e('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xae6e('0xa')],'defaultValue':![],'comment':_0xae6e('0xd'),'set':function(_0x211ae8){if(!_0x211ae8){this[_0xae6e('0xe')](_0xae6e('0xf'),null);}this[_0xae6e('0xe')](_0xae6e('0x10'),_0x211ae8);}},'description':{'type':Sequelize[_0xae6e('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index a6c4a35..f632165 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 _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 +var _0x3558=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','json','getApplications','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','twilio','from','From','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','AttachmentId','UserId','applications','unshift','agent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','dataValues','Messages','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','sendStatus','status','undefined','limit','offset','count','Content-Range','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappAccount','includeAll','findAll','rows','catch','show','params','keys','include','create','user','role','get','find','userProfileId'];(function(_0x2dbe7e,_0x1866e5){var _0x15f7e4=function(_0x1b9161){while(--_0x1b9161){_0x2dbe7e['push'](_0x2dbe7e['shift']());}};_0x15f7e4(++_0x1866e5);}(_0x3558,0x67));var _0x8355=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x3558[_0x4fbfd9];return _0x31dc94;};'use strict';var emlformat=require(_0x8355('0x0'));var rimraf=require(_0x8355('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8355('0x2'));var rp=require('request-promise');var moment=require(_0x8355('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8355('0x4'));var util=require(_0x8355('0x5'));var path=require('path');var sox=require(_0x8355('0x6'));var csv=require(_0x8355('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8355('0x8'));var _=require(_0x8355('0x9'));var squel=require(_0x8355('0xa'));var crypto=require(_0x8355('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8355('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8355('0xc'));var authService=require(_0x8355('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x8355('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8355('0xf'))('api');var utils=require(_0x8355('0x10'));var config=require(_0x8355('0x11'));var licenseUtil=require(_0x8355('0x12'));var db=require('../../mysqldb')['db'];config[_0x8355('0x13')]=_[_0x8355('0x14')](config[_0x8355('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x8355('0x15'))(new Redis(config[_0x8355('0x13')]));require('./whatsappAccount.socket')[_0x8355('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8355('0x17')][_0x8355('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x47958f,_0xeee4b7,_0x5ae87b,_0x456e48){return new BPromise(function(_0x53f377,_0x35bce8){var _0x5486b8=_0x456e48||client;return _0x5486b8[_0x8355('0x19')](_0x47958f,_0x5ae87b)[_0x8355('0x1a')](function(_0x1aaaea){logger['info'](_0x8355('0x1b'),_0xeee4b7,_0x8355('0x1c'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xeee4b7,'request\x20sent',JSON[_0x8355('0x1d')](_0x1aaaea));if(_0x1aaaea['error']){if(_0x1aaaea[_0x8355('0x1e')][_0x8355('0x1f')]===0x1f4){logger[_0x8355('0x1e')](_0x8355('0x1b'),_0xeee4b7,_0x1aaaea[_0x8355('0x1e')][_0x8355('0x20')]);return _0x35bce8(_0x1aaaea['error'][_0x8355('0x20')]);}logger[_0x8355('0x1e')](_0x8355('0x1b'),_0xeee4b7,_0x1aaaea[_0x8355('0x1e')][_0x8355('0x20')]);return _0x53f377(_0x1aaaea[_0x8355('0x1e')][_0x8355('0x20')]);}else{logger[_0x8355('0x21')](_0x8355('0x1b'),_0xeee4b7,_0x8355('0x1c'));_0x53f377(_0x1aaaea['result'][_0x8355('0x20')]);}})['catch'](function(_0x3768da){logger['error'](_0x8355('0x1b'),_0xeee4b7,_0x3768da);_0x35bce8(_0x3768da);});});}function respondWithStatusCode(_0x50488a,_0x182392){_0x182392=_0x182392||0xcc;return function(_0x44b696){if(_0x44b696){return _0x50488a[_0x8355('0x22')](_0x182392);}return _0x50488a[_0x8355('0x23')](_0x182392)['end']();};}function respondWithResult(_0x1032fe,_0x107c66){_0x107c66=_0x107c66||0xc8;return function(_0x564551){if(_0x564551){return _0x1032fe[_0x8355('0x23')](_0x107c66)['json'](_0x564551);}};}function respondWithFilteredResult(_0x34fbf2,_0x422abe){return function(_0x2ee409){if(_0x2ee409){var _0x38a5bb=typeof _0x422abe['offset']===_0x8355('0x24')&&typeof _0x422abe[_0x8355('0x25')]===_0x8355('0x24');var _0x256261=_0x2ee409['count'];var _0x20135b=_0x38a5bb?0x0:_0x422abe[_0x8355('0x26')];var _0x1d5b32=_0x38a5bb?_0x2ee409[_0x8355('0x27')]:_0x422abe[_0x8355('0x26')]+_0x422abe['limit'];var _0x3847c7;if(_0x1d5b32>=_0x256261){_0x1d5b32=_0x256261;_0x3847c7=0xc8;}else{_0x3847c7=0xce;}_0x34fbf2[_0x8355('0x23')](_0x3847c7);return _0x34fbf2['set'](_0x8355('0x28'),_0x20135b+'-'+_0x1d5b32+'/'+_0x256261)['json'](_0x2ee409);}return null;};}function patchUpdates(_0x425356){return function(_0x51d2cc){try{jsonpatch['apply'](_0x51d2cc,_0x425356,!![]);}catch(_0x1ba3e2){return BPromise[_0x8355('0x29')](_0x1ba3e2);}return _0x51d2cc[_0x8355('0x2a')]();};}function saveUpdates(_0x37baec,_0x29224b){return function(_0x1a287f){if(_0x1a287f){return _0x1a287f[_0x8355('0x2b')](_0x37baec)[_0x8355('0x1a')](function(_0x526399){return _0x526399;});}return null;};}function removeEntity(_0x50bf62,_0x102fab){return function(_0x5221f3){if(_0x5221f3){return _0x5221f3[_0x8355('0x2c')]()[_0x8355('0x1a')](function(){var _0x41203d=_0x5221f3['get']({'plain':!![]});var _0x6963cc=_0x8355('0x2d');return db[_0x8355('0x2e')][_0x8355('0x2c')]({'where':{'type':_0x6963cc,'resourceId':_0x41203d['id']}})[_0x8355('0x1a')](function(){return _0x5221f3;});})['then'](function(){_0x50bf62['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x272ba7,_0x2386b4){return function(_0x10e31e){if(!_0x10e31e){_0x272ba7[_0x8355('0x22')](0x194);}return _0x10e31e;};}function handleError(_0x287f3e,_0x9d834a){_0x9d834a=_0x9d834a||0x1f4;return function(_0x444ce4){logger[_0x8355('0x1e')](_0x444ce4['stack']);if(_0x444ce4[_0x8355('0x2f')]){delete _0x444ce4[_0x8355('0x2f')];}_0x287f3e[_0x8355('0x23')](_0x9d834a)[_0x8355('0x30')](_0x444ce4);};}exports[_0x8355('0x31')]=function(_0x512ed1,_0x399d26){var _0x2c2980={'include':[{'model':db[_0x8355('0x32')],'as':_0x8355('0x33')}]},_0x440dd9={},_0xb95cec={'count':0x0,'rows':[]};var _0x490132=_[_0x8355('0x34')](db['WhatsappAccount'][_0x8355('0x35')],function(_0x30ecc8){return{'name':_0x30ecc8[_0x8355('0x36')],'type':_0x30ecc8[_0x8355('0x37')][_0x8355('0x38')]};});_0x440dd9[_0x8355('0x39')]=_['map'](_0x490132,_0x8355('0x2f'));_0x440dd9[_0x8355('0x3a')]=_['keys'](_0x512ed1[_0x8355('0x3a')]);_0x440dd9[_0x8355('0x3b')]=_[_0x8355('0x3c')](_0x440dd9[_0x8355('0x39')],_0x440dd9['query']);_0x2c2980[_0x8355('0x3d')]=_[_0x8355('0x3c')](_0x440dd9[_0x8355('0x39')],qs[_0x8355('0x3e')](_0x512ed1[_0x8355('0x3a')][_0x8355('0x3e')]));_0x2c2980[_0x8355('0x3d')]=_0x2c2980['attributes'][_0x8355('0x3f')]?_0x2c2980[_0x8355('0x3d')]:_0x440dd9['model'];if(!_0x512ed1[_0x8355('0x3a')][_0x8355('0x40')](_0x8355('0x41'))){_0x2c2980[_0x8355('0x25')]=qs[_0x8355('0x25')](_0x512ed1['query'][_0x8355('0x25')]);_0x2c2980[_0x8355('0x26')]=qs['offset'](_0x512ed1['query'][_0x8355('0x26')]);}_0x2c2980[_0x8355('0x42')]=qs[_0x8355('0x43')](_0x512ed1[_0x8355('0x3a')][_0x8355('0x43')]);_0x2c2980[_0x8355('0x44')]=qs[_0x8355('0x3b')](_[_0x8355('0x45')](_0x512ed1[_0x8355('0x3a')],_0x440dd9[_0x8355('0x3b')]),_0x490132);if(_0x512ed1[_0x8355('0x3a')]['filter']){_0x2c2980[_0x8355('0x44')]=_[_0x8355('0x46')](_0x2c2980['where'],{'$or':_['map'](_0x490132,function(_0x27b2cf){if(_0x27b2cf[_0x8355('0x37')]!==_0x8355('0x47')){var _0x456fb2={};_0x456fb2[_0x27b2cf[_0x8355('0x2f')]]={'$like':'%'+_0x512ed1['query'][_0x8355('0x48')]+'%'};return _0x456fb2;}})});}_0x2c2980=_['merge']({},_0x2c2980,_0x512ed1[_0x8355('0x49')]);var _0x49b84b={'where':_0x2c2980[_0x8355('0x44')]};return db[_0x8355('0x4a')][_0x8355('0x27')](_0x49b84b)[_0x8355('0x1a')](function(_0x25c1f3){_0xb95cec['count']=_0x25c1f3;if(_0x512ed1[_0x8355('0x3a')][_0x8355('0x4b')]){_0x2c2980['include']=[{'all':!![]}];}return db[_0x8355('0x4a')][_0x8355('0x4c')](_0x2c2980);})[_0x8355('0x1a')](function(_0x903869){_0xb95cec[_0x8355('0x4d')]=_0x903869;return _0xb95cec;})[_0x8355('0x1a')](respondWithFilteredResult(_0x399d26,_0x2c2980))[_0x8355('0x4e')](handleError(_0x399d26,null));};exports[_0x8355('0x4f')]=function(_0x4ec9ce,_0x27fbfa){var _0x3f4a80={'raw':![],'where':{'id':_0x4ec9ce[_0x8355('0x50')]['id']},'include':[{'model':db[_0x8355('0x32')],'as':'mandatoryDispositionPause'}]},_0x3d9bef={};_0x3d9bef[_0x8355('0x39')]=_[_0x8355('0x51')](db['WhatsappAccount'][_0x8355('0x35')]);_0x3d9bef[_0x8355('0x3a')]=_[_0x8355('0x51')](_0x4ec9ce[_0x8355('0x3a')]);_0x3d9bef[_0x8355('0x3b')]=_[_0x8355('0x3c')](_0x3d9bef[_0x8355('0x39')],_0x3d9bef[_0x8355('0x3a')]);_0x3f4a80[_0x8355('0x3d')]=_['intersection'](_0x3d9bef[_0x8355('0x39')],qs[_0x8355('0x3e')](_0x4ec9ce['query'][_0x8355('0x3e')]));_0x3f4a80[_0x8355('0x3d')]=_0x3f4a80['attributes'][_0x8355('0x3f')]?_0x3f4a80['attributes']:_0x3d9bef[_0x8355('0x39')];if(_0x4ec9ce[_0x8355('0x3a')][_0x8355('0x4b')]){_0x3f4a80[_0x8355('0x52')]=[{'all':!![]}];}_0x3f4a80=_['merge']({},_0x3f4a80,_0x4ec9ce['options']);return db[_0x8355('0x4a')]['find'](_0x3f4a80)[_0x8355('0x1a')](handleEntityNotFound(_0x27fbfa,null))['then'](respondWithResult(_0x27fbfa,null))['catch'](handleError(_0x27fbfa,null));};exports[_0x8355('0x53')]=function(_0x158b22,_0x576616){return db[_0x8355('0x4a')][_0x8355('0x53')](_0x158b22['body'],{})[_0x8355('0x1a')](function(_0x39314b){var _0x5d0587=_0x158b22[_0x8355('0x54')]['get']({'plain':!![]});if(!_0x5d0587)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d0587[_0x8355('0x55')]==='user'){var _0x4eb7c5=_0x39314b[_0x8355('0x56')]({'plain':!![]});var _0x503495=_0x8355('0x2d');return db['UserProfileSection'][_0x8355('0x57')]({'where':{'name':_0x503495,'userProfileId':_0x5d0587[_0x8355('0x58')]},'raw':!![]})[_0x8355('0x1a')](function(_0x299fb0){if(_0x299fb0&&_0x299fb0[_0x8355('0x59')]===0x0){return db[_0x8355('0x2e')][_0x8355('0x53')]({'name':_0x4eb7c5[_0x8355('0x2f')],'resourceId':_0x4eb7c5['id'],'type':_0x299fb0[_0x8355('0x2f')],'sectionId':_0x299fb0['id']},{})[_0x8355('0x1a')](function(){return _0x39314b;});}else{return _0x39314b;}})[_0x8355('0x4e')](function(_0x453d5e){logger[_0x8355('0x1e')](_0x8355('0x5a'),_0x453d5e);throw _0x453d5e;});}return _0x39314b;})[_0x8355('0x1a')](respondWithResult(_0x576616,0xc9))[_0x8355('0x4e')](handleError(_0x576616,null));};exports[_0x8355('0x2b')]=function(_0x28d4b4,_0x440c11){if(_0x28d4b4[_0x8355('0x5b')]['id']){delete _0x28d4b4[_0x8355('0x5b')]['id'];}return db[_0x8355('0x4a')]['find']({'where':{'id':_0x28d4b4[_0x8355('0x50')]['id']},'include':[{'model':db[_0x8355('0x32')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x440c11,null))[_0x8355('0x1a')](saveUpdates(_0x28d4b4[_0x8355('0x5b')],null))['then'](respondWithResult(_0x440c11,null))[_0x8355('0x4e')](handleError(_0x440c11,null));};exports[_0x8355('0x2c')]=function(_0x26ac73,_0x39ace5){return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0x26ac73[_0x8355('0x50')]['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0x39ace5,null))['then'](removeEntity(_0x39ace5,null))[_0x8355('0x4e')](handleError(_0x39ace5,null));};exports['describe']=function(_0xcf41ea,_0x5d5151){return db['WhatsappAccount'][_0x8355('0x5c')]()[_0x8355('0x1a')](respondWithResult(_0x5d5151,null))[_0x8355('0x4e')](handleError(_0x5d5151,null));};exports[_0x8355('0x5d')]=function(_0x290eab,_0xd346a7,_0x219d08){if(_0x290eab[_0x8355('0x5b')]['id']){delete _0x290eab[_0x8355('0x5b')]['id'];}return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0x290eab['params']['id']}})['then'](handleEntityNotFound(_0xd346a7,null))[_0x8355('0x1a')](function(_0x4085c7){if(_0x4085c7){_0x290eab['body'][_0x8355('0x5e')]=_0x4085c7['id'];return db['Disposition'][_0x8355('0x53')](_0x290eab[_0x8355('0x5b')]);}})[_0x8355('0x1a')](respondWithResult(_0xd346a7,null))[_0x8355('0x4e')](handleError(_0xd346a7,null));};exports[_0x8355('0x5f')]=function(_0x12c12b,_0x19cc7c,_0x4199bb){var _0x2ddcba={'raw':![],'where':{}};var _0x3d6cd8={};var _0x449b67={'count':0x0,'rows':[]};return db[_0x8355('0x4a')][_0x8355('0x60')]({'where':{'id':_0x12c12b[_0x8355('0x50')]['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0x19cc7c,null))[_0x8355('0x1a')](function(_0xfe5747){if(_0xfe5747){_0x3d6cd8[_0x8355('0x39')]=_[_0x8355('0x51')](db[_0x8355('0x61')]['rawAttributes']);_0x3d6cd8[_0x8355('0x3a')]=_[_0x8355('0x51')](_0x12c12b[_0x8355('0x3a')]);_0x3d6cd8[_0x8355('0x3b')]=_['intersection'](_0x3d6cd8[_0x8355('0x39')],_0x3d6cd8['query']);_0x2ddcba[_0x8355('0x3d')]=_[_0x8355('0x3c')](_0x3d6cd8[_0x8355('0x39')],qs[_0x8355('0x3e')](_0x12c12b[_0x8355('0x3a')]['fields']));_0x2ddcba[_0x8355('0x3d')]=_0x2ddcba[_0x8355('0x3d')]['length']?_0x2ddcba[_0x8355('0x3d')]:_0x3d6cd8[_0x8355('0x39')];if(!_0x12c12b[_0x8355('0x3a')]['hasOwnProperty'](_0x8355('0x41'))){_0x2ddcba[_0x8355('0x25')]=qs['limit'](_0x12c12b[_0x8355('0x3a')][_0x8355('0x25')]);_0x2ddcba[_0x8355('0x26')]=qs[_0x8355('0x26')](_0x12c12b['query'][_0x8355('0x26')]);}_0x2ddcba[_0x8355('0x42')]=qs[_0x8355('0x43')](_0x12c12b['query'][_0x8355('0x43')]);_0x2ddcba['where']=qs[_0x8355('0x3b')](_['pick'](_0x12c12b[_0x8355('0x3a')],_0x3d6cd8[_0x8355('0x3b')]));_0x2ddcba[_0x8355('0x44')][_0x8355('0x5e')]=_0xfe5747['id'];if(_0x12c12b[_0x8355('0x3a')][_0x8355('0x48')]){_0x2ddcba['where']=_[_0x8355('0x46')](_0x2ddcba[_0x8355('0x44')],{'$or':_[_0x8355('0x34')](_0x2ddcba[_0x8355('0x3d')],function(_0x37c2c6){var _0x139f33={};_0x139f33[_0x37c2c6]={'$like':'%'+_0x12c12b[_0x8355('0x3a')][_0x8355('0x48')]+'%'};return _0x139f33;})});}_0x2ddcba=_['merge']({},_0x2ddcba,_0x12c12b['options']);return db[_0x8355('0x61')][_0x8355('0x27')]({'where':_0x2ddcba['where']})[_0x8355('0x1a')](function(_0x3527d4){_0x449b67['count']=_0x3527d4;if(_0x12c12b[_0x8355('0x3a')][_0x8355('0x4b')]){_0x2ddcba[_0x8355('0x52')]=[{'all':!![]}];}return db[_0x8355('0x61')][_0x8355('0x4c')](_0x2ddcba);})['then'](function(_0x41dc57){_0x449b67['rows']=_0x41dc57;return _0x449b67;});}})[_0x8355('0x1a')](respondWithFilteredResult(_0x19cc7c,_0x2ddcba))['catch'](handleError(_0x19cc7c,null));};exports[_0x8355('0x62')]=function(_0x1f7fe4,_0x1d6c89,_0x2ef9a9){return db['WhatsappAccount'][_0x8355('0x57')]({'where':{'id':_0x1f7fe4[_0x8355('0x50')]['id']}})['then'](handleEntityNotFound(_0x1d6c89,null))[_0x8355('0x1a')](function(_0x4b941f){if(_0x4b941f){return _0x4b941f[_0x8355('0x62')](_0x1f7fe4[_0x8355('0x3a')][_0x8355('0x63')]);}})[_0x8355('0x1a')](respondWithStatusCode(_0x1d6c89,null))[_0x8355('0x4e')](handleError(_0x1d6c89,null));};exports[_0x8355('0x64')]=function(_0x42881b,_0x5665ee,_0x15373a){if(_0x42881b[_0x8355('0x5b')]['id']){delete _0x42881b['body']['id'];}return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0x42881b['params']['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0x5665ee,null))[_0x8355('0x1a')](function(_0x31dda0){if(_0x31dda0){_0x42881b[_0x8355('0x5b')][_0x8355('0x5e')]=_0x31dda0['id'];return db['CannedAnswer'][_0x8355('0x53')](_0x42881b[_0x8355('0x5b')]);}})[_0x8355('0x1a')](respondWithResult(_0x5665ee,null))[_0x8355('0x4e')](handleError(_0x5665ee,null));};exports[_0x8355('0x65')]=function(_0x3158de,_0x215343,_0x5b79ed){var _0x1bb563={'raw':![],'where':{}};var _0x491f9b={};var _0x1cbcd1={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8355('0x60')]({'where':{'id':_0x3158de[_0x8355('0x50')]['id']}})['then'](handleEntityNotFound(_0x215343,null))[_0x8355('0x1a')](function(_0x35af79){if(_0x35af79){_0x491f9b['model']=_[_0x8355('0x51')](db[_0x8355('0x66')]['rawAttributes']);_0x491f9b[_0x8355('0x3a')]=_[_0x8355('0x51')](_0x3158de['query']);_0x491f9b[_0x8355('0x3b')]=_['intersection'](_0x491f9b['model'],_0x491f9b['query']);_0x1bb563[_0x8355('0x3d')]=_[_0x8355('0x3c')](_0x491f9b[_0x8355('0x39')],qs[_0x8355('0x3e')](_0x3158de[_0x8355('0x3a')]['fields']));_0x1bb563['attributes']=_0x1bb563[_0x8355('0x3d')][_0x8355('0x3f')]?_0x1bb563[_0x8355('0x3d')]:_0x491f9b[_0x8355('0x39')];if(!_0x3158de[_0x8355('0x3a')][_0x8355('0x40')](_0x8355('0x41'))){_0x1bb563[_0x8355('0x25')]=qs[_0x8355('0x25')](_0x3158de[_0x8355('0x3a')]['limit']);_0x1bb563['offset']=qs['offset'](_0x3158de['query'][_0x8355('0x26')]);}_0x1bb563[_0x8355('0x42')]=qs[_0x8355('0x43')](_0x3158de[_0x8355('0x3a')]['sort']);_0x1bb563[_0x8355('0x44')]=qs[_0x8355('0x3b')](_[_0x8355('0x45')](_0x3158de[_0x8355('0x3a')],_0x491f9b['filters']));_0x1bb563[_0x8355('0x44')][_0x8355('0x5e')]=_0x35af79['id'];if(_0x3158de[_0x8355('0x3a')][_0x8355('0x48')]){_0x1bb563[_0x8355('0x44')]=_[_0x8355('0x46')](_0x1bb563[_0x8355('0x44')],{'$or':_[_0x8355('0x34')](_0x1bb563['attributes'],function(_0x2addd6){var _0x1ae7c1={};_0x1ae7c1[_0x2addd6]={'$like':'%'+_0x3158de[_0x8355('0x3a')]['filter']+'%'};return _0x1ae7c1;})});}_0x1bb563=_[_0x8355('0x46')]({},_0x1bb563,_0x3158de[_0x8355('0x49')]);return db[_0x8355('0x66')][_0x8355('0x27')]({'where':_0x1bb563['where']})[_0x8355('0x1a')](function(_0x18e1aa){_0x1cbcd1['count']=_0x18e1aa;if(_0x3158de[_0x8355('0x3a')][_0x8355('0x4b')]){_0x1bb563[_0x8355('0x52')]=[{'all':!![]}];}return db[_0x8355('0x66')][_0x8355('0x4c')](_0x1bb563);})[_0x8355('0x1a')](function(_0x22ece7){_0x1cbcd1[_0x8355('0x4d')]=_0x22ece7;return _0x1cbcd1;});}})[_0x8355('0x1a')](respondWithFilteredResult(_0x215343,_0x1bb563))[_0x8355('0x4e')](handleError(_0x215343,null));};exports['removeAnswers']=function(_0x9b44f3,_0x3f1c1a,_0x43b2cf){return db['WhatsappAccount'][_0x8355('0x57')]({'where':{'id':_0x9b44f3[_0x8355('0x50')]['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0x3f1c1a,null))[_0x8355('0x1a')](function(_0x18877a){if(_0x18877a){return _0x18877a[_0x8355('0x67')](_0x9b44f3[_0x8355('0x3a')]['ids']);}})[_0x8355('0x1a')](respondWithStatusCode(_0x3f1c1a,null))[_0x8355('0x4e')](handleError(_0x3f1c1a,null));};exports[_0x8355('0x68')]=function(_0x3d07a6,_0x172ba4,_0x3a3d0f){return db['WhatsappAccount'][_0x8355('0x57')]({'where':{'id':_0x3d07a6[_0x8355('0x50')]['id']}})['then'](handleEntityNotFound(_0x172ba4,null))[_0x8355('0x1a')](function(_0x375dda){if(_0x375dda){return _0x375dda['addAgents'](_0x3d07a6[_0x8355('0x5b')][_0x8355('0x63')],_[_0x8355('0x69')](_0x3d07a6[_0x8355('0x5b')],['ids','id'])||{})[_0x8355('0x6a')](function(_0x36fe2c){for(var _0x2b3257=0x0;_0x2b3257<_0x3d07a6[_0x8355('0x5b')][_0x8355('0x63')][_0x8355('0x3f')];_0x2b3257+=0x1){socket[_0x8355('0x6b')](_0x8355('0x6c'),{'UserId':Number(_0x3d07a6['body']['ids'][_0x2b3257]),'WhatsappAccountId':Number(_0x3d07a6[_0x8355('0x50')]['id'])});}return _0x36fe2c;});}})[_0x8355('0x1a')](respondWithResult(_0x172ba4,null))[_0x8355('0x4e')](handleError(_0x172ba4,null));};exports[_0x8355('0x6d')]=function(_0x5b8c65,_0x165fe4,_0x74fa63){return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0x5b8c65['params']['id']}})['then'](handleEntityNotFound(_0x165fe4,null))[_0x8355('0x1a')](function(_0x5ab59c){if(_0x5ab59c){return _0x5ab59c[_0x8355('0x6d')](_0x5b8c65['query']['ids'])[_0x8355('0x1a')](function(){if(_[_0x8355('0x6e')](_0x5b8c65[_0x8355('0x3a')]['ids'])){for(var _0x40e899=0x0;_0x40e899<_0x5b8c65['query']['ids'][_0x8355('0x3f')];_0x40e899+=0x1){socket[_0x8355('0x6b')]('userWhatsappAccount:remove',{'UserId':Number(_0x5b8c65['query'][_0x8355('0x63')][_0x40e899]),'WhatsappAccountId':Number(_0x5b8c65[_0x8355('0x50')]['id'])});}}else{socket[_0x8355('0x6b')](_0x8355('0x6f'),{'UserId':Number(_0x5b8c65['query']['ids']),'WhatsappAccountId':Number(_0x5b8c65['params']['id'])});}});}})[_0x8355('0x1a')](respondWithStatusCode(_0x165fe4,null))['catch'](handleError(_0x165fe4,null));};exports[_0x8355('0x70')]=function(_0x108beb,_0xf5b354,_0x30efb6){var _0x40072c={};var _0x92c2b7={};var _0xce1b1d;var _0x13f813;return db[_0x8355('0x4a')][_0x8355('0x60')]({'where':{'id':_0x108beb[_0x8355('0x50')]['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0xf5b354,null))['then'](function(_0xeb53a2){if(_0xeb53a2){_0xce1b1d=_0xeb53a2;_0x92c2b7[_0x8355('0x39')]=_[_0x8355('0x51')](db[_0x8355('0x71')][_0x8355('0x35')]);_0x92c2b7[_0x8355('0x3a')]=_['keys'](_0x108beb[_0x8355('0x3a')]);_0x92c2b7[_0x8355('0x3b')]=_[_0x8355('0x3c')](_0x92c2b7[_0x8355('0x39')],_0x92c2b7[_0x8355('0x3a')]);_0x40072c['attributes']=_[_0x8355('0x3c')](_0x92c2b7['model'],qs[_0x8355('0x3e')](_0x108beb[_0x8355('0x3a')][_0x8355('0x3e')]));_0x40072c[_0x8355('0x3d')]=_0x40072c[_0x8355('0x3d')]['length']?_0x40072c[_0x8355('0x3d')]:_0x92c2b7[_0x8355('0x39')];_0x40072c[_0x8355('0x42')]=qs[_0x8355('0x43')](_0x108beb['query'][_0x8355('0x43')]);_0x40072c[_0x8355('0x44')]=qs[_0x8355('0x3b')](_[_0x8355('0x45')](_0x108beb[_0x8355('0x3a')],_0x92c2b7[_0x8355('0x3b')]));if(_0x108beb[_0x8355('0x3a')][_0x8355('0x48')]){_0x40072c[_0x8355('0x44')]=_['merge'](_0x40072c['where'],{'$or':_[_0x8355('0x34')](_0x40072c[_0x8355('0x3d')],function(_0x68d197){var _0x103b9a={};_0x103b9a[_0x68d197]={'$like':'%'+_0x108beb[_0x8355('0x3a')][_0x8355('0x48')]+'%'};return _0x103b9a;})});}_0x40072c=_['merge']({},_0x40072c,_0x108beb[_0x8355('0x49')]);return _0xce1b1d[_0x8355('0x70')](_0x40072c);}})['then'](function(_0x15b4b2){if(_0x15b4b2){_0x13f813=_0x15b4b2[_0x8355('0x3f')];if(!_0x108beb[_0x8355('0x3a')][_0x8355('0x40')](_0x8355('0x41'))){_0x40072c[_0x8355('0x25')]=qs['limit'](_0x108beb[_0x8355('0x3a')][_0x8355('0x25')]);_0x40072c['offset']=qs['offset'](_0x108beb[_0x8355('0x3a')][_0x8355('0x26')]);}return _0xce1b1d[_0x8355('0x70')](_0x40072c);}})[_0x8355('0x1a')](function(_0x58bac5){if(_0x58bac5){return _0x58bac5?{'count':_0x13f813,'rows':_0x58bac5}:null;}})[_0x8355('0x1a')](respondWithResult(_0xf5b354,null))['catch'](handleError(_0xf5b354,null));};exports[_0x8355('0x72')]=function(_0x346ac6,_0x2ac3bf){var _0x4501ee=_0x346ac6[_0x8355('0x50')]['id'];var _0x151d82=_0x346ac6['body'];var _0x1e9ddc=0xc8;var _0x58f01b=null;return db['sequelize'][_0x8355('0x73')]({'isolationLevel':db['sequelize'][_0x8355('0x74')][_0x8355('0x75')][_0x8355('0x76')]},function(_0x504575){return db[_0x8355('0x4a')]['findOne']({'where':{'id':_0x4501ee},'transaction':_0x504575})[_0x8355('0x1a')](function(_0x80c628){if(_0x80c628){return db[_0x8355('0x77')][_0x8355('0x2c')]({'where':{'WhatsappAccountId':_0x4501ee},'transaction':_0x504575})['then'](function(){var _0x5d3e20=_[_0x8355('0x34')](_0x151d82,function(_0x49ef2b){_0x49ef2b[_0x8355('0x5e')]=_0x4501ee;return _0x49ef2b;});return db[_0x8355('0x77')][_0x8355('0x78')](_0x5d3e20,{'transaction':_0x504575});});}else{_0x1e9ddc=0x194;_0x58f01b=[];}});})[_0x8355('0x1a')](function(){if(_0x1e9ddc!==0x194){return db[_0x8355('0x77')][_0x8355('0x79')]({'where':{'WhatsappAccountId':_0x4501ee},'order':_0x8355('0x7a')})['then'](function(_0x4def1a){_0x58f01b=_0x4def1a;});}})[_0x8355('0x4e')](function(_0x509f7c){_0x1e9ddc=0x1f4;logger[_0x8355('0x1e')](_0x509f7c['stack']);if(_0x509f7c[_0x8355('0x2f')]){delete _0x509f7c[_0x8355('0x2f')];}_0x58f01b=_0x509f7c;})[_0x8355('0x7b')](function(){if(_0x58f01b===null){_0x2ac3bf[_0x8355('0x22')](_0x1e9ddc);}else{if(_0x1e9ddc===0x1f4){_0x2ac3bf[_0x8355('0x23')](_0x1e9ddc)[_0x8355('0x30')](_0x58f01b);}else{_0x2ac3bf['status'](_0x1e9ddc)[_0x8355('0x7c')](_0x58f01b);}}});};exports[_0x8355('0x7d')]=function(_0x20382d,_0x207f3a,_0x4aed46){var _0x4769b8={};var _0x3fa0d2={};var _0x339619;var _0x512c3;return db['WhatsappAccount'][_0x8355('0x60')]({'where':{'id':_0x20382d[_0x8355('0x50')]['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0x207f3a,null))['then'](function(_0x482386){if(_0x482386){_0x339619=_0x482386;_0x3fa0d2[_0x8355('0x39')]=_[_0x8355('0x51')](db['WhatsappApplication'][_0x8355('0x35')]);_0x3fa0d2[_0x8355('0x3a')]=_[_0x8355('0x51')](_0x20382d[_0x8355('0x3a')]);_0x3fa0d2[_0x8355('0x3b')]=_[_0x8355('0x3c')](_0x3fa0d2['model'],_0x3fa0d2[_0x8355('0x3a')]);_0x4769b8[_0x8355('0x3d')]=_[_0x8355('0x3c')](_0x3fa0d2[_0x8355('0x39')],qs[_0x8355('0x3e')](_0x20382d[_0x8355('0x3a')][_0x8355('0x3e')]));_0x4769b8[_0x8355('0x3d')]=_0x4769b8[_0x8355('0x3d')]['length']?_0x4769b8[_0x8355('0x3d')]:_0x3fa0d2[_0x8355('0x39')];_0x4769b8[_0x8355('0x42')]=qs[_0x8355('0x43')](_0x20382d[_0x8355('0x3a')][_0x8355('0x43')]);_0x4769b8[_0x8355('0x44')]=qs[_0x8355('0x3b')](_[_0x8355('0x45')](_0x20382d[_0x8355('0x3a')],_0x3fa0d2[_0x8355('0x3b')]));if(_0x20382d['query'][_0x8355('0x48')]){_0x4769b8[_0x8355('0x44')]=_[_0x8355('0x46')](_0x4769b8[_0x8355('0x44')],{'$or':_[_0x8355('0x34')](_0x4769b8[_0x8355('0x3d')],function(_0x45afb2){var _0x5ab011={};_0x5ab011[_0x45afb2]={'$like':'%'+_0x20382d[_0x8355('0x3a')][_0x8355('0x48')]+'%'};return _0x5ab011;})});}_0x4769b8=_[_0x8355('0x46')]({},_0x4769b8,_0x20382d[_0x8355('0x49')]);return _0x339619[_0x8355('0x7d')](_0x4769b8);}})[_0x8355('0x1a')](function(_0x3b8712){if(_0x3b8712){_0x512c3=_0x3b8712[_0x8355('0x3f')];if(!_0x20382d['query'][_0x8355('0x40')](_0x8355('0x41'))){_0x4769b8[_0x8355('0x25')]=qs[_0x8355('0x25')](_0x20382d[_0x8355('0x3a')][_0x8355('0x25')]);_0x4769b8['offset']=qs[_0x8355('0x26')](_0x20382d[_0x8355('0x3a')][_0x8355('0x26')]);}return _0x339619[_0x8355('0x7d')](_0x4769b8);}})['then'](function(_0x5475e7){if(_0x5475e7){return _0x5475e7?{'count':_0x512c3,'rows':_0x5475e7}:null;}})[_0x8355('0x1a')](respondWithResult(_0x207f3a,null))[_0x8355('0x4e')](handleError(_0x207f3a,null));};exports['notify']=function(_0x5dd002,_0x47094e,_0x444008){var _0x51070d={'channel':'whatsapp'};var _0x81f8d9=[];var _0x28cd76=[];var _0x1a6bf2={};return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0x5dd002[_0x8355('0x50')]['id']},'include':[{'model':db[_0x8355('0x77')],'as':_0x8355('0x7e')}]})[_0x8355('0x1a')](handleEntityNotFound(_0x47094e,null))[_0x8355('0x1a')](function(_0x3709bc){_0x51070d[_0x8355('0x7f')]=_0x3709bc;if(_0x51070d['account']&&_0x51070d[_0x8355('0x7f')]['type']===_0x8355('0x80')&&_0x5dd002[_0x8355('0x5b')][_0x8355('0x81')]){if(_0x5dd002[_0x8355('0x5b')][_0x8355('0x81')][_0x8355('0x3f')]===0x0)return;if(_0x5dd002[_0x8355('0x5b')]['statuses'][0x0][_0x8355('0x82')]!==_0x8355('0x83'))return;return db[_0x8355('0x84')]['update']({'read':!![],'readAt':_0x5dd002['body'][_0x8355('0x81')][0x0][_0x8355('0x85')]},{'where':{'messageId':_0x5dd002['body'][_0x8355('0x81')][0x0][_0x8355('0x86')]},'individualHooks':!![]})[_0x8355('0x1a')](function(_0x23dd25){return _0x47094e[_0x8355('0x23')](0xc8)[_0x8355('0x7c')](_0x23dd25);});}_0x51070d['applications']=_[_0x8355('0x87')](_0x3709bc[_0x8355('0x7e')],[_0x8355('0x7a')],[_0x8355('0x88')]);if(_0x51070d[_0x8355('0x7f')][_0x8355('0x7e')]){delete _0x51070d[_0x8355('0x7f')][_0x8355('0x7e')];}return db[_0x8355('0x89')][_0x8355('0x5c')]()[_0x8355('0x1a')](function(_0x44f8b5){if(!_0x44f8b5){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))](_0x8355('0x8c'));}_0x81f8d9=_[_0x8355('0x8d')](_[_0x8355('0x51')](_0x44f8b5),['createdAt','updatedAt']);_0x28cd76=_[_0x8355('0x8d')](_[_0x8355('0x51')](_0x44f8b5),[_0x8355('0x8e'),'updatedAt',_0x8355('0x8f'),_0x8355('0x90')]);_0x51070d['body']={'mapKey':'mobile'};if(_0x51070d[_0x8355('0x7f')]&&_0x51070d[_0x8355('0x7f')][_0x8355('0x37')]===_0x8355('0x91')){_0x51070d[_0x8355('0x5b')][_0x8355('0x92')]=_0x5dd002[_0x8355('0x5b')][_0x8355('0x93')]['replace'](_0x8355('0x94'),'');_0x51070d[_0x8355('0x5b')][_0x8355('0x5b')]=_0x5dd002[_0x8355('0x5b')]['Body'];_0x51070d['body'][_0x8355('0x95')]=_0x5dd002[_0x8355('0x5b')][_0x8355('0x96')];}if(_0x51070d['account']&&_0x51070d['account'][_0x8355('0x37')]==='sinch'){_0x51070d[_0x8355('0x5b')][_0x8355('0x92')]=_0x5dd002[_0x8355('0x5b')][_0x8355('0x97')][0x0][_0x8355('0x92')];_0x51070d['body']['body']=_0x5dd002[_0x8355('0x5b')][_0x8355('0x97')][0x0]['message'][_0x8355('0x5b')];_0x51070d['body'][_0x8355('0x95')]=_0x5dd002[_0x8355('0x5b')]['notifications'][0x0][_0x8355('0x86')];}if(_0x51070d[_0x8355('0x5b')]['id']){delete _0x51070d[_0x8355('0x5b')]['id'];}if(_[_0x8355('0x98')](_0x51070d[_0x8355('0x5b')][_0x8355('0x92')])){throw new db['Sequelize'][(_0x8355('0x8b'))](_0x8355('0x99'));}if(_[_0x8355('0x98')](_0x51070d[_0x8355('0x5b')][_0x8355('0x5b')])||_0x51070d['body'][_0x8355('0x5b')]===''){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))](_0x8355('0x9a'));}if(_['isNil'](_0x51070d[_0x8355('0x5b')][_0x8355('0x9b')])){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))](_0x8355('0x9c')+_0x28cd76);}if(!_['includes'](_0x28cd76,_0x51070d[_0x8355('0x5b')][_0x8355('0x9b')])){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x28cd76);}_0x1a6bf2[_0x51070d[_0x8355('0x5b')][_0x8355('0x9b')]]=_0x51070d[_0x8355('0x5b')][_0x8355('0x92')];return db[_0x8355('0x9d')][_0x8355('0x57')]({'where':{'id':_0x51070d['account']['ListId']},'include':[{'model':db[_0x8355('0x89')],'as':_0x8355('0x9e'),'where':_0x1a6bf2,'limit':0x1,'order':[[_0x8355('0x9f'),_0x8355('0xa0')]]}]});})[_0x8355('0x1a')](handleEntityNotFound(_0x47094e,null))[_0x8355('0x1a')](function(_0x19282f){if(_0x19282f){_0x51070d[_0x8355('0xa1')]=_[_0x8355('0x69')](_0x19282f,[_0x8355('0x9e')]);if(_0x19282f[_0x8355('0x9e')]['length']){return _0x19282f[_0x8355('0x9e')][0x0];}var _0x217b6f=_[_0x8355('0x14')](_0x51070d[_0x8355('0x5b')],{'firstName':_0x51070d[_0x8355('0x5b')][_0x8355('0x92')],'ListId':_0x19282f['id']});_0x217b6f[_0x51070d[_0x8355('0x5b')][_0x8355('0x9b')]]=_0x51070d[_0x8355('0x5b')][_0x8355('0x92')];return db[_0x8355('0x89')][_0x8355('0x53')](_0x217b6f,{'fields':_0x81f8d9,'raw':!![]});}})[_0x8355('0x1a')](handleEntityNotFound(_0x47094e,null))['then'](function(_0x330018){if(_0x330018){_0x51070d[_0x8355('0xa2')]=_0x330018;var _0xa92d5f={'ContactId':_0x330018['id'],'phone':_0x51070d[_0x8355('0x5b')]['from'],'WhatsappAccountId':_0x5dd002[_0x8355('0x50')]['id']};var _0x4e6b2b={'ContactId':_0x330018['id'],'WhatsappAccountId':_0x5dd002[_0x8355('0x50')]['id'],'closed':![]};return db[_0x8355('0xa3')][_0x8355('0x57')]({'where':_0x4e6b2b})['then'](function(_0x35c328){if(_0x35c328){return[_0x35c328,![]];}return db['WhatsappInteraction'][_0x8355('0x53')](_0xa92d5f)['then'](function(_0x38515d){return[_0x38515d,!![]];});});}})[_0x8355('0x6a')](function(_0x326444,_0x22f830){_0x51070d['interaction']=_0x326444['get']({'plain':!![]});_0x51070d[_0x8355('0xa4')][_0x8355('0xa5')]=![];if(_0x22f830){if(_0x51070d['account'][_0x8355('0xa6')]){_0x51070d['applications'][_0x8355('0xa7')]({'id':0x0,'priority':_0x51070d['applications'][_0x8355('0x3f')]+0x1,'app':_0x8355('0xa8'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x51070d[_0x8355('0xa4')][_0x8355('0xa5')]=!![];}return db['WhatsappMessage'][_0x8355('0x53')]({'phone':_0x51070d[_0x8355('0x5b')][_0x8355('0x92')],'messageId':_0x51070d[_0x8355('0x5b')][_0x8355('0x95')],'body':_0x51070d['body'][_0x8355('0x5b')],'WhatsappAccountId':_0x5dd002[_0x8355('0x50')]['id'],'WhatsappInteractionId':_0x326444['id'],'direction':'in','ContactId':_0x326444['ContactId'],'AttachmentId':_0x51070d['body'][_0x8355('0xa9')]});})[_0x8355('0x1a')](function(_0x57b269){_0x51070d[_0x8355('0x20')]=_0x57b269;if(!_0x51070d['interaction']['UserId'])return;return db[_0x8355('0x71')][_0x8355('0x57')]({'attributes':['id',_0x8355('0x2f')],'where':{'id':_0x51070d[_0x8355('0xa4')][_0x8355('0xaa')]}});})[_0x8355('0x1a')](function(_0x559682){if(_0x559682){_0x51070d[_0x8355('0xab')][_0x8355('0xac')]({'id':0x0,'priority':0x0,'app':_0x8355('0xad'),'appdata':_0x559682[_0x8355('0x2f')]+','+(_0x51070d[_0x8355('0x7f')]['waitForTheAssignedAgent']||0xa),'interval':_0x8355('0xae')});}if(!_0x51070d[_0x8355('0xa4')][_0x8355('0xaf')])return;return db[_0x8355('0xb0')][_0x8355('0x57')]({'attributes':['id',_0x8355('0x2f')],'where':{'id':_0x51070d[_0x8355('0xa4')][_0x8355('0xaf')]}});})[_0x8355('0x1a')](function(_0x363785){if(_0x363785){_0x51070d[_0x8355('0xab')][_0x8355('0xac')]({'id':0x0,'priority':0x1,'app':_0x8355('0xb1'),'appdata':_0x363785[_0x8355('0x2f')]+','+(_0x51070d[_0x8355('0x7f')][_0x8355('0xb2')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8355('0xb3'),_0x8355('0xb4'),_0x51070d);})['then'](function(_0x147e90){if(_0x147e90){var _0x2b89e2=0xc8;var _0x175a6e=_0x8355('0xb5');logger[_0x8355('0x21')](_0x8355('0xb6'),_0x175a6e,_0x2b89e2,_0x8355('0xb7'));logger['debug'](_0x8355('0xb8'),_0x175a6e,_0x2b89e2,_0x8355('0xb7'),JSON['stringify'](_0x147e90));if(_0x51070d['account'][_0x8355('0x37')]===_0x8355('0x91')){return _0x47094e[_0x8355('0x23')](_0x2b89e2)['set'](_0x8355('0xb9'),_0x8355('0xba'))[_0x8355('0x30')](_0x8355('0xbb'));}else{return _0x47094e[_0x8355('0x23')](_0x2b89e2)['json'](_0x147e90);}}});})[_0x8355('0x4e')](handleError(_0x47094e,null));};exports[_0x8355('0x30')]=function(_0xfca4a1,_0x219dc6,_0x16ceeb){var _0x4f86b5,_0x6dd46b,_0x294e9c;if(_[_0x8355('0x98')](_0xfca4a1[_0x8355('0x5b')][_0x8355('0x5b')])||_0xfca4a1[_0x8355('0x5b')][_0x8355('0x5b')]===''){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))](_0x8355('0x9a'));}if(_[_0x8355('0x98')](_0xfca4a1[_0x8355('0x5b')]['to'])){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))](_0x8355('0xbc'));}_0x4f86b5=_0xfca4a1[_0x8355('0x5b')]['to'];return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0xfca4a1['params']['id']},'include':[{'model':db[_0x8355('0x9d')],'as':'List','include':[{'model':db[_0x8355('0x89')],'as':_0x8355('0x9e'),'where':{'mobile':_0x4f86b5},'limit':0x1,'order':[[_0x8355('0x9f'),_0x8355('0xa0')]]}]}]})['then'](handleEntityNotFound(_0x219dc6,null))[_0x8355('0x1a')](function(_0x19a1f1){if(_0x19a1f1&&_0x19a1f1['List']){_0x6dd46b=_0x19a1f1[_0x8355('0x56')]({'plain':!![]});if(_0x6dd46b['List']&&_0x6dd46b[_0x8355('0xbd')]['Contacts']['length']){return _0x6dd46b[_0x8355('0xbd')][_0x8355('0x9e')][0x0];}return db[_0x8355('0x89')][_0x8355('0x53')](_['defaults'](_0xfca4a1[_0x8355('0x5b')],{'firstName':_0x4f86b5,'mobile':_0x4f86b5,'phone':_0x4f86b5,'ListId':_0x6dd46b[_0x8355('0x90')]}));}})[_0x8355('0x1a')](handleEntityNotFound(_0x219dc6,null))[_0x8355('0x1a')](function(_0x450542){if(_0x450542){_0x294e9c=_0x450542;return db[_0x8355('0xa3')][_0x8355('0x57')]({'where':{'ContactId':_0x294e9c['id'],'closed':![],'WhatsappAccountId':_0x6dd46b['id']}})['then'](function(_0x317877){if(_0x317877){return[_0x317877,![]];}return db['WhatsappInteraction'][_0x8355('0x53')]({'UserId':_0xfca4a1[_0x8355('0x54')]['id'],'ContactId':_0x294e9c['id'],'WhatsappAccountId':_0x6dd46b['id'],'phone':_0x4f86b5,'firstMsgDirection':'out','Messages':[_['merge'](_0xfca4a1[_0x8355('0x5b')],{'read':![],'body':_0xfca4a1[_0x8355('0x5b')]['body'],'phone':_0x4f86b5,'WhatsappAccountId':_0x6dd46b['id'],'UserId':_0xfca4a1['user']['id'],'ContactId':_0x294e9c['id']})]},{'include':[{'model':db[_0x8355('0x84')],'as':'Messages'}]})[_0x8355('0x1a')](function(_0x499a19){return[_0x499a19,!![]];});});}})['spread'](function(_0xed27b5,_0x3dadd5){if(_0x3dadd5){return _0xed27b5;}return db['WhatsappMessage'][_0x8355('0x53')](_[_0x8355('0x46')](_0xfca4a1['body'],{'read':![],'body':_0xfca4a1[_0x8355('0x5b')]['body'],'phone':_0x4f86b5,'WhatsappAccountId':_0x6dd46b['id'],'WhatsappInteractionId':_0xed27b5['id'],'UserId':_0xfca4a1[_0x8355('0x54')]['id'],'ContactId':_0x294e9c['id']}))[_0x8355('0x1a')](function(_0x1b8d78){_0xed27b5[_0x8355('0xbe')][_0x8355('0xbf')]=[];_0xed27b5[_0x8355('0xbe')][_0x8355('0xbf')][_0x8355('0xa7')](_0x1b8d78[_0x8355('0xbe')]);return _0xed27b5;});})[_0x8355('0x1a')](respondWithResult(_0x219dc6,null))['catch'](handleError(_0x219dc6,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a0888b6..2c03342 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 _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 +var _0x5285=['hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x45423d,_0x5b9263){var _0x2085d6=function(_0x4d4f86){while(--_0x4d4f86){_0x45423d['push'](_0x45423d['shift']());}};_0x2085d6(++_0x5b9263);}(_0x5285,0xca));var _0x5528=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x5285[_0xffa198];return _0x1e4b50;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x5528('0x0'))['db'][_0x5528('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5528('0x2')](0x0);var events={'afterCreate':_0x5528('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5a905e){return function(_0x36569a,_0x29ee9d,_0x74ef5){WhatsappAccountEvents[_0x5528('0x4')](_0x5a905e+':'+_0x36569a['id'],_0x36569a);WhatsappAccountEvents['emit'](_0x5a905e,_0x36569a);_0x74ef5(null);};}for(var e in events){if(events[_0x5528('0x5')](e)){var event=events[e];WhatsappAccount[_0x5528('0x6')](e,emitEvent(event));}}module[_0x5528('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 4d522ec..5e7a065 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 _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 +var _0x2f44=['exports','WhatsappAccount','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5cab7e,_0x464e20){var _0x35c71f=function(_0x5455e6){while(--_0x5455e6){_0x5cab7e['push'](_0x5cab7e['shift']());}};_0x35c71f(++_0x464e20);}(_0x2f44,0x19a));var _0x42f4=function(_0x3d6135,_0x256136){_0x3d6135=_0x3d6135-0x0;var _0x16f3c1=_0x2f44[_0x3d6135];return _0x16f3c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x42f4('0x0'))(_0x42f4('0x1'));var moment=require('moment');var BPromise=require(_0x42f4('0x2'));var rp=require(_0x42f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42f4('0x4'));var config=require(_0x42f4('0x5'));var attributes=require('./whatsappAccount.attributes');module[_0x42f4('0x6')]=function(_0x318886,_0x3bab68){return _0x318886['define'](_0x42f4('0x7'),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 8197d08..4cbee9c 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 _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 +var _0x1e82=['localhost','socket.io-emitter','register','request','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1e82,0x8b));var _0x21e8=function(_0x10f46e,_0x3e9e6d){_0x10f46e=_0x10f46e-0x0;var _0x433756=_0x1e82[_0x10f46e];return _0x433756;};'use strict';var _=require(_0x21e8('0x0'));var util=require(_0x21e8('0x1'));var moment=require(_0x21e8('0x2'));var BPromise=require(_0x21e8('0x3'));var rs=require(_0x21e8('0x4'));var fs=require('fs');var Redis=require(_0x21e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21e8('0x6'));var logger=require(_0x21e8('0x7'))('rpc');var config=require(_0x21e8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21e8('0x9')][_0x21e8('0xa')]({'port':0x232a});config[_0x21e8('0xb')]=_[_0x21e8('0xc')](config['redis'],{'host':_0x21e8('0xd'),'port':0x18eb});var socket=require(_0x21e8('0xe'))(new Redis(config[_0x21e8('0xb')]));require('./whatsappAccount.socket')[_0x21e8('0xf')](socket);function respondWithRpcPromise(_0x20aae0,_0x2f4a82,_0x3fa1da){return new BPromise(function(_0x5c6d17,_0x4d561a){return client[_0x21e8('0x10')](_0x20aae0,_0x3fa1da)['then'](function(_0x131349){logger[_0x21e8('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x2f4a82,_0x21e8('0x12'));logger['debug'](_0x21e8('0x13'),_0x2f4a82,_0x21e8('0x12'),JSON[_0x21e8('0x14')](_0x131349));if(_0x131349['error']){if(_0x131349[_0x21e8('0x15')]['code']===0x1f4){logger[_0x21e8('0x15')](_0x21e8('0x16'),_0x2f4a82,_0x131349[_0x21e8('0x15')]['message']);return _0x4d561a(_0x131349['error'][_0x21e8('0x17')]);}logger[_0x21e8('0x15')](_0x21e8('0x16'),_0x2f4a82,_0x131349[_0x21e8('0x15')][_0x21e8('0x17')]);return _0x5c6d17(_0x131349[_0x21e8('0x15')][_0x21e8('0x17')]);}else{logger[_0x21e8('0x11')](_0x21e8('0x16'),_0x2f4a82,'request\x20sent');_0x5c6d17(_0x131349[_0x21e8('0x18')]['message']);}})['catch'](function(_0x32ec05){logger[_0x21e8('0x15')](_0x21e8('0x16'),_0x2f4a82,_0x32ec05);_0x4d561a(_0x32ec05);});});}exports[_0x21e8('0x19')]=function(_0x5ca78c){var _0x45243f=this;return new Promise(function(_0x1be10b,_0x25b678){return db[_0x21e8('0x1a')][_0x21e8('0x1b')]({'raw':_0x5ca78c[_0x21e8('0x1c')]?_0x5ca78c[_0x21e8('0x1c')][_0x21e8('0x1d')]===undefined?!![]:![]:!![],'where':_0x5ca78c['options']?_0x5ca78c[_0x21e8('0x1c')][_0x21e8('0x1e')]||null:null,'attributes':_0x5ca78c['options']?_0x5ca78c[_0x21e8('0x1c')][_0x21e8('0x1f')]||null:null,'include':_0x5ca78c[_0x21e8('0x1c')]?_0x5ca78c[_0x21e8('0x1c')][_0x21e8('0x20')]?_[_0x21e8('0x21')](_0x5ca78c[_0x21e8('0x1c')][_0x21e8('0x20')],function(_0x565c96){return{'model':db[_0x565c96[_0x21e8('0x22')]],'as':_0x565c96['as'],'attributes':_0x565c96['attributes'],'include':_0x565c96[_0x21e8('0x20')]?_[_0x21e8('0x21')](_0x565c96[_0x21e8('0x20')],function(_0x559509){return{'model':db[_0x559509[_0x21e8('0x22')]],'as':_0x559509['as'],'attributes':_0x559509['attributes'],'include':_0x559509[_0x21e8('0x20')]?_[_0x21e8('0x21')](_0x559509[_0x21e8('0x20')],function(_0x4e7b45){return{'model':db[_0x4e7b45[_0x21e8('0x22')]],'as':_0x4e7b45['as'],'attributes':_0x4e7b45[_0x21e8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x21e8('0x23')](function(_0x5e79c5){logger[_0x21e8('0x11')](_0x21e8('0x19'),_0x5ca78c);logger[_0x21e8('0x24')](_0x21e8('0x19'),_0x5ca78c,JSON[_0x21e8('0x14')](_0x5e79c5));_0x1be10b(_0x5e79c5);})[_0x21e8('0x25')](function(_0x2116f2){logger[_0x21e8('0x15')](_0x21e8('0x19'),_0x2116f2[_0x21e8('0x17')],_0x5ca78c);_0x25b678(_0x45243f[_0x21e8('0x15')](0x1f4,_0x2116f2[_0x21e8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d9d81d0..2afe242 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 _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 +var _0x4c3b=['./whatsappAccount.events','save','remove','update','emit','length','whatsappAccount:'];(function(_0x2d48c8,_0x235edf){var _0x2d14b7=function(_0x4235cb){while(--_0x4235cb){_0x2d48c8['push'](_0x2d48c8['shift']());}};_0x2d14b7(++_0x235edf);}(_0x4c3b,0xe0));var _0xb4c3=function(_0x1eaa26,_0x51b276){_0x1eaa26=_0x1eaa26-0x0;var _0x2aa6f9=_0x4c3b[_0x1eaa26];return _0x2aa6f9;};'use strict';var WhatsappAccountEvents=require(_0xb4c3('0x0'));var events=[_0xb4c3('0x1'),_0xb4c3('0x2'),_0xb4c3('0x3')];function createListener(_0x1c109e,_0x1409c6){return function(_0x53797a){_0x1409c6[_0xb4c3('0x4')](_0x1c109e,_0x53797a);};}function removeListener(_0x435418,_0x494912){return function(){WhatsappAccountEvents['removeListener'](_0x435418,_0x494912);};}exports['register']=function(_0x190c03){for(var _0x2ef280=0x0,_0x15f74e=events[_0xb4c3('0x5')];_0x2ef280<_0x15f74e;_0x2ef280++){var _0x3ddcbb=events[_0x2ef280];var _0x59753e=createListener(_0xb4c3('0x6')+_0x3ddcbb,_0x190c03);WhatsappAccountEvents['on'](_0x3ddcbb,_0x59753e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 58c2220..bd51ac0 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 _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 +var _0xb978=['post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x734698,_0x4c1bbd){var _0x3a5a6b=function(_0x2107ef){while(--_0x2107ef){_0x734698['push'](_0x734698['shift']());}};_0x3a5a6b(++_0x4c1bbd);}(_0xb978,0x124));var _0x8b97=function(_0x5f55d9,_0x37b594){_0x5f55d9=_0x5f55d9-0x0;var _0x35f3b0=_0xb978[_0x5f55d9];return _0x35f3b0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8b97('0x0'));var timeout=require(_0x8b97('0x1'));var express=require(_0x8b97('0x2'));var router=express[_0x8b97('0x3')]();var fs_extra=require(_0x8b97('0x4'));var auth=require(_0x8b97('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b97('0x6'));var controller=require(_0x8b97('0x7'));router[_0x8b97('0x8')]('/',auth[_0x8b97('0x9')](),controller[_0x8b97('0xa')]);router['get'](_0x8b97('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8b97('0xc')]('/',auth[_0x8b97('0x9')](),controller[_0x8b97('0xd')]);router[_0x8b97('0xe')](_0x8b97('0xb'),auth[_0x8b97('0x9')](),controller[_0x8b97('0xf')]);router[_0x8b97('0x10')](_0x8b97('0xb'),auth[_0x8b97('0x9')](),controller[_0x8b97('0x11')]);module[_0x8b97('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 1a8d6e8..0b0c5be 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 _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 +var _0xa5cd=['STRING','noop','*,*,*,*','INTEGER'];(function(_0x6a8b44,_0x23b383){var _0x16fe06=function(_0x1cbb88){while(--_0x1cbb88){_0x6a8b44['push'](_0x6a8b44['shift']());}};_0x16fe06(++_0x23b383);}(_0xa5cd,0xd3));var _0xda5c=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xa5cd[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xda5c('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xda5c('0x1')],'allowNull':![],'defaultValue':_0xda5c('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xda5c('0x1')]},'interval':{'type':Sequelize[_0xda5c('0x1')],'defaultValue':_0xda5c('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4aef8ec..8247897 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 _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 +var _0xdbc6=['create','body','find','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','show','params','rawAttributes','catch'];(function(_0x43218a,_0x467f94){var _0x38c054=function(_0x487e48){while(--_0x487e48){_0x43218a['push'](_0x43218a['shift']());}};_0x38c054(++_0x467f94);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x3b191c,_0x5cba50){_0x3b191c=_0x3b191c-0x0;var _0x56fdb7=_0xdbc6[_0x3b191c];return _0x56fdb7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6dbc('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dbc('0x1'));var moment=require(_0x6dbc('0x2'));var BPromise=require(_0x6dbc('0x3'));var Mustache=require(_0x6dbc('0x4'));var util=require(_0x6dbc('0x5'));var path=require(_0x6dbc('0x6'));var sox=require('sox');var csv=require(_0x6dbc('0x7'));var ejs=require(_0x6dbc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6dbc('0x9'));var squel=require(_0x6dbc('0xa'));var crypto=require(_0x6dbc('0xb'));var jsforce=require(_0x6dbc('0xc'));var deskjs=require(_0x6dbc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6dbc('0xe'));var Papa=require(_0x6dbc('0xf'));var Redis=require('ioredis');var authService=require(_0x6dbc('0x10'));var qs=require(_0x6dbc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6dbc('0x12'));var logger=require(_0x6dbc('0x13'))(_0x6dbc('0x14'));var utils=require(_0x6dbc('0x15'));var config=require(_0x6dbc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x296a9b,_0x1da999){_0x1da999=_0x1da999||0xcc;return function(_0x44591c){if(_0x44591c){return _0x296a9b[_0x6dbc('0x17')](_0x1da999);}return _0x296a9b[_0x6dbc('0x18')](_0x1da999)[_0x6dbc('0x19')]();};}function respondWithResult(_0x314a55,_0x424e52){_0x424e52=_0x424e52||0xc8;return function(_0x297b6a){if(_0x297b6a){return _0x314a55['status'](_0x424e52)[_0x6dbc('0x1a')](_0x297b6a);}};}function respondWithFilteredResult(_0x3fc449,_0x12a257){return function(_0x418e71){if(_0x418e71){var _0x25b8a8=typeof _0x12a257[_0x6dbc('0x1b')]===_0x6dbc('0x1c')&&typeof _0x12a257[_0x6dbc('0x1d')]==='undefined';var _0x5a896d=_0x418e71['count'];var _0x285ccd=_0x25b8a8?0x0:_0x12a257[_0x6dbc('0x1b')];var _0x1f185b=_0x25b8a8?_0x418e71[_0x6dbc('0x1e')]:_0x12a257[_0x6dbc('0x1b')]+_0x12a257['limit'];var _0x44435c;if(_0x1f185b>=_0x5a896d){_0x1f185b=_0x5a896d;_0x44435c=0xc8;}else{_0x44435c=0xce;}_0x3fc449[_0x6dbc('0x18')](_0x44435c);return _0x3fc449[_0x6dbc('0x1f')](_0x6dbc('0x20'),_0x285ccd+'-'+_0x1f185b+'/'+_0x5a896d)[_0x6dbc('0x1a')](_0x418e71);}return null;};}function patchUpdates(_0x2cd2f1){return function(_0x94335e){try{jsonpatch[_0x6dbc('0x21')](_0x94335e,_0x2cd2f1,!![]);}catch(_0x9edc7a){return BPromise[_0x6dbc('0x22')](_0x9edc7a);}return _0x94335e[_0x6dbc('0x23')]();};}function saveUpdates(_0x581438,_0x2f106f){return function(_0x2a1d0d){if(_0x2a1d0d){return _0x2a1d0d[_0x6dbc('0x24')](_0x581438)['then'](function(_0x1b8e84){return _0x1b8e84;});}return null;};}function removeEntity(_0x47d55b,_0x3e98b2){return function(_0x3f290e){if(_0x3f290e){return _0x3f290e[_0x6dbc('0x25')]()['then'](function(){_0x47d55b[_0x6dbc('0x18')](0xcc)[_0x6dbc('0x19')]();});}};}function handleEntityNotFound(_0x2be03c,_0x8cc556){return function(_0xd6dd78){if(!_0xd6dd78){_0x2be03c[_0x6dbc('0x17')](0x194);}return _0xd6dd78;};}function handleError(_0x43fab4,_0x1eb3fd){_0x1eb3fd=_0x1eb3fd||0x1f4;return function(_0x4bcbfb){logger[_0x6dbc('0x26')](_0x4bcbfb[_0x6dbc('0x27')]);if(_0x4bcbfb[_0x6dbc('0x28')]){delete _0x4bcbfb[_0x6dbc('0x28')];}_0x43fab4[_0x6dbc('0x18')](_0x1eb3fd)[_0x6dbc('0x29')](_0x4bcbfb);};}exports[_0x6dbc('0x2a')]=function(_0x235e00,_0xe77d87){var _0x485593={},_0x23ea7d={},_0x17203d={'count':0x0,'rows':[]};var _0x7d6155=_[_0x6dbc('0x2b')](db[_0x6dbc('0x2c')]['rawAttributes'],function(_0x3e2788){return{'name':_0x3e2788[_0x6dbc('0x2d')],'type':_0x3e2788[_0x6dbc('0x2e')][_0x6dbc('0x2f')]};});_0x23ea7d[_0x6dbc('0x30')]=_[_0x6dbc('0x2b')](_0x7d6155,'name');_0x23ea7d[_0x6dbc('0x31')]=_[_0x6dbc('0x32')](_0x235e00[_0x6dbc('0x31')]);_0x23ea7d[_0x6dbc('0x33')]=_[_0x6dbc('0x34')](_0x23ea7d[_0x6dbc('0x30')],_0x23ea7d[_0x6dbc('0x31')]);_0x485593[_0x6dbc('0x35')]=_[_0x6dbc('0x34')](_0x23ea7d[_0x6dbc('0x30')],qs[_0x6dbc('0x36')](_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x36')]));_0x485593[_0x6dbc('0x35')]=_0x485593[_0x6dbc('0x35')][_0x6dbc('0x37')]?_0x485593[_0x6dbc('0x35')]:_0x23ea7d[_0x6dbc('0x30')];if(!_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x38')](_0x6dbc('0x39'))){_0x485593[_0x6dbc('0x1d')]=qs[_0x6dbc('0x1d')](_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x1d')]);_0x485593[_0x6dbc('0x1b')]=qs['offset'](_0x235e00['query'][_0x6dbc('0x1b')]);}_0x485593[_0x6dbc('0x3a')]=qs[_0x6dbc('0x3b')](_0x235e00['query'][_0x6dbc('0x3b')]);_0x485593['where']=qs['filters'](_[_0x6dbc('0x3c')](_0x235e00[_0x6dbc('0x31')],_0x23ea7d['filters']),_0x7d6155);if(_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x3d')]){_0x485593[_0x6dbc('0x3e')]=_[_0x6dbc('0x3f')](_0x485593[_0x6dbc('0x3e')],{'$or':_['map'](_0x7d6155,function(_0x2c7545){if(_0x2c7545['type']!==_0x6dbc('0x40')){var _0x11554b={};_0x11554b[_0x2c7545['name']]={'$like':'%'+_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x3d')]+'%'};return _0x11554b;}})});}_0x485593=_[_0x6dbc('0x3f')]({},_0x485593,_0x235e00[_0x6dbc('0x41')]);var _0x40d79e={'where':_0x485593['where']};return db[_0x6dbc('0x2c')]['count'](_0x40d79e)['then'](function(_0x501d15){_0x17203d[_0x6dbc('0x1e')]=_0x501d15;if(_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x42')]){_0x485593[_0x6dbc('0x43')]=[{'all':!![]}];}return db[_0x6dbc('0x2c')][_0x6dbc('0x44')](_0x485593);})[_0x6dbc('0x45')](function(_0x39df60){_0x17203d[_0x6dbc('0x46')]=_0x39df60;return _0x17203d;})[_0x6dbc('0x45')](respondWithFilteredResult(_0xe77d87,_0x485593))['catch'](handleError(_0xe77d87,null));};exports[_0x6dbc('0x47')]=function(_0x3b74b0,_0x5cd3b9){var _0x1b946b={'raw':!![],'where':{'id':_0x3b74b0[_0x6dbc('0x48')]['id']}},_0x39adea={};_0x39adea[_0x6dbc('0x30')]=_[_0x6dbc('0x32')](db['WhatsappApplication'][_0x6dbc('0x49')]);_0x39adea[_0x6dbc('0x31')]=_[_0x6dbc('0x32')](_0x3b74b0[_0x6dbc('0x31')]);_0x39adea[_0x6dbc('0x33')]=_[_0x6dbc('0x34')](_0x39adea[_0x6dbc('0x30')],_0x39adea['query']);_0x1b946b[_0x6dbc('0x35')]=_['intersection'](_0x39adea[_0x6dbc('0x30')],qs[_0x6dbc('0x36')](_0x3b74b0[_0x6dbc('0x31')][_0x6dbc('0x36')]));_0x1b946b[_0x6dbc('0x35')]=_0x1b946b[_0x6dbc('0x35')][_0x6dbc('0x37')]?_0x1b946b[_0x6dbc('0x35')]:_0x39adea[_0x6dbc('0x30')];if(_0x3b74b0['query'][_0x6dbc('0x42')]){_0x1b946b[_0x6dbc('0x43')]=[{'all':!![]}];}_0x1b946b=_[_0x6dbc('0x3f')]({},_0x1b946b,_0x3b74b0[_0x6dbc('0x41')]);return db['WhatsappApplication']['find'](_0x1b946b)[_0x6dbc('0x45')](handleEntityNotFound(_0x5cd3b9,null))['then'](respondWithResult(_0x5cd3b9,null))[_0x6dbc('0x4a')](handleError(_0x5cd3b9,null));};exports[_0x6dbc('0x4b')]=function(_0x45b4d6,_0xfda49d){return db[_0x6dbc('0x2c')]['create'](_0x45b4d6[_0x6dbc('0x4c')],{})[_0x6dbc('0x45')](respondWithResult(_0xfda49d,0xc9))[_0x6dbc('0x4a')](handleError(_0xfda49d,null));};exports['update']=function(_0x427210,_0x82ea74){if(_0x427210['body']['id']){delete _0x427210[_0x6dbc('0x4c')]['id'];}return db[_0x6dbc('0x2c')][_0x6dbc('0x4d')]({'where':{'id':_0x427210['params']['id']}})['then'](handleEntityNotFound(_0x82ea74,null))['then'](saveUpdates(_0x427210['body'],null))[_0x6dbc('0x45')](respondWithResult(_0x82ea74,null))[_0x6dbc('0x4a')](handleError(_0x82ea74,null));};exports[_0x6dbc('0x25')]=function(_0x5501cc,_0x23f39b){return db[_0x6dbc('0x2c')][_0x6dbc('0x4d')]({'where':{'id':_0x5501cc['params']['id']}})['then'](handleEntityNotFound(_0x23f39b,null))[_0x6dbc('0x45')](removeEntity(_0x23f39b,null))[_0x6dbc('0x4a')](handleError(_0x23f39b,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index abfd998..1890080 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 _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 +var _0xacfe=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4'];(function(_0x496b7e,_0x30c11a){var _0x26b0c1=function(_0x33e357){while(--_0x33e357){_0x496b7e['push'](_0x496b7e['shift']());}};_0x26b0c1(++_0x30c11a);}(_0xacfe,0xfd));var _0xeacf=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xacfe[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeacf('0x0'))(_0xeacf('0x1'));var moment=require(_0xeacf('0x2'));var BPromise=require(_0xeacf('0x3'));var rp=require(_0xeacf('0x4'));var fs=require('fs');var path=require(_0xeacf('0x5'));var rimraf=require(_0xeacf('0x6'));var config=require(_0xeacf('0x7'));var attributes=require(_0xeacf('0x8'));module[_0xeacf('0x9')]=function(_0x369ad7,_0x229f28){return _0x369ad7[_0xeacf('0xa')]('WhatsappApplication',attributes,{'tableName':_0xeacf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeacf('0xc'),'collate':_0xeacf('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 2b80e60..fa2b1a2 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 _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 +var _0x0e85=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x7a8d74,_0x61f903){var _0x163048=function(_0x5d1ba7){while(--_0x5d1ba7){_0x7a8d74['push'](_0x7a8d74['shift']());}};_0x163048(++_0x61f903);}(_0x0e85,0x7c));var _0x50e8=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x0e85[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){return client[_0x50e8('0x9')](_0x5e8b01,_0x108edc)[_0x50e8('0xa')](function(_0x5825f5){logger[_0x50e8('0xb')](_0x50e8('0xc'),_0x3ce904,_0x50e8('0xd'));logger[_0x50e8('0xe')](_0x50e8('0xf'),_0x3ce904,_0x50e8('0xd'),JSON[_0x50e8('0x10')](_0x5825f5));if(_0x5825f5[_0x50e8('0x11')]){if(_0x5825f5['error']['code']===0x1f4){logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error']['message']);return _0x988da0(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error'][_0x50e8('0x12')]);return _0x42665e(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 3523f2d..57bca6e 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 _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 +var _0x25fa=['update','delete','whatsappinteraction:destroy','removeTags','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x5d5ee0,_0x55b047){var _0x36a63c=function(_0x40103b){while(--_0x40103b){_0x5d5ee0['push'](_0x5d5ee0['shift']());}};_0x36a63c(++_0x55b047);}(_0x25fa,0x109));var _0xa25f=function(_0xe135e,_0x30083a){_0xe135e=_0xe135e-0x0;var _0x316059=_0x25fa[_0xe135e];return _0x316059;};'use strict';var multer=require(_0xa25f('0x0'));var util=require('util');var path=require(_0xa25f('0x1'));var timeout=require(_0xa25f('0x2'));var express=require('express');var router=express[_0xa25f('0x3')]();var fs_extra=require(_0xa25f('0x4'));var auth=require(_0xa25f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa25f('0x6'));router['get']('/',auth[_0xa25f('0x7')](),controller[_0xa25f('0x8')]);router[_0xa25f('0x9')](_0xa25f('0xa'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xb')]);router[_0xa25f('0x9')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['show']);router[_0xa25f('0x9')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0xe')]);router[_0xa25f('0x9')](_0xa25f('0xf'),auth[_0xa25f('0x7')](),controller['download']);router[_0xa25f('0x10')]('/',auth[_0xa25f('0x7')](),controller['create']);router[_0xa25f('0x10')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0x11')]);router[_0xa25f('0x10')](_0xa25f('0x12'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')](_0xa25f('0x14'),_0xa25f('0x15')),controller[_0xa25f('0x16')]);router[_0xa25f('0x17')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x18')),controller[_0xa25f('0x19')]);router[_0xa25f('0x1a')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x1b')),controller['destroy']);router[_0xa25f('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa25f('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index e69d5d4..7c59d6a 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 _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 +var _0xe61c=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x29203e,_0x428c2c){var _0x116d6=function(_0x5a9212){while(--_0x5a9212){_0x29203e['push'](_0x29203e['shift']());}};_0x116d6(++_0x428c2c);}(_0xe61c,0xee));var _0xce61=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0xe61c[_0x188703];return _0x1a0c81;};'use strict';var Sequelize=require(_0xce61('0x0'));var moment=require('moment');module[_0xce61('0x1')]={'closed':{'type':Sequelize[_0xce61('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce61('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xce61('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xce61('0x4')]},'read1stAt':{'type':Sequelize[_0xce61('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xce61('0x5')]('in',_0xce61('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xce61('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xce61('0x5')]('in',_0xce61('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xce61('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 414ee1a..27e8bbf 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 _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 +var _0x9137=['moment','bluebird','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','end','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','user','catch','params','model','query','keys','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','update','destroy','describe','WhatsappMessage','omit','ids','getMessages','findOne','hasOwnProperty','order','where','pick','filters','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Whatsapp','closed','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','out','value','renderFile','views','.pdf','log','err','unlinkSync','sendStatus','rimraf','zip-dir'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0x9137,0x7b));var _0x7913=function(_0x127728,_0x11c9c5){_0x127728=_0x127728-0x0;var _0x3b6cfe=_0x9137[_0x127728];return _0x3b6cfe;};'use strict';var rimraf=require(_0x7913('0x0'));var zipdir=require(_0x7913('0x1'));var moment=require(_0x7913('0x2'));var BPromise=require(_0x7913('0x3'));var util=require('util');var path=require(_0x7913('0x4'));var ejs=require(_0x7913('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x7913('0x6'));var interaction=require(_0x7913('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x7913('0x8'));var logger=require(_0x7913('0x9'))(_0x7913('0xa'));var config=require(_0x7913('0xb'));var db=require(_0x7913('0xc'))['db'];config[_0x7913('0xd')]=_['defaults'](config[_0x7913('0xd')],{'host':_0x7913('0xe'),'port':0x18eb});var socket=require(_0x7913('0xf'))(new Redis(config['redis']));require(_0x7913('0x10'))[_0x7913('0x11')](socket);function respondWithStatusCode(_0x111f0a,_0x4b5840){_0x4b5840=_0x4b5840||0xcc;return function(_0x1d6c1e){if(_0x1d6c1e){return _0x111f0a['sendStatus'](_0x4b5840);}return _0x111f0a[_0x7913('0x12')](_0x4b5840)['end']();};}function respondWithResult(_0x139861,_0x2e8b1f){_0x2e8b1f=_0x2e8b1f||0xc8;return function(_0x57caa6){if(_0x57caa6){return _0x139861[_0x7913('0x12')](_0x2e8b1f)[_0x7913('0x13')](_0x57caa6);}};}function respondWithFilteredResult(_0x91367d,_0x2ec155){return function(_0x1d4612){if(_0x1d4612){var _0x39d2ae=typeof _0x2ec155[_0x7913('0x14')]===_0x7913('0x15')&&typeof _0x2ec155[_0x7913('0x16')]===_0x7913('0x15');var _0x2bff56=_0x1d4612[_0x7913('0x17')];var _0x58edee=_0x39d2ae?0x0:_0x2ec155[_0x7913('0x14')];var _0x335e5a=_0x39d2ae?_0x1d4612[_0x7913('0x17')]:_0x2ec155[_0x7913('0x14')]+_0x2ec155[_0x7913('0x16')];var _0xc66976;if(_0x335e5a>=_0x2bff56){_0x335e5a=_0x2bff56;_0xc66976=0xc8;}else{_0xc66976=0xce;}_0x91367d[_0x7913('0x12')](_0xc66976);return _0x91367d[_0x7913('0x18')](_0x7913('0x19'),_0x58edee+'-'+_0x335e5a+'/'+_0x2bff56)[_0x7913('0x13')](_0x1d4612);}return null;};}function saveUpdates(_0x3389a4){return function(_0x11e877){if(_0x11e877){return _0x11e877['update'](_0x3389a4)[_0x7913('0x1a')](function(_0x3b3f51){return _0x3b3f51;});}return null;};}function removeEntity(_0xf6e6fc){return function(_0x28a1f1){if(_0x28a1f1){return _0x28a1f1['destroy']()['then'](function(){_0xf6e6fc[_0x7913('0x12')](0xcc)[_0x7913('0x1b')]();});}};}function handleEntityNotFound(_0x400a60){return function(_0x277b21){if(!_0x277b21){_0x400a60['sendStatus'](0x194);}return _0x277b21;};}function handleError(_0x423054,_0x2731fc){_0x2731fc=_0x2731fc||0x1f4;return function(_0x41b710){logger[_0x7913('0x1c')](_0x41b710[_0x7913('0x1d')]);if(_0x41b710[_0x7913('0x1e')]){delete _0x41b710['name'];}_0x423054[_0x7913('0x12')](_0x2731fc)['send'](_0x41b710);};}exports[_0x7913('0x1f')]=function(_0x380afe,_0x54737c){var _0x35b7ad={};var _0x5738e6=_[_0x7913('0x20')](db[_0x7913('0x21')][_0x7913('0x22')],function(_0x44dd6d){return{'name':_0x44dd6d[_0x7913('0x23')],'type':_0x44dd6d['type'][_0x7913('0x24')]};});_0x35b7ad=qs[_0x7913('0x25')](_0x5738e6,_0x380afe);return interaction[_0x7913('0x26')](_0x7913('0x27'),_0x380afe['query'],_0x380afe[_0x7913('0x28')],_0x35b7ad,_0x5738e6)[_0x7913('0x1a')](respondWithFilteredResult(_0x54737c,_0x35b7ad))[_0x7913('0x29')](handleError(_0x54737c,null));};exports['show']=function(_0x56c67c,_0x366003){var _0x43f607={'raw':![],'where':{'id':_0x56c67c[_0x7913('0x2a')]['id']}},_0x3dc3eb={};_0x3dc3eb[_0x7913('0x2b')]=_['keys'](db['WhatsappInteraction'][_0x7913('0x22')]);_0x3dc3eb[_0x7913('0x2c')]=_[_0x7913('0x2d')](_0x56c67c[_0x7913('0x2c')]);_0x3dc3eb['filters']=_[_0x7913('0x2e')](_0x3dc3eb[_0x7913('0x2b')],_0x3dc3eb[_0x7913('0x2c')]);_0x43f607['attributes']=_['intersection'](_0x3dc3eb[_0x7913('0x2b')],qs[_0x7913('0x2f')](_0x56c67c['query'][_0x7913('0x2f')]));_0x43f607[_0x7913('0x30')]=_0x43f607['attributes'][_0x7913('0x31')]?_0x43f607[_0x7913('0x30')]:_0x3dc3eb['model'];if(_0x56c67c['query'][_0x7913('0x32')]){_0x43f607[_0x7913('0x33')]=[{'all':!![]}];}_0x43f607=_[_0x7913('0x34')]({},_0x43f607,_0x56c67c[_0x7913('0x35')]);return db[_0x7913('0x21')][_0x7913('0x36')](_0x43f607)['then'](handleEntityNotFound(_0x366003,null))[_0x7913('0x1a')](respondWithResult(_0x366003,null))[_0x7913('0x29')](handleError(_0x366003,null));};exports[_0x7913('0x37')]=function(_0x17124f,_0x2a7e8f){return db[_0x7913('0x21')][_0x7913('0x37')](_0x17124f[_0x7913('0x38')],{})[_0x7913('0x1a')](respondWithResult(_0x2a7e8f,0xc9))[_0x7913('0x29')](handleError(_0x2a7e8f,null));};exports[_0x7913('0x39')]=function(_0x5543c4,_0xfc574d){if(_0x5543c4['body']['id']){delete _0x5543c4[_0x7913('0x38')]['id'];}return db[_0x7913('0x21')][_0x7913('0x36')]({'where':{'id':_0x5543c4[_0x7913('0x2a')]['id']}})[_0x7913('0x1a')](handleEntityNotFound(_0xfc574d,null))[_0x7913('0x1a')](saveUpdates(_0x5543c4[_0x7913('0x38')],null))['then'](respondWithResult(_0xfc574d,null))[_0x7913('0x29')](handleError(_0xfc574d,null));};exports[_0x7913('0x3a')]=function(_0x5b7ca2,_0x25309a){return db[_0x7913('0x21')]['find']({'where':{'id':_0x5b7ca2[_0x7913('0x2a')]['id']}})[_0x7913('0x1a')](handleEntityNotFound(_0x25309a,null))['then'](removeEntity(_0x25309a,null))['catch'](handleError(_0x25309a,null));};exports['describe']=function(_0x4cd3b5,_0x2b591e){return db[_0x7913('0x21')][_0x7913('0x3b')]()[_0x7913('0x1a')](respondWithResult(_0x2b591e,null))['catch'](handleError(_0x2b591e,null));};exports['addMessage']=function(_0x1e8a16,_0x86ed9a){return db[_0x7913('0x3c')][_0x7913('0x36')]({'where':{'id':_0x1e8a16[_0x7913('0x2a')]['id']}})[_0x7913('0x1a')](handleEntityNotFound(_0x86ed9a,null))[_0x7913('0x1a')](function(_0x5ee687){if(_0x5ee687){return _0x5ee687['addMessage'](_0x1e8a16[_0x7913('0x38')]['ids'],_[_0x7913('0x3d')](_0x1e8a16[_0x7913('0x38')],[_0x7913('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x86ed9a,null))[_0x7913('0x29')](handleError(_0x86ed9a,null));};exports[_0x7913('0x3f')]=function(_0x1b76bf,_0x3b2adc){var _0x204397={'raw':![],'where':{}};var _0x23d846={};var _0x44182a={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x7913('0x40')]({'where':{'id':_0x1b76bf[_0x7913('0x2a')]['id']}})[_0x7913('0x1a')](handleEntityNotFound(_0x3b2adc,null))['then'](function(_0x45d3aa){if(_0x45d3aa){_0x23d846[_0x7913('0x2b')]=_[_0x7913('0x2d')](db[_0x7913('0x3c')][_0x7913('0x22')]);_0x23d846['query']=_[_0x7913('0x2d')](_0x1b76bf[_0x7913('0x2c')]);_0x23d846['filters']=_['intersection'](_0x23d846['model'],_0x23d846[_0x7913('0x2c')]);_0x204397[_0x7913('0x30')]=_[_0x7913('0x2e')](_0x23d846['model'],qs[_0x7913('0x2f')](_0x1b76bf[_0x7913('0x2c')]['fields']));_0x204397[_0x7913('0x30')]=_0x204397[_0x7913('0x30')][_0x7913('0x31')]?_0x204397[_0x7913('0x30')]:_0x23d846['model'];if(!_0x1b76bf[_0x7913('0x2c')][_0x7913('0x41')]('nolimit')){_0x204397[_0x7913('0x16')]=qs[_0x7913('0x16')](_0x1b76bf[_0x7913('0x2c')][_0x7913('0x16')]);_0x204397['offset']=qs[_0x7913('0x14')](_0x1b76bf[_0x7913('0x2c')][_0x7913('0x14')]);}_0x204397[_0x7913('0x42')]=qs['sort'](_0x1b76bf[_0x7913('0x2c')]['sort']);_0x204397[_0x7913('0x43')]=qs['filters'](_[_0x7913('0x44')](_0x1b76bf['query'],_0x23d846[_0x7913('0x45')]));_0x204397[_0x7913('0x43')][_0x7913('0x46')]=_0x45d3aa['id'];if(_0x1b76bf[_0x7913('0x2c')][_0x7913('0x47')]){_0x204397[_0x7913('0x43')]=_[_0x7913('0x34')](_0x204397['where'],{'$or':_[_0x7913('0x20')](_0x204397['attributes'],function(_0x229430){var _0x2edaf0={};_0x2edaf0[_0x229430]={'$like':'%'+_0x1b76bf['query'][_0x7913('0x47')]+'%'};return _0x2edaf0;})});}if(_0x1b76bf[_0x7913('0x2c')][_0x7913('0x48')]){var _0xc2ef92=_0x1b76bf[_0x7913('0x2c')]['$gte']['split'](',');var _0x388bb6={};_0x388bb6[_0xc2ef92[0x0]]={'$gte':moment(_0xc2ef92[0x1])[_0x7913('0x49')](_0x7913('0x4a'))};_0x204397[_0x7913('0x43')]=_[_0x7913('0x34')](_0x204397[_0x7913('0x43')],_0x388bb6);}_0x204397=_[_0x7913('0x34')]({},_0x204397,_0x1b76bf[_0x7913('0x35')]);return db[_0x7913('0x3c')][_0x7913('0x17')]({'where':_0x204397[_0x7913('0x43')]})[_0x7913('0x1a')](function(_0x5261d9){_0x44182a[_0x7913('0x17')]=_0x5261d9;if(_0x1b76bf['query'][_0x7913('0x32')]){_0x204397[_0x7913('0x33')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x204397);})['then'](function(_0x306ebd){_0x44182a[_0x7913('0x4b')]=_0x306ebd;return _0x44182a;});}})[_0x7913('0x1a')](respondWithFilteredResult(_0x3b2adc,_0x204397))[_0x7913('0x29')](handleError(_0x3b2adc,null));};exports[_0x7913('0x4c')]=function(_0x17846d,_0x3cff81){return db[_0x7913('0x21')][_0x7913('0x36')]({'where':{'id':_0x17846d[_0x7913('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3cff81,null))[_0x7913('0x1a')](function(_0x180584){if(_0x180584){return _0x180584[_0x7913('0x4d')](_0x17846d[_0x7913('0x38')][_0x7913('0x3e')],_[_0x7913('0x3d')](_0x17846d['body'],['ids','id'])||{})['spread'](function(){return db[_0x7913('0x4e')][_0x7913('0x26')]({'attributes':['id','name','color'],'where':{'id':_0x17846d[_0x7913('0x38')][_0x7913('0x3e')]}});})['then'](function(_0x529a00){socket['emit'](_0x7913('0x4f'),{'id':Number(_0x17846d[_0x7913('0x2a')]['id']),'tags':_0x529a00||[]});return{'id':Number(_0x17846d[_0x7913('0x2a')]['id']),'tags':_0x529a00||[]};});}})[_0x7913('0x1a')](respondWithResult(_0x3cff81,null))[_0x7913('0x29')](handleError(_0x3cff81,null));};exports[_0x7913('0x50')]=function(_0x464c46,_0x69ffc5){return db[_0x7913('0x21')][_0x7913('0x36')]({'where':{'id':_0x464c46[_0x7913('0x2a')]['id']}})['then'](handleEntityNotFound(_0x69ffc5,null))['then'](function(_0x5b0ffa){if(_0x5b0ffa){return _0x5b0ffa[_0x7913('0x50')](_0x464c46[_0x7913('0x2c')][_0x7913('0x3e')]);}})[_0x7913('0x1a')](respondWithStatusCode(_0x69ffc5,null))[_0x7913('0x29')](handleError(_0x69ffc5,null));};exports[_0x7913('0x51')]=function(_0x2dde76,_0x1c9994){var _0x4b6c96=moment()[_0x7913('0x52')]()[_0x7913('0x53')]();var _0x549c17=path[_0x7913('0x54')](config[_0x7913('0x55')],_0x7913('0x56'),_0x7913('0x57'),_0x7913('0x58'));var _0x58d2e1=path['join'](config[_0x7913('0x55')],_0x7913('0x56'),_0x7913('0x57'),_0x7913('0x59'));var _0x7e618f=path[_0x7913('0x54')](_0x549c17,_0x4b6c96);var _0x1d34da=util['format'](_0x7913('0x5a'),_0x2dde76[_0x7913('0x2a')]['id'],_0x4b6c96);var _0x5b6413=path[_0x7913('0x54')](_0x549c17,_0x1d34da);var _0x28f5c5=[];_0x28f5c5[_0x7913('0x5b')]({'model':db[_0x7913('0x5c')],'as':_0x7913('0x5c'),'attributes':['id',_0x7913('0x5d')],'raw':!![]});_0x28f5c5['push']({'model':db[_0x7913('0x5e')],'as':_0x7913('0x5f'),'attributes':['id',_0x7913('0x60'),_0x7913('0x61')],'raw':!![]});if(_0x2dde76[_0x7913('0x2c')][_0x7913('0x59')]){_0x28f5c5[_0x7913('0x5b')]({'model':db['Attachment'],'as':_0x7913('0x62'),'raw':!![]});}var _0x3e1f8d=[{'model':db[_0x7913('0x3c')],'as':_0x7913('0x63'),'attributes':['id',_0x7913('0x38'),_0x7913('0x64'),_0x7913('0x65'),_0x7913('0x66'),_0x7913('0x67')],'include':_0x28f5c5}];_0x3e1f8d[_0x7913('0x5b')]({'model':db['WhatsappAccount'],'as':_0x7913('0x68'),'attributes':['id',_0x7913('0x1e')]});_0x3e1f8d[_0x7913('0x5b')]({'model':db['User'],'as':_0x7913('0x69'),'attributes':['id','fullname']});return db[_0x7913('0x21')][_0x7913('0x36')]({'where':{'id':_0x2dde76[_0x7913('0x2a')]['id']},'include':_0x3e1f8d})[_0x7913('0x1a')](handleEntityNotFound(_0x1c9994,null))['then'](function(_0x4d4786){if(_0x4d4786){var _0x3cda86=_0x4d4786[_0x7913('0x6a')]({'plain':!![]});fs[_0x7913('0x6b')](_0x7e618f);var _0x2294a9={'channel':_0x7913('0x6c'),'account':_0x3cda86[_0x7913('0x68')][_0x7913('0x1e')],'agent':_0x3cda86[_0x7913('0x69')]?_0x3cda86[_0x7913('0x69')][_0x7913('0x5d')]:'N.A.','createdAt':moment(_0x3cda86['createdAt'])['format'](_0x7913('0x4a'))[_0x7913('0x53')](),'closedAt':_0x3cda86[_0x7913('0x6d')]?moment(_0x3cda86['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7913('0x53')]():'','disposition':_0x3cda86[_0x7913('0x6e')],'messages':_(_0x3cda86[_0x7913('0x63')])[_0x7913('0x47')]({'secret':![]})['map'](function(_0x38a002){if(_0x38a002[_0x7913('0x62')]){var _0x380fab=path['join'](_0x58d2e1,_0x38a002[_0x7913('0x62')]['basename']);if(fs[_0x7913('0x6f')](_0x380fab)){fs[_0x7913('0x70')](_0x380fab)[_0x7913('0x71')](fs[_0x7913('0x72')](path[_0x7913('0x54')](_0x7e618f,_0x38a002['Attachment'][_0x7913('0x73')])));}}return{'date':moment(_0x38a002['createdAt'])['format'](_0x7913('0x4a'))[_0x7913('0x53')](),'sender':_0x38a002[_0x7913('0x65')]===_0x7913('0x74')?_0x38a002[_0x7913('0x5c')]?_0x38a002['User'][_0x7913('0x5d')]:'System':_0x38a002[_0x7913('0x5f')][_0x7913('0x60')]+(_0x38a002[_0x7913('0x5f')][_0x7913('0x61')]?'\x20'+_0x38a002[_0x7913('0x5f')][_0x7913('0x61')]:''),'body':_0x38a002[_0x7913('0x62')]?_0x38a002[_0x7913('0x62')]['basename']:_0x38a002['body'],'direction':_0x38a002[_0x7913('0x65')]===_0x7913('0x74')?'A':'C','secret':_0x38a002['secret'],'read':_0x38a002['read'],'attachment':_0x38a002['Attachment']};})[_0x7913('0x75')]()};return ejs[_0x7913('0x76')](path['join'](config[_0x7913('0x55')],_0x7913('0x56'),_0x7913('0x77'),'downloadInteraction.ejs'),{'interaction':_0x2294a9})['then'](function(_0x3a65ff){var _0x2f34d8=path['join'](_0x7e618f,'transcript-'+_0x3cda86['id']+'-'+_0x4b6c96+_0x7913('0x78'));var _0x12e8a4={'path':_0x2f34d8,'channel':_0x7913('0x6c'),'interactionId':_0x3cda86['id']};return pdf['createPdfFromHTML'](_0x3a65ff,_0x12e8a4);})[_0x7913('0x1a')](function(){return new BPromise(function(_0x182a88,_0x176e02){zipdir(_0x7e618f,{'saveTo':_0x5b6413},function(_0x365591,_0x37ac8c){if(_0x365591)return _0x176e02(_0x365591);return _0x182a88(_0x37ac8c);});})[_0x7913('0x1a')](function(){return new BPromise(function(_0x20eb35,_0x4f70a1){rimraf(_0x7e618f,function(_0x32b4ec){if(_0x32b4ec)_0x4f70a1(_0x32b4ec);return _0x20eb35();});});})[_0x7913('0x1a')](function(){return _0x1c9994['download'](_0x5b6413,_0x1d34da,function(_0x3c3666){if(_0x3c3666){console[_0x7913('0x79')](_0x7913('0x7a'),_0x3c3666);}else{fs[_0x7913('0x7b')](_0x5b6413);}});});});}else{return _0x1c9994[_0x7913('0x7c')](0xc8);}})[_0x7913('0x29')](handleError(_0x1c9994,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 16eab14..71c9fe0 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 _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 +var _0xaa2d=['then','setDataValue','Users','map','findAll','unreadMessages','length','catch','../../mysqldb','setMaxListeners','save','update'];(function(_0x2896c2,_0x30e986){var _0x244375=function(_0x573941){while(--_0x573941){_0x2896c2['push'](_0x2896c2['shift']());}};_0x244375(++_0x30e986);}(_0xaa2d,0x11c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xdaa2('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xdaa2('0x1')](0x0);var events={'afterCreate':_0xdaa2('0x2'),'afterUpdate':_0xdaa2('0x3'),'afterDestroy':'remove'};function emitEvent(_0xc2de5c){return function(_0x113f8b,_0x27a165,_0x552169){_0x113f8b['getUsers']({'attributes':['id'],'raw':!![]})[_0xdaa2('0x4')](function(_0x4ca453){_0x113f8b[_0xdaa2('0x5')](_0xdaa2('0x6'),_0x4ca453[_0xdaa2('0x7')](function(_0x4b10b2){return{'id':_0x4b10b2['id']};}));return WhatsappMessage[_0xdaa2('0x8')]({'where':{'WhatsappInteractionId':_0x113f8b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdaa2('0x4')](function(_0x464c8c){_0x113f8b[_0xdaa2('0x5')](_0xdaa2('0x9'),_0x464c8c[_0xdaa2('0xa')]);WhatsappInteractionEvents['emit'](_0xc2de5c+':'+_0x113f8b['id'],_0x113f8b);WhatsappInteractionEvents['emit'](_0xc2de5c,_0x113f8b);_0x552169(null);})[_0xdaa2('0xb')](_0x552169(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](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 1dba719..061ed6a 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 _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 +var _0x1834=['../../config/logger','api','moment','bluebird','request-promise','path','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x45e5f1,_0x5ac3ee){var _0x448018=function(_0x115b44){while(--_0x115b44){_0x45e5f1['push'](_0x45e5f1['shift']());}};_0x448018(++_0x5ac3ee);}(_0x1834,0x1c9));var _0x4183=function(_0x39f375,_0x3aa8ec){_0x39f375=_0x39f375-0x0;var _0x463f93=_0x1834[_0x39f375];return _0x463f93;};'use strict';var _=require(_0x4183('0x0'));var util=require(_0x4183('0x1'));var logger=require(_0x4183('0x2'))(_0x4183('0x3'));var moment=require(_0x4183('0x4'));var BPromise=require(_0x4183('0x5'));var rp=require(_0x4183('0x6'));var fs=require('fs');var path=require(_0x4183('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4183('0x8'));module[_0x4183('0x9')]=function(_0x4fe1b3,_0x4327ec){return _0x4fe1b3[_0x4183('0xa')](_0x4183('0xb'),attributes,{'tableName':_0x4183('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25079a,_0x3514b4,_0x3f9473){if(_0x25079a['changed'](_0x4183('0xd'))){_0x25079a[_0x4183('0xe')]=moment()[_0x4183('0xf')](_0x4183('0x10'));}_0x3f9473(null,_0x25079a);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index da6539d..383d1b0 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 _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 +var _0x5d4d=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappInteraction,\x20%s,\x20%s','catch','WhatsappInteraction','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','find','addTags','ids','AddTags','lodash','moment','randomstring','ioredis'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x5d4d,0x18c));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5d4('0x0'));var util=require('util');var moment=require(_0xd5d4('0x1'));var BPromise=require('bluebird');var rs=require(_0xd5d4('0x2'));var fs=require('fs');var Redis=require(_0xd5d4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5d4('0x4'));var logger=require('../../config/logger')(_0xd5d4('0x5'));var config=require(_0xd5d4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd5d4('0x7')][_0xd5d4('0x8')]({'port':0x232a});config[_0xd5d4('0x9')]=_[_0xd5d4('0xa')](config['redis'],{'host':_0xd5d4('0xb'),'port':0x18eb});var socket=require(_0xd5d4('0xc'))(new Redis(config['redis']));require(_0xd5d4('0xd'))[_0xd5d4('0xe')](socket);function respondWithRpcPromise(_0x3a2b0d,_0xb880dc,_0x511622){return new BPromise(function(_0x5de7b5,_0x4888a6){return client[_0xd5d4('0xf')](_0x3a2b0d,_0x511622)[_0xd5d4('0x10')](function(_0x22d3d7){logger[_0xd5d4('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0xb880dc,_0xd5d4('0x12'));logger[_0xd5d4('0x13')](_0xd5d4('0x14'),_0xb880dc,_0xd5d4('0x12'),JSON['stringify'](_0x22d3d7));if(_0x22d3d7[_0xd5d4('0x15')]){if(_0x22d3d7[_0xd5d4('0x15')][_0xd5d4('0x16')]===0x1f4){logger[_0xd5d4('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0xb880dc,_0x22d3d7[_0xd5d4('0x15')][_0xd5d4('0x17')]);return _0x4888a6(_0x22d3d7[_0xd5d4('0x15')][_0xd5d4('0x17')]);}logger[_0xd5d4('0x15')](_0xd5d4('0x18'),_0xb880dc,_0x22d3d7[_0xd5d4('0x15')][_0xd5d4('0x17')]);return _0x5de7b5(_0x22d3d7[_0xd5d4('0x15')][_0xd5d4('0x17')]);}else{logger[_0xd5d4('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0xb880dc,_0xd5d4('0x12'));_0x5de7b5(_0x22d3d7['result']['message']);}})[_0xd5d4('0x19')](function(_0x18a7bc){logger[_0xd5d4('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0xb880dc,_0x18a7bc);_0x4888a6(_0x18a7bc);});});}exports['UpdateWhatsappInteraction']=function(_0x528578){var _0x48f4f0=this;return new Promise(function(_0x207519,_0x26ef7a){return db[_0xd5d4('0x1a')]['update'](_0x528578[_0xd5d4('0x1b')],{'raw':_0x528578[_0xd5d4('0x1c')]?_0x528578[_0xd5d4('0x1c')][_0xd5d4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x528578['options']?_0x528578['options'][_0xd5d4('0x1e')]||null:null,'attributes':_0x528578[_0xd5d4('0x1c')]?_0x528578[_0xd5d4('0x1c')][_0xd5d4('0x1f')]||null:null,'limit':_0x528578[_0xd5d4('0x1c')]?_0x528578[_0xd5d4('0x1c')][_0xd5d4('0x20')]||null:null})['then'](function(_0x56d987){logger[_0xd5d4('0x11')](_0xd5d4('0x21'),_0x528578);logger[_0xd5d4('0x13')](_0xd5d4('0x21'),_0x528578,JSON[_0xd5d4('0x22')](_0x56d987));_0x207519(_0x56d987);})[_0xd5d4('0x19')](function(_0x45f4a6){logger[_0xd5d4('0x15')](_0xd5d4('0x21'),_0x45f4a6[_0xd5d4('0x17')],_0x528578);_0x26ef7a(_0x48f4f0['error'](0x1f4,_0x45f4a6[_0xd5d4('0x17')]));});});};exports[_0xd5d4('0x23')]=function(_0x58301e){return new Promise(function(_0x132263,_0x253acd){return db[_0xd5d4('0x1a')][_0xd5d4('0x24')]({'where':_0x58301e[_0xd5d4('0x1c')]?_0x58301e[_0xd5d4('0x1c')]['where']||null:null})['then'](function(_0x38e331){if(_0x38e331){return _0x38e331[_0xd5d4('0x25')](_0x58301e['body'][_0xd5d4('0x26')],_['omit'](_0x58301e[_0xd5d4('0x1b')],[_0xd5d4('0x26'),'id'])||{});}})['spread'](function(_0x1cf8d2){logger[_0xd5d4('0x11')](_0xd5d4('0x27'),_0x58301e);logger[_0xd5d4('0x13')](_0xd5d4('0x27'),_0x58301e,JSON[_0xd5d4('0x22')](_0x1cf8d2));_0x132263(_0x1cf8d2);})[_0xd5d4('0x19')](function(_0x49c4fd){logger['error'](_0xd5d4('0x27'),_0x49c4fd['message'],_0x58301e);_0x253acd(_this[_0xd5d4('0x15')](0x1f4,_0x49c4fd[_0xd5d4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5aa8a62..f47aba6 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 _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 +var _0x326d=['update','removeListener','register','length','whatsappInteraction:','save'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x326d,0x1af));var _0xd326=function(_0x48796d,_0x30b860){_0x48796d=_0x48796d-0x0;var _0x3b1572=_0x326d[_0x48796d];return _0x3b1572;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xd326('0x0'),'remove',_0xd326('0x1')];function createListener(_0x311f75,_0x4a8af2){return function(_0x5a4cb9){_0x4a8af2['emit'](_0x311f75,_0x5a4cb9);};}function removeListener(_0x50ddb2,_0x36ee92){return function(){WhatsappInteractionEvents[_0xd326('0x2')](_0x50ddb2,_0x36ee92);};}exports[_0xd326('0x3')]=function(_0x21543b){for(var _0x2015fa=0x0,_0x217fe8=events[_0xd326('0x4')];_0x2015fa<_0x217fe8;_0x2015fa++){var _0x5a9576=events[_0x2015fa];var _0x108dc7=createListener(_0xd326('0x5')+_0x5a9576,_0x21543b);WhatsappInteractionEvents['on'](_0x5a9576,_0x108dc7);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index cf3938d..99556a1 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 _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 +var _0xffbb=['../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffbb,0xc5));var _0xbffb=function(_0x51e1e7,_0x5c7bca){_0x51e1e7=_0x51e1e7-0x0;var _0x568f5c=_0xffbb[_0x51e1e7];return _0x568f5c;};'use strict';var multer=require(_0xbffb('0x0'));var util=require('util');var path=require(_0xbffb('0x1'));var timeout=require(_0xbffb('0x2'));var express=require(_0xbffb('0x3'));var router=express[_0xbffb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbffb('0x5'));var interaction=require(_0xbffb('0x6'));var config=require(_0xbffb('0x7'));var controller=require(_0xbffb('0x8'));router[_0xbffb('0x9')]('/',auth['isAuthenticated'](),controller[_0xbffb('0xa')]);router[_0xbffb('0x9')](_0xbffb('0xb'),auth[_0xbffb('0xc')](),controller[_0xbffb('0xd')]);router['get'](_0xbffb('0xe'),auth[_0xbffb('0xc')](),controller[_0xbffb('0xf')]);router[_0xbffb('0x10')]('/',auth['isAuthenticated'](),interaction[_0xbffb('0x11')](_0xbffb('0x12'),_0xbffb('0x13')),controller['create']);router[_0xbffb('0x10')](_0xbffb('0x14'),controller[_0xbffb('0x15')]);router[_0xbffb('0x16')](_0xbffb('0xe'),auth[_0xbffb('0xc')](),controller['update']);router[_0xbffb('0x16')](_0xbffb('0x17'),auth['isAuthenticated'](),controller[_0xbffb('0x18')]);router[_0xbffb('0x16')](_0xbffb('0x19'),auth[_0xbffb('0xc')](),controller['reject']);router[_0xbffb('0x1a')](_0xbffb('0xe'),auth[_0xbffb('0xc')](),controller[_0xbffb('0x1b')]);module[_0xbffb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 1e79011..d8af12f 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 _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 +var _0xb515=['medium','BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x5472cb,_0x1108b7){var _0x564309=function(_0x593a9d){while(--_0x593a9d){_0x5472cb['push'](_0x5472cb['shift']());}};_0x564309(++_0x1108b7);}(_0xb515,0x195));var _0x5b51=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0xb515[_0x17c483];return _0x112bdb;};'use strict';var Sequelize=require(_0x5b51('0x0'));module[_0x5b51('0x1')]={'body':{'type':Sequelize[_0x5b51('0x2')](_0x5b51('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5b51('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5b51('0x5')),'defaultValue':_0x5b51('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x5b51('0x6')]},'readAt':{'type':Sequelize[_0x5b51('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5b51('0x6')]},'providerResponse':{'type':Sequelize[_0x5b51('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 332f29a..5e3386e 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 _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 +var _0xe26e=['interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT','User','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','read','twilio','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x273fcb,_0x576f40){var _0xebff6b=function(_0x571b7f){while(--_0x571b7f){_0x273fcb['push'](_0x273fcb['shift']());}};_0xebff6b(++_0x576f40);}(_0xe26e,0x1cf));var _0xee26=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe26e[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee26('0x0'));var zipdir=require(_0xee26('0x1'));var jsonpatch=require(_0xee26('0x2'));var rp=require(_0xee26('0x3'));var moment=require(_0xee26('0x4'));var BPromise=require(_0xee26('0x5'));var Mustache=require(_0xee26('0x6'));var util=require(_0xee26('0x7'));var path=require('path');var sox=require(_0xee26('0x8'));var csv=require(_0xee26('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee26('0xa'));var _=require(_0xee26('0xb'));var squel=require(_0xee26('0xc'));var crypto=require(_0xee26('0xd'));var jsforce=require(_0xee26('0xe'));var deskjs=require(_0xee26('0xf'));var toCsv=require(_0xee26('0x9'));var querystring=require(_0xee26('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee26('0x11'));var qs=require(_0xee26('0x12'));var as=require(_0xee26('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee26('0x14'))(_0xee26('0x15'));var utils=require(_0xee26('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee26('0x17'))['db'];config[_0xee26('0x18')]=_[_0xee26('0x19')](config[_0xee26('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xee26('0x1a'))(new Redis(config['redis']));require(_0xee26('0x1b'))[_0xee26('0x1c')](socket);var jayson=require(_0xee26('0x1d'));var client=jayson[_0xee26('0x1e')][_0xee26('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xee26('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1a4a83,_0x17b5b6,_0x456099,_0x2acef3){return new BPromise(function(_0x397dfc,_0x2bd865){var _0x52f470=_0x2acef3||client;return _0x52f470['request'](_0x1a4a83,_0x456099)[_0xee26('0x20')](function(_0x581d3b){logger['info'](_0xee26('0x21'),_0x17b5b6,'request\x20sent');logger[_0xee26('0x22')](_0xee26('0x23'),_0x17b5b6,_0xee26('0x24'),JSON[_0xee26('0x25')](_0x581d3b));if(_0x581d3b[_0xee26('0x26')]){if(_0x581d3b[_0xee26('0x26')][_0xee26('0x27')]===0x1f4){logger[_0xee26('0x26')](_0xee26('0x21'),_0x17b5b6,_0x581d3b[_0xee26('0x26')]['message']);return _0x2bd865(_0x581d3b[_0xee26('0x26')]['message']);}logger[_0xee26('0x26')](_0xee26('0x21'),_0x17b5b6,_0x581d3b[_0xee26('0x26')][_0xee26('0x28')]);return _0x397dfc(_0x581d3b['error'][_0xee26('0x28')]);}else{logger[_0xee26('0x29')](_0xee26('0x21'),_0x17b5b6,_0xee26('0x24'));_0x397dfc(_0x581d3b[_0xee26('0x2a')]['message']);}})[_0xee26('0x2b')](function(_0x4fbd40){logger[_0xee26('0x26')](_0xee26('0x21'),_0x17b5b6,_0x4fbd40);_0x2bd865(_0x4fbd40);});});}function respondWithStatusCode(_0x479a8e,_0x30d1aa){_0x30d1aa=_0x30d1aa||0xcc;return function(_0x5b4978){if(_0x5b4978){return _0x479a8e[_0xee26('0x2c')](_0x30d1aa);}return _0x479a8e['status'](_0x30d1aa)[_0xee26('0x2d')]();};}function respondWithResult(_0x48c49f,_0x3778f1){_0x3778f1=_0x3778f1||0xc8;return function(_0x59d019){if(_0x59d019){return _0x48c49f['status'](_0x3778f1)[_0xee26('0x2e')](_0x59d019);}};}function respondWithFilteredResult(_0x4dbba1,_0x8b8927){return function(_0x1822d2){if(_0x1822d2){var _0x412dde=typeof _0x8b8927[_0xee26('0x2f')]===_0xee26('0x30')&&typeof _0x8b8927[_0xee26('0x31')]===_0xee26('0x30');var _0x1a3ebc=_0x1822d2[_0xee26('0x32')];var _0x2b28f=_0x412dde?0x0:_0x8b8927[_0xee26('0x2f')];var _0x49c08a=_0x412dde?_0x1822d2[_0xee26('0x32')]:_0x8b8927[_0xee26('0x2f')]+_0x8b8927['limit'];var _0x942796;if(_0x49c08a>=_0x1a3ebc){_0x49c08a=_0x1a3ebc;_0x942796=0xc8;}else{_0x942796=0xce;}_0x4dbba1[_0xee26('0x33')](_0x942796);return _0x4dbba1[_0xee26('0x34')](_0xee26('0x35'),_0x2b28f+'-'+_0x49c08a+'/'+_0x1a3ebc)[_0xee26('0x2e')](_0x1822d2);}return null;};}function patchUpdates(_0x3aa48b){return function(_0x5b3086){try{jsonpatch[_0xee26('0x36')](_0x5b3086,_0x3aa48b,!![]);}catch(_0x3e52de){return BPromise['reject'](_0x3e52de);}return _0x5b3086['save']();};}function saveUpdates(_0x1e9e77,_0x431579){return function(_0x5ef6ba){if(_0x5ef6ba){return _0x5ef6ba[_0xee26('0x37')](_0x1e9e77)[_0xee26('0x20')](function(_0x1ff2e8){return _0x1ff2e8;});}return null;};}function removeEntity(_0x4618fd,_0x256207){return function(_0x596cb4){if(_0x596cb4){return _0x596cb4['destroy']()[_0xee26('0x20')](function(){_0x4618fd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd7ba21,_0x46fc17){return function(_0x431864){if(!_0x431864){_0xd7ba21[_0xee26('0x2c')](0x194);}return _0x431864;};}function handleError(_0x54eb5a,_0x122ed7){_0x122ed7=_0x122ed7||0x1f4;return function(_0x2b19b8){logger[_0xee26('0x26')](_0x2b19b8[_0xee26('0x38')]);if(_0x2b19b8['name']){delete _0x2b19b8[_0xee26('0x39')];}_0x54eb5a[_0xee26('0x33')](_0x122ed7)[_0xee26('0x3a')](_0x2b19b8);};}exports[_0xee26('0x3b')]=function(_0x1d3157,_0x406c31){var _0x1f49b8={},_0x51a156={},_0x5496f1={'count':0x0,'rows':[]};var _0x3095e9=_[_0xee26('0x3c')](db[_0xee26('0x3d')]['rawAttributes'],function(_0x45b627){return{'name':_0x45b627[_0xee26('0x3e')],'type':_0x45b627[_0xee26('0x3f')][_0xee26('0x40')]};});_0x51a156[_0xee26('0x41')]=_[_0xee26('0x3c')](_0x3095e9,'name');_0x51a156[_0xee26('0x42')]=_['keys'](_0x1d3157[_0xee26('0x42')]);_0x51a156[_0xee26('0x43')]=_['intersection'](_0x51a156[_0xee26('0x41')],_0x51a156['query']);_0x1f49b8['attributes']=_[_0xee26('0x44')](_0x51a156[_0xee26('0x41')],qs['fields'](_0x1d3157[_0xee26('0x42')][_0xee26('0x45')]));_0x1f49b8[_0xee26('0x46')]=_0x1f49b8['attributes'][_0xee26('0x47')]?_0x1f49b8['attributes']:_0x51a156[_0xee26('0x41')];if(!_0x1d3157[_0xee26('0x42')][_0xee26('0x48')](_0xee26('0x49'))){_0x1f49b8[_0xee26('0x31')]=qs[_0xee26('0x31')](_0x1d3157[_0xee26('0x42')]['limit']);_0x1f49b8[_0xee26('0x2f')]=qs[_0xee26('0x2f')](_0x1d3157[_0xee26('0x42')][_0xee26('0x2f')]);}_0x1f49b8[_0xee26('0x4a')]=qs[_0xee26('0x4b')](_0x1d3157[_0xee26('0x42')][_0xee26('0x4b')]);_0x1f49b8['where']=qs[_0xee26('0x43')](_['pick'](_0x1d3157['query'],_0x51a156[_0xee26('0x43')]),_0x3095e9);if(_0x1d3157['query'][_0xee26('0x4c')]){_0x1f49b8['where']=_['merge'](_0x1f49b8[_0xee26('0x4d')],{'$or':_[_0xee26('0x3c')](_0x3095e9,function(_0x62f7ca){if(_0x62f7ca[_0xee26('0x3f')]!==_0xee26('0x4e')){var _0x30e76e={};_0x30e76e[_0x62f7ca['name']]={'$like':'%'+_0x1d3157[_0xee26('0x42')][_0xee26('0x4c')]+'%'};return _0x30e76e;}})});}_0x1f49b8=_[_0xee26('0x4f')]({},_0x1f49b8,_0x1d3157[_0xee26('0x50')]);var _0x2fefdc={'where':_0x1f49b8[_0xee26('0x4d')]};return db[_0xee26('0x3d')][_0xee26('0x32')](_0x2fefdc)[_0xee26('0x20')](function(_0x31f6db){_0x5496f1[_0xee26('0x32')]=_0x31f6db;if(_0x1d3157['query'][_0xee26('0x51')]){_0x1f49b8[_0xee26('0x52')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xee26('0x53')](_0x1f49b8);})['then'](function(_0xfa7209){_0x5496f1[_0xee26('0x54')]=_0xfa7209;return _0x5496f1;})[_0xee26('0x20')](respondWithFilteredResult(_0x406c31,_0x1f49b8))[_0xee26('0x2b')](handleError(_0x406c31,null));};exports[_0xee26('0x55')]=function(_0x16f90a,_0x5b2497){var _0x4cca1d={'raw':!![],'where':{'id':_0x16f90a[_0xee26('0x56')]['id']}},_0xaf7f2c={};_0xaf7f2c[_0xee26('0x41')]=_[_0xee26('0x57')](db[_0xee26('0x3d')][_0xee26('0x58')]);_0xaf7f2c['query']=_[_0xee26('0x57')](_0x16f90a['query']);_0xaf7f2c['filters']=_[_0xee26('0x44')](_0xaf7f2c[_0xee26('0x41')],_0xaf7f2c['query']);_0x4cca1d['attributes']=_[_0xee26('0x44')](_0xaf7f2c[_0xee26('0x41')],qs[_0xee26('0x45')](_0x16f90a[_0xee26('0x42')][_0xee26('0x45')]));_0x4cca1d[_0xee26('0x46')]=_0x4cca1d[_0xee26('0x46')][_0xee26('0x47')]?_0x4cca1d[_0xee26('0x46')]:_0xaf7f2c[_0xee26('0x41')];if(_0x16f90a['query'][_0xee26('0x51')]){_0x4cca1d[_0xee26('0x52')]=[{'all':!![]}];}_0x4cca1d=_[_0xee26('0x4f')]({},_0x4cca1d,_0x16f90a[_0xee26('0x50')]);return db['WhatsappMessage'][_0xee26('0x59')](_0x4cca1d)[_0xee26('0x20')](handleEntityNotFound(_0x5b2497,null))['then'](respondWithResult(_0x5b2497,null))[_0xee26('0x2b')](handleError(_0x5b2497,null));};exports[_0xee26('0x5a')]=function(_0x571bc5,_0x98c4b7){return db[_0xee26('0x3d')]['create'](_0x571bc5[_0xee26('0x5b')],{})[_0xee26('0x20')](respondWithResult(_0x98c4b7,0xc9))[_0xee26('0x2b')](handleError(_0x98c4b7,null));};exports[_0xee26('0x37')]=function(_0x1ac874,_0x512aa8){if(_0x1ac874[_0xee26('0x5b')]['id']){delete _0x1ac874['body']['id'];}return db[_0xee26('0x3d')][_0xee26('0x59')]({'where':{'id':_0x1ac874['params']['id']}})[_0xee26('0x20')](handleEntityNotFound(_0x512aa8,null))[_0xee26('0x20')](saveUpdates(_0x1ac874['body'],null))[_0xee26('0x20')](respondWithResult(_0x512aa8,null))[_0xee26('0x2b')](handleError(_0x512aa8,null));};exports['destroy']=function(_0x5c3fa9,_0x898188){return db[_0xee26('0x3d')][_0xee26('0x59')]({'where':{'id':_0x5c3fa9['params']['id']}})[_0xee26('0x20')](handleEntityNotFound(_0x898188,null))[_0xee26('0x20')](removeEntity(_0x898188,null))[_0xee26('0x2b')](handleError(_0x898188,null));};exports['describe']=function(_0x5d09fd,_0x5dd1d3){return db[_0xee26('0x3d')][_0xee26('0x5c')]()[_0xee26('0x20')](respondWithResult(_0x5dd1d3,null))[_0xee26('0x2b')](handleError(_0x5dd1d3,null));};var interaction_log=require(_0xee26('0x14'))(_0xee26('0x5d'));exports[_0xee26('0x5e')]=function(_0x410ff9,_0x35efe8,_0x1019a5){var _0x3ef4af={'agent':{},'channel':_0xee26('0x5f')};if(_0x410ff9[_0xee26('0x5b')]['id']){delete _0x410ff9[_0xee26('0x5b')]['id'];}_0x410ff9['body']['read']=!![];_0x410ff9[_0xee26('0x5b')][_0xee26('0x60')]=moment()[_0xee26('0x61')](_0xee26('0x62'));_0x410ff9['body'][_0xee26('0x63')]=_0x410ff9[_0xee26('0x5b')][_0xee26('0x63')]||_0x410ff9[_0xee26('0x64')]['id'];_0x3ef4af[_0xee26('0x65')]['id']=_0x410ff9[_0xee26('0x5b')]['UserId'];return db[_0xee26('0x3d')]['find']({'where':{'id':_0x410ff9[_0xee26('0x56')]['id'],'UserId':null}})[_0xee26('0x20')](handleEntityNotFound(_0x35efe8,null))['then'](saveUpdates(_0x410ff9[_0xee26('0x5b')],null))[_0xee26('0x20')](function(_0x357ab0){if(_0x357ab0){_0x3ef4af[_0xee26('0x28')]=_0x357ab0['get']({'plain':!![]});return db[_0xee26('0x66')][_0xee26('0x59')]({'where':{'id':_0x357ab0[_0xee26('0x67')]}});}return null;})[_0xee26('0x20')](handleEntityNotFound(_0x35efe8,null))[_0xee26('0x20')](function(_0x3fe34f){if(_0x3fe34f){return _0x3fe34f[_0xee26('0x37')]({'UserId':_0x410ff9[_0xee26('0x5b')][_0xee26('0x63')],'read1stAt':_[_0xee26('0x68')](_0x3fe34f[_0xee26('0x69')])?moment()[_0xee26('0x61')](_0xee26('0x62')):undefined});}return null;})[_0xee26('0x20')](function(_0xecb556){if(_0xecb556){_0x3ef4af['interaction']=_0xecb556[_0xee26('0x6a')]({'plain':!![]});interaction_log[_0xee26('0x29')](_0xee26('0x6b'),_0x410ff9['user']['id'],_0x410ff9[_0xee26('0x64')][_0xee26('0x39')],_0x410ff9[_0xee26('0x64')][_0xee26('0x6c')],_0x3ef4af[_0xee26('0x6d')]['id'],_0x410ff9['body']?JSON[_0xee26('0x25')](_0x410ff9['body']):'null');return respondWithRpcPromise(_0xee26('0x6e'),_0xee26('0x6f'),_0x3ef4af);}return null;})[_0xee26('0x20')](function(_0x4eafbc){var _0x755de6=_0xee26('0x70')+_0x4eafbc[_0xee26('0x28')][_0xee26('0x71')];return db[_0xee26('0x72')][_0xee26('0x42')](_0x755de6,{'type':db[_0xee26('0x73')][_0xee26('0x74')]['SELECT'],'raw':!![]})['then'](function(_0x40792c){return _0x40792c;});})[_0xee26('0x20')](function(_0x4dce5c){if(_0x4dce5c){_0x3ef4af[_0xee26('0x28')][_0xee26('0x75')]=_0x4dce5c[0x0];if(!_0x410ff9[_0xee26('0x5b')][_0xee26('0x63')])return;return db['User'][_0xee26('0x59')]({'where':{'id':_0x410ff9[_0xee26('0x5b')][_0xee26('0x63')],'role':_0xee26('0x65')},'attributes':['id','name',_0xee26('0x76'),_0xee26('0x77'),_0xee26('0x78')],'raw':!![]});}return null;})[_0xee26('0x20')](function(_0x575130){if(!_0x575130)return null;_0x3ef4af[_0xee26('0x28')][_0xee26('0x65')]=_0x575130;return _0x3ef4af;})[_0xee26('0x20')](function(_0x1b9a08){if(_0x1b9a08){if(_0x410ff9[_0xee26('0x5b')][_0xee26('0x79')]){_0x3ef4af['message'][_0xee26('0x7a')]=util[_0xee26('0x61')](_0xee26('0x7b'),_0x410ff9['user'][_0xee26('0x39')]);_0x3ef4af['message'][_0xee26('0x7c')]=_0x3ef4af[_0xee26('0x7c')];_0x3ef4af['message'][_0xee26('0x7d')]=_0x3ef4af['channel'];_0x3ef4af[_0xee26('0x28')][_0xee26('0x7e')]='accept';return respondWithRpcPromise(_0xee26('0x7f'),_0xee26('0x7f'),{'event':_0xee26('0x80'),'message':_0x3ef4af[_0xee26('0x28')]},client9002)[_0xee26('0x20')](function(){return _0x3ef4af;});}return _0x3ef4af;}return null;})[_0xee26('0x20')](respondWithResult(_0x35efe8,null))[_0xee26('0x2b')](handleError(_0x35efe8,null));};var interaction_log=require(_0xee26('0x14'))(_0xee26('0x5d'));exports[_0xee26('0x81')]=function(_0x25a0d1,_0x5d7fe2,_0x300435){var _0x1d9e22={'agent':{},'channel':_0xee26('0x5f')};if(_0x25a0d1[_0xee26('0x5b')]['id']){delete _0x25a0d1[_0xee26('0x5b')]['id'];}_0x25a0d1[_0xee26('0x5b')][_0xee26('0x63')]=_0x25a0d1[_0xee26('0x5b')][_0xee26('0x63')]||_0x25a0d1[_0xee26('0x64')]['id'];_0x1d9e22['agent']['id']=_0x25a0d1[_0xee26('0x5b')][_0xee26('0x63')];return db[_0xee26('0x3d')]['find']({'where':{'id':_0x25a0d1['params']['id'],'UserId':null}})[_0xee26('0x20')](handleEntityNotFound(_0x5d7fe2,null))['then'](function(_0x1d0fd0){if(_0x1d0fd0){_0x1d9e22[_0xee26('0x28')]=_0x1d0fd0['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x1d0fd0[_0xee26('0x67')]}});}return null;})[_0xee26('0x20')](handleEntityNotFound(_0x5d7fe2,null))['then'](function(_0x227c42){if(_0x227c42){_0x1d9e22[_0xee26('0x6d')]=_0x227c42[_0xee26('0x6a')]({'plain':!![]});interaction_log[_0xee26('0x29')](_0xee26('0x82'),_0x25a0d1[_0xee26('0x64')]['id'],_0x25a0d1[_0xee26('0x64')][_0xee26('0x39')],_0x25a0d1[_0xee26('0x64')][_0xee26('0x6c')],_0x1d9e22[_0xee26('0x6d')]['id'],_0x25a0d1['body']?JSON[_0xee26('0x25')](_0x25a0d1[_0xee26('0x5b')]):_0xee26('0x83'));return respondWithRpcPromise(_0xee26('0x84'),'rejectMessage',_0x1d9e22);}return null;})['then'](function(_0x3c0cf8){var _0x496ed2=_0xee26('0x70')+_0x3c0cf8['message']['ContactId'];return db[_0xee26('0x72')][_0xee26('0x42')](_0x496ed2,{'type':db[_0xee26('0x73')][_0xee26('0x74')][_0xee26('0x85')],'raw':!![]})[_0xee26('0x20')](function(_0x25ba5b){return _0x25ba5b;});})['then'](function(_0x818562){if(_0x818562){_0x1d9e22[_0xee26('0x28')][_0xee26('0x75')]=_0x818562[0x0];if(!_0x25a0d1[_0xee26('0x5b')][_0xee26('0x63')])return;return db[_0xee26('0x86')]['find']({'where':{'id':_0x25a0d1[_0xee26('0x5b')][_0xee26('0x63')],'role':_0xee26('0x65')},'attributes':['id','name',_0xee26('0x76'),_0xee26('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3c7842){if(!_0x3c7842)return null;_0x1d9e22[_0xee26('0x28')][_0xee26('0x65')]=_0x3c7842;return _0x1d9e22;})[_0xee26('0x20')](function(_0x5af104){if(_0x5af104){_0x5af104[_0xee26('0x28')][_0xee26('0x7a')]=util[_0xee26('0x61')]('SIP/%s',_0x25a0d1['user']['name']);_0x5af104['message'][_0xee26('0x7c')]=_0x1d9e22[_0xee26('0x7c')];_0x5af104[_0xee26('0x28')][_0xee26('0x7d')]=_0x1d9e22[_0xee26('0x7c')];_0x5af104[_0xee26('0x28')][_0xee26('0x7e')]=_0xee26('0x81');respondWithRpcPromise(_0xee26('0x7f'),_0xee26('0x7f'),{'event':'rejectmessage','message':_0x5af104[_0xee26('0x28')]},client9002);return _0x1d9e22;}return null;})[_0xee26('0x20')](respondWithResult(_0x5d7fe2,null))[_0xee26('0x2b')](handleError(_0x5d7fe2,null));};exports[_0xee26('0x33')]=function(_0x3dde91,_0x1188d1,_0x3e3662){if(_0x3dde91[_0xee26('0x5b')]['id']){delete _0x3dde91[_0xee26('0x5b')]['id'];}var _0x1d6050;return db[_0xee26('0x3d')][_0xee26('0x59')]({'where':{'id':_0x3dde91['params']['id']}})[_0xee26('0x20')](handleEntityNotFound(_0x1188d1,null))[_0xee26('0x20')](function(_0x223003){if(_0x223003){_0x1d6050=_0x223003;return db[_0xee26('0x87')][_0xee26('0x59')]({'where':{'id':_0x223003['WhatsappAccountId']}});}})[_0xee26('0x20')](handleEntityNotFound(_0x1188d1,null))[_0xee26('0x20')](function(_0x502edf){if(_0x502edf){logger[_0xee26('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xee26('0x33'),_0xee26('0x88'),_0x502edf[_0xee26('0x3f')],util[_0xee26('0x89')](_0x3dde91[_0xee26('0x5b')],{'showHidden':![],'depth':null}));switch(_0x502edf[_0xee26('0x3f')]){case'twilio':if(_0x3dde91[_0xee26('0x5b')][_0xee26('0x8a')]&&_0x3dde91[_0xee26('0x5b')][_0xee26('0x8a')]===_0x1d6050[_0xee26('0x8b')]&&_0x3dde91[_0xee26('0x5b')][_0xee26('0x8c')]&&_0x3dde91[_0xee26('0x5b')][_0xee26('0x8c')]===_0xee26('0x8d')){return _0x1d6050[_0xee26('0x37')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xee26('0x33'),_0xee26('0x8e'),util['inspect'](_0x3dde91[_0xee26('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x1d6050;}})['then'](respondWithResult(_0x1188d1,null))[_0xee26('0x2b')](handleError(_0x1188d1,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e05bb34..ef86309 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 _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 +var _0xe130=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x46a01f,_0x425306){var _0x3fb6dd=function(_0x4a590e){while(--_0x4a590e){_0x46a01f['push'](_0x46a01f['shift']());}};_0x3fb6dd(++_0x425306);}(_0xe130,0x127));var _0x0e13=function(_0x3e7eea,_0x42397b){_0x3e7eea=_0x3e7eea-0x0;var _0x5d2b6f=_0xe130[_0x3e7eea];return _0x5d2b6f;};'use strict';var EventEmitter=require(_0x0e13('0x0'));var WhatsappMessage=require(_0x0e13('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0e13('0x2')](0x0);var events={'afterCreate':_0x0e13('0x3'),'afterUpdate':_0x0e13('0x4'),'afterDestroy':_0x0e13('0x5')};function emitEvent(_0x449ddd){return function(_0x504f15,_0x1489a9,_0x223c28){WhatsappMessageEvents[_0x0e13('0x6')](_0x449ddd+':'+_0x504f15['id'],_0x504f15);WhatsappMessageEvents[_0x0e13('0x6')](_0x449ddd,_0x504f15);_0x223c28(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x0e13('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 333d8cc..5c21858 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 _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 +var _0x44ca=['statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','toLowerCase','direction','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','out','find','then','type','twilio','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','accountSid','authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x44ca,0xe6));var _0xa44c=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0x44ca[_0x4169d8];return _0x32084a;};'use strict';var _=require(_0xa44c('0x0'));var util=require(_0xa44c('0x1'));var logger=require(_0xa44c('0x2'))('api');var moment=require(_0xa44c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0xa44c('0x4'));var fs=require('fs');var path=require(_0xa44c('0x5'));var rimraf=require(_0xa44c('0x6'));var config=require(_0xa44c('0x7'));var attributes=require(_0xa44c('0x8'));module['exports']=function(_0x214fca,_0x1d1c4b){return _0x214fca[_0xa44c('0x9')]('WhatsappMessage',attributes,{'tableName':_0xa44c('0xa'),'paranoid':![],'indexes':[{'name':_0xa44c('0xb'),'fields':[_0xa44c('0xb')]},{'name':_0xa44c('0xc'),'fields':[_0xa44c('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a46a9,_0x12e2b4,_0x4457da){var _0x295d61=_0x214fca[_0xa44c('0xe')];var _0x142d12=_0x5a46a9['get']({'plain':!![]});if(_0x142d12['direction'][_0xa44c('0xf')]()==='in'||_0x142d12[_0xa44c('0x10')][_0xa44c('0xf')]()==='out'&&!_0x142d12[_0xa44c('0x11')]&&!_['isNil'](_0x142d12[_0xa44c('0x12')])){_0x295d61[_0xa44c('0x13')][_0xa44c('0x14')]({'where':{'id':_0x142d12[_0xa44c('0x15')]}})['then'](function(_0x567a95){if(_0x567a95){_0x567a95[_0xa44c('0x16')]({'lastMsgAt':_0x142d12[_0xa44c('0x17')],'lastMsgDirection':_0x142d12[_0xa44c('0x10')][_0xa44c('0xf')]()});}})['catch'](function(_0x574df7){console['error'](_0x574df7);});}if(_0x142d12[_0xa44c('0x10')]===_0xa44c('0x18')&&!_0x142d12['secret']){var _0x4be612;_0x295d61['WhatsappAccount'][_0xa44c('0x19')]({'where':{'id':_0x142d12['WhatsappAccountId']},'raw':!![]})[_0xa44c('0x1a')](function(_0x56a346){_0x4be612=_0x56a346;if(_0x4be612&&_0x4be612['type']){switch(_0x4be612[_0xa44c('0x1b')]){case _0xa44c('0x1c'):var _0x43b76d=require(_0xa44c('0x1c'));if(_0x4be612['accountSid']&&_0x4be612['authToken']&&_0x4be612[_0xa44c('0x1d')]){var _0x105211=new _0x43b76d(_0x4be612['accountSid'],_0x4be612['authToken']);_0x105211[_0xa44c('0x1e')][_0xa44c('0x1f')]({'body':_0x142d12[_0xa44c('0xd')],'to':_0xa44c('0x20')+_0x142d12[_0xa44c('0x1d')],'from':'whatsapp:'+_0x4be612[_0xa44c('0x1d')],'statusCallback':_0x4be612[_0xa44c('0x21')]+_0xa44c('0x22')+_0x142d12['id']+'/status?token='+_0x4be612[_0xa44c('0x23')]})[_0xa44c('0x1a')](function(_0x11d3e9){if(_0x11d3e9[_0xa44c('0x24')]){return _0x5a46a9['update']({'messageId':_0x11d3e9[_0xa44c('0x24')]});}})[_0xa44c('0x25')](function(_0x156cbf){logger[_0xa44c('0x26')](_0xa44c('0x27'),'afterCreate',_0xa44c('0x1c'),util['inspect'](_0x156cbf,{'showHidden':![],'depth':null}));});}else{logger[_0xa44c('0x26')](_0xa44c('0x27'),_0xa44c('0x28'),_0xa44c('0x1c'),_0xa44c('0x29'));}break;case _0xa44c('0x2a'):var _0x42e649=_0x4be612[_0xa44c('0x2b')];var _0x1ee75a=_0x4be612[_0xa44c('0x2c')];var _0x1cf489=_0x4be612[_0xa44c('0x2d')]+_0xa44c('0x2e')+_0x42e649+_0xa44c('0x2f');var _0xf6c90a={'to':[_0x142d12[_0xa44c('0x1d')]],'message':{'type':_0xa44c('0x30'),'text':_0x142d12[_0xa44c('0xd')]}};var _0x4885ba={'method':_0xa44c('0x31'),'uri':_0x1cf489,'headers':{'Authorization':'Bearer\x20'+_0x1ee75a,'Content-Type':'application/json'},'body':_0xf6c90a,'json':!![]};rp(_0x4885ba)[_0xa44c('0x1a')](function(_0x555db0){if(_0x555db0[_0xa44c('0x32')][0x0][_0xa44c('0x33')]){return _0x5a46a9[_0xa44c('0x16')]({'messageId':_0x555db0['statuses'][0x0][_0xa44c('0x33')]});}})['catch'](function(_0x262f4b){logger[_0xa44c('0x34')]('WhatsappMessage,\x20%s',_0x262f4b);});break;}}})[_0xa44c('0x35')](function(){_0x4457da();});}else{_0x4457da();}}},'charset':_0xa44c('0x36'),'collate':_0xa44c('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1b1cee2..28cfe13 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 _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 +var _0x7067=['WhatsappMessage,\x20%s,\x20%s','result','create','body','options','CreateWhatsappMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x32194d,_0x174cd5){var _0x10217d=function(_0x1d5e66){while(--_0x1d5e66){_0x32194d['push'](_0x32194d['shift']());}};_0x10217d(++_0x174cd5);}(_0x7067,0x87));var _0x7706=function(_0x46d838,_0x16ef6d){_0x46d838=_0x46d838-0x0;var _0x3f820a=_0x7067[_0x46d838];return _0x3f820a;};'use strict';var _=require(_0x7706('0x0'));var util=require(_0x7706('0x1'));var moment=require(_0x7706('0x2'));var BPromise=require(_0x7706('0x3'));var rs=require(_0x7706('0x4'));var fs=require('fs');var Redis=require(_0x7706('0x5'));var db=require(_0x7706('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7706('0x7'));var config=require(_0x7706('0x8'));var jayson=require(_0x7706('0x9'));var client=jayson[_0x7706('0xa')][_0x7706('0xb')]({'port':0x232a});config[_0x7706('0xc')]=_[_0x7706('0xd')](config[_0x7706('0xc')],{'host':_0x7706('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7706('0xc')]));require(_0x7706('0xf'))[_0x7706('0x10')](socket);function respondWithRpcPromise(_0x119d17,_0x14b054,_0x504c9a){return new BPromise(function(_0x28bd66,_0x9ef330){return client['request'](_0x119d17,_0x504c9a)[_0x7706('0x11')](function(_0x39c005){logger[_0x7706('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x14b054,_0x7706('0x13'));logger[_0x7706('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x14b054,_0x7706('0x13'),JSON[_0x7706('0x15')](_0x39c005));if(_0x39c005[_0x7706('0x16')]){if(_0x39c005['error'][_0x7706('0x17')]===0x1f4){logger[_0x7706('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x14b054,_0x39c005[_0x7706('0x16')][_0x7706('0x18')]);return _0x9ef330(_0x39c005['error'][_0x7706('0x18')]);}logger[_0x7706('0x16')](_0x7706('0x19'),_0x14b054,_0x39c005[_0x7706('0x16')][_0x7706('0x18')]);return _0x28bd66(_0x39c005[_0x7706('0x16')]['message']);}else{logger[_0x7706('0x12')](_0x7706('0x19'),_0x14b054,_0x7706('0x13'));_0x28bd66(_0x39c005[_0x7706('0x1a')][_0x7706('0x18')]);}})['catch'](function(_0x30270c){logger['error'](_0x7706('0x19'),_0x14b054,_0x30270c);_0x9ef330(_0x30270c);});});}exports['CreateWhatsappMessage']=function(_0x64b4c5){var _0x115749=this;return new Promise(function(_0x29d9ef,_0x33da73){return db['WhatsappMessage'][_0x7706('0x1b')](_0x64b4c5[_0x7706('0x1c')],{'raw':_0x64b4c5[_0x7706('0x1d')]?_0x64b4c5[_0x7706('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4dce93){logger[_0x7706('0x12')](_0x7706('0x1e'),_0x64b4c5);logger['debug'](_0x7706('0x1e'),_0x64b4c5,JSON[_0x7706('0x15')](_0x4dce93));_0x29d9ef(_0x4dce93);})[_0x7706('0x1f')](function(_0xd7c277){logger[_0x7706('0x16')](_0x7706('0x1e'),_0xd7c277['message'],_0x64b4c5);_0x33da73(_0x115749['error'](0x1f4,_0xd7c277['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 2ea0c21..53e69e0 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 _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 +var _0x6cb9=['remove','emit','removeListener','register','length','./whatsappMessage.events','save'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x6cb9,0xbb));var _0x96cb=function(_0xacd69c,_0x305440){_0xacd69c=_0xacd69c-0x0;var _0x519594=_0x6cb9[_0xacd69c];return _0x519594;};'use strict';var WhatsappMessageEvents=require(_0x96cb('0x0'));var events=[_0x96cb('0x1'),_0x96cb('0x2'),'update'];function createListener(_0x4e3241,_0x5514a9){return function(_0x1cfdcd){_0x5514a9[_0x96cb('0x3')](_0x4e3241,_0x1cfdcd);};}function removeListener(_0x28ab8b,_0xa3f691){return function(){WhatsappMessageEvents[_0x96cb('0x4')](_0x28ab8b,_0xa3f691);};}exports[_0x96cb('0x5')]=function(_0x5d96c7){for(var _0xa7d80a=0x0,_0x21d1c7=events[_0x96cb('0x6')];_0xa7d80a<_0x21d1c7;_0xa7d80a++){var _0x567699=events[_0xa7d80a];var _0x22c0e3=createListener('whatsappMessage:'+_0x567699,_0x5d96c7);WhatsappMessageEvents['on'](_0x567699,_0x22c0e3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6164dbe..3426778 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 _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 +var _0x7883=['post','/:id/teams','/:id/users','put','delete','removeTeams','removeAgents','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams'];(function(_0x2de59e,_0x24b766){var _0x534d4b=function(_0x30617b){while(--_0x30617b){_0x2de59e['push'](_0x2de59e['shift']());}};_0x534d4b(++_0x24b766);}(_0x7883,0x8b));var _0x3788=function(_0x1ae81f,_0x3c0dd6){_0x1ae81f=_0x1ae81f-0x0;var _0x102107=_0x7883[_0x1ae81f];return _0x102107;};'use strict';var multer=require(_0x3788('0x0'));var util=require('util');var path=require(_0x3788('0x1'));var timeout=require('connect-timeout');var express=require(_0x3788('0x2'));var router=express['Router']();var fs_extra=require(_0x3788('0x3'));var auth=require(_0x3788('0x4'));var interaction=require(_0x3788('0x5'));var config=require(_0x3788('0x6'));var controller=require('./whatsappQueue.controller');router[_0x3788('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3788('0x7')](_0x3788('0x8'),auth[_0x3788('0x9')](),controller['describe']);router['get'](_0x3788('0xa'),auth[_0x3788('0x9')](),controller[_0x3788('0xb')]);router[_0x3788('0x7')](_0x3788('0xc'),auth[_0x3788('0x9')](),controller[_0x3788('0xd')]);router['get']('/:id/teams',auth[_0x3788('0x9')](),controller[_0x3788('0xe')]);router[_0x3788('0x7')]('/:id/users',auth[_0x3788('0x9')](),controller['getAgents']);router[_0x3788('0xf')]('/',auth[_0x3788('0x9')](),controller['create']);router[_0x3788('0xf')](_0x3788('0x10'),auth[_0x3788('0x9')](),controller['addTeams']);router[_0x3788('0xf')](_0x3788('0x11'),auth[_0x3788('0x9')](),controller['addAgents']);router[_0x3788('0x12')]('/:id',auth[_0x3788('0x9')](),controller['update']);router[_0x3788('0x13')]('/:id',auth[_0x3788('0x9')](),controller['destroy']);router[_0x3788('0x13')](_0x3788('0x10'),auth[_0x3788('0x9')](),controller[_0x3788('0x14')]);router[_0x3788('0x13')](_0x3788('0x11'),auth[_0x3788('0x9')](),controller[_0x3788('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 126e244..0a29b58 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 _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 +var _0x885e=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','name'];(function(_0x221244,_0x206702){var _0x209ee2=function(_0x50674e){while(--_0x50674e){_0x221244['push'](_0x221244['shift']());}};_0x209ee2(++_0x206702);}(_0x885e,0xe4));var _0xe885=function(_0x2ea651,_0x5ac315){_0x2ea651=_0x2ea651-0x0;var _0x2fa5cc=_0x885e[_0x2ea651];return _0x2fa5cc;};'use strict';var Sequelize=require(_0xe885('0x0'));module[_0xe885('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe885('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe885('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe885('0x4')](_0xe885('0x5'),_0xe885('0x6'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 70d37cf..0cb70c7 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 _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 +var _0x119e=['then','WhatsappQueues','destroy','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','include','query','rows','catch','show','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','where','WhatsappQueueId','filter','findAll','User','UserId','whatsappPause','createdAt','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update'];(function(_0x1aba6a,_0x3018a3){var _0x148845=function(_0x435a2a){while(--_0x435a2a){_0x1aba6a['push'](_0x1aba6a['shift']());}};_0x148845(++_0x3018a3);}(_0x119e,0x16e));var _0xe119=function(_0x58ab6b,_0x1e6049){_0x58ab6b=_0x58ab6b-0x0;var _0x28901b=_0x119e[_0x58ab6b];return _0x28901b;};'use strict';var BPromise=require(_0xe119('0x0'));var util=require(_0xe119('0x1'));var _=require(_0xe119('0x2'));var squel=require(_0xe119('0x3'));var Redis=require('ioredis');var qs=require(_0xe119('0x4'));var logger=require(_0xe119('0x5'))('api');var config=require(_0xe119('0x6'));var db=require(_0xe119('0x7'))['db'];config[_0xe119('0x8')]=_[_0xe119('0x9')](config[_0xe119('0x8')],{'host':_0xe119('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe119('0xb'))[_0xe119('0xc')](socket);function respondWithStatusCode(_0x47c3cd,_0x4912ed){_0x4912ed=_0x4912ed||0xcc;return function(_0x558fed){if(_0x558fed){return _0x47c3cd[_0xe119('0xd')](_0x4912ed);}return _0x47c3cd[_0xe119('0xe')](_0x4912ed)[_0xe119('0xf')]();};}function respondWithResult(_0x114ffd,_0x4b970e){_0x4b970e=_0x4b970e||0xc8;return function(_0x283054){if(_0x283054){return _0x114ffd['status'](_0x4b970e)[_0xe119('0x10')](_0x283054);}};}function respondWithFilteredResult(_0x39784c,_0x9ff127){return function(_0x35b2f6){if(_0x35b2f6){var _0x16e30a=typeof _0x9ff127[_0xe119('0x11')]==='undefined'&&typeof _0x9ff127[_0xe119('0x12')]===_0xe119('0x13');var _0x30667f=_0x35b2f6[_0xe119('0x14')];var _0x36bcc7=_0x16e30a?0x0:_0x9ff127['offset'];var _0x3577b3=_0x16e30a?_0x35b2f6['count']:_0x9ff127['offset']+_0x9ff127[_0xe119('0x12')];var _0x24b092;if(_0x3577b3>=_0x30667f){_0x3577b3=_0x30667f;_0x24b092=0xc8;}else{_0x24b092=0xce;}_0x39784c[_0xe119('0xe')](_0x24b092);return _0x39784c[_0xe119('0x15')](_0xe119('0x16'),_0x36bcc7+'-'+_0x3577b3+'/'+_0x30667f)[_0xe119('0x10')](_0x35b2f6);}return null;};}function saveUpdates(_0x1f74af){return function(_0x55dfa8){if(_0x55dfa8){return _0x55dfa8[_0xe119('0x17')](_0x1f74af)[_0xe119('0x18')](function(_0x540a2c){return _0x540a2c;});}return null;};}function removeEntity(_0x391933){return function(_0x1898c6){if(_0x1898c6){return _0x1898c6['destroy']()[_0xe119('0x18')](function(){var _0x149c33=_0x1898c6['get']({'plain':!![]});var _0x528e0a=_0xe119('0x19');return db['UserProfileResource'][_0xe119('0x1a')]({'where':{'type':_0x528e0a,'resourceId':_0x149c33['id']}})[_0xe119('0x18')](function(){return _0x1898c6;});})[_0xe119('0x18')](function(){_0x391933[_0xe119('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e44b3){return function(_0x2f10fb){if(!_0x2f10fb){_0x1e44b3[_0xe119('0xd')](0x194);}return _0x2f10fb;};}function handleError(_0x2f91f5,_0x4f1bbe){_0x4f1bbe=_0x4f1bbe||0x1f4;return function(_0x1807b0){logger[_0xe119('0x1b')](_0x1807b0[_0xe119('0x1c')]);if(_0x1807b0[_0xe119('0x1d')]){delete _0x1807b0[_0xe119('0x1d')];}_0x2f91f5[_0xe119('0xe')](_0x4f1bbe)[_0xe119('0x1e')](_0x1807b0);};}exports[_0xe119('0x1f')]=function(_0x2005aa,_0x2e015d){var _0x50e0be={};var _0x20a2b1={'count':0x0,'rows':[]};var _0x1f4183=_[_0xe119('0x20')](db[_0xe119('0x21')][_0xe119('0x22')],function(_0x1fc917){return{'name':_0x1fc917[_0xe119('0x23')],'type':_0x1fc917[_0xe119('0x24')][_0xe119('0x25')]};});_0x50e0be=qs[_0xe119('0x26')](_0x1f4183,_0x2005aa);var _0x4bd56e={'where':_0x50e0be['where']};return db[_0xe119('0x21')][_0xe119('0x14')](_0x4bd56e)[_0xe119('0x18')](function(_0x1730ec){_0x20a2b1['count']=_0x1730ec;_0x50e0be[_0xe119('0x27')]=qs[_0xe119('0x27')](_0x2005aa[_0xe119('0x28')]);return db[_0xe119('0x21')]['findAll'](_0x50e0be);})[_0xe119('0x18')](function(_0x5e76d2){_0x20a2b1[_0xe119('0x29')]=_0x5e76d2;return _0x20a2b1;})[_0xe119('0x18')](respondWithFilteredResult(_0x2e015d,_0x50e0be))[_0xe119('0x2a')](handleError(_0x2e015d,null));};exports[_0xe119('0x2b')]=function(_0x1841ea,_0x3b85da){var _0x150744={'raw':!![],'where':{'id':_0x1841ea['params']['id']}},_0x384bcc={};_0x384bcc['model']=_[_0xe119('0x2c')](db[_0xe119('0x21')][_0xe119('0x22')]);_0x384bcc[_0xe119('0x28')]=_['keys'](_0x1841ea[_0xe119('0x28')]);_0x384bcc[_0xe119('0x2d')]=_[_0xe119('0x2e')](_0x384bcc[_0xe119('0x2f')],_0x384bcc[_0xe119('0x28')]);_0x150744[_0xe119('0x30')]=_[_0xe119('0x2e')](_0x384bcc['model'],qs[_0xe119('0x31')](_0x1841ea[_0xe119('0x28')][_0xe119('0x31')]));_0x150744['attributes']=_0x150744['attributes'][_0xe119('0x32')]?_0x150744['attributes']:_0x384bcc[_0xe119('0x2f')];if(_0x1841ea['query'][_0xe119('0x33')]){_0x150744[_0xe119('0x27')]=[{'all':!![]}];}_0x150744=_[_0xe119('0x34')]({},_0x150744,_0x1841ea[_0xe119('0x35')]);return db[_0xe119('0x21')][_0xe119('0x36')](_0x150744)[_0xe119('0x18')](handleEntityNotFound(_0x3b85da,null))[_0xe119('0x18')](respondWithResult(_0x3b85da,null))[_0xe119('0x2a')](handleError(_0x3b85da,null));};exports['create']=function(_0x37e6e4,_0x9dcc48){return db['WhatsappQueue']['create'](_0x37e6e4[_0xe119('0x37')],{})[_0xe119('0x18')](function(_0x1d897a){var _0x279e6a=_0x37e6e4[_0xe119('0x38')][_0xe119('0x39')]({'plain':!![]});if(!_0x279e6a)throw new Error(_0xe119('0x3a'));if(_0x279e6a[_0xe119('0x3b')]==='user'){var _0x1eb9ef=_0x1d897a[_0xe119('0x39')]({'plain':!![]});var _0x138a87=_0xe119('0x19');return db[_0xe119('0x3c')][_0xe119('0x36')]({'where':{'name':_0x138a87,'userProfileId':_0x279e6a[_0xe119('0x3d')]},'raw':!![]})[_0xe119('0x18')](function(_0x3461db){if(_0x3461db&&_0x3461db[_0xe119('0x3e')]===0x0){return db[_0xe119('0x3f')][_0xe119('0x40')]({'name':_0x1eb9ef[_0xe119('0x1d')],'resourceId':_0x1eb9ef['id'],'type':_0x3461db['name'],'sectionId':_0x3461db['id']},{})[_0xe119('0x18')](function(){return _0x1d897a;});}else{return _0x1d897a;}})[_0xe119('0x2a')](function(_0x2f0db2){logger[_0xe119('0x1b')](_0xe119('0x41'),_0x2f0db2);throw _0x2f0db2;});}return _0x1d897a;})['then'](respondWithResult(_0x9dcc48,0xc9))[_0xe119('0x2a')](handleError(_0x9dcc48,null));};exports[_0xe119('0x17')]=function(_0x4900ba,_0x219caa){if(_0x4900ba[_0xe119('0x37')]['id']){delete _0x4900ba[_0xe119('0x37')]['id'];}return db[_0xe119('0x21')][_0xe119('0x36')]({'where':{'id':_0x4900ba['params']['id']}})[_0xe119('0x18')](handleEntityNotFound(_0x219caa,null))[_0xe119('0x18')](saveUpdates(_0x4900ba[_0xe119('0x37')],null))[_0xe119('0x18')](respondWithResult(_0x219caa,null))[_0xe119('0x2a')](handleError(_0x219caa,null));};exports[_0xe119('0x1a')]=function(_0x8baf1d,_0x3530a3){return db['WhatsappQueue'][_0xe119('0x36')]({'where':{'id':_0x8baf1d[_0xe119('0x42')]['id']}})[_0xe119('0x18')](handleEntityNotFound(_0x3530a3,null))[_0xe119('0x18')](removeEntity(_0x3530a3,null))[_0xe119('0x2a')](handleError(_0x3530a3,null));};exports[_0xe119('0x43')]=function(_0x37f655,_0x2aee4d){return db[_0xe119('0x21')][_0xe119('0x43')]()[_0xe119('0x18')](respondWithResult(_0x2aee4d,null))['catch'](handleError(_0x2aee4d,null));};exports[_0xe119('0x44')]=function(_0x174eba,_0x5f0a07){var _0x25aa82={'raw':!![],'where':{}},_0x5bcecf={},_0x285fa6;return db[_0xe119('0x21')][_0xe119('0x45')]({'where':{'id':_0x174eba['params']['id']}})['then'](handleEntityNotFound(_0x5f0a07,null))['then'](function(_0x57c481){if(_0x57c481){_0x285fa6=_0x57c481[_0xe119('0x39')]({'plain':!![]});_0x5bcecf['model']=_[_0xe119('0x2c')](db[_0xe119('0x46')]['rawAttributes']);_0x5bcecf[_0xe119('0x28')]=_[_0xe119('0x2c')](_0x174eba[_0xe119('0x28')]);_0x5bcecf[_0xe119('0x2d')]=_[_0xe119('0x2e')](_0x5bcecf['model'],_0x5bcecf['query']);_0x25aa82[_0xe119('0x30')]=_[_0xe119('0x2e')](_0x5bcecf[_0xe119('0x2f')],qs['fields'](_0x174eba['query'][_0xe119('0x31')]));_0x25aa82[_0xe119('0x30')]=_0x25aa82[_0xe119('0x30')][_0xe119('0x32')]?_0x25aa82['attributes']:_0x5bcecf[_0xe119('0x2f')];if(!_0x174eba[_0xe119('0x28')][_0xe119('0x47')](_0xe119('0x48'))){_0x25aa82[_0xe119('0x12')]=qs[_0xe119('0x12')](_0x174eba[_0xe119('0x28')]['limit']);_0x25aa82[_0xe119('0x11')]=qs[_0xe119('0x11')](_0x174eba[_0xe119('0x28')][_0xe119('0x11')]);}_0x25aa82[_0xe119('0x49')]=qs['sort'](_0x174eba[_0xe119('0x28')][_0xe119('0x4a')]);_0x25aa82['where']=qs[_0xe119('0x2d')](_['pick'](_0x174eba['query'],_0x5bcecf[_0xe119('0x2d')]));_0x25aa82[_0xe119('0x4b')][_0xe119('0x4c')]=_0x57c481['id'];if(_0x174eba['query']['filter']){_0x25aa82['where']=_[_0xe119('0x34')](_0x25aa82[_0xe119('0x4b')],{'$or':_[_0xe119('0x20')](_0x25aa82[_0xe119('0x30')],function(_0xda4fe9){var _0x29aa99={};_0x29aa99[_0xda4fe9]={'$like':'%'+_0x174eba[_0xe119('0x28')][_0xe119('0x4d')]+'%'};return _0x29aa99;})});}_0x25aa82=_[_0xe119('0x34')]({},_0x25aa82,_0x174eba[_0xe119('0x35')]);return db[_0xe119('0x46')][_0xe119('0x4e')](_0x25aa82);}})['then'](function(_0x413bd5){if(_0x413bd5){return db[_0xe119('0x4f')]['findAndCountAll']({'where':{'id':_[_0xe119('0x20')](_0x413bd5,_0xe119('0x50')),'role':'agent'},'attributes':['id',_0xe119('0x1d'),_0xe119('0x51'),'updatedAt',_0xe119('0x52')]});}})['then'](function(_0x1ad271){if(_0x1ad271){return{'count':_0x1ad271['count'],'rows':_[_0xe119('0x20')](_0x1ad271[_0xe119('0x29')],function(_0x3e8813){return{'membername':_0x3e8813[_0xe119('0x1d')],'UserId':_0x3e8813['id'],'queue_name':_0x285fa6[_0xe119('0x1d')],'WhatsappQueueId':_0x285fa6['id'],'interface':util[_0xe119('0x53')](_0xe119('0x54'),_0xe119('0x55'),_0x3e8813['name']),'penalty':0x0,'paused':_0x3e8813[_0xe119('0x51')],'createdAt':_0x3e8813['createdAt'],'updatedAt':_0x3e8813['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe119('0x18')](respondWithFilteredResult(_0x5f0a07,_0x25aa82))['catch'](handleError(_0x5f0a07,null));};exports[_0xe119('0x56')]=function(_0x5d6c75,_0x488eb5){var _0x27a300={};var _0x45b8ef={};var _0x2f6c61;var _0x32f641;return db[_0xe119('0x21')][_0xe119('0x45')]({'where':{'id':_0x5d6c75[_0xe119('0x42')]['id']}})[_0xe119('0x18')](handleEntityNotFound(_0x488eb5,null))[_0xe119('0x18')](function(_0x4bb03c){if(_0x4bb03c){_0x2f6c61=_0x4bb03c;_0x45b8ef['model']=_['keys'](db[_0xe119('0x57')]['rawAttributes']);_0x45b8ef[_0xe119('0x28')]=_[_0xe119('0x2c')](_0x5d6c75[_0xe119('0x28')]);_0x45b8ef['filters']=_[_0xe119('0x2e')](_0x45b8ef['model'],_0x45b8ef[_0xe119('0x28')]);_0x27a300[_0xe119('0x30')]=_[_0xe119('0x2e')](_0x45b8ef[_0xe119('0x2f')],qs[_0xe119('0x31')](_0x5d6c75[_0xe119('0x28')][_0xe119('0x31')]));_0x27a300[_0xe119('0x30')]=_0x27a300['attributes'][_0xe119('0x32')]?_0x27a300[_0xe119('0x30')]:_0x45b8ef['model'];_0x27a300[_0xe119('0x49')]=qs['sort'](_0x5d6c75['query'][_0xe119('0x4a')]);_0x27a300[_0xe119('0x4b')]=qs[_0xe119('0x2d')](_[_0xe119('0x58')](_0x5d6c75['query'],_0x45b8ef[_0xe119('0x2d')]));if(_0x5d6c75[_0xe119('0x28')]['filter']){_0x27a300[_0xe119('0x4b')]=_[_0xe119('0x34')](_0x27a300[_0xe119('0x4b')],{'$or':_[_0xe119('0x20')](_0x27a300['attributes'],function(_0x2b4b30){var _0x4e8f0c={};_0x4e8f0c[_0x2b4b30]={'$like':'%'+_0x5d6c75[_0xe119('0x28')][_0xe119('0x4d')]+'%'};return _0x4e8f0c;})});}_0x27a300=_[_0xe119('0x34')]({},_0x27a300,_0x5d6c75[_0xe119('0x35')]);return _0x2f6c61[_0xe119('0x56')](_0x27a300);}})['then'](function(_0x21d3e7){if(_0x21d3e7){_0x32f641=_0x21d3e7[_0xe119('0x32')];if(!_0x5d6c75[_0xe119('0x28')]['hasOwnProperty'](_0xe119('0x48'))){_0x27a300[_0xe119('0x12')]=qs[_0xe119('0x12')](_0x5d6c75[_0xe119('0x28')]['limit']);_0x27a300[_0xe119('0x11')]=qs[_0xe119('0x11')](_0x5d6c75['query']['offset']);}return _0x2f6c61[_0xe119('0x56')](_0x27a300);}})[_0xe119('0x18')](function(_0x453366){if(_0x453366){return _0x453366?{'count':_0x32f641,'rows':_0x453366}:null;}})[_0xe119('0x18')](respondWithResult(_0x488eb5,null))[_0xe119('0x2a')](handleError(_0x488eb5,null));};exports[_0xe119('0x59')]=function(_0x8d5b1f,_0x4e459e){var _0x1441d7=_0x8d5b1f[_0xe119('0x37')][_0xe119('0x5a')];return db[_0xe119('0x57')][_0xe119('0x4e')]({'where':{'id':_0x1441d7},'attributes':['id'],'include':[{'model':db[_0xe119('0x4f')],'as':_0xe119('0x5b'),'attributes':['id','name','online',_0xe119('0x5c'),_0xe119('0x5d')],'raw':!![]}]})[_0xe119('0x18')](function(_0x401146){if(_0x401146){var _0x512eff=_[_0xe119('0x5e')](_0x401146,function(_0x43684b){var _0x382f57=_0x43684b[_0xe119('0x39')]({'plain':!![]});return _0x382f57[_0xe119('0x5b')];});return db['WhatsappQueue']['find']({'where':{'id':_0x8d5b1f[_0xe119('0x42')]['id']}})[_0xe119('0x18')](function(_0x445ad6){return db[_0xe119('0x5f')]['transaction'](function(_0x515580){return _0x445ad6[_0xe119('0x59')](_0x1441d7,{'transaction':_0x515580})[_0xe119('0x18')](function(){return BPromise[_0xe119('0x60')](_0x512eff,function(_0x392b78){return db[_0xe119('0x46')][_0xe119('0x61')]({'where':{'UserId':_0x392b78['id'],'WhatsappQueueId':_0x8d5b1f[_0xe119('0x42')]['id']},'transaction':_0x515580});});})[_0xe119('0x18')](function(){_0x512eff[_0xe119('0x62')](function(_0x327c84){socket[_0xe119('0x63')](_0xe119('0x64'),{'UserId':_0x327c84['id'],'WhatsappQueueId':_0x445ad6['id']});});});});});}})[_0xe119('0x18')](respondWithStatusCode(_0x4e459e,null))[_0xe119('0x2a')](handleError(_0x4e459e,null));};exports[_0xe119('0x65')]=function(_0x38434e,_0x82d5c7){return db[_0xe119('0x57')][_0xe119('0x4e')]({'where':{'id':_0x38434e[_0xe119('0x28')][_0xe119('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xe119('0x4f')],'as':_0xe119('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xe119('0x18')](handleEntityNotFound(_0x82d5c7,null))[_0xe119('0x18')](function(_0x5b7940){var _0x560d88=_[_0xe119('0x20')](_0x5b7940,'id');var _0x93a875=[];var _0x57fd8b=[];var _0x57e04c=squel['select']();_0x57e04c[_0xe119('0x66')](_0xe119('0x67'))[_0xe119('0x68')](_0xe119('0x69'),'tq')['join'](_0xe119('0x6a'),'ut',_0xe119('0x6b'))[_0xe119('0x4b')](_0xe119('0x6c'),_0x38434e[_0xe119('0x42')]['id']);for(var _0x19f025=0x0;_0x19f025<_0x5b7940[_0xe119('0x32')];_0x19f025+=0x1){let _0x52013e=_0x5b7940[_0x19f025];for(var _0x2dd316=0x0;_0x2dd316<_0x52013e[_0xe119('0x5b')][_0xe119('0x32')];_0x2dd316+=0x1){let _0x4799df=_0x52013e['Agents'][_0x2dd316];var _0x169cd8=_0x57e04c[_0xe119('0x6d')]();_0x169cd8['where'](_0xe119('0x6e'),_0x4799df['id']);_0x57fd8b[_0xe119('0x6f')](db[_0xe119('0x5f')]['query'](_0x169cd8[_0xe119('0x70')](),{'type':db[_0xe119('0x5f')][_0xe119('0x71')][_0xe119('0x72')]})[_0xe119('0x18')](function(_0x357715){if(_0x357715[_0xe119('0x32')]===0x1){return _0x4799df['id'];}else{var _0xb590c=_[_0xe119('0x73')](_[_0xe119('0x20')](_0x357715,_0xe119('0x74')),function(_0x5b720e){return _[_0xe119('0x75')](_0x560d88,_0x5b720e);});if(_0xb590c){return _0x4799df['id'];}}}));}}return BPromise[_0xe119('0x76')](_0x57fd8b)[_0xe119('0x18')](function(_0x335308){_0x93a875=_(_0x93a875)[_0xe119('0x77')](_0x335308)['compact']()[_0xe119('0x78')]();return db['WhatsappQueue'][_0xe119('0x36')]({'where':{'id':_0x38434e[_0xe119('0x42')]['id']}})[_0xe119('0x18')](function(_0x4d4553){return db['sequelize'][_0xe119('0x79')](function(_0x1993d2){return _0x4d4553[_0xe119('0x65')](_0x38434e[_0xe119('0x28')][_0xe119('0x5a')],{'transaction':_0x1993d2})[_0xe119('0x18')](function(){if(!_[_0xe119('0x7a')](_0x93a875)){return _0x4d4553['removeAgents'](_0x93a875,{'transaction':_0x1993d2});}})[_0xe119('0x18')](function(){_0x93a875['forEach'](function(_0x5cb69e){socket['emit'](_0xe119('0x7b'),{'UserId':_0x5cb69e,'WhatsappQueueId':_0x4d4553['id']});});});});});});})['then'](respondWithStatusCode(_0x82d5c7,null))[_0xe119('0x2a')](handleError(_0x82d5c7,null));};exports[_0xe119('0x7c')]=function(_0x19032f,_0xa19cb4){return db[_0xe119('0x21')][_0xe119('0x36')]({'where':{'id':_0x19032f[_0xe119('0x42')]['id']}})[_0xe119('0x18')](handleEntityNotFound(_0xa19cb4,null))[_0xe119('0x18')](function(_0x278c77){if(_0x278c77){return _0x278c77[_0xe119('0x7c')](_0x19032f[_0xe119('0x37')][_0xe119('0x5a')],_[_0xe119('0x7d')](_0x19032f[_0xe119('0x37')],[_0xe119('0x5a'),'id'])||{})[_0xe119('0x7e')](function(_0x53a94c){for(var _0x5bb6ac=0x0;_0x5bb6ac<_0x19032f[_0xe119('0x37')][_0xe119('0x5a')][_0xe119('0x32')];_0x5bb6ac+=0x1){socket[_0xe119('0x63')]('userWhatsappQueue:save',{'UserId':Number(_0x19032f[_0xe119('0x37')][_0xe119('0x5a')][_0x5bb6ac]),'WhatsappQueueId':Number(_0x19032f[_0xe119('0x42')]['id'])});}return _0x53a94c;});}})[_0xe119('0x18')](respondWithResult(_0xa19cb4,null))[_0xe119('0x2a')](handleError(_0xa19cb4,null));};exports[_0xe119('0x7f')]=function(_0x537073,_0x1a63ff){return db['WhatsappQueue'][_0xe119('0x36')]({'where':{'id':_0x537073['params']['id']}})[_0xe119('0x18')](handleEntityNotFound(_0x1a63ff,null))[_0xe119('0x18')](function(_0x84e0f0){if(_0x84e0f0){return _0x84e0f0[_0xe119('0x7f')](_0x537073[_0xe119('0x28')][_0xe119('0x5a')])[_0xe119('0x18')](function(){if(_[_0xe119('0x80')](_0x537073[_0xe119('0x28')]['ids'])){for(var _0x1b27a4=0x0;_0x1b27a4<_0x537073[_0xe119('0x28')][_0xe119('0x5a')][_0xe119('0x32')];_0x1b27a4+=0x1){socket[_0xe119('0x63')](_0xe119('0x7b'),{'UserId':Number(_0x537073[_0xe119('0x28')]['ids'][_0x1b27a4]),'WhatsappQueueId':Number(_0x537073[_0xe119('0x42')]['id'])});}}else{socket['emit'](_0xe119('0x7b'),{'UserId':Number(_0x537073[_0xe119('0x28')][_0xe119('0x5a')]),'WhatsappQueueId':Number(_0x537073[_0xe119('0x42')]['id'])});}});}})[_0xe119('0x18')](respondWithStatusCode(_0x1a63ff,null))[_0xe119('0x2a')](handleError(_0x1a63ff,null));};exports[_0xe119('0x81')]=function(_0x2afcb5,_0x19cd52){var _0x4c34f3={};var _0x3c71fc={};var _0x5e2aed;var _0x5385cf;return db['WhatsappQueue']['findOne']({'where':{'id':_0x2afcb5[_0xe119('0x42')]['id']}})[_0xe119('0x18')](handleEntityNotFound(_0x19cd52,null))[_0xe119('0x18')](function(_0x31a0ae){if(_0x31a0ae){_0x5e2aed=_0x31a0ae;_0x3c71fc[_0xe119('0x2f')]=_[_0xe119('0x2c')](db[_0xe119('0x4f')][_0xe119('0x22')]);_0x3c71fc[_0xe119('0x28')]=_[_0xe119('0x2c')](_0x2afcb5[_0xe119('0x28')]);_0x3c71fc[_0xe119('0x2d')]=_[_0xe119('0x2e')](_0x3c71fc[_0xe119('0x2f')],_0x3c71fc[_0xe119('0x28')]);_0x4c34f3[_0xe119('0x30')]=_[_0xe119('0x2e')](_0x3c71fc['model'],qs[_0xe119('0x31')](_0x2afcb5[_0xe119('0x28')][_0xe119('0x31')]));_0x4c34f3[_0xe119('0x30')]=_0x4c34f3[_0xe119('0x30')]['length']?_0x4c34f3[_0xe119('0x30')]:_0x3c71fc[_0xe119('0x2f')];_0x4c34f3[_0xe119('0x49')]=qs[_0xe119('0x4a')](_0x2afcb5[_0xe119('0x28')][_0xe119('0x4a')]);_0x4c34f3[_0xe119('0x4b')]=qs['filters'](_[_0xe119('0x58')](_0x2afcb5[_0xe119('0x28')],_0x3c71fc[_0xe119('0x2d')]));if(_0x2afcb5[_0xe119('0x28')][_0xe119('0x4d')]){_0x4c34f3[_0xe119('0x4b')]=_[_0xe119('0x34')](_0x4c34f3[_0xe119('0x4b')],{'$or':_[_0xe119('0x20')](_0x4c34f3[_0xe119('0x30')],function(_0x1b23b8){var _0x5eb60c={};_0x5eb60c[_0x1b23b8]={'$like':'%'+_0x2afcb5[_0xe119('0x28')][_0xe119('0x4d')]+'%'};return _0x5eb60c;})});}_0x4c34f3=_[_0xe119('0x34')]({},_0x4c34f3,_0x2afcb5[_0xe119('0x35')]);return _0x5e2aed['getAgents'](_0x4c34f3);}})['then'](function(_0x53cf5f){if(_0x53cf5f){_0x5385cf=_0x53cf5f[_0xe119('0x32')];if(!_0x2afcb5['query'][_0xe119('0x47')](_0xe119('0x48'))){_0x4c34f3['limit']=qs[_0xe119('0x12')](_0x2afcb5[_0xe119('0x28')][_0xe119('0x12')]);_0x4c34f3[_0xe119('0x11')]=qs[_0xe119('0x11')](_0x2afcb5['query'][_0xe119('0x11')]);}return _0x5e2aed[_0xe119('0x81')](_0x4c34f3);}})[_0xe119('0x18')](function(_0xec0b75){if(_0xec0b75){return _0xec0b75?{'count':_0x5385cf,'rows':_0xec0b75}:null;}})[_0xe119('0x18')](respondWithResult(_0x19cd52,null))[_0xe119('0x2a')](handleError(_0x19cd52,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 5f3fd71..2432cfd 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 _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 +var _0x365e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x45fa84,_0x215351){var _0x42c133=function(_0x6ddd37){while(--_0x6ddd37){_0x45fa84['push'](_0x45fa84['shift']());}};_0x42c133(++_0x215351);}(_0x365e,0x1bc));var _0xe365=function(_0x3996f5,_0x5c8d76){_0x3996f5=_0x3996f5-0x0;var _0x4a7aeb=_0x365e[_0x3996f5];return _0x4a7aeb;};'use strict';var EventEmitter=require(_0xe365('0x0'));var WhatsappQueue=require(_0xe365('0x1'))['db'][_0xe365('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xe365('0x3')](0x0);var events={'afterCreate':_0xe365('0x4'),'afterUpdate':_0xe365('0x5'),'afterDestroy':'remove'};function emitEvent(_0x246dd5){return function(_0x129c95,_0x388a7d,_0x1ac435){WhatsappQueueEvents[_0xe365('0x6')](_0x246dd5+':'+_0x129c95['id'],_0x129c95);WhatsappQueueEvents[_0xe365('0x6')](_0x246dd5,_0x129c95);_0x1ac435(null);};}for(var e in events){if(events[_0xe365('0x7')](e)){var event=events[e];WhatsappQueue[_0xe365('0x8')](e,emitEvent(event));}}module[_0xe365('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 ba2cb3d..1996728 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 _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 +var _0x7f34=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x276067,_0xe95243){var _0x2cbf90=function(_0x4bb231){while(--_0x4bb231){_0x276067['push'](_0x276067['shift']());}};_0x2cbf90(++_0xe95243);}(_0x7f34,0x1a4));var _0x47f3=function(_0x314552,_0x3b82ef){_0x314552=_0x314552-0x0;var _0xb13f7f=_0x7f34[_0x314552];return _0xb13f7f;};'use strict';var _=require(_0x47f3('0x0'));var util=require(_0x47f3('0x1'));var logger=require(_0x47f3('0x2'))(_0x47f3('0x3'));var moment=require(_0x47f3('0x4'));var BPromise=require(_0x47f3('0x5'));var rp=require(_0x47f3('0x6'));var fs=require('fs');var path=require(_0x47f3('0x7'));var rimraf=require(_0x47f3('0x8'));var config=require('../../config/environment');var attributes=require(_0x47f3('0x9'));module[_0x47f3('0xa')]=function(_0x5e5cee,_0x3bafea){return _0x5e5cee[_0x47f3('0xb')](_0x47f3('0xc'),attributes,{'tableName':_0x47f3('0xd'),'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 8517db0..ccaf827 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 _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 +var _0x88d6=['register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','options','raw','where','limit','include','map','attributes','model','GetWhatsappQueue','ShowWhatsappQueue','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket'];(function(_0xa42446,_0x3fd138){var _0x48dbf8=function(_0x214d42){while(--_0x214d42){_0xa42446['push'](_0xa42446['shift']());}};_0x48dbf8(++_0x3fd138);}(_0x88d6,0x103));var _0x688d=function(_0x3a14ba,_0x1b19fe){_0x3a14ba=_0x3a14ba-0x0;var _0x564584=_0x88d6[_0x3a14ba];return _0x564584;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x688d('0x0'));var BPromise=require('bluebird');var rs=require(_0x688d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x688d('0x2'))['db'];var utils=require(_0x688d('0x3'));var logger=require(_0x688d('0x4'))(_0x688d('0x5'));var config=require(_0x688d('0x6'));var jayson=require(_0x688d('0x7'));var client=jayson['client'][_0x688d('0x8')]({'port':0x232a});config['redis']=_[_0x688d('0x9')](config['redis'],{'host':_0x688d('0xa'),'port':0x18eb});var socket=require(_0x688d('0xb'))(new Redis(config[_0x688d('0xc')]));require(_0x688d('0xd'))[_0x688d('0xe')](socket);function respondWithRpcPromise(_0x2689a2,_0x45a72a,_0xf75233){return new BPromise(function(_0x511bae,_0x51c6d3){return client[_0x688d('0xf')](_0x2689a2,_0xf75233)[_0x688d('0x10')](function(_0x2872ff){logger[_0x688d('0x11')](_0x688d('0x12'),_0x45a72a,_0x688d('0x13'));logger[_0x688d('0x14')](_0x688d('0x15'),_0x45a72a,_0x688d('0x13'),JSON[_0x688d('0x16')](_0x2872ff));if(_0x2872ff['error']){if(_0x2872ff[_0x688d('0x17')][_0x688d('0x18')]===0x1f4){logger[_0x688d('0x17')](_0x688d('0x12'),_0x45a72a,_0x2872ff['error']['message']);return _0x51c6d3(_0x2872ff[_0x688d('0x17')]['message']);}logger['error'](_0x688d('0x12'),_0x45a72a,_0x2872ff[_0x688d('0x17')][_0x688d('0x19')]);return _0x511bae(_0x2872ff['error'][_0x688d('0x19')]);}else{logger[_0x688d('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x45a72a,_0x688d('0x13'));_0x511bae(_0x2872ff[_0x688d('0x1a')][_0x688d('0x19')]);}})[_0x688d('0x1b')](function(_0x125178){logger[_0x688d('0x17')](_0x688d('0x12'),_0x45a72a,_0x125178);_0x51c6d3(_0x125178);});});}exports['GetWhatsappQueue']=function(_0x1653d2){var _0x410943=this;return new Promise(function(_0x295f44,_0x242a3c){return db[_0x688d('0x1c')]['findAll']({'raw':_0x1653d2[_0x688d('0x1d')]?_0x1653d2[_0x688d('0x1d')][_0x688d('0x1e')]===undefined?!![]:![]:!![],'where':_0x1653d2['options']?_0x1653d2['options'][_0x688d('0x1f')]||null:null,'attributes':_0x1653d2[_0x688d('0x1d')]?_0x1653d2['options']['attributes']||null:null,'limit':_0x1653d2['options']?_0x1653d2['options'][_0x688d('0x20')]||null:null,'include':_0x1653d2[_0x688d('0x1d')]?_0x1653d2[_0x688d('0x1d')][_0x688d('0x21')]?_[_0x688d('0x22')](_0x1653d2[_0x688d('0x1d')][_0x688d('0x21')],function(_0x467759){return{'model':db[_0x467759['model']],'as':_0x467759['as'],'attributes':_0x467759[_0x688d('0x23')],'include':_0x467759[_0x688d('0x21')]?_[_0x688d('0x22')](_0x467759[_0x688d('0x21')],function(_0x29c8d7){return{'model':db[_0x29c8d7['model']],'as':_0x29c8d7['as'],'attributes':_0x29c8d7['attributes'],'include':_0x29c8d7[_0x688d('0x21')]?_[_0x688d('0x22')](_0x29c8d7['include'],function(_0x23a918){return{'model':db[_0x23a918[_0x688d('0x24')]],'as':_0x23a918['as'],'attributes':_0x23a918[_0x688d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x688d('0x10')](function(_0x466f21){logger[_0x688d('0x11')](_0x688d('0x25'),_0x1653d2);logger[_0x688d('0x14')](_0x688d('0x25'),_0x1653d2,JSON[_0x688d('0x16')](_0x466f21));_0x295f44(_0x466f21);})[_0x688d('0x1b')](function(_0x3337e5){logger[_0x688d('0x17')]('GetWhatsappQueue',_0x3337e5[_0x688d('0x19')],_0x1653d2);_0x242a3c(_0x410943[_0x688d('0x17')](0x1f4,_0x3337e5['message']));});});};exports['ShowWhatsappQueue']=function(_0x43a07a){var _0x3b86a6=this;return new Promise(function(_0x605cd5,_0x41a7f6){return db['WhatsappQueue']['find']({'raw':_0x43a07a['options']?_0x43a07a[_0x688d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x43a07a[_0x688d('0x1d')]?_0x43a07a[_0x688d('0x1d')][_0x688d('0x1f')]||null:null,'attributes':_0x43a07a['options']?_0x43a07a['options']['attributes']||null:null,'include':_0x43a07a['options']?_0x43a07a['options'][_0x688d('0x21')]?_[_0x688d('0x22')](_0x43a07a[_0x688d('0x1d')][_0x688d('0x21')],function(_0x657076){return{'model':db[_0x657076[_0x688d('0x24')]],'as':_0x657076['as'],'attributes':_0x657076[_0x688d('0x23')],'include':_0x657076['include']?_[_0x688d('0x22')](_0x657076[_0x688d('0x21')],function(_0x17a11b){return{'model':db[_0x17a11b[_0x688d('0x24')]],'as':_0x17a11b['as'],'attributes':_0x17a11b[_0x688d('0x23')],'include':_0x17a11b[_0x688d('0x21')]?_[_0x688d('0x22')](_0x17a11b[_0x688d('0x21')],function(_0xf8d151){return{'model':db[_0xf8d151[_0x688d('0x24')]],'as':_0xf8d151['as'],'attributes':_0xf8d151[_0x688d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x688d('0x10')](function(_0x94af47){logger['info'](_0x688d('0x26'),_0x43a07a);logger['debug'](_0x688d('0x26'),_0x43a07a,JSON[_0x688d('0x16')](_0x94af47));_0x605cd5(_0x94af47);})['catch'](function(_0x5c0721){logger[_0x688d('0x17')](_0x688d('0x26'),_0x5c0721['message'],_0x43a07a);_0x41a7f6(_0x3b86a6[_0x688d('0x17')](0x1f4,_0x5c0721[_0x688d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 625ac3d..052a584 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 _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 +var _0x10ec=['emit','register','length','whatsappQueue:','./whatsappQueue.events','remove','update'];(function(_0xe78493,_0x2428e8){var _0x3fb97b=function(_0x4954d0){while(--_0x4954d0){_0xe78493['push'](_0xe78493['shift']());}};_0x3fb97b(++_0x2428e8);}(_0x10ec,0xe4));var _0xc10e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x10ec[_0xfae23b];return _0x200640;};'use strict';var WhatsappQueueEvents=require(_0xc10e('0x0'));var events=['save',_0xc10e('0x1'),_0xc10e('0x2')];function createListener(_0x337091,_0x940a4a){return function(_0xb889ca){_0x940a4a[_0xc10e('0x3')](_0x337091,_0xb889ca);};}function removeListener(_0x4e118c,_0x234d34){return function(){WhatsappQueueEvents['removeListener'](_0x4e118c,_0x234d34);};}exports[_0xc10e('0x4')]=function(_0xe710b2){for(var _0x63e67d=0x0,_0x1034c1=events[_0xc10e('0x5')];_0x63e67d<_0x1034c1;_0x63e67d++){var _0x55f476=events[_0x63e67d];var _0x395992=createListener(_0xc10e('0x6')+_0x55f476,_0xe710b2);WhatsappQueueEvents['on'](_0x55f476,_0x395992);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 171718e..6a50b53 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 _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 +var _0x148b=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put'];(function(_0x71bb53,_0x5970da){var _0x46c0bd=function(_0x1716b0){while(--_0x1716b0){_0x71bb53['push'](_0x71bb53['shift']());}};_0x46c0bd(++_0x5970da);}(_0x148b,0x8f));var _0xb148=function(_0x53c8ef,_0x1a95c6){_0x53c8ef=_0x53c8ef-0x0;var _0x16e980=_0x148b[_0x53c8ef];return _0x16e980;};'use strict';var multer=require(_0xb148('0x0'));var util=require(_0xb148('0x1'));var path=require(_0xb148('0x2'));var timeout=require(_0xb148('0x3'));var express=require(_0xb148('0x4'));var router=express['Router']();var fs_extra=require(_0xb148('0x5'));var auth=require(_0xb148('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb148('0x7'));router['get']('/',auth[_0xb148('0x8')](),controller[_0xb148('0x9')]);router[_0xb148('0xa')](_0xb148('0xb'),auth[_0xb148('0x8')](),controller[_0xb148('0xc')]);router[_0xb148('0xa')](_0xb148('0xd'),auth['isAuthenticated'](),controller[_0xb148('0xe')]);router[_0xb148('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb148('0x10')](_0xb148('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xb148('0x11')]('/:id',auth[_0xb148('0x8')](),controller[_0xb148('0x12')]);module[_0xb148('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 022c033..e58c7b4 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(_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 +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x262339,_0x910304){var _0x5a984c=function(_0x14b33c){while(--_0x14b33c){_0x262339['push'](_0x262339['shift']());}};_0x5a984c(++_0x910304);}(_0x7a54,0x106));var _0x47a5=function(_0x26ea5a,_0x20e5d1){_0x26ea5a=_0x26ea5a-0x0;var _0x2c2196=_0x7a54[_0x26ea5a];return _0x2c2196;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index a51e9ca..fbe9c20 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 _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 +var _0x4cf8=['limit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','show','merge','find','create','body','params','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x38080e,_0x95512d){_0x38080e=_0x38080e-0x0;var _0x4e4c87=_0x4cf8[_0x38080e];return _0x4e4c87;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x18')](_0x33f83e);}return _0x35f852[_0x84cf('0x19')](_0x33f83e)[_0x84cf('0x1a')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x19')](_0x250a19)[_0x84cf('0x1b')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=typeof _0x27261b[_0x84cf('0x1c')]===_0x84cf('0x1d')&&typeof _0x27261b['limit']===_0x84cf('0x1d');var _0x5d6a93=_0x167c3e[_0x84cf('0x1e')];var _0x1abe2d=_0x464e70?0x0:_0x27261b[_0x84cf('0x1c')];var _0x13ba16=_0x464e70?_0x167c3e[_0x84cf('0x1e')]:_0x27261b['offset']+_0x27261b['limit'];var _0x42d6d4;if(_0x13ba16>=_0x5d6a93){_0x13ba16=_0x5d6a93;_0x42d6d4=0xc8;}else{_0x42d6d4=0xce;}_0x20e79c[_0x84cf('0x19')](_0x42d6d4);return _0x20e79c[_0x84cf('0x1f')](_0x84cf('0x20'),_0x1abe2d+'-'+_0x13ba16+'/'+_0x5d6a93)[_0x84cf('0x1b')](_0x167c3e);}return null;};}function patchUpdates(_0x5dda3f){return function(_0x39a37b){try{jsonpatch[_0x84cf('0x21')](_0x39a37b,_0x5dda3f,!![]);}catch(_0x3ca1be){return BPromise[_0x84cf('0x22')](_0x3ca1be);}return _0x39a37b[_0x84cf('0x23')]();};}function saveUpdates(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x24')](_0x54405a)[_0x84cf('0x25')](function(_0x3e5e94){return _0x3e5e94;});}return null;};}function removeEntity(_0x29e9e1,_0x7feb4){return function(_0x4c9d1c){if(_0x4c9d1c){return _0x4c9d1c[_0x84cf('0x26')]()[_0x84cf('0x25')](function(){_0x29e9e1[_0x84cf('0x19')](0xcc)[_0x84cf('0x1a')]();});}};}function handleEntityNotFound(_0x1d220a,_0x44d4bf){return function(_0x3c7eda){if(!_0x3c7eda){_0x1d220a[_0x84cf('0x18')](0x194);}return _0x3c7eda;};}function handleError(_0x401aa4,_0x6797c0){_0x6797c0=_0x6797c0||0x1f4;return function(_0x5179c1){logger[_0x84cf('0x27')](_0x5179c1[_0x84cf('0x28')]);if(_0x5179c1[_0x84cf('0x29')]){delete _0x5179c1[_0x84cf('0x29')];}_0x401aa4['status'](_0x6797c0)[_0x84cf('0x2a')](_0x5179c1);};}exports['index']=function(_0x29455e,_0x4092fd){var _0x43b41b={},_0xc15298={},_0x51adcf={'count':0x0,'rows':[]};var _0x20de4b=_[_0x84cf('0x2b')](db[_0x84cf('0x2c')][_0x84cf('0x2d')],function(_0xb4fc5a){return{'name':_0xb4fc5a[_0x84cf('0x2e')],'type':_0xb4fc5a[_0x84cf('0x2f')][_0x84cf('0x30')]};});_0xc15298[_0x84cf('0x31')]=_['map'](_0x20de4b,'name');_0xc15298[_0x84cf('0x32')]=_[_0x84cf('0x33')](_0x29455e[_0x84cf('0x32')]);_0xc15298[_0x84cf('0x34')]=_[_0x84cf('0x35')](_0xc15298[_0x84cf('0x31')],_0xc15298[_0x84cf('0x32')]);_0x43b41b[_0x84cf('0x36')]=_['intersection'](_0xc15298[_0x84cf('0x31')],qs[_0x84cf('0x37')](_0x29455e['query'][_0x84cf('0x37')]));_0x43b41b['attributes']=_0x43b41b[_0x84cf('0x36')][_0x84cf('0x38')]?_0x43b41b[_0x84cf('0x36')]:_0xc15298[_0x84cf('0x31')];if(!_0x29455e[_0x84cf('0x32')]['hasOwnProperty'](_0x84cf('0x39'))){_0x43b41b['limit']=qs['limit'](_0x29455e[_0x84cf('0x32')][_0x84cf('0x3a')]);_0x43b41b['offset']=qs[_0x84cf('0x1c')](_0x29455e[_0x84cf('0x32')][_0x84cf('0x1c')]);}_0x43b41b[_0x84cf('0x3b')]=qs[_0x84cf('0x3c')](_0x29455e[_0x84cf('0x32')]['sort']);_0x43b41b[_0x84cf('0x3d')]=qs[_0x84cf('0x34')](_[_0x84cf('0x3e')](_0x29455e[_0x84cf('0x32')],_0xc15298[_0x84cf('0x34')]),_0x20de4b);if(_0x29455e[_0x84cf('0x32')]['filter']){_0x43b41b[_0x84cf('0x3d')]=_['merge'](_0x43b41b[_0x84cf('0x3d')],{'$or':_[_0x84cf('0x2b')](_0x20de4b,function(_0x3fa39a){if(_0x3fa39a[_0x84cf('0x2f')]!==_0x84cf('0x3f')){var _0x3897b0={};_0x3897b0[_0x3fa39a[_0x84cf('0x29')]]={'$like':'%'+_0x29455e[_0x84cf('0x32')][_0x84cf('0x40')]+'%'};return _0x3897b0;}})});}_0x43b41b=_['merge']({},_0x43b41b,_0x29455e[_0x84cf('0x41')]);var _0x516928={'where':_0x43b41b[_0x84cf('0x3d')]};return db[_0x84cf('0x2c')]['count'](_0x516928)[_0x84cf('0x25')](function(_0x531410){_0x51adcf[_0x84cf('0x1e')]=_0x531410;if(_0x29455e['query'][_0x84cf('0x42')]){_0x43b41b['include']=[{'all':!![]}];}return db[_0x84cf('0x2c')][_0x84cf('0x43')](_0x43b41b);})['then'](function(_0x847ce9){_0x51adcf[_0x84cf('0x44')]=_0x847ce9;return _0x51adcf;})[_0x84cf('0x25')](respondWithFilteredResult(_0x4092fd,_0x43b41b))['catch'](handleError(_0x4092fd,null));};exports[_0x84cf('0x45')]=function(_0x5f1b8e,_0x1c84e0){var _0x58b539={'raw':!![],'where':{'id':_0x5f1b8e['params']['id']}},_0x56b0e5={};_0x56b0e5[_0x84cf('0x31')]=_[_0x84cf('0x33')](db['WhatsappQueueReport'][_0x84cf('0x2d')]);_0x56b0e5['query']=_[_0x84cf('0x33')](_0x5f1b8e[_0x84cf('0x32')]);_0x56b0e5['filters']=_[_0x84cf('0x35')](_0x56b0e5['model'],_0x56b0e5[_0x84cf('0x32')]);_0x58b539['attributes']=_['intersection'](_0x56b0e5['model'],qs['fields'](_0x5f1b8e['query']['fields']));_0x58b539['attributes']=_0x58b539[_0x84cf('0x36')][_0x84cf('0x38')]?_0x58b539[_0x84cf('0x36')]:_0x56b0e5[_0x84cf('0x31')];if(_0x5f1b8e['query'][_0x84cf('0x42')]){_0x58b539['include']=[{'all':!![]}];}_0x58b539=_[_0x84cf('0x46')]({},_0x58b539,_0x5f1b8e[_0x84cf('0x41')]);return db[_0x84cf('0x2c')][_0x84cf('0x47')](_0x58b539)[_0x84cf('0x25')](handleEntityNotFound(_0x1c84e0,null))[_0x84cf('0x25')](respondWithResult(_0x1c84e0,null))['catch'](handleError(_0x1c84e0,null));};exports[_0x84cf('0x48')]=function(_0x2732bf,_0x4a4cf7){return db[_0x84cf('0x2c')][_0x84cf('0x48')](_0x2732bf[_0x84cf('0x49')],{})['then'](respondWithResult(_0x4a4cf7,0xc9))['catch'](handleError(_0x4a4cf7,null));};exports['update']=function(_0x1cf3f6,_0x104421){if(_0x1cf3f6[_0x84cf('0x49')]['id']){delete _0x1cf3f6[_0x84cf('0x49')]['id'];}return db[_0x84cf('0x2c')][_0x84cf('0x47')]({'where':{'id':_0x1cf3f6['params']['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x104421,null))['then'](saveUpdates(_0x1cf3f6[_0x84cf('0x49')],null))['then'](respondWithResult(_0x104421,null))['catch'](handleError(_0x104421,null));};exports[_0x84cf('0x26')]=function(_0xb1c3a8,_0x426df1){return db['WhatsappQueueReport']['find']({'where':{'id':_0xb1c3a8[_0x84cf('0x4a')]['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x426df1,null))[_0x84cf('0x25')](removeEntity(_0x426df1,null))[_0x84cf('0x4b')](handleError(_0x426df1,null));};exports[_0x84cf('0x4c')]=function(_0x4c2025,_0xcfe28f){return db[_0x84cf('0x2c')]['describe']()[_0x84cf('0x25')](respondWithResult(_0xcfe28f,null))['catch'](handleError(_0xcfe28f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9a24157..2886caa 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 _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 +var _0x8e75=['api','moment','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger'];(function(_0x1bcb32,_0x284fac){var _0x387d2e=function(_0x9ab44f){while(--_0x9ab44f){_0x1bcb32['push'](_0x1bcb32['shift']());}};_0x387d2e(++_0x284fac);}(_0x8e75,0x8d));var _0x58e7=function(_0x58226c,_0x3333d9){_0x58226c=_0x58226c-0x0;var _0x545de4=_0x8e75[_0x58226c];return _0x545de4;};'use strict';var _=require(_0x58e7('0x0'));var util=require(_0x58e7('0x1'));var logger=require(_0x58e7('0x2'))(_0x58e7('0x3'));var moment=require(_0x58e7('0x4'));var BPromise=require('bluebird');var rp=require(_0x58e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58e7('0x6'));var config=require(_0x58e7('0x7'));var attributes=require(_0x58e7('0x8'));module[_0x58e7('0x9')]=function(_0x13bc81,_0x1b383f){return _0x13bc81[_0x58e7('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x58e7('0xb'),'fields':[_0x58e7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 06c8eae..1b75bb2 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 _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 +var _0x4513=['stringify','UpdateWhatsappQueueReport','update','body','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw'];(function(_0x3a2c88,_0x26226c){var _0x2bffe2=function(_0x221144){while(--_0x221144){_0x3a2c88['push'](_0x3a2c88['shift']());}};_0x2bffe2(++_0x26226c);}(_0x4513,0x19e));var _0x3451=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4513[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3451('0x0'));var util=require(_0x3451('0x1'));var moment=require(_0x3451('0x2'));var BPromise=require(_0x3451('0x3'));var rs=require(_0x3451('0x4'));var fs=require('fs');var Redis=require(_0x3451('0x5'));var db=require(_0x3451('0x6'))['db'];var utils=require(_0x3451('0x7'));var logger=require(_0x3451('0x8'))(_0x3451('0x9'));var config=require(_0x3451('0xa'));var jayson=require(_0x3451('0xb'));var client=jayson[_0x3451('0xc')][_0x3451('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5ab0bf,_0x4b97a8,_0x44ea7b){return new BPromise(function(_0x1cbe14,_0x110728){return client['request'](_0x5ab0bf,_0x44ea7b)[_0x3451('0xe')](function(_0x29adad){logger[_0x3451('0xf')](_0x3451('0x10'),_0x4b97a8,'request\x20sent');logger[_0x3451('0x11')](_0x3451('0x12'),_0x4b97a8,_0x3451('0x13'),JSON['stringify'](_0x29adad));if(_0x29adad[_0x3451('0x14')]){if(_0x29adad[_0x3451('0x14')]['code']===0x1f4){logger[_0x3451('0x14')](_0x3451('0x10'),_0x4b97a8,_0x29adad['error']['message']);return _0x110728(_0x29adad[_0x3451('0x14')][_0x3451('0x15')]);}logger[_0x3451('0x14')](_0x3451('0x10'),_0x4b97a8,_0x29adad[_0x3451('0x14')][_0x3451('0x15')]);return _0x1cbe14(_0x29adad[_0x3451('0x14')][_0x3451('0x15')]);}else{logger['info'](_0x3451('0x10'),_0x4b97a8,_0x3451('0x13'));_0x1cbe14(_0x29adad[_0x3451('0x16')]['message']);}})[_0x3451('0x17')](function(_0x461c65){logger[_0x3451('0x14')](_0x3451('0x10'),_0x4b97a8,_0x461c65);_0x110728(_0x461c65);});});}exports[_0x3451('0x18')]=function(_0x41ab26){var _0x5d93fa=this;return new Promise(function(_0x1f26c0,_0x268bfc){return db[_0x3451('0x19')]['create'](_0x41ab26['body'],{'raw':_0x41ab26[_0x3451('0x1a')]?_0x41ab26[_0x3451('0x1a')][_0x3451('0x1b')]===undefined?!![]:![]:!![]})[_0x3451('0xe')](function(_0x1a9e13){logger[_0x3451('0xf')]('CreateWhatsappQueueReport',_0x41ab26);logger[_0x3451('0x11')](_0x3451('0x18'),_0x41ab26,JSON[_0x3451('0x1c')](_0x1a9e13));_0x1f26c0(_0x1a9e13);})[_0x3451('0x17')](function(_0x332a16){logger['error'](_0x3451('0x18'),_0x332a16['message'],_0x41ab26);_0x268bfc(_0x5d93fa[_0x3451('0x14')](0x1f4,_0x332a16[_0x3451('0x15')]));});});};exports[_0x3451('0x1d')]=function(_0x4c7431){var _0x570fb0=this;return new Promise(function(_0x15cae9,_0x3928d6){return db[_0x3451('0x19')][_0x3451('0x1e')](_0x4c7431[_0x3451('0x1f')],{'raw':_0x4c7431[_0x3451('0x1a')]?_0x4c7431[_0x3451('0x1a')][_0x3451('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c7431[_0x3451('0x1a')]?_0x4c7431[_0x3451('0x1a')]['where']||null:null,'attributes':_0x4c7431['options']?_0x4c7431['options'][_0x3451('0x20')]||null:null,'limit':_0x4c7431[_0x3451('0x1a')]?_0x4c7431[_0x3451('0x1a')][_0x3451('0x21')]||null:null})[_0x3451('0xe')](function(_0x16d4fa){logger[_0x3451('0xf')](_0x3451('0x1d'),_0x4c7431);logger['debug'](_0x3451('0x1d'),_0x4c7431,JSON[_0x3451('0x1c')](_0x16d4fa));_0x15cae9(_0x16d4fa);})['catch'](function(_0x41a050){logger[_0x3451('0x14')](_0x3451('0x1d'),_0x41a050['message'],_0x4c7431);_0x3928d6(_0x570fb0['error'](0x1f4,_0x41a050[_0x3451('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index eda1d18..8c31a1d 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 _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 +var _0x809c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','exports','multer','util','path'];(function(_0x4001c7,_0xfe9f11){var _0x555a8b=function(_0xec1f67){while(--_0xec1f67){_0x4001c7['push'](_0x4001c7['shift']());}};_0x555a8b(++_0xfe9f11);}(_0x809c,0x1ad));var _0xc809=function(_0x4f68a9,_0x1b2cb1){_0x4f68a9=_0x4f68a9-0x0;var _0x266722=_0x809c[_0x4f68a9];return _0x266722;};'use strict';var multer=require(_0xc809('0x0'));var util=require(_0xc809('0x1'));var path=require(_0xc809('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc809('0x3')]();var fs_extra=require(_0xc809('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc809('0x5'));var config=require(_0xc809('0x6'));var controller=require(_0xc809('0x7'));router[_0xc809('0x8')]('/',auth['isAuthenticated'](),controller[_0xc809('0x9')]);router['get'](_0xc809('0xa'),auth[_0xc809('0xb')](),controller[_0xc809('0xc')]);router[_0xc809('0x8')](_0xc809('0xd'),auth[_0xc809('0xb')](),controller[_0xc809('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc809('0xd'),auth[_0xc809('0xb')](),controller[_0xc809('0xf')]);router[_0xc809('0x10')](_0xc809('0xd'),auth[_0xc809('0xb')](),controller['destroy']);module[_0xc809('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index fd5257c..fa815d6 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 _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 +var _0x723c=['STRING','account','queue','DATE','exports'];(function(_0x134a39,_0x43e765){var _0x1464e9=function(_0x5ce7a3){while(--_0x5ce7a3){_0x134a39['push'](_0x134a39['shift']());}};_0x1464e9(++_0x43e765);}(_0x723c,0x1ad));var _0xc723=function(_0x2d034b,_0xa50b7c){_0x2d034b=_0x2d034b-0x0;var _0x19caee=_0x723c[_0x2d034b];return _0x19caee;};'use strict';var Sequelize=require('sequelize');module[_0xc723('0x0')]={'uniqueid':{'type':Sequelize[_0xc723('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc723('0x2'),'agent',_0xc723('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc723('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index fb7179a..30c667c 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 _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 +var _0x9dde=['../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','end','sendStatus','error','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x10b34d,_0xf07181){var _0x14bf67=function(_0x45178d){while(--_0x45178d){_0x10b34d['push'](_0x10b34d['shift']());}};_0x14bf67(++_0xf07181);}(_0x9dde,0x1e2));var _0xe9dd=function(_0x421ff1,_0x453e00){_0x421ff1=_0x421ff1-0x0;var _0x35ef3b=_0x9dde[_0x421ff1];return _0x35ef3b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9dd('0x0'));var zipdir=require(_0xe9dd('0x1'));var jsonpatch=require(_0xe9dd('0x2'));var rp=require(_0xe9dd('0x3'));var moment=require(_0xe9dd('0x4'));var BPromise=require(_0xe9dd('0x5'));var Mustache=require('mustache');var util=require(_0xe9dd('0x6'));var path=require('path');var sox=require(_0xe9dd('0x7'));var csv=require(_0xe9dd('0x8'));var ejs=require(_0xe9dd('0x9'));var fs=require('fs');var fs_extra=require(_0xe9dd('0xa'));var _=require(_0xe9dd('0xb'));var squel=require(_0xe9dd('0xc'));var crypto=require(_0xe9dd('0xd'));var jsforce=require(_0xe9dd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe9dd('0x8'));var querystring=require('querystring');var Papa=require(_0xe9dd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe9dd('0x10'));var as=require(_0xe9dd('0x11'));var hardwareService=require(_0xe9dd('0x12'));var logger=require(_0xe9dd('0x13'))(_0xe9dd('0x14'));var utils=require(_0xe9dd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe9dd('0x16'))['db'];function respondWithStatusCode(_0x7461b2,_0x37497b){_0x37497b=_0x37497b||0xcc;return function(_0x5932c1){if(_0x5932c1){return _0x7461b2['sendStatus'](_0x37497b);}return _0x7461b2[_0xe9dd('0x17')](_0x37497b)['end']();};}function respondWithResult(_0x37e478,_0xe5bac2){_0xe5bac2=_0xe5bac2||0xc8;return function(_0x14ebec){if(_0x14ebec){return _0x37e478[_0xe9dd('0x17')](_0xe5bac2)[_0xe9dd('0x18')](_0x14ebec);}};}function respondWithFilteredResult(_0x1e5eaa,_0x6586ba){return function(_0x9b5bf){if(_0x9b5bf){var _0x13038c=typeof _0x6586ba[_0xe9dd('0x19')]===_0xe9dd('0x1a')&&typeof _0x6586ba[_0xe9dd('0x1b')]===_0xe9dd('0x1a');var _0x45b943=_0x9b5bf[_0xe9dd('0x1c')];var _0x57cc59=_0x13038c?0x0:_0x6586ba[_0xe9dd('0x19')];var _0x20ed8d=_0x13038c?_0x9b5bf[_0xe9dd('0x1c')]:_0x6586ba[_0xe9dd('0x19')]+_0x6586ba[_0xe9dd('0x1b')];var _0x2423e4;if(_0x20ed8d>=_0x45b943){_0x20ed8d=_0x45b943;_0x2423e4=0xc8;}else{_0x2423e4=0xce;}_0x1e5eaa[_0xe9dd('0x17')](_0x2423e4);return _0x1e5eaa['set'](_0xe9dd('0x1d'),_0x57cc59+'-'+_0x20ed8d+'/'+_0x45b943)['json'](_0x9b5bf);}return null;};}function patchUpdates(_0x26a787){return function(_0x5a7bda){try{jsonpatch['apply'](_0x5a7bda,_0x26a787,!![]);}catch(_0x38b087){return BPromise['reject'](_0x38b087);}return _0x5a7bda[_0xe9dd('0x1e')]();};}function saveUpdates(_0x1c14fb,_0xf813b){return function(_0x3a41fe){if(_0x3a41fe){return _0x3a41fe[_0xe9dd('0x1f')](_0x1c14fb)['then'](function(_0x5e399c){return _0x5e399c;});}return null;};}function removeEntity(_0x4f9da8,_0x434818){return function(_0xec67ad){if(_0xec67ad){return _0xec67ad[_0xe9dd('0x20')]()[_0xe9dd('0x21')](function(){_0x4f9da8['status'](0xcc)[_0xe9dd('0x22')]();});}};}function handleEntityNotFound(_0x497eb9,_0x3ff8fb){return function(_0x16e654){if(!_0x16e654){_0x497eb9[_0xe9dd('0x23')](0x194);}return _0x16e654;};}function handleError(_0x431527,_0x10c99d){_0x10c99d=_0x10c99d||0x1f4;return function(_0x2f5f59){logger[_0xe9dd('0x24')](_0x2f5f59['stack']);if(_0x2f5f59[_0xe9dd('0x25')]){delete _0x2f5f59[_0xe9dd('0x25')];}_0x431527['status'](_0x10c99d)[_0xe9dd('0x26')](_0x2f5f59);};}exports['index']=function(_0x1b04bb,_0x1ec997){var _0x44425b={},_0x2e0a34={},_0x409567={'count':0x0,'rows':[]};var _0x3d307a=_[_0xe9dd('0x27')](db[_0xe9dd('0x28')][_0xe9dd('0x29')],function(_0x32fc80){return{'name':_0x32fc80[_0xe9dd('0x2a')],'type':_0x32fc80[_0xe9dd('0x2b')][_0xe9dd('0x2c')]};});_0x2e0a34[_0xe9dd('0x2d')]=_[_0xe9dd('0x27')](_0x3d307a,_0xe9dd('0x25'));_0x2e0a34[_0xe9dd('0x2e')]=_[_0xe9dd('0x2f')](_0x1b04bb[_0xe9dd('0x2e')]);_0x2e0a34[_0xe9dd('0x30')]=_[_0xe9dd('0x31')](_0x2e0a34[_0xe9dd('0x2d')],_0x2e0a34['query']);_0x44425b[_0xe9dd('0x32')]=_[_0xe9dd('0x31')](_0x2e0a34['model'],qs[_0xe9dd('0x33')](_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x33')]));_0x44425b[_0xe9dd('0x32')]=_0x44425b['attributes'][_0xe9dd('0x34')]?_0x44425b[_0xe9dd('0x32')]:_0x2e0a34[_0xe9dd('0x2d')];if(!_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x35')](_0xe9dd('0x36'))){_0x44425b['limit']=qs[_0xe9dd('0x1b')](_0x1b04bb[_0xe9dd('0x2e')]['limit']);_0x44425b['offset']=qs['offset'](_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x19')]);}_0x44425b[_0xe9dd('0x37')]=qs['sort'](_0x1b04bb[_0xe9dd('0x2e')]['sort']);_0x44425b[_0xe9dd('0x38')]=qs[_0xe9dd('0x30')](_[_0xe9dd('0x39')](_0x1b04bb['query'],_0x2e0a34[_0xe9dd('0x30')]),_0x3d307a);if(_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x3a')]){_0x44425b[_0xe9dd('0x38')]=_[_0xe9dd('0x3b')](_0x44425b['where'],{'$or':_[_0xe9dd('0x27')](_0x3d307a,function(_0x2c9987){if(_0x2c9987[_0xe9dd('0x2b')]!==_0xe9dd('0x3c')){var _0x1b3305={};_0x1b3305[_0x2c9987[_0xe9dd('0x25')]]={'$like':'%'+_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x3a')]+'%'};return _0x1b3305;}})});}_0x44425b=_[_0xe9dd('0x3b')]({},_0x44425b,_0x1b04bb[_0xe9dd('0x3d')]);var _0x25adde={'where':_0x44425b[_0xe9dd('0x38')]};return db[_0xe9dd('0x28')][_0xe9dd('0x1c')](_0x25adde)[_0xe9dd('0x21')](function(_0x4435d1){_0x409567[_0xe9dd('0x1c')]=_0x4435d1;if(_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x3e')]){_0x44425b[_0xe9dd('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xe9dd('0x40')](_0x44425b);})[_0xe9dd('0x21')](function(_0x5dc27b){_0x409567[_0xe9dd('0x41')]=_0x5dc27b;return _0x409567;})[_0xe9dd('0x21')](respondWithFilteredResult(_0x1ec997,_0x44425b))[_0xe9dd('0x42')](handleError(_0x1ec997,null));};exports[_0xe9dd('0x43')]=function(_0x51bc9c,_0x37240d){var _0x36be8b={'raw':!![],'where':{'id':_0x51bc9c[_0xe9dd('0x44')]['id']}},_0x5c09ce={};_0x5c09ce[_0xe9dd('0x2d')]=_[_0xe9dd('0x2f')](db[_0xe9dd('0x28')]['rawAttributes']);_0x5c09ce[_0xe9dd('0x2e')]=_['keys'](_0x51bc9c[_0xe9dd('0x2e')]);_0x5c09ce[_0xe9dd('0x30')]=_[_0xe9dd('0x31')](_0x5c09ce['model'],_0x5c09ce[_0xe9dd('0x2e')]);_0x36be8b[_0xe9dd('0x32')]=_['intersection'](_0x5c09ce[_0xe9dd('0x2d')],qs[_0xe9dd('0x33')](_0x51bc9c[_0xe9dd('0x2e')]['fields']));_0x36be8b[_0xe9dd('0x32')]=_0x36be8b[_0xe9dd('0x32')][_0xe9dd('0x34')]?_0x36be8b['attributes']:_0x5c09ce['model'];if(_0x51bc9c[_0xe9dd('0x2e')][_0xe9dd('0x3e')]){_0x36be8b[_0xe9dd('0x3f')]=[{'all':!![]}];}_0x36be8b=_[_0xe9dd('0x3b')]({},_0x36be8b,_0x51bc9c[_0xe9dd('0x3d')]);return db[_0xe9dd('0x28')][_0xe9dd('0x45')](_0x36be8b)['then'](handleEntityNotFound(_0x37240d,null))[_0xe9dd('0x21')](respondWithResult(_0x37240d,null))['catch'](handleError(_0x37240d,null));};exports['create']=function(_0x14f50f,_0x105c4f){return db[_0xe9dd('0x28')]['create'](_0x14f50f[_0xe9dd('0x46')],{})['then'](respondWithResult(_0x105c4f,0xc9))[_0xe9dd('0x42')](handleError(_0x105c4f,null));};exports[_0xe9dd('0x1f')]=function(_0x10bf42,_0x30ee87){if(_0x10bf42[_0xe9dd('0x46')]['id']){delete _0x10bf42['body']['id'];}return db[_0xe9dd('0x28')][_0xe9dd('0x45')]({'where':{'id':_0x10bf42['params']['id']}})[_0xe9dd('0x21')](handleEntityNotFound(_0x30ee87,null))[_0xe9dd('0x21')](saveUpdates(_0x10bf42[_0xe9dd('0x46')],null))[_0xe9dd('0x21')](respondWithResult(_0x30ee87,null))['catch'](handleError(_0x30ee87,null));};exports[_0xe9dd('0x20')]=function(_0x5f4619,_0x42c551){return db[_0xe9dd('0x28')][_0xe9dd('0x45')]({'where':{'id':_0x5f4619['params']['id']}})[_0xe9dd('0x21')](handleEntityNotFound(_0x42c551,null))['then'](removeEntity(_0x42c551,null))[_0xe9dd('0x42')](handleError(_0x42c551,null));};exports['describe']=function(_0x1d9075,_0x517d66){return db[_0xe9dd('0x28')][_0xe9dd('0x47')]()['then'](respondWithResult(_0x517d66,null))[_0xe9dd('0x42')](handleError(_0x517d66,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 0f8d512..2c3f432 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 _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 +var _0x5004=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x58b113,_0x4e638e){var _0xf242c1=function(_0x1befca){while(--_0x1befca){_0x58b113['push'](_0x58b113['shift']());}};_0xf242c1(++_0x4e638e);}(_0x5004,0x117));var _0x4500=function(_0x152919,_0x345c46){_0x152919=_0x152919-0x0;var _0x46f867=_0x5004[_0x152919];return _0x46f867;};'use strict';var _=require(_0x4500('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4500('0x1'));var moment=require('moment');var BPromise=require(_0x4500('0x2'));var rp=require(_0x4500('0x3'));var fs=require('fs');var path=require(_0x4500('0x4'));var rimraf=require(_0x4500('0x5'));var config=require(_0x4500('0x6'));var attributes=require(_0x4500('0x7'));module[_0x4500('0x8')]=function(_0x8bfbc,_0xc13979){return _0x8bfbc['define'](_0x4500('0x9'),attributes,{'tableName':_0x4500('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4500('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index ff836cb..9228732 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 _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 +var _0x7a1c=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x4e7d5d,_0x1a3ceb){var _0x5f1719=function(_0xcfacec){while(--_0xcfacec){_0x4e7d5d['push'](_0x4e7d5d['shift']());}};_0x5f1719(++_0x1a3ceb);}(_0x7a1c,0x78));var _0xc7a1=function(_0x49297c,_0x29bdb5){_0x49297c=_0x49297c-0x0;var _0xa22a84=_0x7a1c[_0x49297c];return _0xa22a84;};'use strict';var _=require('lodash');var util=require(_0xc7a1('0x0'));var moment=require(_0xc7a1('0x1'));var BPromise=require(_0xc7a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7a1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7a1('0x4'))(_0xc7a1('0x5'));var config=require(_0xc7a1('0x6'));var jayson=require(_0xc7a1('0x7'));var client=jayson[_0xc7a1('0x8')][_0xc7a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b162,_0x21d8f1,_0x4c11d0){return new BPromise(function(_0x7f53c0,_0x40439a){return client[_0xc7a1('0xa')](_0x52b162,_0x4c11d0)[_0xc7a1('0xb')](function(_0x25a9b4){logger['info'](_0xc7a1('0xc'),_0x21d8f1,_0xc7a1('0xd'));logger[_0xc7a1('0xe')](_0xc7a1('0xf'),_0x21d8f1,_0xc7a1('0xd'),JSON['stringify'](_0x25a9b4));if(_0x25a9b4['error']){if(_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x11')]===0x1f4){logger[_0xc7a1('0x10')](_0xc7a1('0xc'),_0x21d8f1,_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);return _0x40439a(_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);}logger[_0xc7a1('0x10')](_0xc7a1('0xc'),_0x21d8f1,_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);return _0x7f53c0(_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);}else{logger['info'](_0xc7a1('0xc'),_0x21d8f1,'request\x20sent');_0x7f53c0(_0x25a9b4['result']['message']);}})[_0xc7a1('0x13')](function(_0x38886d){logger[_0xc7a1('0x10')](_0xc7a1('0xc'),_0x21d8f1,_0x38886d);_0x40439a(_0x38886d);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 460c437..aa7a522 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x4672=['pm2_env','name','Online\x20apps:','filter','online','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/seedDB','./config/license','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map'];(function(_0x1439e6,_0x2634b8){var _0x1101a9=function(_0x591d44){while(--_0x591d44){_0x1439e6['push'](_0x1439e6['shift']());}};_0x1101a9(++_0x2634b8);}(_0x4672,0x18a));var _0x2467=function(_0x4ede09,_0x18801d){_0x4ede09=_0x4ede09-0x0;var _0x253193=_0x4672[_0x4ede09];return _0x253193;};'use strict';var _=require(_0x2467('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x2467('0x1'));var checkLicense=require(_0x2467('0x2'));var rpc=require('./rpc');var config=require(_0x2467('0x3'));var logger=require('./config/logger')(_0x2467('0x4'));var pm2=require(_0x2467('0x5'));var pm2Config=require(_0x2467('0x6'));var schedule=require(_0x2467('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x2467('0x8'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x2467('0x9'));function main(){return db[_0x2467('0xa')][_0x2467('0xb')]()[_0x2467('0xc')](function(){if(config[_0x2467('0xd')]){return seedDb[_0x2467('0xe')]();}})[_0x2467('0xc')](function(){return checkLicense[_0x2467('0xe')]();})[_0x2467('0xc')](function(){return rpc['listen']();})[_0x2467('0xc')](function(_0x1b1c63){logger[_0x2467('0xf')](_0x1b1c63);return chat[_0x2467('0x10')]();})['then'](function(){return whatsapp[_0x2467('0x10')]();})[_0x2467('0xc')](function(){return schedule[_0x2467('0x10')]();})[_0x2467('0xc')](function(){return transcribe[_0x2467('0x10')]();})[_0x2467('0xc')](function(){return provider['start']();})[_0x2467('0xc')](function(_0x373ef2){logger[_0x2467('0xf')](_0x373ef2);return pm2[_0x2467('0x10')](pm2Config);})[_0x2467('0xc')](function(_0x265d7e){var _0x15aa74=_0x265d7e['filter'](function(_0x520ad9){return typeof _0x520ad9['exitCode']===_0x2467('0x11')&&_0x520ad9[_0x2467('0x12')]>=0x0;});if(_0x15aa74[_0x2467('0x13')]>0x0){throw new Error(_0x15aa74['length']+_0x2467('0x14')+_[_0x2467('0x15')](_0x15aa74,function(_0x4abd91){return'\x22'+_0x4abd91[_0x2467('0x16')][_0x2467('0x17')]+'\x22';}));}logger[_0x2467('0xf')](_0x2467('0x18'),_[_0x2467('0x15')](_[_0x2467('0x19')](_0x265d7e,{'status':_0x2467('0x1a')}),'name')['join']());logger[_0x2467('0xf')]('Offline\x20apps:',_[_0x2467('0x15')](_[_0x2467('0x19')](_0x265d7e,function(_0x50e555){return _0x50e555['status']!==_0x2467('0x1a');}),_0x2467('0x17'))['join']()||_0x2467('0x1b'));console[_0x2467('0x1c')](_0x2467('0x1d'));})[_0x2467('0x1e')](function(_0x59f7d2){console[_0x2467('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x59f7d2);logger['error'](_0x2467('0x1f'),_0x59f7d2);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 3e482ae..75167e9 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 _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 +var _0x4cf8=['Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','catch','User\x20object\x20not\x20found.','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','session','options','promisify','verify','randomBytes','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','role','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','authenticate','pass','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x4cf8[_0x4a3898];return _0x25ceb0;};'use strict';var db=require(_0x84cf('0x0'))['db'];var config=require(_0x84cf('0x1'));var hardwareConf=require(_0x84cf('0x2'));var licenseUtil=require(_0x84cf('0x3'));var encryptor=require(_0x84cf('0x4'));var _=require(_0x84cf('0x5'));var jwt=require(_0x84cf('0x6'));var expressJwt=require(_0x84cf('0x7'));var compose=require(_0x84cf('0x8'));var basicAuth=require(_0x84cf('0x9'));var crypto=require(_0x84cf('0xa'));var BPromise=require(_0x84cf('0xb'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x84cf('0xc')]['session']});var userAttributes=['id',_0x84cf('0xd'),_0x84cf('0xe'),'name',_0x84cf('0xf'),_0x84cf('0x10'),'userpic',_0x84cf('0x11'),_0x84cf('0x12'),_0x84cf('0x13'),_0x84cf('0x14'),'mailPause',_0x84cf('0x15'),_0x84cf('0x16'),'openchannelPause','pauseType',_0x84cf('0x17'),_0x84cf('0x18'),_0x84cf('0x19'),_0x84cf('0x1a'),_0x84cf('0x1b'),_0x84cf('0x1c'),_0x84cf('0x1d'),_0x84cf('0x1e'),_0x84cf('0x1f'),_0x84cf('0x20'),_0x84cf('0x21'),_0x84cf('0x22'),_0x84cf('0x23'),_0x84cf('0x24'),_0x84cf('0x25'),_0x84cf('0x26'),_0x84cf('0x27'),_0x84cf('0x28'),_0x84cf('0x29'),'userProfileId',_0x84cf('0x2a'),_0x84cf('0x2b'),_0x84cf('0x2c'),_0x84cf('0x2d'),_0x84cf('0x2e'),_0x84cf('0x2f'),_0x84cf('0x30'),'selectRecallMeCampaign','chatAutoanswer',_0x84cf('0x31'),_0x84cf('0x32'),_0x84cf('0x33'),_0x84cf('0x34'),_0x84cf('0x35'),'openchannelAutoanswer',_0x84cf('0x36'),_0x84cf('0x37'),_0x84cf('0x38'),_0x84cf('0x39'),_0x84cf('0x3a'),'messengerSoundNotification'];exports[_0x84cf('0x3b')]=function(){return this[_0x84cf('0x3c')](!![])[_0x84cf('0x3d')](function(_0x23e1e7,_0x3e5e94,_0x29e9e1){if(_0x23e1e7[_0x84cf('0x3e')]){_0x29e9e1();}else{return db['ChatInteraction'][_0x84cf('0x3f')]({'where':{'id':_0x23e1e7[_0x84cf('0x40')]['id']},'attributes':['id',_0x84cf('0x41'),_0x84cf('0x42')],'raw':!![]})[_0x84cf('0x43')](function(_0x44d4bf){if(_0x44d4bf&&_0x44d4bf[_0x84cf('0x41')]){return _0x3e5e94[_0x84cf('0x44')](_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?0x195:0x193)['json']({'message':_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?_0x84cf('0x46'):_0x84cf('0x47')});}else{_0x29e9e1();}})['catch'](function(_0x1595dd){_0x29e9e1(_0x1595dd);});}});};exports['isAuthenticated']=function isAuthenticated(_0x29455e){return compose()[_0x84cf('0x3d')](function(_0x43b41b,_0xc15298,_0x51adcf){var _0x20de4b;if(_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')]){if(_[_0x84cf('0x4a')](_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')],_0x84cf('0x4b'))){var _0x18243d=basicAuth(_0x43b41b);db[_0x84cf('0x4c')]['find']({'where':{'name':_0x18243d['name']}})[_0x84cf('0x43')](function(_0x25de3a){if(!_0x25de3a||!_0x25de3a[_0x84cf('0x4d')](_0x18243d[_0x84cf('0x4e')])){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x50')});}_0x43b41b[_0x84cf('0x3e')]={'id':_0x25de3a['id']};_0x51adcf();})['catch'](function(_0x113b3e){_0x51adcf(_0x113b3e);});}else if(_[_0x84cf('0x4a')](_0x43b41b['headers'][_0x84cf('0x49')],'Bearer')){validateJwt(_0x43b41b,_0xc15298,_0x51adcf);}else{if(_0x29455e){_0x51adcf();}else{return _0xc15298[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}}}else if(_0x43b41b[_0x84cf('0x52')][_0x84cf('0x53')]){try{var _0x49d415={'audience':hardwareConf[_0x84cf('0x54')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x43b41b['query'][_0x84cf('0x53')],_0x49d415)[_0x84cf('0x43')](function(_0x4c4676){return db[_0x84cf('0x4c')][_0x84cf('0x55')]({'where':{'id':_0x4c4676[_0x84cf('0x56')]}})[_0x84cf('0x43')](function(_0xd13908){_0x20de4b=_0xd13908;return db[_0x84cf('0x57')]['findOne']({'where':{'id':0x1},'attributes':[_0x84cf('0x58'),_0x84cf('0x59')],'raw':!![]});})[_0x84cf('0x43')](function(_0x32cff6){if(!_0x20de4b||!_[_0x84cf('0x5a')](_0x20de4b[_0x84cf('0x5b')],_0x4c4676['nonce'])){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5c')});}if(_0x20de4b[_0x84cf('0x5d')]){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}if(_0x20de4b[_0x84cf('0x5f')]){if(_0x32cff6[_0x84cf('0x59')]>0x0){if(moment(_0x20de4b[_0x84cf('0x60')])[_0x84cf('0x61')](_0x32cff6['blockDuration'],_0x84cf('0x62'))>moment()){return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}}else{return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x43b41b[_0x84cf('0x3e')]={'id':_0x20de4b['id']};_0x51adcf();});})['catch'](function(){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5e')});});}catch(_0x40ae50){_0x51adcf(_0x40ae50);}}else if(_0x29455e){_0x51adcf();}else{return _0xc15298['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}})[_0x84cf('0x3d')](function(_0x5ef5fb,_0x3c1314,_0x5f1b8e){if(_0x5ef5fb[_0x84cf('0x3e')]){db['User']['find']({'where':{'id':_0x5ef5fb['user']['id']},'attributes':userAttributes})[_0x84cf('0x43')](function(_0xcf14ba){if(!_0xcf14ba){return _0x3c1314['status'](0x194)[_0x84cf('0x4f')]({'message':'User\x20not\x20found.'});}_0x5ef5fb[_0x84cf('0x3e')]=_0xcf14ba;_0x5f1b8e();})[_0x84cf('0x63')](function(_0x5ce309){_0x5f1b8e(_0x5ce309);});}else if(_0x29455e){_0x5f1b8e();}else{return _0x3c1314[_0x84cf('0x44')](0x194)['json']({'message':_0x84cf('0x64')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x5d8b69,_0x5498ec,_0x585644){return licenseUtil['getLicense']()['then'](function(_0x210d9b){if(_0x210d9b[_0x84cf('0x65')]){_0x585644();}else{return _0x5498ec[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':'Forbidden'});}})[_0x84cf('0x63')](function(_0x4af229){_0x585644(_0x4af229);});});};exports[_0x84cf('0x66')]=function isWebrtcLicence(){return compose()[_0x84cf('0x3d')](function(_0x1533a7,_0x253464,_0x121bb9){return licenseUtil[_0x84cf('0x67')]()['then'](function(_0x2f7da6){if(_0x2f7da6[_0x84cf('0x68')]){_0x121bb9();}else{return _0x253464['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x69')});}})[_0x84cf('0x63')](function(_0x5212ec){_0x121bb9(_0x5212ec);});});};exports['isMiddleware']=function(_0x5499f9,_0x1cf3f6,_0x104421){_0x5499f9[_0x84cf('0x6a')]=!![];return _0x104421();};exports[_0x84cf('0x6b')]=function signToken(_0x271cc3){return signJwt(_0x271cc3);};exports[_0x84cf('0x6c')]=function(_0x51d725,_0x350985){if(!_0x51d725['user']){return _0x350985[_0x84cf('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x46c595={'payload':{'id':_0x51d725[_0x84cf('0x3e')]['id'],'role':_0x51d725[_0x84cf('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x46c595)['then'](function(_0x290a4d){_0x350985[_0x84cf('0x6d')](_0x84cf('0x6e'),_0x290a4d);_0x350985[_0x84cf('0x6f')](_0x84cf('0x70'));})['catch'](function(_0xcfe28f){return _0x350985[_0x84cf('0x44')](0x1f4)['send'](_0xcfe28f);});};exports[_0x84cf('0x71')]=function(_0x5baea8){if(_['isNil'](_0x5baea8[_0x84cf('0x5b')])||_[_0x84cf('0x72')](_0x5baea8['apiKeyIat'])){return null;}else{return createJwt(_0x5baea8);}};exports['generateApiKey']=function(_0x31176c){_0x31176c[_0x84cf('0x5b')]=generateNonce();_0x31176c[_0x84cf('0x73')]=generateIssuedAt();return createJwt(_0x31176c);};exports[_0x84cf('0x74')]=function(_0x406c33,_0x3edaec){var _0x3a0eb4=_0x406c33[_0x84cf('0x52')]['apikey'];if(_0x3a0eb4){var _0x1bc15c={'nonce':_0x3edaec[_0x84cf('0x5b')],'iat':_0x3edaec['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x84cf('0x54')]()};return verifyJwt(_0x3a0eb4,_0x1bc15c)[_0x84cf('0x43')](function(){return generateApiKey(_0x3edaec);});}else{throw{'message':_0x84cf('0x75')};}};exports[_0x84cf('0x76')]=function(_0x340915){var _0xfec87d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xfec87d[_0x84cf('0x77')](_0x340915))throw new db['Sequelize'][(_0x84cf('0x78'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x84cf('0x79')]=function(_0x5c0122,_0x2a60bc,_0x1c2f1b){var _0x55d8c4=encryptor[_0x84cf('0x7a')](_0x2a60bc)[_0x84cf('0x7b')](',');for(var _0x52a3f1=0x0;_0x52a3f1<_0x1c2f1b;_0x52a3f1++){if(!_0x55d8c4[_0x52a3f1])break;if(_0x5c0122[_0x84cf('0x7c')]()===_0x55d8c4[_0x52a3f1]['toLowerCase']()){var _0x577d55=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x1c2f1b);if(_0x1c2f1b===0x1){_0x577d55=_0x84cf('0x7d');}throw new db[(_0x84cf('0x7e'))][(_0x84cf('0x78'))](_0x577d55);}}return;};exports[_0x84cf('0x7f')]=function(_0x480c3e,_0x32aa8b){var _0x3c1c55=_0x32aa8b?encryptor['decryptString'](_0x32aa8b)[_0x84cf('0x7b')](','):[];if(_0x3c1c55[_0x84cf('0x80')]===0x5){_0x3c1c55[_0x84cf('0x81')](-0x1,0x1);}_0x3c1c55[_0x84cf('0x82')](_0x480c3e);return encryptor[_0x84cf('0x83')](_0x3c1c55[_0x84cf('0x84')](','));};function signJwt(_0x1f1f76){var _0x39a336=BPromise['promisify'](jwt[_0x84cf('0x85')],{'context':jwt});var _0x58a96a=_0x1f1f76[_0x84cf('0x86')]||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x276ab1,_0x2602b7){_0x39a336(_0x1f1f76['payload'],_0x58a96a,_0x1f1f76[_0x84cf('0x88')])[_0x84cf('0x43')](function(_0xe1a1d9){_0x276ab1(_0xe1a1d9);})['catch'](function(_0xdb9b0c){_0x2602b7(_0xdb9b0c);});});}function verifyJwt(_0x240cca,_0x4e6077,_0x84d9cb){var _0x482958=BPromise[_0x84cf('0x89')](jwt[_0x84cf('0x8a')],{'context':jwt});var _0x57f1f2=_0x84d9cb||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x4a7905,_0x40b33e){_0x482958(_0x240cca,_0x57f1f2,_0x4e6077)[_0x84cf('0x43')](function(_0x262ae1){_0x4a7905(_0x262ae1);})[_0x84cf('0x63')](function(_0x577ade){_0x40b33e(_0x577ade);});});}function generateNonce(){return crypto[_0x84cf('0x8b')](0x10)[_0x84cf('0x8c')]('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x84cf('0x8c')]();}function createJwt(_0x8399f4){var _0xfcd0d={'payload':{'iat':_0x8399f4['apiKeyIat'],'nonce':_0x8399f4['apiKeyNonce']},'options':{'algorithm':_0x84cf('0x8d'),'subject':_0x8399f4['id'][_0x84cf('0x8c')](),'issuer':hardwareConf[_0x84cf('0x54')](),'audience':hardwareConf[_0x84cf('0x54')]()}};return signJwt(_0xfcd0d)[_0x84cf('0x43')](function(_0x39bd44){return{'iat':_0x8399f4[_0x84cf('0x73')],'nonce':_0x8399f4[_0x84cf('0x5b')],'token':_0x39bd44};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index c83a1f8..34499bb 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 _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 +var _0xafd7=['tags','skip','checkListsRestrictions','ids','tag','count','buildContactsQuery','fields','getFilteredContacts','describe','keys','startsWith','cf_','map','findOne','slice','all','fieldType','catch','./sql-utils','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','where','default','filter','user','clause'];(function(_0x45ee80,_0x556689){var _0x350e98=function(_0x96e156){while(--_0x96e156){_0x45ee80['push'](_0x45ee80['shift']());}};_0x350e98(++_0x556689);}(_0xafd7,0x1b3));var _0x7afd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xafd7[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var sqlUtils=require(_0x7afd('0x0'));var db=require(_0x7afd('0x1'))['db'];exports['findAll']=function(_0x1c9274,_0x11d294,_0x2dc806,_0x1c887b){var _0xd5cde5={'count':0x0,'rows':[]};var _0x3f55f8=sqlUtils[_0x7afd('0x2')](_0x11d294,_0x1c9274);if(_0x3f55f8){return Promise['resolve'](_0xd5cde5);}var _0x58bf2a=sqlUtils[_0x7afd('0x3')]();var _0x449cdb={};var _0x50b0e9=![];var _0x26f0c0=![];return Promise[_0x7afd('0x4')]()[_0x7afd('0x5')](function(){if(_0x1c9274[_0x7afd('0x6')]){return sqlUtils[_0x7afd('0x7')](_0x1c9274[_0x7afd('0x6')],_0x1c887b);}else{return sqlUtils['parseQueryParameters'](_0x1c9274,_0x1c887b);}})['then'](function(_0x3e414b){_0x58bf2a[_0x7afd('0x8')](_0x3e414b[_0x7afd('0x9')]);_0x58bf2a['where'](_0x3e414b['fields']);_0x58bf2a[_0x7afd('0x8')](_0x3e414b[_0x7afd('0xa')]);_0x58bf2a[_0x7afd('0x8')](_0x3e414b[_0x7afd('0xb')][_0x7afd('0xc')]);_0x449cdb=_0x3e414b[_0x7afd('0xd')];_0x26f0c0=_0x3e414b[_0x7afd('0xb')][_0x7afd('0xe')];return sqlUtils[_0x7afd('0xf')](_0x11d294,_0x1c9274,_0x26f0c0);})['then'](function(_0x1af06c){_0x58bf2a[_0x7afd('0x8')](_0x1af06c);var _0x18830f=_0x1c9274[_0x7afd('0x6')]?_0x449cdb[_0x7afd('0x10')]:_0x1c9274[_0x7afd('0x11')];_0x50b0e9=_0x18830f?!![]:![];return sqlUtils['countFilteredContacts'](_0x58bf2a,_0x18830f);})[_0x7afd('0x5')](function(_0x4282e4){_0xd5cde5[_0x7afd('0x12')]=_0x4282e4;if(_0xd5cde5[_0x7afd('0x12')]===0x0){return;}if(_0x1c9274['User']){_0x26f0c0=!![];}return sqlUtils[_0x7afd('0x13')](_0x58bf2a,_0x1c9274[_0x7afd('0x14')],_0x2dc806,_0x50b0e9,_0x449cdb[_0x7afd('0xc')],_0x26f0c0);})[_0x7afd('0x5')](function(_0x30bd32){if(!_0x30bd32){return[];}return sqlUtils[_0x7afd('0x15')](_0x30bd32,_0x1c9274,_0x2dc806);})[_0x7afd('0x5')](function(_0x5527f8){_0xd5cde5['rows']=_0x5527f8;return _0xd5cde5;})['catch'](function(_0x190a1f){throw _0x190a1f;});};exports['describe']=function(){var _0x3b3749={};var _0x5a1eff=[];return db['CmContact'][_0x7afd('0x16')]()[_0x7afd('0x5')](function(_0x26c347){_0x3b3749=_0x26c347;var _0x48b475=Object[_0x7afd('0x17')](_0x3b3749)[_0x7afd('0xa')](function(_0x47ce8f){return _[_0x7afd('0x18')](_0x47ce8f,_0x7afd('0x19'))?_0x47ce8f:undefined;});var _0x14d603=_0x48b475[_0x7afd('0x1a')](function(_0x35aec1){return db['CmCustomField'][_0x7afd('0x1b')]({'where':{'id':_0x35aec1[_0x7afd('0x1c')](0x3)},'raw':!![]});});return Promise[_0x7afd('0x1d')](_0x14d603);})[_0x7afd('0x5')](function(_0xde0d44){for(var _0x3b6dba=0x0;_0x3b6dba<_0xde0d44['length'];_0x3b6dba++){if(_0xde0d44[_0x3b6dba]){var _0xdeda00=_0x7afd('0x19')+_0xde0d44[_0x3b6dba]['id'];_0x3b3749[_0xdeda00][_0x7afd('0x1e')]=_0xde0d44[_0x3b6dba]['type'];}}_0x5a1eff=_[_0x7afd('0x1a')](Object[_0x7afd('0x17')](_0x3b3749),function(_0x12241c){return{'name':_0x12241c,'type':_0x3b3749[_0x12241c]['type']};});return _0x5a1eff;})[_0x7afd('0x1f')](function(_0x25f858){throw _0x25f858;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 18e789d..5742132 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 _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 +var _0xf4c9=['User','and','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','fields','tag','filter','then','search','role','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','subqry.id','order','subqry.','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','Tags','clone','COUNT(*)','SELECT','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','agent','ListId','autocomplete','true','select','from','where','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','phone','mobile','fax','email','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','length','conditions','dateOfBirth','fieldType','DATE','buildExpression','type','default','text','end','Tag','value','map','tags','clause','ids','user','uc.UserId\x20=\x20?','keys','some','name','compact','Contact'];(function(_0x3c1b91,_0x4b4914){var _0x43881b=function(_0x284bc2){while(--_0x284bc2){_0x3c1b91['push'](_0x3c1b91['shift']());}};_0x43881b(++_0x4b4914);}(_0xf4c9,0x1b3));var _0x9f4c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf4c9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9f4c('0x0'));var squel=require('squel');var as=require(_0x9f4c('0x1'));var qs=require(_0x9f4c('0x2'));var utils=require(_0x9f4c('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x2bb415,_0x2768ab){var _0x1e8d86=![];if(_0x2bb415['role']===_0x9f4c('0x4')&&!_0x2768ab['search']&&!_0x2768ab[_0x9f4c('0x5')]&&_0x2768ab[_0x9f4c('0x6')]!==_0x9f4c('0x7')){_0x1e8d86=!![];}return _0x1e8d86;}function getContactsSubquery(){return squel[_0x9f4c('0x8')]()[_0x9f4c('0x9')]('cm_contacts','c')[_0x9f4c('0xa')](_0x9f4c('0xb'));}function applyJoinClauses(_0x6f32d4,_0x57d9ba){var _0x550d0c=_0x57d9ba?'c':_0x9f4c('0xc');_0x6f32d4[_0x9f4c('0xd')](_0x9f4c('0xe'),'uc',_0x9f4c('0xf')+_0x550d0c+_0x9f4c('0x10'))[_0x9f4c('0xd')](_0x9f4c('0x11'),'ct',_0x9f4c('0x12')+_0x550d0c+_0x9f4c('0x10'))[_0x9f4c('0xd')](_0x9f4c('0x13'),'t',_0x9f4c('0x14'));return _0x6f32d4;}function addFieldsToQuery(_0x4a7292,_0x2a4e66,_0x3ea048,_0x48b28f,_0x528f62){var _0x27ca23=_0x528f62?'c':_0x9f4c('0xc');if(!_0x2a4e66){_0x2a4e66=['id',_0x9f4c('0x15'),'lastName',_0x9f4c('0x16'),_0x9f4c('0x17'),_0x9f4c('0x18'),_0x9f4c('0x19'),_0x9f4c('0x5'),'CompanyId',_0x9f4c('0x1a'),_0x9f4c('0x1b'),_0x9f4c('0x1c'),_0x9f4c('0x1d')];}else if(!_0x2a4e66[_0x9f4c('0x1e')]('id')){_0x2a4e66[_0x9f4c('0x1f')]('id');}var _0x5d6a4d=_0x3ea048&&_0x528f62||!_0x3ea048&&!_0x528f62;if(_0x48b28f){_0x5d6a4d=_0x48b28f&&_0x528f62||!_0x48b28f&&!_0x528f62;}_0x2a4e66[_0x9f4c('0x20')](function(_0x4cb843){if(_0x4cb843===_0x9f4c('0x1d')){if(_0x5d6a4d){_0x4a7292[_0x9f4c('0x21')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4cb843);}else if(_0x3ea048||_0x48b28f){_0x4a7292['field'](_0x27ca23+'.'+_0x4cb843);}}else{_0x4a7292[_0x9f4c('0x21')](_0x27ca23+'.'+_0x4cb843);}});return _0x4a7292;}function getSqlClauses(){var _0x56002e={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x9f4c('0x22')](),'tags':{'clause':squel[_0x9f4c('0x22')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x56002e;}function parseTagParameter(_0x360dca){var _0x444da1=squel[_0x9f4c('0x22')]();if(_0x360dca){var _0x150fe5=utils[_0x9f4c('0x23')](_0x360dca);_0x150fe5[_0x9f4c('0x20')](function(_0x207b74){_0x444da1['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x207b74+',%');});}return _0x444da1;}function parseSearchFilter(_0x2a8d5f){var _0x2e232a=squel[_0x9f4c('0x22')]();if(_0x2a8d5f){var _0x447693=_0x2a8d5f[_0x9f4c('0x24')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x447693[_0x9f4c('0x25')]('\x20')['length']>0x1){_0x2e232a['or'](_0x9f4c('0x26'),qs['getFullTextValue'](_0x447693,!![]),null);}else{if(qs['isNumeric'](_0x447693)){_0x2e232a['or'](_0x9f4c('0x27'),_0x447693+'%');_0x2e232a['or'](_0x9f4c('0x28'),_0x447693+'%');_0x2e232a['or'](_0x9f4c('0x29'),_0x447693+'%');_0x2e232a['or']('c.fax\x20LIKE\x20?',_0x447693+'%');}else if(qs[_0x9f4c('0x2a')](_0x447693)){_0x2e232a['or'](_0x9f4c('0x2b'),_0x447693+'%');}else{_0x2e232a['or']('c.firstName\x20LIKE\x20?','%'+_0x447693+'%');_0x2e232a['or'](_0x9f4c('0x2c'),'%'+_0x447693+'%');_0x2e232a['or'](_0x9f4c('0x2b'),'%'+_0x447693+'%');}}}return _0x2e232a;}function parseAdvancedSearchFilter(_0x26aa09,_0x12b8df){var _0x57512e=getSqlClauses();var _0x80a6bc=as[_0x9f4c('0x2d')](_0x26aa09);var _0x31b18c=_0x80a6bc[_0x9f4c('0x2e')];for(var _0x3727a8=0x0;_0x3727a8<_0x80a6bc['conditions'][_0x9f4c('0x2f')];_0x3727a8++){var _0x58f380=_0x80a6bc[_0x9f4c('0x30')][_0x3727a8];var _0x45ebf2='c';var _0x3e9f26=_['find'](_0x12b8df,['name',_0x58f380[_0x9f4c('0x21')]]);if(_0x3e9f26){if(_0x58f380[_0x9f4c('0x21')]===_0x9f4c('0x31')||_0x3e9f26[_0x9f4c('0x32')]==='datetime'){_0x58f380['castTo']=_0x9f4c('0x33');}var _0x18e96c=as[_0x9f4c('0x34')](_0x45ebf2,_0x3e9f26[_0x9f4c('0x35')],_0x58f380);_0x57512e[_0x9f4c('0x36')][_0x31b18c](_0x18e96c[_0x9f4c('0x37')],_0x18e96c['value']['start'],_0x18e96c['value'][_0x9f4c('0x38')]);}else{if(_0x58f380[_0x9f4c('0x21')]===_0x9f4c('0x39')){var _0x13d185=_0x58f380[_0x9f4c('0x3a')][_0x9f4c('0x25')](',')[_0x9f4c('0x3b')](function(_0x21f0df){return Number(_0x21f0df);});var _0x1aaab4=parseTagParameter(_0x13d185);_0x57512e[_0x9f4c('0x3c')][_0x9f4c('0x3d')]['and'](_0x1aaab4);_0x57512e[_0x9f4c('0x3c')][_0x9f4c('0x3e')]=_0x13d185;}else if(_0x58f380[_0x9f4c('0x21')]==='User'){_0x57512e[_0x9f4c('0x3f')][_0x9f4c('0x3d')]['and'](_0x9f4c('0x40'),_0x58f380[_0x9f4c('0x3a')]);_0x57512e['user']['skip']=!![];}}}return _0x57512e;}function parseModelFields(_0x5dc438,_0x23cd79){var _0x37bb37=squel[_0x9f4c('0x22')]();var _0x319415=_(_0x5dc438)[_0x9f4c('0x41')]()[_0x9f4c('0x3b')](function(_0x1ac627){return _[_0x9f4c('0x42')](_0x23cd79,[_0x9f4c('0x43'),_0x1ac627])?_0x1ac627:undefined;})[_0x9f4c('0x44')]()['value']();if(_0x5dc438[_0x9f4c('0x45')]){_0x319415[_0x9f4c('0x1f')](_0x9f4c('0x45'));}if(_0x5dc438[_0x9f4c('0x46')]){_0x319415[_0x9f4c('0x1f')](_0x9f4c('0x46'));}if(_0x319415[_0x9f4c('0x2f')]>0x0){_0x319415[_0x9f4c('0x20')](function(_0x3c1939){if(_0x3c1939===_0x9f4c('0x5')){_0x37bb37[_0x9f4c('0x47')](_0x9f4c('0x48'),[][_0x9f4c('0x49')](_0x5dc438[_0x3c1939]));}else if(_0x3c1939===_0x9f4c('0x45')){var _0x79174f='%'+_0x5dc438[_0x3c1939]+'%';_0x37bb37[_0x9f4c('0x47')](_0x9f4c('0x4a'),_0x79174f);}else if(_0x3c1939===_0x9f4c('0x46')){_0x37bb37['and']('uc.UserId\x20=\x20?',_0x5dc438[_0x3c1939]);}else{_0x37bb37['and']('c.'+_0x3c1939+_0x9f4c('0x4b'),_0x5dc438[_0x3c1939]);}});}return _0x37bb37;}function parseQueryParameters(_0x5d354a,_0x39235f){var _0x4dbd50=getSqlClauses();return Promise[_0x9f4c('0x4c')]()['then'](function(){return parseModelFields(_0x5d354a,_0x39235f);})['then'](function(_0x524de7){_0x4dbd50[_0x9f4c('0x4d')][_0x9f4c('0x47')](_0x524de7);return parseTagParameter(_0x5d354a[_0x9f4c('0x4e')]);})['then'](function(_0x1d67e){_0x4dbd50[_0x9f4c('0x3c')]['clause']['and'](_0x1d67e);return parseSearchFilter(_0x5d354a[_0x9f4c('0x4f')]);})[_0x9f4c('0x50')](function(_0x58ecf5){_0x4dbd50['filter']=_0x58ecf5;return _0x4dbd50;});}function checkListsRestrictions(_0x34f54e,_0x2c03f3,_0xf4371b){var _0x4264bb=squel[_0x9f4c('0x22')]();return Promise[_0x9f4c('0x4c')]()['then'](function(){if(_0x2c03f3[_0x9f4c('0x51')]&&_0x34f54e[_0x9f4c('0x52')]===_0x9f4c('0x4')&&!_0xf4371b){return _0x34f54e['getLists']({'attributes':['id'],'raw':!![]});}})[_0x9f4c('0x50')](function(_0x3cf6ea){if(_0x3cf6ea){if(_0x3cf6ea[_0x9f4c('0x2f')]===0x0){_0x4264bb[_0x9f4c('0x47')](_0x9f4c('0x53'));}else{_0x4264bb['and'](_0x9f4c('0x48'),_['map'](_0x3cf6ea,'id'));}}})[_0x9f4c('0x50')](function(){return _0x4264bb;});}function buildContactsQuery(_0x4a659e,_0x464825,_0x7abe4,_0x41b267,_0x3759ee,_0x2e62c7){if(_0x464825){_0x464825=_0x7abe4['attributes'];}_0x4a659e=addFieldsToQuery(_0x4a659e,_0x464825,_0x41b267,_0x2e62c7,!![]);var _0x302a24=squel[_0x9f4c('0x8')]();_0x302a24=addFieldsToQuery(_0x302a24,_0x464825,_0x41b267,_0x2e62c7,![]);if(_0x41b267||_0x2e62c7){_0x4a659e=applyJoinClauses(_0x4a659e,!![]);_0x4a659e[_0x9f4c('0x54')](_0x9f4c('0x55'));if(_0x7abe4[_0x9f4c('0x56')]){_0x302a24[_0x9f4c('0x56')](_0x7abe4['limit']);}if(_0x7abe4[_0x9f4c('0x57')]){_0x302a24[_0x9f4c('0x57')](_0x7abe4[_0x9f4c('0x57')]);}}else{_0x302a24=applyJoinClauses(_0x302a24,![]);_0x302a24[_0x9f4c('0x54')](_0x9f4c('0x58'));if(_0x7abe4[_0x9f4c('0x56')]){_0x4a659e[_0x9f4c('0x56')](_0x7abe4['limit']);}if(_0x7abe4[_0x9f4c('0x57')]){_0x4a659e['offset'](_0x7abe4[_0x9f4c('0x57')]);}}_0x302a24['having'](_0x3759ee);if(_0x7abe4[_0x9f4c('0x59')]){_0x7abe4[_0x9f4c('0x59')][_0x9f4c('0x20')](function(_0x219556){_0x4a659e[_0x9f4c('0x59')]('c.'+_0x219556[0x0],_0x219556[0x1]==='DESC'?![]:!![]);_0x302a24[_0x9f4c('0x59')](_0x9f4c('0x5a')+_0x219556[0x0],_0x219556[0x1]==='DESC'?![]:!![]);});}_0x302a24[_0x9f4c('0x9')](_0x4a659e,_0x9f4c('0xc'));return _0x302a24;}function getFilteredContacts(_0x5d5484){var _0x55ab02=[];return db[_0x9f4c('0x39')]['findAll']({'attributes':['id','name','color'],'raw':!![]})[_0x9f4c('0x50')](function(_0x3bc468){_0x55ab02=_[_0x9f4c('0x5b')](_0x3bc468,'id');var _0x16fdab={'type':db[_0x9f4c('0x5c')][_0x9f4c('0x5d')]['SELECT'],'model':db[_0x9f4c('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x9f4c('0x5f')][_0x9f4c('0x60')](_0x5d5484['toString'](),_0x16fdab);})[_0x9f4c('0x50')](function(_0xb7757c){_0xb7757c[_0x9f4c('0x20')](function(_0x2533c2){if(_0x2533c2[_0x9f4c('0x1d')]){_0x2533c2[_0x9f4c('0x61')]=[];_0x2533c2[_0x9f4c('0x1d')][_0x9f4c('0x25')](',')[_0x9f4c('0x20')](function(_0x37dc51){_0x2533c2[_0x9f4c('0x61')][_0x9f4c('0x1f')](_0x55ab02[_0x37dc51]);});}delete _0x2533c2['TagIds'];});return _0xb7757c;});}function countFilteredContacts(_0x34bfb1,_0x482f0b){var _0x176f22=_0x34bfb1[_0x9f4c('0x62')]();_0x176f22[_0x9f4c('0x21')](_0x9f4c('0x63'));_0x176f22=applyJoinClauses(_0x176f22,!![]);_0x34bfb1[_0x9f4c('0x54')](_0x9f4c('0x55'));var _0x17a4fa=utils['getSelectedTags'](_0x482f0b);if(!_['isEmpty'](_0x17a4fa)){_0x176f22['where']('t.id\x20IN\x20?',_0x17a4fa);}var _0x4f6310={'type':db[_0x9f4c('0x5c')][_0x9f4c('0x5d')][_0x9f4c('0x64')],'raw':!![]};return db[_0x9f4c('0x5f')]['query'](_0x176f22['toString'](),_0x4f6310)[_0x9f4c('0x50')](function(_0x1ca6ae){return _0x1ca6ae[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e48aa4d..8e47d93 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 _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 +var _0xea1c=['filter','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','update','write','end','binary','close','unlink','decryptFile','createDecipher','final','utf8','base64','decryptString','secret','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0xea1c,0xe5));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0xcea1('0x0'));var fs=require('fs');var BPromise=require(_0xcea1('0x1'));var _=require(_0xcea1('0x2'));var config=require(_0xcea1('0x3'));var logger=require(_0xcea1('0x4'))(_0xcea1('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xcea1('0x6')][_0xcea1('0x7')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xcea1('0x8')};if(config[_0xcea1('0x9')]&&config['encrypt'][_0xcea1('0xa')]){var isSupported=isAlgorithmSupported(config[_0xcea1('0x9')][_0xcea1('0xa')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0xcea1('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xcea1('0xb')](',\x20');logger[_0xcea1('0xc')](config[_0xcea1('0x9')][_0xcea1('0xa')],_0xcea1('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x1a085e){return AES_SUPPORTED_RX[_0xcea1('0xe')](_0x1a085e);}function getSupportedCiphers(){return crypto[_0xcea1('0xf')]()[_0xcea1('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x42a9cb){return getSupportedCiphers()['indexOf'](_0x42a9cb)>-0x1;}function combineOptions(_0x503cee){var _0x1b68e9={};for(var _0x30a81b in fileOptions){if(fileOptions['hasOwnProperty'](_0x30a81b)){_0x1b68e9[_0x30a81b]=fileOptions[_0x30a81b];}}if(_0x503cee){for(var _0x535499 in _0x503cee){if(_0x503cee[_0xcea1('0x11')](_0x535499)){_0x1b68e9[_0x535499]=_0x503cee[_0x535499];}}}return _0x1b68e9;}exports['encryptFile']=function(_0x216d48,_0x5a6f53,_0xd40e8a,_0xc4da80){return new BPromise(function(_0x5afb74,_0xf62fe1){_0xc4da80=combineOptions(_0xc4da80);var _0x2cad61=new Buffer(_0xd40e8a);var _0x2e8cb8=fs[_0xcea1('0x12')](_0x216d48);var _0x22122b=fs[_0xcea1('0x13')](_0x5a6f53);var _0x1cc858=crypto[_0xcea1('0x14')](_0xc4da80[_0xcea1('0xa')],_0x2cad61);_0x2e8cb8['on'](_0xcea1('0x15'),function(_0x164577){var _0x50e6d2=new Buffer(_0x1cc858[_0xcea1('0x16')](_0x164577),'binary');_0x22122b[_0xcea1('0x17')](_0x50e6d2);});_0x2e8cb8['on'](_0xcea1('0x18'),function(){try{var _0x55548d=new Buffer(_0x1cc858['final']('binary'),_0xcea1('0x19'));_0x22122b[_0xcea1('0x17')](_0x55548d);_0x22122b[_0xcea1('0x18')]();_0x22122b['on'](_0xcea1('0x1a'),function(){return _0x5afb74(_0x5a6f53);});}catch(_0x5af03a){fs[_0xcea1('0x1b')](_0x5a6f53);return _0xf62fe1(_0x5af03a);}});});};exports[_0xcea1('0x1c')]=function(_0x84a72c,_0x772637,_0x2b61f3,_0x19e03b){return new BPromise(function(_0x442a47,_0x5eabae){_0x19e03b=combineOptions(_0x19e03b);var _0xf11923=new Buffer(_0x2b61f3);var _0x3701f4=fs[_0xcea1('0x12')](_0x84a72c);var _0x577e8c=fs['createWriteStream'](_0x772637);var _0x2edd3e=crypto[_0xcea1('0x1d')](_0x19e03b[_0xcea1('0xa')],_0xf11923);_0x3701f4['on'](_0xcea1('0x15'),function(_0x4e2da1){var _0xbb17c=new Buffer(_0x2edd3e[_0xcea1('0x16')](_0x4e2da1),_0xcea1('0x19'));_0x577e8c['write'](_0xbb17c);});_0x3701f4['on'](_0xcea1('0x18'),function(){try{var _0x3c7c8f=new Buffer(_0x2edd3e[_0xcea1('0x1e')]('binary'),'binary');_0x577e8c[_0xcea1('0x17')](_0x3c7c8f);_0x577e8c[_0xcea1('0x18')]();_0x577e8c['on'](_0xcea1('0x1a'),function(){return _0x442a47(_0x772637);});}catch(_0x3ce2d3){fs[_0xcea1('0x1b')](_0x772637);return _0x5eabae(_0x3ce2d3);}});});};exports['encryptString']=function(_0x399403,_0x5b3af7,_0x4d603c){var _0x52c3a1=_0x4d603c||stringOptions['algorithm'];var _0x2a6605=_0x5b3af7||stringOptions['secret'];var _0x15a62e=crypto['createCipher'](_0x52c3a1,_0x2a6605);var _0x237d67=_0x15a62e[_0xcea1('0x16')](_0x399403,_0xcea1('0x1f'),_0xcea1('0x20'));_0x237d67+=_0x15a62e[_0xcea1('0x1e')](_0xcea1('0x20'));return _0x237d67;};exports[_0xcea1('0x21')]=function(_0x5b0cb4,_0xd43c2a,_0x4cb5e4){var _0x128b06=_0x4cb5e4||stringOptions['algorithm'];var _0x5b4df0=_0xd43c2a||stringOptions[_0xcea1('0x22')];var _0x3aa5f=crypto[_0xcea1('0x1d')](_0x128b06,_0x5b4df0);var _0x1c463d=_0x3aa5f[_0xcea1('0x16')](_0x5b0cb4,_0xcea1('0x20'),_0xcea1('0x1f'));_0x1c463d+=_0x3aa5f[_0xcea1('0x1e')](_0xcea1('0x1f'));return _0x1c463d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 377d6a6..35e47ed 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 _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 +var _0x78d9=['to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.csv','existsSync','mkdirSync','join','%s%d.%s','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','lodash'];(function(_0x5d05c6,_0x482c6e){var _0x52403a=function(_0x256a97){while(--_0x256a97){_0x5d05c6['push'](_0x5d05c6['shift']());}};_0x52403a(++_0x482c6e);}(_0x78d9,0x156));var _0x978d=function(_0x3dcd7d,_0x184b2e){_0x3dcd7d=_0x3dcd7d-0x0;var _0x34d496=_0x78d9[_0x3dcd7d];return _0x34d496;};'use strict';var util=require('util');var path=require('path');var _=require(_0x978d('0x0'));var csv=require(_0x978d('0x1'));var fs=require('fs');var BPromise=require(_0x978d('0x2'));var zipdir=require(_0x978d('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x978d('0x4'))[_0x978d('0x5')];var logger=require(_0x978d('0x6'))(_0x978d('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x978d('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x978d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x16f2ea,_0x49d0dc){var _0x554c1f={'status':_0x16f2ea};var _0x1a90d5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x49d0dc){_0x554c1f[_0x978d('0x9')]=_0x49d0dc;}return db[_0x978d('0xa')][_0x978d('0xb')](_0x554c1f,_0x1a90d5);}function main(){var _0x1665c6=0x1388;var _0x192085;logger[_0x978d('0xc')](util['format'](_0x978d('0xd'),EXTRACTED_REPORT_ID,_0x978d('0xe')));return db[_0x978d('0xf')][_0x978d('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x978d('0x11'),_0x978d('0x12')]})[_0x978d('0x13')](function(_0x425dd7){if(_0x425dd7){_0x192085=_0x425dd7;_0x1665c6=_0x192085[_0x978d('0x12')]||0x1388;}})[_0x978d('0x13')](function(){return dbH[_0x978d('0x14')]['query'](util[_0x978d('0x15')](_0x978d('0x16'),QUERY),{'type':dbH['sequelize'][_0x978d('0x17')][_0x978d('0x18')]});})[_0x978d('0x13')](function(_0x32c48c){if(!_0x32c48c[0x0][_0x978d('0x19')]){return analyticExtractedReport(_0x978d('0x1a'));}var _0x1e5f79=[];var _0x50a8e7=0x0;if(_0x192085[_0x978d('0x11')]){if(_0x32c48c&&_0x32c48c[_0x978d('0x1b')]){var _0x53f061=_['range'](_0x32c48c[0x0][_0x978d('0x19')]/_0x1665c6);var _0x3c64ea=Number[_0x978d('0x1c')](_0x32c48c[0x0][_0x978d('0x19')]/_0x1665c6)?_0x32c48c[0x0][_0x978d('0x19')]%_0x1665c6:0x0;_0x53f061[_0x978d('0x1d')](function(_0x45c486){if(_0x45c486>0x0){_0x50a8e7+=_0x1665c6;}_0x1e5f79['push'](dbH[_0x978d('0x14')][_0x978d('0x1e')](util[_0x978d('0x15')](_0x978d('0x1f'),QUERY,_0x1665c6,_0x50a8e7),{'type':dbH[_0x978d('0x14')][_0x978d('0x17')][_0x978d('0x18')]}));});if(_0x3c64ea>0x0){_0x50a8e7+=_0x1665c6;_0x1e5f79[_0x978d('0x20')](dbH[_0x978d('0x14')][_0x978d('0x1e')](util[_0x978d('0x15')](_0x978d('0x1f'),QUERY,_0x3c64ea,_0x50a8e7),{'type':dbH[_0x978d('0x14')][_0x978d('0x17')][_0x978d('0x18')]}));}}}else{_0x1e5f79[_0x978d('0x20')](dbH[_0x978d('0x14')][_0x978d('0x1e')](QUERY,{'type':dbH[_0x978d('0x14')]['QueryTypes']['SELECT']}));}var _0x1cda59=path[_0x978d('0x21')](PATH);var _0x3a9948=path['basename'](PATH,_0x978d('0x22'));var _0x4c7bf3=_0x192085[_0x978d('0x11')]&&_0x1e5f79[_0x978d('0x1b')]>0x1;var _0x57f5c6=[];if(!fs[_0x978d('0x23')](path['join'](_0x1cda59,_0x3a9948))&&_0x4c7bf3){fs[_0x978d('0x24')](path[_0x978d('0x25')](_0x1cda59,_0x3a9948));}return BPromise['each'](_0x1e5f79,function(_0x21d0d8){_0x57f5c6['push'](_0x21d0d8);})[_0x978d('0x13')](function(){for(var _0x5c44df=0x0;_0x5c44df<_0x57f5c6[_0x978d('0x1b')];_0x5c44df+=0x1){var _0x21390c;var _0x577f09=_0x57f5c6[_0x5c44df];if(_0x4c7bf3){_0x21390c=path[_0x978d('0x25')](_0x1cda59,_0x3a9948,util[_0x978d('0x15')](_0x978d('0x26'),_0x3a9948,_0x5c44df,'csv'));}else{_0x21390c=path['join'](_0x1cda59,util[_0x978d('0x15')](_0x978d('0x27'),_0x3a9948,'csv'));}fs[_0x978d('0x28')](_0x21390c,csv(_0x577f09));}})[_0x978d('0x13')](function(){if(_0x4c7bf3){return new Promise(function(_0x18f899){zipdir(path['join'](_0x1cda59,_0x3a9948),{'saveTo':path['join'](_0x1cda59,util[_0x978d('0x15')]('%s.%s',_0x3a9948,_0x978d('0x29')))},function(_0x333ef8,_0x4411e6){rimraf(path[_0x978d('0x25')](_0x1cda59,_0x3a9948),function(){});_0x18f899('zip\x20finished');});});}})[_0x978d('0x13')](function(){logger[_0x978d('0xc')](util[_0x978d('0x15')](_0x978d('0x2a'),EXTRACTED_REPORT_ID,_0x978d('0xe')));return analyticExtractedReport(_0x978d('0x2b'),_0x4c7bf3?util['format'](_0x978d('0x27'),_0x3a9948,_0x4c7bf3?_0x978d('0x29'):_0x978d('0x2c')):null);});})[_0x978d('0x2d')](function(_0x3ea81b){logger[_0x978d('0xc')](util['format'](_0x978d('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x3ea81b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x978d('0x2f')](function(){process[_0x978d('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 483b3b3..1fa0658 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 _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 +var _0xdb14=['zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','body','concat','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','push','header','pageBreak','before','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xdb14,0xcc));var _0x4db1=function(_0x5dee44,_0x115b60){_0x5dee44=_0x5dee44-0x0;var _0x46f720=_0xdb14[_0x5dee44];return _0x46f720;};'use strict';var _=require(_0x4db1('0x0'));var fs=require('fs');var util=require(_0x4db1('0x1'));var path=require(_0x4db1('0x2'));var moment=require(_0x4db1('0x3'));var htmlToPdfmake=require(_0x4db1('0x4'));var PdfPrinter=require(_0x4db1('0x5'));var zipdir=require(_0x4db1('0x6'));var rimraf=require(_0x4db1('0x7'));var JSDOM=require(_0x4db1('0x8'))[_0x4db1('0x9')];var window=new JSDOM('')[_0x4db1('0xa')];var BPromise=require(_0x4db1('0xb'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x4db1('0xc'))(_0x4db1('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4db1('0xe')][0x3];var PATH=process[_0x4db1('0xe')][0x4];var NAME=process[_0x4db1('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x46bc4f,_0x5e8d97){var _0x17438e={'status':_0x46bc4f};var _0x7a4302={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5e8d97){_0x17438e[_0x4db1('0xf')]=_0x5e8d97;}return db[_0x4db1('0x10')][_0x4db1('0x11')](_0x17438e,_0x7a4302);}function getHeaders(_0x5eb2c3){return _[_0x4db1('0x12')](_0x5eb2c3,function(_0x4ac76){return{'text':_0x4ac76,'style':_0x4db1('0x13')};});}function getRows(_0x2480a8,_0x20a52e){return _[_0x4db1('0x12')](_0x20a52e,function(_0x2a82c5){return _(_0x2a82c5)[_0x4db1('0x14')](_0x2480a8)['map'](function(_0x52b99e){return _0x52b99e?_[_0x4db1('0x15')](_0x52b99e):'';})[_0x4db1('0x16')]();});}function createTable(_0x46fcbc,_0x36c505){var _0x3ed191={'widths':_[_0x4db1('0x17')](Array(_0x46fcbc[_0x4db1('0x18')]),0x91),'heights':function(_0x2740a1){return _0x2740a1===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4b2364=getHeaders(_0x46fcbc);_0x3ed191['body']['push'](_0x4b2364);var _0xbfaacd=getRows(_0x46fcbc,_0x36c505);_0x3ed191[_0x4db1('0x19')]=_0x3ed191[_0x4db1('0x19')][_0x4db1('0x1a')](_0xbfaacd);return _0x3ed191;}function createTables(_0x415b35){var _0x4dd6d2=[];var _0x156fb9=_['chunk'](Object['keys'](_0x415b35[0x0]),0x5);_0x156fb9[_0x4db1('0x1b')](function(_0x1de970){_0x4dd6d2['push'](createTable(_0x1de970,_0x415b35));});return _0x4dd6d2;}function getPDFDocDefinition(_0x35595d){var _0x38747f=util[_0x4db1('0x1c')](_0x4db1('0x1d'),NAME,EXTRACTED_REPORT[_0x4db1('0x1e')],moment(EXTRACTED_REPORT['startDate'])[_0x4db1('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x4db1('0x1f')])[_0x4db1('0x1c')](FORMAT));var _0x4c606c=[];for(var _0x511b59=0x0;_0x511b59<_0x35595d[_0x4db1('0x18')];_0x511b59++){var _0x2a1866=[];if(_0x511b59===0x0){_0x2a1866[_0x4db1('0x20')]({'text':_0x38747f,'style':_0x4db1('0x21')});}var _0xd1d05={'table':_0x35595d[_0x511b59]};if(_0x511b59>0x0){_0xd1d05[_0x4db1('0x22')]=_0x4db1('0x23');_0xd1d05['margin']=[0x0,0x46,0x0,0x0];}_0x2a1866[_0x4db1('0x20')](_0xd1d05);_0x4c606c[_0x4db1('0x20')](_0x2a1866);}return{'pageSize':'A4','pageOrientation':_0x4db1('0x24'),'content':_0x4c606c,'footer':function(_0x33630d,_0x19dad5){return{'text':_0x33630d['toString']()+_0x4db1('0x25')+_0x19dad5,'style':_0x4db1('0x26')};},'defaultStyle':{'font':_0x4db1('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4db1('0x28')},'footer':{'alignment':_0x4db1('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x63e2b9){var _0x38575a=0x1388;var _0x35d50f;if(!_0x63e2b9[0x0][_0x4db1('0x2a')]){return analyticExtractedReport(_0x4db1('0x2b'));}return db[_0x4db1('0x2c')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4db1('0x2d'),_0x4db1('0x2e')]})[_0x4db1('0x2f')](function(_0x6666c5){if(_0x6666c5){_0x35d50f=_0x6666c5;_0x38575a=_0x35d50f[_0x4db1('0x2e')]||0x3e8;}})[_0x4db1('0x2f')](function(){var _0x5a4220=[];var _0xc2d12d=0x0;if(_0x35d50f[_0x4db1('0x2d')]){if(_0x63e2b9&&_0x63e2b9['length']){var _0x3362dc=_[_0x4db1('0x30')](_0x63e2b9[0x0]['num']/_0x38575a);var _0x12b411=Number[_0x4db1('0x31')](_0x63e2b9[0x0]['num']/_0x38575a)?_0x63e2b9[0x0][_0x4db1('0x2a')]%_0x38575a:0x0;_0x3362dc[_0x4db1('0x1b')](function(_0x4d7d04){if(_0x4d7d04>0x0){_0xc2d12d+=_0x38575a;}_0x5a4220[_0x4db1('0x20')](dbH['sequelize'][_0x4db1('0x32')](util[_0x4db1('0x1c')](_0x4db1('0x33'),QUERY,_0x38575a,_0xc2d12d),{'type':dbH[_0x4db1('0x34')]['QueryTypes']['SELECT']}));});if(_0x12b411>0x0){_0xc2d12d+=_0x38575a;_0x5a4220['push'](dbH[_0x4db1('0x34')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x12b411,_0xc2d12d),{'type':dbH[_0x4db1('0x34')][_0x4db1('0x35')][_0x4db1('0x36')]}));}}}else{_0x5a4220[_0x4db1('0x20')](dbH[_0x4db1('0x34')][_0x4db1('0x32')](QUERY,{'type':dbH[_0x4db1('0x34')]['QueryTypes']['SELECT']}));}var _0x3e0d41=path[_0x4db1('0x37')](PATH);var _0xebafb5=path['basename'](PATH,_0x4db1('0x38'));var _0xeb725b=_0x35d50f['split']&&_0x5a4220[_0x4db1('0x18')]>0x1;var _0x1de744=[];if(!fs[_0x4db1('0x39')](path[_0x4db1('0x3a')](_0x3e0d41,_0xebafb5))&&_0xeb725b){fs['mkdirSync'](path[_0x4db1('0x3a')](_0x3e0d41,_0xebafb5));}return BPromise[_0x4db1('0x3b')](_0x5a4220,function(_0x55aa1e){_0x1de744[_0x4db1('0x20')](_0x55aa1e);})['then'](function(){var _0x1da4f4=[];for(var _0x39dc5e=0x0;_0x39dc5e<_0x1de744['length'];_0x39dc5e+=0x1){var _0x54b58b=_0x1de744[_0x39dc5e];var _0x5a3ddb=createTables(_[_0x4db1('0x3c')](_0x54b58b));var _0x11191f;var _0x415d87=getPDFDocDefinition(_0x5a3ddb);var _0x5ec77c=getPDFPrinter();var _0x37bedb=_0x5ec77c[_0x4db1('0x3d')](_0x415d87);if(_0xeb725b){_0x11191f=path[_0x4db1('0x3a')](_0x3e0d41,_0xebafb5,util[_0x4db1('0x1c')](_0x4db1('0x3e'),_0xebafb5,_0x39dc5e,_0x4db1('0x3f')));}else{_0x11191f=path[_0x4db1('0x3a')](_0x3e0d41,util[_0x4db1('0x1c')](_0x4db1('0x40'),_0xebafb5,_0x4db1('0x3f')));}_0x1da4f4[_0x4db1('0x20')](writePDFDocument(_0x37bedb,_0x11191f));}return Promise['all'](_0x1da4f4);})['then'](function(){if(_0xeb725b){return new Promise(function(_0x27605b){zipdir(path[_0x4db1('0x3a')](_0x3e0d41,_0xebafb5),{'saveTo':path['join'](_0x3e0d41,util[_0x4db1('0x1c')]('%s.%s',_0xebafb5,_0x4db1('0x41')))},function(){rimraf(path['join'](_0x3e0d41,_0xebafb5),function(){});_0x27605b(_0x4db1('0x42'));});});}})[_0x4db1('0x2f')](function(){if(!_0xeb725b)return;rimraf(path[_0x4db1('0x3a')](_0x3e0d41,_0xebafb5),function(){});})[_0x4db1('0x2f')](function(){logger[_0x4db1('0x43')](util[_0x4db1('0x1c')](_0x4db1('0x44'),EXTRACTED_REPORT_ID,_0x4db1('0x45')));return analyticExtractedReport(_0x4db1('0x46'),_0xeb725b?util['format']('%s.%s',_0xebafb5,_0xeb725b?_0x4db1('0x41'):_0x4db1('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4db1('0x43')](util[_0x4db1('0x1c')](_0x4db1('0x47'),EXTRACTED_REPORT_ID,_0x4db1('0x45')));return db[_0x4db1('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4db1('0x2f')](function(_0x48d040){EXTRACTED_REPORT=_0x48d040;return dbH[_0x4db1('0x34')][_0x4db1('0x32')](util['format'](_0x4db1('0x48'),QUERY),{'type':dbH['sequelize'][_0x4db1('0x35')]['SELECT']});})[_0x4db1('0x2f')](extractReport)['catch'](function(_0x2b8aa1){logger[_0x4db1('0x43')](util[_0x4db1('0x1c')](_0x4db1('0x49'),EXTRACTED_REPORT_ID,_0x4db1('0x45')),util[_0x4db1('0x4a')](_0x2b8aa1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4db1('0x4b'));})['finally'](function(){process[_0x4db1('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2ee59f=new PdfPrinter({'Arial':{'normal':__dirname+_0x4db1('0x4d'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x4db1('0x4e'),'bolditalics':__dirname+_0x4db1('0x4f')}});return _0x2ee59f;}function getPDFDocDefinitionFromHTML(_0x3369f5,_0x4e1c36){var _0x2cc8b6=util['format'](_0x4db1('0x50'),_0x4e1c36[_0x4db1('0x51')],_0x4e1c36['interactionId']);var _0x129687=moment()[_0x4db1('0x1c')](_0x4db1('0x52'))[_0x4db1('0x15')]();var _0x1bc160=htmlToPdfmake(_0x3369f5,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1bc160],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4db1('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4db1('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x4db1('0x21')}];},'footer':function(_0x2a7cc6,_0x24d651){return[{'text':util[_0x4db1('0x1c')](_0x4db1('0x54'),_0x2cc8b6,_0x2a7cc6,_0x24d651,_0x129687),'style':'footer'}];}};}function writePDFDocument(_0x19dcb7,_0x265643){return new Promise(function(_0x521678,_0x2afad5){var _0x35f195=_0x19dcb7[_0x4db1('0x55')](fs[_0x4db1('0x56')](_0x265643));_0x35f195['on']('finish',function(){_0x521678(_0x4db1('0x57'));});_0x35f195['on']('error',function(_0x2e900d){_0x2afad5(_0x2e900d);});_0x19dcb7['end']();});}exports[_0x4db1('0x58')]=function(_0x3e1710,_0x4f5967){var _0x4eb6c4=getPDFPrinter();var _0x25b783=getPDFDocDefinitionFromHTML(_0x3e1710,_0x4f5967);var _0x32c228=_0x4eb6c4[_0x4db1('0x3d')](_0x25b783);return writePDFDocument(_0x32c228,_0x4f5967[_0x4db1('0x2')])[_0x4db1('0x59')](function(_0x5685a5){throw _0x5685a5;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 8f245cf..3b71946 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 _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 +var _0xa7b5=['Empty','length','range','num','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x161904,_0x21d7bf){_0x161904=_0x161904-0x0;var _0x24ffa3=_0xa7b5[_0x161904];return _0x24ffa3;};'use strict';var util=require(_0x5a7b('0x0'));var path=require('path');var _=require(_0x5a7b('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x5a7b('0x2'));var zipdir=require(_0x5a7b('0x3'));var rimraf=require(_0x5a7b('0x4'));var db=require(_0x5a7b('0x5'))['db'];var dbH=require(_0x5a7b('0x5'))[_0x5a7b('0x6')];var logger=require(_0x5a7b('0x7'))(_0x5a7b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x5a7b('0x9')][0x2]);var QUERY=process[_0x5a7b('0x9')][0x3];var PATH=process[_0x5a7b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x493ae6,_0x2cd623){var _0x24b80c={'status':_0x493ae6};var _0x7a3ae={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2cd623){_0x24b80c[_0x5a7b('0xa')]=_0x2cd623;}return db[_0x5a7b('0xb')][_0x5a7b('0xc')](_0x24b80c,_0x7a3ae);}function main(){var _0x5a414a=0x1388;var _0x5476b8;logger[_0x5a7b('0xd')](util['format'](_0x5a7b('0xe'),EXTRACTED_REPORT_ID,_0x5a7b('0xf')));return db[_0x5a7b('0x10')][_0x5a7b('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5a7b('0x12'),_0x5a7b('0x13')]})[_0x5a7b('0x14')](function(_0x156031){if(_0x156031){_0x5476b8=_0x156031;_0x5a414a=_0x5476b8[_0x5a7b('0x13')]||0x1388;}})[_0x5a7b('0x14')](function(){return dbH[_0x5a7b('0x15')]['query'](util[_0x5a7b('0x16')](_0x5a7b('0x17'),QUERY),{'type':dbH[_0x5a7b('0x15')][_0x5a7b('0x18')]['SELECT']});})[_0x5a7b('0x14')](function(_0x2ca1d6){if(!_0x2ca1d6[0x0]['num']){return analyticExtractedReport(_0x5a7b('0x19'));}var _0x4d2e57=[];var _0x3d3239=0x0;if(_0x5476b8['split']){if(_0x2ca1d6&&_0x2ca1d6[_0x5a7b('0x1a')]){var _0x3c3359=_[_0x5a7b('0x1b')](_0x2ca1d6[0x0]['num']/_0x5a414a);var _0x33b996=Number['isInteger'](_0x2ca1d6[0x0][_0x5a7b('0x1c')]/_0x5a414a)?_0x2ca1d6[0x0][_0x5a7b('0x1c')]%_0x5a414a:0x0;_0x3c3359[_0x5a7b('0x1d')](function(_0x311b3f){if(_0x311b3f>0x0){_0x3d3239+=_0x5a414a;}_0x4d2e57[_0x5a7b('0x1e')](dbH[_0x5a7b('0x15')][_0x5a7b('0x1f')](util[_0x5a7b('0x16')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a414a,_0x3d3239),{'type':dbH[_0x5a7b('0x15')][_0x5a7b('0x18')]['SELECT']}));});if(_0x33b996>0x0){_0x3d3239+=_0x5a414a;_0x4d2e57['push'](dbH[_0x5a7b('0x15')][_0x5a7b('0x1f')](util[_0x5a7b('0x16')](_0x5a7b('0x20'),QUERY,_0x33b996,_0x3d3239),{'type':dbH[_0x5a7b('0x15')]['QueryTypes']['SELECT']}));}}}else{_0x4d2e57[_0x5a7b('0x1e')](dbH[_0x5a7b('0x15')][_0x5a7b('0x1f')](QUERY,{'type':dbH[_0x5a7b('0x15')]['QueryTypes']['SELECT']}));}var _0x51928c=path[_0x5a7b('0x21')](PATH);var _0x3fbff6=path[_0x5a7b('0x22')](PATH,_0x5a7b('0x23'));var _0x26b4f3=_0x5476b8['split']&&_0x4d2e57[_0x5a7b('0x1a')]>0x1;var _0x55724d=[];if(!fs[_0x5a7b('0x24')](path['join'](_0x51928c,_0x3fbff6))&&_0x26b4f3){fs[_0x5a7b('0x25')](path[_0x5a7b('0x26')](_0x51928c,_0x3fbff6));}return BPromise[_0x5a7b('0x27')](_0x4d2e57,function(_0x4adbf0){_0x55724d[_0x5a7b('0x1e')](_0x4adbf0);})[_0x5a7b('0x14')](function(){for(var _0x169762=0x0;_0x169762<_0x55724d['length'];_0x169762+=0x1){var _0x36b90e;var _0x3172a8=_0x55724d[_0x169762];if(_0x26b4f3){_0x36b90e=path[_0x5a7b('0x26')](_0x51928c,_0x3fbff6,util[_0x5a7b('0x16')](_0x5a7b('0x28'),_0x3fbff6,_0x169762,'xlsx'));}else{_0x36b90e=path[_0x5a7b('0x26')](_0x51928c,util[_0x5a7b('0x16')](_0x5a7b('0x29'),_0x3fbff6,_0x5a7b('0x2a')));}fs[_0x5a7b('0x2b')](_0x36b90e,json2xls(_0x3172a8),_0x5a7b('0x2c'));}})['then'](function(){if(_0x26b4f3){return new Promise(function(_0x34f7a8){zipdir(path['join'](_0x51928c,_0x3fbff6),{'saveTo':path[_0x5a7b('0x26')](_0x51928c,util['format'](_0x5a7b('0x29'),_0x3fbff6,_0x5a7b('0x2d')))},function(_0x16d07e,_0x220f5d){rimraf(path[_0x5a7b('0x26')](_0x51928c,_0x3fbff6),function(){});_0x34f7a8(_0x5a7b('0x2e'));});});}})[_0x5a7b('0x14')](function(){logger['info'](util[_0x5a7b('0x16')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x5a7b('0xf')));return analyticExtractedReport(_0x5a7b('0x2f'),_0x26b4f3?util[_0x5a7b('0x16')](_0x5a7b('0x29'),_0x3fbff6,_0x26b4f3?'zip':_0x5a7b('0x2a')):null);});})[_0x5a7b('0x30')](function(_0x441afc){logger[_0x5a7b('0xd')](util['format'](_0x5a7b('0x31'),EXTRACTED_REPORT_ID,_0x5a7b('0xf')),util[_0x5a7b('0x32')](_0x441afc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x5a7b('0x33')](function(){process[_0x5a7b('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 8f8e68a..d85a313 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 _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 +var _0x2077=['Hangup','transaction','bulkCreate','sortBy','catch','lodash','Interval','findAll','then','intervals','models','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','inbound','VoiceExtensionId','context','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','hasOwnProperty','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat'];(function(_0x26f360,_0x2e261a){var _0x36d220=function(_0x550fd7){while(--_0x550fd7){_0x26f360['push'](_0x26f360['shift']());}};_0x36d220(++_0x2e261a);}(_0x2077,0x1e1));var _0x7207=function(_0x322a4f,_0x5ed401){_0x322a4f=_0x322a4f-0x0;var _0x4cca48=_0x2077[_0x322a4f];return _0x4cca48;};'use strict';var _=require(_0x7207('0x0'));var util=require('util');function rewrite(_0x462a0e,_0x2f47b3){var _0x4e16f8=this;return _0x462a0e['models'][_0x7207('0x1')][_0x7207('0x2')]({'raw':!![]})[_0x7207('0x3')](function(_0x197351){_0x4e16f8[_0x7207('0x4')]=_0x197351;return _0x462a0e[_0x7207('0x5')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x2f47b3['IntervalId']},'raw':!![]});})[_0x7207('0x3')](function(_0x25a558){return _0x462a0e[_0x7207('0x5')][_0x7207('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x7207('0x7')](_0x25a558,_0x7207('0x8')))}},'order':[{'raw':_0x7207('0x9')}],'raw':!![]});})[_0x7207('0x3')](function(_0x3a44b9){var _0x441c39=_[_0x7207('0xa')](_0x3a44b9,{'priority':'1'});var _0x4ef0f5=_[_0x7207('0xa')](_0x3a44b9,{'isApp':0x1});var _0x4fac00=_[_0x7207('0xb')](_0x4ef0f5,_0x7207('0x8'));var _0x44689f=['queue',_0x7207('0xc')];var _0x3f5cb1=[];var _0x3adaea=[];for(var _0x501395 in _0x4fac00){if(_0x4fac00['hasOwnProperty'](_0x501395)){_0x4e16f8[_0x7207('0xd')]=0x2;_0x4e16f8[_0x7207('0xe')]=[];_0x4e16f8[_0x7207('0xf')]=_[_0x7207('0x10')](_0x441c39,{'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')]});_0x4e16f8['extensions'][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':util[_0x7207('0x14')](_0x7207('0x15'),_0x4fac00[_0x501395][0x0][_0x7207('0x12')]),'context':_0x4fac00[_0x501395][0x0]['context'],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0]['VoiceExtensionId']});if(_0x4fac00[_0x501395][0x0][_0x7207('0x12')]===_0x7207('0x16')){_0x4e16f8['extensions'][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':'CDR(routeid)='+_0x4fac00[_0x501395][0x0][_0x7207('0x17')],'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});}else if(_0x4fac00[_0x501395][0x0][_0x7207('0x12')]===_0x7207('0x19')){if(_0x4e16f8[_0x7207('0xf')]){_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0]['type'],'app':'Set','appdata':_0x7207('0x1a')+(_0x4e16f8['extension'][_0x7207('0x1b')]?'${EXTEN:'+_0x4e16f8[_0x7207('0xf')][_0x7207('0x1b')]+'}':_0x7207('0x1c')),'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});}_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':_0x7207('0x1d')+_0x4fac00[_0x501395][0x0][_0x7207('0x17')],'context':_0x4fac00[_0x501395][0x0]['context'],'exten':_0x4fac00[_0x501395][0x0]['exten'],'priority':_0x4e16f8['priority']++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});var _0x389957=_0x4e16f8[_0x7207('0xd')]++;_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x389957+0x2)+'):Goto('+(_0x389957+0x1)+')','context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x389957,'VoiceExtensionId':_0x4fac00[_0x501395][0x0]['VoiceExtensionId']});if(_0x4e16f8['extension']){_0x4e16f8['extensions'][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':'Set','appdata':_0x4e16f8[_0x7207('0xf')]['cutdigits']?_0x7207('0x1f')+_0x4e16f8[_0x7207('0xf')][_0x7207('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8['priority']++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0]['VoiceExtensionId']});}_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':'Set','appdata':_0x7207('0x20')+_0x4fac00[_0x501395][0x0][_0x7207('0x17')],'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});if(_0x4e16f8[_0x7207('0xf')]&&_0x4e16f8['extension']['hasOwnProperty'](_0x7207('0x21'))&&_0x4e16f8[_0x7207('0xf')][_0x7207('0x21')]!==_0x7207('0x22')){_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':'Set','appdata':_0x7207('0x23'),'context':_0x4fac00[_0x501395][0x0]['context'],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8['priority']++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});_0x4e16f8[_0x7207('0xe')]['push']({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4e16f8['extension'][_0x7207('0x21')]||_0x7207('0x24'),'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8['priority']++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});}}_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':_0x7207('0x25'),'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0]['VoiceExtensionId']});_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0]['exten'],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':_0x7207('0x26'),'context':_0x4fac00[_0x501395][0x0]['context'],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8['priority']++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});for(var _0x25284f=0x0,_0x49916c=0x0;_0x25284f<_0x4fac00[_0x501395][_0x7207('0x27')];_0x25284f+=0x1,_0x49916c=0x0){var _0x54d89b=_0x4fac00[_0x501395][_0x25284f];if(_0x54d89b[_0x7207('0x12')]){_0x54d89b[_0x7207('0x12')]=_0x54d89b[_0x7207('0x12')][_0x7207('0x28')]();}var _0x20250f=[];var _0x2c2c92=[];delete _0x54d89b['id'];delete _0x54d89b[_0x7207('0x29')];delete _0x54d89b[_0x7207('0x2a')];var _0x508483=_0x54d89b[_0x7207('0x2b')]!=='*,*,*,*'?[_0x54d89b['interval']]:_0x54d89b['IntervalId']?_[_0x7207('0x7')](_[_0x7207('0xa')](_0x4e16f8[_0x7207('0x4')],{'IntervalId':_0x54d89b['IntervalId']}),_0x7207('0x2b')):[];if(_0x54d89b[_0x7207('0x2c')]('tag')){if(_0x54d89b[_0x7207('0x2d')]&&_0x54d89b[_0x7207('0x2d')]!=='--'){_0x20250f['push']({'type':_0x54d89b[_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':_0x7207('0x2e')+_0x54d89b[_0x7207('0x2d')],'context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b['exten'],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});}}if(_0x54d89b[_0x7207('0x12')]===_0x7207('0x19')&&_0x54d89b[_0x7207('0x2c')]('callerID')){if(_0x54d89b[_0x7207('0x2f')]){_0x20250f[_0x7207('0x11')]({'type':_0x54d89b['type'],'app':'ExecIf','appdata':_0x7207('0x30')+_0x54d89b[_0x7207('0x2f')]+')','context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b[_0x7207('0x8')],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});}else{_0x20250f[_0x7207('0x11')]({'type':_0x54d89b[_0x7207('0x12')],'app':_0x7207('0x1e'),'appdata':_0x7207('0x31'),'context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b['exten'],'priority':_0x508483['length']+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});}}if(_0x54d89b[_0x7207('0x2c')](_0x7207('0x32'))){if(_0x44689f[_0x7207('0x33')](_0x54d89b[_0x7207('0x34')][_0x7207('0x28')]())>=0x0&&_0x54d89b[_0x7207('0x35')]!==_0x7207('0x36')){if(_0x54d89b['answer']){_0x20250f[_0x7207('0x11')]({'type':_0x54d89b['type'],'app':_0x7207('0x1e'),'appdata':_0x7207('0x37'),'context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b[_0x7207('0x8')],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});_0x20250f['push']({'type':_0x54d89b[_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':_0x7207('0x38'),'context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b['exten'],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});}else{_0x20250f[_0x7207('0x11')]({'type':_0x54d89b[_0x7207('0x12')],'app':_0x7207('0x1e'),'appdata':_0x7207('0x39'),'context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b[_0x7207('0x8')],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8['priority']+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});_0x20250f[_0x7207('0x11')]({'type':_0x54d89b[_0x7207('0x12')],'app':'Set','appdata':_0x7207('0x3a'),'context':_0x54d89b['context'],'exten':_0x54d89b[_0x7207('0x8')],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});}}}for(var _0x2fa964=0x0;_0x2fa964<_0x508483[_0x7207('0x27')];_0x2fa964+=0x1){var _0x32e6ac=_0x4e16f8[_0x7207('0xd')]+_0x508483['length'];var _0x3abefa=_0x2fa964===_0x508483['length']-0x1?_0x4e16f8[_0x7207('0xd')]+_0x20250f['length']+_0x2c2c92[_0x7207('0x27')]+0x2:_0x4e16f8['priority']+_0x2fa964+0x1;_0x20250f[_0x7207('0x3b')](_0x2fa964,0x0,{'type':_0x54d89b['type'],'app':_0x7207('0x3c'),'appdata':_0x508483[_0x2fa964]+'?'+_0x54d89b['context']+',${EXTEN},'+_0x32e6ac+':'+_0x54d89b['context']+',${EXTEN},'+_0x3abefa,'exten':_0x54d89b[_0x7207('0x8')],'context':_0x54d89b[_0x7207('0x18')],'priority':_0x4e16f8[_0x7207('0xd')]+_0x2fa964,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});}_0x54d89b['priority']=_0x20250f['length']?_[_0x7207('0x3d')](_0x20250f)[_0x7207('0xd')]+0x1:_0x4e16f8[_0x7207('0xd')];_0x4e16f8[_0x7207('0xd')]=(_0x2c2c92['length']?_['last'](_0x2c2c92)[_0x7207('0xd')]:_0x54d89b[_0x7207('0xd')])+0x1;_0x4e16f8[_0x7207('0xe')]=_[_0x7207('0x3e')](_0x4e16f8[_0x7207('0xe')],_0x20250f,[_0x54d89b],_0x2c2c92);}_0x4e16f8['extensions'][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0]['type'],'app':_0x7207('0x3f'),'exten':_0x4fac00[_0x501395][0x0]['exten'],'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'priority':_0x4e16f8['priority'],'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});_0x3f5cb1[_0x7207('0x11')](_0x4fac00[_0x501395][0x0][_0x7207('0x17')]);_0x3adaea=_[_0x7207('0x3e')](_0x3adaea,_0x4e16f8[_0x7207('0xe')]);}}return _0x462a0e[_0x7207('0x40')](function(_0x1db561){return _0x462a0e[_0x7207('0x5')][_0x7207('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3f5cb1}},'transaction':_0x1db561})['then'](function(_0x2c073c){return _0x462a0e[_0x7207('0x5')]['VoiceExtension'][_0x7207('0x41')](_[_0x7207('0x42')](_0x3adaea,_0x7207('0xd')),{'transaction':_0x1db561});});});})[_0x7207('0x43')](function(_0x4ae031){console['error'](_0x4ae031);});}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 aff469b..10ccb9d 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 _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 +var _0x5905=['CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','finally','resolve','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','hasOwnProperty','data','firstName','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','into','fromQuery','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','cm_hopper_black','findAll','dialCheckDuplicateType','CmList','get','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','VoiceQueue','outbound','Lists'];(function(_0x5c96d8,_0x2bb659){var _0x4a0263=function(_0x36e0be){while(--_0x36e0be){_0x5c96d8['push'](_0x5c96d8['shift']());}};_0x4a0263(++_0x2bb659);}(_0x5905,0xea));var _0x5590=function(_0x380c2d,_0x555eb9){_0x380c2d=_0x380c2d-0x0;var _0x5a1ba2=_0x5905[_0x380c2d];return _0x5a1ba2;};'use strict';var BPromise=require(_0x5590('0x0'));var util=require(_0x5590('0x1'));var _=require(_0x5590('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x5590('0x3'));var Redis=require(_0x5590('0x4'));var db=require(_0x5590('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('api');config[_0x5590('0x6')]=_['defaults'](config[_0x5590('0x6')],{'host':_0x5590('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5590('0x8'))['register'](socket);try{if(!process[_0x5590('0x9')][0x2]||process[_0x5590('0x9')][0x2]===_0x5590('0xa')||process['argv'][0x2]==='null'){throw new Error(_0x5590('0xb'));}var FILEPATH=process[_0x5590('0x9')][0x2];if(!process[_0x5590('0x9')][0x3]||process[_0x5590('0x9')][0x3]===_0x5590('0xa')||process[_0x5590('0x9')][0x3]===_0x5590('0xc')||!process[_0x5590('0x9')][0x4]||process['argv'][0x4]===_0x5590('0xa')||process[_0x5590('0x9')][0x4]===_0x5590('0xc')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x5590('0xd')](process['argv'][0x3][_0x5590('0xe')](','),process[_0x5590('0x9')][0x4][_0x5590('0xe')](','));if(!process[_0x5590('0x9')][0x5]||process['argv'][0x5]===_0x5590('0xa')||process[_0x5590('0x9')][0x5]===_0x5590('0xc')){throw new Error(_0x5590('0xf'));}var LISTID=process[_0x5590('0x9')][0x5];var COMPANYID=process[_0x5590('0x9')][0x6]&&process[_0x5590('0x9')][0x6]!==_0x5590('0xa')&&process['argv'][0x6]!==_0x5590('0xc')?process[_0x5590('0x9')][0x6]:null;var DUPLICATES=process[_0x5590('0x9')][0x7]&&process[_0x5590('0x9')][0x7]!==_0x5590('0xa')&&process[_0x5590('0x9')][0x7]!==_0x5590('0xc')?process[_0x5590('0x9')][0x7]:null;if(!process[_0x5590('0x9')][0x8]||process['argv'][0x8]===_0x5590('0xa')||process['argv'][0x8]===_0x5590('0xc')){throw new Error(_0x5590('0x10'));}var SOCKET_TIMESTAMP=process[_0x5590('0x9')][0x8];}catch(_0x5813a8){logger[_0x5590('0x11')](_0x5813a8);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(_0x53fe82,_0x12a706,_0xa796e1,_0x101809){var _0x5c7658={'message':_0x12a706};_0x5c7658[_0x53fe82]=!![];if(_0xa796e1){_0x5c7658['contact']=_0xa796e1;}if(_0x101809){_0x5c7658['index']=_0x101809;}return _0x5c7658;}function isEmail(_0x48f284){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'](_0x48f284);}function checkRow(_0x5f4867,_0x4ab450,_0x208fea){return new BPromise(function(_0x45d39d,_0x3be8c1){if(_[_0x5590('0x12')](_0x5f4867)){return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),_0x5590('0x13'),null,_0x208fea));}if(_0x5f4867[_0x5590('0x14')]&&_0x5f4867['errors'][_0x5590('0x15')]){var _0x27a266=_[_0x5590('0x16')](_0x5f4867['errors'],'message')['join'](';');return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),_0x27a266,null,_0x208fea));}var _0x22f6dd={};for(var _0x2ee23c in FIELDS){if(FIELDS[_0x5590('0x17')](_0x2ee23c)&&FIELDS[_0x2ee23c]){_0x22f6dd[_0x2ee23c]=_0x5f4867['data'][0x0][FIELDS[_0x2ee23c]]||_0x5f4867[_0x5590('0x18')][0x0]['\ufeff'+FIELDS[_0x2ee23c]];}}if(!_0x22f6dd[_0x5590('0x19')]){return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),'firstName\x20not\x20specified!',null,_0x208fea));}if(!_0x22f6dd[_0x5590('0x1a')]){return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),'phone\x20not\x20specified!',null,_0x208fea));}if(_0x22f6dd['birthDate']){var _0x409fcf=moment(_0x22f6dd[_0x5590('0x1b')],_0x5590('0x1c'));if(!_0x409fcf[_0x5590('0x1d')]()){return _0x3be8c1(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x208fea));}}if(_0x22f6dd[_0x5590('0x1e')]){if(!isEmail(_0x22f6dd[_0x5590('0x1e')])){return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),_0x5590('0x1f'),null,_0x208fea));}}_0x22f6dd[_0x5590('0x20')]=LISTID;_0x22f6dd[_0x5590('0x21')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5590('0x15')]&&_0x4ab450){var _0x276c89={};for(var _0x46a665=0x0,_0x292fee=DUPLICATES[_0x5590('0x15')];_0x46a665<_0x292fee;_0x46a665+=0x1){_0x276c89[DUPLICATES[_0x46a665]]=_0x22f6dd[DUPLICATES[_0x46a665]];}var _0x20da7e=_[_0x5590('0x22')](_0x4ab450,_0x276c89);if(_0x20da7e){return _0x3be8c1(handleCheckRowError(_0x5590('0x23'),_0x5590('0x24'),_0x20da7e,_0x208fea));}}return db['CmContact']['create'](_0x22f6dd,{'raw':!![],'hooks':![],'fields':_[_0x5590('0x25')](_0x22f6dd)})[_0x5590('0x26')](function(_0x2f94e1){if(DUPLICATES&&DUPLICATES[_0x5590('0x15')]&&_0x4ab450){_0x4ab450['push'](_[_0x5590('0x27')](_0x22f6dd,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2f94e1['id'];return _0x45d39d();})[_0x5590('0x28')](function(_0x287c81){return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),_0x5590('0x29')+(_0x287c81['message']||JSON[_0x5590('0x2a')](_0x287c81)),null,_0x208fea));});});}function checkHopper(){function _0x9b9bc0(){return function(_0x56ad8e){logger[_0x5590('0x11')](_0x5590('0x2b'),'checkHopper',util[_0x5590('0x2c')](_0x56ad8e,{'showHidden':![],'depth':null}));};}var _0x255c95=function(_0x1fbe77,_0x4a29cf){var _0x1f203a=squel[_0x5590('0x2d')]()['into']('cm_hopper')['fromQuery']([_0x5590('0x1a'),_0x5590('0x2e'),_0x5590('0x2f'),_0x5590('0x20'),_0x4a29cf,_0x5590('0x30'),_0x5590('0x31')],squel[_0x5590('0x32')]()[_0x5590('0x33')](_0x5590('0x1a'),_0x5590('0x1a'))[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x2e'))['field']('id','ContactId')[_0x5590('0x33')](LISTID[_0x5590('0x35')](),'ListId')[_0x5590('0x33')](_0x1fbe77['id']['toString'](),_0x4a29cf)[_0x5590('0x33')](_0x5590('0x34'),'createdAt')[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x31'))[_0x5590('0x36')](_0x5590('0x37'))[_0x5590('0x38')]('deletedAt\x20IS\x20NULL')[_0x5590('0x38')]('ListId\x20=\x20?',LISTID[_0x5590('0x35')]())[_0x5590('0x38')](_0x5590('0x39'))[_0x5590('0x38')](_0x5590('0x3a'),squel['select']()[_0x5590('0x33')](_0x5590('0x1a'))[_0x5590('0x36')](_0x5590('0x3b'))['where'](_0x4a29cf+'\x20=\x20?',_0x1fbe77['id']['toString']())))[_0x5590('0x35')]();return _0x1f203a;};var _0x1c2052=function(_0x343868,_0x37345b){var _0x1de134=squel[_0x5590('0x2d')]()[_0x5590('0x3c')]('cm_hopper')[_0x5590('0x3d')]([_0x5590('0x1a'),_0x5590('0x2e'),_0x5590('0x2f'),_0x5590('0x20'),_0x37345b,'createdAt',_0x5590('0x31')],squel[_0x5590('0x32')]()['field'](_0x5590('0x1a'),_0x5590('0x1a'))[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x2e'))['field']('id',_0x5590('0x2f'))['field'](LISTID[_0x5590('0x35')](),_0x5590('0x20'))['field'](_0x343868['id'][_0x5590('0x35')](),_0x37345b)[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x30'))['field']('NOW()',_0x5590('0x31'))[_0x5590('0x36')](_0x5590('0x37'))[_0x5590('0x38')](_0x5590('0x3e'))[_0x5590('0x38')](_0x5590('0x3f'),LISTID['toString']())[_0x5590('0x38')](_0x5590('0x40'),squel['str'](hopperContacts))['where'](_0x5590('0x39'))[_0x5590('0x38')](_0x5590('0x3a'),squel[_0x5590('0x32')]()['field']('calleridnum')[_0x5590('0x36')]('cm_hopper_final')[_0x5590('0x38')](_0x37345b+'\x20=\x20?',_0x343868['id'][_0x5590('0x35')]()))[_0x5590('0x38')](_0x5590('0x3a'),squel[_0x5590('0x32')]()[_0x5590('0x33')](_0x5590('0x1a'))[_0x5590('0x36')](_0x5590('0x3b'))[_0x5590('0x38')](_0x37345b+'\x20=\x20?',_0x343868['id'][_0x5590('0x35')]())))['toString']();return _0x1de134;};function _0x4f3200(_0x3cb9e0,_0x393c55){var _0x564fd5=squel[_0x5590('0x2d')]()['into']('cm_hopper')['fromQuery']([_0x5590('0x1a'),_0x5590('0x2e'),'ContactId',_0x5590('0x20'),_0x393c55,'createdAt',_0x5590('0x31')],squel[_0x5590('0x32')]()['field'](_0x5590('0x1a'),_0x5590('0x1a'))[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x2e'))[_0x5590('0x33')]('id',_0x5590('0x2f'))['field'](LISTID[_0x5590('0x35')](),_0x5590('0x20'))[_0x5590('0x33')](_0x3cb9e0['id'][_0x5590('0x35')](),_0x393c55)[_0x5590('0x33')](_0x5590('0x34'),'createdAt')[_0x5590('0x33')]('NOW()',_0x5590('0x31'))['from'](_0x5590('0x37'))[_0x5590('0x38')]('deletedAt\x20IS\x20NULL')['where'](_0x5590('0x3f'),LISTID[_0x5590('0x35')]())['where'](_0x5590('0x40'),squel[_0x5590('0x41')](hopperContacts))[_0x5590('0x38')](_0x5590('0x39')))[_0x5590('0x35')]();return _0x564fd5;}function _0x24dfab(_0x192f9b,_0x3b706f){var _0x1fbd46=squel[_0x5590('0x2d')]()[_0x5590('0x3c')](_0x5590('0x42'))[_0x5590('0x3d')](['phone',_0x5590('0x2f'),'ListId',_0x3b706f,_0x5590('0x30'),'updatedAt'],squel[_0x5590('0x32')]()['field'](_0x5590('0x1a'),_0x5590('0x1a'))[_0x5590('0x33')]('id',_0x5590('0x2f'))[_0x5590('0x33')](LISTID[_0x5590('0x35')](),_0x5590('0x20'))['field'](_0x192f9b['id'][_0x5590('0x35')](),_0x3b706f)[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x30'))[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x31'))[_0x5590('0x36')]('cm_contacts')[_0x5590('0x38')](_0x5590('0x3e'))['where'](_0x5590('0x3f'),LISTID[_0x5590('0x35')]())[_0x5590('0x38')]('id\x20IN\x20?',squel[_0x5590('0x41')](hopperContacts))['where'](_0x5590('0x39')))[_0x5590('0x35')]();return _0x1fbd46;}return db['VoiceQueue'][_0x5590('0x43')]({'where':{'type':'outbound'},'attributes':['id',_0x5590('0x44')],'include':[{'model':db[_0x5590('0x45')],'as':'Lists','where':{'id':LISTID}}]})[_0x5590('0x26')](function(_0x5a91fa){var _0x3b8bf5=[];if(_0x5a91fa){var _0x18107a;for(var _0xe3236a=0x0,_0x514de0;_0xe3236a<_0x5a91fa[_0x5590('0x15')];_0xe3236a+=0x1){_0x514de0=_0x5a91fa[_0xe3236a][_0x5590('0x46')]({'plain':!![]});switch(_0x514de0[_0x5590('0x44')]){case _0x5590('0x47'):_0x3b8bf5[_0x5590('0x48')](db[_0x5590('0x49')][_0x5590('0x4a')](_0x1c2052(_0x514de0,_0x5590('0x4b')))[_0x5590('0x26')](function(){})[_0x5590('0x28')](_0x9b9bc0()));break;case _0x5590('0x4c'):_0x3b8bf5[_0x5590('0x48')](db[_0x5590('0x49')]['query'](_0x255c95(_0x514de0,_0x5590('0x4b')))[_0x5590('0x26')](function(){})[_0x5590('0x28')](_0x9b9bc0()));break;default:_0x3b8bf5[_0x5590('0x48')](db['sequelize'][_0x5590('0x4a')](_0x4f3200(_0x514de0,'VoiceQueueId'))[_0x5590('0x26')](function(){})[_0x5590('0x28')](_0x9b9bc0()));}}}return _0x3b8bf5;})[_0x5590('0x4d')]()[_0x5590('0x26')](function(){return db[_0x5590('0x4e')][_0x5590('0x43')]({'where':{'type':_0x5590('0x4f')},'attributes':['id'],'include':[{'model':db[_0x5590('0x45')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x552d7c){var _0x3f2ea3=[];if(_0x552d7c){var _0x4d61bd;for(var _0x5afa18=0x0,_0x4c8035;_0x5afa18<_0x552d7c[_0x5590('0x15')];_0x5afa18+=0x1){_0x4c8035=_0x552d7c[_0x5afa18]['get']({'plain':!![]});_0x3f2ea3[_0x5590('0x48')](db[_0x5590('0x49')][_0x5590('0x4a')](_0x24dfab(_0x4c8035,'VoiceQueueId'))[_0x5590('0x26')](function(){})['catch'](_0x9b9bc0()));}}return _0x3f2ea3;})[_0x5590('0x4d')]();})[_0x5590('0x26')](function(){return db['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x5590('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x258a97){var _0x23d303=[];if(_0x258a97){for(var _0x39a434=0x0,_0x2dd991;_0x39a434<_0x258a97[_0x5590('0x15')];_0x39a434+=0x1){_0x2dd991=_0x258a97[_0x39a434][_0x5590('0x46')]({'plain':!![]});switch(_0x2dd991['dialCheckDuplicateType']){case'always':_0x23d303[_0x5590('0x48')](db[_0x5590('0x49')][_0x5590('0x4a')](_0x1c2052(_0x2dd991,_0x5590('0x51')))[_0x5590('0x26')](function(){})[_0x5590('0x28')](_0x9b9bc0()));break;case _0x5590('0x4c'):_0x23d303[_0x5590('0x48')](db['sequelize'][_0x5590('0x4a')](_0x255c95(_0x2dd991,_0x5590('0x51')))['then'](function(){})['catch'](_0x9b9bc0()));break;default:_0x23d303[_0x5590('0x48')](db[_0x5590('0x49')][_0x5590('0x4a')](_0x4f3200(_0x2dd991,_0x5590('0x51')))['then'](function(){})[_0x5590('0x28')](_0x9b9bc0()));}}}return _0x23d303;})['all']();})[_0x5590('0x26')](function(){return db[_0x5590('0x52')][_0x5590('0x43')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x5590('0x53'),'where':{'id':LISTID}}]})[_0x5590('0x26')](function(_0x3b279c){var _0x5caa26=[];if(_0x3b279c){for(var _0x43bec1=0x0,_0x596ed7;_0x43bec1<_0x3b279c[_0x5590('0x15')];_0x43bec1+=0x1){_0x596ed7=_0x3b279c[_0x43bec1][_0x5590('0x46')]({'plain':!![]});_0x5caa26['push'](db[_0x5590('0x49')][_0x5590('0x4a')](_0x24dfab(_0x596ed7,_0x5590('0x51')))['then'](function(){})[_0x5590('0x28')](_0x9b9bc0()));}}return _0x5caa26;})[_0x5590('0x4d')]();})['catch'](function(_0x34bb0c){logger[_0x5590('0x11')](_0x5590('0x54'),_0x5590('0x55'),_0x34bb0c[_0x5590('0x56')]);});}var processPromises=function(_0x56e1d8){return BPromise['all'](promises)[_0x5590('0x26')](function(_0x27a29b){})[_0x5590('0x28')](function(_0x3bb643){logger[_0x5590('0x11')](_0x5590('0x57'),JSON['stringify'](_0x3bb643));})[_0x5590('0x58')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x56e1d8){return _0x56e1d8['resume']();}});};var endCsv=function(){return BPromise[_0x5590('0x59')]()[_0x5590('0x26')](function(){if(hopperContacts){return checkHopper();}})[_0x5590('0x26')](function(){socket[_0x5590('0x5a')](_0x5590('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5590('0x5c')](FILEPATH);}catch(_0x52076b){logger[_0x5590('0x11')](_0x5590('0x5d'),JSON[_0x5590('0x2a')](_0x52076b));}finally{process[_0x5590('0x5e')](0x0);}});};process['on'](_0x5590('0x5f'),function(){logger[_0x5590('0x60')](_0x5590('0x61'));endCsv();});function main(){return BPromise[_0x5590('0x59')]()[_0x5590('0x26')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x5590('0x62')][_0x5590('0x43')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x5590('0x26')](function(_0x1b4b65){var _0x316de4=fs[_0x5590('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5590('0x64')](_0x316de4,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5f3b34,_0x179594){total+=0x1;var _0x3fe9d6=total;promises[_0x5590('0x48')](checkRow(_0x5f3b34,_0x1b4b65,_0x3fe9d6)[_0x5590('0x26')](function(){success+=0x1;})[_0x5590('0x28')](function(_0x11cfc9){if(_0x11cfc9[_0x5590('0x11')]){errors+=0x1;delete _0x11cfc9[_0x5590('0x11')];}else if(_0x11cfc9['duplicate']){duplicates+=0x1;delete _0x11cfc9[_0x5590('0x23')];}rows[_0x5590('0x48')](_0x11cfc9);}));if(total%0xc8===0x0){_0x179594[_0x5590('0x65')]();return processPromises(_0x179594);}},'complete':function(){return processPromises()['then'](function(){logger[_0x5590('0x60')](_0x5590('0x66'));endCsv();});},'error':function(_0x101f4e,_0x56e643){logger[_0x5590('0x60')](_0x5590('0x67'),JSON[_0x5590('0x2a')](_0x101f4e));endCsv();}});})[_0x5590('0x28')](function(_0x1b37ea){logger[_0x5590('0x11')](_0x5590('0x68'),JSON[_0x5590('0x2a')](_0x1b37ea));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index f06489c..2487245 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 _0x23f1=['body\x20id\x20mandatory','uncaughtException','path','lodash','util','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','findOne','CmContactHasItem','update','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','join','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.id','cm_hopper_black','fields','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','into','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','toString','concat','keys','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','min_id','group','error','message','exit','errors','code','info','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','query','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','utcOffset','set','offset','dialTimezone','main','stringify','send','start','binding','clone','root','includes','ContactItemType','name','_description','header','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','find','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','campaigns_','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','CompanyId','contactId','contactTypeId','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\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','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','from','.id\x20=\x20','where','join','CmContact','findAll','length','push','all','split','then','isNil','filter','CmContactHasItem','findOne','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','updatedAt','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc98e,0x1ec));var _0xec98=function(_0x56c146,_0x1abb0e){_0x56c146=_0x56c146-0x0;var _0x17c39c=_0xc98e[_0x56c146];return _0x17c39c;};'use strict';var fs=require('fs');var path=require(_0xec98('0x0'));var _=require(_0xec98('0x1'));var Papa=require(_0xec98('0x2'));var util=require(_0xec98('0x3'));var BPromise=require('bluebird');var moment=require(_0xec98('0x4'));var squel=require(_0xec98('0x5'));var Redis=require(_0xec98('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xec98('0x7'));var shared=require(_0xec98('0x8'));var logger=require(_0xec98('0x9'))(_0xec98('0xa'));config[_0xec98('0xb')]=_[_0xec98('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xec98('0xd'))(new Redis(config[_0xec98('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xec98('0xe')](_0xec98('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xec98('0xe')](_0xec98('0xf'));function isEmail(_0x33ecf2){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'](_0x33ecf2);}function selectNotIn(_0xa534ec,_0x2d44a7,_0x5825b6,_0x4fd021,_0x316217){return squel['select']()[_0xec98('0x10')](_0xec98('0x11'))[_0xec98('0x12')](_0x4fd021)['join'](_0x2d44a7,null,_0x2d44a7+_0xec98('0x13')+_0x4fd021+'.'+_0x5825b6)[_0xec98('0x14')](_0x4fd021+'.'+_0x5825b6+'\x20=\x20'+_0xa534ec+'.'+_0x5825b6)['where'](_0x2d44a7+'.dialCheckDuplicateType\x20IN\x20('+_0x316217[_0xec98('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x58ba8b,_0x2191c4){promisesAdditionalPhones=[];return db[_0xec98('0x16')][_0xec98('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x110400){if(_0x110400!==null){var _0x234598=[];for(var _0x5d8308=0x0;_0x5d8308<_0x110400[_0xec98('0x18')];_0x5d8308++){var _0x469862=_0x110400[_0x5d8308];_0x234598[_0xec98('0x19')](insertAdditionalPhones(_0x469862));}}Promise[_0xec98('0x1a')](_0x234598)['then'](function(){_0x58ba8b({'val':0x1});});});});}function insertAdditionalPhones(_0x162f29){return new Promise(function(_0x155ebb,_0x35b4f4){var _0x398ce0=_0x162f29['AdditionalPhones'];var _0x4411a9=_0x398ce0[_0xec98('0x1b')](';');var _0x1896b6=[];orderBy=0x0;for(var _0x577201=0x0;_0x577201<_0x4411a9[_0xec98('0x18')];_0x577201++){_0x1896b6[_0xec98('0x19')](splitAdditionalPhone(_0x162f29['id'],_0x4411a9[_0x577201]));}Promise[_0xec98('0x1a')](_0x1896b6)[_0xec98('0x1c')](function(){_0x155ebb({'val':_0x4411a9[_0xec98('0x18')]});});});}function splitAdditionalPhone(_0x576fa1,_0x39d305){return new Promise(function(_0x11774a,_0x12800c){var _0x53621b=_0x39d305[_0xec98('0x1b')](':');var _0x32b753=_0x53621b[0x0];var _0x8db2f8=_0x53621b[0x1];if(!_[_0xec98('0x1d')](_0x8db2f8)){var _0x5a7365=_0x8db2f8[_0xec98('0x1b')]('|');var _0x4aba4a=[];for(var _0x1d5656=0x0;_0x1d5656<_0x5a7365[_0xec98('0x18')];_0x1d5656++){if(_0x5a7365[_0x1d5656]!==''){var _0x50582a=_[_0xec98('0x1e')](promisesAdditionalPhones,{'contactId':_0x576fa1,'phone':_0x5a7365[_0x1d5656]});if(_0x50582a[_0xec98('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0xec98('0x19')]({'contactId':_0x576fa1,'contactTypeId':_0x32b753,'phone':_0x5a7365[_0x1d5656],'orderBy':orderBy});}}}_0x11774a({'ok':0x1});}else _0x11774a({'res':0x0});});}function createAdditionalPhone(_0xdaec97,_0x565499,_0x38f2fe,_0x522360){var _0xc9393b='';var _0x13eacc='';var _0x2b0f23=_0x38f2fe[_0xec98('0x1b')]('§');_0xc9393b=_0x2b0f23[0x0];if(_0x2b0f23[_0xec98('0x18')]==0x2)_0x13eacc=_0x2b0f23[0x1];return new Promise(function(_0x1a0ec2,_0x36517f){return db[_0xec98('0x1f')][_0xec98('0x20')]({'where':{'CmContactId':_0xdaec97,'item':_0xc9393b}})['then'](function(_0x123209){if(_0x123209){return db['CmContactHasItem']['update']({'ItemTypeId':_0x565499,'description':_0x13eacc,'OrderBy':_0x522360},{'where':{'CmContactId':_0xdaec97,'item':_0xc9393b}})[_0xec98('0x1c')](function(_0x270568){_0x1a0ec2({'res':_0xec98('0x21')});});}else{return db[_0xec98('0x1f')][_0xec98('0x22')]({'CmContactId':_0xdaec97,'item':_0xc9393b,'description':_0x13eacc,'ItemTypeId':_0x565499,'OrderBy':_0x522360,'ItemClass':_0xec98('0x23')})[_0xec98('0x1c')](function(_0x3d3879){_0x1a0ec2({'res':_0xec98('0x24')});});}});});}function insertCmHopper(_0x4e9e17,_0x24ea90,_0x59f759,_0x493407,_0x339328){var _0x2bdbf8=[_0xec98('0x25'),_0xec98('0x26'),'cm_contacts.id',_0xec98('0x27'),_0x24ea90+'.'+_0x493407,_0xec98('0x28'),_0xec98('0x29'),'cm_contacts.priority',_0xec98('0x2a'),'\x22'+_0x339328+'\x22'];return squel[_0xec98('0x2b')]()['into'](_0xec98('0x2c'))[_0xec98('0x2d')](['phone','scheduledat',_0xec98('0x2e'),_0xec98('0x2f'),_0x493407,'createdAt',_0xec98('0x30'),'priority',_0xec98('0x31'),_0xec98('0x32')],squel['select']()[_0xec98('0x33')](_0x2bdbf8)['from'](_0x24ea90)[_0xec98('0x15')]('cm_contacts',null,_0xec98('0x34')+_0x24ea90+_0xec98('0x35'))[_0xec98('0x15')](_0x59f759,null,_0x59f759+_0xec98('0x13')+_0x24ea90+'.'+_0x493407)[_0xec98('0x14')](_0x24ea90+_0xec98('0x36'),_0x4e9e17)[_0xec98('0x14')](_0xec98('0x37'),NOW)[_0xec98('0x14')](_0xec98('0x38'),selectNotIn(_0x24ea90,_0x59f759,_0x493407,_0xec98('0x2c'),[_0xec98('0x39'),_0xec98('0x3a')]))[_0xec98('0x14')](_0xec98('0x38'),selectNotIn(_0x24ea90,_0x59f759,_0x493407,_0xec98('0x2c'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x1542d7,_0x40be47,_0x5175fa,_0x51ad26){var _0x5f188e=[_0xec98('0x25'),'cm_contacts.id','cm_contacts.ListId',_0x40be47+'.'+_0x51ad26,_0xec98('0x28'),_0xec98('0x29')];return squel['insert']()[_0xec98('0x3b')]('cm_hopper_black')[_0xec98('0x2d')](['phone',_0xec98('0x2e'),_0xec98('0x2f'),_0x51ad26,_0xec98('0x3c'),_0xec98('0x30')],squel['select']()[_0xec98('0x33')](_0x5f188e)[_0xec98('0x12')](_0x40be47)[_0xec98('0x15')](_0xec98('0x3d'),null,_0xec98('0x34')+_0x40be47+_0xec98('0x35'))[_0xec98('0x15')](_0x5175fa,null,_0x5175fa+_0xec98('0x13')+_0x40be47+'.'+_0x51ad26)[_0xec98('0x14')](_0x40be47+_0xec98('0x36'),_0x1542d7)[_0xec98('0x14')](_0xec98('0x37'),NOW)[_0xec98('0x14')](_0xec98('0x38'),squel[_0xec98('0x3e')]()[_0xec98('0x10')](_0xec98('0x11'))[_0xec98('0x12')](_0xec98('0x3f'))['where'](_0xec98('0x40'),_0x1542d7)[_0xec98('0x14')](_0x51ad26+_0xec98('0x41')+_0x40be47+'.'+_0x51ad26)))[_0xec98('0x42')]();}function insertTzCmHopper(_0x5af08a,_0x1af8b8,_0x25cc15,_0xe3f920,_0x4dde3f,_0x43a64a){var _0x4a067d=[_0xec98('0x25'),_0xec98('0x43')+_0x43a64a+_0xec98('0x44'),_0xec98('0x45'),_0xec98('0x27'),_0x1af8b8+'.'+_0xe3f920,_0xec98('0x28'),_0xec98('0x29'),_0xec98('0x46'),_0xec98('0x2a'),'\x22'+_0x4dde3f+'\x22'];var _0x30f940=squel['insert']()['into']('cm_hopper')[_0xec98('0x2d')]([_0xec98('0x11'),_0xec98('0x47'),'ContactId',_0xec98('0x2f'),_0xe3f920,'createdAt','updatedAt','priority',_0xec98('0x31'),'recallme'],squel['select']()['fields'](_0x4a067d)[_0xec98('0x12')](_0x1af8b8)['join'](_0xec98('0x3d'),null,'cm_contacts.ListId\x20=\x20'+_0x1af8b8+_0xec98('0x35'))[_0xec98('0x15')](_0x25cc15,null,_0x25cc15+'.id\x20=\x20'+_0x1af8b8+'.'+_0xe3f920)[_0xec98('0x15')](_0x43a64a,null,_0x43a64a+'.id\x20=\x20'+_0x1af8b8+'.'+_0xe3f920)[_0xec98('0x14')](_0x1af8b8+_0xec98('0x36'),_0x5af08a)[_0xec98('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xec98('0x14')](_0xec98('0x38'),selectNotIn(_0x1af8b8,_0x25cc15,_0xe3f920,_0xec98('0x2c'),['\x22always\x22',_0xec98('0x3a')]))['where'](_0xec98('0x38'),selectNotIn(_0x1af8b8,_0x25cc15,_0xe3f920,_0xec98('0x2c'),[_0xec98('0x39')])))[_0xec98('0x42')]();return _0x30f940;}function insertTzCmHopperBlack(_0x3ca11d,_0x75bab8,_0x2a95ea,_0x2b3391){var _0x3eb17f=[_0xec98('0x25'),_0xec98('0x45'),_0xec98('0x27'),_0x75bab8+'.'+_0x2b3391,_0xec98('0x28'),_0xec98('0x29')];return squel['insert']()[_0xec98('0x3b')](_0xec98('0x3f'))['fromQuery']([_0xec98('0x11'),_0xec98('0x2e'),_0xec98('0x2f'),_0x2b3391,'createdAt',_0xec98('0x30')],squel[_0xec98('0x3e')]()[_0xec98('0x33')](_0x3eb17f)[_0xec98('0x12')](_0x75bab8)[_0xec98('0x15')](_0xec98('0x3d'),null,_0xec98('0x34')+_0x75bab8+_0xec98('0x35'))[_0xec98('0x15')](_0x2a95ea,null,_0x2a95ea+_0xec98('0x13')+_0x75bab8+'.'+_0x2b3391)['where'](_0x75bab8+'.CmListId\x20=\x20?',_0x3ca11d)[_0xec98('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xec98('0x38'),squel[_0xec98('0x3e')]()[_0xec98('0x10')]('phone')['from']('cm_hopper_black')[_0xec98('0x14')](_0xec98('0x40'),_0x3ca11d)['where'](_0x2b3391+_0xec98('0x41')+_0x75bab8+'.'+_0x2b3391)))[_0xec98('0x42')]();}function insertCmHopperAdditionalPhones(_0x4d198f){var _0x528d5f=[_0xec98('0x48'),_0xec98('0x49'),'cm_contact_has_items.OrderBy',_0xec98('0x4a'),_0xec98('0x4b')];return squel['insert']()[_0xec98('0x3b')](_0xec98('0x4c'))[_0xec98('0x2d')]([_0xec98('0x4d'),_0xec98('0x11'),'OrderBy','createdAt',_0xec98('0x30')],squel[_0xec98('0x3e')]()['fields'](_0x528d5f)[_0xec98('0x12')]('cm_hopper')[_0xec98('0x15')](_0xec98('0x3d'),null,_0xec98('0x4e'))[_0xec98('0x15')](_0xec98('0x4f'),null,_0xec98('0x50'))[_0xec98('0x14')](_0xec98('0x51'),_0x4d198f)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0xec98('0x42')]();}function insertCmContact(_0x18c793,_0x3617b3,_0x4d86e7,_0x2f46d4){var _0x34b070=_[_0xec98('0x52')](_[_0xec98('0x53')](_0x2f46d4),[_0xec98('0x2f'),'CompanyId',_0xec98('0x3c'),_0xec98('0x30'),_0xec98('0x54')]);return squel[_0xec98('0x2b')]()[_0xec98('0x3b')](_0xec98('0x3d'))[_0xec98('0x2d')](_0x34b070,squel[_0xec98('0x3e')]()['fields'](_0x34b070)[_0xec98('0x12')](_0x3617b3)['where']('('+_0x4d86e7[_0xec98('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0xec98('0x3e')]()[_0xec98('0x33')](_0x4d86e7)['from'](_0xec98('0x3d'))['where'](_0xec98('0x40'),_0x18c793)[_0xec98('0x14')](_0xec98('0x55')))[_0xec98('0x14')](_0xec98('0x56'),squel[_0xec98('0x3e')]()[_0xec98('0x10')](_0xec98('0x57'),_0xec98('0x58'))[_0xec98('0x12')](_0x3617b3)[_0xec98('0x59')](_0x4d86e7[_0xec98('0x15')](','))))[_0xec98('0x42')]();}function handleStop(){logger[_0xec98('0x5a')](_0xec98('0x5b'));stopped=!![];}function handleUncaughtException(_0x4c9a30){logger[_0xec98('0x5c')](_0x4c9a30[_0xec98('0x5d')]);process[_0xec98('0x5e')](0x1);}function handleError(_0x1e9be9,_0x193770){stats['errors']['push']({'name':_0x193770[_0xec98('0x5f')],'message':_0x193770['message'],'row':_0x1e9be9});}function handleQuery(_0x54ee3a){logger[_0xec98('0x5a')](_0x54ee3a);return db[_0xec98('0x60')][_0xec98('0x61')](_0x54ee3a)[_0xec98('0x62')](function(_0x5e1b10){results['push'](_0x5e1b10);})['catch'](function(_0xf65fd5){logger[_0xec98('0x5c')](_0xf65fd5['message']);});}function updateTzCampaigns(_0x35a3f6){return new Promise(function(_0x5d193d,_0x11513f){var _0xd87835=squel[_0xec98('0x3e')]()[_0xec98('0x33')]([_0xec98('0x63'),_0xec98('0x64')])[_0xec98('0x12')]('campaigns')[_0xec98('0x15')]('campaigns_has_cm_lists',null,_0xec98('0x65'))[_0xec98('0x14')](_0xec98('0x66')+_0x35a3f6);db['sequelize']['query'](_0xd87835[_0xec98('0x42')]())[_0xec98('0x62')](function(_0x1afd69){var _0x161125=[];for(var _0x17b3ca=0x0;_0x17b3ca<_0x1afd69[_0xec98('0x18')];_0x17b3ca++){_0x161125[_0xec98('0x19')](getTimezoneData(_0x1afd69[_0x17b3ca],tmp_campaigns));}BPromise[_0xec98('0x1a')](_0x161125)[_0xec98('0x1c')](function(){_0x5d193d({'val':0x1});});})[_0xec98('0x67')](function(_0x341bfd){logger[_0xec98('0x5c')](_0x341bfd[_0xec98('0x5d')]);_0x5d193d({'val':0x0});});});}function updateTzVoiceQueues(_0x51babe){return new Promise(function(_0x4781f8,_0x376f4a){var _0xed310c=squel[_0xec98('0x3e')]()[_0xec98('0x33')](['voice_queues.id',_0xec98('0x68')])[_0xec98('0x12')](_0xec98('0x69'))[_0xec98('0x15')]('voice_queues_has_cm_lists',null,_0xec98('0x6a'))[_0xec98('0x14')](_0xec98('0x6b')+_0x51babe);db[_0xec98('0x60')][_0xec98('0x61')](_0xed310c[_0xec98('0x42')]())[_0xec98('0x62')](function(_0x31146e){var _0x2ec50b=[];for(var _0x15dbd7=0x0;_0x15dbd7<_0x31146e[_0xec98('0x18')];_0x15dbd7++){_0x2ec50b['push'](getTimezoneData(_0x31146e[_0x15dbd7],tmp_voice_queues));}BPromise['all'](_0x2ec50b)[_0xec98('0x1c')](function(){_0x4781f8({'val':0x1});});})[_0xec98('0x67')](function(_0x123a35){logger[_0xec98('0x5c')](_0x123a35[_0xec98('0x5d')]);_0x4781f8({'val':0x0});});});}function getTimezoneData(_0x4d2020,_0x45ba07){return new Promise(function(_0x19d8c6,_0x1cca13){var _0x1ed9d0=shared[_0xec98('0x6c')];var _0x4748f2=_0x1ed9d0[_0x4d2020['dialTimezone']];if(_[_0xec98('0x1d')](_0x4748f2)){_0x19d8c6({'ret':0x1});}else{var _0x8f358a=_0x4748f2['utcOffset'];var _0x26a675=squel[_0xec98('0x2b')]()[_0xec98('0x3b')](_0x45ba07)[_0xec98('0x6d')]('id',_0x4d2020['id'])[_0xec98('0x6d')](_0xec98('0x6e'),_0x8f358a)[_0xec98('0x6d')](_0xec98('0x6f'),_0x4d2020[_0xec98('0x6f')])[_0xec98('0x42')]();return db[_0xec98('0x60')][_0xec98('0x61')](_0x26a675)[_0xec98('0x62')](function(_0x570d05){_0x19d8c6({'ret':0x1});})[_0xec98('0x67')](function(_0x202d8a){logger[_0xec98('0x5c')](_0x202d8a[_0xec98('0x5d')]);_0x1cca13({'ret':0x1});});}});}function handleTZQuery(_0xb5f1d3){logger[_0xec98('0x5a')](_0xb5f1d3);return db[_0xec98('0x60')]['query'](_0xb5f1d3)[_0xec98('0x62')](function(_0x450c36){})[_0xec98('0x67')](function(_0x511809){logger[_0xec98('0x5c')](_0x511809['message']);});}function main(_0x15221e,_0x2c4488,_0x3be915,_0x506bd9){logger[_0xec98('0x5a')](_0xec98('0x70'),_0x15221e,JSON[_0xec98('0x71')](_0x2c4488));process[_0xec98('0x72')](_0xec98('0x73'));var _0x332b43=_0x2c4488['binding'];var _0x4d4d30=_[_0xec98('0x74')](_0x332b43);var _0x353b6d=_0x2c4488[_0xec98('0x75')];var _0x2c14a5=path[_0xec98('0x15')](config[_0xec98('0x76')],_0xec98('0x77'),_0x353b6d+_0xec98('0x78'));hasTZ=_['keys'](_0x332b43)[_0xec98('0x79')](_0xec98('0x6f'));var _0x5cc9d0=_[_0xec98('0x53')](_0x332b43)['join']();logger['info']('header',_0x5cc9d0);db[_0xec98('0x7a')]['findAll']({'raw':!![],'attributes':['id',_0xec98('0x7b')]})['then'](function(_0x21dac5){for(var _0x5e18f5=0x0;_0x5e18f5<_0x21dac5['length'];_0x5e18f5++){if(_0x21dac5[_0x5e18f5][_0xec98('0x7b')]in _0x332b43){contactItemTypes['push'](_0x21dac5[_0x5e18f5]);delete _0x4d4d30[_0x21dac5[_0x5e18f5]['name']];hasAdditionalPhones=!![];}for(var _0x33484d in _0x332b43){if(_0x21dac5[_0x5e18f5][_0xec98('0x7b')]+_0xec98('0x7c')===_0x33484d){phoneDescriptions[_0xec98('0x19')]({'itemTypeId':_0x21dac5[_0x5e18f5]['id'],'description':_0x33484d});delete _0x4d4d30[_0x33484d];}}}if(hasAdditionalPhones)_0x4d4d30[_0xec98('0x7d')]='';var _0x59cada=_[_0xec98('0x53')](_0x4d4d30)[_0xec98('0x15')]();logger['info']('header',_0x59cada);fs['writeFileSync'](_0x2c14a5,_0x59cada+'\x0a');Papa['parse'](fs['createReadStream'](_0x15221e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x54cd6a,_0x2e3a9d){try{for(var _0x563278=0x0,_0x335cfa=[];_0x563278<_0x54cd6a[_0xec98('0x7e')][_0xec98('0x18')];_0x563278++){stats[_0xec98('0x7f')]+=0x1;if(_0x54cd6a[_0xec98('0x80')][_0x563278]){handleError(_0x54cd6a[_0xec98('0x7e')][_0x563278],_0x54cd6a[_0xec98('0x80')][_0x563278]);}else{var _0xe104ab=[];var _0x21a51d=[];var _0x5f0b89={};for(var _0x98ab3c in _0x332b43){let _0x9fee81=contactItemTypes['find'](_0x224aeb=>_0x224aeb[_0xec98('0x7b')]===_0x98ab3c);let _0x5f61c6=contactItemTypes[_0xec98('0x81')](_0x5b51c4=>_0x5b51c4[_0xec98('0x7b')]+_0xec98('0x7c')===_0x98ab3c);if(_['isNil'](_0x9fee81)&&_['isNil'](_0x5f61c6)){if(_0x332b43[_0xec98('0x82')](_0x98ab3c)){if(_0x54cd6a['data'][_0x563278][_0x332b43[_0x98ab3c]]){var _0x317d96=_[_0xec98('0x83')](_0x54cd6a['data'][_0x563278][_0x332b43[_0x98ab3c]][_0xec98('0x84')](/"/g,'\x27'));switch(_0x98ab3c){case _0xec98('0x47'):var _0x1ef43a=moment(_0x317d96,_0xec98('0xf'),!![]);if(_0x1ef43a[_0xec98('0x85')]()){_0x335cfa[_0xec98('0x19')]('\x22'+_0x317d96+'\x22');}else{_0xe104ab['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xec98('0x86'):var _0x2a2385=parseInt(_0x317d96);_0x317d96=_['isNaN'](_0x2a2385)||_0x2a2385<0x0||_0x2a2385>0x4?_0x506bd9?0x3:0x2:_0x2a2385;_0x335cfa['push']('\x22'+_0x317d96+'\x22');break;case _0xec98('0x31'):var _0x14c4dd=parseInt(_0x317d96);if(_[_0xec98('0x87')](_0x14c4dd)&&_[_0xec98('0x79')](_0x3be915,_0x14c4dd)){_0x335cfa[_0xec98('0x19')]('\x22'+_0x14c4dd+'\x22');}else{_0xe104ab['push'](_0xec98('0x88'));}break;case _0xec98('0x89'):if(isEmail(_0x317d96)){_0x335cfa[_0xec98('0x19')]('\x22'+_0x317d96+'\x22');}else{_0xe104ab[_0xec98('0x19')](_0xec98('0x8a'));}break;case'dateOfBirth':var _0x55eb62=moment(_0x317d96,_0xec98('0x8b'),!![]);if(_0x55eb62[_0xec98('0x85')]()){_0x335cfa['push']('\x22'+_0x317d96+'\x22');}else{_0xe104ab['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xec98('0x6f'):var _0x42412b=shared[_0xec98('0x6c')];var _0x59ec2d=_0x42412b[_0x317d96];if(!_[_0xec98('0x1d')](_0x59ec2d)){var _0x36e6a4=_0x59ec2d[_0xec98('0x8c')];_0x335cfa[_0xec98('0x19')]('\x22'+_0x317d96+'\x22');_0x335cfa[_0xec98('0x19')]('\x22'+_0x36e6a4+'\x22');}break;default:_0x335cfa[_0xec98('0x19')]('\x22'+_0x317d96+'\x22');}}else{switch(_0x98ab3c){case _0xec98('0x8d'):case _0xec98('0x11'):_0xe104ab['push'](_0x98ab3c+'\x20not\x20specified');break;default:_0x335cfa[_0xec98('0x19')]('\x22\x22');}}}}else{var _0x2c32c6='';if(!_[_0xec98('0x1d')](_0x9fee81)){if(!_0x5f0b89[_0xec98('0x82')](_0x9fee81['id'])){if(!_['isNil'](_0x54cd6a['data'][_0x563278][_0x332b43[_0x98ab3c]])){var _0x317d96=_[_0xec98('0x83')](_0x54cd6a['data'][_0x563278][_0x332b43[_0x98ab3c]][_0xec98('0x84')](/"/g,'\x27'));var _0x5edd6e=phoneDescriptions[_0xec98('0x81')](_0x547080=>_0x547080[_0xec98('0x8e')]===_0x9fee81['id']);if(!_[_0xec98('0x1d')](_0x5edd6e)){var _0x16d04e=_[_0xec98('0x83')](_0x54cd6a[_0xec98('0x7e')][_0x563278][_0x332b43[_0x5edd6e[_0xec98('0x8f')]]][_0xec98('0x84')](/"/g,'\x27'));if(!_[_0xec98('0x1d')](_0x16d04e))_0x317d96=_0x317d96+'§'+_0x16d04e;}if(_0x2c32c6=='')_0x2c32c6=_0x317d96;else _0x2c32c6+='|'+_0x317d96;}_0x21a51d['push'](_0x9fee81['id']+':'+_0x2c32c6);_0x5f0b89[_0x9fee81['id']]=0x1;}}}}if(hasAdditionalPhones){_0x335cfa[_0xec98('0x19')]('\x22'+_0x21a51d[_0xec98('0x15')](';')+'\x22');}if(_0xe104ab[_0xec98('0x18')]){handleError(_0x54cd6a[_0xec98('0x7e')][_0x563278],{'code':_0xec98('0x90'),'message':_0xe104ab['join']()});}else{fs['appendFileSync'](_0x2c14a5,_0x335cfa['join']()+'\x0a');}_0x335cfa=[];}if(!(stats[_0xec98('0x7f')]%0xc8)){socket[_0xec98('0x91')](_0xec98('0x92')+_0x353b6d,stats);stats['errors']=[];}}if(stopped){logger[_0xec98('0x5a')](_0xec98('0x93'));_0x2e3a9d['abort']();}}catch(_0x10ada0){handleError(_0x54cd6a['data'][_0x563278],{'code':_0xec98('0x94'),'message':_0x10ada0['message']});logger[_0xec98('0x5c')]('step',_0x10ada0[_0xec98('0x5d')]);}},'complete':function(){try{var _0x4c28b6=[];var _0x2eead5=[];var _0x1b26ab=_0xec98('0x3d');if(_0x2c4488[_0xec98('0x95')]&&_0x2c4488[_0xec98('0x95')][_0xec98('0x18')]){_0x1b26ab=_0xec98('0x96')+_0x353b6d;_0x4c28b6['push'](_0xec98('0x97')+_0x1b26ab+_0xec98('0x98'));}tmp_campaigns=_0xec98('0x99')+_0x353b6d;tmp_voice_queues=_0xec98('0x9a')+_0x353b6d;_0x2eead5[_0xec98('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x2eead5[_0xec98('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xec98('0x9b'));BPromise['each'](_0x2eead5,handleTZQuery)['then'](function(_0x26bcf5){updateTzCampaigns(_0x2c4488['ListId'])[_0xec98('0x1c')](function(_0x5ad5fd){updateTzVoiceQueues(_0x2c4488['ListId'])[_0xec98('0x1c')](function(_0x3bef73){if(hasTZ)_0x59cada=_0x59cada[_0xec98('0x84')]('dialTimezone','dialTimezone,utcOffset');var _0x5346e7=util[_0xec98('0xe')](_0xec98('0x9c'),_0x2c14a5,_0x1b26ab,_0x59cada,_0x2c4488[_0xec98('0x2f')],_0x2c4488['CompanyId']||null,NOW,NOW);if(_[_0xec98('0x1d')](_0x332b43[_0xec98('0x47')])){_0x5346e7+=',\x20scheduledAt\x20=\x20NOW()';}_0x4c28b6[_0xec98('0x19')](_0x5346e7);if(_0x2c4488[_0xec98('0x95')]&&_0x2c4488[_0xec98('0x95')][_0xec98('0x18')]){_0x4c28b6[_0xec98('0x19')](insertCmContact(_0x2c4488[_0xec98('0x2f')],_0x1b26ab,_0x2c4488[_0xec98('0x95')],_0x332b43));_0x4c28b6['push'](_0xec98('0x9d')+_0x1b26ab+';');}BPromise[_0xec98('0x9e')](_0x4c28b6,handleQuery)[_0xec98('0x1c')](function(_0x2b8636){BPromise[_0xec98('0x1a')]([handleAdditionalPhones()])[_0xec98('0x1c')](function(){_0x4c28b6=[];for(var _0x9db5e1=0x0;_0x9db5e1_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 +var _0xc7da=['cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','code','spread','main','stringify','send','start','binding','clone','socket_timestamp','root','.csv','body','findAll','name','_description','header','writeFileSync','parse','rows','errors','find','hasOwnProperty','data','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','finish','affectedRows','unlink','catch','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','sequelize','query','select\x20*\x20from\x20','length','isNil','push','all','then','error','message','AdditionalPhones','split','CmContactHasItem','findOne','updated','create','PHONE','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','ListId','createdAt','UserId','recallme','fields','from','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','toString','into','cm_hopper_black','updatedAt','cm_contacts','.CmListId','.CmListId\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId'];(function(_0x5112f1,_0x8ecb42){var _0x449174=function(_0x1f74a8){while(--_0x1f74a8){_0x5112f1['push'](_0x5112f1['shift']());}};_0x449174(++_0x8ecb42);}(_0xc7da,0xf2));var _0xac7d=function(_0x269f94,_0x5f50b3){_0x269f94=_0x269f94-0x0;var _0x537a59=_0xc7da[_0x269f94];return _0x537a59;};'use strict';var fs=require('fs');var path=require(_0xac7d('0x0'));var _=require(_0xac7d('0x1'));var Papa=require(_0xac7d('0x2'));var util=require('util');var BPromise=require(_0xac7d('0x3'));var moment=require(_0xac7d('0x4'));var squel=require('squel');var Redis=require(_0xac7d('0x5'));var db=require(_0xac7d('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xac7d('0x7'))(_0xac7d('0x8'));config[_0xac7d('0x9')]=_[_0xac7d('0xa')](config[_0xac7d('0x9')],{'host':_0xac7d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac7d('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xac7d('0xc')](_0xac7d('0xd'));var tempTableName=_0xac7d('0xe')+moment()[_0xac7d('0xc')](_0xac7d('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xe8dfe6){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'](_0xe8dfe6);}function selectNotIn(_0x276778,_0x2fd75b,_0x3eaee6,_0x5a53de,_0x238069){return squel[_0xac7d('0x10')]()[_0xac7d('0x11')](_0xac7d('0x12'))['from'](_0x5a53de)[_0xac7d('0x13')](_0x2fd75b,null,_0x2fd75b+_0xac7d('0x14')+_0x5a53de+'.'+_0x3eaee6)[_0xac7d('0x15')](_0x5a53de+'.'+_0x3eaee6+_0xac7d('0x16')+_0x276778+'.'+_0x3eaee6)[_0xac7d('0x15')](_0x2fd75b+'.dialCheckDuplicateType\x20IN\x20('+_0x238069[_0xac7d('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5b94e9,_0x3e580d){promisesAdditionalPhones=[];promisesContact=[];return db[_0xac7d('0x17')][_0xac7d('0x18')](_0xac7d('0x19')+tempTableName)['spread'](function(_0x19e7ba){if(_0x19e7ba!==null){var _0x4283dd=[];for(var _0x27ed38=0x0;_0x27ed38<_0x19e7ba[_0xac7d('0x1a')];_0x27ed38++){var _0x35ea95=_0x19e7ba[_0x27ed38];if(!_['isNil'](_0x35ea95[_0xac7d('0x12')])){if(!_[_0xac7d('0x1b')](_0x35ea95['AdditionalPhones']))_0x4283dd[_0xac7d('0x1c')](insertAdditionalPhones(_0x35ea95));promisesContact[_0xac7d('0x1c')]({'contact':_0x35ea95});}}}Promise[_0xac7d('0x1d')](_0x4283dd)[_0xac7d('0x1e')](function(){_0x5b94e9({'val':0x1});});})['catch'](function(_0x46e2ed){logger[_0xac7d('0x1f')](_0x46e2ed[_0xac7d('0x20')]);});});}function insertAdditionalPhones(_0x518e77){return new Promise(function(_0xd42c40,_0x4f4e4e){var _0x3189fe=_0x518e77[_0xac7d('0x21')];if(_[_0xac7d('0x1b')](_0x3189fe))_0x4f4e4e({'val':0x0});else{var _0x160b42=_0x3189fe[_0xac7d('0x22')](';');var _0x365269=[];orderBy=0x0;for(var _0x5a006e=0x0;_0x5a006e<_0x160b42['length'];_0x5a006e++){_0x365269[_0xac7d('0x1c')](splitAdditionalPhone(_0x518e77['id'],_0x160b42[_0x5a006e]));}Promise[_0xac7d('0x1d')](_0x365269)['then'](function(){_0xd42c40({'val':_0x160b42[_0xac7d('0x1a')]});});}});}function splitAdditionalPhone(_0x3966dd,_0x2a5774){return new Promise(function(_0x1c1f88,_0x43aa8e){var _0xc8a7f0=_0x2a5774[_0xac7d('0x22')](':');var _0x3bb7dd=_0xc8a7f0[0x0];var _0x42e313=_0xc8a7f0[0x1];if(_0x42e313!==''){var _0x26a8c4=_0x42e313['split']('|');var _0x229ecd=[];for(var _0x3216cb=0x0;_0x3216cb<_0x26a8c4[_0xac7d('0x1a')];_0x3216cb++){if(_0x26a8c4[_0x3216cb]!==''){var _0x1bcfd5=_['filter'](promisesAdditionalPhones,{'contactId':_0x3966dd,'phone':_0x26a8c4[_0x3216cb]});if(_0x1bcfd5['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3966dd,'contactTypeId':_0x3bb7dd,'phone':_0x26a8c4[_0x3216cb],'orderBy':orderBy});}}}_0x1c1f88({'ok':0x1});}else _0x1c1f88({'res':0x0});});}function createAdditionalPhone(_0xc30df3,_0x32b12c,_0xac3f87,_0x5bd39b){var _0x51df23='';var _0x506b88='';var _0x4e2456=_0xac3f87['split']('§');_0x51df23=_0x4e2456[0x0];if(_0x4e2456['length']==0x2)_0x506b88=_0x4e2456[0x1];return new Promise(function(_0x57ef95,_0x104186){return db[_0xac7d('0x23')][_0xac7d('0x24')]({'where':{'CmContactId':_0xc30df3,'item':_0x51df23}})[_0xac7d('0x1e')](function(_0x15a950){if(_0x15a950){return db['CmContactHasItem']['update']({'ItemTypeId':_0x32b12c,'description':_0x506b88,'OrderBy':_0x5bd39b},{'where':{'CmContactId':_0xc30df3,'item':_0x51df23}})[_0xac7d('0x1e')](function(_0xfbfbf7){_0x57ef95({'res':_0xac7d('0x25')});});}else{return db[_0xac7d('0x23')][_0xac7d('0x26')]({'CmContactId':_0xc30df3,'item':_0x51df23,'ItemTypeId':_0x32b12c,'description':_0x506b88,'OrderBy':_0x5bd39b,'ItemClass':_0xac7d('0x27')})[_0xac7d('0x1e')](function(_0x3c507e){_0x57ef95({'res':_0xac7d('0x28')});});}});});}function updateContact(_0x96e66b){return new Promise(function(_0x41c60a,_0x2e10f7){var _0x29163c=_0x96e66b['id'];delete _0x96e66b['id'];return db[_0xac7d('0x29')][_0xac7d('0x2a')](_0x96e66b,{'where':{'id':_0x29163c}})[_0xac7d('0x1e')](function(_0x4ee968){updatedRows+=0x1;return db[_0xac7d('0x2b')][_0xac7d('0x2a')]({'phone':_0x96e66b[_0xac7d('0x12')]},{'where':{'ContactId':_0x29163c}})[_0xac7d('0x1e')](function(_0x204717){_0x41c60a({'ret':'OK'});});});});}function insertCmHopper(_0x5690e4,_0x2bfc9e,_0x5c09a4,_0x5831e2,_0x23a09d){var _0x1c2ccc=[_0xac7d('0x2c'),_0xac7d('0x2d'),_0xac7d('0x2e'),_0xac7d('0x2f'),_0x2bfc9e+'.'+_0x5831e2,_0xac7d('0x30'),_0xac7d('0x31'),_0xac7d('0x32'),_0xac7d('0x33'),'\x22'+_0x23a09d+'\x22'];return squel[_0xac7d('0x34')]()['into']('cm_hopper')[_0xac7d('0x35')](['phone',_0xac7d('0x36'),_0xac7d('0x37'),_0xac7d('0x38'),_0x5831e2,_0xac7d('0x39'),'updatedAt','priority',_0xac7d('0x3a'),_0xac7d('0x3b')],squel[_0xac7d('0x10')]()[_0xac7d('0x3c')](_0x1c2ccc)[_0xac7d('0x3d')](_0x2bfc9e)['join']('cm_contacts',null,_0xac7d('0x3e')+_0x2bfc9e+'.CmListId')[_0xac7d('0x13')](_0x5c09a4,null,_0x5c09a4+_0xac7d('0x14')+_0x2bfc9e+'.'+_0x5831e2)[_0xac7d('0x15')](_0x2bfc9e+'.CmListId\x20=\x20?',_0x5690e4)[_0xac7d('0x15')](_0xac7d('0x3f'),NOW)[_0xac7d('0x15')](_0xac7d('0x40'),selectNotIn(_0x2bfc9e,_0x5c09a4,_0x5831e2,_0xac7d('0x41'),[_0xac7d('0x42'),'\x22onlyIfOpen\x22']))['where'](_0xac7d('0x40'),selectNotIn(_0x2bfc9e,_0x5c09a4,_0x5831e2,_0xac7d('0x41'),['\x22always\x22'])))[_0xac7d('0x43')]();}function insertCmHopperBlack(_0x14a658,_0x355647,_0x5978ea,_0x5f3b48){var _0x133bd6=['cm_contacts.phone',_0xac7d('0x2e'),_0xac7d('0x2f'),_0x355647+'.'+_0x5f3b48,_0xac7d('0x30'),_0xac7d('0x31')];return squel[_0xac7d('0x34')]()[_0xac7d('0x44')](_0xac7d('0x45'))[_0xac7d('0x35')]([_0xac7d('0x12'),_0xac7d('0x37'),'ListId',_0x5f3b48,_0xac7d('0x39'),_0xac7d('0x46')],squel[_0xac7d('0x10')]()[_0xac7d('0x3c')](_0x133bd6)[_0xac7d('0x3d')](_0x355647)[_0xac7d('0x13')](_0xac7d('0x47'),null,'cm_contacts.ListId\x20=\x20'+_0x355647+_0xac7d('0x48'))[_0xac7d('0x13')](_0x5978ea,null,_0x5978ea+'.id\x20=\x20'+_0x355647+'.'+_0x5f3b48)[_0xac7d('0x15')](_0x355647+_0xac7d('0x49'),_0x14a658)[_0xac7d('0x15')](_0xac7d('0x3f'),NOW)[_0xac7d('0x15')](_0xac7d('0x40'),squel[_0xac7d('0x10')]()['field'](_0xac7d('0x12'))[_0xac7d('0x3d')]('cm_hopper_black')[_0xac7d('0x15')](_0xac7d('0x4a'),_0x14a658)[_0xac7d('0x15')](_0x5f3b48+'\x20=\x20?',_0x355647+'.'+_0x5f3b48)))[_0xac7d('0x43')]();}function insertCmHopperAdditionalPhones(_0xead395){var _0xfa8ab=[_0xac7d('0x4b'),'cm_contact_has_items.item',_0xac7d('0x4c'),_0xac7d('0x4d'),_0xac7d('0x4e')];return squel[_0xac7d('0x34')]()[_0xac7d('0x44')]('cm_hopper_additional_phones')['fromQuery']([_0xac7d('0x4f'),_0xac7d('0x12'),_0xac7d('0x50'),'createdAt',_0xac7d('0x46')],squel['select']()[_0xac7d('0x3c')](_0xfa8ab)[_0xac7d('0x3d')](_0xac7d('0x41'))[_0xac7d('0x13')](_0xac7d('0x47'),null,_0xac7d('0x51'))['join'](_0xac7d('0x52'),null,_0xac7d('0x53'))[_0xac7d('0x15')](_0xac7d('0x54'),_0xead395)[_0xac7d('0x15')](_0xac7d('0x3f'),NOW))[_0xac7d('0x43')]();}function insertCmContact(_0x1bcfbd,_0x20166d,_0x5bc2e2,_0x449034){var _0x24977d=_[_0xac7d('0x55')](_[_0xac7d('0x56')](_0x449034),[_0xac7d('0x38'),_0xac7d('0x57'),_0xac7d('0x39'),_0xac7d('0x46')]);return squel[_0xac7d('0x34')]()[_0xac7d('0x44')](_0xac7d('0x47'))[_0xac7d('0x35')](_0x24977d,squel[_0xac7d('0x10')]()[_0xac7d('0x3c')](_0x24977d)['from'](_0x20166d)['where']('('+_0x5bc2e2[_0xac7d('0x13')](',')+_0xac7d('0x58'),squel[_0xac7d('0x10')]()[_0xac7d('0x3c')](_0x5bc2e2)['from'](_0xac7d('0x47'))[_0xac7d('0x15')](_0xac7d('0x4a'),_0x1bcfbd))[_0xac7d('0x15')](_0xac7d('0x59'),squel['select']()[_0xac7d('0x11')](_0xac7d('0x5a'),_0xac7d('0x5b'))[_0xac7d('0x3d')](_0x20166d)['group'](_0x5bc2e2['join'](','))))[_0xac7d('0x43')]();}function handleStop(){logger[_0xac7d('0x5c')](_0xac7d('0x5d'));stopped=!![];}function handleUncaughtException(_0x29fc2c){logger[_0xac7d('0x1f')](_0x29fc2c[_0xac7d('0x20')]);process[_0xac7d('0x5e')](0x1);}function handleError(_0x407ace,_0x2bbd4d){stats['errors'][_0xac7d('0x1c')]({'name':_0x2bbd4d[_0xac7d('0x5f')],'message':_0x2bbd4d[_0xac7d('0x20')],'row':_0x407ace});}function handleQuery(_0x2ea5ea){logger['info'](_0x2ea5ea);return db[_0xac7d('0x17')][_0xac7d('0x18')](_0x2ea5ea)[_0xac7d('0x60')](function(_0x45097a){results[_0xac7d('0x1c')](_0x45097a);})['catch'](function(_0x3daf00){logger[_0xac7d('0x1f')](_0x3daf00[_0xac7d('0x20')]);});}function main(_0x13dc6b,_0x336cb2,_0x1b2c24,_0x1caa0a){logger['info'](_0xac7d('0x61'),_0x13dc6b,JSON[_0xac7d('0x62')](_0x336cb2));process[_0xac7d('0x63')](_0xac7d('0x64'));var _0x145bfa=_0x336cb2[_0xac7d('0x65')];var _0xf2b4bb=_[_0xac7d('0x66')](_0x145bfa);var _0x22153a=_0x336cb2[_0xac7d('0x67')];var _0x22d7cd=path[_0xac7d('0x13')](config[_0xac7d('0x68')],'server/files/tmp',_0x22153a+_0xac7d('0x69'));logger[_0xac7d('0x5c')](_0xac7d('0x6a'),_0x336cb2);db['ContactItemType'][_0xac7d('0x6b')]({'raw':!![],'attributes':['id','name']})['then'](function(_0xd7c443){for(var _0x12c35f=0x0;_0x12c35f<_0xd7c443[_0xac7d('0x1a')];_0x12c35f++){if(_0xd7c443[_0x12c35f][_0xac7d('0x6c')]in _0x145bfa){contactItemTypes[_0xac7d('0x1c')](_0xd7c443[_0x12c35f]);delete _0xf2b4bb[_0xd7c443[_0x12c35f]['name']];hasAdditionalPhones=!![];}for(var _0x213649 in _0x145bfa){if(_0xd7c443[_0x12c35f]['name']+_0xac7d('0x6d')===_0x213649){phoneDescriptions['push']({'itemTypeId':_0xd7c443[_0x12c35f]['id'],'description':_0x213649});delete _0xf2b4bb[_0x213649];}}}if(hasAdditionalPhones)_0xf2b4bb[_0xac7d('0x21')]='';var _0x46b202=_[_0xac7d('0x56')](_0xf2b4bb)['join']();logger[_0xac7d('0x5c')](_0xac7d('0x6e'),_0x46b202);fs[_0xac7d('0x6f')](_0x22d7cd,_0x46b202+'\x0a');Papa[_0xac7d('0x70')](fs['createReadStream'](_0x13dc6b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x298e2b,_0x2779a4){try{for(var _0x65058a=0x0,_0x57c19e=[];_0x65058a<_0x298e2b['data'][_0xac7d('0x1a')];_0x65058a++){stats[_0xac7d('0x71')]+=0x1;if(_0x298e2b['errors'][_0x65058a]){handleError(_0x298e2b['data'][_0x65058a],_0x298e2b[_0xac7d('0x72')][_0x65058a]);}else{var _0x4d1321=[];var _0x36ff2d=[];var _0x1f5ba6={};for(var _0x482693 in _0x145bfa){let _0x38b8ba=contactItemTypes[_0xac7d('0x73')](_0x5bd9e0=>_0x5bd9e0[_0xac7d('0x6c')]===_0x482693);let _0x39129b=contactItemTypes['find'](_0x31a86c=>_0x31a86c[_0xac7d('0x6c')]+_0xac7d('0x6d')===_0x482693);if(_['isNil'](_0x38b8ba)&&_[_0xac7d('0x1b')](_0x39129b)){if(_0x145bfa[_0xac7d('0x74')](_0x482693)){if(_0x298e2b[_0xac7d('0x75')][_0x65058a][_0x145bfa[_0x482693]]){var _0x437c8e=_[_0xac7d('0x76')](_0x298e2b[_0xac7d('0x75')][_0x65058a][_0x145bfa[_0x482693]]['replace'](/"/g,'\x27'));switch(_0x482693){case'scheduledat':var _0x45d0fd=moment(_0x437c8e,_0xac7d('0xd'),!![]);if(_0x45d0fd[_0xac7d('0x77')]()){_0x57c19e['push']('\x22'+_0x437c8e+'\x22');}else{_0x4d1321[_0xac7d('0x1c')](_0xac7d('0x78'));}break;case _0xac7d('0x79'):var _0x2ad3dd=parseInt(_0x437c8e);_0x437c8e=_[_0xac7d('0x7a')](_0x2ad3dd)||_0x2ad3dd<0x0||_0x2ad3dd>0x4?_0x1caa0a?0x3:0x2:_0x2ad3dd;_0x57c19e[_0xac7d('0x1c')]('\x22'+_0x437c8e+'\x22');break;case _0xac7d('0x3a'):var _0x1b6f79=parseInt(_0x437c8e);if(_[_0xac7d('0x7b')](_0x1b6f79)&&_['includes'](_0x1b2c24,_0x1b6f79)){_0x57c19e['push']('\x22'+_0x1b6f79+'\x22');}else{_0x4d1321['push'](_0xac7d('0x7c'));}break;case'email':if(isEmail(_0x437c8e)){_0x57c19e[_0xac7d('0x1c')]('\x22'+_0x437c8e+'\x22');}else{_0x4d1321[_0xac7d('0x1c')](_0xac7d('0x7d'));}break;case _0xac7d('0x7e'):var _0x561429=moment(_0x437c8e,_0xac7d('0x7f'),!![]);if(_0x561429[_0xac7d('0x77')]()){_0x57c19e[_0xac7d('0x1c')]('\x22'+_0x437c8e+'\x22');}else{_0x4d1321['push'](_0xac7d('0x80'));}break;default:_0x57c19e[_0xac7d('0x1c')]('\x22'+_0x437c8e+'\x22');}}else{switch(_0x482693){case'firstName':case _0xac7d('0x12'):_0x4d1321['push'](_0x482693+_0xac7d('0x81'));break;default:_0x57c19e[_0xac7d('0x1c')]('\x22\x22');}}}}else{var _0x413871='';if(!_[_0xac7d('0x1b')](_0x38b8ba)){if(!_0x1f5ba6[_0xac7d('0x74')](_0x38b8ba['id'])){for(var _0x5ea154=0x0;_0x5ea154<_0x145bfa[_0x482693]['length'];_0x5ea154++){var _0x437c8e=_[_0xac7d('0x76')](_0x298e2b[_0xac7d('0x75')][_0x65058a][_0x145bfa[_0x482693][_0x5ea154]][_0xac7d('0x82')](/"/g,'\x27'));var _0x50d35a=phoneDescriptions['find'](_0x5bafd3=>_0x5bafd3[_0xac7d('0x83')]===_0x38b8ba['id']);if(!_['isNil'](_0x50d35a)){var _0x1b7160=_[_0xac7d('0x76')](_0x298e2b['data'][_0x65058a][_0x145bfa[_0x50d35a[_0xac7d('0x84')]][0x0]][_0xac7d('0x82')](/"/g,'\x27'));if(!_[_0xac7d('0x1b')](_0x1b7160))_0x437c8e=_0x437c8e+'§'+_0x1b7160;}if(_0x413871=='')_0x413871=_0x437c8e;else _0x413871+='|'+_0x437c8e;}_0x36ff2d[_0xac7d('0x1c')](_0x38b8ba['id']+':'+_0x413871);_0x1f5ba6[_0x38b8ba['id']]=0x1;}}}}if(hasAdditionalPhones){_0x57c19e[_0xac7d('0x1c')]('\x22'+_0x36ff2d[_0xac7d('0x13')](';')+'\x22');}if(_0x4d1321[_0xac7d('0x1a')]){handleError(_0x298e2b[_0xac7d('0x75')][_0x65058a],{'code':_0xac7d('0x85'),'message':_0x4d1321[_0xac7d('0x13')]()});}else{fs[_0xac7d('0x86')](_0x22d7cd,_0x57c19e[_0xac7d('0x13')]()+'\x0a');}_0x57c19e=[];}if(!(stats[_0xac7d('0x71')]%0xc8)){socket[_0xac7d('0x87')](_0xac7d('0x88')+_0x22153a,stats);stats[_0xac7d('0x72')]=[];}}if(stopped){logger[_0xac7d('0x5c')](_0xac7d('0x89'));_0x2779a4[_0xac7d('0x8a')]();}}catch(_0x542aa7){handleError(_0x298e2b['data'][_0x65058a],{'code':_0xac7d('0x8b'),'message':_0x542aa7[_0xac7d('0x20')]});logger[_0xac7d('0x1f')](_0xac7d('0x8c'),_0x542aa7['message']);}},'complete':function(){try{var _0x7d535a=[];var _0x238e07=tempTableName;_0x7d535a[_0xac7d('0x1c')]('CREATE\x20TABLE\x20'+_0x238e07+_0xac7d('0x8d'));logger[_0xac7d('0x5c')](_0xac7d('0x8e'),contactItemTypes[_0xac7d('0x1a')]);var _0x50bbe3=util[_0xac7d('0xc')](_0xac7d('0x8f'),_0x22d7cd,_0x238e07,_0x46b202,_0x336cb2[_0xac7d('0x38')],_0x336cb2['CompanyId']||null,NOW,NOW);if(_[_0xac7d('0x1b')](_0x145bfa['scheduledat'])){_0x50bbe3+=_0xac7d('0x90');}_0x7d535a[_0xac7d('0x1c')](_0x50bbe3);BPromise[_0xac7d('0x91')](_0x7d535a,handleQuery)[_0xac7d('0x1e')](function(_0x5345a9){BPromise[_0xac7d('0x1d')]([handleAdditionalPhones()])[_0xac7d('0x1e')](function(){_0x7d535a=[];for(var _0x4f53e7=0x0;_0x4f53e7\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 +var _0x69de=['a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','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','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.internal','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','role','agent','search','field','name','color','from','tools_tags','getInteractionFK','user_has_','select','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','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?','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','default','text','value','start','end','read','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','clause','and','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','type','body','some','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','fields','then','tag','tags','filter','get','capitalize','Websites','Accounts','resolve','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages'];(function(_0x8ccfdc,_0x59d713){var _0x1e106e=function(_0x2c4745){while(--_0x2c4745){_0x8ccfdc['push'](_0x8ccfdc['shift']());}};_0x1e106e(++_0x59d713);}(_0x69de,0x16b));var _0xe69d=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x69de[_0x16629d];return _0x56ccee;};'use strict';var _=require('lodash');var squel=require(_0xe69d('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0xe69d('0x1'));var updateInteraction=require(_0xe69d('0x2'))[_0xe69d('0x3')];var utils=require(_0xe69d('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x3ae7a5,_0x4917e2,_0x3de00d){var _0x5ec521=![];var _0x3e7ca0=utils[_0xe69d('0x5')](_0x3ae7a5);if(_0x4917e2[_0xe69d('0x6')]===_0xe69d('0x7')&&!_0x3de00d[_0xe69d('0x8')]&&!_0x3de00d[_0x3e7ca0]){_0x5ec521=!![];}return _0x5ec521;}function getTagsQuery(){return squel['select']()[_0xe69d('0x9')]('id')[_0xe69d('0x9')](_0xe69d('0xa'))[_0xe69d('0x9')](_0xe69d('0xb'))[_0xe69d('0xc')](_0xe69d('0xd'));}function getUsersQuery(_0x358aa3,_0x139175){var _0x50fd4e=utils[_0xe69d('0xe')](_0x358aa3);var _0x4142ec=_0xe69d('0xf')+_0x358aa3+'_interactions';var _0x22c14b=squel[_0xe69d('0x10')]()['field'](_0xe69d('0x11'))[_0xe69d('0x9')]('u.fullname')['field'](_0xe69d('0x12')+_0x50fd4e)['from'](_0x4142ec,'ui')[_0xe69d('0x13')](_0xe69d('0x14'),'u',_0xe69d('0x15'));if(_0x139175[_0xe69d('0x16')]>0x0){_0x22c14b[_0xe69d('0x17')](_0xe69d('0x12')+_0x50fd4e+_0xe69d('0x18'),_[_0xe69d('0x19')](_0x139175,'id'));}return _0x22c14b;}function getInteractionsQuery(_0x5bf7f1){var _0x298d75=utils[_0xe69d('0x1a')](_0x5bf7f1);var _0x35302d=utils['getAccountFK'](_0x5bf7f1);var _0x250b73=utils['getInteractionFK'](_0x5bf7f1);return squel[_0xe69d('0x10')]()[_0xe69d('0xc')](_0x298d75[_0xe69d('0x1b')],'i')['left_join'](_0xe69d('0x1c'),'c',_0xe69d('0x1d'))[_0xe69d('0x13')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x298d75[_0xe69d('0x1e')],'a',_0xe69d('0x1f')+_0x35302d)[_0xe69d('0x13')](_0x298d75[_0xe69d('0x20')],'me','me.'+_0x250b73+_0xe69d('0x21'))[_0xe69d('0x13')](_0x298d75['interactionsTags'],'it',_0xe69d('0x22')+_0x250b73+_0xe69d('0x21'))[_0xe69d('0x13')](_0xe69d('0xd'),'t',_0xe69d('0x23'));}function getSqlClauses(){var _0x563e9e={'body':squel[_0xe69d('0x24')](),'contact':squel[_0xe69d('0x24')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0xe69d('0x24')](),'read':squel[_0xe69d('0x24')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xe69d('0x24')]()};return _0x563e9e;}function parseTagParameter(_0x9afad1){var _0x296c10=squel[_0xe69d('0x24')]();if(_0x9afad1){var _0x5519fa=utils[_0xe69d('0x25')](_0x9afad1);_0x5519fa[_0xe69d('0x26')](function(_0x5172fa){_0x296c10['or'](_0xe69d('0x27'),'%,'+_0x5172fa+',%');});}return _0x296c10;}function parseReadParameter(_0x42d045){var _0x12e9a9='';if(_0x42d045){_0x12e9a9='unreadMessages\x20{OPERATOR}\x200';if(_0x42d045==='1'){_0x12e9a9=_0x12e9a9['replace']('{OPERATOR}','=');}else{_0x12e9a9=_0x12e9a9[_0xe69d('0x28')](_0xe69d('0x29'),'>');}}return _0x12e9a9;}function parseSearchFilter(_0x5cce95,_0x5bb33a){var _0x201744=squel['expr']();if(_0x5bb33a){var _0x351240=_0x5bb33a[_0xe69d('0x28')]('\x5c','\x5c\x5c')[_0xe69d('0x28')](/'/g,'\x27\x27');if(qs[_0xe69d('0x2a')](_0x351240)){_0x201744['or'](_0xe69d('0x2b'),_0x351240+'%');if([_0xe69d('0x2c'),_0xe69d('0x2d')][_0xe69d('0x2e')](_0x5cce95)){_0x201744['or'](_0xe69d('0x2f'),_0x351240+'%');}else if(_0x5cce95===_0xe69d('0x30')){_0x201744['or']('i.fax\x20LIKE\x20?',_0x351240+'%');}else if(_0x5cce95===_0xe69d('0x31')){_0x201744['or'](_0xe69d('0x32'),_0x351240+'%');}}else if(_0x5cce95===_0xe69d('0x33')&&qs[_0xe69d('0x34')](_0x351240)){_0x201744['or'](_0xe69d('0x35'),_0x351240+'%');}else{if(_0x5cce95===_0xe69d('0x33')){_0x201744['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x351240,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe69d('0x36')](_0x351240));}else if(_0x5cce95!==_0xe69d('0x30')){_0x201744['or'](_0xe69d('0x37'),qs[_0xe69d('0x36')](_0x351240));}_0x201744['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe69d('0x36')](_0x351240,!![]),null);}}return _0x201744;}function parseAdvancedSearchFilter(_0xf94752,_0x2caec4){var _0x2b9748=getSqlClauses();var _0x4b826d=as['parseSearch'](_0xf94752);var _0x3e7604=_0x4b826d[_0xe69d('0x38')];for(var _0x3c0a48=0x0;_0x3c0a48<_0x4b826d[_0xe69d('0x39')]['length'];_0x3c0a48++){var _0x1b098d=_0x4b826d[_0xe69d('0x39')][_0x3c0a48];var _0x59cdcd='i';var _0x55334d=_[_0xe69d('0x3a')](_0x2caec4,[_0xe69d('0xa'),_0x1b098d[_0xe69d('0x9')]]);if(_0x55334d){var _0x22835d=as['buildExpression'](_0x59cdcd,_0x55334d['type'],_0x1b098d);_0x2b9748[_0xe69d('0x3b')][_0x3e7604](_0x22835d[_0xe69d('0x3c')],_0x22835d[_0xe69d('0x3d')][_0xe69d('0x3e')],_0x22835d[_0xe69d('0x3d')][_0xe69d('0x3f')]);}else{switch(_0x1b098d['field']){case'unreadMessages':var _0x5f2d15=parseReadParameter(_0x1b098d[_0xe69d('0x3d')]);_0x2b9748[_0xe69d('0x40')]['and'](_0x5f2d15);break;case _0xe69d('0x41'):if(_0x1b098d[_0xe69d('0x42')]===_0xe69d('0x43')){if(_0x1b098d['value'][_0xe69d('0x44')]('\x20')[_0xe69d('0x16')]>0x1){_0x2b9748['contact'][_0x3e7604](_0xe69d('0x45'),qs[_0xe69d('0x36')](_0x1b098d['value'],!![]),null);}else{var _0x33cf38='%'+_0x1b098d[_0xe69d('0x3d')]+'%';_0x2b9748[_0xe69d('0x46')][_0x3e7604](_0xe69d('0x47'),_0x33cf38,_0x33cf38,_0x33cf38);}}else{_0x55334d=_[_0xe69d('0x3a')](_0x2caec4,[_0xe69d('0xa'),'ContactId']);_0x1b098d[_0xe69d('0x9')]=_0xe69d('0x48');_0x22835d=as['buildExpression'](_0x59cdcd,_0x55334d['type'],_0x1b098d);_0x2b9748['contact'][_0x3e7604](_0x22835d[_0xe69d('0x3c')],_0x22835d[_0xe69d('0x3d')][_0xe69d('0x3e')],_0x22835d[_0xe69d('0x3d')][_0xe69d('0x3f')]);}break;case _0xe69d('0x49'):var _0x29f7ed=_0x1b098d[_0xe69d('0x3d')][_0xe69d('0x44')](',')['map'](function(_0x46b7b9){return Number(_0x46b7b9);});var _0x171b1f=parseTagParameter(_0x29f7ed);_0x2b9748['tags'][_0xe69d('0x4a')][_0xe69d('0x4b')](_0x171b1f);_0x2b9748['tags'][_0xe69d('0x4c')]=_0x29f7ed;break;case'User':if(_0x1b098d[_0xe69d('0x42')]==='$substring'){_0x2b9748[_0xe69d('0x4d')][_0x3e7604](_0xe69d('0x4e'),'%'+_0x1b098d['value']+'%',null);}else{_0x55334d=_['find'](_0x2caec4,[_0xe69d('0xa'),_0xe69d('0x4f')]);_0x1b098d[_0xe69d('0x9')]=_0xe69d('0x4f');_0x22835d=as[_0xe69d('0x50')](_0x59cdcd,_0x55334d[_0xe69d('0x51')],_0x1b098d);_0x2b9748[_0xe69d('0x4d')][_0x3e7604](_0x22835d[_0xe69d('0x3c')],_0x22835d[_0xe69d('0x3d')][_0xe69d('0x3e')],_0x22835d['value'][_0xe69d('0x3f')]);}break;case'body':case'plainBody':_0x22835d=as[_0xe69d('0x50')]('me',null,_0x1b098d);_0x2b9748[_0xe69d('0x52')][_0x3e7604](_0x22835d[_0xe69d('0x3c')],_0x22835d['value']['start'],_0x22835d['value']['end']);break;}}}return _0x2b9748;}function parseModelFields(_0x38509d,_0x283ed1,_0x39a536){var _0x5885a9=utils[_0xe69d('0x5')](_0x38509d);var _0x38179d=squel['expr']();var _0x5adae9=_(_0x283ed1)['keys']()[_0xe69d('0x19')](function(_0xe71daa){return _[_0xe69d('0x53')](_0x39a536,['name',_0xe71daa])?_0xe71daa:undefined;})['compact']()['value']();if(_0x5adae9[_0xe69d('0x16')]>0x0){_0x5adae9['forEach'](function(_0x3464ea){if(_0x3464ea===_0x5885a9){_0x38179d[_0xe69d('0x4b')]('i.'+_0x5885a9+_0xe69d('0x18'),[]['concat'](_0x283ed1[_0x3464ea]));}else if(_0x3464ea===_0xe69d('0x54')){var _0x3adf5a=JSON[_0xe69d('0x55')](_0x283ed1[_0x3464ea])[_0xe69d('0x56')];var _0x30d07c=JSON[_0xe69d('0x55')](_0x283ed1[_0x3464ea])[_0xe69d('0x57')];_0x38179d['and'](_0xe69d('0x58'),_0x3adf5a,_0x30d07c);}else{if(_0x283ed1[_0x3464ea]===_0xe69d('0x59')){_0x38179d[_0xe69d('0x4b')]('i.'+_0x3464ea+'\x20IS\x20NULL');}else{_0x38179d[_0xe69d('0x4b')]('i.'+_0x3464ea+'\x20=\x20?',_0x283ed1[_0x3464ea]);}}});}return _0x38179d;}function parseQueryParameters(_0x36b5d4,_0x2c0830,_0x13b654){var _0x27de14=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x36b5d4,_0x2c0830,_0x13b654);})['then'](function(_0x54ad74){_0x27de14[_0xe69d('0x5a')][_0xe69d('0x4b')](_0x54ad74);return parseReadParameter(_0x2c0830[_0xe69d('0x40')]);})[_0xe69d('0x5b')](function(_0x3010be){_0x27de14[_0xe69d('0x40')]['and'](_0x3010be);return parseTagParameter(_0x2c0830[_0xe69d('0x5c')]);})[_0xe69d('0x5b')](function(_0x2e36e6){_0x27de14[_0xe69d('0x5d')][_0xe69d('0x4a')]['and'](_0x2e36e6);return parseSearchFilter(_0x36b5d4,_0x2c0830[_0xe69d('0x5e')]);})[_0xe69d('0x5b')](function(_0x3eb86e){_0x27de14[_0xe69d('0x5e')]=_0x3eb86e;return _0x27de14;});}function checkAccountsRestrictions(_0x4f11e0,_0x415d2a,_0x1a02c5){var _0x50e721=utils[_0xe69d('0x5')](_0x4f11e0);var _0x3485bc=_0xe69d('0x5f')+_[_0xe69d('0x60')](_0x4f11e0)+(_0x4f11e0==='chat'?_0xe69d('0x61'):_0xe69d('0x62'));var _0x43cf6f=squel['expr']();return Promise[_0xe69d('0x63')]()[_0xe69d('0x5b')](function(){if(_0x1a02c5['search']&&_0x415d2a[_0xe69d('0x6')]==='agent'){return _0x415d2a[_0x3485bc]({'attributes':['id'],'raw':!![]});}})[_0xe69d('0x5b')](function(_0x29e5de){if(_0x29e5de){if(_0x29e5de[_0xe69d('0x16')]===0x0){_0x43cf6f['and']('i.'+_0x50e721+_0xe69d('0x64'));}else{_0x43cf6f['and']('i.'+_0x50e721+'\x20IN\x20?',_['map'](_0x29e5de,'id'));}}else if(!_0x1a02c5[_0x50e721]){_0x43cf6f[_0xe69d('0x4b')]('i.'+_0x50e721+_0xe69d('0x65'));}})['then'](function(){return _0x43cf6f;});}function getClosedOrderClause(_0x173080,_0x101903){var _0x434cce='';var _0x5ae726=['i.thirdDisposition',_0xe69d('0x66'),_0xe69d('0x67')];if(_0x173080===_0xe69d('0x33')){_0x5ae726[_0xe69d('0x68')](_0xe69d('0x69'));}if(_0x101903[_0xe69d('0x6a')]==='0'&&_0x173080===_0xe69d('0x33')){_0x434cce=_0xe69d('0x69');}else{if(_0x101903[_0xe69d('0x6a')]==='1'){_0x5ae726[_0xe69d('0x6b')]();}_0x434cce=_0xe69d('0x6c')+_0x5ae726['join'](',\x20')+')';}return _0x434cce;}function getFilteredInteractions(_0x12a746,_0x5c470d,_0x1a126f,_0x37b5c4){var _0x2e55cd=utils[_0xe69d('0xe')](_0x12a746);var _0x4567b8=_[_0xe69d('0x60')](_0x12a746)+_0xe69d('0x6d');var _0x177b1f=[];var _0x35a4f4=getTagsQuery();var _0x5153aa={'type':db[_0xe69d('0x6e')][_0xe69d('0x6f')][_0xe69d('0x70')],'raw':!![]};var _0x1d9f8a=[];var _0x5d4301=[];return db[_0xe69d('0x71')][_0xe69d('0x72')](_0x35a4f4[_0xe69d('0x73')](),_0x5153aa)[_0xe69d('0x5b')](function(_0x4afa01){_0x177b1f=_[_0xe69d('0x74')](_0x4afa01,'id');_0x5153aa=_['merge'](_0x5153aa,{'model':db[_0x4567b8],'mapToModel':!![],'nest':!![]});if(_0x1a126f[_0xe69d('0x5a')]){_0x37b5c4[_0xe69d('0x75')]['forEach'](function(_0x2e3454){_0x5c470d['field']('i.'+_0x2e3454);});}else{_0x5c470d['field'](_0xe69d('0x76'),_0xe69d('0x77'));_0x5c470d[_0xe69d('0x9')]('a.key','Account.key');_0x5c470d[_0xe69d('0x9')](_0xe69d('0x78'),_0xe69d('0x79'));if(_0x12a746===_0xe69d('0x33')){_0x5c470d[_0xe69d('0x9')]('a.email','Account.email');_0x5c470d[_0xe69d('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xe69d('0x7a'));_0x5c470d[_0xe69d('0x9')]('i.id');_0x5c470d[_0xe69d('0x9')](_0xe69d('0x7b'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x7c'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x7d'));_0x5c470d['field'](_0xe69d('0x7e'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x7f'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x80'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x81'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x82'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x67'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x66'));_0x5c470d['field'](_0xe69d('0x83'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x69'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x84'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x85'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x86'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x87'));}else if(_0x12a746===_0xe69d('0x31')){_0x5c470d['field'](_0xe69d('0x88'),_0xe69d('0x7a'));}else{_0x5c470d['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(_0x12a746!==_0xe69d('0x33')){_0x5c470d[_0xe69d('0x9')](_0xe69d('0x89'));}_0x5c470d[_0xe69d('0x9')](_0xe69d('0x8a'),'Contact.firstName');_0x5c470d['field'](_0xe69d('0x8b'),_0xe69d('0x8c'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x8d'),_0xe69d('0x8e'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x8f'),_0xe69d('0x90'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x91'),'Contact.mobile');_0x5c470d[_0xe69d('0x9')](_0xe69d('0x92'),_0xe69d('0x93'));_0x5c470d[_0xe69d('0x9')]('o.fullname','Owner.fullname');_0x5c470d[_0xe69d('0x9')]('o.internal',_0xe69d('0x94'));_0x5c470d[_0xe69d('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe69d('0x95'));}if(_0x37b5c4['limit']){_0x5c470d[_0xe69d('0x96')](_0x37b5c4['limit']);}if(_0x37b5c4[_0xe69d('0x97')]){_0x5c470d['offset'](_0x37b5c4[_0xe69d('0x97')]);}return db[_0xe69d('0x71')][_0xe69d('0x72')](_0x5c470d[_0xe69d('0x73')](),_0x5153aa);})[_0xe69d('0x5b')](function(_0x370237){_0x1d9f8a=_0x370237;var _0x142fa4=getUsersQuery(_0x12a746,_0x1d9f8a);return db[_0xe69d('0x71')][_0xe69d('0x72')](_0x142fa4[_0xe69d('0x73')](),_0x5153aa);})[_0xe69d('0x5b')](function(_0x581b74){_0x5d4301=_[_0xe69d('0x98')](_0x581b74,_0x2e55cd);if(_0x12a746===_0xe69d('0x33')){return db[_0xe69d('0x99')][_0xe69d('0x9a')]({'attributes':[_0xe69d('0x9b')],'raw':!![]});}})[_0xe69d('0x5b')](function(_0x707637){var _0x53816=_0x707637?_0x707637[_0xe69d('0x9b')]:undefined;var _0x394f8a=_0x1d9f8a[_0xe69d('0x19')](function(_0x658892){return updateInteraction(_0x658892,_0x177b1f,_0x5d4301,_0x53816);});return Promise[_0xe69d('0x9c')](_0x394f8a);});}function countFilteredInteractions(_0x477d58,_0x4deefb){var _0x185a71=_0x477d58[_0xe69d('0x9d')]();_0x185a71['field'](_0xe69d('0x9e'));_0x185a71['field'](_0xe69d('0x76'),_0xe69d('0x77'));var _0x8249be=utils['getSelectedTags'](_0x4deefb);if(!_[_0xe69d('0x9f')](_0x8249be)){_0x185a71[_0xe69d('0x17')](_0xe69d('0xa0'),_0x8249be);}var _0x4323c2={'type':db[_0xe69d('0x6e')][_0xe69d('0x6f')]['SELECT'],'raw':!![]};return db['sequelize'][_0xe69d('0x72')](_0x185a71[_0xe69d('0x73')](),_0x4323c2);}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 6314104..15f9120 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 _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 +var _0x72f6=['waiting','talking','answered','abandoned','total','closed','disposition','unmanaged','UserId','findOne','out','plainBody','-id','then','lastMsgText','trimStart','updateInteraction','Users','TagIds','lodash','map','fullname','split','push'];(function(_0x1fec1e,_0xce18d2){var _0x31f9ec=function(_0x347a9a){while(--_0x347a9a){_0x1fec1e['push'](_0x1fec1e['shift']());}};_0x31f9ec(++_0xce18d2);}(_0x72f6,0x133));var _0x672f=function(_0x10779c,_0x22d624){_0x10779c=_0x10779c-0x0;var _0x147632=_0x72f6[_0x10779c];return _0x147632;};'use strict';var _=require(_0x672f('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x36440a,_0x22b076){return new Promise(function(_0x36d9d5,_0x13673c){try{var _0x4b06ef=[];if(_0x22b076[_0x36440a]){_0x4b06ef=_0x22b076[_0x36440a][_0x672f('0x1')](function(_0x585d29){return{'id':_0x585d29['id'],'fullname':_0x585d29[_0x672f('0x2')]};});}return _0x36d9d5(_0x4b06ef);}catch(_0x5e356e){_0x13673c(_0x5e356e);}});}function getInteractionTags(_0x16c24b,_0x46d8d6){var _0x71cb3b=[];if(_0x16c24b){_0x16c24b[_0x672f('0x3')](',')['forEach'](function(_0x23acf4){_0x71cb3b[_0x672f('0x4')](_0x46d8d6[_0x23acf4]);});}return _0x71cb3b;}function updateWaitingCounter(_0x485fba){if(_0x485fba[_0x672f('0x5')]){_0x485fba[_0x672f('0x5')]-=0x1;}}function updateInteractionCounters(_0x1b2656){_0x1b2656['waiting']=0x0;_0x1b2656[_0x672f('0x6')]=0x0;_0x1b2656[_0x672f('0x7')]=0x0;_0x1b2656['unmanaged']=0x0;_0x1b2656[_0x672f('0x8')]=0x0;_0x1b2656[_0x672f('0x9')]=0x0;if(_0x1b2656[_0x672f('0xa')]){if(_0x1b2656[_0x672f('0xb')]===_0x672f('0x8')){_0x1b2656['abandoned']+=0x1;updateWaitingCounter(_0x1b2656);}if(_0x1b2656['UserId']){_0x1b2656[_0x672f('0x7')]+=0x1;if(_0x1b2656[_0x672f('0x6')]){_0x1b2656[_0x672f('0x6')]-=0x1;}}else{if(_0x1b2656['disposition']){_0x1b2656[_0x672f('0xc')]+=0x1;updateWaitingCounter(_0x1b2656);}}}else{if(!_0x1b2656[_0x672f('0xd')]){_0x1b2656['waiting']+=0x1;}if(_0x1b2656[_0x672f('0xd')]){_0x1b2656[_0x672f('0x6')]+=0x1;updateWaitingCounter(_0x1b2656);}}_0x1b2656[_0x672f('0x9')]+=0x1;return _0x1b2656;}function getLastMessageText(_0x5a8a0a){return db['MailMessage'][_0x672f('0xe')]({'where':{'$and':[{'MailInteractionId':_0x5a8a0a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x672f('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x672f('0x10')],'order':_0x672f('0x11'),'raw':!![]})[_0x672f('0x12')](function(_0x54d444){if(_0x54d444&&_0x54d444['plainBody']){_0x5a8a0a[_0x672f('0x13')]=_[_0x672f('0x14')](_0x54d444[_0x672f('0x10')]);}return _0x5a8a0a;})['catch'](function(_0x353d75){throw _0x353d75;});}exports[_0x672f('0x15')]=function(_0xf69435,_0x13b040,_0x3db311,_0x5ad34c){return new Promise(function(_0x5dc9c5,_0x2a689a){return getInteractionUsers(_0xf69435['id'],_0x3db311)[_0x672f('0x12')](function(_0x4f0705){_0xf69435[_0x672f('0x16')]=_0x4f0705;return getInteractionTags(_0xf69435[_0x672f('0x17')],_0x13b040);})[_0x672f('0x12')](function(_0x3ff62e){_0xf69435['Tags']=_0x3ff62e;delete _0xf69435[_0x672f('0x17')];return updateInteractionCounters(_0xf69435);})[_0x672f('0x12')](function(_0x5cedda){if(_0x5ad34c){return getLastMessageText(_0x5cedda);}else{return _0x5cedda;}})[_0x672f('0x12')](function(_0x1116e6){_0x5dc9c5(_0x1116e6);})['catch'](function(_0x480b5a){_0x2a689a(_0x480b5a);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 0c7e65c..911d729 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 _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 +var _0x6463=['isArray','toUpperCase','role','stringify','null','Interaction','findOne','then','update','info','error','openchannel-interactions','../../config/logger','mail-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_messages','user_has_'];(function(_0x16be20,_0x3f7898){var _0x38f195=function(_0x2bdad1){while(--_0x2bdad1){_0x16be20['push'](_0x16be20['shift']());}};_0x38f195(++_0x3f7898);}(_0x6463,0x1bb));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x3646('0x0')),'mail':require(_0x3646('0x1'))(_0x3646('0x2')),'fax':require(_0x3646('0x1'))('fax-interactions'),'sms':require(_0x3646('0x1'))(_0x3646('0x3')),'chat':require(_0x3646('0x1'))('chat-interactions'),'whatsapp':require(_0x3646('0x1'))(_0x3646('0x4'))};function getAccountFK(_0x5ec104){return _[_0x3646('0x5')](_0x5ec104)+(_0x5ec104===_0x3646('0x6')?_0x3646('0x7'):_0x3646('0x8'))+'Id';}function getInteractionFK(_0x4cd106){return _['capitalize'](_0x4cd106)+_0x3646('0x9');}function getInteractionId(_0x1a6756,_0x2b794b,_0x6a638a){if(_0x1a6756&&_0x1a6756[_[_0x3646('0xa')](_0x6a638a)+_0x3646('0x9')]){return _0x1a6756[_[_0x3646('0xa')](_0x6a638a)+'InteractionId'];}else if(_0x1a6756&&_0x1a6756['id']){return _0x1a6756['id'];}else if(_0x2b794b&&_0x2b794b['id']){return _0x2b794b['id'];}else{return _0x3646('0xb');}}function getInteractionsTables(_0x374e99){return{'accounts':_0x374e99+'_'+(_0x374e99==='chat'?'websites':_0x3646('0xc')),'interactions':_0x374e99+_0x3646('0xd'),'interactionsTags':_0x374e99+'_interaction_has_tags','messages':_0x374e99+_0x3646('0xe'),'userInteractions':_0x3646('0xf')+_0x374e99+_0x3646('0xd')};}function getSelectedTags(_0x542f2d){var _0x133355=[];if(_0x542f2d){_0x133355=Array[_0x3646('0x10')](_0x542f2d)?_0x542f2d:[_0x542f2d];}return _0x133355;}function log(_0x1c6687,_0x47beb4,_0x471363,_0x5cfe2d,_0x190d84,_0xde3818){loggers[_0x190d84['toLowerCase']()][_0x1c6687]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xde3818[_0x3646('0x11')](),_0x47beb4?_0x47beb4['id']:null,_0x47beb4?_0x47beb4['name']:null,_0x47beb4?_0x47beb4[_0x3646('0x12')]:null,getInteractionId(_0x471363,_0x5cfe2d,_0x190d84),_0x471363?JSON[_0x3646('0x13')](_0x471363):_0x3646('0x14'));}function updateUser(_0x2943a1,_0x3aeda2,_0x32dd1a,_0x5b4644,_0x3db86b){db[_['upperFirst'](_0x5b4644)+_0x3646('0x15')][_0x3646('0x16')]({'where':{'id':getInteractionId(_0x3aeda2,_0x32dd1a,_0x5b4644)}})[_0x3646('0x17')](function(_0x49a0cb){if(_0x49a0cb){return _0x49a0cb[_0x3646('0x18')]({'UserId':_0x2943a1?_0x2943a1['id']:null});}})[_0x3646('0x17')](function(_0x28d2e6){if(_0x28d2e6){log(_0x3646('0x19'),_0x2943a1,_0x3aeda2,_0x32dd1a,_0x5b4644,_0x3db86b);}})['catch'](function(){log(_0x3646('0x1a'),_0x2943a1,_0x3aeda2,_0x32dd1a,_0x5b4644,_0x3db86b);});}module['exports']={'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 7b29184..fed97e2 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 _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 +var _0xd3a5=['user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','format','%s:%s:%s','base64','utf8','final','parse','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User'];(function(_0x40412a,_0xd7d49){var _0x369d36=function(_0x325cb4){while(--_0x325cb4){_0x40412a['push'](_0x40412a['shift']());}};_0x369d36(++_0xd7d49);}(_0xd3a5,0x1cd));var _0x5d3a=function(_0x12dc45,_0x388e68){_0x12dc45=_0x12dc45-0x0;var _0x3691e4=_0xd3a5[_0x12dc45];return _0x3691e4;};'use strict';var crypto=require(_0x5d3a('0x0'));var util=require(_0x5d3a('0x1'));var compose=require(_0x5d3a('0x2'));var db=require(_0x5d3a('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2e5d9c,_0x33da22){if(_0x2e5d9c&&_0x33da22){if(_0x33da22[_0x5d3a('0x4')]&&_0x33da22[_0x5d3a('0x5')]){var _0x568955=_0x33da22['data1'];var _0x5a365c=_0x33da22[_0x5d3a('0x5')];var _0x500562=_0x568955['split']('-')[0x4];var _0x253353=_0x568955[_0x5d3a('0x6')]('-')[0x0];var _0x3bb5a3=crypto[_0x5d3a('0x7')]('aes-256-ctr',util[_0x5d3a('0x8')](_0x5d3a('0x9'),_0x500562,_0x568955,_0x253353));var _0x503055=_0x3bb5a3['update'](_0x5a365c,_0x5d3a('0xa'),_0x5d3a('0xb'));_0x503055+=_0x3bb5a3[_0x5d3a('0xc')](_0x5d3a('0xb'));var _0x44830f=JSON[_0x5d3a('0xd')](_0x503055);return _0x44830f['hasOwnProperty'](_0x2e5d9c)?_0x44830f[_0x2e5d9c]:null;}}return null;}function isLimit(_0x45f1c9,_0x2ad0fb,_0x42a27d,_0x4985ae){var _0x20e3d5=_0x2ad0fb;return compose()[_0x5d3a('0xe')](function(_0x38cacb,_0x1d6f7d,_0x44e993){return db[_0x5d3a('0xf')][_0x5d3a('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x5d3a('0x11')](function(_0x5755c0){var _0x1738bd=getValueFromLicense(_0x45f1c9,_0x5755c0);return _0x1738bd?_0x1738bd:_0x20e3d5;})[_0x5d3a('0x11')](function(_0x459f78){_0x20e3d5=_0x459f78;return _0x42a27d[_0x5d3a('0x12')](_0x4985ae);})[_0x5d3a('0x11')](function(_0x27d7e2){if(_0x27d7e2>=_0x20e3d5){return _0x1d6f7d[_0x5d3a('0x13')](0x193)[_0x5d3a('0x14')]({'message':util[_0x5d3a('0x8')](_0x5d3a('0x15'),_0x45f1c9)});}_0x44e993();})[_0x5d3a('0x16')](function(_0x4e1aa5){_0x44e993(_0x4e1aa5);});});}function isUserLimit(){return isLimit(_0x5d3a('0x17'),0x1,db[_0x5d3a('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0x5d3a('0x19')}]}});}exports[_0x5d3a('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index b9337b2..bd2b518 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 _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 +var _0xcf0b=['lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','DATE','operator','value','includes','$gt','$lte','format','YYYY-MM-DD','castTo','CAST(','field','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$lt','<\x20?','<=\x20?','$gte','>=\x20?','$between','start','$startsWith','$endsWith','pop','utcOffset','add','hours','minutes','seconds'];(function(_0x2e50e4,_0xc9271e){var _0x1ccb48=function(_0x496ab7){while(--_0x496ab7){_0x2e50e4['push'](_0x2e50e4['shift']());}};_0x1ccb48(++_0xc9271e);}(_0xcf0b,0x156));var _0xbcf0=function(_0x123824,_0x52a5c7){_0x123824=_0x123824-0x0;var _0x1421eb=_0xcf0b[_0x123824];return _0x1421eb;};'use strict';var _=require(_0xbcf0('0x0'));var moment=require(_0xbcf0('0x1'));exports[_0xbcf0('0x2')]=function(_0xff0dd7){var _0x38683a={'conditions':[]};_0x38683a[_0xbcf0('0x3')]=_[_0xbcf0('0x4')](_0xff0dd7,_0xbcf0('0x5'))?'or':_0xbcf0('0x6');var _0x491ded=_0xff0dd7[_0xbcf0('0x7')](_0xbcf0('0x8'),'')[_0xbcf0('0x7')](_0xbcf0('0x5'),'')[_0xbcf0('0x9')]('||');for(var _0x14aed=0x0;_0x14aed<_0x491ded[_0xbcf0('0xa')];_0x14aed++){var _0x500c58=_0x491ded[_0x14aed][_0xbcf0('0x9')](':=');var _0x6f9a96=_0x500c58[0x0];var _0x14b44e=_0x500c58[_0xbcf0('0xb')](0x1);_0x14b44e[_0xbcf0('0xc')](function(_0x275387){var _0x3d3653=_0x275387[_0xbcf0('0x9')]('[')[_0xbcf0('0xd')]();var _0x403bb6=_0x275387[_0xbcf0('0xe')](/\[(.*?)\]/g);_0x403bb6[_0xbcf0('0xc')](function(_0x130159){var _0xa8ccf7=_0x130159[_0xbcf0('0x9')]('[')[_0xbcf0('0xf')](function(_0x30d265){return _0x30d265[_0xbcf0('0x10')](']')>-0x1;})[_0xbcf0('0x11')](function(_0x509280){return _0x509280[_0xbcf0('0x9')](']')[0x0];})[0x0];_0x38683a[_0xbcf0('0x12')][_0xbcf0('0x13')]({'field':_0x6f9a96,'operator':_0x3d3653,'value':_0xa8ccf7});});});}return _0x38683a;};exports['buildExpression']=function(_0xf8ba4c,_0x1d2cc0,_0x4fdb58){var _0x2b1991={};if(_0x1d2cc0===_0xbcf0('0x14')){if(_0x4fdb58[_0xbcf0('0x15')]==='$eq'){_0x4fdb58[_0xbcf0('0x15')]='$between';_0x4fdb58[_0xbcf0('0x16')]+=','+_0x4fdb58['value'];}else if(_[_0xbcf0('0x17')]([_0xbcf0('0x18'),_0xbcf0('0x19')],_0x4fdb58[_0xbcf0('0x15')])){_0x4fdb58[_0xbcf0('0x16')]=moment(_0x4fdb58['value'])['add'](0x1,'days')[_0xbcf0('0x1a')](_0xbcf0('0x1b'));}}if(_0x4fdb58[_0xbcf0('0x1c')]){_0x1d2cc0=_0x4fdb58[_0xbcf0('0x1c')];_0x2b1991['text']=_0xbcf0('0x1d')+_0xf8ba4c+'.'+_0x4fdb58[_0xbcf0('0x1e')]+'\x20AS\x20'+_0x4fdb58['castTo']+')\x20'+parseOperator(_0x4fdb58['operator']);}else{_0x2b1991['text']=_0xf8ba4c+'.'+_0x4fdb58['field']+'\x20'+parseOperator(_0x4fdb58[_0xbcf0('0x15')]);}if(_['includes']([_0xbcf0('0x1f'),_0xbcf0('0x20')],_0x4fdb58[_0xbcf0('0x15')]))_0x2b1991['text']='('+_0x2b1991[_0xbcf0('0x21')]+_0xbcf0('0x22')+_0xf8ba4c+'.'+_0x4fdb58[_0xbcf0('0x1e')]+_0xbcf0('0x23');_0x2b1991[_0xbcf0('0x16')]=parseValue(_0x1d2cc0,_0x4fdb58[_0xbcf0('0x15')],_0x4fdb58[_0xbcf0('0x16')]);return _0x2b1991;};function parseOperator(_0x4f9bb6){var _0x1bc729;switch(_0x4f9bb6){case _0xbcf0('0x24'):_0x1bc729=_0xbcf0('0x25');break;case _0xbcf0('0x20'):_0x1bc729=_0xbcf0('0x26');break;case'$eq':_0x1bc729=_0xbcf0('0x27');break;case _0xbcf0('0x1f'):_0x1bc729=_0xbcf0('0x28');break;case _0xbcf0('0x29'):case'$startsWith':case'$endsWith':_0x1bc729='LIKE\x20?';break;case _0xbcf0('0x2a'):_0x1bc729=_0xbcf0('0x2b');break;case'$gt':_0x1bc729='>\x20?';break;case _0xbcf0('0x19'):_0x1bc729=_0xbcf0('0x2c');break;case _0xbcf0('0x2d'):_0x1bc729=_0xbcf0('0x2e');break;case _0xbcf0('0x2f'):_0x1bc729='BETWEEN\x20?\x20AND\x20?';break;}return _0x1bc729;}function parseValue(_0x28b7c6,_0x17269c,_0x5f5a0f){var _0x34bc0b={'start':undefined,'end':undefined};switch(_0x17269c){case _0xbcf0('0x24'):case _0xbcf0('0x20'):_0x34bc0b[_0xbcf0('0x30')]=_0x5f5a0f[_0xbcf0('0x9')](',');break;case _0xbcf0('0x29'):_0x34bc0b[_0xbcf0('0x30')]='%'+_0x5f5a0f+'%';break;case _0xbcf0('0x31'):_0x34bc0b[_0xbcf0('0x30')]=_0x5f5a0f+'%';break;case _0xbcf0('0x32'):_0x34bc0b[_0xbcf0('0x30')]='%'+_0x5f5a0f;break;case'$between':var _0x46cbb1=_0x5f5a0f[_0xbcf0('0x9')](',');var _0x5f5a0f=_0x46cbb1[_0xbcf0('0xd')]();var _0x53f2f8=_0x46cbb1[_0xbcf0('0x33')]();if(_0x28b7c6===_0xbcf0('0x14')){_0x5f5a0f=moment(_0x5f5a0f)[_0xbcf0('0x34')](0x0,!![])[_0xbcf0('0x1a')]();_0x53f2f8=moment(_0x53f2f8)[_0xbcf0('0x34')](0x0,!![])[_0xbcf0('0x35')](0x17,_0xbcf0('0x36'))[_0xbcf0('0x35')](0x3b,_0xbcf0('0x37'))['add'](0x3b,_0xbcf0('0x38'))[_0xbcf0('0x1a')]();}_0x34bc0b={'start':_0x5f5a0f,'end':_0x53f2f8};break;default:_0x34bc0b['start']=_0x5f5a0f;break;}return _0x34bc0b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 15d3396..2a744d2 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 _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 +var _0xd881=['hasOwnProperty','nolimit','offset','order','where','filter','object','columns','value','merge','VIRTUAL','lower','options','include','lodash','moment','../../mysqldb','parse','includes','keys','model','alias','fields','raw','split','filters','isEmpty','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','isArray','limit','sort','map','indexOf','priority','cast','unsigned','substr','ASC','omit','length','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach','replace','join','getOptions','query','$id','intersection','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd881,0x182));var _0x1d88=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd881[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1d88('0x0'));var sequelize=require('sequelize');var moment=require(_0x1d88('0x1'));var db=require(_0x1d88('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x15f3c9){var _0x1577ce=['ne'];try{var _0x3ab373=JSON[_0x1d88('0x3')](_0x15f3c9);var _0x5afc73=Object['keys'](_0x3ab373)[0x0];return _0x1577ce[_0x1d88('0x4')](_0x5afc73);}catch(_0x11b44f){return![];}}function getOperatorValue(_0x2e8c29){var _0x32d763=JSON['parse'](_0x2e8c29);var _0x3aa622=Object[_0x1d88('0x5')](_0x32d763)[0x0];var _0x4f09c7=_0x32d763[_0x3aa622];return{['$'+_0x3aa622]:_0x4f09c7};}function parseIncludeModel(_0x35e35f){var _0x1ebd2d=JSON[_0x1d88('0x3')](_0x35e35f);return{'model':db[_0x1ebd2d[_0x1d88('0x6')]],'as':_0x1ebd2d[_0x1d88('0x7')],'attributes':_0x1ebd2d[_0x1d88('0x8')],'raw':_0x1ebd2d[_0x1d88('0x9')]};}exports[_0x1d88('0x8')]=function(_0x5be669){var _0x1bf57b=null;if(_0x5be669){_0x1bf57b=_0x5be669[_0x1d88('0xa')](',');}return _0x1bf57b;};exports[_0x1d88('0xb')]=function(_0x4bcc1e,_0x3de233){var _0x485406={};if(!_[_0x1d88('0xc')](_0x4bcc1e)){_['forOwn'](_0x4bcc1e,function(_0x50962e,_0x499ff3){try{if(_0x3de233){var _0xc2d0fb=_['find'](_0x3de233,{'name':_0x499ff3})||{};if(hasSequelizeOperator(_0x50962e)){_0x485406[_0x499ff3]=getOperatorValue(_0x50962e);}else if(_0xc2d0fb[_0x1d88('0xd')]===_0x1d88('0xe')&&_[_0x1d88('0xf')](_0x50962e)){var _0x32d9e1=JSON[_0x1d88('0x3')](_0x50962e);var _0x59dccd={'$gte':moment(moment(_0x32d9e1[_0x1d88('0x10')])[_0x1d88('0x11')](_0x1d88('0x12')))['utc']()[_0x1d88('0x11')](),'$lte':moment(moment(_0x32d9e1['$lte'])[_0x1d88('0x11')]('YYYY-MM-DD'))[_0x1d88('0x13')]()[_0x1d88('0x14')](0x1,'s')[_0x1d88('0x11')]()};_0x485406[_0x499ff3]=_0x59dccd;}else if(_0xc2d0fb[_0x1d88('0x15')]==='uniqueid'){_0x485406[_0x499ff3]=_0x50962e;}else{_0x485406[_0x499ff3]=_[_0x1d88('0x16')](_0x50962e)?_0x50962e:JSON[_0x1d88('0x3')](_0x50962e);}}else{_0x485406[_0x499ff3]=_[_0x1d88('0x16')](_0x50962e)?_0x50962e:JSON['parse'](_0x50962e);}}catch(_0x15b5ac){_0x485406[_0x499ff3]=_0x50962e[_0x1d88('0xa')](',');}});}return _0x485406;};exports[_0x1d88('0x17')]=function(_0x175aae){_0x175aae=parseInt(_0x175aae,0xa);if(!_0x175aae||_0x175aae<0x0){_0x175aae=LIMIT_VALUE;}return _0x175aae;};exports['offset']=function(_0x20bf4c){_0x20bf4c=parseInt(_0x20bf4c,0xa);if(!_0x20bf4c||_0x20bf4c<0x0){_0x20bf4c=0x0;}return _0x20bf4c;};exports[_0x1d88('0x18')]=function(_0x492457){var _0x5c4520,_0x1efb3e=null;if(_0x492457){_0x5c4520=_0x492457['split'](',');_0x1efb3e=_[_0x1d88('0x19')](_0x5c4520,function(_0x85bab3){if(_0x85bab3[_0x1d88('0x1a')]('-')===0x0){return[_0x85bab3===_0x1d88('0x1b')?sequelize[_0x1d88('0x1c')](sequelize['col'](_0x1d88('0x1b')),_0x1d88('0x1d')):_0x85bab3[_0x1d88('0x1e')](0x1),'DESC'];}else{return[_0x85bab3==='priority'?sequelize[_0x1d88('0x1c')](sequelize['col'](_0x1d88('0x1b')),_0x1d88('0x1d')):_0x85bab3,_0x1d88('0x1f')];}});}return _0x1efb3e;};exports[_0x1d88('0x20')]=function(_0x4f1850,_0x9b2853){if(_[_0x1d88('0xc')](_0x4f1850)){return _0x4f1850;}if(_[_0x1d88('0x16')](_0x4f1850)){for(var _0x302c08=0x0;_0x302c08<_0x4f1850[_0x1d88('0x21')];_0x302c08+=0x1){_0x4f1850[_0x302c08]=this[_0x1d88('0x20')](_0x4f1850[_0x302c08],_0x9b2853);}return _0x4f1850;}if(!_['isObject'](_0x4f1850)){return _0x4f1850;}if(_[_0x1d88('0x22')](_0x9b2853)){_0x9b2853=[_0x9b2853];}if(!_[_0x1d88('0x16')](_0x9b2853)){return _0x4f1850;}for(var _0x15d07e=0x0;_0x15d07e<_0x9b2853[_0x1d88('0x21')];_0x15d07e+=0x1){_[_0x1d88('0x23')](_0x4f1850,_0x9b2853[_0x15d07e]);}for(var _0x19cc88 in _0x4f1850){if(_0x4f1850['hasOwnProperty'](_0x19cc88)){_0x4f1850[_0x19cc88]=this[_0x1d88('0x20')](_0x4f1850[_0x19cc88],_0x9b2853);}}return _0x4f1850;};exports[_0x1d88('0x24')]=function(_0x5db753){return _0x5db753[_0x1d88('0x25')](RegExp(_0x1d88('0x26')))?!![]:![];};exports[_0x1d88('0x27')]=function(_0x40d04c){return _0x40d04c[_0x1d88('0x25')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x546f19,_0xf7a566){var _0x3b3c09=[];var _0x4a810e=/[ `!@#$%^&*()_\-?~]/;var _0x44ac11=_0xf7a566?'\x22{EXPR}\x22':'{EXPR}';_0x546f19[_0x1d88('0xa')](/[ ,]+/)[_0x1d88('0x28')](function(_0x491ad6){_0x491ad6=_0x491ad6[_0x1d88('0x29')](/([^:]")"+/g,'$1');_0x491ad6='+'+_0x491ad6+'*';var _0x5ee644=_0x491ad6[_0x1d88('0x25')](_0x4a810e);if(_0x5ee644){_0x491ad6='\x22'+_0x491ad6+'\x22';}_0x3b3c09['push'](_0x491ad6);});_0x44ac11=_0x44ac11[_0x1d88('0x29')]('{EXPR}',_0x3b3c09[_0x1d88('0x2a')]('\x20'));return _0x44ac11;};exports[_0x1d88('0x2b')]=function(_0x152f51,_0x26379f,_0x1f86d6){var _0xa4cae0={},_0x5ca2bf={};if(_0x26379f[_0x1d88('0x2c')][_0x1d88('0x2d')]){_0x26379f['query']['id']=_0x26379f[_0x1d88('0x2c')][_0x1d88('0x2d')];delete _0x26379f[_0x1d88('0x2c')]['$id'];}_0xa4cae0[_0x1d88('0x6')]=_[_0x1d88('0x19')](_0x152f51,_0x1d88('0x15'));_0xa4cae0[_0x1d88('0x2c')]=_[_0x1d88('0x5')](_0x26379f[_0x1d88('0x2c')]);_0xa4cae0[_0x1d88('0xb')]=_[_0x1d88('0x2e')](_0xa4cae0[_0x1d88('0x6')],_0xa4cae0[_0x1d88('0x2c')]);_0x5ca2bf[_0x1d88('0x2f')]=_[_0x1d88('0x2e')](_0xa4cae0['model'],this[_0x1d88('0x8')](_0x26379f[_0x1d88('0x2c')][_0x1d88('0x8')]));_0x5ca2bf[_0x1d88('0x2f')]=_0x5ca2bf[_0x1d88('0x2f')][_0x1d88('0x21')]?_0x5ca2bf[_0x1d88('0x2f')]:_0xa4cae0[_0x1d88('0x6')];if(!_0x26379f[_0x1d88('0x2c')][_0x1d88('0x30')](_0x1d88('0x31'))){_0x5ca2bf[_0x1d88('0x17')]=this[_0x1d88('0x17')](_0x26379f['query'][_0x1d88('0x17')]);_0x5ca2bf[_0x1d88('0x32')]=this[_0x1d88('0x32')](_0x26379f[_0x1d88('0x2c')]['offset']);}_0x5ca2bf[_0x1d88('0x33')]=this[_0x1d88('0x18')](_0x26379f[_0x1d88('0x2c')]['sort']);_0x5ca2bf[_0x1d88('0x34')]=this[_0x1d88('0xb')](_['pick'](_0x26379f['query'],_0xa4cae0[_0x1d88('0xb')]),_0x152f51);if(_0x26379f[_0x1d88('0x2c')]['filter']){var _0x44fce6=_0x152f51;var _0x48a754=_0x26379f['query'][_0x1d88('0x35')];if(typeof _0x48a754===_0x1d88('0x36')){_0x44fce6=_[_0x1d88('0x35')](_0x152f51,function(_0x45cd0d){return _['includes'](_0x48a754[_0x1d88('0x37')],_0x45cd0d['name']);});_0x48a754=_0x48a754[_0x1d88('0x38')];}_0x5ca2bf['where']=_[_0x1d88('0x39')](_0x5ca2bf[_0x1d88('0x34')],{'$or':_[_0x1d88('0x19')](_0x44fce6,function(_0x28a0e4){if(_0x28a0e4[_0x1d88('0xd')]!==_0x1d88('0x3a')){if(_0x1f86d6){return sequelize[_0x1d88('0x34')](sequelize['fn'](_0x1d88('0x3b'),sequelize['col'](_0x28a0e4[_0x1d88('0x15')])),{'$like':sequelize['fn'](_0x1d88('0x3b'),'%'+_0x26379f['query']['filter']+'%')});}else{var _0xacffa4={};_0xacffa4[_0x28a0e4[_0x1d88('0x15')]]={'$like':'%'+_0x26379f[_0x1d88('0x2c')][_0x1d88('0x35')]+'%'};return _0xacffa4;}}})});}_0x5ca2bf=_[_0x1d88('0x39')]({},_0x5ca2bf,_0x26379f[_0x1d88('0x3c')]);return _0x5ca2bf;};exports[_0x1d88('0x3d')]=function(_0x5ceb30){var _0x168f07=[];if(_0x5ceb30['includeAll']){_0x168f07['push']({'all':!![]});}else if(_0x5ceb30[_0x1d88('0x3d')]){if(Array[_0x1d88('0x16')](_0x5ceb30[_0x1d88('0x3d')])){_0x168f07=Object[_0x1d88('0x5')](_0x5ceb30[_0x1d88('0x3d')])[_0x1d88('0x19')](function(_0x4b62ac){return parseIncludeModel(_0x5ceb30[_0x1d88('0x3d')][_0x4b62ac]);});}else{var _0x52b22a=parseIncludeModel(_0x5ceb30['include']);_0x168f07['push'](_0x52b22a);}}return _0x168f07;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 273985c..50bfe39 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 _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 +var _0x8678=['uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','mailPause','smsPause','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','internal','indexOf','validateSortParameter','sort','pauseType','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','lodash','jayson/promise','client','http','chatPause','faxPause','openchannelPause','whatsappPause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','voicePause','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','error','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','getAgents','all','flatten','map'];(function(_0x24431a,_0x52459a){var _0x454ec7=function(_0x34cd60){while(--_0x34cd60){_0x24431a['push'](_0x24431a['shift']());}};_0x454ec7(++_0x52459a);}(_0x8678,0x1b6));var _0x8867=function(_0xd2010c,_0x203dc6){_0xd2010c=_0xd2010c-0x0;var _0x543bb8=_0x8678[_0xd2010c];return _0x543bb8;};'use strict';var _=require(_0x8867('0x0'));var jayson=require(_0x8867('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x8867('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x8867('0x2')][_0x8867('0x3')]({'port':0x232c});function isAgentPaused(_0x14c325,_0x4525db){var _0x10171b=[_0x14c325[_0x8867('0x4')],_0x14c325[_0x8867('0x5')],_0x14c325['mailPause'],_0x14c325[_0x8867('0x6')],_0x14c325['smsPause'],_0x14c325['voicePause'],_0x14c325[_0x8867('0x7')]];if(!_0x4525db)return _[_0x8867('0x8')](_0x10171b);var _0x3955be=_[_0x8867('0x9')](_0x10171b);return _0x3955be[_0x8867('0xa')]>0x0&&_0x3955be[_0x8867('0xa')]<_0x10171b[_0x8867('0xa')]?!![]:![];}function isIdle(_0x534435){return _0x534435===_0x8867('0xb')||_0x534435===_0x8867('0xc')||_0x534435===_0x8867('0xd')||_0x534435==='ringing'||_[_0x8867('0xe')](_0x534435);}function isAgentIdle(_0x10a456){if(_0x10a456[_0x8867('0xf')]!==_0x8867('0xb')&&_0x10a456[_0x8867('0x10')]){_0x10a456['voiceStatus']=_0x8867('0x11');return![];}return _[_0x8867('0x8')]([_0x10a456[_0x8867('0x12')],_0x10a456[_0x8867('0x13')],_0x10a456[_0x8867('0x14')],_0x10a456[_0x8867('0x15')],_0x10a456[_0x8867('0x16')],_0x10a456['voiceStatus'],_0x10a456[_0x8867('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x8867('0x18')]('Agents',{})[_0x8867('0x19')](function(_0x1beb47){if(_0x1beb47['error']){throw new Error(_0x8867('0x1a'));}var _0x3e6eb9=_0x1beb47[_0x8867('0x1b')];return routingClient[_0x8867('0x18')](_0x8867('0x1c'),{})['then'](function(_0x9e3096){if(_0x9e3096[_0x8867('0x1d')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x5b59ca=_0x9e3096['result'];return _['merge']({},_0x3e6eb9,_0x5b59ca);});})[_0x8867('0x1e')](function(_0x1db600){throw _0x1db600;});}exports[_0x8867('0x1f')]=getRealtimeAgents;function getAgentStatus(_0xb9b5aa){var _0x3af5e1='unknown';if(isAgentPaused(_0xb9b5aa))_0x3af5e1=_0x8867('0x11');else if(isAgentPaused(_0xb9b5aa,!![]))_0x3af5e1=_0x8867('0x20');else if(isAgentIdle(_0xb9b5aa))_0x3af5e1=_0x8867('0xb');else _0x3af5e1=_0x8867('0x21');return _0x3af5e1;}exports[_0x8867('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x129b69,_0xea16d9){var _0x5dceea=_[_0x8867('0x23')](_0x129b69)?_0x129b69:[_0x129b69];var _0x270f32=_[_0x8867('0x24')](_0xea16d9)+_0x8867('0x25');var _0x1c6ead=_['map'](_0x5dceea,function(_0x38276b){return db[_0x270f32]['findOne']({'where':{'id':_0x38276b}})['then'](function(_0x1f0a34){if(!_0x1f0a34)return[];return _0x1f0a34[_0x8867('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x8867('0x27')](_0x1c6ead)[_0x8867('0x19')](function(_0xc44264){var _0x54d021=_(_0xc44264)[_0x8867('0x28')]()[_0x8867('0x29')]('id')[_0x8867('0x2a')]()[_0x8867('0x2b')]();return _0x54d021;});}exports[_0x8867('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4a8852,_0x5f1e81,_0x2b4b26){try{if(_0x5f1e81[_0x8867('0xa')]>0x0){_0x4a8852=_0x4a8852[_0x8867('0x9')](function(_0x29b5e7){return _0x5f1e81[_0x8867('0x2d')](_0x29b5e7['id']);});}var _0x269bd9=_0x4a8852['filter'](function(_0x757a47){var _0x4db310=_0x8867('0x21');if(isAgentIdle(_0x757a47)){_0x4db310=_0x8867('0xb');}return _0x4db310===_0x2b4b26;});return _['map'](_0x269bd9,'id');}catch(_0xb46c8d){throw _0xb46c8d;}}exports[_0x8867('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2f1d6f,_0x31298c,_0x4b82b5){return Promise[_0x8867('0x2f')]()[_0x8867('0x19')](function(){if(_0x31298c[_0x8867('0xa')]>0x0){_0x2f1d6f=_0x2f1d6f[_0x8867('0x9')](function(_0x46c5fe){return _0x31298c[_0x8867('0x2d')](_0x46c5fe['id']);});}return _0x2f1d6f;})[_0x8867('0x19')](function(){return db['User'][_0x8867('0x30')]({'attributes':['id',_0x8867('0x31'),_0x8867('0x32'),_0x8867('0x4'),_0x8867('0x5'),_0x8867('0x33'),_0x8867('0x6'),_0x8867('0x34'),'voicePause','whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x8867('0x29')](_0x2f1d6f,'id')}},'raw':!![]});})[_0x8867('0x19')](function(_0x9173d){return _0x9173d[_0x8867('0x29')](function(_0x500479){var _0x1338b8=_[_0x8867('0x35')](_0x2f1d6f,['id',_0x500479['id']]);var _0x1d082d=filterAgentAttributes(_0x1338b8);_[_0x8867('0x36')](_0x500479,_0x1d082d);_0x500479[_0x8867('0x37')]=getAgentStatus(_0x500479);return _0x500479;});})[_0x8867('0x19')](function(_0x3cf6ee){var _0x1e2b0d=sortAgentsByStatus(_0x3cf6ee,_0x4b82b5);return _['map'](_0x1e2b0d,'id');})[_0x8867('0x1e')](function(_0xdd24f){throw _0xdd24f;});}exports[_0x8867('0x38')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x26d8cd){var _0x54dcad={'fields':[],'order':null};var _0x4542ae=_0x26d8cd[_0x8867('0x39')](',');_0x54dcad[_0x8867('0x3a')]=_['filter'](_0x4542ae,function(_0x40a0f4){if(!_0x40a0f4[_0x8867('0x2d')](_0x8867('0x37'))){return!![];}_0x54dcad[_0x8867('0x3b')]=_[_0x8867('0x3c')](_0x40a0f4,'-')?_0x8867('0x3d'):'ASC';return![];});return _0x54dcad;}exports[_0x8867('0x3e')]=getUpdatedSortOptions;function validateSortParameter(_0x45fdb4){if(!_0x45fdb4){_0x45fdb4='fullname,internal';}if(_0x45fdb4[_0x8867('0x2d')](_0x8867('0x32'))&&!_0x45fdb4[_0x8867('0x2d')](_0x8867('0x3f'))){var _0x4ad32f=_0x45fdb4['substring'](0x0,_0x45fdb4[_0x8867('0x40')](_0x8867('0x32')));_0x45fdb4+=','+_0x4ad32f+_0x8867('0x3f');}return _0x45fdb4;}exports[_0x8867('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x286bda,_0x55c362){var _0x24f019=_0x286bda[_0x8867('0x42')](function(_0x4a3622,_0x36297c){if(_0x4a3622['globalStatus']===_0x36297c[_0x8867('0x37')]){if(_0x4a3622['globalStatus']===_0x8867('0x11')){if(_0x55c362==='DESC'){return(_0x4a3622[_0x8867('0x43')]||'')<(_0x36297c[_0x8867('0x43')]||'')||_0x4a3622[_0x8867('0x32')][_0x8867('0x44')]()>_0x36297c['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x4a3622[_0x8867('0x43')]||'')<(_0x36297c[_0x8867('0x43')]||'')||_0x4a3622[_0x8867('0x32')]['toLowerCase']()>_0x36297c['fullname'][_0x8867('0x44')]()?-0x1:0x1;}}else{if(_0x55c362===_0x8867('0x3d')){return _0x4a3622[_0x8867('0x32')][_0x8867('0x44')]()<_0x36297c[_0x8867('0x32')]['toLowerCase']()?0x1:-0x1;}else{return _0x4a3622[_0x8867('0x32')][_0x8867('0x44')]()<_0x36297c['fullname'][_0x8867('0x44')]()?-0x1:0x1;}}}else{if(_0x55c362===_0x8867('0x3d')){return _0x4a3622[_0x8867('0x37')]<_0x36297c[_0x8867('0x37')]?0x1:-0x1;}else{return _0x4a3622[_0x8867('0x37')]<_0x36297c[_0x8867('0x37')]?-0x1:0x1;}}});return _0x24f019;}exports[_0x8867('0x45')]=sortAgentsByStatus;function filterAgentAttributes(_0x2fed2b){var _0x170893=['userpic',_0x8867('0x46'),_0x8867('0x47'),_0x8867('0x48'),_0x8867('0x43'),_0x8867('0x48'),_0x8867('0x3f'),_0x8867('0x49'),_0x8867('0x4'),_0x8867('0x6'),'mailPause',_0x8867('0x34'),_0x8867('0x7'),_0x8867('0x5'),_0x8867('0x10'),'chatCapacity','openchannelCapacity','mailCapacity',_0x8867('0x4a'),_0x8867('0x4b'),_0x8867('0x4c'),_0x8867('0x4d'),_0x8867('0x4e'),_0x8867('0x4f'),_0x8867('0x50'),_0x8867('0x51'),_0x8867('0x52'),_0x8867('0x12'),_0x8867('0x15'),'mailStatus','smsStatus',_0x8867('0x17'),'faxStatus',_0x8867('0xf'),_0x8867('0x53'),_0x8867('0x54'),_0x8867('0x55'),_0x8867('0x56'),_0x8867('0x57'),'faxStatusTime',_0x8867('0x58'),_0x8867('0x59'),_0x8867('0x5a'),'screenrecording',_0x8867('0x5b'),_0x8867('0x5c'),'routealias'];var _0x309ab6=[_0x8867('0x4'),_0x8867('0x6'),'mailPause',_0x8867('0x34'),_0x8867('0x7'),'faxPause',_0x8867('0x10'),_0x8867('0x46')];var _0x556d48=_(_0x2fed2b)[_0x8867('0x5d')](_0x309ab6)[_0x8867('0x5e')](_0x170893)[_0x8867('0x2b')]();return _0x556d48;}exports[_0x8867('0x5f')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index ba14438..4611c48 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 _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 +var _0x1ada=['predictiveIntervalAvgTalktime','request','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','inbound','concat','map','get','loggedInDb','waiting','outbound','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','busy','inUse','notInUse','onHold','talking','unavailable','unknown','originated','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1ada,0x1ce));var _0xa1ad=function(_0x55a915,_0x5a0c85){_0x55a915=_0x55a915-0x0;var _0x30e971=_0x1ada[_0x55a915];return _0x30e971;};'use strict';var _=require(_0xa1ad('0x0'));var jayson=require(_0xa1ad('0x1'));var util=require(_0xa1ad('0x2'));var amiClient=jayson[_0xa1ad('0x3')][_0xa1ad('0x4')]({'port':0x232a});var routingClient=jayson[_0xa1ad('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xa1ad('0x5'),_0xa1ad('0x6'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xa1ad('0x7'),_0xa1ad('0x8'),'invalid','loggedInDb',_0xa1ad('0x9'),_0xa1ad('0xa'),'ringing','ringInUse',_0xa1ad('0xb'),_0xa1ad('0xc'),_0xa1ad('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xa1ad('0xe'),'message',_0xa1ad('0xf'),_0xa1ad('0x10'),_0xa1ad('0x11'),_0xa1ad('0x12'),'startPredictive',_0xa1ad('0x13'),_0xa1ad('0x14'),_0xa1ad('0x15'),_0xa1ad('0x16'),_0xa1ad('0x17'),_0xa1ad('0x18'),'dialPredictiveIntervalMaxThreshold',_0xa1ad('0x19'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xa1ad('0x1a'),_0xa1ad('0x1b'),_0xa1ad('0x1c')];function getRealtimeQueues(_0x48e8b6,_0x20b90b){var _0x281a03=_0x20b90b==='voice'?amiClient:routingClient;return _0x281a03[_0xa1ad('0x1d')](_['startCase'](_0x20b90b)+'Queues',_0x48e8b6)[_0xa1ad('0x1e')](function(_0x4d7e4c){if(_0x4d7e4c[_0xa1ad('0x1f')])throw new Error(util[_0xa1ad('0x20')](_0xa1ad('0x21'),_0x20b90b));return _0x4d7e4c[_0xa1ad('0x22')];})[_0xa1ad('0x23')](function(_0x1ff447){throw _0x1ff447;});}exports[_0xa1ad('0x24')]=getRealtimeQueues;function initializeQueues(_0x15819c,_0x5673d6,_0x1838a7,_0x50a84e){var _0x1a9cff=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1838a7===_0xa1ad('0x25')){if(_0x50a84e===_0xa1ad('0x26')){_0x1a9cff=_0x1a9cff[_0xa1ad('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x50a84e==='outbound'){_0x1a9cff=_0x1a9cff['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x15819c[_0xa1ad('0x28')](function(_0x94d306){var _0x473c60=_0x94d306[_0xa1ad('0x29')]({'plain':!![]});_0x473c60['paused']=0x0;_0x473c60[_0xa1ad('0x2a')]=0x0;_0x473c60[_0xa1ad('0x6')]=0x0;_0x473c60[_0xa1ad('0x5')]=0x0;_0x473c60[_0xa1ad('0x2b')]=0x0;if(_0x1838a7===_0xa1ad('0x25')){_0x473c60[_0xa1ad('0xb')]=0x0;_0x473c60[_0xa1ad('0x7')]=0x0;if(_0x50a84e===_0xa1ad('0x2c')){_0x473c60['pTalking']=0x0;_0x473c60[_0xa1ad('0xe')]=0x0;}}var _0x249faa=_[_0xa1ad('0x2d')](_0x5673d6,['id',_0x473c60['id']]);if(_0x249faa){_[_0xa1ad('0x2e')](_0x473c60,_[_0xa1ad('0x2f')](_0x249faa,_0x1a9cff));}return _0x473c60;});}exports[_0xa1ad('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 479380c..eda738e 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(_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 +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(_0x5e0bfe,_0x747312){var _0x6468b8=function(_0x20e5e0){while(--_0x20e5e0){_0x5e0bfe['push'](_0x5e0bfe['shift']());}};_0x6468b8(++_0x747312);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 d143e27..b8fdb76 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 _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 +var _0xc328=['filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc328,0x13b));var _0x8c32=function(_0x25a084,_0x29e736){_0x25a084=_0x25a084-0x0;var _0x18bba5=_0xc328[_0x25a084];return _0x18bba5;};'use strict';var _=require(_0x8c32('0x0'));var os=require('os');var crypto=require(_0x8c32('0x1'));var machine=require(_0x8c32('0x2'));var exec=require(_0x8c32('0x3'))[_0x8c32('0x4')];var config=require(_0x8c32('0x5'));function getInterfaces(){var _0x1903a3=[];var _0x3e67b0=os[_0x8c32('0x6')]();var _0x5f4678=_[_0x8c32('0x7')](_['keys'](_0x3e67b0));for(var _0x388363=0x0;_0x388363<_0x5f4678[_0x8c32('0x8')];_0x388363++){var _0x42c3b2=_0x3e67b0[_0x5f4678[_0x388363]][_0x8c32('0x9')](function(_0x30e6ea){return _0x30e6ea[_0x8c32('0xa')]===_0x8c32('0xb')&&_0x30e6ea[_0x8c32('0xc')]===![];});_0x1903a3=_0x1903a3[_0x8c32('0xd')](_0x42c3b2);}return _0x1903a3;}function getFirstInterface(){var _0x16296f=_[_0x8c32('0xe')](getInterfaces());return{'macAddress':_0x16296f&&_0x16296f['mac']?_0x16296f['mac']:_0x8c32('0xf'),'ipAddress':_0x16296f&&_0x16296f[_0x8c32('0x10')]?_0x16296f[_0x8c32('0x10')]:_0x8c32('0x11')};}exports[_0x8c32('0x12')]=getFirstInterface;function getCPUhash(){var _0x39e383=_['orderBy'](os[_0x8c32('0x13')]()[_0x8c32('0x14')](function(_0x136c0f){return _0x136c0f[_0x8c32('0x15')];}))['join'](':');return crypto['createHash'](_0x8c32('0x16'))[_0x8c32('0x17')](_0x39e383)[_0x8c32('0x18')]('hex');}exports[_0x8c32('0x19')]=function(){var _0x233b52=os[_0x8c32('0x1a')]();var _0x1c8b10=/[0-9a-f-]{36}/;if(config[_0x8c32('0x1b')]&&_0x1c8b10[_0x8c32('0x1c')](config[_0x8c32('0x1b')])){return config[_0x8c32('0x1b')];}else if(_0x233b52===_0x8c32('0x1d')){return exec(_0x8c32('0x1e'),{'encoding':_0x8c32('0x1f')})[_0x8c32('0x20')]('\x0d\x0a','');}else{var _0x1a75b9=getFirstInterface();var _0x63f7df=getCPUhash();var _0x11d138=_0x63f7df+'|'+os['hostname']()+'|'+_0x1a75b9['macAddress']+'|'+_0x1a75b9[_0x8c32('0x21')];var _0x15b289=crypto['createHash']('md5')[_0x8c32('0x17')](_0x11d138)['digest'](_0x8c32('0x22'));return _0x15b289['substring'](0x0,0x8)+'-'+_0x15b289[_0x8c32('0x23')](0x8,0xc)+'-'+_0x15b289[_0x8c32('0x23')](0xc,0x10)+'-'+_0x15b289['substring'](0x10,0x14)+'-'+_0x15b289[_0x8c32('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 0db785f..dfa71da 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 _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 +var _0xfdd2=['https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data2','data1','then','active','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','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','error','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license'];(function(_0x5f0676,_0xdaf0e4){var _0x1e11ba=function(_0x5a77ff){while(--_0x5a77ff){_0x5f0676['push'](_0x5f0676['shift']());}};_0x1e11ba(++_0xdaf0e4);}(_0xfdd2,0x128));var _0x2fdd=function(_0x530245,_0x1541ab){_0x530245=_0x530245-0x0;var _0x22506d=_0xfdd2[_0x530245];return _0x22506d;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x2fdd('0x0'));var BPromise=require('bluebird');var pkginfo=require(_0x2fdd('0x1'))(module,_0x2fdd('0x2'));var db=require(_0x2fdd('0x3'))['db'];var encryptor=require(_0x2fdd('0x4'));var hardware=require(_0x2fdd('0x5'));var logger=require(_0x2fdd('0x6'))(_0x2fdd('0x7'));var HOST=_0x2fdd('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x33e927){return new BPromise(function(_0x16ad45,_0xb4edc5){var _0x378431=util[_0x2fdd('0x9')](_0x2fdd('0xa'),HOST,_0x33e927,module[_0x2fdd('0xb')]['version']);if(oldToken){_0x378431=util[_0x2fdd('0x9')](_0x2fdd('0xc'),HOST,_0x33e927,module[_0x2fdd('0xb')]['version'],oldToken);}var _0xc11c47={'uri':_0x378431,'method':_0x2fdd('0xd'),'timeout':0xea60,'json':!![]};return rp(_0xc11c47)['then'](function(_0x3c843e){_0x16ad45(_0x3c843e);})[_0x2fdd('0xe')](function(_0x868e85){_0xb4edc5(_0x868e85);});});}function manageLicense(_0x328f7a,_0x5235ec){var _0x46800e=_0x5235ec['get']({'plain':!![]});if(!isOldTokenSent&&_0x46800e['data1']!==_0x328f7a&&!_0x46800e[_0x2fdd('0xf')]){oldToken=_0x46800e[_0x2fdd('0x10')];}httpRequest(_0x328f7a)[_0x2fdd('0x11')](function(_0x73cbcb){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x73cbcb[_0x2fdd('0x12')]){isOldTokenSent=![];if(!_0x46800e[_0x2fdd('0x7')]&&_0x46800e[_0x2fdd('0x7')]!=_0x73cbcb[_0x2fdd('0x7')]||_0x46800e[_0x2fdd('0x7')]&&_0x46800e[_0x2fdd('0xf')]){logger[_0x2fdd('0x13')](_0x2fdd('0x14'));}if(_0x46800e[_0x2fdd('0x7')]&&!_0x46800e['data2']&&_0x46800e['license']!=_0x73cbcb[_0x2fdd('0x7')]){logger[_0x2fdd('0x13')](_0x2fdd('0x15'));}if(_0x46800e['license']&&!_0x46800e[_0x2fdd('0xf')]&&_0x46800e[_0x2fdd('0x7')]==_0x73cbcb[_0x2fdd('0x7')]){return _0x5235ec;}return _0x5235ec[_0x2fdd('0x16')]({'data1':_0x328f7a,'data2':null,'license':_0x73cbcb[_0x2fdd('0x7')]});}else{if(_0x73cbcb[_0x2fdd('0x7')]||_0x46800e[_0x2fdd('0x7')]){if(!_0x46800e[_0x2fdd('0xf')]){if(_0x46800e[_0x2fdd('0x10')]==_0x328f7a){GRAY_PERIOD_REASON=_0x2fdd('0x17');logger[_0x2fdd('0x13')](_0x2fdd('0x18'));}else{GRAY_PERIOD_REASON=_0x2fdd('0x19');logger[_0x2fdd('0x13')](_0x2fdd('0x1a'),_0x46800e['data1'],_0x328f7a);}logger[_0x2fdd('0x13')](_0x2fdd('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x2fdd('0x9')](_0x2fdd('0x1c')));return _0x5235ec[_0x2fdd('0x16')]({'data2':encryptor[_0x2fdd('0x1d')](moment()[_0x2fdd('0x9')](_0x2fdd('0x1c')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x46800e[_0x2fdd('0xf')]),'days')>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x2fdd('0x1c')));isOldTokenSent=![];return _0x5235ec['update']({'data1':_0x328f7a,'data2':null,'license':null});}}}else{if(_0x46800e[_0x2fdd('0x10')]!=_0x328f7a){logger[_0x2fdd('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x46800e[_0x2fdd('0x10')],_0x328f7a);return _0x5235ec[_0x2fdd('0x16')]({'data1':_0x328f7a,'data2':null,'license':null});}}}return _0x5235ec;})[_0x2fdd('0x11')](function(_0x22f733){_0x5235ec=_0x22f733;})['catch'](function(_0x3c5788){logger[_0x2fdd('0x1e')](_0x3c5788['message']);})[_0x2fdd('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x2fdd('0x20')](),_0x5235ec);},TIME);});}function defaultLicense(){var _0x44c85c=hardware[_0x2fdd('0x20')]();if(_0x44c85c){return db[_0x2fdd('0x21')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x44c85c}})[_0x2fdd('0x22')](function(_0x13028f,_0x6e8b49){logger[_0x2fdd('0x13')](_0x2fdd('0x23'),_0x44c85c);manageLicense(_0x44c85c,_0x13028f);})[_0x2fdd('0xe')](function(_0x5d15e8){logger[_0x2fdd('0x1e')](_0x5d15e8[_0x2fdd('0x24')]);});}}exports[_0x2fdd('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 62c9500..bee7ea1 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 _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 +var _0x682b=['sequelize','COUNT','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','moment','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','gray','deadline','add','days','grayReason','machineUuid','changed','message','findAll','role'];(function(_0xbbebbf,_0x5c4820){var _0x2fba5a=function(_0x3026b4){while(--_0x3026b4){_0xbbebbf['push'](_0xbbebbf['shift']());}};_0x2fba5a(++_0x5c4820);}(_0x682b,0x1da));var _0xb682=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x682b[_0x7e2eb0];return _0xd92de4;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xb682('0x0'));var BPromise=require('bluebird');var hardware=require(_0xb682('0x1'));var encryptor=require(_0xb682('0x2'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb682('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xb682('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb682('0x5'),'machineUuid':hardware[_0xb682('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x18b87f){return new BPromise(function(_0x2e622c,_0x24de2f){return db[_0xb682('0x6')][_0xb682('0x7')](_[_0xb682('0x8')](_0x18b87f,{'raw':!![],'where':{'id':0x1}}))[_0xb682('0x9')](function(_0xbf3710){return checkLicense(_0xbf3710,null);})['then'](function(_0x68aac7){_0x2e622c(_0x68aac7);return;})[_0xb682('0xa')](function(_0x1f7cd3){_0x24de2f(_0x1f7cd3);});});}function checkLicense(_0x24f0d4,_0x240a5a){if(!_0x24f0d4){demoLicense[_0xb682('0xb')]=_0x24f0d4[_0xb682('0xc')];return demoLicense;}try{var _0x39858b=_0x240a5a||_0x24f0d4[_0xb682('0xd')];if(_[_0xb682('0xe')](_0x39858b)){throw new Error(_0xb682('0xf'));}var _0x740af=_0x24f0d4[_0xb682('0xc')];var _0x50f655=_0x24f0d4[_0xb682('0x10')];var _0x49e8ec=_0x740af[_0xb682('0x11')]('-')[0x4];var _0x3bb819=_0x740af[_0xb682('0x11')]('-')[0x0];var _0x200ff5=encryptor[_0xb682('0x12')](_0x39858b,util[_0xb682('0x13')](_0xb682('0x14'),_0x49e8ec,_0x740af,_0x3bb819));var _0xf030cf=JSON['parse'](_0x200ff5);_0xf030cf[_0xb682('0x15')]=![];_0xf030cf[_0xb682('0xb')]=_0x740af;_0xf030cf['machineUuid']=hardware['getUuid']();if(_0x50f655){var _0xbb6eca=encryptor[_0xb682('0x12')](_0x50f655);_0xf030cf[_0xb682('0x16')]=_0xbb6eca;_0xf030cf[_0xb682('0x17')]=moment(_0xbb6eca)[_0xb682('0x18')](0x7,_0xb682('0x19'))[_0xb682('0x13')]();_0xf030cf[_0xb682('0x1a')]=_0xf030cf[_0xb682('0xb')]!=_0xf030cf[_0xb682('0x1b')]?_0xb682('0x1c'):'disabled';}return _0xf030cf;}catch(_0x32a0e8){breakingLicense['uuid']=_0x24f0d4[_0xb682('0xc')];breakingLicense[_0xb682('0x1d')]=_0x32a0e8[_0xb682('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1a05ba,_0x5bf1d0){getLicense()[_0xb682('0x9')](function(_0x1a2391){return db['User'][_0xb682('0x1e')]({'attributes':[_0xb682('0x1f'),[db[_0xb682('0x20')]['fn'](_0xb682('0x21'),db[_0xb682('0x20')]['col']('role')),_0xb682('0x22')]],'group':_0xb682('0x1f'),'where':{'role':{'$or':[_0xb682('0x23'),_0xb682('0x24'),_0xb682('0x25')]}},'raw':!![]})[_0xb682('0x9')](function(_0x113b88){var _0x3575fb={'user':_0x1a2391[_0xb682('0x26')]||0x0,'telephone':_0x1a2391[_0xb682('0x27')]||0x0};_0x113b88[_0xb682('0x28')](function(_0x22f9ae){var _0x1fbba1=_0x22f9ae[_0xb682('0x1f')]===_0xb682('0x23')?_0xb682('0x24'):_0x22f9ae['role'];_0x3575fb[_0x1fbba1]-=_0x22f9ae[_0xb682('0x22')];if(_0x3575fb[_0x1fbba1]<0x0)_0x3575fb[_0x1fbba1]=0x0;});_0x1a05ba(_0x3575fb);return;});})[_0xb682('0xa')](function(_0xff3fd9){_0x5bf1d0(_0xff3fd9);});});}function checkUserLimits(_0x580217){return new BPromise(function(_0x59ea6b,_0x25befa){getLimits()[_0xb682('0x9')](function(_0x4a1748){var _0x14151b=_[_0xb682('0x29')](_[_0xb682('0x2a')](_0x580217,_0xb682('0x1f')),[_0xb682('0x23'),'user',_0xb682('0x25')]);var _0x17a693=(_0x14151b[_0xb682('0x23')]||0x0)+(_0x14151b[_0xb682('0x24')]||0x0);var _0x250867=_0x14151b[_0xb682('0x25')]||0x0;if(_0x17a693>_0x4a1748[_0xb682('0x24')])return _0x25befa(_0xb682('0x2b'));if(_0x250867>_0x4a1748[_0xb682('0x25')])return _0x25befa(_0xb682('0x2c'));return _0x59ea6b();})['catch'](function(_0xa3e308){_0x25befa(_0xa3e308);});});}module[_0xb682('0x2d')]={'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 49d9a2c..b1167a3 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 _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 +var _0xab40=['http://localhost:9000','exports'];(function(_0xb6f59,_0x240181){var _0x20f32d=function(_0x2104b6){while(--_0x2104b6){_0xb6f59['push'](_0xb6f59['shift']());}};_0x20f32d(++_0x240181);}(_0xab40,0xcd));var _0x0ab4=function(_0x433b61,_0x1eb8df){_0x433b61=_0x433b61-0x0;var _0x4c9a12=_0xab40[_0x433b61];return _0x4c9a12;};'use strict';module[_0x0ab4('0x0')]={'DOMAIN':_0x0ab4('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index fbefead..303f590 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x78e6=['../utils/loggers','exports'];(function(_0x49f2a1,_0x2623e0){var _0x1d0ad3=function(_0x36f38){while(--_0x36f38){_0x49f2a1['push'](_0x49f2a1['shift']());}};_0x1d0ad3(++_0x2623e0);}(_0x78e6,0x122));var _0x678e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x78e6[_0x4a9fb1];return _0x348672;};'use strict';var fileLogger=require(_0x678e('0x0'))['fileLogger'];module[_0x678e('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 8d3089f..c2c84d9 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 _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 +var _0xbef8=['../../services/agi/index.js','email','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x1aa1d3,_0x56eeee){var _0x99c18e=function(_0x52cbe5){while(--_0x52cbe5){_0x1aa1d3['push'](_0x1aa1d3['shift']());}};_0x99c18e(++_0x56eeee);}(_0xbef8,0x17c));var _0x8bef=function(_0x480708,_0x46a37c){_0x480708=_0x480708-0x0;var _0x348a0d=_0xbef8[_0x480708];return _0x348a0d;};'use strict';var path=require(_0x8bef('0x0'));var cfg=require(_0x8bef('0x1'));var env={'NODE_PATH':path[_0x8bef('0x2')](path[_0x8bef('0x3')](cfg[_0x8bef('0x4')],_0x8bef('0x5')))};var pm2config={'apps':[{'name':_0x8bef('0x6'),'script':path[_0x8bef('0x3')](__dirname,_0x8bef('0x7')),'env':env},{'name':_0x8bef('0x8'),'script':path[_0x8bef('0x3')](__dirname,_0x8bef('0x9')),'env':env},{'name':_0x8bef('0xa'),'script':path[_0x8bef('0x3')](__dirname,_0x8bef('0xb')),'env':env},{'name':_0x8bef('0xc'),'script':path[_0x8bef('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0x8bef('0x3')](__dirname,_0x8bef('0xd')),'env':env},{'name':_0x8bef('0xe'),'script':path[_0x8bef('0x3')](__dirname,_0x8bef('0xf')),'env':env}]};module[_0x8bef('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index aea1270..8420401 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 _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 +var _0xa461=['./config','connect','connected','then','start','disconnect','restart','list','describe','delete','dump','pm2'];(function(_0x2493a8,_0x5a240d){var _0x2b06c9=function(_0x198d3c){while(--_0x198d3c){_0x2493a8['push'](_0x2493a8['shift']());}};_0x2b06c9(++_0x5a240d);}(_0xa461,0xb3));var _0x1a46=function(_0x43df6f,_0x4ff749){_0x43df6f=_0x43df6f-0x0;var _0x5373a2=_0xa461[_0x43df6f];return _0x5373a2;};'use strict';var pm2=require(_0x1a46('0x0'));var BPromise=require('bluebird');var config=require(_0x1a46('0x1'));function connect(){return new BPromise(function(_0x1858f4,_0xc5deaf){return pm2[_0x1a46('0x2')](function(_0x2d4944){if(_0x2d4944){return _0xc5deaf(_0x2d4944);}return _0x1858f4(_0x1a46('0x3'));});});};exports['start']=function(_0x153898){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x57600d,_0x3bccb6){return pm2[_0x1a46('0x5')](_0x153898,function(_0x3eb3c4,_0x916173){if(_0x3eb3c4){return _0x3bccb6(_0x3eb3c4);}pm2[_0x1a46('0x6')]();return _0x57600d(_0x916173);});});});};exports['stop']=function(_0x51b9a8){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x2cc947,_0x3bb613){return pm2['stop'](_0x51b9a8,function(_0x530f1b,_0x38c9b0){if(_0x530f1b){return _0x3bb613(_0x530f1b);}pm2[_0x1a46('0x6')]();return _0x2cc947(_0x38c9b0);});});});};exports[_0x1a46('0x7')]=function(_0x476e16){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x285850,_0xa79572){return pm2[_0x1a46('0x7')](_0x476e16,function(_0x4820e8,_0x5cfd79){if(_0x4820e8){return _0xa79572(_0x4820e8);}pm2[_0x1a46('0x6')]();return _0x285850(_0x5cfd79);});});});};exports[_0x1a46('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2ff019,_0x2b9419){return pm2[_0x1a46('0x8')](function(_0x43834b,_0x4af5a1){if(_0x43834b){return _0x2b9419(_0x43834b);}pm2[_0x1a46('0x6')]();return _0x2ff019(_0x4af5a1);});});});};exports[_0x1a46('0x9')]=function(_0x1c21d5){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x5a87f3,_0x28a7fe){return pm2['describe'](_0x1c21d5,function(_0x1dd6b8,_0x515843){if(_0x1dd6b8){return _0x28a7fe(_0x1dd6b8);}pm2['disconnect']();return _0x5a87f3(_0x515843);});});});};exports[_0x1a46('0xa')]=function(_0x15435b){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x4c715a,_0x24a1c3){return pm2[_0x1a46('0xa')](_0x15435b,function(_0x2a5fc8,_0x1e3027){if(_0x2a5fc8){return _0x24a1c3(_0x2a5fc8);}pm2['disconnect']();return _0x4c715a(_0x1e3027);});});});};exports[_0x1a46('0xb')]=function(){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x14295b,_0x5e6154){return pm2[_0x1a46('0xb')](function(_0x20b689){if(_0x20b689){return _0x5e6154(_0x20b689);}return _0x14295b('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 58c425d..97292c7 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 _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 +var _0xf5a0=['[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch'];(function(_0x3ce17e,_0x9aa616){var _0x251a99=function(_0x1f0aaf){while(--_0x1f0aaf){_0x3ce17e['push'](_0x3ce17e['shift']());}};_0x251a99(++_0x9aa616);}(_0xf5a0,0x69));var _0x0f5a=function(_0x4cd685,_0x472697){_0x4cd685=_0x4cd685-0x0;var _0x37743e=_0xf5a0[_0x4cd685];return _0x37743e;};'use strict';var _=require(_0x0f5a('0x0'));var moment=require(_0x0f5a('0x1'));var Redis=require(_0x0f5a('0x2'));var util=require(_0x0f5a('0x3'));var config=require('../../config/environment');var db=require(_0x0f5a('0x4'))['db'];var logger=require(_0x0f5a('0x5'))(_0x0f5a('0x6'));config['redis']=_[_0x0f5a('0x7')](config[_0x0f5a('0x8')],{'host':_0x0f5a('0x9'),'port':0x18eb});var io=require(_0x0f5a('0xa'))(new Redis(config[_0x0f5a('0x8')]));function closeInteractions(){var _0x1533e5=0x0;var _0x267678=[];return db[_0x0f5a('0xb')][_0x0f5a('0xc')]({'raw':!![],'attributes':['id',_0x0f5a('0xd')],'where':{'id':0x1}})[_0x0f5a('0xe')](function(_0x294efa){_0x1533e5=_0x294efa[_0x0f5a('0xd')];if(_0x1533e5){return db[_0x0f5a('0xf')][_0x0f5a('0x10')]({'raw':!![],'attributes':['id',_0x0f5a('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0f5a('0x12')](_0x294efa[_0x0f5a('0xd')],'minutes')}}});}else{return[];}})[_0x0f5a('0xe')](function(_0x24d715){if(_0x24d715&&_0x24d715['length']){_0x267678=_[_0x0f5a('0x13')](_0x24d715||[],'id');logger[_0x0f5a('0x14')](_0x0f5a('0x15'),_0x267678[_0x0f5a('0x16')]());return db[_0x0f5a('0xf')][_0x0f5a('0x17')]({'closeReason':_0x0f5a('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x0f5a('0x19')](_0x0f5a('0x1a'))},{'where':{'id':_0x267678}});}})['then'](function(){if(_0x267678&&_0x267678[_0x0f5a('0x1b')]){logger[_0x0f5a('0x14')](_0x0f5a('0x1c'),_0x267678[_0x0f5a('0x16')]());for(var _0x9014c2=0x0;_0x9014c2<_0x267678['length'];_0x9014c2++){io['emit'](_0x0f5a('0x1d'),{'id':_0x267678[_0x9014c2],'closed':!![]});}}})[_0x0f5a('0x1e')](function(_0x31246d){logger['error'](_0x0f5a('0x1f'),_0x31246d?util[_0x0f5a('0x20')](_0x31246d,{'showHidden':![],'depth':null}):'');});}exports[_0x0f5a('0x21')]=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 ddb5af5..dd4cd8e 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +var _0x96de=['startAllRefreshIntervals','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x96de,0x8c));var _0xe96d=function(_0x1254b4,_0x13b275){_0x1254b4=_0x1254b4-0x0;var _0x2de247=_0x96de[_0x1254b4];return _0x2de247;};'use strict';function start(){var _0x5a223b=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x5a223b[_0xe96d('0x0')]();}module[_0xe96d('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 6568bd0..b06b1ac 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 _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 +var _0x61ec=['active','isBetween','startAt','add','add\x20cron','exists','stop\x20cron','start','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','user','bcc','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','stringify','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','toString','keyBy','difference','intersection','length','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron'];(function(_0x3b371d,_0x2cdf47){var _0x2227f2=function(_0x395806){while(--_0x395806){_0x3b371d['push'](_0x3b371d['shift']());}};_0x2227f2(++_0x2cdf47);}(_0x61ec,0xb0));var _0xc61e=function(_0x209238,_0x43cc6b){_0x209238=_0x209238-0x0;var _0x3de0e0=_0x61ec[_0x209238];return _0x3de0e0;};'use strict';var fs=require('fs');var util=require(_0xc61e('0x0'));var path=require(_0xc61e('0x1'));var _=require(_0xc61e('0x2'));var moment=require(_0xc61e('0x3'));var CronJobManager=require(_0xc61e('0x4'));var jayson=require(_0xc61e('0x5'));var BPromise=require('bluebird');var logger=require(_0xc61e('0x6'))('schedule');var db=require(_0xc61e('0x7'))['db'];var analyticCustomReportController=require(_0xc61e('0x8'));var analyticDefaultReportController=require(_0xc61e('0x9'));var client=jayson[_0xc61e('0xa')][_0xc61e('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2bd629,_0x108698){return function(){logger[_0xc61e('0xc')](_0xc61e('0xd'),_0x2bd629[_0xc61e('0xe')]);var _0xb35f52=!![];var _0x155e37=_0x2bd629[_0xc61e('0xf')][_0xc61e('0x10')]();var _0x5f2e1a={'account':_0x155e37,'message':{'from':util[_0xc61e('0x11')](_0xc61e('0x12'),_0x2bd629[_0xc61e('0xf')][_0xc61e('0x13')],_0x2bd629['MailAccount'][_0xc61e('0xe')]||_0x2bd629['MailAccount']['Smtp'][_0xc61e('0x14')]),'to':_0x2bd629[_0xc61e('0xe')],'cc':_0x2bd629['cc'],'bcc':_0x2bd629[_0xc61e('0x15')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x108698['name'],_0x2bd629[_0xc61e('0x16')],_0x2bd629[_0xc61e('0x17')])}};var _0x4a8f84=path[_0xc61e('0x18')](__dirname,'../../files/reports');var _0x242d72=_0x108698[_0xc61e('0x19')];var _0x33c2f4=util[_0xc61e('0x11')](_0xc61e('0x1a'),path[_0xc61e('0x1b')](_0x108698[_0xc61e('0x19')],path[_0xc61e('0x1c')](_0x108698[_0xc61e('0x19')])),_0xc61e('0x1d'));var _0x2cb8f=path[_0xc61e('0x18')](_0x4a8f84,_0x242d72);var _0x59197f=path['join'](_0x4a8f84,_0x33c2f4);if(fs[_0xc61e('0x1e')](_0x2cb8f)){_0x108698[_0xc61e('0x1f')]=_0xc61e('0x20');_0x5f2e1a[_0xc61e('0x21')][_0xc61e('0x22')]=[{'filename':_0x242d72,'path':_0x2cb8f}];_0x5f2e1a[_0xc61e('0x21')]['text']=util[_0xc61e('0x11')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xc61e('0x23')](_0x108698,null,0x2));}else if(fs[_0xc61e('0x1e')](_0x59197f)){_0x108698[_0xc61e('0x1f')]=_0xc61e('0x20');_0x5f2e1a[_0xc61e('0x21')]['attachments']=[{'filename':_0x33c2f4,'path':_0x59197f}];}else{_0x5f2e1a[_0xc61e('0x21')][_0xc61e('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2bd629[_0xc61e('0x25')]){_0xb35f52=![];logger[_0xc61e('0xc')](_0xc61e('0x26'));}}if(_0xb35f52){return client[_0xc61e('0x27')]('SendMail',_0x5f2e1a)['then'](function(_0x41312e){if(_0x41312e['error']){return logger[_0xc61e('0x28')](_0xc61e('0x29'),JSON[_0xc61e('0x23')](_0x41312e));}return logger[_0xc61e('0xc')](_0xc61e('0x2a'));})[_0xc61e('0x2b')](function(_0x335ca8){return logger['error'](_0xc61e('0x29'),JSON[_0xc61e('0x23')](_0x335ca8));});}};}function handleError(){return function(_0x455600){return logger[_0xc61e('0x28')](JSON[_0xc61e('0x23')](_0x455600));};}function handleResult(_0x4a0abc){return function(_0xf246b1){logger[_0xc61e('0xc')](_0xc61e('0x2c'),JSON[_0xc61e('0x23')](_0xf246b1));if(_0x4a0abc['MailAccount']&&_0x4a0abc['MailAccount'][_0xc61e('0x2d')]&&!_[_0xc61e('0x2e')](_0x4a0abc[_0xc61e('0xe')])){setTimeout(handleSendEmail(_0x4a0abc,_0xf246b1),0x3c*0x3e8);}};}function handleJob(_0x2f1839){return function(){try{if(_[_0xc61e('0x2e')](_0x2f1839['subtractNumber'])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x2f1839[_0xc61e('0x17')])){return logger[_0xc61e('0xc')](_0xc61e('0x2f'));}var _0x5ecc62={'startDate':moment()[_0xc61e('0x30')](_0x2f1839[_0xc61e('0x16')],_0x2f1839[_0xc61e('0x17')])[_0xc61e('0x11')](_0xc61e('0x31')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xc61e('0x32'),'output':_0x2f1839[_0xc61e('0x33')],'name':_0x2f1839[_0xc61e('0x13')]};if(!_[_0xc61e('0x2e')](_0x2f1839[_0xc61e('0x34')])){logger[_0xc61e('0xc')](_0xc61e('0x35'),_0x2f1839[_0xc61e('0x34')]);return analyticDefaultReportController[_0xc61e('0x36')]({'id':_0x2f1839[_0xc61e('0x34')]},_0x5ecc62)[_0xc61e('0x37')](handleResult(_0x2f1839))['catch'](handleError());}if(!_[_0xc61e('0x2e')](_0x2f1839['CustomReportId'])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x2f1839['CustomReportId']);return analyticCustomReportController[_0xc61e('0x36')]({'id':_0x2f1839[_0xc61e('0x38')]},_0x5ecc62)[_0xc61e('0x37')](handleResult(_0x2f1839))['catch'](handleError());}}catch(_0x11128d){logger[_0xc61e('0x28')](JSON['stringify'](_0x11128d));}return logger[_0xc61e('0xc')](_0xc61e('0x39'));};}function getJobs(_0x588b64){var _0x446076={};if(_0x588b64){_0x446076['id']=_0x588b64;}return db[_0xc61e('0x3a')][_0xc61e('0x3b')]({'where':_0x446076,'include':[{'model':db[_0xc61e('0xf')],'attributes':['id',_0xc61e('0x13'),_0xc61e('0xe')],'include':[{'model':db[_0xc61e('0x3c')],'as':'Smtp','include':[{'model':db[_0xc61e('0x3d')],'as':_0xc61e('0x3d')}]}]}]})[_0xc61e('0x37')](function(_0x560a04){var _0x511a93=_['keys'](manager[_0xc61e('0x3e')]);var _0x2d64ce=_['map'](_0x560a04,function(_0x1478f0){return _0x1478f0['id'][_0xc61e('0x3f')]();});var _0x1447ea=_[_0xc61e('0x40')](_0x560a04,function(_0xc01ffd){return _0xc01ffd['id']['toString']();});var _0x1511f6=_0x588b64?_0x2d64ce:_[_0xc61e('0x41')](_0x2d64ce,_0x511a93);var _0x24f1a4=_[_0xc61e('0x42')](_0x2d64ce,_0x511a93);var _0xbbd33c=_[_0xc61e('0x41')](_0x511a93,_0x2d64ce);var _0x1054e4;var _0x363ee1;for(_0x1054e4=0x0;_0x1054e4<_0xbbd33c[_0xc61e('0x43')]&&!_0x588b64;_0x1054e4+=0x1){_0x363ee1=_0xbbd33c[_0x1054e4][_0xc61e('0x3f')]();if(manager['exists'](_0x363ee1)){manager[_0xc61e('0x44')](_0x363ee1);manager[_0xc61e('0x45')](_0x363ee1);logger[_0xc61e('0xc')]('delete\x20cron',_0x363ee1);}}logger['info'](_0xc61e('0x46'),JSON['stringify'](_0x1511f6));for(_0x1054e4=0x0;_0x1054e4<_0x1511f6['length'];_0x1054e4+=0x1){_0x363ee1=_0x1511f6[_0x1054e4]['toString']();logger[_0xc61e('0xc')](_0xc61e('0x47'),_0x363ee1);if(_0x588b64){logger[_0xc61e('0xc')](_0xc61e('0x48'),_0x588b64);logger[_0xc61e('0xc')](JSON[_0xc61e('0x23')](_0x1447ea[_0x363ee1]));BPromise[_0xc61e('0x49')]()[_0xc61e('0x37')](handleJob(_0x1447ea[_0x363ee1]));logger[_0xc61e('0xc')](_0xc61e('0x4a'),_0x1447ea[_0x363ee1][_0xc61e('0x13')],_0x1447ea[_0x363ee1][_0xc61e('0x4b')]);}else if(_0x1447ea[_0x363ee1][_0xc61e('0x4b')]&&_0x1447ea[_0x363ee1][_0xc61e('0x4c')]&&moment()[_0xc61e('0x4d')](_0x1447ea[_0x363ee1][_0xc61e('0x4e')],_0x1447ea[_0x363ee1]['endAt'])){manager[_0xc61e('0x4f')](_0x363ee1,_0x1447ea[_0x363ee1][_0xc61e('0x4b')],handleJob(_0x1447ea[_0x363ee1]));manager['start'](_0x363ee1);logger['info'](_0xc61e('0x50'),_0x1447ea[_0x363ee1]['name'],_0x1447ea[_0x363ee1][_0xc61e('0x4b')]);}else if(manager[_0xc61e('0x51')](_0x363ee1)){manager[_0xc61e('0x44')](_0x363ee1);manager['deleteJob'](_0x363ee1);logger[_0xc61e('0xc')](_0xc61e('0x52'),_0x1447ea[_0x363ee1][_0xc61e('0x13')],_0x1447ea[_0x363ee1][_0xc61e('0x4b')]);}}for(_0x1054e4=0x0,_0x363ee1;_0x1054e4<_0x24f1a4['length']&&!_0x588b64;_0x1054e4+=0x1){_0x363ee1=_0x24f1a4[_0x1054e4][_0xc61e('0x3f')]();if(manager['exists'](_0x363ee1)){if(_0x1447ea[_0x363ee1][_0xc61e('0x4b')]&&_0x1447ea[_0x363ee1][_0xc61e('0x4c')]&&moment()['isBetween'](_0x1447ea[_0x363ee1]['startAt'],_0x1447ea[_0x363ee1]['endAt'])){manager['update'](_0x363ee1,_0x1447ea[_0x363ee1][_0xc61e('0x4b')],handleJob(_0x1447ea[_0x363ee1]));logger['info']('update\x20cron',_0x1447ea[_0x363ee1]['name'],_0x1447ea[_0x363ee1][_0xc61e('0x4b')]);}else{manager[_0xc61e('0x44')](_0x363ee1);manager['deleteJob'](_0x363ee1);logger[_0xc61e('0xc')](_0xc61e('0x52'),_0x1447ea[_0x363ee1][_0xc61e('0x13')],_0x1447ea[_0x363ee1][_0xc61e('0x4b')]);}}}})['catch'](function(_0x41582e){logger[_0xc61e('0x28')](JSON[_0xc61e('0x23')](_0x41582e));});}exports['run']=function(_0x59e196){return getJobs(_0x59e196);};exports[_0xc61e('0x53')]=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 c784f13..7b9826d 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 _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 +var _0x4483=['data1','Cloud\x20Provider\x20not\x20configured','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','all','catch','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','sentimentAccountId','CloudProvider','then'];(function(_0x5c1345,_0x40116e){var _0x1c070d=function(_0x1e862f){while(--_0x1e862f){_0x5c1345['push'](_0x5c1345['shift']());}};_0x1c070d(++_0x40116e);}(_0x4483,0x1a3));var _0x3448=function(_0x19b0e9,_0x542840){_0x19b0e9=_0x19b0e9-0x0;var _0x19748d=_0x4483[_0x19b0e9];return _0x19748d;};var _=require(_0x3448('0x0'));var AWS=require(_0x3448('0x1'));var rp=require(_0x3448('0x2'));var util=require('util');var BPromise=require(_0x3448('0x3'));var db=require(_0x3448('0x4'))['db'];var logger=require(_0x3448('0x5'))(_0x3448('0x6'));function getTranscriptionJob(_0xef1a93,_0x5f5163,_0xeb5b8,_0x6a89b){return new Promise(function(_0x1b05db,_0xd3606d){var _0x1bb7e5=new AWS[(_0x3448('0x7'))]({'accessKeyId':_0x5f5163,'secretAccessKey':_0xef1a93,'region':_0xeb5b8});_0x1bb7e5[_0x3448('0x8')]({'TranscriptionJobName':_0x6a89b},function(_0x34b926,_0x5923ee){if(_0x34b926){return _0xd3606d(_0x34b926);}else{return _0x1b05db(_0x5923ee);}});});}function sentiment(_0x5c82c6,_0x46b1ee,_0x25c152,_0xc36409,_0x6f82ca){return new Promise(function(_0x3f4364,_0x1e645a){var _0x2bdf02=new AWS[(_0x3448('0x9'))]({'accessKeyId':_0x46b1ee,'secretAccessKey':_0x5c82c6,'region':_0x25c152});_0x2bdf02[_0x3448('0xa')]({'Text':_0xc36409,'LanguageCode':_0x6f82ca[_0x3448('0xb')](0x0,0x2)},function(_0x2a6048,_0x481a6f){if(_0x2a6048){return _0x1e645a(_0x2a6048);}else{return _0x3f4364(_0x481a6f);}});});}function checkTranscribeJob(_0x5bf09e,_0x298ae6,_0x38fbb1){var _0x5f52bd;return new BPromise(function(_0x2661e1,_0xdfb89d){logger[_0x3448('0xc')](util['format'](_0x3448('0xd'),_0x5bf09e['id'],_0x5bf09e[_0x3448('0xe')]));return getTranscriptionJob(_0x38fbb1['data1'],_0x38fbb1[_0x3448('0xf')],_0x298ae6[_0x3448('0x10')],_0x5bf09e[_0x3448('0xe')])['then'](function(_0x472518){logger[_0x3448('0xc')](util[_0x3448('0x11')](_0x3448('0x12'),_0x5bf09e['id'],_0x5bf09e[_0x3448('0xe')],_0x472518[_0x3448('0x13')][_0x3448('0x14')]));if(!_0x5bf09e[_0x3448('0x15')]){switch(_0x472518['TranscriptionJob'][_0x3448('0x14')]){case'COMPLETED':var _0x48f94a={'transcribeStatus':_0x472518['TranscriptionJob'][_0x3448('0x14')],'fileUri':_0x472518[_0x3448('0x13')][_0x3448('0x16')]['TranscriptFileUri']};logger[_0x3448('0xc')](util[_0x3448('0x11')](_0x3448('0x17'),_0x5bf09e['id']));return rp({'uri':_0x472518[_0x3448('0x13')][_0x3448('0x16')][_0x3448('0x18')],'json':!![]})['then'](function(_0x54c7ee){logger['info'](util[_0x3448('0x11')](_0x3448('0x19'),_0x5bf09e['id']));if(_0x54c7ee&&_0x54c7ee['results']&&_0x54c7ee['results'][_0x3448('0x1a')]&&_0x54c7ee[_0x3448('0x1b')][_0x3448('0x1a')][_0x3448('0x1c')]){_0x48f94a[_0x3448('0x15')]='';for(var _0x566ff5=0x0;_0x566ff5<_0x54c7ee[_0x3448('0x1b')][_0x3448('0x1a')][_0x3448('0x1c')];_0x566ff5++){_0x48f94a[_0x3448('0x15')]+=_0x54c7ee[_0x3448('0x1b')]['transcripts'][_0x566ff5][_0x3448('0x1d')]+'';}}return _0x5bf09e[_0x3448('0x1e')](_0x48f94a);})['then'](function(){logger[_0x3448('0xc')](util[_0x3448('0x11')](_0x3448('0x1f'),_0x5bf09e['id']));if(!_0x5bf09e[_0x3448('0x20')]){throw new db[(_0x3448('0x21'))][(_0x3448('0x22'))](_0x3448('0x23'));}if(!_0x298ae6[_0x3448('0x24')]||!_0x298ae6['sentimentAccountId']||!_0x298ae6[_0x3448('0x25')]||!_0x298ae6[_0x3448('0x26')]||!_0x298ae6[_0x3448('0x27')]){throw new db['Sequelize'][(_0x3448('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x48f94a['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x298ae6[_0x3448('0x28')]===_0x38fbb1['id']){return _0x38fbb1;}else{return db[_0x3448('0x29')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3448('0x2a')](function(_0x37ceac){if(!_0x37ceac){throw new db[(_0x3448('0x21'))][(_0x3448('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x37ceac[_0x3448('0x2b')]||!_0x37ceac[_0x3448('0xf')]){throw new db[(_0x3448('0x21'))]['ValidationError'](_0x3448('0x2c'));}_0x5f52bd=_0x37ceac;logger[_0x3448('0xc')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5bf09e['id']));return sentiment(_0x5f52bd[_0x3448('0x2b')],_0x5f52bd[_0x3448('0xf')],_0x298ae6[_0x3448('0x25')],_0x48f94a[_0x3448('0x15')],_0x298ae6['language']);})[_0x3448('0x2a')](function(_0x36291e){logger[_0x3448('0xc')](util[_0x3448('0x11')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5bf09e['id']));return _0x5bf09e[_0x3448('0x1e')]({'sentiment':_0x36291e[_0x3448('0x2d')],'sPositive':_0x36291e['SentimentScore'][_0x3448('0x2e')],'sNegative':_0x36291e[_0x3448('0x2f')][_0x3448('0x30')],'sMixed':_0x36291e[_0x3448('0x2f')][_0x3448('0x31')],'sNeutral':_0x36291e[_0x3448('0x2f')][_0x3448('0x32')]});})[_0x3448('0x2a')](function(){logger[_0x3448('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5bf09e['id']));_0x2661e1();});case _0x3448('0x33'):return _0x5bf09e['update']({'transcribeStatus':_0x3448('0x33'),'failureReason':_0x472518[_0x3448('0x13')][_0x3448('0x34')]})[_0x3448('0x2a')](function(){logger['info'](util[_0x3448('0x11')](_0x3448('0x1f'),_0x5bf09e['id']));_0x2661e1();});default:logger[_0x3448('0xc')](util[_0x3448('0x11')](_0x3448('0x35'),_0x5bf09e['id']));break;}}else{return BPromise[_0x3448('0x36')]()[_0x3448('0x2a')](function(){if(!_0x5bf09e[_0x3448('0x20')]){throw new db[(_0x3448('0x21'))]['ValidationError'](_0x3448('0x23'));}if(!_0x298ae6[_0x3448('0x24')]||!_0x298ae6[_0x3448('0x28')]||!_0x298ae6[_0x3448('0x25')]||!_0x298ae6[_0x3448('0x26')]||!_0x298ae6['bucket']){throw new db[(_0x3448('0x21'))][(_0x3448('0x22'))](_0x3448('0x37'));}if(!_0x5bf09e[_0x3448('0x15')]){throw new Error(_0x3448('0x38'));}if(_0x298ae6[_0x3448('0x28')]===_0x38fbb1['id']){return _0x38fbb1;}else{return db[_0x3448('0x29')][_0x3448('0x39')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3448('0x2a')](function(_0x3d96be){if(!_0x3d96be){throw new db[(_0x3448('0x21'))]['ValidationError'](_0x3448('0x3a'));}if(!_0x3d96be[_0x3448('0x2b')]||!_0x3d96be[_0x3448('0xf')]){throw new db[(_0x3448('0x21'))][(_0x3448('0x22'))](_0x3448('0x2c'));}_0x5f52bd=_0x3d96be;logger[_0x3448('0xc')](util['format'](_0x3448('0x3b'),_0x5bf09e['id']));return sentiment(_0x5f52bd[_0x3448('0x2b')],_0x5f52bd[_0x3448('0xf')],_0x298ae6[_0x3448('0x25')],_0x5bf09e[_0x3448('0x15')],_0x298ae6[_0x3448('0x26')]);})['then'](function(_0xcd75af){logger['info'](util['format'](_0x3448('0x3c'),_0x5bf09e['id']));return _0x5bf09e[_0x3448('0x1e')]({'sentiment':_0xcd75af['Sentiment'],'sPositive':_0xcd75af[_0x3448('0x2f')][_0x3448('0x2e')],'sNegative':_0xcd75af['SentimentScore'][_0x3448('0x30')],'sMixed':_0xcd75af[_0x3448('0x2f')]['Mixed'],'sNeutral':_0xcd75af[_0x3448('0x2f')][_0x3448('0x32')],'transcribeStatus':_0x3448('0x3d')});})[_0x3448('0x2a')](function(){logger[_0x3448('0xc')](util[_0x3448('0x11')](_0x3448('0x1f'),_0x5bf09e['id']));_0x2661e1();});}})['catch'](function(_0x5791fe){if(_0x5791fe){if(!_0x5791fe[_0x3448('0x3e')]||_0x5791fe[_0x3448('0x3e')]!==_0x3448('0x3f')){logger[_0x3448('0x40')](util['format'](_0x3448('0x41'),_0x5bf09e['id']),util[_0x3448('0x42')](_0x5791fe,{'showHidden':![],'depth':null}));}}_0x2661e1();});});}function checkTranscribe(){var _0x248925;var _0x2d55b6;var _0x363374;return db['VoiceRecording'][_0x3448('0x43')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x3448('0x2a')](function(_0x31787c){if(!_0x31787c||!_0x31787c['length']){throw new db[(_0x3448('0x21'))][(_0x3448('0x22'))](_0x3448('0x44'));}_0x248925=_0x31787c;return db[_0x3448('0x45')][_0x3448('0x39')]({'where':{'id':0x1}});})[_0x3448('0x2a')](function(_0xc769e1){if(!_0xc769e1){throw new db['Sequelize'][(_0x3448('0x22'))](_0x3448('0x46'));}_0x2d55b6=_0xc769e1;if(!_0x2d55b6['transcribe']||!_0x2d55b6['transcribeAccountId']||!_0x2d55b6[_0x3448('0x10')]||!_0x2d55b6[_0x3448('0x26')]||!_0x2d55b6['bucket']){throw new db['Sequelize'][(_0x3448('0x22'))](_0x3448('0x47'));}return db[_0x3448('0x29')][_0x3448('0x39')]({'where':{'id':_0x2d55b6[_0x3448('0x48')]}});})[_0x3448('0x2a')](function(_0x2aea70){if(!_0x2aea70){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2aea70[_0x3448('0x2b')]||!_0x2aea70[_0x3448('0xf')]){throw new db['Sequelize'][(_0x3448('0x22'))](_0x3448('0x2c'));}_0x363374=_0x2aea70;var _0x5a4cde=[];_0x248925[_0x3448('0x49')](function(_0x93669){_0x5a4cde['push'](checkTranscribeJob(_0x93669,_0x2d55b6,_0x363374));});return BPromise[_0x3448('0x4a')](_0x5a4cde);})[_0x3448('0x4b')](function(_0x1bfa93){if(_0x1bfa93){if(!_0x1bfa93[_0x3448('0x3e')]||_0x1bfa93[_0x3448('0x3e')]!==_0x3448('0x3f')){logger[_0x3448('0x40')](util[_0x3448('0x42')](_0x1bfa93,{'showHidden':![],'depth':null}));}}});}exports[_0x3448('0x4c')]=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 364b538..d79d704 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 _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 +var _0x8f18=['defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','../../config/environment','../../mysqldb','schedule','redis'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8f18,0x108));var _0x88f1=function(_0x51058f,_0x28dde0){_0x51058f=_0x51058f-0x0;var _0x25e307=_0x8f18[_0x51058f];return _0x25e307;};'use strict';var _=require(_0x88f1('0x0'));var moment=require(_0x88f1('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x88f1('0x2'));var db=require(_0x88f1('0x3'))['db'];var logger=require('../logger')(_0x88f1('0x4'));config[_0x88f1('0x5')]=_[_0x88f1('0x6')](config[_0x88f1('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x88f1('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x10e421=[];return db[_0x88f1('0x8')][_0x88f1('0x9')]({'raw':!![],'attributes':['id',_0x88f1('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x88f1('0xb')](0x18,_0x88f1('0xc'))}}})['then'](function(_0x24d3ef){if(_0x24d3ef&&_0x24d3ef[_0x88f1('0xd')]){_0x10e421=_[_0x88f1('0xe')](_0x24d3ef||[],'id');logger[_0x88f1('0xf')](_0x88f1('0x10'),_0x10e421[_0x88f1('0x11')]());return db[_0x88f1('0x8')][_0x88f1('0x12')]({'closeReason':_0x88f1('0x13'),'disposition':_0x88f1('0x14'),'closed':!![],'closedAt':moment()[_0x88f1('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x10e421}});}})[_0x88f1('0x16')](function(){if(_0x10e421&&_0x10e421[_0x88f1('0xd')]){logger[_0x88f1('0xf')](_0x88f1('0x17'),_0x10e421[_0x88f1('0x11')]());for(var _0xa7ca97=0x0;_0xa7ca97<_0x10e421[_0x88f1('0xd')];_0xa7ca97++){io[_0x88f1('0x18')](_0x88f1('0x19'),{'id':_0x10e421[_0xa7ca97],'closed':!![]});}}})[_0x88f1('0x1a')](function(_0x59ebb1){logger[_0x88f1('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x59ebb1?util[_0x88f1('0x1c')](_0x59ebb1,{'showHidden':![],'depth':null}):'');});}exports[_0x88f1('0x1d')]=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 a17550a..ec4cf56 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xd665=['now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts2','CmHopper','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x26c903,_0x110b4d){var _0x5dfdbe=function(_0x35c183){while(--_0x35c183){_0x26c903['push'](_0x26c903['shift']());}};_0x5dfdbe(++_0x110b4d);}(_0xd665,0x1cd));var _0x5d66=function(_0x43d41a,_0x267d65){_0x43d41a=_0x43d41a-0x0;var _0x45969c=_0xd665[_0x43d41a];return _0x45969c;};'use strict';var util=require(_0x5d66('0x0'));var db=require(_0x5d66('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5d66('0x2')]({'id':i,'firstName':_0x5d66('0x3')+i,'lastName':_0x5d66('0x4')+i,'phone':0xf879fb460+i,'email':_0x5d66('0x5')+i+_0x5d66('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5d66('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x5d66('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5d66('0x7')](),'updatedAt':Date[_0x5d66('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5d66('0x2')]({'id':i,'firstName':_0x5d66('0x3')+i,'lastName':_0x5d66('0x4')+i,'phone':0xf879fb460+i,'email':_0x5d66('0x5')+i+_0x5d66('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5d66('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x5d66('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x5d66('0x7')]()});}db[_0x5d66('0x8')][_0x5d66('0x9')]({'where':{}})[_0x5d66('0xa')](function(){return db[_0x5d66('0x8')][_0x5d66('0xb')](contacts);})[_0x5d66('0xa')](function(){console[_0x5d66('0xc')](_0x5d66('0xd'),'contacts1');return db['CmHopper'][_0x5d66('0x9')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x5d66('0xb')](hopper);})[_0x5d66('0xa')](function(){console[_0x5d66('0xc')](_0x5d66('0xd'),'hopper1');return db[_0x5d66('0x8')][_0x5d66('0xb')](contacts2);})[_0x5d66('0xa')](function(){console[_0x5d66('0xc')](_0x5d66('0xd'),_0x5d66('0xe'));return db[_0x5d66('0xf')][_0x5d66('0xb')](hopper2);})[_0x5d66('0xa')](function(){console[_0x5d66('0xc')](_0x5d66('0xd'),_0x5d66('0x10'));})[_0x5d66('0x11')](function(_0x2d5016){console[_0x5d66('0xc')](_0x2d5016);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index abfcbeb..5d3d091 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xcc87=['format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','add\x20user','catch','log','util','../mysqldb','push'];(function(_0x227e24,_0x573dd6){var _0x2ccc99=function(_0x177963){while(--_0x177963){_0x227e24['push'](_0x227e24['shift']());}};_0x2ccc99(++_0x573dd6);}(_0xcc87,0x189));var _0x7cc8=function(_0x579200,_0x3a9f46){_0x579200=_0x579200-0x0;var _0x212840=_0xcc87[_0x579200];return _0x212840;};'use strict';var util=require(_0x7cc8('0x0'));var db=require(_0x7cc8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7cc8('0x2')]({'name':util[_0x7cc8('0x3')](_0x7cc8('0x4'),_0x7cc8('0x5'),i),'fullname':util[_0x7cc8('0x3')]('%s%s',_0x7cc8('0x5'),i),'email':util[_0x7cc8('0x3')](_0x7cc8('0x6'),_0x7cc8('0x5'),i),'role':_0x7cc8('0x5'),'password':_0x7cc8('0x7'),'internal':0xfa0+i,'type':_0x7cc8('0x8'),'transport':[_0x7cc8('0x9'),'ws',_0x7cc8('0xa')],'disallow':[_0x7cc8('0xb')],'allow':[_0x7cc8('0xc')],'defaultuser':util[_0x7cc8('0x3')](_0x7cc8('0x4'),'agent',i),'encryption':_0x7cc8('0xd'),'avpf':_0x7cc8('0xd'),'force_avp':_0x7cc8('0xd'),'icesupport':_0x7cc8('0xd'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x7cc8('0xe'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x7cc8('0xf'),'callerid':util[_0x7cc8('0x3')](_0x7cc8('0x10'),util[_0x7cc8('0x3')]('%s%s','agent',i),0xfa0+i)});}db[_0x7cc8('0x11')][_0x7cc8('0x12')](users)['then'](function(){console['log'](_0x7cc8('0x13'));})[_0x7cc8('0x14')](function(_0x33f65c){console[_0x7cc8('0x15')](_0x33f65c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 0fe8d29..e6769f6 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x9303=['removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','../mysqldb','name','role','agent','type','ivr','findOne','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','then','where','telephone','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','User','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','SmsQueue','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','fax','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','map'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x9303,0xd7));var _0x3930=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x9303[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0x3930('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x3930('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x3930('0x2')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x3930('0x2'),_0x3930('0x3')],'raw':!![],'where':{'role':_0x3930('0x4')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3930('0x2')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x3930('0x2')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x3930('0x2'),_0x3930('0x5')],'where':{'type':_0x3930('0x6')}};function getAssociatedResources(_0xe6fe58,_0xf9b29e,_0x58e723){return db['UserProfileSection'][_0x3930('0x7')]({'where':{'name':_0xe6fe58,'userProfileId':_0xf9b29e},'raw':!![]})['then'](function(_0x5269b3){if(_0x5269b3){if(_0x5269b3['autoAssociation']){switch(_0xe6fe58){case _0x3930('0x8'):case _0x3930('0x9'):case _0x3930('0xa'):case _0x3930('0xb'):case _0x3930('0xc'):case'OpenchannelQueues':case _0x3930('0xd'):return db[_0x58e723]['findAll'](queryQueues);case _0x3930('0xe'):return db[_0x58e723][_0x3930('0xf')](queryTelephones);case _0x3930('0x10'):return db[_0x58e723]['findAll'](queryTrunks);case _0x3930('0x11'):return db[_0x58e723][_0x3930('0xf')](queryCampaigns);}}else{return db['UserProfileResource'][_0x3930('0xf')]({'attributes':[_0x3930('0x12')],'where':{'sectionId':_0x5269b3['id']},'raw':!![]})[_0x3930('0x13')](function(_0x135498){if(_0x135498){var _0x5db060={'where':{'id':_['map'](_0x135498,_0x3930('0x12'))},'raw':!![]};switch(_0x58e723){case'User':_0x5db060[_0x3930('0x14')]['role']=_0x3930('0x15');break;case _0x3930('0x16'):_0x5db060['where']['type']='ivr';break;}return db[_0x58e723][_0x3930('0xf')](_0x5db060);}else{return[];}});}}else{return[];}})[_0x3930('0x13')](function(_0x41f3b5){return _0x41f3b5;});}function joinOrLeaveQueues(_0x5b5f55,_0x5053ea,_0x4f4e2e,_0x5a2501){_0x5b5f55[_0x5053ea](util[_0x3930('0x17')](_0x3930('0x18'),_0x4f4e2e,_0x5a2501[_0x3930('0x2')]));if(_0x5a2501[_0x3930('0x19')]){for(var _0x3d2a2f=0x0;_0x3d2a2f<_0x5a2501['Agents'][_0x3930('0x1a')];_0x3d2a2f+=0x1){_0x5b5f55[_0x5053ea](util[_0x3930('0x17')](_0x3930('0x1b'),_0x5a2501['Agents'][_0x3d2a2f][_0x3930('0x2')]));}}}function joinOrLeave(_0x2ea386,_0x12eeb7,_0x3a0e16){var _0x2bcc3b;if(_0x2ea386[_0x3930('0x1c')][_0x3930('0x1d')]['id']){db[_0x3930('0x1e')]['find']({'attributes':['id',_0x3930('0x2'),_0x3930('0x3'),_0x3930('0x1f')],'where':{'id':_0x2ea386[_0x3930('0x1c')][_0x3930('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x3930('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x3930('0x21')],'as':_0x3930('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x3930('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x3930('0x24')],'as':_0x3930('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x3930('0x26')],'as':_0x3930('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x3930('0x28'),'attributes':['id'],'raw':!![]}]})[_0x3930('0x13')](function(_0xca904a){if(_0xca904a){_0x2bcc3b=_0xca904a;_0x2ea386[_0x12eeb7](util['format'](_0x3930('0x1b'),_0xca904a[_0x3930('0x2')]));var _0x63acd5=[];switch(_0xca904a[_0x3930('0x3')]){case _0x3930('0x29'):_0x2ea386[_0x12eeb7](_0x3930('0x2a'));_0x2ea386[_0x12eeb7](_0x3930('0x2b'));if(queryQueues[_0x3930('0x2c')](_0x3930('0x2d'))){delete queryQueues[_0x3930('0x2d')];}_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x2f')][_0x3930('0xf')](queryQueues));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x30')][_0x3930('0xf')](queryQueues));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x31')][_0x3930('0xf')](queryQueues));_0x63acd5[_0x3930('0x2e')](db['SmsQueue']['findAll'](queryQueues));_0x63acd5['push'](db[_0x3930('0x32')][_0x3930('0xf')](queryQueues));_0x63acd5['push'](db[_0x3930('0x33')][_0x3930('0xf')](queryQueues));_0x63acd5['push'](db[_0x3930('0x34')]['findAll'](queryQueues));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x1e')][_0x3930('0xf')](queryTelephones));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x35')][_0x3930('0xf')](queryTrunks));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x16')][_0x3930('0xf')](queryCampaigns));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x1e')][_0x3930('0xf')](queryAgents));break;case _0x3930('0x36'):_0x2ea386[_0x12eeb7](_0x3930('0x2a'));_0x2ea386[_0x12eeb7](_0x3930('0x2b'));_0x63acd5[_0x3930('0x2e')](getAssociatedResources('VoiceQueues',_0xca904a[_0x3930('0x1f')],'VoiceQueue'));_0x63acd5[_0x3930('0x2e')](getAssociatedResources('ChatQueues',_0xca904a[_0x3930('0x1f')],'ChatQueue'));_0x63acd5['push'](getAssociatedResources(_0x3930('0xa'),_0xca904a[_0x3930('0x1f')],'FaxQueue'));_0x63acd5['push'](getAssociatedResources(_0x3930('0xb'),_0xca904a['userProfileId'],_0x3930('0x37')));_0x63acd5[_0x3930('0x2e')](getAssociatedResources(_0x3930('0xc'),_0xca904a[_0x3930('0x1f')],_0x3930('0x32')));_0x63acd5[_0x3930('0x2e')](getAssociatedResources(_0x3930('0x38'),_0xca904a[_0x3930('0x1f')],'OpenchannelQueue'));_0x63acd5['push'](getAssociatedResources(_0x3930('0xd'),_0xca904a[_0x3930('0x1f')],'WhatsappQueue'));_0x63acd5['push'](getAssociatedResources(_0x3930('0xe'),_0xca904a[_0x3930('0x1f')],_0x3930('0x1e')));_0x63acd5['push'](getAssociatedResources('Trunks',_0xca904a[_0x3930('0x1f')],_0x3930('0x35')));_0x63acd5[_0x3930('0x2e')](getAssociatedResources(_0x3930('0x11'),_0xca904a['userProfileId'],'Campaign'));_0x63acd5[_0x3930('0x2e')](db['User'][_0x3930('0xf')](queryAgents));break;case _0x3930('0x4'):_0x2ea386[_0x12eeb7]('voice:inbound');_0x2ea386[_0x12eeb7](_0x3930('0x2b'));_0x63acd5['push'](_0xca904a[_0x3930('0x39')]({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a[_0x3930('0x3a')]({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a[_0x3930('0x3b')]({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a[_0x3930('0x3c')]({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a[_0x3930('0x3d')]({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a['getOpenchannelQueues']({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a[_0x3930('0x3e')]({'attributes':['id',_0x3930('0x2')]}));break;}return BPromise[_0x3930('0x3f')](_0x63acd5);}})[_0x3930('0x13')](function(_0x58ebb7){if(_0x58ebb7&&_0x58ebb7[_0x3930('0x1a')]){for(var _0xcb6e0=0x0;_0xcb6e0<_0x58ebb7[_0x3930('0x1a')];_0xcb6e0+=0x1){for(var _0xc8014a=0x0;_0xc8014a<_0x58ebb7[_0xcb6e0]['length'];_0xc8014a+=0x1){switch(_0xcb6e0){case 0x0:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,_0x3930('0x40'),_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x1:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,'chat',_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x2:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,_0x3930('0x41'),_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x3:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,'sms',_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x4:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,'mail',_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x5:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,_0x3930('0x42'),_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x6:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,_0x3930('0x43'),_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x7:if(_0x2bcc3b['role']!==_0x3930('0x4'))_0x2ea386[_0x12eeb7](util[_0x3930('0x17')](_0x3930('0x44'),_0x58ebb7[_0xcb6e0][_0xc8014a][_0x3930('0x2')]));break;case 0x8:if(_0x2bcc3b['role']!==_0x3930('0x4'))_0x2ea386[_0x12eeb7](util[_0x3930('0x17')](_0x3930('0x45'),_0x58ebb7[_0xcb6e0][_0xc8014a][_0x3930('0x2')]));break;case 0x9:if(_0x2bcc3b['role']!==_0x3930('0x4'))_0x2ea386[_0x12eeb7](util[_0x3930('0x17')](_0x3930('0x46'),_0x58ebb7[_0xcb6e0][_0xc8014a][_0x3930('0x5')],_0x58ebb7[_0xcb6e0][_0xc8014a][_0x3930('0x2')]));break;case 0xa:_0x2ea386[_0x12eeb7](util[_0x3930('0x17')]('user:%s',_0x58ebb7[_0xcb6e0][_0xc8014a][_0x3930('0x2')]));break;}}}}})[_0x3930('0x13')](function(){if(_0x12eeb7==='leave'){var _0x937682=_['map'](_0x2bcc3b[_0x3930('0x20')],'id');return _0x2bcc3b[_0x3930('0x47')](_0x937682)[_0x3930('0x13')](function(){for(var _0x2d23e3=0x0;_0x2d23e3<_0x937682['length'];_0x2d23e3+=0x1){_0x3a0e16[_0x3930('0x48')](_0x3930('0x49'),{'ChatInteractionId':Number(_0x937682[_0x2d23e3]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x13')](function(){if(_0x12eeb7===_0x3930('0x4a')){var _0xb82796=_[_0x3930('0x4b')](_0x2bcc3b[_0x3930('0x22')],'id');return _0x2bcc3b[_0x3930('0x4c')](_0xb82796)[_0x3930('0x13')](function(){for(var _0x822979=0x0;_0x822979<_0xb82796['length'];_0x822979+=0x1){_0x3a0e16[_0x3930('0x48')](_0x3930('0x4d'),{'MailInteractionId':Number(_0xb82796[_0x822979]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x13')](function(){if(_0x12eeb7==='leave'){var _0x430e8c=_['map'](_0x2bcc3b[_0x3930('0x23')],'id');return _0x2bcc3b['removeFaxInteractions'](_0x430e8c)[_0x3930('0x13')](function(){for(var _0x1d0717=0x0;_0x1d0717<_0x430e8c[_0x3930('0x1a')];_0x1d0717+=0x1){_0x3a0e16[_0x3930('0x48')](_0x3930('0x4e'),{'FaxInteractionId':Number(_0x430e8c[_0x1d0717]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x13')](function(){if(_0x12eeb7===_0x3930('0x4a')){var _0x218592=_['map'](_0x2bcc3b['SmsInteractions'],'id');return _0x2bcc3b[_0x3930('0x4f')](_0x218592)[_0x3930('0x13')](function(){for(var _0x5121ed=0x0;_0x5121ed<_0x218592['length'];_0x5121ed+=0x1){_0x3a0e16[_0x3930('0x48')](_0x3930('0x50'),{'SmsInteractionId':Number(_0x218592[_0x5121ed]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x13')](function(){if(_0x12eeb7==='leave'){var _0x315f21=_[_0x3930('0x4b')](_0x2bcc3b[_0x3930('0x27')],'id');return _0x2bcc3b[_0x3930('0x51')](_0x315f21)[_0x3930('0x13')](function(){for(var _0x4f965a=0x0;_0x4f965a<_0x315f21['length'];_0x4f965a+=0x1){_0x3a0e16[_0x3930('0x48')](_0x3930('0x52'),{'OpenchannelInteractionId':Number(_0x315f21[_0x4f965a]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x13')](function(){if(_0x12eeb7==='leave'){var _0x4a4506=_['map'](_0x2bcc3b['WhatsappInteractions'],'id');return _0x2bcc3b[_0x3930('0x53')](_0x4a4506)[_0x3930('0x13')](function(){for(var _0x8489d2=0x0;_0x8489d2<_0x4a4506[_0x3930('0x1a')];_0x8489d2+=0x1){_0x3a0e16['emit'](_0x3930('0x54'),{'WhatsappInteractionId':Number(_0x4a4506[_0x8489d2]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x55')](function(_0x555d3b){_0x2ea386[_0x3930('0x56')](_0x555d3b);});}}function onDisconnect(_0x38aedd,_0x3a9cc2){joinOrLeave(_0x38aedd,_0x3930('0x4a'),_0x3a9cc2);}function onConnect(_0x3c3f7c){joinOrLeave(_0x3c3f7c,_0x3930('0x57'));}exports['default']=function(_0x2b8a55){_0x2b8a55['on'](_0x3930('0x58'),function(_0x10874b){_0x10874b['setMaxListeners'](0x0);_0x10874b[_0x3930('0x59')]=_0x10874b[_0x3930('0x5a')][_0x3930('0x58')][_0x3930('0x5b')]+':'+_0x10874b[_0x3930('0x5a')][_0x3930('0x58')]['remotePort'];_0x10874b[_0x3930('0x5c')]=new Date();_0x10874b['log']=function(_0x42719f){console['log'](_0x3930('0x5d')+_0x10874b[_0x3930('0x5e')][_0x3930('0x2')]+'['+_0x10874b['address']+']',_0x42719f);};_0x10874b['on']('disconnect',function(){onDisconnect(_0x10874b,_0x2b8a55);_0x10874b[_0x3930('0x56')](_0x3930('0x5f'));});onConnect(_0x10874b);_0x10874b[_0x3930('0x56')](_0x3930('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ea1888c..1256b92 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 _0xf1be=['Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','channel','motionChannel','event','resolve','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','SELECT','contact','interface','format','agent','incomingmessage','AfterCreateMessage','offlineMessage','get','opened','UserId','undefined','AfterCreate','changed','closed','substatus','QueryTypes','SIP/%s','name','AfterUpdate','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','Chat','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','afterCreate','SmsInteraction','Sms','SmsMessage'];(function(_0x235ab1,_0x3cabe6){var _0x52ccb9=function(_0x170063){while(--_0x170063){_0x235ab1['push'](_0x235ab1['shift']());}};_0x52ccb9(++_0x3cabe6);}(_0xf1be,0x1be));var _0xef1b=function(_0x7fcf39,_0xa98dba){_0x7fcf39=_0x7fcf39-0x0;var _0x1a148a=_0xf1be[_0x7fcf39];return _0x1a148a;};'use strict';var util=require(_0xef1b('0x0'));var db=require(_0xef1b('0x1'))['db'];var jayson=require(_0xef1b('0x2'));var logger=require(_0xef1b('0x3'))(_0xef1b('0x4'));var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':_0xef1b('0x5'),'model':'ChatInteraction','event':'afterCreate','condition':_0xef1b('0x6'),'callback':afterCreate},{'channel':_0xef1b('0x5'),'model':'ChatInteraction','event':_0xef1b('0x7'),'condition':_0xef1b('0x8'),'callback':afterUpdate},{'channel':'Chat','model':_0xef1b('0x9'),'event':'afterCreate','condition':_0xef1b('0xa'),'callback':afterCreateMessage},{'channel':'Chat','model':_0xef1b('0xb'),'event':_0xef1b('0xc'),'condition':_0xef1b('0xa'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xef1b('0xd'),'event':_0xef1b('0xc'),'condition':_0xef1b('0x6'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0xef1b('0x7'),'condition':_0xef1b('0x8'),'callback':afterUpdate},{'channel':_0xef1b('0xe'),'model':_0xef1b('0xf'),'event':_0xef1b('0xc'),'condition':_0xef1b('0xa'),'callback':afterCreateMessage},{'channel':_0xef1b('0x10'),'model':_0xef1b('0x11'),'event':_0xef1b('0xc'),'condition':_0xef1b('0x6'),'callback':afterCreate},{'channel':_0xef1b('0x10'),'model':_0xef1b('0x11'),'event':_0xef1b('0x7'),'condition':_0xef1b('0x8'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xef1b('0x12'),'event':_0xef1b('0xc'),'condition':_0xef1b('0xa'),'callback':afterCreateMessage},{'channel':_0xef1b('0x13'),'model':_0xef1b('0x14'),'event':'afterCreate','condition':_0xef1b('0x6'),'callback':afterCreate},{'channel':'Fax','model':_0xef1b('0x14'),'event':_0xef1b('0x7'),'condition':_0xef1b('0x8'),'callback':afterUpdate},{'channel':'Fax','model':_0xef1b('0x15'),'event':'afterCreate','condition':_0xef1b('0xa'),'callback':afterCreateMessage},{'channel':_0xef1b('0x16'),'model':_0xef1b('0x17'),'event':_0xef1b('0xc'),'condition':_0xef1b('0x6'),'callback':afterCreate},{'channel':_0xef1b('0x16'),'model':_0xef1b('0x17'),'event':_0xef1b('0x7'),'condition':_0xef1b('0x8'),'callback':afterUpdate},{'channel':'Mail','model':_0xef1b('0x18'),'event':'afterCreate','condition':_0xef1b('0xa'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xef1b('0x19'),'event':'afterCreate','condition':_0xef1b('0x6'),'callback':afterCreate},{'channel':_0xef1b('0x1a'),'model':_0xef1b('0x19'),'event':_0xef1b('0x7'),'condition':_0xef1b('0x8'),'callback':afterUpdate},{'channel':_0xef1b('0x1a'),'model':'OpenchannelMessage','event':_0xef1b('0xc'),'condition':_0xef1b('0xa'),'callback':afterCreateMessage}];function request(_0x28d845){return client[_0xef1b('0x1b')](_0xef1b('0x1c'),_0x28d845)[_0xef1b('0x1d')](function(_0x3bfd55){logger[_0xef1b('0x1e')](_0xef1b('0x1f'),_0xef1b('0x1c'),_0x3bfd55);if(_0x3bfd55[_0xef1b('0x20')]){if(_0x3bfd55[_0xef1b('0x20')][_0xef1b('0x21')]===0x1f4){logger['error'](_0xef1b('0x1f'),_0xef1b('0x1c'),_0x3bfd55['error']);}}})[_0xef1b('0x22')](function(_0x2ac814){logger['error'](_0xef1b('0x1f'),_0xef1b('0x1c'),_0x2ac814);});}function afterCreateMessage(_0x315136){return function(_0x239766){_0x239766=_0x239766['get']({'plain':!![]});_0x239766[_0xef1b('0x23')]=_0x315136;_0x239766[_0xef1b('0x24')]=_0x315136;_0x239766[_0xef1b('0x25')]=_0x239766['direction'];Promise[_0xef1b('0x26')]()[_0xef1b('0x1d')](function(){if(typeof _0x239766[_0xef1b('0x27')]==='undefined')return null;var _0x338240=_0xef1b('0x28')+_0x239766['ContactId'];return db[_0xef1b('0x29')][_0xef1b('0x2a')](_0x338240,{'type':db[_0xef1b('0x2b')]['QueryTypes'][_0xef1b('0x2c')],'raw':!![]});})[_0xef1b('0x1d')](function(_0x244260){if(_0x244260){_0x239766[_0xef1b('0x2d')]=_0x244260[0x0];}if(typeof _0x239766['UserId']==='undefined')return;return getAgent(_0x239766['UserId']);})[_0xef1b('0x1d')](function(_0xbabf6a){if(_0xbabf6a){_0x239766[_0xef1b('0x2e')]=util[_0xef1b('0x2f')]('SIP/%s',_0xbabf6a['name']);_0x239766[_0xef1b('0x30')]=_0xbabf6a;_0x239766[_0xef1b('0x23')]=_0x315136;return request({'event':_0xef1b('0x31'),'message':_0x239766});}else{return request({'event':'outgoingmessage','message':_0x239766});}})[_0xef1b('0x22')](function(_0x69271e){logger[_0xef1b('0x20')](_0xef1b('0x1f'),_0xef1b('0x32'),_0x69271e);});};}function afterCreateOfflineMessage(_0x155eb7){return function(_0x945802){_0x945802=_0x945802['get']({'plain':!![]});_0x945802[_0xef1b('0x23')]=_0x155eb7;_0x945802[_0xef1b('0x24')]=_0x155eb7;_0x945802[_0xef1b('0x25')]=_0xef1b('0x33');return request({'event':_0x945802[_0xef1b('0x25')],'message':_0x945802});};}function afterCreate(_0xf33284,_0x4931af){return function(_0x5f4f1b){_0x5f4f1b=_0x5f4f1b[_0xef1b('0x34')]({'plain':!![]});_0x5f4f1b[_0xef1b('0x23')]=_0xf33284;_0x5f4f1b[_0xef1b('0x24')]=_0xf33284;_0x5f4f1b[_0xef1b('0x25')]=_0xef1b('0x35');Promise[_0xef1b('0x26')]()[_0xef1b('0x1d')](function(){var _0x418884=_0xef1b('0x28')+_0x5f4f1b[_0xef1b('0x27')];return db[_0xef1b('0x29')][_0xef1b('0x2a')](_0x418884,{'type':db['Sequelize']['QueryTypes'][_0xef1b('0x2c')],'raw':!![]});})[_0xef1b('0x1d')](function(_0x4c7792){if(_0x4c7792){_0x5f4f1b[_0xef1b('0x2d')]=_0x4c7792[0x0];}if(typeof _0x5f4f1b[_0xef1b('0x36')]===_0xef1b('0x37'))return;return getAgent(_0x5f4f1b[_0xef1b('0x36')]);})[_0xef1b('0x1d')](function(_0x187325){if(_0x187325){_0x5f4f1b[_0xef1b('0x2e')]=util['format']('SIP/%s',_0x187325['name']);_0x5f4f1b[_0xef1b('0x30')]=_0x187325;}return request({'event':_0x4931af,'message':_0x5f4f1b});})['catch'](function(_0x46b75b){logger[_0xef1b('0x20')](_0xef1b('0x1f'),_0xef1b('0x38'),_0x46b75b);});};}function afterUpdate(_0x425d45){return function(_0x586fe8){var _0x4b93ab=_0x586fe8[_0xef1b('0x39')]('closed')&&_0x586fe8[_0xef1b('0x3a')];var _0x3916d9=_0x586fe8[_0xef1b('0x39')]('substatus');if(_0x4b93ab||_0x3916d9){var _0x178360=_0x4b93ab?_0xef1b('0x8'):_0xef1b('0x3b');var _0x4bf995=_0x586fe8[_0xef1b('0x34')]({'plain':!![]});_0x4bf995[_0xef1b('0x23')]=_0x425d45;_0x4bf995[_0xef1b('0x24')]=_0x425d45;_0x4bf995[_0xef1b('0x25')]=_0x4b93ab?_0xef1b('0x3a'):_0xef1b('0x3b');var _0x543225='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4bf995[_0xef1b('0x27')];return db[_0xef1b('0x29')]['query'](_0x543225,{'type':db[_0xef1b('0x2b')][_0xef1b('0x3c')][_0xef1b('0x2c')],'raw':!![]})[_0xef1b('0x1d')](function(_0xdbbc1b){if(_0xdbbc1b){_0x4bf995[_0xef1b('0x2d')]=_0xdbbc1b[0x0];}if(typeof _0x4bf995[_0xef1b('0x36')]===_0xef1b('0x37'))return;return getAgent(_0x4bf995[_0xef1b('0x36')]);})[_0xef1b('0x1d')](function(_0x1e25f4){if(_0x1e25f4){_0x4bf995[_0xef1b('0x2e')]=util[_0xef1b('0x2f')](_0xef1b('0x3d'),_0x1e25f4[_0xef1b('0x3e')]);_0x4bf995[_0xef1b('0x30')]=_0x1e25f4;}return request({'event':_0x178360,'message':_0x4bf995});})[_0xef1b('0x22')](function(_0x1dcc6b){logger['error'](_0xef1b('0x1f'),_0xef1b('0x3f'),_0x1dcc6b);});}};}function getAgent(_0x28acbf){return db[_0xef1b('0x40')][_0xef1b('0x41')]({'where':{'id':_0x28acbf},'attributes':['id',_0xef1b('0x3e'),_0xef1b('0x42'),_0xef1b('0x43'),_0xef1b('0x44')],'raw':!![]})[_0xef1b('0x1d')](function(_0x3aae47){return _0x3aae47;});}exports[_0xef1b('0x45')]=function(){for(var _0x76fb45=0x0;_0x76fb45=_0x4caebf[_0x9626('0x16')]){throw Error(_0x9626('0x17'));}_0x34e903(_0x2eabda);})['catch'](function(_0x408d2d){_0x495ad1(_0x408d2d);});});}; \ No newline at end of file +var _0x368b=['getLicense','agent','User','count','then','agents','catch','lodash','bluebird','mail','chat','fax','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes'];(function(_0x40ce46,_0x118c52){var _0x393a7a=function(_0x191ee1){while(--_0x191ee1){_0x40ce46['push'](_0x40ce46['shift']());}};_0x393a7a(++_0x118c52);}(_0x368b,0x118));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb368('0x0'));var BPromise=require(_0xb368('0x1'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0xb368('0x2'),_0xb368('0x3'),_0xb368('0x4'),'sms',_0xb368('0x5'),_0xb368('0x6')];exports[_0xb368('0x7')]=function(){return channels;};exports[_0xb368('0x8')]=function(_0x346bfa){_0x346bfa=_0x346bfa[_0xb368('0x9')]();return _[_0xb368('0xa')](channels,_0x346bfa);};exports['clearBlockUser']=function(_0x2a9d6e,_0x35c035,_0x113805,_0x189574){var _0x1ec46c={'loginAttempts':_0x35c035,'blocked':_0x113805};if(!_[_0xb368('0xb')](_0x189574)){_0x1ec46c[_0xb368('0xc')]=_0x189574;}return _0x2a9d6e[_0xb368('0xd')](_0x1ec46c);};exports[_0xb368('0xe')]=function(_0x577755){return new BPromise(function(_0x4c5a80,_0x4595fb){var _0x4bb38b=0x0;if(_0x577755['role']!==_0xb368('0xf')){_0x4c5a80(_0x577755);}db[_0xb368('0x10')][_0xb368('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x577755['id']}}})['then'](function(_0x1c5c40){_0x4bb38b=_0x1c5c40;return util[_0xb368('0xe')]();})[_0xb368('0x12')](function(_0x517409){if(_0x517409&&_0x517409[_0xb368('0x13')]&&_0x4bb38b>=_0x517409['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4c5a80(_0x577755);})[_0xb368('0x14')](function(_0x3ef7c2){_0x4595fb(_0x3ef7c2);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 10256b4..c8bcde3 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +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(_0x3f2439,_0x3b062f){var _0xa2576c=function(_0x1ba547){while(--_0x1ba547){_0x3f2439['push'](_0x3f2439['shift']());}};_0xa2576c(++_0x3b062f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'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 316973f..c929ef0 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x87ee=['exports','404','status','render','json','send'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x87ee,0x120));var _0xe87e=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x87ee[_0x403c20];return _0x2b271a;};'use strict';module[_0xe87e('0x0')][0x194]=function pageNotFound(_0x55b946,_0x56d295){var _0x4f7eba=_0xe87e('0x1');var _0x201a25=0x194;var _0x478522={'status':_0x201a25};_0x56d295['status'](_0x478522[_0xe87e('0x2')]);_0x56d295[_0xe87e('0x3')](_0x4f7eba,{},function(_0x1635ec,_0x340dc5){if(_0x1635ec){return _0x56d295[_0xe87e('0x2')](_0x478522[_0xe87e('0x2')])[_0xe87e('0x4')](_0x478522);}_0x56d295[_0xe87e('0x5')](_0x340dc5);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index b554bc0..da72454 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(_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 +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(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 8572d59..d57fe45 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xb43b=['/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/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/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/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','static','join','root','/www','/demo','snippet','3.5.0','/server/files/plugins','route','get','sendFile','resolve','appPath','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue'];(function(_0xc2928,_0x4de4be){var _0x521fa1=function(_0x28847e){while(--_0x28847e){_0xc2928['push'](_0xc2928['shift']());}};_0x521fa1(++_0x4de4be);}(_0xb43b,0xbf));var _0xbb43=function(_0x52bf06,_0x21822f){_0x52bf06=_0x52bf06-0x0;var _0x58d79e=_0xb43b[_0x52bf06];return _0x58d79e;};'use strict';var path=require(_0xbb43('0x0'));var express=require('express');var errors=require(_0xbb43('0x1'));var config=require(_0xbb43('0x2'));var setupLoggers=require(_0xbb43('0x3'))[_0xbb43('0x4')];var clientSideLogs=require(_0xbb43('0x5'));exports[_0xbb43('0x6')]=function(_0x2e9c09){return setupLoggers(_0x2e9c09)[_0xbb43('0x7')](function(){_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x9'),require(_0xbb43('0xa')));_0x2e9c09['use'](_0xbb43('0xb'),require('./api/voiceChanSpy'));_0x2e9c09['use'](_0xbb43('0xc'),require(_0xbb43('0xd')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe'),require(_0xbb43('0xf')));_0x2e9c09['use'](_0xbb43('0x10'),require(_0xbb43('0x11')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x12'),require('./api/voiceQueue'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x13'),require('./api/voiceRecording'));_0x2e9c09['use']('/api/screen/recordings',require(_0xbb43('0x14')));_0x2e9c09['use'](_0xbb43('0x15'),require('./api/voiceMail'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x16'),require(_0xbb43('0x17')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x18'),require('./api/voiceCallReport'));_0x2e9c09[_0xbb43('0x8')]('/api/voice/dials/reports',require(_0xbb43('0x19')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x1a'),require(_0xbb43('0x1b')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x1c'),require(_0xbb43('0x1d')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x1e'),require(_0xbb43('0x1f')));_0x2e9c09[_0xbb43('0x8')]('/api/trunks',require(_0xbb43('0x20')));_0x2e9c09['use'](_0xbb43('0x21'),require(_0xbb43('0x22')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x23'),require('./api/mailServerOut'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x24'),require(_0xbb43('0x25')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x26'),require(_0xbb43('0x27')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x28'),require(_0xbb43('0x29')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x2a'),require(_0xbb43('0x2b')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x2c'),require('./api/mailMessage'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x2d'),require('./api/mailApplication'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x2e'),require(_0xbb43('0x2f')));_0x2e9c09['use']('/api/dashboards',require(_0xbb43('0x30')));_0x2e9c09[_0xbb43('0x8')]('/api/dashboards/items',require('./api/dashboardItem'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x31'),require(_0xbb43('0x32')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x33'),require(_0xbb43('0x34')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x35'),require('./api/faxInteraction'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x36'),require(_0xbb43('0x37')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x38'),require(_0xbb43('0x39')));_0x2e9c09[_0xbb43('0x8')]('/api/fax/reports/queue',require(_0xbb43('0x3a')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x3b'),require('./api/smsAccount'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x3c'),require(_0xbb43('0x3d')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x3e'),require(_0xbb43('0x3f')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x40'),require(_0xbb43('0x41')));_0x2e9c09['use']('/api/sms/queues',require('./api/smsQueue'));_0x2e9c09['use'](_0xbb43('0x42'),require(_0xbb43('0x43')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x44'),require(_0xbb43('0x45')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x46'),require(_0xbb43('0x47')));_0x2e9c09['use'](_0xbb43('0x48'),require(_0xbb43('0x49')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x4a'),require('./api/openchannelQueue'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x4b'),require(_0xbb43('0x4c')));_0x2e9c09[_0xbb43('0x8')]('/api/openchannel/reports/queue',require(_0xbb43('0x4d')));_0x2e9c09['use'](_0xbb43('0x4e'),require(_0xbb43('0x4f')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x50'),require(_0xbb43('0x51')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x52'),require(_0xbb43('0x53')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x54'),require(_0xbb43('0x55')));_0x2e9c09[_0xbb43('0x8')]('/api/chat/queues',require(_0xbb43('0x56')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x57'),require(_0xbb43('0x58')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x59'),require(_0xbb43('0x5a')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x5b'),require(_0xbb43('0x5c')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x5d'),require(_0xbb43('0x5e')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x5f'),require('./api/cmHopper'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x60'),require(_0xbb43('0x61')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x62'),require(_0xbb43('0x63')));_0x2e9c09['use'](_0xbb43('0x64'),require(_0xbb43('0x65')));_0x2e9c09['use']('/api/cm/custom_fields',require(_0xbb43('0x66')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x67'),require(_0xbb43('0x68')));_0x2e9c09[_0xbb43('0x8')]('/api/automations',require('./api/automation'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x69'),require(_0xbb43('0x6a')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x6b'),require(_0xbb43('0x6c')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x6d'),require(_0xbb43('0x6e')));_0x2e9c09[_0xbb43('0x8')]('/api/intervals',require('./api/interval'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x6f'),require('./api/pause'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x70'),require(_0xbb43('0x71')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x72'),require(_0xbb43('0x73')));_0x2e9c09[_0xbb43('0x8')]('/api/schedules',require(_0xbb43('0x74')));_0x2e9c09[_0xbb43('0x8')]('/api/sounds',require(_0xbb43('0x75')));_0x2e9c09[_0xbb43('0x8')]('/api/tags',require(_0xbb43('0x76')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x77'),require(_0xbb43('0x78')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x79'),require(_0xbb43('0x7a')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x7b'),require(_0xbb43('0x7c')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x7d'),require('./api/template'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x7e'),require(_0xbb43('0x7f')));_0x2e9c09[_0xbb43('0x8')]('/api/variables',require(_0xbb43('0x80')));_0x2e9c09['use'](_0xbb43('0x81'),require('./api/integration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x82'),require(_0xbb43('0x83')));_0x2e9c09['use'](_0xbb43('0x84'),require(_0xbb43('0x85')));_0x2e9c09[_0xbb43('0x8')]('/api/analytics/default_reports',require(_0xbb43('0x86')));_0x2e9c09[_0xbb43('0x8')]('/api/analytics/extracted_reports',require(_0xbb43('0x87')));_0x2e9c09['use'](_0xbb43('0x88'),require(_0xbb43('0x89')));_0x2e9c09['use'](_0xbb43('0x8a'),require(_0xbb43('0x8b')));_0x2e9c09[_0xbb43('0x8')]('/api/analytics/tree_reports',require(_0xbb43('0x8c')));_0x2e9c09['use'](_0xbb43('0x8d'),require(_0xbb43('0x8e')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/salesforce/configurations',require(_0xbb43('0x8f')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x90'),require('./api/intSugarcrmAccount'));_0x2e9c09['use'](_0xbb43('0x91'),require('./api/intSugarcrmConfiguration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x92'),require(_0xbb43('0x93')));_0x2e9c09['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x2e9c09['use']('/api/integrations/desk/configurations',require(_0xbb43('0x94')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x95'),require(_0xbb43('0x96')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/zoho/accounts',require(_0xbb43('0x97')));_0x2e9c09['use'](_0xbb43('0x98'),require('./api/intZohoConfiguration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x99'),require(_0xbb43('0x9a')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/zendesk/accounts',require(_0xbb43('0x9b')));_0x2e9c09['use'](_0xbb43('0x9c'),require(_0xbb43('0x9d')));_0x2e9c09['use'](_0xbb43('0x9e'),require(_0xbb43('0x9f')));_0x2e9c09['use'](_0xbb43('0xa0'),require(_0xbb43('0xa1')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xa2'),require(_0xbb43('0xa3')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xa4'),require(_0xbb43('0xa5')));_0x2e9c09['use'](_0xbb43('0xa6'),require('./api/intVtigerAccount'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xa7'),require('./api/intVtigerConfiguration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xa8'),require(_0xbb43('0xa9')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xaa'),require(_0xbb43('0xab')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xac'),require('./api/intServicenowConfiguration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xad'),require(_0xbb43('0xae')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/dynamics365/accounts',require(_0xbb43('0xaf')));_0x2e9c09['use'](_0xbb43('0xb0'),require('./api/intDynamics365Configuration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xb1'),require(_0xbb43('0xb2')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xb3'),require(_0xbb43('0xb4')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xb5'),require(_0xbb43('0xb6')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/freshsales/fields',require(_0xbb43('0xb7')));_0x2e9c09['use'](_0xbb43('0xb8'),require(_0xbb43('0xb9')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xba'),require(_0xbb43('0xbb')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xbc'),require(_0xbb43('0xbd')));_0x2e9c09['use'](_0xbb43('0xbe'),require('./api/jscriptyAnswerReport'));_0x2e9c09['use'](_0xbb43('0xbf'),require('./api/jscriptyQuestionReport'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc0'),require('./api/jscriptySessionReport'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc1'),require('./api/smsQueueReport'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc2'),require(_0xbb43('0xc3')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc4'),require(_0xbb43('0xc5')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc6'),require(_0xbb43('0xc7')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc8'),require(_0xbb43('0xc9')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xca'),require(_0xbb43('0xcb')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xcc'),require(_0xbb43('0xcd')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xce'),require(_0xbb43('0xcf')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xd0'),require(_0xbb43('0xd1')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xd2'),require(_0xbb43('0xd3')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xd4'),require(_0xbb43('0xd5')));_0x2e9c09['use'](_0xbb43('0xd6'),require(_0xbb43('0xd7')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xd8'),require(_0xbb43('0xd9')));_0x2e9c09[_0xbb43('0x8')]('/api/attachments',require(_0xbb43('0xda')));_0x2e9c09[_0xbb43('0x8')]('/api/plugins',require('./api/plugin'));_0x2e9c09['use'](_0xbb43('0xdb'),require(_0xbb43('0xdc')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xdd'),require('./api/chatTransferReport'));_0x2e9c09['use'](_0xbb43('0xde'),require('./api/faxTransferReport'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xdf'),require('./api/openchannelTransferReport'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe0'),require(_0xbb43('0xe1')));_0x2e9c09['use'](_0xbb43('0xe2'),require('./api/cmList'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe3'),require('./api/voicePrefix'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe4'),require(_0xbb43('0xe5')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe6'),require('./api/userProfileSection'));_0x2e9c09['use'](_0xbb43('0xe7'),require(_0xbb43('0xe8')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe9'),require(_0xbb43('0xea')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xeb'),require(_0xbb43('0xec')));_0x2e9c09['use'](_0xbb43('0xed'),require('./api/whatsappApplication'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xee'),require('./api/whatsappInteraction'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xef'),require(_0xbb43('0xf0')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xf1'),require(_0xbb43('0xf2')));_0x2e9c09['use'](_0xbb43('0xf3'),require(_0xbb43('0xf4')));_0x2e9c09['use'](_0xbb43('0xf5'),require('./api/whatsappQueue'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xf6'),require(_0xbb43('0xf7')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xf8'),require(_0xbb43('0xf9')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xfa'),require(_0xbb43('0xfb')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xfc'),require('./api/authLocal'));_0x2e9c09[_0xbb43('0x8')]('/api/auth/google',require(_0xbb43('0xfd')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xfe'),require(_0xbb43('0xff')));_0x2e9c09[_0xbb43('0x8')]('/api/jira',require(_0xbb43('0x100')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x101'),require(_0xbb43('0x102')));_0x2e9c09[_0xbb43('0x8')]('/api/version',require(_0xbb43('0x103')));_0x2e9c09['use'](_0xbb43('0x104'),require(_0xbb43('0x105')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x106'),require(_0xbb43('0x107')));_0x2e9c09['use'](_0xbb43('0x108'),require('./api/webbar'));_0x2e9c09[_0xbb43('0x8')]('/api/logs',clientSideLogs);_0x2e9c09[_0xbb43('0x8')]('/apidoc',express[_0xbb43('0x109')](path[_0xbb43('0x10a')](config[_0xbb43('0x10b')],'/apidoc')));_0x2e9c09[_0xbb43('0x8')]('/www',express[_0xbb43('0x109')](path[_0xbb43('0x10a')](config['root'],_0xbb43('0x10c'))));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x10d'),express[_0xbb43('0x109')](path['join'](config[_0xbb43('0x10b')],_0xbb43('0x10d'))));_0x2e9c09['use']('/snippet',express['static'](path[_0xbb43('0x10a')](config['root'],_0xbb43('0x10e'),_0xbb43('0x10f'))));_0x2e9c09[_0xbb43('0x8')]('/plugins',express['static'](path[_0xbb43('0x10a')](config[_0xbb43('0x10b')],_0xbb43('0x110'))));_0x2e9c09[_0xbb43('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xbb43('0x112')](errors[0x194]);_0x2e9c09[_0xbb43('0x111')]('/*')[_0xbb43('0x112')](function(_0x49be0f,_0x202f08){_0x202f08[_0xbb43('0x113')](path[_0xbb43('0x114')](_0x2e9c09[_0xbb43('0x112')](_0xbb43('0x115'))+'/index.html'));});return _0x2e9c09;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 8f7d49b..781f3c7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x36b2=['../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc'];(function(_0x130c7d,_0x155870){var _0xaaa03e=function(_0x553bd7){while(--_0x553bd7){_0x130c7d['push'](_0x130c7d['shift']());}};_0xaaa03e(++_0x155870);}(_0x36b2,0x6b));var _0x236b=function(_0x52702a,_0x132421){_0x52702a=_0x52702a-0x0;var _0x49f776=_0x36b2[_0x52702a];return _0x49f776;};'use strict';var jayson=require(_0x236b('0x0'));var _=require(_0x236b('0x1'));var config=require(_0x236b('0x2'));exports['listen']=function(){return new Promise(function(_0x17977e,_0x2aa6b5){var _0x45d0d4={};_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x3')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/voiceExtension/voiceExtension.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x5')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x6')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x7')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x8')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x9')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0xa')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/trunk/trunk.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0xb')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/mailServerIn/mailServerIn.rpc'));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0xc')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0xd')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0xe')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0xf')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x10')));_0x45d0d4=_['merge'](_0x45d0d4,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x11')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x12')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/faxInteraction/faxInteraction.rpc'));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x13')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x14')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x15')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x16')));_0x45d0d4=_['merge'](_0x45d0d4,require('../api/smsMessage/smsMessage.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x17')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x18')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x19')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x1a')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x1b')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x1c')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x1d')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/chatMessage/chatMessage.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x1e')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/cmContact/cmContact.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x1f')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x20')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x21')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x22')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x23')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x24')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x25')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x26')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x27')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x28')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x29')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x2a')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x2b')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x2c')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x2d')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x2e')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x2f')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x30')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x31')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x32')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x33')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x34')));_0x45d0d4=_['merge'](_0x45d0d4,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x35')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x36')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x37')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x38')));_0x45d0d4=_['merge'](_0x45d0d4,require('../api/squareProject/squareProject.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x39')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3a')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/campaign/campaign.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3b')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3c')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3d')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3e')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3f')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x40')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x41')));var _0x2423e5=jayson[_0x236b('0x42')](_0x45d0d4)[_0x236b('0x43')]();var _0x22616a=config[_0x236b('0x44')][_0x236b('0x45')]||config[_0x236b('0x45')]+0x1;var _0x50ba8b=config['rpc']['ip']||'localhost';_0x2423e5['on'](_0x236b('0x46'),function(_0x3b05c0){return _0x2aa6b5(_0x3b05c0);});_0x2423e5[_0x236b('0x47')](_0x22616a,_0x50ba8b,function(){console[_0x236b('0x48')](_0x236b('0x49'),_0x50ba8b,_0x22616a);require(_0x236b('0x4a'))[_0x236b('0x4b')]();return _0x17977e(_0x236b('0x4c')+_0x50ba8b+':'+_0x22616a);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 11ad4f1..d78e210 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 _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 +var _0xb296=['SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','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','exports','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','replace','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','destroy','pipe','write','prototype','command','sync','answer','sendRequest','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s'];(function(_0x826da3,_0x1eedfd){var _0x442c47=function(_0x57e53a){while(--_0x57e53a){_0x826da3['push'](_0x826da3['shift']());}};_0x442c47(++_0x1eedfd);}(_0xb296,0xa3));var _0x6b29=function(_0x5600d8,_0xc2ed6b){_0x5600d8=_0x5600d8-0x0;var _0x35ea60=_0xb296[_0x5600d8];return _0x35ea60;};'use strict';var util=require(_0x6b29('0x0'));var _=require(_0x6b29('0x1'));var EventEmitter=require(_0x6b29('0x2'))[_0x6b29('0x3')];var AGIReply=require(_0x6b29('0x4'));var AGIError=require(_0x6b29('0x5'));function AGIChannel(_0x2c502e){var _0x48e967=this,_0x3ff65c=new AGIReply(),_0x5c1cf5=![],_0x50a1ba={};EventEmitter[_0x6b29('0x6')](_0x48e967);_0x2c502e['setEncoding'](_0x6b29('0x7'));_0x2c502e[_0x6b29('0x8')](0x8*0x3c*0x3c*0x3e8);_0x3ff65c[_0x6b29('0x9')](_0x6b29('0x7'));_0x3ff65c['on'](_0x6b29('0xa'),function(_0x4e4dd4){for(var _0x533b28 in _0x4e4dd4){_0x48e967[_0x533b28]=_0x4e4dd4[_0x533b28];}_0x48e967[_0x6b29('0xb')](_0x6b29('0xc'));});_0x3ff65c['on'](_0x6b29('0xd'),function(_0x1eb87c){if(_0x1eb87c[_0x6b29('0xe')]()==_0x6b29('0xf')){_0x48e967[_0x6b29('0xb')]('hangup');return;}if(_0x1eb87c[_0x6b29('0x10')](0x0,0xb)==_0x6b29('0x11')){_0x5c1cf5=!![];}if(_0x5c1cf5){_0x50a1ba['rx']+=_0x1eb87c+'\x0a';if(_0x1eb87c[_0x6b29('0x12')]('520\x20End\x20of\x20proper')!=-0x1){_0x5c1cf5=![];}}else{_0x50a1ba['rx']=_0x1eb87c;}if(_0x5c1cf5){return;}if(typeof _0x50a1ba['cb']==_0x6b29('0x13')){var _0x4ca75d=_0x50a1ba['rx']['substring'](0x0,0x3),_0x512818=null,_0x28495f=null;_0x4ca75d=parseInt(_0x4ca75d);if(isNaN(_0x4ca75d)){_0x50a1ba['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4ca75d!=0xc8){_0x50a1ba['cb'](null,{'code':_0x4ca75d,'result':-0x1,'extra':'KO'});return;}_0x512818=_0x50a1ba['rx'][_0x6b29('0x10')](0x4)[_0x6b29('0x14')]('result=','');if(_0x512818[_0x6b29('0x15')]('\x20')!=-0x1){_0x512818=_0x512818[_0x6b29('0x16')](0x0,_0x512818[_0x6b29('0x15')]('\x20'));}if(_[_0x6b29('0x17')](_0x512818,'-1')){_0x512818=parseInt(_0x512818);}_0x28495f=_0x50a1ba['rx'][_0x6b29('0x18')]('\x20');if(_0x28495f[_0x6b29('0x19')]==0x3){_0x28495f=_0x28495f[0x2][_0x6b29('0x10')](0x1,_0x28495f[0x2]['length']-0x1);}else if(_0x28495f[_0x6b29('0x19')]>0x3){var _0x14a4a8=/\((.+)\)/;var _0x1b2830=_0x50a1ba['rx']['match'](_0x14a4a8);if(_0x1b2830){_0x28495f=_0x1b2830[0x1];}else{_0x28495f=null;}}else{_0x28495f=null;}_0x50a1ba['cb'](null,{'code':_0x4ca75d,'result':_0x512818,'extra':_0x28495f});}});_0x2c502e['on']('error',function(_0xc9511c){_0x48e967[_0x6b29('0xb')](_0x6b29('0x1a'),new AGIError(_0x6b29('0x1b'),_0xc9511c[_0x6b29('0x1c')]));});_0x2c502e['on'](_0x6b29('0x1d'),function(){_0x48e967[_0x6b29('0xb')](_0x6b29('0x1d'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x2c502e['on'](_0x6b29('0x1e'),function(){_0x48e967[_0x6b29('0xb')](_0x6b29('0x1e'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x2c502e[_0x6b29('0x1f')]();});_0x2c502e[_0x6b29('0x20')](_0x3ff65c);this['command']=function(_0x35d3e4,_0x3686d1){var _0x35d3e4=_0x35d3e4||'',_0x3686d1=typeof _0x3686d1==_0x6b29('0x13')?_0x3686d1:new Function();_0x50a1ba={'tx':_0x35d3e4,'rx':'','cb':_0x3686d1};_0x2c502e[_0x6b29('0x21')](_0x35d3e4+'\x0a');},this[_0x6b29('0x1d')]=function(){_0x2c502e[_0x6b29('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x6b29('0x22')]['sendRequest']=function(_0x237cad){return this[_0x6b29('0x23')][_0x6b29('0x24')](this,_0x237cad);};AGIChannel[_0x6b29('0x22')][_0x6b29('0x25')]=function(){return this[_0x6b29('0x26')](_0x6b29('0x27'));};AGIChannel['prototype'][_0x6b29('0x28')]=function(_0x3b2811,_0xea8c31,_0x654528){_0x3b2811=_0x3b2811===undefined?'beep':_0x3b2811;_0xea8c31=_0xea8c31===undefined?'5':_0xea8c31;_0x654528=_0x654528===undefined?'1':_0x654528;return this['sendRequest'](util[_0x6b29('0x29')](_0x6b29('0x2a'),_0x3b2811,_0xea8c31*0x3e8,_0x654528));};AGIChannel[_0x6b29('0x22')][_0x6b29('0x2b')]=function(_0x370d50){_0x370d50=_0x370d50||_0x6b29('0x2c');return this[_0x6b29('0x26')](util['format'](_0x6b29('0x2d'),_0x370d50));};AGIChannel[_0x6b29('0x22')][_0x6b29('0x2e')]=function(_0x36e708,_0x36e293){if(_[_0x6b29('0x2f')](_0x36e293)){return this['sendRequest'](util[_0x6b29('0x29')](_0x6b29('0x30'),_0x36e708,_0x36e293[_0x6b29('0x31')](',')));}return this[_0x6b29('0x26')](util[_0x6b29('0x29')](_0x6b29('0x30'),_0x36e708,_0x36e293));};AGIChannel[_0x6b29('0x22')]['setContext']=function(_0x129846){return this[_0x6b29('0x26')](util[_0x6b29('0x29')](_0x6b29('0x32'),_0x129846));};AGIChannel[_0x6b29('0x22')][_0x6b29('0x33')]=function(_0x2d0988){return this[_0x6b29('0x26')](util['format']('SET\x20EXTENSION\x20%s',_0x2d0988));};AGIChannel['prototype']['setPriority']=function(_0x2b3df9){return this[_0x6b29('0x26')](util[_0x6b29('0x29')]('SET\x20PRIORITY\x20%s',_0x2b3df9));};AGIChannel[_0x6b29('0x22')][_0x6b29('0xf')]=function(){return this[_0x6b29('0x26')](_0x6b29('0x34'));};AGIChannel['prototype'][_0x6b29('0x35')]=function(_0x24ee15,_0x20f7da){var _0x5aad94=_['isBoolean'](_0x20f7da)||_[_0x6b29('0x36')](_0x20f7da)?_0x20f7da['toString']():_0x20f7da;return this['sendRequest'](util[_0x6b29('0x29')](_0x6b29('0x37'),_0x24ee15,_0x5aad94?_0x5aad94[_0x6b29('0x38')]()[_0x6b29('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x6b29('0x39')]=function(_0x54ccd5,_0xbb6e00){return this[_0x6b29('0x26')](util[_0x6b29('0x29')](_0x6b29('0x3a'),_0x54ccd5,_0xbb6e00));};AGIChannel[_0x6b29('0x22')]['sayDigits']=function(_0x332af5,_0x2be07a){return this[_0x6b29('0x26')](util[_0x6b29('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x332af5,_0x2be07a));};AGIChannel[_0x6b29('0x22')]['sayPhonetic']=function(_0x247e4f,_0x3bd58d){return this['sendRequest'](util['format'](_0x6b29('0x3b'),_0x247e4f,_0x3bd58d));};AGIChannel[_0x6b29('0x22')][_0x6b29('0x3c')]=function(_0x278573,_0x524feb,_0x8d8571){_0x524feb=_0x524feb||this[_0x6b29('0x3d')];_0x8d8571=_0x8d8571||0x1;this['setContext'](_0x278573);this[_0x6b29('0x33')](_0x524feb);this[_0x6b29('0x3e')](_0x8d8571);return this['noop'](util[_0x6b29('0x29')](_0x6b29('0x3f'),_0x278573,_0x524feb,_0x8d8571));};AGIChannel[_0x6b29('0x22')]['getVariable']=function(_0x574b40){return this[_0x6b29('0x26')](util[_0x6b29('0x29')](_0x6b29('0x40'),_0x574b40));};AGIChannel[_0x6b29('0x22')][_0x6b29('0x41')]=function(_0x46813b,_0x285756,_0x4788e5,_0xe1c900,_0x3491ab,_0x48ab0f){_0x285756=_0x285756||'wav';_0x4788e5=_0x4788e5||'';_0xe1c900=_0xe1c900===undefined?-0x1:_0xe1c900==='-1'?-0x1:_0xe1c900*0x3e8;_0x3491ab=_0x3491ab===undefined?'':'s='+_0x3491ab;_0x48ab0f=_0x48ab0f?'BEEP':'';return this[_0x6b29('0x26')](util[_0x6b29('0x29')](_0x6b29('0x42'),_0x46813b,_0x285756,_0x4788e5,_0xe1c900,_0x48ab0f,_0x3491ab));};AGIChannel['prototype'][_0x6b29('0x43')]=function(_0x17201b,_0x495a72){_0x495a72=_0x495a72||'';return this[_0x6b29('0x26')](util['format'](_0x6b29('0x44'),_0x17201b,_0x495a72));};AGIChannel[_0x6b29('0x22')]['agi']=function(_0x2db4cc){return this[_0x6b29('0x2e')](_0x6b29('0x45'),_0x2db4cc);};AGIChannel[_0x6b29('0x22')]['wait']=function(_0x30df11){return this[_0x6b29('0x2e')](_0x6b29('0x46'),_0x30df11);};AGIChannel[_0x6b29('0x22')]['error']=function(_0x2338d9,_0x3729b8){this[_0x6b29('0x2b')](util['format'](_0x6b29('0x47'),_0x2338d9['id'],_0x2338d9[_0x6b29('0x48')],_0x3729b8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6b29('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index c3f4317..f0181c9 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 _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 +var _0x2bdc=['name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2bdc,0x9b));var _0xc2bd=function(_0x176883,_0x4d9888){_0x176883=_0x176883-0x0;var _0x27bc09=_0x2bdc[_0x176883];return _0x27bc09;};'use strict';var util=require(_0xc2bd('0x0'));var error={'E_AGI_UNDEFINED':_0xc2bd('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xc2bd('0x2'),'E_AGI_SERVER_CLOSE':_0xc2bd('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xc2bd('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xc2bd('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xc2bd('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xc2bd('0x7'),'E_AGI_COMMAND_EMPTY':_0xc2bd('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc2bd('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3ac758){var _0x3ac758=_0x3ac758||null,_0x33e3a8=_0x33e3a8||[],_0x4f4698=0x1,_0x3f3fad='';if(!error[_0x3ac758]){_0x3ac758=_0xc2bd('0xa');}_0x33e3a8[_0xc2bd('0xb')](error[_0x3ac758]);while(arguments[_0x4f4698]){_0x33e3a8['push'](arguments[_0x4f4698]);_0x4f4698++;}_0x3f3fad=util[_0xc2bd('0xc')][_0xc2bd('0xd')](util,_0x33e3a8);this[_0xc2bd('0xe')]=_0x3f3fad;this[_0xc2bd('0xf')]=_0x3ac758;}module[_0xc2bd('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 9367c26..5027f19 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 _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 +var _0x750a=['lodash','events','EventEmitter','ioredis','./error','redis','defaults','subscribe','agi','emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR'];(function(_0x527a23,_0x4d4154){var _0x3fd2c1=function(_0x16b2d1){while(--_0x16b2d1){_0x527a23['push'](_0x527a23['shift']());}};_0x3fd2c1(++_0x4d4154);}(_0x750a,0x186));var _0xa750=function(_0x5a7a32,_0x2497da){_0x5a7a32=_0x5a7a32-0x0;var _0x30ba14=_0x750a[_0x5a7a32];return _0x30ba14;};'use strict';var _=require(_0xa750('0x0'));var EventEmitter=require(_0xa750('0x1'))[_0xa750('0x2')];var Redis=require(_0xa750('0x3'));var AGIError=require(_0xa750('0x4'));var config=require('../../config/environment');config[_0xa750('0x5')]=_[_0xa750('0x6')](config[_0xa750('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xa750('0x5')]);sub[_0xa750('0x7')](_0xa750('0x8'),function(_0x7de428){if(_0x7de428)return eventEmitter[_0xa750('0x9')](_0xa750('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x7de428));});sub['on'](_0xa750('0xb'),function(_0x297e14,_0x338d8e){if(_0x297e14!==_0xa750('0x8'))return;try{var _0x4f6e7e=JSON[_0xa750('0xc')](_0x338d8e);eventEmitter[_0xa750('0x9')](_0xa750('0xd'),_0x4f6e7e);}catch(_0x1c23cf){eventEmitter[_0xa750('0x9')](_0xa750('0xa'),new AGIError(_0xa750('0xe'),_0x1c23cf));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 40804ec..a05ec40 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 _0x6458=['invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','menu','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','condition','split','agicommand','target','default'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6458,0x133));var _0x8645=function(_0x9ae685,_0x2c6652){_0x9ae685=_0x9ae685-0x0;var _0x4c492e=_0x6458[_0x9ae685];return _0x4c492e;};'use strict';var _=require(_0x8645('0x0'));var logger=require('../../../config/logger')(_0x8645('0x1'));var verticesWithRetry=[_0x8645('0x2'),'getdigits',_0x8645('0x3')];var Graph=function(){this[_0x8645('0x4')]={};this[_0x8645('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x8645('0x6')][_0x8645('0x7')]=function(_0x2a2e6d){this[_0x8645('0x4')][_0x2a2e6d['id']]=_0x2a2e6d;this[_0x8645('0x5')][_0x2a2e6d['id']]=[];};Graph['prototype'][_0x8645('0x8')]=function(_0x50679a,_0x3076d6,_0x40c81a){this[_0x8645('0x5')][_0x50679a][_0x8645('0x9')]({'target':_0x3076d6,'condition':_0x40c81a});this[_0x8645('0xa')]+=0x1;};Graph[_0x8645('0x6')][_0x8645('0xb')]=function(){return _['size'](this['vertices']);};Graph['prototype'][_0x8645('0xc')]=function(){return this[_0x8645('0xa')];};Graph[_0x8645('0x6')][_0x8645('0xd')]=function(_0x71b911){return this['vertices'][_0x71b911];};Graph[_0x8645('0x6')][_0x8645('0xe')]=function(_0x59b2f3,_0x1cec1d){if(!this[_0x8645('0x4')][_0x59b2f3]){return logger[_0x8645('0xf')]('no\x20vertex\x20found');}var _0xad9a9d=_0x1cec1d(this[_0x8645('0x4')][_0x59b2f3]);if(!_0xad9a9d){return logger['info'](_0x8645('0x10'));}if(this['edges'][_0x59b2f3][_0x8645('0x11')]===0x0){return logger[_0x8645('0xf')]('no\x20edge/s\x20available');}for(var _0x45a7da=0x0,_0x25d282=[],_0x3a14e1=![];_0x45a7da\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 +var _0xe6b9=['then','hasOwnProperty','indexOf','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','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','projectUpdate','nextTick','error','findIndex','splice','push','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','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'];(function(_0x4877e3,_0x3a2ba3){var _0x14e764=function(_0x5c3607){while(--_0x5c3607){_0x4877e3['push'](_0x4877e3['shift']());}};_0x14e764(++_0x3a2ba3);}(_0xe6b9,0x1cb));var _0x9e6b=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0xe6b9[_0x406115];return _0xbbabdb;};'use strict';var _=require(_0x9e6b('0x0'));var syncho=require(_0x9e6b('0x1'));var util=require(_0x9e6b('0x2'));var config=require(_0x9e6b('0x3'));var logger=require(_0x9e6b('0x4'))(_0x9e6b('0x5'));var utilLicense=require(_0x9e6b('0x6'));var rpc=require(_0x9e6b('0x7'));var Project=require(_0x9e6b('0x8'));var AGIEmitter=require(_0x9e6b('0x9'))[_0x9e6b('0xa')];var projects=[];config[_0x9e6b('0x5')]=_['defaults'](config[_0x9e6b('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x9e6b('0xb'),projectUpdateHandler);function connectionHandler(_0x42433e){process[_0x9e6b('0xc')](function(){syncho(function(){try{setChannelVariables(_0x42433e);agiHandler(_0x42433e);}catch(_0x45bae1){logger[_0x9e6b('0xd')](_0x45bae1['stack']);}});});}function projectUpdateHandler(_0x240e7e){try{var _0x26be7f=_[_0x9e6b('0xe')](projects,['id',_0x240e7e['id']]);if(_0x26be7f>-0x1){if(_0x240e7e['deleted']===!![]){projects[_0x9e6b('0xf')](_0x26be7f,0x1);}else{projects[_0x26be7f]=_0x240e7e;}}else{projects[_0x9e6b('0x10')](_0x240e7e);}}catch(_0x164021){logger['error'](_0x164021[_0x9e6b('0x11')]);}}function listeningHandler(){console['log'](_0x9e6b('0x12'),config[_0x9e6b('0x5')][_0x9e6b('0x13')]);logger[_0x9e6b('0x14')](util[_0x9e6b('0x15')](_0x9e6b('0x16'),config[_0x9e6b('0x5')]['ip'],config['agi']['port']));}function errorHandler(_0x1e6319){if(_0x1e6319&&_0x1e6319[_0x9e6b('0x17')]&&_0x1e6319[_0x9e6b('0x18')]){logger['error'](util[_0x9e6b('0x15')]('[%s]\x20%s',_0x1e6319[_0x9e6b('0x17')],_0x1e6319['message']));}else{logger[_0x9e6b('0xd')](util['format'](_0x9e6b('0x19'),_0x1e6319[_0x9e6b('0x11')]));}}function closeHandler(){logger['info'](util[_0x9e6b('0x15')](_0x9e6b('0x1a'),this[_0x9e6b('0x1b')],this[_0x9e6b('0x1c')],this[_0x9e6b('0x1d')],this[_0x9e6b('0x1e')],this[_0x9e6b('0x1f')]));try{createSquareReport(this);}catch(_0x214969){logger[_0x9e6b('0xd')](_0x214969['stack']);}}function timeoutHandler(){logger[_0x9e6b('0x14')](util[_0x9e6b('0x15')](_0x9e6b('0x20'),this[_0x9e6b('0x1b')],this[_0x9e6b('0x1c')],this[_0x9e6b('0x1d')],this[_0x9e6b('0x1e')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x9e6b('0x15')](_0x9e6b('0x21'),this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this[_0x9e6b('0x1f')]));this[_0x9e6b('0x22')]=!![];}function createSquareReport(_0x1fc26b,_0x52decf){rpc[_0x9e6b('0x23')](_0x1fc26b)[_0x9e6b('0x24')](function(_0x41113b){if(_0x52decf){_0x52decf(null,_0x41113b);}})['catch'](function(_0x5271a1){if(_0x52decf){_0x52decf(null,_0x5271a1);}});}function setChannelVariables(_0x26e41e){for(var _0x4aae23 in _0x26e41e){if(_0x26e41e[_0x9e6b('0x25')](_0x4aae23)){if(_0x4aae23[_0x9e6b('0x26')]('agi_')===0x0){_0x26e41e[_0x4aae23[_0x9e6b('0x27')](0x4)]=_0x26e41e[_0x4aae23];delete _0x26e41e[_0x4aae23];}}}}function agiHandler(_0x5ca85d){logger[_0x9e6b('0x28')](_0x9e6b('0x29'),JSON['stringify'](_0x5ca85d,null,0x2));logger[_0x9e6b('0x14')](util[_0x9e6b('0x15')](_0x9e6b('0x2a'),_0x5ca85d[_0x9e6b('0x1b')],_0x5ca85d[_0x9e6b('0x1c')],_0x5ca85d[_0x9e6b('0x1d')],_0x5ca85d[_0x9e6b('0x1e')],_0x5ca85d[_0x9e6b('0x1f')]));_0x5ca85d['on'](_0x9e6b('0xd'),errorHandler);_0x5ca85d['on'](_0x9e6b('0x2b'),closeHandler);_0x5ca85d['on'](_0x9e6b('0x2c'),timeoutHandler);_0x5ca85d[_0x9e6b('0x22')]=![];_0x5ca85d['on']('hangup',hangupHandler);var _0x223696=_['find'](projects,[_0x9e6b('0x17'),_0x5ca85d[_0x9e6b('0x1b')]]);if(!_0x223696)return Project[_0x9e6b('0x2d')](_0x5ca85d);if(!_0x223696['production'])return Project[_0x9e6b('0x2e')](_0x5ca85d);return Project[_0x9e6b('0x2f')](_0x223696,_0x5ca85d);}function main(){var _0x517d1d;return utilLicense[_0x9e6b('0x30')]()[_0x9e6b('0x24')](function(_0x4cf25e){if(!_0x4cf25e)return;if(_0x4cf25e['voice']){if(_0x4cf25e[_0x9e6b('0x31')]&&_0x4cf25e[_0x9e6b('0x31')]>0x0){logger[_0x9e6b('0x14')](util[_0x9e6b('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4cf25e['callysquare']));_0x517d1d=_0x4cf25e[_0x9e6b('0x31')];}else{logger[_0x9e6b('0x14')](_0x9e6b('0x32'));}}else{logger[_0x9e6b('0x14')](_0x9e6b('0x33'));_0x517d1d=-0x1;}})[_0x9e6b('0x24')](function(){return Project[_0x9e6b('0x34')]();})['then'](function(_0x1b9d3a){projects=_0x1b9d3a;return;})['catch'](function(_0x32226){logger[_0x9e6b('0xd')](_0x9e6b('0x35'),_0x32226[_0x9e6b('0x11')]);})['finally'](function(){var _0x3ef4be=require('./server')(config[_0x9e6b('0x5')][_0x9e6b('0x13')],config[_0x9e6b('0x5')]['ip'],_0x517d1d);_0x3ef4be['on'](_0x9e6b('0xd'),errorHandler);_0x3ef4be['on']('listening',listeningHandler);_0x3ef4be['on'](_0x9e6b('0x36'),connectionHandler);_0x3ef4be['on'](_0x9e6b('0x2b'),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 283ccb8..06d01bb 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 _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 +var _0x3667=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x3667,0x145));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x7366('0x0'));var jayson=require(_0x7366('0x1'));var client=jayson[_0x7366('0x2')][_0x7366('0x3')]({'port':0x232b});function request(_0x477e2d,_0x620713){return new BPromise(function(_0x992e8c,_0x464df2){return client[_0x7366('0x4')](_0x477e2d,_0x620713)[_0x7366('0x5')](function(_0x5ccf2e){if(_0x5ccf2e['error']){return _0x464df2(_0x5ccf2e[_0x7366('0x6')][_0x7366('0x7')]);}else{return _0x992e8c(_0x5ccf2e[_0x7366('0x8')]);}})[_0x7366('0x9')](function(_0x2d994){return _0x464df2(_0x2d994);});});}exports[_0x7366('0xa')]=function(_0xdd57b4,_0x5465a4){return request(_0x7366('0xb'),{'account':_0xdd57b4,'message':_0x5465a4});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 2db6949..900c28d 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 _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 +var _0x1076=['mxCell','length','source','target','value','toJson','mxGraphModel','root','inspect','production','start','debug','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','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString','finally','vertex','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x1076,0xe6));var _0x6107=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x1076[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x6107('0x0'));var moment=require(_0x6107('0x1'));var parser=require(_0x6107('0x2'));var util=require(_0x6107('0x3'));var logger=require(_0x6107('0x4'))(_0x6107('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x6107('0x6'));var Graph=require('./graph');var Vertices=require(_0x6107('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x6107('0x8')](function(_0x2fe932){logger[_0x6107('0x9')](_0x6107('0xa'),_0x2fe932[_0x6107('0xb')]);return[];});}function addVertex(_0x59526d,_0x244e22,_0x364b35){_0x244e22[_0x6107('0xc')]=_0x364b35;if(_0x244e22[_0x6107('0xd')](_0x6107('0xe'))){_0x244e22[_0x6107('0xf')]=parseInt(_0x244e22['retry'],0xa);}_0x59526d[_0x6107('0x10')](_[_0x6107('0x11')](_0x244e22,_0x6107('0x12')));}function initGraph(_0x2a8c9c,_0x220288){var _0x40cd75=new Graph();for(var _0x5050ba in _0x2a8c9c){if(_0x2a8c9c[_0x6107('0xd')](_0x5050ba)){if(_['isArray'](_0x2a8c9c[_0x5050ba])){for(var _0x37d2cd=0x0;_0x37d2cd<_0x2a8c9c[_0x5050ba][_0x6107('0x13')];_0x37d2cd+=0x1){addVertex(_0x40cd75,_0x2a8c9c[_0x5050ba][_0x37d2cd],_0x5050ba);}}else{addVertex(_0x40cd75,_0x2a8c9c[_0x5050ba],_0x5050ba);}}}for(var _0x31c4f9=0x0;_0x31c4f9<_0x220288[_0x6107('0x13')];_0x31c4f9+=0x1){if(_0x220288[_0x31c4f9][_0x6107('0x14')]&&_0x220288[_0x31c4f9][_0x6107('0x15')]){_0x40cd75['addEdge'](_0x220288[_0x31c4f9][_0x6107('0x14')],_0x220288[_0x31c4f9]['target'],_0x220288[_0x31c4f9][_0x6107('0x16')]);}}return _0x40cd75;}function getRoot(_0x15f9eb){return parser[_0x6107('0x17')](_0x15f9eb,{'object':!![]})[_0x6107('0x18')][_0x6107('0x19')];}function inspect(_0x35459b){return util[_0x6107('0x1a')](_0x35459b,{'showHidden':![],'depth':null});}function initialize(_0x56c7fc,_0x5959c5){var _0x2fb6df=getRoot(_0x56c7fc[_0x6107('0x1b')]);if(!_0x2fb6df||!_0x2fb6df[_0x6107('0x1c')])return;var _0x5bfcce,_0x5202ac,_0x3b42b2;logger[_0x6107('0x1d')](_0x6107('0x19'),JSON['stringify'](_0x2fb6df,null,0x2));_0x5959c5[_0x6107('0x1e')]=moment()[_0x6107('0x1f')](_0x6107('0x20'));_0x5bfcce=initGraph(_[_0x6107('0x11')](_0x2fb6df,_0x6107('0x12')),_0x2fb6df[_0x6107('0x12')]);_0x5202ac=new Vertices(_0x5959c5,rpc,mailRpc);logger[_0x6107('0x21')](util['format'](_0x6107('0x22'),_0x5959c5[_0x6107('0x23')],_0x5959c5[_0x6107('0x24')],_0x5959c5[_0x6107('0x25')],_0x5959c5[_0x6107('0x26')],_0x5959c5[_0x6107('0x27')]));_0x5bfcce[_0x6107('0x28')](_0x2fb6df[_0x6107('0x1c')]['id'],function(_0x17c3bd){try{_0x17c3bd=_0x5202ac[_0x6107('0x29')](_0x17c3bd);logger[_0x6107('0x1d')]('vertex',JSON[_0x6107('0x2a')](_0x17c3bd,null,0x2));if(_0x17c3bd[_0x6107('0xc')]===_0x6107('0x2b')){logger['info'](_0x6107('0x2c'));_0x5959c5[_0x6107('0x2d')]=_0x17c3bd[_0x6107('0x2d')]||_0x5959c5[_0x6107('0x2d')];_0x5959c5['extension']=_0x17c3bd[_0x6107('0x2e')];_0x5959c5[_0x6107('0x2f')]=_0x17c3bd[_0x6107('0x2f')]?_0x17c3bd[_0x6107('0x2f')]-0x1:0x1;return null;}else if(_0x17c3bd&&_0x5202ac[_0x17c3bd[_0x6107('0xc')]]){_0x3b42b2=_0x5202ac[_0x17c3bd[_0x6107('0xc')]](_0x17c3bd);logger[_0x6107('0x21')]('response',JSON[_0x6107('0x2a')](_0x3b42b2,null,0x2));if(_0x3b42b2&&_0x3b42b2[_0x6107('0x30')]===AGI_CODE_SUCCESS&&_0x3b42b2[_0x6107('0x31')]!==AGI_RESULT_ERROR&&!_0x5959c5['evtHangup']){logger['debug'](_0x6107('0x32'),inspect(_0x3b42b2));return _[_0x6107('0x33')](_0x3b42b2['result'])?null:_0x3b42b2[_0x6107('0x31')][_0x6107('0x34')]();}else{logger[_0x6107('0x9')](_0x6107('0x32'),inspect(_0x3b42b2));return null;}}else{logger[_0x6107('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x16d1c9){logger[_0x6107('0x9')](_0x16d1c9['stack']);return null;}});if(_0x2fb6df[_0x6107('0x35')]){logger[_0x6107('0x21')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5959c5['arg_1'],_0x5959c5['calleridname'],_0x5959c5['callerid'],_0x5959c5['dnid'],_0x5959c5[_0x6107('0x27')]));_0x5bfcce[_0x6107('0x28')](_0x2fb6df['finally']['id'],function(_0x9c9304){try{_0x9c9304=_0x5202ac[_0x6107('0x29')](_0x9c9304);logger[_0x6107('0x1d')](_0x6107('0x36'),JSON[_0x6107('0x2a')](_0x9c9304,null,0x2));if(_0x9c9304&&_0x5202ac[_0x9c9304['agicommand']]){_0x3b42b2=_0x5202ac[_0x9c9304[_0x6107('0xc')]](_0x9c9304);if(_0x3b42b2){logger['debug'](_0x6107('0x32'),inspect(_0x3b42b2));return _['isUndefined'](_0x3b42b2[_0x6107('0x31')])?null:_0x3b42b2[_0x6107('0x31')][_0x6107('0x34')]();}else{logger[_0x6107('0x9')]('response',inspect(_0x3b42b2));return null;}}else{logger[_0x6107('0x9')](_0x6107('0x37'));return null;}}catch(_0x4e6217){logger[_0x6107('0x9')](_0x4e6217[_0x6107('0xb')]);return null;}});}logger[_0x6107('0x21')](util['format'](_0x6107('0x38'),_0x5959c5[_0x6107('0x23')],_0x5959c5[_0x6107('0x24')],_0x5959c5[_0x6107('0x25')],_0x5959c5[_0x6107('0x26')],_0x5959c5['uniqueid']));logger['info'](util[_0x6107('0x1f')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5959c5['context'],_0x5959c5[_0x6107('0x2e')],parseInt(_0x5959c5[_0x6107('0x2f')],0xa)+0x1));_0x5959c5['continueAt'](_0x5959c5[_0x6107('0x2d')],_0x5959c5[_0x6107('0x2e')],parseInt(_0x5959c5[_0x6107('0x2f')],0xa)+0x1);_0x5959c5[_0x6107('0x39')]();}function handleNotFound(_0x13e3de){logger[_0x6107('0x9')](util[_0x6107('0x1f')](_0x6107('0x3a'),_0x13e3de['arg_1']));_0x13e3de[_0x6107('0x3b')](_0x13e3de[_0x6107('0x2d')],_0x13e3de[_0x6107('0x2e')],parseInt(_0x13e3de[_0x6107('0x2f')],0xa)+0x1);_0x13e3de['close']();}function handleUnpublished(_0x21b85c){logger[_0x6107('0x9')](util[_0x6107('0x1f')](_0x6107('0x3c'),_0x21b85c[_0x6107('0x23')]));_0x21b85c['continueAt'](_0x21b85c['context'],_0x21b85c[_0x6107('0x2e')],parseInt(_0x21b85c['priority'],0xa)+0x1);_0x21b85c[_0x6107('0x39')]();}module[_0x6107('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 2439049..6081e83 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 _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 +var _0xded5=['Transform','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','exports','util'];(function(_0x5104b2,_0x153661){var _0x104012=function(_0x531dbb){while(--_0x531dbb){_0x5104b2['push'](_0x5104b2['shift']());}};_0x104012(++_0x153661);}(_0xded5,0xba));var _0x5ded=function(_0x13cb14,_0x555607){_0x13cb14=_0x13cb14-0x0;var _0x47e515=_0xded5[_0x13cb14];return _0x47e515;};'use strict';var util=require(_0x5ded('0x0'));var Transform=require('stream')[_0x5ded('0x1')];function AGIReply(_0x25f78a){Transform['call'](this,_0x25f78a);this[_0x5ded('0x2')]='';this[_0x5ded('0x3')]=![];}util[_0x5ded('0x4')](AGIReply,Transform);AGIReply['prototype'][_0x5ded('0x5')]=function(_0x1b2da5,_0x5cdc68,_0x1b935c){var _0x31d77c='\x0a',_0x26b217=['\x0a\x0a',_0x5ded('0x6')],_0x19e889=-0x1,_0x3ac88b=-0x1,_0x4c003f='',_0x1617d9=0x0,_0x4fea44='',_0x40b413='';this[_0x5ded('0x2')]+=_0x1b2da5[_0x5ded('0x7')]();_0x4fea44=this[_0x5ded('0x2')];if(!this[_0x5ded('0x3')]){_0x1617d9=0x0;while(_0x26b217[_0x1617d9]){while((_0x3ac88b=_0x4fea44[_0x5ded('0x8')](_0x26b217[_0x1617d9]))!=-0x1){_0x4c003f=_0x26b217[_0x1617d9];_0x40b413=_0x4fea44[_0x5ded('0x9')](0x0,_0x3ac88b);_0x4fea44=_0x4fea44[_0x5ded('0x9')](_0x3ac88b+_0x4c003f[_0x5ded('0xa')]);var _0x4b8d07=_0x40b413[_0x5ded('0xb')](_0x31d77c),_0x25c928=0x0,_0x34fa7d={},_0x2d5eb2='',_0x22e911='',_0x5b127c=-0x1;while(_0x4b8d07[_0x25c928]){_0x5b127c=_0x4b8d07[_0x25c928][_0x5ded('0x8')](':');if(_0x5b127c!=-0x1){_0x2d5eb2=_0x4b8d07[_0x25c928][_0x5ded('0xc')](0x0,_0x5b127c)[_0x5ded('0xd')]();_0x22e911=_0x4b8d07[_0x25c928]['slice'](_0x5b127c+0x1)[_0x5ded('0xd')]();if(_0x2d5eb2[_0x5ded('0xa')]>0x0){_0x34fa7d[_0x2d5eb2]=_0x22e911;}}else{}_0x25c928++;}this[_0x5ded('0xe')](_0x5ded('0xf'),_0x34fa7d);this[_0x5ded('0x3')]=!![];}_0x1617d9++;}this[_0x5ded('0x2')]=_0x4fea44;}else{while((_0x19e889=_0x4fea44[_0x5ded('0x8')](_0x31d77c))!=-0x1){_0x40b413=_0x4fea44[_0x5ded('0x9')](0x0,_0x19e889);this[_0x5ded('0xe')]('line',_0x40b413);_0x4fea44=_0x4fea44[_0x5ded('0x9')](_0x19e889+_0x31d77c['length']);}this[_0x5ded('0x2')]=_0x4fea44;}_0x1b935c();};module[_0x5ded('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 512dfaf..2398fb1 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 _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 +var _0x55d2=['ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','jayson/promise','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','ShowSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById'];(function(_0x3a97ac,_0x442d2a){var _0x2adc20=function(_0x3ffb22){while(--_0x3ffb22){_0x3a97ac['push'](_0x3a97ac['shift']());}};_0x2adc20(++_0x442d2a);}(_0x55d2,0x9f));var _0x255d=function(_0x4ac85a,_0x644ea){_0x4ac85a=_0x4ac85a-0x0;var _0x585481=_0x55d2[_0x4ac85a];return _0x585481;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x255d('0x0'));var client=jayson[_0x255d('0x1')][_0x255d('0x2')]({'port':0x2329});function request(_0x2bac55,_0x28c41e){return new Promise(function(_0x2c9d29,_0x57cbc1){return client[_0x255d('0x3')](_0x2bac55,_0x28c41e)[_0x255d('0x4')](function(_0xda2444){if(_0xda2444[_0x255d('0x5')]){return _0x57cbc1(_0xda2444['error']['message']);}else{return _0x2c9d29(_0xda2444[_0x255d('0x6')]);}})[_0x255d('0x7')](function(_0x253ac9){return _0x57cbc1(_0x253ac9);});});}exports[_0x255d('0x8')]=function(){return request(_0x255d('0x9'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports['getSquareProject']=function(_0x51c2dc){return request(_0x255d('0xa'),{'options':{'raw':![],'where':{'name':_0x51c2dc},'attributes':['production']}});};exports[_0x255d('0xb')]=function(_0x2c3754){return request(_0x255d('0xc'),{'options':{'raw':![],'where':{'id':_0x2c3754},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x255d('0xd'),'as':_0x255d('0xd')}]}],'attributes':['id',_0x255d('0xe'),_0x255d('0xf')],'smtp':!![]}});};exports[_0x255d('0x10')]=function(_0x30d8f0){return request(_0x255d('0xa'),{'options':{'where':{'id':_0x30d8f0},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x11')]=function(_0x2b21fd){return request(_0x255d('0x12'),{'options':{'where':{'id':_0x2b21fd},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x13')]=function(_0x500002){return request(_0x255d('0x14'),{'options':{'where':{'id':_0x500002},'attributes':[_0x255d('0xe')]}});};exports['getSquareOdbcById']=function(_0x477c48){return request(_0x255d('0x15'),{'options':{'where':{'id':_0x477c48},'attributes':[_0x255d('0x16')]}});};exports[_0x255d('0x17')]=function(_0x201313){return request(_0x255d('0x18'),{'options':{'where':{'id':_0x201313},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x19')]=function(_0x464f6a){return request(_0x255d('0x1a'),{'options':{'where':{'phone':_0x464f6a['phone']},'attributes':['id']}});};exports[_0x255d('0x1b')]=function(_0x46b939){return request(_0x255d('0x1c'),{'options':{'where':{'id':_0x46b939},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x1d')]=function(_0x24f105){return request(_0x255d('0x1e'),{'options':{'where':{'id':_0x24f105},'attributes':[_0x255d('0x1f')]}});};exports[_0x255d('0x20')]=function(_0x48a380){return request(_0x255d('0x21'),{'options':{'raw':![],'where':{'id':_0x48a380},'include':[{'model':_0x255d('0x22'),'as':_0x255d('0x23')}]}});};exports[_0x255d('0x24')]=function(_0xb9d98e){return request(_0x255d('0x25'),{'options':{'where':{'id':_0xb9d98e},'attributes':['id',_0x255d('0xe')]}});};exports[_0x255d('0x26')]=function(_0xd69061){return request(_0x255d('0x27'),{'body':_0xd69061});};exports[_0x255d('0x28')]=function(_0x37e01e){return request(_0x255d('0x29'),{'body':_0x37e01e});};exports[_0x255d('0x2a')]=function(_0x3d7126){return request(_0x255d('0x2b'),{'body':_[_0x255d('0x2c')](_0x3d7126,{'project_name':_0x3d7126[_0x255d('0x2d')],'prev_project_name':_0x3d7126[_0x255d('0x2e')]||'','is_subproject':_0x3d7126['arg_2']?!![]:![],'leaveAt':moment()[_0x255d('0x2f')](_0x255d('0x30'))})});};exports[_0x255d('0x31')]=function(_0x22c91b){return request(_0x255d('0x32'),{'body':_0x22c91b});};exports[_0x255d('0x33')]=function(_0x56f124){return request(_0x255d('0x34'),{'body':_0x56f124});};exports['createCmContact']=function(_0x3ed01d){return request(_0x255d('0x35'),{'options':{'raw':![],'where':{'phone':_0x3ed01d[_0x255d('0x36')],'ListId':_0x3ed01d['ListId']}}})[_0x255d('0x4')](function(_0x3f8849){if(_0x3f8849){return _0x3f8849;}return request(_0x255d('0x37'),{'body':_0x3ed01d});});};exports[_0x255d('0x38')]=function(_0x25eb35){return request(_0x255d('0x39'),{'options':{'where':{'id':_0x25eb35},'attributes':['name']}});};exports[_0x255d('0x3a')]=function(_0x529680,_0x5e7231){return request(_0x255d('0x3b'),{'body':{'interface':_0x5e7231},'options':{'where':_0x529680}});};exports[_0x255d('0x3c')]=function(_0x2a9402,_0x3bc0a0,_0x5d28bd){return request(_0x255d('0x3d'),{'body':{'type':_0x3bc0a0,'uniqueid':_0x5d28bd},'options':{'where':_0x2a9402}});};exports[_0x255d('0x3e')]=function(_0x50983){return request('UnpauseUser',{'body':{},'options':{'where':_0x50983}});};exports[_0x255d('0x3f')]=function(_0x57acc7){return request('LogoutUser',{'body':{},'options':{'where':_0x57acc7}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 4b83adb..de3f277 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 _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 +var _0x282a=['./lex','exports'];(function(_0x441eab,_0x583ba5){var _0xe6ff41=function(_0x98c274){while(--_0x98c274){_0x441eab['push'](_0x441eab['shift']());}};_0xe6ff41(++_0x583ba5);}(_0x282a,0xa2));var _0xa282=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x282a[_0x411017];return _0x2adeea;};var polly=require('./polly');var lex=require(_0xa282('0x0'));module[_0xa282('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 082d159..b4e9e13 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 _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 +var _0x70e0=['exports','./lib/api'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x70e0,0x17b));var _0x070e=function(_0x27ab96,_0x4a366a){_0x27ab96=_0x27ab96-0x0;var _0x49883e=_0x70e0[_0x27ab96];return _0x49883e;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ 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 50d0ddc..0404c9a 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(_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 +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x548f1d,_0x3295d8){var _0x42f347=function(_0x2ff768){while(--_0x2ff768){_0x548f1d['push'](_0x548f1d['shift']());}};_0x42f347(++_0x3295d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 ad27fd6..d9ae3f3 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 _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 +var _0xcb86=['exports'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0xcb86,0x18e));var _0x6cb8=function(_0x5a7977,_0x1cdcd3){_0x5a7977=_0x5a7977-0x0;var _0x22f392=_0xcb86[_0x5a7977];return _0x22f392;};'use strict';var polly=require('./lib/api');module[_0x6cb8('0x0')]=function(_0x3105e4,_0x4a61cb,_0x566c3a,_0x3d1d6c,_0x5d17e4,_0x206e11,_0x1ffd9a){return polly(_0x3105e4,_0x4a61cb,_0x566c3a,_0x3d1d6c,_0x5d17e4,_0x206e11,_0x1ffd9a);}; \ 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 9a49560..d609670 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 _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 +var _0x2010=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x1e5088,_0xae6ec3){var _0x54341d=function(_0x18f68b){while(--_0x18f68b){_0x1e5088['push'](_0x1e5088['shift']());}};_0x54341d(++_0xae6ec3);}(_0x2010,0x8b));var _0x0201=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2010[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var path=require(_0x0201('0x0'));var BPromise=require('bluebird');var rs=require(_0x0201('0x1'));var AWS=require(_0x0201('0x2'));function pollyResult(_0x202731,_0x331b19,_0x1e3d2f){return new BPromise(function(_0x12d066,_0x50d455){_0x202731[_0x0201('0x3')](_0x331b19,function(_0xfc6e45,_0x166b69){if(_0xfc6e45){_0x50d455(_0xfc6e45);}else if(_0x166b69){if(_0x166b69[_0x0201('0x4')]instanceof Buffer){fs[_0x0201('0x5')](_0x1e3d2f,_0x166b69['AudioStream'],function(_0x221421){if(_0x221421){_0x50d455(_0x221421);}else{_0x12d066();}});}else{_0x50d455(new Error(_0x0201('0x6')));}}else{_0x50d455(new Error(_0x0201('0x7')));}});});}module[_0x0201('0x8')]=function(_0xc157fa,_0xe2f5ac,_0x1533c3,_0x376f84,_0x1ea2ca,_0x13fb3e,_0x4f11d4){var _0xaede9c=new AWS[(_0x0201('0x9'))]({'accessKeyId':_0xc157fa,'secretAccessKey':_0xe2f5ac,'region':_0x1533c3});var _0x483516={'Text':_0x1ea2ca,'TextType':_0x13fb3e||_0x0201('0xa'),'OutputFormat':_0x0201('0xb'),'VoiceId':_0x376f84};return pollyResult(_0xaede9c,_0x483516,_0x4f11d4);}; \ 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 22c33ad..b42efc4 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 _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 +var _0x703a=['./lib/api','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x703a,0xee));var _0xa703=function(_0x399b41,_0x1319eb){_0x399b41=_0x399b41-0x0;var _0x2afeeb=_0x703a[_0x399b41];return _0x2afeeb;};'use strict';var asr=require(_0xa703('0x0'));module[_0xa703('0x1')]=function(_0x115ada,_0xd143ea,_0x593eae,_0x3ac64f){return asr(_0x115ada,_0xd143ea,_0x593eae);}; \ 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 a8f2197..45fe80c 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 _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 +var _0x3ee5=['POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64'];(function(_0x31738c,_0x548d87){var _0x113a11=function(_0x3cffe1){while(--_0x3cffe1){_0x31738c['push'](_0x31738c['shift']());}};_0x113a11(++_0x548d87);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x681d00,_0x43adf6){_0x681d00=_0x681d00-0x0;var _0x26e6a6=_0x3ee5[_0x681d00];return _0x26e6a6;};'use strict';var url=require('url');var BPromise=require(_0x53ee('0x0'));var fs=require('fs');var host=_0x53ee('0x1');module['exports']=function(_0x116163,_0x14adf3,_0x2de317){return new BPromise(function(_0x24e272,_0x25e597){var _0x119975;if(typeof _0x116163!==_0x53ee('0x2')||_0x116163[_0x53ee('0x3')]===0x0){return _0x25e597(_0x53ee('0x4'));}if(typeof _0x14adf3!==_0x53ee('0x2')||_0x14adf3[_0x53ee('0x3')]===0x0){return _0x25e597('key\x20should\x20be\x20a\x20string');}if(typeof _0x2de317!==_0x53ee('0x5')&&(typeof _0x2de317!==_0x53ee('0x2')||_0x2de317[_0x53ee('0x3')]===0x0)){return _0x25e597(_0x53ee('0x6'));}try{_0x119975=fs[_0x53ee('0x7')](_0x116163)[_0x53ee('0x8')](_0x53ee('0x9'));}catch(_0x17dace){return _0x25e597(_0x17dace);}return _0x24e272({'method':_0x53ee('0xa'),'uri':host+_0x53ee('0xb')+_0x14adf3,'body':{'config':{'encoding':_0x53ee('0xc'),'sampleRateHertz':_0x53ee('0xd'),'languageCode':_0x2de317},'audio':{'content':_0x119975}},'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 10cb4be..0f1f7a1 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x2b55=['exports','./asr'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2b55,0x153));var _0x52b5=function(_0x57503d,_0x3485cd){_0x57503d=_0x57503d-0x0;var _0x300444=_0x2b55[_0x57503d];return _0x300444;};var asr=require(_0x52b5('0x0'));module[_0x52b5('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 9619d55..7749a15 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 _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 +var _0x4de7=['protocol','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','close','unlink','download\x20error','pipe','error','end','https:','wav','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','then','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','.mp3','from','writeFile','chmodSync','777','.wav','googleCloudTTS\x20path','utf8','POST','application/x-www-form-urlencoded','stringify','jQ1olc','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','catch','message','googleDialogflow','textRequest','result','action','actionIncomplete','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','languageCode','queryText','responseId','intentDetectionConfidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest'];(function(_0x37b155,_0x6441ce){var _0x462830=function(_0x3d902b){while(--_0x3d902b){_0x37b155['push'](_0x37b155['shift']());}};_0x462830(++_0x6441ce);}(_0x4de7,0x72));var _0x74de=function(_0x2da9c6,_0x140700){_0x2da9c6=_0x2da9c6-0x0;var _0xc05f88=_0x4de7[_0x2da9c6];return _0xc05f88;};'use strict';var apiai=require(_0x74de('0x0'));var BPromise=require(_0x74de('0x1'));var dialogflow=require(_0x74de('0x2'));var fs=require('fs');var http=require(_0x74de('0x3'));var https=require(_0x74de('0x4'));var md5=require(_0x74de('0x5'));var path=require('path');var querystring=require(_0x74de('0x6'));var rp=require(_0x74de('0x7'));var rs=require(_0x74de('0x8'));var sox=require(_0x74de('0x9'));var tts=require(_0x74de('0xa'));var urlParse=require(_0x74de('0xb'))[_0x74de('0xc')];var util=require(_0x74de('0xd'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x74de('0xe'));var tilde=require(_0x74de('0xf'));var logger=require(_0x74de('0x10'))(_0x74de('0x11'));var ISPEECH_API=_0x74de('0x12');function downloadFile(_0x460dcb,_0xbeb438){return new BPromise(function(_0x358a39,_0x22457d){var _0x3d567e=urlParse(_0x460dcb);var _0x5150db=_0x3d567e[_0x74de('0x13')]==='https:'?https:http;var _0x1520e4={'host':_0x3d567e[_0x74de('0x14')],'path':_0x3d567e[_0x74de('0x15')],'headers':{'user-agent':_0x74de('0x16')}};_0x5150db[_0x74de('0x17')](_0x1520e4,function(_0x55ced2){if(_0x55ced2[_0x74de('0x18')]!==0xc8){logger['error'](_0x74de('0x19')+_0x460dcb+_0x74de('0x1a')+_0x55ced2['statusCode']+'\x20('+_0x55ced2[_0x74de('0x1b')]+')');_0x22457d(new Error('request\x20to\x20'+_0x460dcb+_0x74de('0x1a')+_0x55ced2[_0x74de('0x18')]+'\x20('+_0x55ced2[_0x74de('0x1b')]+')'));return;}var _0xb5b773=fs[_0x74de('0x1c')](_0xbeb438);_0xb5b773['on']('finish',function(){logger[_0x74de('0x1d')]('finish\x20download\x20file');_0xb5b773[_0x74de('0x1e')](_0x358a39);});_0xb5b773['on']('error',function(_0x8eeb71){fs[_0x74de('0x1f')](_0xbeb438);logger['error'](_0x74de('0x20'),_0x8eeb71);_0x22457d(_0x8eeb71);});_0x55ced2[_0x74de('0x21')](_0xb5b773);})['on'](_0x74de('0x22'),function(_0x5bd8ce){logger['error'](_0x5bd8ce);_0x22457d(_0x5bd8ce);})[_0x74de('0x23')]();});}function uploadFile(_0x33d579){return new BPromise(function(_0x2286df,_0x522609){var _0x3dc89a=urlParse(_0x33d579);var _0x2bd0ff=_0x3dc89a[_0x74de('0x13')]===_0x74de('0x24')?https:http;var _0x284b81={'host':_0x3dc89a[_0x74de('0x14')],'path':_0x3dc89a['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x2bd0ff[_0x74de('0x17')](_0x284b81,function(_0x51b379){if(_0x51b379[_0x74de('0x18')]!==0xc8){_0x522609(new Error(_0x74de('0x19')+_0x33d579+_0x74de('0x1a')+_0x51b379[_0x74de('0x18')]+'\x20('+_0x51b379['statusMessage']+')'));return;}var _0x1c74c9='';_0x51b379['on']('data',function(_0x1266df){_0x1c74c9+=_0x1266df;});_0x51b379['on'](_0x74de('0x23'),function(){_0x2286df(_0x1c74c9);});})['on'](_0x74de('0x22'),function(_0x2b56d5){_0x522609(_0x2b56d5);})[_0x74de('0x23')]();});}function convertFile(_0x1bf8a0,_0x49a602){return new BPromise(function(_0x42ad8a,_0x90ab95){var _0x119c74=sox['transcode'](_0x1bf8a0,_0x49a602,{'sampleRate':0x1f40,'format':_0x74de('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x119c74['on'](_0x74de('0x22'),function(_0x511384){logger[_0x74de('0x22')]('error\x20convert',_0x511384);_0x90ab95(_0x511384);});_0x119c74['on'](_0x74de('0x23'),function(){logger[_0x74de('0x1d')](_0x74de('0x26'));_0x42ad8a();});_0x119c74[_0x74de('0x27')]();});}function base64Decode(_0x4611a3,_0x3595d5){var _0x52eb58=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs[_0x74de('0x2a')](0x4)+'.wav');fs[_0x74de('0x2b')](_0x52eb58,_0x4611a3,'base64');return convertFile(_0x52eb58,_0x3595d5)[_0x74de('0x2c')](function(){try{fs[_0x74de('0x1f')](_0x52eb58);fs['chmodSync'](_0x3595d5,'777');}catch(_0x4cd823){logger[_0x74de('0x22')](_0x4cd823);}return _0x3595d5[_0x74de('0x2d')]('.')[0x0];});}function base64Encode(_0x5100c6){var _0x525c93=fs[_0x74de('0x2e')](_0x5100c6);return new Buffer(_0x525c93)[_0x74de('0x2f')](_0x74de('0x30'));}exports[_0x74de('0x31')]=function(_0x27c581,_0x144e1d,_0x2cc949,_0x5eb47f,_0x592e2c,_0x557fd0){var _0x2431aa,_0x1774b3;var _0x693f79=_0x74de('0x32');var _0x14032f=_0x74de('0x33')+_0x27c581;var _0x54df1e={};if(_0x144e1d===_0x74de('0x34')){_0x54df1e[_0x74de('0x35')]={'ssml':_0x2cc949};}else{_0x54df1e['input']={'text':_0x2cc949};};_0x54df1e[_0x74de('0x36')]={'languageCode':_0x5eb47f,'ssmlGender':_0x592e2c};_0x54df1e[_0x74de('0x37')]={'audioEncoding':_0x74de('0x38'),'sampleRateHertz':0x1f40};var _0x2f642b={'url':_0x693f79+'text:synthesize'+_0x14032f,'method':'POST','json':!![],'body':_0x54df1e};return rp(_0x2f642b)[_0x74de('0x2c')](function(_0x35f8ab){return new BPromise(function(_0x527f1a,_0x25014c){_0x2431aa=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs['generate'](0x4)+_0x74de('0x39'));var _0x5e3a7c=Buffer[_0x74de('0x3a')](_0x35f8ab['audioContent'],_0x74de('0x30'));return fs[_0x74de('0x3b')](_0x2431aa,_0x5e3a7c,function(_0x511596){_0x25014c(_0x511596);},function(_0x3d9f43){fs[_0x74de('0x3c')](_0x2431aa,_0x74de('0x3d'));_0x527f1a(_0x3d9f43);});});})[_0x74de('0x2c')](function(_0x2688b2){_0x1774b3=path[_0x74de('0x28')](__dirname,'tmp',rs[_0x74de('0x2a')](0x4)+_0x74de('0x3e'));return convertFile(_0x2431aa,_0x1774b3);})['then'](function(){try{fs[_0x74de('0x1f')](_0x2431aa);fs['chmodSync'](_0x1774b3,_0x74de('0x3d'));}catch(_0x5621a5){logger['error'](_0x5621a5);}logger[_0x74de('0x1d')](_0x74de('0x3f'),_0x1774b3[_0x74de('0x2d')]('.')[0x0]);return _0x1774b3['split']('.')[0x0];});};exports['googleTTS']=function(_0x3b2f67,_0x1e0a1a){var _0xfd1fe2='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x4353c7,_0x143b2a;var _0x26e52b;var _0x2a1582={'encoding':_0x74de('0x40'),'method':_0x74de('0x41'),'timeout':0x2710,'url':_0xfd1fe2,'headers':{'Content-Type':_0x74de('0x42')},'body':'f.req='+encodeURIComponent(JSON[_0x74de('0x43')]([[[_0x74de('0x44'),JSON[_0x74de('0x43')]([_0x3b2f67,_0x1e0a1a||'en',![],'null']),null,'generic']]]))};return rp(_0x2a1582)[_0x74de('0x2c')](function(_0x20d7b5){try{_0x26e52b=eval(_0x20d7b5['slice'](0x5))[0x0][0x2];}catch(_0x145127){throw new Error(_0x74de('0x45')+_0x20d7b5['data']);}if(!_0x26e52b){if(_0x3b2f67['length']>0xc8){throw new Error(_0x74de('0x46'));}else{throw new Error('lang\x20\x22'+_0x1e0a1a+_0x74de('0x47'));}}try{_0x26e52b=eval(_0x26e52b)[0x0];}catch(_0x8ce6b5){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x22c13b=_0x26e52b;_0x4353c7=path['resolve'](__dirname,'tmp',rs[_0x74de('0x2a')](0x4)+_0x74de('0x39'));fs['writeFileSync'](_0x4353c7,_0x26e52b,{'encoding':_0x74de('0x30')});_0x143b2a=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs[_0x74de('0x2a')](0x4)+_0x74de('0x3e'));return convertFile(_0x4353c7,_0x143b2a);})[_0x74de('0x2c')](function(){try{fs[_0x74de('0x1f')](_0x4353c7);fs[_0x74de('0x3c')](_0x143b2a,_0x74de('0x3d'));}catch(_0x42facb){logger[_0x74de('0x22')](_0x42facb);}logger['info']('goggleTTS\x20path',_0x143b2a[_0x74de('0x2d')]('.')[0x0]);return _0x143b2a['split']('.')[0x0];});};exports[_0x74de('0x48')]=function(_0x359b3a,_0x5dce09,_0x5082f3){return google[_0x74de('0x49')](_0x359b3a,_0x5dce09,_0x5082f3)[_0x74de('0x2c')](function(_0x3f224c){logger[_0x74de('0x1d')](_0x3f224c[_0x74de('0x4a')]);return rp(_0x3f224c);})[_0x74de('0x2c')](function(_0xfe0dc9){var _0x54c6be='';var _0x1b4e70=0x0;try{fs[_0x74de('0x1f')](_0x359b3a);}catch(_0x108081){logger['error'](_0x108081);}if(_0xfe0dc9&&_0xfe0dc9['results']){_0x54c6be=_0xfe0dc9[_0x74de('0x4b')]['map'](function(_0xd63d59){return _0xd63d59&&_0xd63d59[_0x74de('0x4c')][0x0]&&_0xd63d59[_0x74de('0x4c')][0x0][_0x74de('0x4d')]?_0xd63d59[_0x74de('0x4c')][0x0][_0x74de('0x4d')]:'';})['join']('\x0a');_0x1b4e70=_0xfe0dc9[_0x74de('0x4b')][_0x74de('0x4e')](function(_0x2c1769){return _0x2c1769&&_0x2c1769[_0x74de('0x4c')][0x0]&&_0x2c1769[_0x74de('0x4c')][0x0][_0x74de('0x4f')]?_0x2c1769[_0x74de('0x4c')][0x0]['confidence']:0x0;})[_0x74de('0x50')]('\x0a');}logger[_0x74de('0x1d')](_0x74de('0x51'),_0x54c6be);logger[_0x74de('0x1d')]('googleASR\x20confidence',_0x1b4e70);return{'transcript':_0x54c6be,'confidence':_0x1b4e70};})[_0x74de('0x52')](function(_0x4c3dfc){logger[_0x74de('0x22')]('[%s]\x20%s:%s',_0x4c3dfc[_0x74de('0x18')],_0x4c3dfc['name'],_0x4c3dfc[_0x74de('0x53')]);});};exports[_0x74de('0x54')]=function(_0x277c76,_0x2f4920,_0x3e732b,_0x51e8d2){var _0x77435b=apiai(_0x2f4920,{'language':_0x51e8d2||'en'});return _0x77435b[_0x74de('0x55')](_0x3e732b,{'sessionId':md5(_0x277c76)})[_0x74de('0x2c')](function(_0x14b77c){logger[_0x74de('0x1d')](JSON[_0x74de('0x43')](_0x14b77c));return{'source':_0x14b77c['result']['source'],'resolvedQuery':_0x14b77c[_0x74de('0x56')]['resolvedQuery'],'action':_0x14b77c[_0x74de('0x56')][_0x74de('0x57')],'actionIncomplete':_0x14b77c['result'][_0x74de('0x58')],'speech':_0x14b77c['result']['fulfillment']['speech'],'score':_0x14b77c[_0x74de('0x56')][_0x74de('0x59')],'statusCode':_0x14b77c['status'][_0x74de('0x5a')],'endConversation':_0x14b77c[_0x74de('0x56')][_0x74de('0x5b')][_0x74de('0x5c')]||![],'isFallbackIntent':_0x14b77c[_0x74de('0x56')][_0x74de('0x5b')][_0x74de('0x5d')]};});};exports[_0x74de('0x5e')]=function(_0xc26d3a,_0x58ec75,_0x63eda8,_0x11b33e,_0x41591c,_0x228a0c){var _0x1d1c29=_0x11b33e[_0x74de('0x5f')](/\\n/g,'\x0a');var _0x205530={'credentials':{'private_key':_0x1d1c29,'client_email':_0x63eda8}};var _0x1cb0f3=new dialogflow[(_0x74de('0x60'))](_0x205530);var _0x2b0396=_0x1cb0f3[_0x74de('0x61')](_0x58ec75,md5(_0xc26d3a));var _0x476707={'session':_0x2b0396,'queryInput':{'text':{'text':_0x41591c,'languageCode':_0x228a0c}}};return _0x1cb0f3[_0x74de('0x62')](_0x476707)[_0x74de('0x2c')](function(_0x57499b){if(_0x57499b&&_0x57499b[_0x74de('0x63')]){logger[_0x74de('0x1d')](_0x74de('0x64'),JSON[_0x74de('0x43')](_0x57499b));var _0x49dda1=_0x57499b[0x0];if(_0x49dda1){var _0x6f906f={'action':_0x49dda1[_0x74de('0x65')][_0x74de('0x57')],'allRequiredParamsPresent':_0x49dda1[_0x74de('0x65')][_0x74de('0x66')],'endConversation':_0x49dda1[_0x74de('0x65')]['diagnosticInfo']&&_0x49dda1[_0x74de('0x65')][_0x74de('0x67')][_0x74de('0x68')]?_0x49dda1[_0x74de('0x65')][_0x74de('0x67')][_0x74de('0x68')][_0x74de('0x69')][_0x74de('0x6a')]:![],'fulfillmentText':_0x49dda1[_0x74de('0x65')][_0x74de('0x6b')],'intentName':_0x49dda1[_0x74de('0x65')][_0x74de('0x6c')][_0x74de('0x6d')],'intentDisplayName':_0x49dda1['queryResult']['intent'][_0x74de('0x6e')],'isFallbackIntent':_0x49dda1[_0x74de('0x65')][_0x74de('0x6c')]['isFallback'],'languageCode':_0x49dda1[_0x74de('0x65')][_0x74de('0x6f')],'queryText':_0x49dda1[_0x74de('0x65')][_0x74de('0x70')],'responseId':_0x49dda1[_0x74de('0x71')],'score':_0x49dda1['queryResult'][_0x74de('0x72')],'speech':_0x49dda1[_0x74de('0x65')]['fulfillmentText'],'providerResponse':JSON[_0x74de('0x43')](_0x57499b)};return _0x6f906f;}}});};exports['tildeASR']=function(_0x429c45,_0x3b20f2,_0x3363d5,_0x452d6a){return tilde[_0x74de('0x49')](_0x429c45,_0x3b20f2,_0x3363d5,_0x452d6a)[_0x74de('0x2c')](function(_0x482620){try{fs['unlink'](_0x429c45);}catch(_0xd7c032){logger[_0x74de('0x22')](_0xd7c032);}logger[_0x74de('0x1d')]('Tilde\x20ASR\x20transcription',_0x482620[_0x74de('0x4d')]);logger[_0x74de('0x1d')]('Tilde\x20ASR\x20confidence',_0x482620[_0x74de('0x4f')]);return _0x482620;});};exports[_0x74de('0x73')]=function(_0x13fb80,_0xadc569,_0x5f1fda,_0x2bd4ec,_0x48de13,_0x394f62){var _0x42ddc2=path['resolve'](__dirname,_0x74de('0x29'),rs[_0x74de('0x2a')](0x4)+_0x74de('0x39'));var _0x53b83c;return aws[_0x74de('0x74')](_0x13fb80,_0xadc569,_0x5f1fda,_0x2bd4ec,_0x48de13,_0x394f62,_0x42ddc2)[_0x74de('0x2c')](function(){_0x53b83c=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs['generate'](0x4)+_0x74de('0x3e'));return convertFile(_0x42ddc2,_0x53b83c);})[_0x74de('0x2c')](function(){try{fs[_0x74de('0x1f')](_0x42ddc2);fs[_0x74de('0x3c')](_0x53b83c,_0x74de('0x3d'));}catch(_0x2d02d3){logger[_0x74de('0x22')](_0x2d02d3);}return _0x53b83c['split']('.')[0x0];});};exports[_0x74de('0x75')]=function(_0x383455,_0x336516,_0x34952d,_0x474229,_0x256ccc,_0x7171cd){return aws[_0x74de('0x76')](_0x383455,_0x336516,_0x34952d,_0x474229,_0x256ccc,_0x7171cd)[_0x74de('0x2c')](function(_0xc2b5c5){logger[_0x74de('0x1d')](JSON[_0x74de('0x43')](_0xc2b5c5));return _0xc2b5c5;});};exports[_0x74de('0x77')]=function(_0x55ba05,_0x2b5c14,_0x31dbbb,_0x22f4ab){var _0x3e0449=util[_0x74de('0x78')](_0x74de('0x79'),ISPEECH_API,_0x55ba05,encodeURIComponent(_0x2b5c14),_0x31dbbb,_0x22f4ab);var _0x1e60a4=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs[_0x74de('0x2a')](0x4)+_0x74de('0x39'));var _0x2b1bc8;return downloadFile(_0x3e0449,_0x1e60a4)[_0x74de('0x2c')](function(){_0x2b1bc8=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs[_0x74de('0x2a')](0x4)+_0x74de('0x3e'));return convertFile(_0x1e60a4,_0x2b1bc8);})['then'](function(){try{fs[_0x74de('0x1f')](_0x1e60a4);fs[_0x74de('0x3c')](_0x2b1bc8,_0x74de('0x3d'));}catch(_0x3790ae){logger['error'](_0x3790ae);}return _0x2b1bc8[_0x74de('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x2f4a7d,_0x4cd261,_0x45505b,_0x3bab7e){var _0x34a43e=util[_0x74de('0x78')](_0x74de('0x7a'),ISPEECH_API,_0x4cd261,_0x45505b,base64Encode(_0x2f4a7d),_0x3bab7e?util[_0x74de('0x78')](_0x74de('0x7b'),encodeURIComponent(_0x3bab7e)):_0x74de('0x7c'));return uploadFile(_0x34a43e)['then'](function(_0x1eb37f){return querystring[_0x74de('0xc')](_0x1eb37f);});};exports[_0x74de('0x7d')]=function(_0x59a3a7,_0x3d878e){return sestek[_0x74de('0x7e')](_0x59a3a7,_0x3d878e)[_0x74de('0x2c')](function(_0x294a14){logger[_0x74de('0x1d')](JSON[_0x74de('0x43')](_0x294a14));var _0x1ad140={'speech':_0x294a14['text'],'action':_0x294a14[_0x74de('0x7f')]?_0x294a14[_0x74de('0x7f')][_0x74de('0x80')]:undefined,'actiondata':_0x294a14[_0x74de('0x7f')]?_0x294a14['channelData'][_0x74de('0x81')]:undefined};if(_0x294a14[_0x74de('0x7f')]&&_0x294a14['channelData'][_0x74de('0x82')]){return base64Decode(_0x294a14[_0x74de('0x7f')][_0x74de('0x82')][_0x74de('0x83')],path[_0x74de('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x74de('0x3e')))[_0x74de('0x2c')](function(_0x366e01){_0x1ad140[_0x74de('0x84')]=_0x366e01;return _0x1ad140;});}return _0x1ad140;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index a8d0b7d..9889760 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 _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 +var _0xc4ff=['./nda'];(function(_0x2c094f,_0xe5a1b0){var _0x2f7176=function(_0x28e5f5){while(--_0x28e5f5){_0x2c094f['push'](_0x2c094f['shift']());}};_0x2f7176(++_0xe5a1b0);}(_0xc4ff,0x123));var _0xfc4f=function(_0x163c01,_0xc11912){_0x163c01=_0x163c01-0x0;var _0x1e8c85=_0xc4ff[_0x163c01];return _0x1e8c85;};var nda=require(_0xfc4f('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 c358654..f05cea2 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 _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 +var _0x1d5b=['ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','calleridname','extension','text','Bearer\x20','project','body','channelData'];(function(_0x56ad75,_0x348f9b){var _0x586107=function(_0x48e929){while(--_0x48e929){_0x56ad75['push'](_0x56ad75['shift']());}};_0x586107(++_0x348f9b);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x37acba,_0x19d3c3){_0x37acba=_0x37acba-0x0;var _0x1c2e72=_0x1d5b[_0x37acba];return _0x1c2e72;};'use strict';var rp=require(_0xb1d5('0x0'));var url=require(_0xb1d5('0x1'));var logger=require(_0xb1d5('0x2'))('agi');module[_0xb1d5('0x3')]=function(_0x594c25,_0x2f9c5a){var _0x1a673c={'method':_0xb1d5('0x4'),'uri':url[_0xb1d5('0x5')](_0x2f9c5a['ndauth_url'],'/token'),'form':{'grant_type':_0xb1d5('0x6'),'username':_0x2f9c5a[_0xb1d5('0x7')],'password':_0x2f9c5a[_0xb1d5('0x6')]},'json':!![]};return rp(_0x1a673c)[_0xb1d5('0x8')](function(_0x3b452f){var _0xb2d955={'method':_0xb1d5('0x4'),'uri':url[_0xb1d5('0x5')](_0x2f9c5a['ndassistant_url'],_0xb1d5('0x9')),'body':{'type':_0x2f9c5a[_0xb1d5('0xa')]||'message','channelId':'Nda','conversation':{'id':_0x594c25[_0xb1d5('0xb')]},'from':{'id':_0x594c25[_0xb1d5('0xc')],'name':_0x594c25[_0xb1d5('0xd')]},'recipient':{'id':_0x594c25['dnid'],'name':_0x594c25[_0xb1d5('0xe')]},'text':_0x2f9c5a[_0xb1d5('0xf')],'channelData':{}},'headers':{'Authorization':_0xb1d5('0x10')+_0x3b452f['access_token']},'json':!![]};if(_0x2f9c5a[_0xb1d5('0x11')]){_0xb2d955[_0xb1d5('0x12')][_0xb1d5('0x13')][_0xb1d5('0x14')]=_0x2f9c5a['project'];}if(_0x2f9c5a[_0xb1d5('0x15')]=='1'){_0xb2d955[_0xb1d5('0x12')][_0xb1d5('0x13')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb1d5('0x16')};}if(_0x2f9c5a[_0xb1d5('0x17')]){_0xb2d955[_0xb1d5('0x12')][_0xb1d5('0x13')][_0xb1d5('0x18')]=_0x2f9c5a[_0xb1d5('0x17')];if(_0x2f9c5a['custom_action_data']){_0xb2d955[_0xb1d5('0x12')]['channelData'][_0xb1d5('0x19')]=_0x2f9c5a[_0xb1d5('0x1a')];}}logger['info'](JSON[_0xb1d5('0x1b')](_0xb2d955));return rp(_0xb2d955);});}; \ 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 f2a253f..5b053b3 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 _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 +var _0x71a3=['exports','./lib/api'];(function(_0x1d82ab,_0x567dcc){var _0x27cae6=function(_0x1e53b3){while(--_0x1e53b3){_0x1d82ab['push'](_0x1d82ab['shift']());}};_0x27cae6(++_0x567dcc);}(_0x71a3,0x1b5));var _0x371a=function(_0x5b758a,_0x3d5ff2){_0x5b758a=_0x5b758a-0x0;var _0x2a7e5b=_0x71a3[_0x5b758a];return _0x2a7e5b;};'use strict';var asr=require(_0x371a('0x0'));module[_0x371a('0x1')]=function(_0x3192da,_0x4449eb,_0x3b8e0f,_0xfc4d81){return asr(_0x3192da,_0x4449eb,_0x3b8e0f,_0xfc4d81);}; \ 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 9f6252f..e41a61b 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 _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 +var _0x22cd=['open','message','bluebird','lodash','moment','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0xa6fcce,_0x18fcd5){var _0x228424=function(_0x1b83ff){while(--_0x1b83ff){_0xa6fcce['push'](_0xa6fcce['shift']());}};_0x228424(++_0x18fcd5);}(_0x22cd,0x77));var _0xd22c=function(_0x100e0c,_0x5523b8){_0x100e0c=_0x100e0c-0x0;var _0x4db1aa=_0x22cd[_0x100e0c];return _0x4db1aa;};'use strict';var BPromise=require(_0xd22c('0x0'));var _=require(_0xd22c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xd22c('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0xd22c('0x3'));module['exports']=function(_0x42c47e,_0x11aa76,_0x48891a,_0x578336){return new BPromise(function(_0x19c9ea,_0x124c78){logger[_0xd22c('0x4')](_0xd22c('0x5'),_0x578336||_0xd22c('0x6'));var _0x5ca508=new WebSocket(_0x578336||_0xd22c('0x6'),{'perMessageDeflate':![]});var _0x97c5c8='';var _0x6775c='0';var _0xef1246='1';var _0xe45fe1='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x314303(_0x35535d){var _0x21ebfc=crypto[_0xd22c('0x7')](_0xd22c('0x8'));_0x21ebfc[_0xd22c('0x9')](_0x35535d);return _0x21ebfc[_0xd22c('0xa')]('hex');}function _0x1d32dd(){try{logger[_0xd22c('0x4')](_0xd22c('0xb'));var _0xb1ebc9=moment()[_0xd22c('0xc')]();var _0x95e09b=_0x314303(_0xb1ebc9+_0x11aa76+_0x48891a);_0x5ca508[_0xd22c('0xd')](JSON[_0xd22c('0xe')]({'appID':_0x11aa76,'timestamp':_0xb1ebc9,'appKey':_0x95e09b}));var _0x8d74f4=fs[_0xd22c('0xf')](_0x42c47e);_0x8d74f4['on'](_0xd22c('0x10'),function(_0x6a5c84){_0x5ca508[_0xd22c('0xd')](_0x6a5c84);});_0x8d74f4['on'](_0xd22c('0x11'),function(){_0x5ca508['send']('EOS');});}catch(_0x1d2f52){logger[_0xd22c('0x12')](_0xd22c('0x13'),JSON[_0xd22c('0xe')](_0x1d2f52));_0x5ca508[_0xd22c('0x14')]();}}function _0x10f1a1(_0x2e9031){try{if(_0x2e9031){var _0xedceac=JSON[_0xd22c('0x15')](_0x2e9031);switch(_0xedceac[_0xd22c('0x16')]){case 0x0:if(_0xedceac[_0xd22c('0x17')]){if(_0xedceac[_0xd22c('0x17')]['final']){logger[_0xd22c('0x4')](_0xd22c('0x18'),JSON[_0xd22c('0xe')](_0xedceac[_0xd22c('0x17')][_0xd22c('0x19')]));_0x97c5c8=_0xedceac[_0xd22c('0x17')][_0xd22c('0x19')][0x0][_0xd22c('0x1a')];_0x6775c=_0xedceac['result'][_0xd22c('0x19')][0x0]['likelihood'];_0xef1246='0';_0xe45fe1=_0xd22c('0x1b');_0x5ca508['terminate']();}}break;case 0x1:logger[_0xd22c('0x4')](_0xd22c('0x1c'));_0xef1246='1';_0xe45fe1=_0xd22c('0x1c');break;case 0x2:logger[_0xd22c('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0xef1246='2';_0xe45fe1=_0xd22c('0x1d');break;case 0x9:logger[_0xd22c('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0xef1246='9';_0xe45fe1=_0xd22c('0x1e');break;case 0xa:logger[_0xd22c('0x4')](_0xd22c('0x1f'));_0xef1246='10';_0xe45fe1='Authentication\x20failed.';break;case 0xb:logger[_0xd22c('0x4')](_0xd22c('0x20'));_0xef1246='11';_0xe45fe1=_0xd22c('0x20');}}}catch(_0x4f6c23){logger[_0xd22c('0x12')](_0xd22c('0x21'),JSON[_0xd22c('0xe')](_0x4f6c23));_0x5ca508[_0xd22c('0x14')]();}}function _0x58995e(){logger[_0xd22c('0x4')](_0xd22c('0x22'));_0x19c9ea({'transcript':_0x97c5c8,'confidence':_0x6775c,'status':_0xef1246,'status_message':_0xe45fe1});}function _0xaa9f82(_0x4bdbfd){logger[_0xd22c('0x12')](_0xd22c('0x23'));if(!_[_0xd22c('0x24')](_0x4bdbfd)){logger['error'](_['isObject'](_0x4bdbfd)?JSON[_0xd22c('0xe')](_0x4bdbfd):_0x4bdbfd);}}_0x5ca508['on'](_0xd22c('0x25'),_0x1d32dd);_0x5ca508['on'](_0xd22c('0x26'),_0x10f1a1);_0x5ca508['on']('close',_0x58995e);_0x5ca508['on'](_0xd22c('0x12'),_0xaa9f82);});}; \ 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 79e3d42..13887be 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 _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 +var _0xbea0=['exports','./asr'];(function(_0x526759,_0x3aecf9){var _0xa625f7=function(_0x567ab8){while(--_0x567ab8){_0x526759['push'](_0x526759['shift']());}};_0xa625f7(++_0x3aecf9);}(_0xbea0,0xcb));var _0x0bea=function(_0x1ac695,_0x3fbbd3){_0x1ac695=_0x1ac695-0x0;var _0x320155=_0xbea0[_0x1ac695];return _0x320155;};var asr=require(_0x0bea('0x0'));module[_0x0bea('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 859c63d..31f7300 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(_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 +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(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xe706,0xa3));var _0x6e70=function(_0xa76664,_0x5e32db){_0xa76664=_0xa76664-0x0;var _0x3f7743=_0xe706[_0xa76664];return _0x3f7743;};'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 099c1d7..40ff98b 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 _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 +var _0x61a5=['query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','DIAL','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','streamFile','awslex','no\x20valid\x20credentials\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%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','wav','%s/recordings/%s','beep','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','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','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','output','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','%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','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','XMCS-UNIQUEID','yes','Answer','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','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','dnid','createSquareMessage','uniqueid','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','isPlainObject','%s.%s','setVariable','stringify','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured'];(function(_0x37678f,_0x405bee){var _0x9f9284=function(_0x344255){while(--_0x344255){_0x37678f['push'](_0x37678f['shift']());}};_0x9f9284(++_0x405bee);}(_0x61a5,0xf0));var _0x561a=function(_0x319fc1,_0x29179b){_0x319fc1=_0x319fc1-0x0;var _0xb768af=_0x61a5[_0x319fc1];return _0xb768af;};'use strict';var fs=require('fs');var util=require(_0x561a('0x0'));var _=require('lodash');var sh=require(_0x561a('0x1'));var odbc=require(_0x561a('0x2'))();var rs=require(_0x561a('0x3'));var moment=require(_0x561a('0x4'));var Mustache=require(_0x561a('0x5'));var rp=require('request-promise');var logger=require(_0x561a('0x6'))(_0x561a('0x7'));var config=require('../../config/environment');var scripts=require(_0x561a('0x8'));var FILES_PATH=_0x561a('0x9');var recursiveMapAttributes=[_0x561a('0xa'),_0x561a('0xb')];var verticesWithRetry=[_0x561a('0xc'),_0x561a('0xd'),_0x561a('0xe')];var AGIVertices=function(_0x4db87f,_0x3db11c,_0x52563e){this[_0x561a('0xf')]=_0x4db87f;this[_0x561a('0x10')]=_0x3db11c;this['mailRpc']=_0x52563e;};AGIVertices[_0x561a('0x11')][_0x561a('0x12')]=function(_0x522f52,_0x3a1eee){this['rpc'][_0x561a('0x13')](_0x522f52)[_0x561a('0x14')](function(_0x28a652){_0x3a1eee(null,_0x28a652?_0x28a652[_0x561a('0x15')]:![]);})[_0x561a('0x16')](function(_0x3dfa9f){_0x3a1eee(_0x3dfa9f);});};AGIVertices[_0x561a('0x11')][_0x561a('0x17')]=function(_0x8c1952,_0x4f1e33){this[_0x561a('0x10')][_0x561a('0x18')](_0x8c1952)['then'](function(_0x4037a9){_0x4f1e33(null,_0x4037a9?_0x4037a9[_0x561a('0x15')]:![]);})[_0x561a('0x16')](function(_0xecbcc4){_0x4f1e33(_0xecbcc4);});};AGIVertices[_0x561a('0x11')][_0x561a('0x19')]=function(_0x3d91be,_0x14f141){this[_0x561a('0x10')][_0x561a('0x1a')](_0x3d91be)[_0x561a('0x14')](function(_0x48df6a){_0x14f141(null,_0x48df6a?_0x48df6a[_0x561a('0x15')]:![]);})[_0x561a('0x16')](function(_0x533d95){_0x14f141(_0x533d95);});};AGIVertices[_0x561a('0x11')][_0x561a('0x1b')]=function(_0x4d9f1b,_0x22c72a){this['rpc']['getSquareOdbcById'](_0x4d9f1b)[_0x561a('0x14')](function(_0xb023e6){_0x22c72a(null,_0xb023e6?_0xb023e6['dsn']:![]);})[_0x561a('0x16')](function(_0x88b2b5){_0x22c72a(_0x88b2b5);});};AGIVertices[_0x561a('0x11')][_0x561a('0x1c')]=function(_0x345941,_0x1bb8df){this['rpc'][_0x561a('0x1d')](_0x345941)[_0x561a('0x14')](function(_0x46ede7){_0x1bb8df(null,_0x46ede7?_0x46ede7['name']:![]);})['catch'](function(_0x25b53c){_0x1bb8df(_0x25b53c);});};AGIVertices[_0x561a('0x11')][_0x561a('0x1e')]=function(_0x1bbb57,_0x234771){this[_0x561a('0x10')][_0x561a('0x1f')](_0x1bbb57)[_0x561a('0x14')](function(_0x5bf2fa){_0x234771(null,_0x5bf2fa?_0x5bf2fa['name']:![]);})[_0x561a('0x16')](function(_0x2765c5){_0x234771(_0x2765c5);});};AGIVertices[_0x561a('0x11')][_0x561a('0x20')]=function(_0x5a0acd,_0x186862){var _0x3f0789=this;this[_0x561a('0x10')][_0x561a('0x21')](_0x5a0acd)[_0x561a('0x14')](function(_0x47f93a){_0x186862(null,_0x47f93a?_0x3f0789[_0x561a('0x22')](_0x47f93a[_0x561a('0x23')]):![]);})['catch'](function(_0x401636){_0x186862(_0x401636);});};AGIVertices[_0x561a('0x11')]['getMailAccount']=function(_0x2a147d,_0x591737){this['rpc'][_0x561a('0x24')](_0x2a147d)[_0x561a('0x14')](function(_0x4e0042){_0x591737(null,_0x4e0042?_0x4e0042:![]);})[_0x561a('0x16')](function(_0x1bc44c){_0x591737(_0x1bc44c);});};AGIVertices[_0x561a('0x11')][_0x561a('0x25')]=function(_0x169243,_0xbb2ae8,_0x33b2fc){this[_0x561a('0x26')]['sendMailMessage'](_0x169243,_0xbb2ae8)[_0x561a('0x14')](function(){_0x33b2fc(null);})[_0x561a('0x16')](function(_0x2ab150){_0x33b2fc(_0x2ab150);});};AGIVertices[_0x561a('0x11')][_0x561a('0x27')]=function(_0x4ab97f,_0xf96a9f){this[_0x561a('0x10')][_0x561a('0x28')](_0x4ab97f)[_0x561a('0x14')](function(_0x57809f){if(_0x57809f){if(_0x57809f[_0x561a('0x29')]){_0xf96a9f(null,[_0x57809f[_0x561a('0x2a')]]);}else{_0xf96a9f(null,_[_0x561a('0x2b')](_0x57809f['Intervals'],'interval'));}}else{_0xf96a9f(null,![]);}})[_0x561a('0x16')](function(_0x47a277){_0xf96a9f(_0x47a277);});};AGIVertices['prototype']['getSoundPath']=function(_0x46445a){return util[_0x561a('0x2c')](_0x561a('0x2d'),FILES_PATH,_0x46445a);};AGIVertices[_0x561a('0x11')][_0x561a('0x2e')]=function(_0x1e6417,_0x520f8b,_0x588a39){odbc[_0x561a('0x2f')](_0x1e6417,function(_0x1e7c4f){if(_0x1e7c4f){logger[_0x561a('0x30')](_0x561a('0x31'),_0x1e7c4f);_0x588a39(_0x1e7c4f);}else{logger[_0x561a('0x32')](_0x561a('0x33'));odbc[_0x561a('0x34')](_0x520f8b,function(_0x132237,_0x5865c7){if(_0x132237){logger[_0x561a('0x32')](_0x561a('0x35'),_0x520f8b);_0x588a39(_0x132237);}else{logger[_0x561a('0x32')](_0x561a('0x36'),_0x520f8b);odbc['close'](function(_0xbd11c4){if(_0xbd11c4){logger[_0x561a('0x30')](_0x561a('0x37'),_0xbd11c4);}_0x588a39(null,_0x5865c7);});}});}});};AGIVertices['prototype'][_0x561a('0x38')]=function(_0x3ae2db,_0x289c68){this[_0x561a('0x10')][_0x561a('0x39')](_0x3ae2db)[_0x561a('0x14')](function(_0x214846){_0x289c68(null,_0x214846?_0x214846:![]);})['catch'](function(_0x1253d9){_0x289c68(_0x1253d9);});};AGIVertices[_0x561a('0x11')][_0x561a('0x3a')]=function(_0x7c0a97,_0x75c0cf){this[_0x561a('0x10')]['createSmsMessage'](_0x7c0a97)[_0x561a('0x14')](function(_0xd991f8){_0x75c0cf(null,_0xd991f8);})[_0x561a('0x16')](function(_0x356599){_0x75c0cf(_0x356599);});};AGIVertices[_0x561a('0x11')][_0x561a('0x3b')]=function(_0x293e11,_0x32f8bd,_0x2e32b3){this['rpc'][_0x561a('0x3b')]({'uniqueid':this[_0x561a('0xf')]['uniqueid'],'node':_0x293e11[_0x561a('0x3c')],'application':_0x293e11['agicommand'],'data':_0x32f8bd||null,'project_name':this[_0x561a('0xf')][_0x561a('0x3d')],'callerid':this[_0x561a('0xf')][_0x561a('0x3e')]})[_0x561a('0x14')](function(_0x52ab73){if(_0x2e32b3){_0x2e32b3(null,_0x52ab73);}})[_0x561a('0x16')](function(_0x12e7c6){if(_0x2e32b3){_0x2e32b3(_0x12e7c6);}});};AGIVertices[_0x561a('0x11')][_0x561a('0x3f')]=function(_0x33cc,_0x13c6c6,_0x5ec6ac,_0x500629){this[_0x561a('0x10')]['createSquareRecording']({'uniqueid':this['channel']['uniqueid'],'callerid':this['channel']['callerid'],'calleridname':this[_0x561a('0xf')][_0x561a('0x40')],'context':this[_0x561a('0xf')]['context'],'extension':this[_0x561a('0xf')]['extension'],'priority':this['channel'][_0x561a('0x41')],'accountcode':this[_0x561a('0xf')][_0x561a('0x42')],'dnid':this['channel'][_0x561a('0x43')],'projectName':this['channel'][_0x561a('0x3d')],'saveName':_0x13c6c6,'filename':_0x33cc['file']||_0x13c6c6,'savePath':_0x5ec6ac})[_0x561a('0x14')](function(_0x43d557){_0x500629(null,_0x43d557);})[_0x561a('0x16')](function(_0x14d82b){_0x500629(_0x14d82b);});};AGIVertices[_0x561a('0x11')][_0x561a('0x44')]=function(_0x355d4f,_0x25aaf6,_0x8f048d,_0x5124a7,_0x1cb7e4){this[_0x561a('0x10')][_0x561a('0x44')]({'uniqueid':this['channel'][_0x561a('0x45')],'body':_0x355d4f,'direction':_0x25aaf6,'providerName':_0x8f048d,'providerResponse':_0x5124a7})[_0x561a('0x14')](function(_0x597ccf){if(_0x1cb7e4){_0x1cb7e4(null,_0x597ccf);}})[_0x561a('0x16')](function(_0x99dc7f){if(_0x1cb7e4){_0x1cb7e4(_0x99dc7f);}});};AGIVertices[_0x561a('0x11')]['createCmContact']=function(_0x1161e3,_0x2a050c){this[_0x561a('0x10')][_0x561a('0x46')]({'firstName':_[_0x561a('0x47')](_0x1161e3[_0x561a('0x15')])||_[_0x561a('0x48')](_0x1161e3['name'])?_0x561a('0x49')+Math[_0x561a('0x4a')]():_0x1161e3[_0x561a('0x15')],'lastName':_[_0x561a('0x47')](_0x1161e3[_0x561a('0x4b')])||_[_0x561a('0x48')](_0x1161e3[_0x561a('0x4b')])?null:_0x1161e3['lastName'],'phone':_0x1161e3[_0x561a('0x4c')],'ListId':_0x1161e3[_0x561a('0x4d')],'scheduledat':_0x1161e3[_0x561a('0x4e')],'callbackUniqueid':this['channel'][_0x561a('0x45')],'tags':'callback','description':_0x561a('0x4f')+_0x1161e3[_0x561a('0x4e')][_0x561a('0x50')](),'priority':_0x1161e3[_0x561a('0x51')]})[_0x561a('0x14')](function(_0x27b10c){_0x2a050c(null,_0x27b10c);})[_0x561a('0x16')](function(_0x4cad70){_0x2a050c(_0x4cad70);});};AGIVertices['prototype'][_0x561a('0x52')]=function(_0x2f274b,_0x370205){this[_0x561a('0x10')][_0x561a('0x53')](_0x2f274b)[_0x561a('0x14')](function(_0x4d13c8){_0x370205(null,_0x4d13c8?_0x4d13c8[_0x561a('0x15')]:![]);})[_0x561a('0x16')](function(_0x4ad9ee){_0x370205(_0x4ad9ee);});};AGIVertices[_0x561a('0x11')]['agentPause']=function(_0x5194d5,_0xc7447e,_0x16daeb){var _0x36dd1a={'role':_0x561a('0x54')};_0x36dd1a[_0x5194d5]=this['channel'][_0x561a('0x3e')];this['rpc'][_0x561a('0x55')](_0x36dd1a,_0xc7447e,this[_0x561a('0xf')][_0x561a('0x45')])['then'](function(_0x4ec13c){_0x16daeb(null,_['isNil'](_0x4ec13c)?![]:!![]);})['catch'](function(_0x5f28d7){logger[_0x561a('0x30')](_0x5f28d7);_0x16daeb(null,![]);});};AGIVertices['prototype'][_0x561a('0x56')]=function(_0xe76184,_0x209f07){var _0x4ae9a4={'role':_0x561a('0x54')};_0x4ae9a4[_0xe76184]=this[_0x561a('0xf')][_0x561a('0x3e')];this[_0x561a('0x10')][_0x561a('0x56')](_0x4ae9a4)[_0x561a('0x14')](function(_0x2ef4cf){_0x209f07(null,_[_0x561a('0x48')](_0x2ef4cf)?![]:!![]);})[_0x561a('0x16')](function(_0x1764a4){logger[_0x561a('0x30')](_0x1764a4);_0x209f07(null,![]);});};AGIVertices['prototype'][_0x561a('0x57')]=function(_0x4a904c,_0x540c46){var _0x54056b={'role':_0x561a('0x54')};_0x54056b[_0x4a904c]=this[_0x561a('0xf')]['callerid'];this[_0x561a('0x10')][_0x561a('0x57')](_0x54056b)[_0x561a('0x14')](function(_0x27e18a){_0x540c46(null,_[_0x561a('0x48')](_0x27e18a)?![]:!![]);})[_0x561a('0x16')](function(_0x51219f){logger['error'](_0x51219f);_0x540c46(null,![]);});};AGIVertices[_0x561a('0x11')][_0x561a('0x58')]=function(_0x3c8b20,_0xc9c23){var _0xbad527={'role':_0x561a('0x54')};_0xbad527[_0x3c8b20]=this['channel']['callerid'];var _0x53a93a=_0x3c8b20!=_0x561a('0x59')?util[_0x561a('0x2c')](_0x561a('0x5a'),'LOCAL',this['channel']['callerid']):undefined;this['rpc'][_0x561a('0x58')](_0xbad527,_0x53a93a)[_0x561a('0x14')](function(_0x5de26e){_0xc9c23(null,_[_0x561a('0x48')](_0x5de26e)?![]:!![]);})['catch'](function(_0x538bc9){logger[_0x561a('0x30')](_0x538bc9);_0xc9c23(null,![]);});};AGIVertices[_0x561a('0x11')]['shellCommand']=function(_0x40bc90,_0x5eb0d9){sh[_0x561a('0x5b')](_[_0x561a('0x5c')](_0x40bc90),function(_0x3b2031,_0x7d85ff){var _0x1cac4b=_0x7d85ff[_0x561a('0x5d')](/(\r\n|\n|\r)/gm,'');_0x5eb0d9(null,_0x1cac4b);});};AGIVertices[_0x561a('0x11')]['googleCloudTTS']=function(_0x4ef174,_0x41a1a7){scripts[_0x561a('0x5e')](_0x4ef174['apiKey'],_0x4ef174[_0x561a('0x5f')]||_0x561a('0x60'),_0x4ef174['text'],_0x4ef174[_0x561a('0x61')]||_0x561a('0x62'),_0x4ef174[_0x561a('0x63')]||'MALE',_0x4ef174[_0x561a('0x64')]||_0x561a('0x65'))['then'](function(_0xbb20c8){_0x41a1a7(null,_0xbb20c8);})['catch'](function(_0x5f0900){_0x41a1a7(_0x5f0900);});};AGIVertices[_0x561a('0x11')][_0x561a('0x66')]=function(_0x511793,_0x1fbf13){scripts['googleTTS'](_0x511793[_0x561a('0x60')],_0x511793['google_tts_language']||'en',0x1)[_0x561a('0x14')](function(_0x43daec){_0x1fbf13(null,_0x43daec);})[_0x561a('0x16')](function(_0x1c5905){_0x1fbf13(_0x1c5905);});};AGIVertices[_0x561a('0x11')][_0x561a('0x67')]=function(_0x4dcb3a,_0x528846){var _0x43dd9b={'uri':_0x4dcb3a[_0x561a('0x68')],'method':_0x4dcb3a['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4dcb3a[_0x561a('0x69')])===_0x561a('0x6a')&&parseInt(_0x4dcb3a[_0x561a('0x69')])>=0x1?parseInt(_0x4dcb3a[_0x561a('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x561a('0x6b')]([_0x561a('0x6c'),_0x561a('0x6d')],_0x43dd9b[_0x561a('0x6e')][_0x561a('0x6f')]())){try{_0x43dd9b[_0x561a('0x70')]=_0x4dcb3a[_0x561a('0xb')]?JSON[_0x561a('0x71')](_0x4dcb3a[_0x561a('0xb')]):{};}catch(_0x509680){logger[_0x561a('0x30')](_0x561a('0x72'),_0x509680);}}try{_0x43dd9b[_0x561a('0x73')]=_0x4dcb3a['rawHeaders']?JSON[_0x561a('0x71')](_0x4dcb3a[_0x561a('0xa')]):{};}catch(_0x3ca837){logger[_0x561a('0x30')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3ca837);}if(_0x4dcb3a[_0x561a('0x74')]){try{var _0x204a83=require(_0x4dcb3a[_0x561a('0x74')])[_0x561a('0x75')](this,_0x43dd9b);_0x43dd9b[_0x561a('0x76')]=Mustache[_0x561a('0x77')](_0x4dcb3a[_0x561a('0x68')],_0x204a83,{},['$$','$$']);if(_0x43dd9b['headers']){_0x43dd9b['headers']=JSON[_0x561a('0x71')](Mustache[_0x561a('0x77')](JSON['stringify'](_0x43dd9b['headers']),_0x204a83,{},['$$','$$']));}if(_0x43dd9b['body']){_0x43dd9b[_0x561a('0x70')]=JSON[_0x561a('0x71')](Mustache[_0x561a('0x77')](JSON['stringify'](_0x43dd9b['body']),_0x204a83,{},['$$','$$']));}}catch(_0x4ec14a){logger[_0x561a('0x30')](_0x561a('0x78'),_0x4ec14a);}}rp(_0x43dd9b)[_0x561a('0x14')](function(_0x1b5e89){var _0x4b53dc={'statusCode':_0x1b5e89[_0x561a('0x79')]||0xc8,'statusMessage':_0x1b5e89[_0x561a('0x7a')]||'OK','headers':_0x1b5e89[_0x561a('0x73')]||{},'body':_0x1b5e89[_0x561a('0x70')]||{}};_0x528846(null,_0x4b53dc);})[_0x561a('0x16')](function(_0x562c71){var _0x59a5d0={'statusCode':_0x562c71[_0x561a('0x79')]||0x1f4,'statusMessage':_0x562c71[_0x561a('0x7b')]||_0x561a('0x7c'),'headers':_0x562c71[_0x561a('0x7d')][_0x561a('0x73')]||{},'body':_0x562c71[_0x561a('0x7d')]['body']||{}};_0x528846(null,_0x59a5d0);});};AGIVertices[_0x561a('0x11')][_0x561a('0x7e')]=function(_0x168fe8,_0x443a4a){scripts[_0x561a('0x7e')](this['channel'][_0x561a('0x45')],_0x168fe8[_0x561a('0x7f')],_0x168fe8[_0x561a('0x60')],_0x168fe8[_0x561a('0x80')]||'en')[_0x561a('0x14')](function(_0x156f6c){_0x443a4a(null,_0x156f6c);})[_0x561a('0x16')](function(_0x2dadf8){_0x443a4a(_0x2dadf8);});};AGIVertices[_0x561a('0x11')]['googleDialogflowV2']=function(_0x379e9e,_0x2d3cb3){scripts[_0x561a('0x81')](this[_0x561a('0xf')][_0x561a('0x45')],_0x379e9e[_0x561a('0x82')],_0x379e9e[_0x561a('0x83')],_0x379e9e['private_key'],_0x379e9e[_0x561a('0x60')],_0x379e9e[_0x561a('0x84')]||'en')['then'](function(_0x1eb6aa){_0x2d3cb3(null,_0x1eb6aa);})[_0x561a('0x16')](function(_0x2b22dd){_0x2d3cb3(_0x2b22dd);});};AGIVertices[_0x561a('0x11')]['sestekNDA']=function(_0x4493e9,_0x19d817){scripts[_0x561a('0x85')](this[_0x561a('0xf')],_0x4493e9)[_0x561a('0x14')](function(_0x1c6514){_0x19d817(null,_0x1c6514);})[_0x561a('0x16')](function(_0x3bbc5b){_0x19d817(_0x3bbc5b);});};AGIVertices['prototype']['ispeechTTS']=function(_0x147762,_0x4a3c8a){scripts[_0x561a('0x86')](_0x147762[_0x561a('0x7f')],_0x147762[_0x561a('0x60')],_0x147762['ispeech_tts_language']||_0x561a('0x62'),_0x147762[_0x561a('0x87')])[_0x561a('0x14')](function(_0x1d2cfd){_0x4a3c8a(null,_0x1d2cfd);})['catch'](function(_0x44328d){_0x4a3c8a(_0x44328d);});};AGIVertices[_0x561a('0x11')]['ispeechASR']=function(_0x515820,_0x54c6cc,_0x56d02e){scripts[_0x561a('0x88')](_0x54c6cc,_0x515820[_0x561a('0x7f')],_0x515820['ispeech_asr_language']||_0x561a('0x62'),this[_0x561a('0x89')](_0x515820[_0x561a('0x8a')])?_0x515820[_0x561a('0x8a')]:undefined)[_0x561a('0x14')](function(_0x40a372){_0x56d02e(null,_0x40a372);})[_0x561a('0x16')](function(_0x603e94){_0x56d02e(_0x603e94);});};AGIVertices[_0x561a('0x11')]['awsPolly']=function(_0xa02f30,_0x643bdd){scripts['awsPolly'](_0xa02f30[_0x561a('0x8b')],_0xa02f30[_0x561a('0x8c')],_0xa02f30[_0x561a('0x8d')],_0xa02f30[_0x561a('0x8e')]||_0x561a('0x8f'),_0xa02f30['text'],_0xa02f30[_0x561a('0x90')]||_0x561a('0x60'))[_0x561a('0x14')](function(_0x218f31){_0x643bdd(null,_0x218f31);})[_0x561a('0x16')](function(_0x2be528){_0x643bdd(_0x2be528);});};AGIVertices[_0x561a('0x11')]['awsLex']=function(_0x299d9c,_0x1f96cb){scripts[_0x561a('0x91')](this['channel']['uniqueid'],_0x299d9c[_0x561a('0x8b')],_0x299d9c['aws_secret_access_key'],_0x299d9c[_0x561a('0x92')],_0x299d9c[_0x561a('0x60')],_0x299d9c[_0x561a('0x93')])[_0x561a('0x14')](function(_0x566492){_0x1f96cb(null,_0x566492);})[_0x561a('0x16')](function(_0x41439e){_0x1f96cb(_0x41439e);});};AGIVertices[_0x561a('0x11')][_0x561a('0x94')]=function(_0x33653b,_0x110001,_0x579437){scripts[_0x561a('0x94')](_0x110001,_0x33653b[_0x561a('0x7f')],_0x33653b[_0x561a('0x95')]||'en-US')[_0x561a('0x14')](function(_0x412753){_0x579437(null,_0x412753);})[_0x561a('0x16')](function(_0x454ce0){_0x579437(_0x454ce0);});};AGIVertices[_0x561a('0x11')][_0x561a('0x96')]=function(_0x1d1adb,_0x1939cc,_0x5978e1){scripts['tildeASR'](_0x1939cc,_0x1d1adb[_0x561a('0x97')],_0x1d1adb[_0x561a('0x98')],_0x1d1adb[_0x561a('0x76')])[_0x561a('0x14')](function(_0x34fb60){_0x5978e1(null,_0x34fb60);})[_0x561a('0x16')](function(_0x280a26){_0x5978e1(_0x280a26);});};AGIVertices[_0x561a('0x11')][_0x561a('0x99')]=function(_0xf3351c){var _0x5517c0=_[_0x561a('0x6b')](verticesWithRetry,_0xf3351c[_0x561a('0x9a')])?_0xf3351c:_[_0x561a('0x9b')](_0xf3351c);for(var _0x437754 in _0x5517c0){if(_0x5517c0[_0x561a('0x9c')](_0x437754)){if(_0x5517c0[_0x437754]&&_['isString'](_0x5517c0[_0x437754])){if(_[_0x561a('0x6b')](recursiveMapAttributes,_0x437754)){_0x5517c0[_0x437754]=this[_0x561a('0x9d')](_0x5517c0[_0x437754]);}else{_0x5517c0[_0x437754]=this[_0x561a('0x9e')](_0x5517c0[_0x437754]);}}}}return _0x5517c0;};AGIVertices[_0x561a('0x11')]['recursiveNodeIndex']=function(_0x1f807d){for(var _0x4c1a68 in _0x1f807d){if(_0x1f807d['hasOwnProperty'](_0x4c1a68)){if(_['isPlainObject'](_0x1f807d[_0x4c1a68])){this[_0x561a('0x9f')](_0x1f807d[_0x4c1a68]);}else if(_[_0x561a('0xa0')](_0x1f807d[_0x4c1a68])){for(var _0x1a8e29=0x0;_0x1a8e29<_0x1f807d[_0x4c1a68][_0x561a('0xa1')];_0x1a8e29++){this[_0x561a('0x9f')](_0x1f807d[_0x4c1a68][_0x1a8e29]);}}else if(_[_0x561a('0xa2')](_0x1f807d[_0x4c1a68])){_0x1f807d[_0x4c1a68]=this[_0x561a('0x9e')](_0x1f807d[_0x4c1a68]);}}}};AGIVertices[_0x561a('0x11')][_0x561a('0xa3')]=function(_0x1fa4f0,_0x3b94ba){for(var _0x466d8a in _0x1fa4f0){if(_0x1fa4f0[_0x561a('0x9c')](_0x466d8a)){if(_[_0x561a('0xa4')](_0x1fa4f0[_0x466d8a])){if(!_[_0x561a('0x47')](_0x1fa4f0[_0x466d8a])){this[_0x561a('0xa3')](_0x1fa4f0[_0x466d8a],util[_0x561a('0x2c')](_0x561a('0xa5'),_0x3b94ba,_0x466d8a));}}else if(_[_0x561a('0xa0')](_0x1fa4f0[_0x466d8a])){for(var _0x33a52f=0x0;_0x33a52f<_0x1fa4f0[_0x466d8a][_0x561a('0xa1')];_0x33a52f++){this[_0x561a('0xa3')](_0x1fa4f0[_0x466d8a][_0x33a52f],util[_0x561a('0x2c')](_0x561a('0xa5'),_0x3b94ba,_0x466d8a+'['+_0x33a52f+']'));}}else{if(!_[_0x561a('0x48')](_0x1fa4f0[_0x466d8a])){this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0xa5'),_0x3b94ba,_0x466d8a),_0x1fa4f0[_0x466d8a]);}}}}};AGIVertices['prototype'][_0x561a('0x9d')]=function(_0xc23457){try{var _0x5079a8=JSON[_0x561a('0x71')](_0xc23457);this[_0x561a('0x9f')](_0x5079a8);return JSON[_0x561a('0xa7')](_0x5079a8);}catch(_0x1712c4){return this[_0x561a('0x9e')](_0xc23457);}};AGIVertices[_0x561a('0x11')]['replaceAllVariables']=function(_0x41bc18){var _0x20fc12=_0x41bc18[_0x561a('0xa8')]('{');for(var _0x4dda7a=0x1;_0x4dda7a<_0x20fc12[_0x561a('0xa1')];_0x4dda7a+=0x1){var _0x3012e7=_0x20fc12[_0x4dda7a][_0x561a('0xa8')]('}');if(_0x3012e7[_0x561a('0xa1')]>0x1){_0x41bc18=_0x41bc18[_0x561a('0xa9')]('{'+_0x3012e7[0x0]+'}',this[_0x561a('0xf')][_0x561a('0x12')](_0x3012e7[0x0])[_0x561a('0xaa')]||_0x3012e7[0x0]);}}if(_0x20fc12[_0x561a('0xa1')]===0x1){return _0x41bc18[_0x561a('0x50')]();}return this[_0x561a('0x9e')](_0x41bc18);};AGIVertices[_0x561a('0x11')][_0x561a('0xab')]=function(_0x1498b1,_0xe1b486){var _0x469c6e=this[_0x561a('0xf')][_0x561a('0x12')](_0x1498b1);if(_0x469c6e[_0x561a('0xac')]===-0x1){return _0x469c6e;}logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0xad'),_0xe1b486,_0x469c6e[_0x561a('0xaa')]));return this['channel'][_0x561a('0xa6')](_0xe1b486,_0x469c6e[_0x561a('0xaa')]);};AGIVertices[_0x561a('0x11')][_0x561a('0x89')]=function(_0x3300ec){return _0x3300ec&&_0x3300ec!=='0'&&_0x3300ec!=='-1'&&_0x3300ec!=='';};AGIVertices['prototype'][_0x561a('0xae')]=function(_0x3d2c16){this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x3d2c16,'-');_0x3d2c16['retry']=_0x3d2c16['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x561a('0x11')][_0x561a('0xaf')]=function(_0x899c29){logger['info'](util[_0x561a('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x899c29['label']));if(!this['isConfigured'](_0x899c29[_0x561a('0x60')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x525fe1='\x22'+_0x899c29[_0x561a('0x60')]+'\x22';if(this[_0x561a('0x89')](_0x899c29[_0x561a('0x7d')])){_0x525fe1+=','+_0x899c29[_0x561a('0x7d')];}var _0x343562=this[_0x561a('0xf')][_0x561a('0x5b')]('MRCPSynth',_0x525fe1);if(_0x343562[_0x561a('0xac')]===-0x1){return _0x343562;}return this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xb1'),_0x525fe1));};AGIVertices[_0x561a('0x11')][_0x561a('0xb2')]=function(_0x53f83b){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x53f83b[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x53f83b['grammar'])){return this['channel']['noop'](_0x561a('0xb3'));}var _0xb902c2=_0x53f83b['grammar'];if(this[_0x561a('0x89')](_0x53f83b[_0x561a('0x7d')])){_0xb902c2+=','+_0x53f83b[_0x561a('0x7d')];}var _0x3f32fa=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0xb4'),_0xb902c2);if(_0x3f32fa[_0x561a('0xac')]===-0x1){return _0x3f32fa;}var _0x6be5bd=this[_0x561a('0xab')](_0x561a('0xb5'),_0x561a('0xb6'));if(_0x6be5bd[_0x561a('0xac')]===-0x1){return _0x6be5bd;}var _0x3816c0=this[_0x561a('0xab')](_0x561a('0xb7'),_0x561a('0xb8'));if(_0x3816c0[_0x561a('0xac')]===-0x1){return _0x3816c0;}var _0x23fd43=this['getAndSetVariable'](_0x561a('0xb9'),'MRCP_RECOG_INSTANCE');if(_0x23fd43[_0x561a('0xac')]===-0x1){return _0x23fd43;}return this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0xb902c2));};AGIVertices[_0x561a('0x11')][_0x561a('0x7')]=function(_0x46b7df){logger['info'](util[_0x561a('0x2c')](_0x561a('0xba'),_0x46b7df[_0x561a('0x3c')]));return this[_0x561a('0xf')]['agi']([_0x46b7df['command'],_0x46b7df['args']]);};AGIVertices[_0x561a('0x11')][_0x561a('0xbb')]=function(_0x3e12eb){logger['info'](util['format'](_0x561a('0xbc'),_0x3e12eb[_0x561a('0x3c')]));if(this[_0x561a('0x89')](_0x3e12eb[_0x561a('0x69')])){logger['info'](util[_0x561a('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3e12eb[_0x561a('0x69')]));var _0x26a537=this[_0x561a('0xf')][_0x561a('0xbd')](_0x3e12eb[_0x561a('0x69')]);if(_0x26a537[_0x561a('0xac')]===-0x1){return _0x26a537;}}return this[_0x561a('0xf')]['answer']();};AGIVertices['prototype'][_0x561a('0xbe')]=function(_0x3ad2f3){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3ad2f3[_0x561a('0x3c')]));if(!this['isConfigured'](_0x3ad2f3[_0x561a('0x4d')])){return this[_0x561a('0xf')]['error'](_0x3ad2f3,_0x561a('0xbf'));}_0x3ad2f3[_0x561a('0x4e')]=moment();if(this['isConfigured'](_0x3ad2f3[_0x561a('0xc0')])){_0x3ad2f3['scheduledAt']=moment()[_0x561a('0xc1')](_0x3ad2f3[_0x561a('0xc0')],_0x561a('0xc2'));}if(!this['isConfigured'](_0x3ad2f3['callback_priority'])){_0x3ad2f3['callback_priority']=0x2;}this['createCmContact'][_0x561a('0x75')](this,_0x3ad2f3);return this['channel']['noop'](util[_0x561a('0x2c')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x3ad2f3[_0x561a('0x4c')],_0x3ad2f3['list_id'],_0x3ad2f3[_0x561a('0x4e')]));};AGIVertices[_0x561a('0x11')][_0x561a('0xc3')]=function(_0x244621){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0xc4'),_0x244621[_0x561a('0x3c')]));var _0xaf717f=this[_0x561a('0xf')][_0x561a('0x5b')](_0x244621['application'],_0x244621[_0x561a('0x7d')]);if(_0xaf717f[_0x561a('0xac')]===-0x1){return _0xaf717f;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xc5'),_0x244621[_0x561a('0xc6')],_0x244621[_0x561a('0x7d')]));};AGIVertices[_0x561a('0x11')][_0x561a('0xc7')]=function(_0x281531){logger[_0x561a('0x32')](util['format'](_0x561a('0xc8'),_0x281531['label']));if(!this[_0x561a('0x89')](_0x281531[_0x561a('0x60')])){return this[_0x561a('0xf')]['noop'](_0x561a('0xc9'));}var _0x36383a='\x22'+_0x281531['text']+'\x22';if(this['isConfigured'](_0x281531[_0x561a('0x7d')])){_0x36383a+=','+_0x281531[_0x561a('0x7d')];}var _0x1944a1=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0xca'),_0x36383a);if(_0x1944a1[_0x561a('0xac')]===-0x1){return _0x1944a1;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xb1'),_0x36383a));};AGIVertices[_0x561a('0x11')][_0x561a('0xcb')]=function(_0x96cdc3){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0xcc'),_0x96cdc3[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x96cdc3[_0x561a('0x60')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20text\x20configured');}var _0x478001='\x22'+_0x96cdc3[_0x561a('0x60')]+'\x22';if(this[_0x561a('0x89')](_0x96cdc3[_0x561a('0x7d')])){_0x478001+=','+_0x96cdc3[_0x561a('0x7d')];}var _0x145c0c=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0xca'),_0x478001);if(_0x145c0c[_0x561a('0xac')]===-0x1){return _0x145c0c;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x478001));};AGIVertices[_0x561a('0x11')][_0x561a('0xcd')]=function(_0x5dde47){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0xce'),_0x5dde47[_0x561a('0x3c')]));if(!this['isConfigured'](_0x5dde47[_0x561a('0xcf')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xb3'));}var _0xc6c8f4=_0x5dde47[_0x561a('0xcf')];if(this[_0x561a('0x89')](_0x5dde47[_0x561a('0x7d')])){_0xc6c8f4+=','+_0x5dde47[_0x561a('0x7d')];}var _0x547928=this[_0x561a('0xf')]['exec'](_0x561a('0xb4'),_0xc6c8f4);if(_0x547928[_0x561a('0xac')]===-0x1){return _0x547928;}var _0x37d954=this[_0x561a('0xab')](_0x561a('0xb5'),_0x561a('0xd0'));if(_0x37d954['result']===-0x1){return _0x37d954;}var _0x48744e=this[_0x561a('0xab')](_0x561a('0xb7'),_0x561a('0xd1'));if(_0x48744e[_0x561a('0xac')]===-0x1){return _0x48744e;}var _0x543827=this[_0x561a('0xab')](_0x561a('0xb9'),'LUMENVOX_ASR_INSTANCE');if(_0x543827[_0x561a('0xac')]===-0x1){return _0x543827;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0xc6c8f4));};AGIVertices['prototype'][_0x561a('0xd2')]=function(_0x14f074){logger[_0x561a('0x32')](util['format'](_0x561a('0xd3'),_0x14f074[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x14f074['grammar'])){return this['channel'][_0x561a('0xb0')]('no\x20grammar\x20configured');}var _0x4198a3=_0x14f074['grammar'];if(this['isConfigured'](_0x14f074[_0x561a('0x7d')])){_0x4198a3+=','+_0x14f074[_0x561a('0x7d')];}var _0x1a2b9a=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0xb4'),_0x4198a3);if(_0x1a2b9a[_0x561a('0xac')]===-0x1){return _0x1a2b9a;}var _0x4cebf9=this[_0x561a('0xab')]('RECOG_CONFIDENCE()',_0x561a('0xd4'));if(_0x4cebf9[_0x561a('0xac')]===-0x1){return _0x4cebf9;}var _0x3fee16=this[_0x561a('0xab')](_0x561a('0xb7'),'SESTEK_ASR_TRANSCRIPT');if(_0x3fee16[_0x561a('0xac')]===-0x1){return _0x3fee16;}var _0x41e9c5=this[_0x561a('0xab')](_0x561a('0xb9'),_0x561a('0xd5'));if(_0x41e9c5['result']===-0x1){return _0x41e9c5;}return this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0xd6'),_0x4198a3));};AGIVertices[_0x561a('0x11')]['database']=function(_0x157bf0){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x157bf0[_0x561a('0x3c')]));if(!this['isConfigured'](_0x157bf0['odbc_id'])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x157bf0,_0x561a('0xd7'));}var _0x20849f=this['getSquareOdbc'][_0x561a('0x75')](this,_0x157bf0[_0x561a('0xd8')]);if(!_0x20849f){return this[_0x561a('0xf')][_0x561a('0x30')](_0x157bf0,_0x561a('0xd9'));}if(!this[_0x561a('0x89')](_0x157bf0[_0x561a('0x34')])){return this[_0x561a('0xf')]['error'](_0x157bf0,_0x561a('0xda'));}var _0xbe1dbf=_0x157bf0['query'][_0x561a('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xdb'),_0xbe1dbf));var _0x38b7c8=this[_0x561a('0x2e')][_0x561a('0x75')](this,_0x20849f,_0xbe1dbf);this['createSquareDetailsReport'][_0x561a('0x75')](this,_0x157bf0,_0xbe1dbf);if(!this[_0x561a('0x89')](_0x157bf0['variable_id'])){return this[_0x561a('0xf')]['noop'](_0x561a('0xdc'));}var _0x3ca7db=this['getVariable'][_0x561a('0x75')](this,_0x157bf0[_0x561a('0xdd')]);if(!_0x3ca7db){return this[_0x561a('0xf')]['error'](_0x157bf0,_0x561a('0xde'));}var _0x5597c5=this;_0x38b7c8[_0x561a('0xdf')](function(_0x34a0ed,_0x2118ed){Object['keys'](_0x34a0ed)[_0x561a('0xdf')](function(_0x4b9dfc){_0x5597c5[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0xe0'),_0x3ca7db,_0x2118ed,_0x4b9dfc),_0x34a0ed[_0x4b9dfc]);});});this[_0x561a('0xf')]['setVariable'](util['format'](_0x561a('0xe1'),_0x3ca7db),_0x38b7c8[_0x561a('0xa1')]);return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xe2'),_0x3ca7db));};AGIVertices['prototype'][_0x561a('0xe3')]=function(_0x2cb029){logger[_0x561a('0xe4')](util[_0x561a('0x2c')](_0x561a('0xe5'),_0x2cb029[_0x561a('0x3c')]));if(!this['isConfigured'](_0x2cb029[_0x561a('0xe6')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x2cb029,_0x561a('0xe7'));}var _0xbc155e=this['getUser'][_0x561a('0x75')](this,_0x2cb029[_0x561a('0xe6')]);if(!_0xbc155e){return this[_0x561a('0xf')][_0x561a('0x30')](_0x2cb029,_0x561a('0xe8'));}var _0x2f2744=this[_0x561a('0xf')][_0x561a('0x5b')]('DIAL',[util[_0x561a('0x2c')](_0x561a('0xe9'),_0xbc155e),_0x2cb029[_0x561a('0x69')],_0x2cb029['opts'],_0x2cb029['url']]);if(_0x2f2744[_0x561a('0xac')]===-0x1){return _0x2f2744;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xea'),'DIAL'));};AGIVertices[_0x561a('0x11')][_0x561a('0xeb')]=function(_0x1aec46){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0xec'),_0x1aec46['label']));if(!this[_0x561a('0x89')](_0x1aec46[_0x561a('0x7f')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xed'));}if(!this[_0x561a('0x89')](_0x1aec46[_0x561a('0x60')])){return this['channel']['noop'](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xee')]=!![];this[_0x561a('0x3b')](_0x1aec46);this[_0x561a('0x44')](_0x1aec46[_0x561a('0x60')],'in','','');this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xef'),_0x1aec46[_0x561a('0x60')]));var _0x32b3fd=this[_0x561a('0x7e')][_0x561a('0x75')](this,_0x1aec46);if(_0x32b3fd){for(var _0x2e5079 in _0x32b3fd){if(_0x32b3fd['hasOwnProperty'](_0x2e5079)){this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0xf0'),_0x2e5079[_0x561a('0x6f')]()),_0x32b3fd[_0x2e5079]);}}this[_0x561a('0x44')](_0x32b3fd[_0x561a('0xf1')],_0x561a('0xf2'),_0x561a('0xeb'),'');return this['channel'][_0x561a('0xb0')](util['format'](_0x561a('0xf3'),_0x32b3fd['speech']));}return this[_0x561a('0xf')]['error'](_0x1aec46,_0x561a('0xf4'));};AGIVertices['prototype'][_0x561a('0xf5')]=function(_0xe4fa70){logger['info'](util[_0x561a('0x2c')](_0x561a('0xf6'),_0xe4fa70['label']));if(!this['isConfigured'](_0xe4fa70[_0x561a('0x82')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20project_id\x20configured');}if(!this[_0x561a('0x89')](_0xe4fa70[_0x561a('0x83')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xf7'));}if(!this[_0x561a('0x89')](_0xe4fa70['private_key'])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xf8'));}if(!this[_0x561a('0x89')](_0xe4fa70['dialogflowV2_language'])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20anguage\x20configured');}if(!this[_0x561a('0x89')](_0xe4fa70['text'])){return this['channel'][_0x561a('0xb0')](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xee')]=!![];this[_0x561a('0x3b')](_0xe4fa70);this[_0x561a('0x44')](_0xe4fa70[_0x561a('0x60')],'in','','');this['channel']['noop'](util[_0x561a('0x2c')](_0x561a('0xf9'),_0xe4fa70[_0x561a('0x60')]));var _0x54ef65=this[_0x561a('0x81')][_0x561a('0x75')](this,_0xe4fa70);if(_0x54ef65){for(var _0x2c569a in _0x54ef65){if(_0x54ef65[_0x561a('0x9c')](_0x2c569a)){if(_0x2c569a!==_0x561a('0xfa')){this[_0x561a('0xf')][_0x561a('0xa6')](util['format']('DIALOGFLOW_%s',_0x2c569a[_0x561a('0x6f')]()),_0x54ef65[_0x2c569a]);}}}this[_0x561a('0x44')](_0x54ef65['speech'],_0x561a('0xf2'),'dialogflowV2',_0x54ef65['providerResponse']);return this['channel'][_0x561a('0xb0')](util['format'](_0x561a('0xfb'),_0x54ef65['speech']));}return this[_0x561a('0xf')][_0x561a('0x30')](_0xe4fa70,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x561a('0x11')][_0x561a('0xfc')]=function(_0x4b5d36){logger['info'](util[_0x561a('0x2c')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4b5d36[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x4b5d36[_0x561a('0xfd')])){return this['channel'][_0x561a('0xb0')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x561a('0x89')](_0x4b5d36['username'])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xfe'));}if(!this[_0x561a('0x89')](_0x4b5d36[_0x561a('0xff')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x100'));}if(!this['isConfigured'](_0x4b5d36[_0x561a('0x101')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xee')]=!![];this[_0x561a('0x3b')](_0x4b5d36);this[_0x561a('0x44')](_0x4b5d36['text'],'in','','');this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x102'),_0x4b5d36[_0x561a('0x60')]));var _0x228ba0=this[_0x561a('0x85')][_0x561a('0x75')](this,_0x4b5d36);if(_0x228ba0){for(var _0x401b5a in _0x228ba0){if(_0x228ba0['hasOwnProperty'](_0x401b5a)){this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')]('SESTEK_NDA_%s',_0x401b5a['toUpperCase']()),_0x228ba0[_0x401b5a]);}}this[_0x561a('0x44')](_0x228ba0[_0x561a('0xf1')],_0x561a('0xf2'),_0x561a('0xfc'),'');if(_0x228ba0[_0x561a('0x103')]){this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x104'),_0x228ba0[_0x561a('0x103')]));var _0x4563b4=this[_0x561a('0xf')]['streamFile'](_0x228ba0[_0x561a('0x103')]);try{fs[_0x561a('0x105')](_0x228ba0[_0x561a('0x103')]+_0x561a('0x106'));}catch(_0x5b962a){logger[_0x561a('0x30')](_0x5b962a);}return _0x4563b4;}else{return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x107'),_0x228ba0[_0x561a('0xf1')]));}}return this[_0x561a('0xf')][_0x561a('0x30')](_0x4b5d36,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x561a('0x11')][_0x561a('0x108')]=function(_0x47bca0){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x109'),_0x47bca0['label']));return this[_0x561a('0xf')]['noop'](_0x561a('0x108'));};AGIVertices[_0x561a('0x11')][_0x561a('0x10a')]=function(_0x2c4dd6){logger['info'](util[_0x561a('0x2c')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2c4dd6['label']));var _0x1e25af='';if(_0x2c4dd6['trunk_id']){if(!this[_0x561a('0x89')](_0x2c4dd6['trunk_id'])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x2c4dd6,_0x561a('0x10b'));}else{var _0x5a3adc=parseInt(_0x2c4dd6[_0x561a('0x10c')],0xa);if(isNaN(_0x5a3adc)){_0x1e25af=_0x2c4dd6[_0x561a('0x10c')];}else{_0x1e25af=this[_0x561a('0x1e')][_0x561a('0x75')](this,_0x2c4dd6[_0x561a('0x10c')]);if(!_0x1e25af){return this['channel'][_0x561a('0x30')](_0x2c4dd6,_0x561a('0x10d'));}}}}else if(_0x2c4dd6[_0x561a('0x10e')]){_0x1e25af=_0x2c4dd6[_0x561a('0x10e')];}else{return this[_0x561a('0xf')][_0x561a('0x30')](_0x2c4dd6,'no\x20trunk\x20selected');}var _0x23f47b=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0x10f'),[util[_0x561a('0x2c')]('SIP/%s/%s',_0x1e25af,_0x2c4dd6['phone']),_0x2c4dd6[_0x561a('0x69')],_0x2c4dd6[_0x561a('0x110')],_0x2c4dd6[_0x561a('0x68')]]);if(_0x23f47b[_0x561a('0xac')]===-0x1){return _0x23f47b;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xea'),_0x561a('0x10f')));};AGIVertices[_0x561a('0x11')][_0x561a('0x111')]=function(_0xa229e6){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x112'),_0xa229e6[_0x561a('0x3c')]));return this[_0x561a('0xf')]['noop'](_0x561a('0x111'));};AGIVertices[_0x561a('0x11')][_0x561a('0xd')]=function(_0x22eea7){logger[_0x561a('0x32')](util['format'](_0x561a('0x113'),_0x22eea7[_0x561a('0x3c')]));if(_0x22eea7[_0x561a('0x114')]===0x0){return this[_0x561a('0xae')](_0x22eea7);}_0x22eea7[_0x561a('0x114')]-=0x1;if(!this[_0x561a('0x89')](_0x22eea7[_0x561a('0x115')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x22eea7,'no\x20file\x20audio\x20selected');}var _0x338aa2=this[_0x561a('0x20')][_0x561a('0x75')](this,_0x22eea7[_0x561a('0x115')]);if(!_0x338aa2){return this['channel'][_0x561a('0x30')](_0x22eea7,_0x561a('0x116'));}if(!this[_0x561a('0x89')](_0x22eea7['variable_id'])){return this[_0x561a('0xf')]['error'](_0x561a('0xdc'));}var _0x4dde3e=this[_0x561a('0xf')][_0x561a('0x117')](_0x338aa2,_0x22eea7['response'],_0x22eea7['maxdigit']);var _0x173817=_0x4dde3e[_0x561a('0xac')]?_0x4dde3e[_0x561a('0xac')]['toString']():'';logger['info'](_0x561a('0x118'),JSON[_0x561a('0xa7')](_0x4dde3e));if(_0x4dde3e[_0x561a('0xac')]===-0x1){this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x22eea7,_0x173817);return _0x4dde3e;}else if(_0x4dde3e['extra']==='timeout'){_0x4dde3e['result']=_0x173817[_0x561a('0xa1')]>=parseInt(_0x22eea7[_0x561a('0x119')])?'x':'i';}else{_0x4dde3e[_0x561a('0xac')]=_0x173817[_0x561a('0xa1')]>=parseInt(_0x22eea7['mindigit'])&&_0x173817['length']<=parseInt(_0x22eea7[_0x561a('0x11a')])?'x':'i';}var _0x1c3ec6=this[_0x561a('0x12')][_0x561a('0x75')](this,_0x22eea7[_0x561a('0xdd')]);if(!_0x1c3ec6){return this[_0x561a('0xf')][_0x561a('0x30')](_0x22eea7,_0x561a('0xde'));}this[_0x561a('0xf')]['setVariable'](_0x1c3ec6,_0x173817);if(this['isConfigured'](_0x22eea7[_0x561a('0x11b')])){var _0x4bc4ff=parseInt(_0x22eea7[_0x561a('0x11b')],0xa);var _0x4753f0=rs[_0x561a('0x11c')]({'charset':'*','length':_0x4bc4ff});var _0x3b31b7=_0x173817[_0x561a('0xa1')];if(_0x3b31b7>0x0){if(_0x3b31b7>_0x4bc4ff){this[_0x561a('0x3b')]['sync'](this,_0x22eea7,_0x22eea7['hiddendigitspos']===_0x561a('0x11d')?_0x4753f0+_0x173817[_0x561a('0x11e')](_0x4bc4ff):_0x173817[_0x561a('0x11e')](0x0,_0x3b31b7-_0x4bc4ff)+_0x4753f0);}else{this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x22eea7,rs['generate']({'charset':'*','length':_0x3b31b7}));}}else{this['createSquareDetailsReport'][_0x561a('0x75')](this,_0x22eea7,'');}}else{this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x22eea7,_0x173817);}return _0x4dde3e;};AGIVertices['prototype'][_0x561a('0xe')]=function(_0x579d23){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x11f'),_0x579d23[_0x561a('0x3c')]));return this[_0x561a('0xd')](_0x579d23);};AGIVertices[_0x561a('0x11')][_0x561a('0x120')]=function(_0x37da8e){logger[_0x561a('0x32')](util['format'](_0x561a('0x121'),_0x37da8e[_0x561a('0x3c')]));this[_0x561a('0x3b')]['sync'](this,_0x37da8e,_0x37da8e['goalname']);return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x122'),_0x37da8e[_0x561a('0x123')]));};AGIVertices[_0x561a('0x11')][_0x561a('0x124')]=function(_0x5b92d9){logger[_0x561a('0x32')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x5b92d9[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x5b92d9[_0x561a('0x8b')])||!this['isConfigured'](_0x5b92d9[_0x561a('0x8c')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x561a('0x89')](_0x5b92d9[_0x561a('0x60')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x125'),_0x5b92d9['text']));var _0x3308e8=this[_0x561a('0x126')][_0x561a('0x75')](this,_0x5b92d9);if(_0x3308e8){this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x127'),_0x3308e8));var _0x42437e=this[_0x561a('0xf')][_0x561a('0x128')](_0x3308e8);try{fs['unlink'](_0x3308e8+_0x561a('0x106'));}catch(_0x24320f){logger[_0x561a('0x30')](_0x24320f);}return _0x42437e;}return this[_0x561a('0xf')][_0x561a('0x30')](_0x5b92d9,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x561a('0x11')][_0x561a('0x129')]=function(_0xe19a4a){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xe19a4a['label']));if(!this[_0x561a('0x89')](_0xe19a4a['aws_access_key_id'])||!this[_0x561a('0x89')](_0xe19a4a[_0x561a('0x8c')])){return this['channel']['noop'](_0x561a('0x12a'));}if(!this[_0x561a('0x89')](_0xe19a4a[_0x561a('0x93')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20bot\x20name\x20configured');}if(!this[_0x561a('0x89')](_0xe19a4a[_0x561a('0x60')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xee')]=!![];this[_0x561a('0x3b')](_0xe19a4a);this[_0x561a('0x44')](_0xe19a4a[_0x561a('0x60')],'in','','');this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x12b'),_0xe19a4a[_0x561a('0x60')]));var _0x2ba60d=this[_0x561a('0x91')][_0x561a('0x75')](this,_0xe19a4a);if(_0x2ba60d){for(var _0x2f86b4 in _0x2ba60d){if(_0x2ba60d[_0x561a('0x9c')](_0x2f86b4)&&_['isString'](_0x2ba60d[_0x2f86b4])){this['channel'][_0x561a('0xa6')](util[_0x561a('0x2c')]('AWS_LEX_%s',_0x2f86b4['toUpperCase']()),_0x2ba60d[_0x2f86b4]);}}if(_[_0x561a('0x48')](_0x2ba60d[_0x561a('0x7b')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x561a('0x44')](_0x2ba60d[_0x561a('0x7b')],_0x561a('0xf2'),_0x561a('0x12c'),'');return this[_0x561a('0xf')][_0x561a('0xb0')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x2ba60d[_0x561a('0x7b')]));}}return this[_0x561a('0xf')][_0x561a('0x30')](_0xe19a4a,_0x561a('0x12d'));};AGIVertices[_0x561a('0x11')][_0x561a('0x12e')]=function(_0x18f10d){logger['info'](util['format'](_0x561a('0x12f'),_0x18f10d[_0x561a('0x3c')],_0x18f10d['timeout']));if(!this[_0x561a('0x89')](_0x18f10d[_0x561a('0x7f')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xed'));}var _0x2d38c0='wav';var _0x210cdb=util[_0x561a('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0x561a('0x11c')](0x4));var _0x1aaf25=util[_0x561a('0x2c')](_0x561a('0xa5'),_0x210cdb,_0x2d38c0);var _0x3d7f30=!![];if(_0x18f10d['beep']===_0x561a('0x130')){_0x3d7f30=![];}var _0x32fa16=this[_0x561a('0xf')][_0x561a('0x131')](_0x210cdb,_0x2d38c0,_0x18f10d[_0x561a('0x132')],_0x18f10d[_0x561a('0x69')],undefined,_0x3d7f30);if(_0x32fa16[_0x561a('0xac')]!==-0x1){this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0x133'),_0x1aaf25));var _0x26eb58=this[_0x561a('0x94')][_0x561a('0x75')](this,_0x18f10d,_0x1aaf25);if(_0x26eb58){for(var _0x252540 in _0x26eb58){if(_0x26eb58[_0x561a('0x9c')](_0x252540)){this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0x134'),_0x252540['toUpperCase']()),_0x26eb58[_0x252540]);}}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x135'),JSON['stringify'](_0x26eb58)));}}return _0x32fa16;};AGIVertices[_0x561a('0x11')][_0x561a('0x136')]=function(_0xd4dfbd){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x137'),_0xd4dfbd['label']));if(!this[_0x561a('0x89')](_0xd4dfbd[_0x561a('0x97')])){return this[_0x561a('0xf')]['noop'](_0x561a('0x138'));}if(!this[_0x561a('0x89')](_0xd4dfbd[_0x561a('0x98')])){return this[_0x561a('0xf')]['noop'](_0x561a('0x139'));}var _0x5a825c=_0x561a('0x13a');var _0x17d8f8=util[_0x561a('0x2c')](_0x561a('0x13b'),FILES_PATH,rs['generate'](0x4));var _0xfd7c3c=util[_0x561a('0x2c')](_0x561a('0xa5'),_0x17d8f8,_0x5a825c);var _0x1610c1=!![];if(_0xd4dfbd[_0x561a('0x13c')]===_0x561a('0x130')){_0x1610c1=![];}var _0x12959e=this['channel'][_0x561a('0x131')](_0x17d8f8,_0x5a825c,_0xd4dfbd[_0x561a('0x132')],_0xd4dfbd['timeout'],undefined,_0x1610c1);if(_0x12959e[_0x561a('0xac')]!==-0x1){this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x13d'),_0xfd7c3c));var _0x537b01=this[_0x561a('0x96')]['sync'](this,_0xd4dfbd,_0xfd7c3c);if(_0x537b01){for(var _0x4da1b3 in _0x537b01){if(_0x537b01['hasOwnProperty'](_0x4da1b3)){this[_0x561a('0xf')]['setVariable'](util[_0x561a('0x2c')]('TILDE_ASR_%s',_0x4da1b3[_0x561a('0x6f')]()),_0x537b01[_0x4da1b3]);}}return this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')]('TildeASR\x20Result\x20%s',JSON[_0x561a('0xa7')](_0x537b01)));}}return _0x12959e;};AGIVertices[_0x561a('0x11')][_0x561a('0x13e')]=function(_0x56d9bd){logger['info'](util[_0x561a('0x2c')](_0x561a('0x13f'),_0x56d9bd[_0x561a('0x3c')]));return this[_0x561a('0xf')][_0x561a('0x140')](_0x56d9bd['context'],_0x56d9bd['extension'],_0x56d9bd[_0x561a('0x41')]);};AGIVertices['prototype'][_0x561a('0x141')]=function(_0x3cdf8e){logger[_0x561a('0x32')](util['format'](_0x561a('0x142'),_0x3cdf8e[_0x561a('0x3c')]));if(!this['isConfigured'](_0x3cdf8e['condition'])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x3cdf8e,'no\x20condition\x20configured');}try{var _0x2c14fb=eval(_0x3cdf8e[_0x561a('0x143')])?_0x561a('0x144'):_0x561a('0x145');this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x146'),_0x3cdf8e[_0x561a('0x143')],_0x2c14fb));return{'code':0xc8,'result':_0x2c14fb};}catch(_0x394518){return{'code':0xc8,'result':_0x561a('0x145')};}};AGIVertices[_0x561a('0x11')][_0x561a('0x147')]=function(_0x5dcf0e){logger[_0x561a('0x32')](util['format'](_0x561a('0x148'),_0x5dcf0e['label']));if(!this[_0x561a('0x89')](_0x5dcf0e[_0x561a('0x149')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x5dcf0e,'no\x20interval\x20configured');}var _0x2218fa=this['getIntervals']['sync'](this,_0x5dcf0e['interval_id']);if(!_0x2218fa){return this[_0x561a('0xf')]['error'](_0x5dcf0e,_0x561a('0x14a'));}for(var _0x1173a5=0x0;_0x1173a5<_0x2218fa[_0x561a('0xa1')];_0x1173a5+=0x1){var _0x3ebb47=this[_0x561a('0xf')]['getVariable'](util['format'](_0x561a('0x14b'),_0x2218fa[_0x1173a5]));if(_0x3ebb47[_0x561a('0xac')]===-0x1){return _0x3ebb47;}logger[_0x561a('0x32')](util[_0x561a('0x2c')]('IFTIME\x20%s\x20%s',_0x2218fa[_0x1173a5],_0x3ebb47['extra']));if(_0x3ebb47['extra']===_0x561a('0x144')){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('IFTIME\x20%s\x20%s',_0x2218fa[_0x1173a5],_0x561a('0x144')));this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x14c'),_0x2218fa[_0x1173a5],_0x561a('0x144')));return{'code':0xc8,'result':_0x561a('0x144')};}else{logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x14c'),_0x2218fa[_0x1173a5],_0x561a('0x145')));this['channel']['noop'](util['format'](_0x561a('0x14c'),_0x2218fa[_0x1173a5],_0x561a('0x145')));}}return{'code':0xc8,'result':_0x561a('0x145')};};AGIVertices['prototype'][_0x561a('0x14d')]=function(_0x2f4d4a){logger[_0x561a('0x32')](util['format'](_0x561a('0x14e'),_0x2f4d4a['label']));return this[_0x561a('0xf')][_0x561a('0x14d')]();};AGIVertices[_0x561a('0x11')][_0x561a('0x14f')]=function(_0x2f45ea){logger[_0x561a('0x32')](util['format'](_0x561a('0x150'),_0x2f45ea[_0x561a('0x3c')]));if(!this['isConfigured'](_0x2f45ea[_0x561a('0x7f')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xed'));}var _0x3daa1f='wav';var _0x5116e8=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x561a('0x11c')](0x4));var _0x3143de=util[_0x561a('0x2c')](_0x561a('0xa5'),_0x5116e8,_0x3daa1f);var _0x2ddc97=!![];if(_0x2f45ea[_0x561a('0x13c')]===_0x561a('0x130')){_0x2ddc97=![];}var _0x2bfc0c=this['channel'][_0x561a('0x131')](_0x5116e8,_0x3daa1f,_0x2f45ea[_0x561a('0x132')],_0x2f45ea[_0x561a('0x69')],undefined,_0x2ddc97);if(_0x2bfc0c[_0x561a('0xac')]!==-0x1){this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0x151'),_0x3143de));var _0x4bb9fc=this['ispeechASR'][_0x561a('0x75')](this,_0x2f45ea,_0x3143de);if(_0x4bb9fc){for(var _0x17c580 in _0x4bb9fc){if(_0x4bb9fc[_0x561a('0x9c')](_0x17c580)){this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0x152'),_0x17c580[_0x561a('0x6f')]()),_0x4bb9fc[_0x17c580]);}}return this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x153'),JSON[_0x561a('0xa7')](_0x4bb9fc)));}}return _0x2bfc0c;};AGIVertices[_0x561a('0x11')][_0x561a('0x154')]=function(_0x52c846){logger['info'](util[_0x561a('0x2c')](_0x561a('0x155'),_0x52c846[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x52c846[_0x561a('0x7f')])){return this['channel'][_0x561a('0xb0')](_0x561a('0xed'));}if(!this[_0x561a('0x89')](_0x52c846['text'])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('Trying\x20ispeech\x20TTS\x20%s',_0x52c846['text']));var _0x29f0f7=this[_0x561a('0x86')][_0x561a('0x75')](this,_0x52c846);if(_0x29f0f7){this['channel'][_0x561a('0xb0')](util['format'](_0x561a('0x151'),_0x29f0f7));var _0x1b26f9=this[_0x561a('0xf')][_0x561a('0x128')](_0x29f0f7,_0x52c846[_0x561a('0x132')]);try{fs[_0x561a('0x105')](_0x29f0f7+_0x561a('0x106'));}catch(_0x2c230e){logger[_0x561a('0x30')](_0x2c230e);}return _0x1b26f9;}return this['channel'][_0x561a('0x30')](_0x52c846,_0x561a('0x156'));};AGIVertices['prototype'][_0x561a('0x157')]=function(_0x68a83){logger[_0x561a('0x32')](util['format'](_0x561a('0x158'),_0x68a83[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x68a83[_0x561a('0x159')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x68a83,_0x561a('0x15a'));}logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x15b'),this[_0x561a('0xf')][_0x561a('0x3e')],_0x68a83[_0x561a('0x159')]));var _0x583842=this[_0x561a('0x58')]['sync'](this,_0x68a83['findBy']);if(_0x583842){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x561a('0xf')][_0x561a('0x3e')],_0x68a83[_0x561a('0x159')]));this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x15c'),this[_0x561a('0xf')]['callerid'],_0x68a83[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15d')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x561a('0x3e')],_0x68a83[_0x561a('0x159')]));this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x15e'),this['channel'][_0x561a('0x3e')],_0x68a83[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15f')};}};AGIVertices['prototype'][_0x561a('0x160')]=function(_0x24fe1f){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x161'),_0x24fe1f[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x24fe1f[_0x561a('0x159')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x24fe1f,_0x561a('0x15a'));}logger[_0x561a('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x561a('0xf')]['callerid'],_0x24fe1f[_0x561a('0x159')]));var _0x469266=this['agentLogout'][_0x561a('0x75')](this,_0x24fe1f[_0x561a('0x159')]);if(_0x469266){logger['info'](util[_0x561a('0x2c')](_0x561a('0x15c'),this[_0x561a('0xf')][_0x561a('0x3e')],_0x24fe1f[_0x561a('0x159')]));this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0x15c'),this[_0x561a('0xf')][_0x561a('0x3e')],_0x24fe1f[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15d')};}else{logger['info'](util[_0x561a('0x2c')](_0x561a('0x15e'),this[_0x561a('0xf')]['callerid'],_0x24fe1f[_0x561a('0x159')]));this[_0x561a('0xf')][_0x561a('0xb0')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x561a('0x3e')],_0x24fe1f['findBy']));return{'code':0xc8,'result':_0x561a('0x15f')};}};AGIVertices[_0x561a('0x11')][_0x561a('0x162')]=function(_0x2265de){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x163'),_0x2265de[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x2265de[_0x561a('0x164')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x2265de,_0x561a('0x165'));}this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x166'),_0x2265de[_0x561a('0x164')]));var _0x471369=eval(_0x2265de[_0x561a('0x164')]);if(!this[_0x561a('0x89')](_0x2265de['variable_id'])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xdc'));}var _0x2e158b=this['getVariable'][_0x561a('0x75')](this,_0x2265de[_0x561a('0xdd')]);if(!_0x2e158b){return this[_0x561a('0xf')][_0x561a('0x30')](_0x2265de,'no\x20variable\x20found');}if(_['isArray'](_0x471369)){var _0x160092=this;_0x471369[_0x561a('0xdf')](function(_0x3377d0,_0xefc8a4){_0x160092[_0x561a('0xf')]['setVariable'](util[_0x561a('0x2c')]('%s[%s]',_0x2e158b,_0xefc8a4),_0x3377d0);});return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('variable\x20%s[key]\x20set',_0x2e158b));}else{return this[_0x561a('0xf')][_0x561a('0xa6')](_0x2e158b,_0x471369);}};AGIVertices[_0x561a('0x11')][_0x561a('0xc')]=function(_0x255b82){logger[_0x561a('0x32')](util['format'](_0x561a('0x167'),_0x255b82[_0x561a('0x3c')]));if(_0x255b82['retry']===0x0){return this['maxRetry'](_0x255b82);}_0x255b82['retry']-=0x1;if(!this[_0x561a('0x89')](_0x255b82[_0x561a('0x115')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x255b82,_0x561a('0x168'));}var _0x4fabd0=this[_0x561a('0x20')][_0x561a('0x75')](this,_0x255b82[_0x561a('0x115')]);if(!_0x4fabd0){return this[_0x561a('0xf')]['error'](_0x255b82,_0x561a('0x116'));}var _0x4d3392=this[_0x561a('0xf')][_0x561a('0x117')](_0x4fabd0,_0x255b82['response'],_0x255b82['digit']);var _0x2cc118=_0x4d3392[_0x561a('0xac')];if(_0x4d3392[_0x561a('0xac')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x255b82,'-1');return _0x4d3392;}else if(_0x4d3392[_0x561a('0xaa')]==='timeout'){_0x4d3392[_0x561a('0xac')]=_0x4d3392[_0x561a('0xac')][_0x561a('0xa1')]>0x0?_0x4d3392[_0x561a('0xac')]:'t';}else if(_['isEmpty'](_0x4d3392[_0x561a('0xac')])){_0x4d3392[_0x561a('0xac')]='#';_0x2cc118='#';}if(!this[_0x561a('0x89')](_0x255b82[_0x561a('0xdd')])){this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3b064c=this['getVariable'][_0x561a('0x75')](this,_0x255b82['variable_id']);if(!_0x3b064c){return this['channel'][_0x561a('0x30')](_0x255b82,_0x561a('0xde'));}this['channel'][_0x561a('0xa6')](_0x3b064c,_0x2cc118);}this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x255b82,_0x2cc118);return _0x4d3392;};AGIVertices[_0x561a('0x11')][_0x561a('0xb0')]=function(_0x5ea420){logger['info'](util[_0x561a('0x2c')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5ea420[_0x561a('0x3c')]));return this['channel']['noop'](_0x5ea420[_0x561a('0x169')]||_0x5ea420[_0x561a('0x3c')]);};AGIVertices[_0x561a('0x11')]['pause']=function(_0x5e01e2){logger['info'](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x5e01e2[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x5e01e2[_0x561a('0x159')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x5e01e2,'no\x20find\x20by\x20configured');}logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x15b'),this[_0x561a('0xf')]['callerid'],_0x5e01e2['findBy']));var _0xb764ee=this['getPause']['sync'](this,_0x5e01e2[_0x561a('0x16a')]);var _0x20f247=this[_0x561a('0x55')]['sync'](this,_0x5e01e2['findBy'],_0xb764ee);if(_0x20f247){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x15c'),this[_0x561a('0xf')][_0x561a('0x3e')],_0x5e01e2[_0x561a('0x159')]));this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x15c'),this['channel']['callerid'],_0x5e01e2['findBy']));return{'code':0xc8,'result':_0x561a('0x15d')};}else{logger[_0x561a('0x32')](util[_0x561a('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x561a('0xf')][_0x561a('0x3e')],_0x5e01e2['findBy']));this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x15c'),this[_0x561a('0xf')][_0x561a('0x3e')],_0x5e01e2[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15f')};}};AGIVertices['prototype'][_0x561a('0x16b')]=function(_0x7d4d2d){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x16c'),_0x7d4d2d['label']));if(!this['isConfigured'](_0x7d4d2d[_0x561a('0x115')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x7d4d2d,_0x561a('0x168'));}var _0x48a3fd=this[_0x561a('0x20')][_0x561a('0x75')](this,_0x7d4d2d[_0x561a('0x115')]);if(!_0x48a3fd){return this[_0x561a('0xf')][_0x561a('0x30')](_0x7d4d2d,'no\x20file\x20audio\x20found');}var _0x2651bf=this['channel'][_0x561a('0x5b')](_0x561a('0x16d'),[_0x48a3fd,_0x7d4d2d['opts']]);if(_0x2651bf['result']===-0x1){return _0x2651bf;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x48a3fd));};AGIVertices[_0x561a('0x11')][_0x561a('0x16e')]=function(_0x1ebbe5){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x16f'),_0x1ebbe5[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x1ebbe5[_0x561a('0x170')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x1ebbe5,_0x561a('0x171'));}var _0x11ac20='';var _0x3c9aed=parseInt(_0x1ebbe5[_0x561a('0x170')],0xa);if(isNaN(_0x3c9aed)){_0x11ac20=_0x1ebbe5[_0x561a('0x170')];}else{_0x11ac20=this[_0x561a('0x17')][_0x561a('0x75')](this,_0x1ebbe5[_0x561a('0x170')]);if(!_0x11ac20){return this[_0x561a('0xf')][_0x561a('0x30')](_0x1ebbe5,_0x561a('0x172'));}}var _0x50f952='';if(this[_0x561a('0x89')](_0x1ebbe5[_0x561a('0x115')])){var _0x5445ad=this[_0x561a('0x20')][_0x561a('0x75')](this,_0x1ebbe5[_0x561a('0x115')]);if(_0x5445ad){_0x50f952=_0x5445ad;}}this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x1ebbe5,_0x11ac20);if(_0x1ebbe5[_0x561a('0x110')][_0x561a('0x173')]('x')<0x0){_0x1ebbe5[_0x561a('0x110')]+='x';}if(_0x1ebbe5['opts'][_0x561a('0x173')]('X')<0x0){_0x1ebbe5[_0x561a('0x110')]+='X';}this[_0x561a('0xf')][_0x561a('0xa6')](_0x561a('0x174'),_0x11ac20?_0x11ac20[_0x561a('0x175')]():'');var _0x5d4b08=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0x176'),[_0x11ac20,_0x1ebbe5[_0x561a('0x110')],_0x1ebbe5[_0x561a('0x68')],_0x50f952,_0x1ebbe5[_0x561a('0x69')],_0x1ebbe5['agi'],_0x1ebbe5[_0x561a('0x177')],_0x1ebbe5[_0x561a('0x178')],'',_0x1ebbe5[_0x561a('0x179')]]);if(_0x5d4b08[_0x561a('0xac')]===-0x1){return _0x5d4b08;}return this[_0x561a('0xf')][_0x561a('0xb0')](util['format']('Executed\x20command\x20%s\x20%s',_0x561a('0x176'),_0x11ac20));};AGIVertices[_0x561a('0x11')][_0x561a('0x17a')]=function(_0x411adc){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x411adc[_0x561a('0x3c')]));var _0x52457f=_0x411adc['recordingFormat']||_0x561a('0x13a');var _0x4658ed=util[_0x561a('0x2c')]('%s_%s',this[_0x561a('0xf')][_0x561a('0x45')],rs['generate'](0x5));var _0x36fd40=util[_0x561a('0x2c')](_0x561a('0x17b'),FILES_PATH,_0x4658ed,_0x52457f);var _0x517cfe=util[_0x561a('0x2c')](_0x561a('0x13b'),FILES_PATH,_0x4658ed);this['createSquareRecording'][_0x561a('0x75')](this,_0x411adc,_0x4658ed,_0x36fd40);this['channel'][_0x561a('0xa6')](_0x561a('0x17c'),_0x4658ed);logger[_0x561a('0x32')](_0x561a('0x17d'),_0x517cfe,_0x52457f,_0x411adc[_0x561a('0x17e')],_0x411adc[_0x561a('0x69')]);return this['channel']['recordFile'](_0x517cfe,_0x52457f,_0x411adc[_0x561a('0x17e')],_0x411adc['timeout'],undefined,!![]);};AGIVertices[_0x561a('0x11')][_0x561a('0x17f')]=function(_0xb4cc50){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x180'),_0xb4cc50[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0xb4cc50['url'])){return this[_0x561a('0xf')]['noop'](_0x561a('0x181'));}var _0x2cbaa2=this[_0x561a('0x67')][_0x561a('0x75')](this,_0xb4cc50);logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x182'),util[_0x561a('0x183')](_0x2cbaa2,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xb4cc50[_0x561a('0xdd')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x184'));}var _0x429060=this[_0x561a('0x12')][_0x561a('0x75')](this,_0xb4cc50['variable_id']);if(!_0x429060){return this['channel'][_0x561a('0x30')](_0xb4cc50,_0x561a('0xde'));}this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0x185'),_0x429060),_0x2cbaa2[_0x561a('0x79')]?_0x2cbaa2[_0x561a('0x79')]:'200');this[_0x561a('0xf')][_0x561a('0xa6')](util['format'](_0x561a('0x186'),_0x429060),_0x2cbaa2['statusMessage']?_0x2cbaa2[_0x561a('0x7a')]:'OK');if(_0x2cbaa2[_0x561a('0x70')]){try{this[_0x561a('0xa3')](_0x2cbaa2[_0x561a('0x70')],_0x429060);}catch(_0x5247cc){logger[_0x561a('0x30')](util[_0x561a('0x2c')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x429060));}}return this['channel'][_0x561a('0xb0')](util['format'](_0x561a('0xe2'),_0x429060));};AGIVertices[_0x561a('0x11')][_0x561a('0x187')]=function(_0x35ce03){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x188'),_0x35ce03['label']));return this[_0x561a('0xf')][_0x561a('0x189')](_0x35ce03['digits'][_0x561a('0x5d')](/\s+/g,''),_0x35ce03['escape_digits']);};AGIVertices[_0x561a('0x11')]['saynumber']=function(_0x3dbd6e){logger['info'](util['format'](_0x561a('0x18a'),_0x3dbd6e[_0x561a('0x3c')]));return this['channel']['sayNumber'](_0x3dbd6e[_0x561a('0x6a')]['replace'](/\s+/g,''),_0x3dbd6e[_0x561a('0x17e')]);};AGIVertices[_0x561a('0x11')][_0x561a('0x18b')]=function(_0x5a7738){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x5a7738[_0x561a('0x3c')]));return this[_0x561a('0xf')]['sayPhonetic'](_0x5a7738['text'],_0x5a7738[_0x561a('0x17e')]);};AGIVertices['prototype']['sendMail']=function(_0x3e5073){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3e5073['label']));if(!this[_0x561a('0x89')](_0x3e5073[_0x561a('0x18c')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x18d'));}var _0x1c34dd=this[_0x561a('0x18e')][_0x561a('0x75')](this,_0x3e5073[_0x561a('0x18c')]);if(!_0x1c34dd||!_0x1c34dd[_0x561a('0x18f')]){return this[_0x561a('0xf')][_0x561a('0x30')](_0x3e5073,_0x561a('0x190'));}var _0x36b520={'from':util['format']('\x22%s\x22\x20<%s>',_0x1c34dd[_0x561a('0x15')],_0x1c34dd[_0x561a('0x191')]||_0x1c34dd['Smtp'][_0x561a('0x192')]),'to':_0x3e5073['to']||'','cc':_0x3e5073['cc']||'','bcc':_0x3e5073[_0x561a('0x193')]||'','subject':_0x3e5073[_0x561a('0x194')],'html':_0x3e5073[_0x561a('0x60')],'text':_0x3e5073['text']};if(this[_0x561a('0x89')](_0x3e5073['template_id'])){}logger[_0x561a('0xe4')](_0x561a('0x195'),JSON[_0x561a('0xa7')](_0x36b520));this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x3e5073,_0x3e5073[_0x561a('0x18c')]);this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x196'),_0x1c34dd[_0x561a('0x15')]));this[_0x561a('0x25')][_0x561a('0x75')](this,_0x1c34dd['smtpOptions'],_0x36b520);return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x197'));};AGIVertices[_0x561a('0x11')][_0x561a('0x198')]=function(_0x82a77e){logger[_0x561a('0x32')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x82a77e[_0x561a('0x3c')]));return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x199'));};AGIVertices[_0x561a('0x11')][_0x561a('0x19a')]=function(_0x3a9310){logger['info'](util[_0x561a('0x2c')](_0x561a('0x19b'),_0x3a9310[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x3a9310[_0x561a('0x19c')])){return this['channel']['noop'](_0x561a('0x19d'));}var _0x141ab5=this[_0x561a('0x38')][_0x561a('0x75')](this,_0x3a9310['sms_account_id']);if(!_0x141ab5){return this[_0x561a('0xf')]['error'](_0x3a9310,_0x561a('0x19e'));}var _0xd5d2f0={'body':_0x3a9310[_0x561a('0x19f')],'phone':_0x3a9310['to']||'','SmsAccountId':_0x141ab5['id']};logger[_0x561a('0xe4')](_0x561a('0x1a0'),JSON[_0x561a('0xa7')](_0xd5d2f0));this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x3a9310,_0x3a9310[_0x561a('0x19c')]);this['channel']['noop'](util['format'](_0x561a('0x1a1'),_0x141ab5[_0x561a('0x15')]));this['createSmsMessage']['sync'](this,_0xd5d2f0);return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x1a2'));};AGIVertices[_0x561a('0x11')]['set']=function(_0x3ad6ad){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1a3'),_0x3ad6ad[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x3ad6ad[_0x561a('0xdd')])){return this[_0x561a('0xf')]['error'](_0x3ad6ad,_0x561a('0x1a4'));}var _0xd3fa43=this['getVariable'][_0x561a('0x75')](this,_0x3ad6ad[_0x561a('0xdd')]);if(!_0xd3fa43){return this[_0x561a('0xf')][_0x561a('0x30')](_0x3ad6ad,_0x561a('0xde'));}return this['channel'][_0x561a('0xa6')](_0xd3fa43,_0x3ad6ad[_0x561a('0x1a5')]);};AGIVertices['prototype'][_0x561a('0x1a6')]=function(_0x1828eb){logger[_0x561a('0x32')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x1828eb[_0x561a('0x3c')]));this[_0x561a('0xf')][_0x561a('0xb0')]('START\x20CALLY\x20SQUARE');var _0x2b62d5=this[_0x561a('0xf')][_0x561a('0x12')](_0x561a('0x1a7'));if(!_['isEmpty'](_0x2b62d5[_0x561a('0xaa')])){this[_0x561a('0xf')][_0x561a('0x45')]=_0x2b62d5[_0x561a('0xaa')];}if(_0x1828eb[_0x561a('0xbb')]===_0x561a('0x1a8')){this['channel'][_0x561a('0xb0')](_0x561a('0x1a9'));return this['channel'][_0x561a('0xbb')]();}return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x1aa'));};AGIVertices[_0x561a('0x11')][_0x561a('0x1ab')]=function(_0x49f1d8){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1ac'),_0x49f1d8[_0x561a('0x3c')]));if(!this['isConfigured'](_0x49f1d8[_0x561a('0x1ad')])){return this['channel'][_0x561a('0x30')](_0x49f1d8,_0x561a('0x1ae'));}var _0x4466bd=this[_0x561a('0x19')][_0x561a('0x75')](this,_0x49f1d8[_0x561a('0x1ad')]);if(!this[_0x561a('0x89')](_0x4466bd)){return this['channel']['error'](_0x49f1d8,util['format'](_0x561a('0x1af'),_0x49f1d8[_0x561a('0x1ad')]));}if(_0x4466bd===this['channel']['arg_1']){return this[_0x561a('0xf')][_0x561a('0x30')](_0x49f1d8,_0x561a('0x1b0'));}this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x49f1d8,_0x4466bd);var _0x747b7c=this[_0x561a('0xf')]['exec'](_0x561a('0x1b1'),util[_0x561a('0x2c')](_0x561a('0x1b2'),config[_0x561a('0x7')][_0x561a('0x1b3')]||'127.0.0.1',_0x4466bd,this[_0x561a('0xf')][_0x561a('0x3d')]));if(_0x747b7c[_0x561a('0xac')]===-0x1){return _0x747b7c;}return this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0xc5'),_0x561a('0x1b1'),_0x4466bd));};AGIVertices['prototype']['system']=function(_0x5ae24){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1b4'),_0x5ae24[_0x561a('0x3c')]));var _0x8ad52b=this[_0x561a('0x1b5')][_0x561a('0x75')](this,_0x5ae24[_0x561a('0x1b6')]);this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x5ae24,_0x5ae24['command']);if(this[_0x561a('0x89')](_0x5ae24['variable_id'])){var _0x3d0b58=this[_0x561a('0x12')][_0x561a('0x75')](this,_0x5ae24[_0x561a('0xdd')]);if(_0x3d0b58){this[_0x561a('0xf')][_0x561a('0xa6')](_0x3d0b58,_0x8ad52b);return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x5ae24['command'],_0x3d0b58));}}return this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0x1b7'),_0x5ae24[_0x561a('0x1b6')]));};AGIVertices[_0x561a('0x11')][_0x561a('0x1b8')]=function(_0x103bc9){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1b9'),_0x103bc9['label']));_0x103bc9[_0x561a('0x60')]=_0x103bc9[_0x561a('0x60')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x103bc9[_0x561a('0x1ba')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20apiKey\x20configured');}if(!this[_0x561a('0x89')](_0x103bc9['text'])){return this[_0x561a('0xf')]['noop'](_0x561a('0xc9'));}this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0x1bb'),_0x103bc9[_0x561a('0x60')]));var _0x193c7c=this[_0x561a('0x5e')][_0x561a('0x75')](this,_0x103bc9);if(_0x193c7c){this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x1bc'),_0x193c7c));var _0x497aef=this[_0x561a('0xf')][_0x561a('0x128')](_0x193c7c);try{fs['unlink'](_0x193c7c+_0x561a('0x106'));}catch(_0x5299ca){logger[_0x561a('0x30')](_0x5299ca);}return _0x497aef;}return this['channel'][_0x561a('0x30')](_0x103bc9,_0x561a('0x1bd'));};AGIVertices[_0x561a('0x11')][_0x561a('0x1be')]=function(_0x636d00){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1bf'),_0x636d00['label']));_0x636d00['text']=_0x636d00['text'][_0x561a('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x561a('0x89')](_0x636d00[_0x561a('0x60')])){return this[_0x561a('0xf')]['noop']('no\x20text\x20configured');}this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x1c0'),_0x636d00[_0x561a('0x60')]));var _0x4f149f=this[_0x561a('0x66')][_0x561a('0x75')](this,_0x636d00);if(_0x4f149f){this['channel'][_0x561a('0xb0')](util['format'](_0x561a('0x1c1'),_0x4f149f));var _0x4c7f92=this[_0x561a('0xf')][_0x561a('0x128')](_0x4f149f);try{fs[_0x561a('0x105')](_0x4f149f+_0x561a('0x106'));}catch(_0x38485f){logger[_0x561a('0x30')](_0x38485f);}return _0x4c7f92;}return this['channel'][_0x561a('0x30')](_0x636d00,_0x561a('0x1c2'));};AGIVertices[_0x561a('0x11')][_0x561a('0x1c3')]=function(_0x1caea2){logger['info'](util[_0x561a('0x2c')](_0x561a('0x1c4'),_0x1caea2[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x1caea2[_0x561a('0x159')])){return this[_0x561a('0xf')]['error'](_0x1caea2,_0x561a('0x15a'));}logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x15b'),this[_0x561a('0xf')]['callerid'],_0x1caea2[_0x561a('0x159')]));var _0x32e07d=this[_0x561a('0x56')]['sync'](this,_0x1caea2[_0x561a('0x159')]);if(_0x32e07d){logger['info'](util[_0x561a('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x561a('0xf')][_0x561a('0x3e')],_0x1caea2['findBy']));this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x561a('0xf')]['callerid'],_0x1caea2[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15d')};}else{logger[_0x561a('0x32')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x561a('0xf')][_0x561a('0x3e')],_0x1caea2[_0x561a('0x159')]));this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x15e'),this['channel'][_0x561a('0x3e')],_0x1caea2[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15f')};}};AGIVertices['prototype']['voicemail']=function(_0x46ad25){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x46ad25['label']));var _0x3282e6=this[_0x561a('0xf')]['exec'](_0x561a('0x1c5'),[_0x46ad25[_0x561a('0x1c6')],_0x46ad25[_0x561a('0x7d')]]);if(_0x3282e6[_0x561a('0xac')]===-0x1){return _0x3282e6;}return this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0xc5'),_0x561a('0x1c5'),_0x46ad25[_0x561a('0x1c6')]));};AGIVertices[_0x561a('0x11')][_0x561a('0x1c7')]=function(_0x1bb2a5){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1c8'),_0x1bb2a5[_0x561a('0x3c')]));if(!this['isConfigured'](_0x1bb2a5[_0x561a('0xdd')])){return this['channel'][_0x561a('0x30')](_0x1bb2a5,_0x561a('0x1a4'));}var _0x5d055e=this['getVariable']['sync'](this,_0x1bb2a5[_0x561a('0xdd')]);if(!_0x5d055e){return this[_0x561a('0xf')]['error'](_0x1bb2a5,'no\x20variable\x20found');}var _0x257b14=this[_0x561a('0xf')][_0x561a('0x12')](_0x5d055e);return{'code':0xc8,'result':_0x257b14[_0x561a('0xaa')]?_0x257b14[_0x561a('0xaa')]:'-'};};String[_0x561a('0x11')][_0x561a('0xa9')]=function(_0x583db1,_0x35b53e){return this[_0x561a('0xa8')](_0x583db1)[_0x561a('0x1c9')](_0x35b53e);};module[_0x561a('0x1ca')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e1f57a8..1e44a28 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 _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 +var _0x5334=['[%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','updateAcw','catch','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','timers','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','lastPauseAt','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','prototype','startAcw','channels','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','agents','resolve','getAgent','then','[%s][INPAUSE][AGENT:%s][QUEUE:%s]'];(function(_0xba0394,_0x2c6844){var _0x1789dd=function(_0x437c00){while(--_0x437c00){_0xba0394['push'](_0xba0394['shift']());}};_0x1789dd(++_0x2c6844);}(_0x5334,0x84));var _0x4533=function(_0x5c10b7,_0x5a7049){_0x5c10b7=_0x5c10b7-0x0;var _0xdb8e8d=_0x5334[_0x5c10b7];return _0xdb8e8d;};'use strict';var _=require(_0x4533('0x0'));var moment=require(_0x4533('0x1'));var ami=require(_0x4533('0x2'));var logger=require(_0x4533('0x3'))(_0x4533('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x4533('0x5'));function Acw(_0x5176b5){this[_0x4533('0x6')]=_0x5176b5[_0x4533('0x6')];this['agents']=_0x5176b5['agents'];this['timers']=_0x5176b5[_0x4533('0x7')];this['channels']={};ami['on']('agentconnect',this['syncAgentConnect'][_0x4533('0x8')](this));ami['on'](_0x4533('0x9'),this[_0x4533('0xa')][_0x4533('0x8')](this));ami['on'](_0x4533('0xb'),this[_0x4533('0xc')][_0x4533('0x8')](this));ami['on']('agentringnoanswer',this[_0x4533('0xd')][_0x4533('0x8')](this));ami['on'](_0x4533('0xe'),this[_0x4533('0xf')]['bind'](this));ami['on'](_0x4533('0x10'),this['syncBlindTransfer'][_0x4533('0x8')](this));ami['on'](_0x4533('0x11'),this[_0x4533('0x12')][_0x4533('0x8')](this));}function getDiff(_0x57ff74){var _0xdd4757=moment()[_0x4533('0x13')](0x0);var _0x187f05=moment(_0x57ff74)[_0x4533('0x13')](0x0);return _0xdd4757['diff'](_0x187f05,_0x4533('0x14'));}Acw['prototype']['updateAcw']=function(_0x466545,_0x34dea9){var _0x5da8b8=this;var _0x30c68c=getDiff(_0x5da8b8[_0x4533('0x7')][_0x466545][_0x4533('0x15')]);clearTimeout(_0x5da8b8['timers'][_0x466545][_0x4533('0x16')]);_0x5da8b8['timers'][_0x466545][_0x4533('0x16')]=![];return RpcVoiceAgentReport[_0x4533('0x17')]({'acwtime':_0x30c68c},_0x5da8b8['timers'][_0x466545][_0x4533('0x18')],_0x466545)['then'](function(_0x5c2c9c){logger[_0x4533('0x19')](_0x4533('0x1a'),_0x34dea9,_0x30c68c,_0x5c2c9c);})['catch'](function(_0x53fe43){logger[_0x4533('0x1b')](_0x4533('0x1c'),_0x34dea9,_0x53fe43);})[_0x4533('0x1d')](function(){delete _0x5da8b8[_0x4533('0x7')][_0x466545];});};Acw[_0x4533('0x1e')][_0x4533('0x1f')]=function(_0x12adde){try{var _0x5c3abb=this;var _0x231bae=this[_0x4533('0x20')][_0x12adde][_0x4533('0x21')];var _0x4aa438=this['channels'][_0x12adde][_0x4533('0x22')];var _0x11e93a=this['voiceQueues'][_0x4aa438];var _0x5dcfd2=![];var _0x307bdd=_0x4533('0x23');if(_0x11e93a[_0x4533('0x24')]&&_0x11e93a['mandatoryDispositionPause'][_0x4533('0x25')]){_0x5dcfd2=!![];_0x307bdd=_0x11e93a[_0x4533('0x26')][_0x4533('0x25')];}if(!_0x5c3abb[_0x4533('0x27')][_0x231bae]){return Promise[_0x4533('0x28')]();}return RpcUser[_0x4533('0x29')](_0x5c3abb[_0x4533('0x27')][_0x231bae]['id'])[_0x4533('0x2a')](function(_0x45ad98){if(!_0x45ad98||_0x45ad98['voicePause']){logger['info'](_0x4533('0x2b'),_0x12adde,_0x231bae,_0x4aa438);return;}logger['info'](_0x4533('0x2c'),_0x12adde,_0x231bae,_0x4aa438);var _0x4e2b80=_0x5c3abb[_0x4533('0x20')][_0x12adde][_0x4533('0x2d')]&&_0x5c3abb[_0x4533('0x20')][_0x12adde][_0x4533('0x2e')]?_0x5c3abb[_0x4533('0x20')][_0x12adde][_0x4533('0x2e')]:_0x12adde;return RpcUser[_0x4533('0x2f')](_0x5c3abb[_0x4533('0x27')][_0x231bae],_0x307bdd,_0x4e2b80);})[_0x4533('0x2a')](function(_0x43682f){if(_0x5dcfd2||!_0x43682f){return;}_0x5c3abb[_0x4533('0x7')][_0x231bae]={};logger[_0x4533('0x19')](_0x4533('0x30'),_0x12adde,_0x5c3abb['voiceQueues'][_0x4aa438][_0x4533('0x31')],_0x231bae,_0x4aa438);_0x5c3abb['timers'][_0x231bae][_0x4533('0x16')]=setTimeout(_0x5c3abb[_0x4533('0x32')][_0x4533('0x8')](_0x5c3abb,_0x231bae),_0x5c3abb[_0x4533('0x6')][_0x4aa438][_0x4533('0x31')]*0x3e8);_0x5c3abb[_0x4533('0x7')][_0x231bae][_0x4533('0x15')]=moment()[_0x4533('0x33')](_0x4533('0x34'));_0x5c3abb[_0x4533('0x7')][_0x231bae][_0x4533('0x18')]=_0x12adde;_0x5c3abb[_0x4533('0x7')][_0x231bae]['queue']=_0x4aa438;_0x5c3abb[_0x4533('0x7')][_0x231bae][_0x4533('0x35')]=_0x5c3abb[_0x4533('0x35')][_0x4533('0x8')](_0x5c3abb,_0x231bae,_0x12adde);})[_0x4533('0x36')](function(){logger['error'](_0x4533('0x30'),_0x12adde,_0x5c3abb[_0x4533('0x6')][_0x4aa438][_0x4533('0x31')],_0x231bae,_0x4aa438);})[_0x4533('0x1d')](function(){delete _0x5c3abb[_0x4533('0x20')][_0x12adde];});}catch(_0x171fc5){logger['error'](_0x4533('0x37'),_0x171fc5[_0x4533('0x38')]);}};Acw['prototype'][_0x4533('0x32')]=function(_0x1e028a){try{var _0x42807e=this;if(_0x42807e[_0x4533('0x7')][_0x1e028a]){_0x42807e[_0x4533('0x7')][_0x1e028a][_0x4533('0x16')]=![];var _0x424924=_0x42807e[_0x4533('0x7')][_0x1e028a][_0x4533('0x18')];var _0x1041d1=_0x42807e['timers'][_0x1e028a][_0x4533('0x22')];var _0x3373a8=_0x42807e[_0x4533('0x6')][_0x1041d1][_0x4533('0x31')];logger[_0x4533('0x19')](_0x4533('0x39'),_0x424924,_0x1e028a);RpcUser[_0x4533('0x3a')](this[_0x4533('0x27')][_0x1e028a]);RpcVoiceAgentReport[_0x4533('0x17')]({'acwtime':_0x3373a8,'agentacw':!![]},_0x424924,_0x1e028a)[_0x4533('0x2a')](function(_0x1890ad){logger[_0x4533('0x19')]('[%s][UPDATE][ACWTIME:%s]',_0x424924,_0x3373a8,_0x1890ad);})['catch'](function(_0x451e1b){logger['error'](_0x4533('0x1c'),_0x424924,_0x451e1b);});}else{logger[_0x4533('0x1b')](_0x4533('0x3b'),_0x1e028a);if(_0x42807e[_0x4533('0x7')]){logger[_0x4533('0x19')](_0x4533('0x3c'),JSON[_0x4533('0x3d')](_0x42807e[_0x4533('0x7')]));}}}catch(_0x11bc6b){logger[_0x4533('0x1b')](_0x4533('0x3e'),_0x11bc6b[_0x4533('0x38')]);}};Acw[_0x4533('0x1e')]['syncAgentConnect']=function(_0x1aaedc){try{if(this['voiceQueues'][_0x1aaedc['queue']]&&(this['voiceQueues'][_0x1aaedc['queue']][_0x4533('0x4')]||this[_0x4533('0x6')][_0x1aaedc[_0x4533('0x22')]][_0x4533('0x24')])){if(this['agents'][_0x1aaedc[_0x4533('0x21')]]){this[_0x4533('0x20')][_0x1aaedc[_0x4533('0x18')]]={'queue':_0x1aaedc[_0x4533('0x22')],'interface':_0x1aaedc[_0x4533('0x21')],'destlinkedid':_0x1aaedc[_0x4533('0x2e')]};}}}catch(_0x46b45c){logger['error'](_0x4533('0x3f'),_0x46b45c['message']);}};Acw['prototype'][_0x4533('0x12')]=function(_0x8cb52f){try{if(this[_0x4533('0x6')][_0x8cb52f[_0x4533('0x22')]]&&(this['voiceQueues'][_0x8cb52f['queue']][_0x4533('0x4')]||this['voiceQueues'][_0x8cb52f[_0x4533('0x22')]][_0x4533('0x24')])){if(this['agents'][_0x8cb52f['interface']]){this['channels'][_0x8cb52f['uniqueid']]={'queue':_0x8cb52f['queue'],'interface':_0x8cb52f[_0x4533('0x21')]};}}}catch(_0x4797a3){logger[_0x4533('0x1b')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4797a3[_0x4533('0x38')]);}};Acw['prototype']['syncHangupRequest']=function(_0xb46cca){try{if(this['channels'][_0xb46cca[_0x4533('0x18')]]&&_['isUndefined'](this[_0x4533('0x20')][_0xb46cca[_0x4533('0x18')]]['attended'])){logger[_0x4533('0x19')](_0x4533('0x40'),_0xb46cca[_0x4533('0x18')]);this[_0x4533('0x1f')](_0xb46cca[_0x4533('0x18')]);}else if(this['channels'][_0xb46cca[_0x4533('0x41')]]&&_[_0x4533('0x42')](this['channels'][_0xb46cca[_0x4533('0x41')]][_0x4533('0x2d')])){logger[_0x4533('0x19')](_0x4533('0x43'),_0xb46cca[_0x4533('0x41')]);this[_0x4533('0x1f')](_0xb46cca[_0x4533('0x41')]);}}catch(_0x2ce254){logger[_0x4533('0x1b')](_0x4533('0x44'),_0x2ce254[_0x4533('0x38')]);}};Acw[_0x4533('0x1e')][_0x4533('0xc')]=function(_0x36297a){try{if(this[_0x4533('0x20')][_0x36297a[_0x4533('0x18')]]&&this['channels'][_0x36297a[_0x4533('0x18')]]['attended']){logger['info'](_0x4533('0x45'),_0x36297a[_0x4533('0x18')]);this[_0x4533('0x1f')](_0x36297a[_0x4533('0x18')]);}else if(this['channels'][_0x36297a[_0x4533('0x41')]]&&this['channels'][_0x36297a['linkedid']][_0x4533('0x2d')]){logger['info'](_0x4533('0x46'),_0x36297a['linkedid']);this[_0x4533('0x1f')](_0x36297a[_0x4533('0x41')]);}}catch(_0x3847cb){logger[_0x4533('0x1b')](_0x4533('0x47'),_0x3847cb['message']);}};Acw[_0x4533('0x1e')][_0x4533('0xf')]=function(_0x3caa6d){try{if(!_['isNil'](this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x48')]])){this['startAcw'](_0x3caa6d[_0x4533('0x48')]);if(this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x49')]]){this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x49')]]['attended']=!![];this[_0x4533('0x20')][_0x3caa6d['transfertargetuniqueid']]=this['channels'][_0x3caa6d[_0x4533('0x49')]];delete this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x49')]];}}else if(!_[_0x4533('0x4a')](this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x4b')]])){this[_0x4533('0x1f')](_0x3caa6d[_0x4533('0x4b')]);if(this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x4c')]]){this[_0x4533('0x20')][_0x3caa6d['origtransfereruniqueid']][_0x4533('0x2d')]=!![];this['channels'][_0x3caa6d[_0x4533('0x48')]]=this['channels'][_0x3caa6d[_0x4533('0x4c')]];delete this['channels'][_0x3caa6d[_0x4533('0x4c')]];}}}catch(_0xb55728){logger[_0x4533('0x1b')](_0x4533('0x4d'),_0xb55728[_0x4533('0x38')]);}};Acw[_0x4533('0x1e')][_0x4533('0x4e')]=function(_0xef36a6){try{if(this['channels'][_0xef36a6['transfereruniqueid']]){logger[_0x4533('0x19')](_0x4533('0x4f'),JSON['stringify'](_0xef36a6[_0x4533('0x50')]));this[_0x4533('0x1f')](_0xef36a6['transfereruniqueid']);}else if(this['channels'][_0xef36a6['transfererlinkedid']]){logger['info'](_0x4533('0x51'),JSON[_0x4533('0x3d')](_0xef36a6[_0x4533('0x52')]));this[_0x4533('0x1f')](_0xef36a6[_0x4533('0x52')]);}}catch(_0xbf35f7){logger[_0x4533('0x1b')](_0x4533('0x53'),_0xbf35f7['message']);}};Acw[_0x4533('0x1e')][_0x4533('0xd')]=function(_0x1b0414){try{if(this[_0x4533('0x6')][_0x1b0414['queue']]&&this['voiceQueues'][_0x1b0414['queue']][_0x4533('0x54')]==='all'){if(this[_0x4533('0x27')][_0x1b0414[_0x4533('0x21')]]){logger[_0x4533('0x19')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1b0414[_0x4533('0x18')],_0x1b0414['interface'],_0x1b0414[_0x4533('0x22')]);return RpcUser['savePause'](this[_0x4533('0x27')][_0x1b0414[_0x4533('0x21')]],_0x4533('0x55'),_0x1b0414[_0x4533('0x18')]);}}}catch(_0x6f6025){logger['error'](_0x4533('0x56'),_0x6f6025['message']);}};module[_0x4533('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 64cb176..c361f61 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 _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 +var _0x20d5=['actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','then','[ami.js][fullybooted]','close','exports','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','actionSipShowRegistry'];(function(_0x7e2d84,_0x3d8d7a){var _0x3acd22=function(_0x24055c){while(--_0x24055c){_0x7e2d84['push'](_0x7e2d84['shift']());}};_0x3acd22(++_0x3d8d7a);}(_0x20d5,0x70));var _0x520d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20d5[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x520d('0x0'));var util=require(_0x520d('0x1'));var logger=require(_0x520d('0x2'))(_0x520d('0x3'));var config=require(_0x520d('0x4'));var ami=new Manager(config[_0x520d('0x5')][_0x520d('0x6')],config[_0x520d('0x5')]['ip'],config['asterisk'][_0x520d('0x7')],config[_0x520d('0x5')]['password'],!![]);ami[_0x520d('0x8')]();ami[_0x520d('0x9')]=BPromise[_0x520d('0xa')](ami[_0x520d('0xb')]);function error(_0x233316){logger['error'](util[_0x520d('0xc')](_0x520d('0xd'),config['asterisk']['username'],config[_0x520d('0x5')]['ip'],config[_0x520d('0x5')]['port'],util['inspect'](_0x233316,![],null)));}function close(){logger[_0x520d('0xe')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x520d('0x7')],config['asterisk']['ip'],config[_0x520d('0x5')][_0x520d('0x6')]));}ami[_0x520d('0xf')]=function(){return function(){return ami[_0x520d('0x9')]({'action':'sipshowregistry'});};};ami[_0x520d('0x10')]=function(){return function(){return ami[_0x520d('0x9')]({'action':_0x520d('0x11')});};};ami[_0x520d('0x12')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x520d('0x13')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x520d('0x14')]=function(){return function(){return ami[_0x520d('0x9')]({'action':'coreshowchannels'});};};function connect(){logger[_0x520d('0x15')](util[_0x520d('0xc')](_0x520d('0x16'),config[_0x520d('0x5')][_0x520d('0x7')],config['asterisk']['ip'],config[_0x520d('0x5')][_0x520d('0x6')]));ami['once'](_0x520d('0xe'),error);ami[_0x520d('0x17')]('close',close);}ami['on']('connect',connect);ami['on'](_0x520d('0x18'),function(_0xc0aac8){logger[_0x520d('0x15')](util['format'](_0x520d('0x19'),config[_0x520d('0x5')]['username'],config['asterisk']['ip'],config[_0x520d('0x5')]['port'],util[_0x520d('0x1a')](_0xc0aac8,![],null)));});ami['on'](_0x520d('0x1b'),function(){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0x520d('0x5')]['ip'],config['asterisk'][_0x520d('0x6')]));return Promise['resolve']()['then'](ami[_0x520d('0xf')]())[_0x520d('0x1c')](ami[_0x520d('0x10')]())['then'](ami[_0x520d('0x12')]())[_0x520d('0x1c')](ami['actionQueueSummary']())[_0x520d('0x1c')](ami['actionCoreShowChannels']())['catch'](function(_0x342afb){logger['error'](_0x520d('0x1d'),util[_0x520d('0x1a')](_0x342afb,{'showHidden':![],'depth':null}));});});ami[_0x520d('0x17')]('error',error);ami['once'](_0x520d('0x1e'),close);module[_0x520d('0x1f')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index a9ee67f..0a05d66 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 _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 +var _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x48fc2c,_0x1e4620){var _0x14dd35=function(_0x341c5f){while(--_0x341c5f){_0x48fc2c['push'](_0x48fc2c['shift']());}};_0x14dd35(++_0x1e4620);}(_0xaa88,0x137));var _0x8aa8=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0xaa88[_0x18fb16];return _0x147b0d;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 6779003..acf54d9 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 _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 +var _0x34a8=['queueBooked','push','merge','idHopper','paused','preview','run','[unlock][syncQueueStatusComplete]','isEmpty','_rr','unlockRR','Agent:\x20','pick','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','AMD','countmachineretry','custom:amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countnoanswerretry','createStateFinal','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','syncQueueSummaryComplete','throttle','dialPreviewRecallmeReminder','filter','online','length','map','Agent','user:%s','loopClearZombieChannels','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','user:dialPreviewRecallReminder','handleIvr','actionOriginate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','originate','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','verifyAdditionalPhones','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalAvgHoldtime','predictiveIntervalAnsweredCalls','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','floor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','reachable','getContactDialer','countReScheduled','RUNNING','checkIsBlackList','loggerHandler','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','checkContactEmpty','checkContactLowerLimitOriginate','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','exports','util','lodash','uuid','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncQueueCallerAbandon','bind','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','name','voice_queue:save','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','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','getSeconds','startProgressive\x20value\x20cleared','startPredictive','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','EMPTY_INTERVAL','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','Action','iftime\x20%s,%s','interval','then','content','command','indexOf','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','catch','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','agiafterat','[syncAgentComplete][createHistory]','moveContactManagedDialer','updateOriginated','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','dialQueueProject2','countdropretry','countglobal','callAdditionalPhoneAfterMin','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','VoiceQueueId','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','actionid','strategy','roundrobin','isNil','locked','stateinterface','rrmemory'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x34a8,0x132));var _0x834a=function(_0x1c6126,_0x278b38){_0x1c6126=_0x1c6126-0x0;var _0x4a375f=_0x34a8[_0x1c6126];return _0x4a375f;};'use strict';var util=require(_0x834a('0x0'));var _=require(_0x834a('0x1'));var uuid=require(_0x834a('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x834a('0x3'));var utils=require('./utils');var hopperUtils=require(_0x834a('0x4'));var ut=require(_0x834a('0x5'));var config=require(_0x834a('0x6'));var logger=require('../../../config/logger')(_0x834a('0x7'));var loggerBooked=require(_0x834a('0x8'))(_0x834a('0x9'));var loggerPredictive=require(_0x834a('0x8'))('predictive');var loggerPredictiveCalls=require(_0x834a('0x8'))(_0x834a('0xa'));var loggerSyncQueueSummary=require(_0x834a('0x8'))(_0x834a('0xb'));var ami=require(_0x834a('0xc'));config[_0x834a('0xd')]=_[_0x834a('0xe')](config['redis'],{'host':_0x834a('0xf'),'port':0x18eb});var io=require(_0x834a('0x10'))(new Redis(config[_0x834a('0xd')]));var cmHopper=require(_0x834a('0x11'));var voiceQueueRt=require(_0x834a('0x12'));var RpcSetting=require(_0x834a('0x13'));var Interval=require(_0x834a('0x14'));var Action=require(_0x834a('0x15'));var History=require(_0x834a('0x16'));var Final=require(_0x834a('0x17'));var AgentComplete=require(_0x834a('0x18'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x834a('0x19'));var ipAgi=process['env'][_0x834a('0x1a')]||_0x834a('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x834a('0x1c')][_0x834a('0x1d')]=function(_0x264328){this[_0x834a('0x1e')]=this[_0x834a('0x1e')]?this[_0x834a('0x1e')][_0x834a('0x1f')](_0x264328):_0x264328();};function Dialer(_0x2f93f0,_0x131ab9){this[_0x834a('0x20')]=new Sequence();this['preview']=_0x131ab9;this[_0x834a('0x21')]=_0x2f93f0[_0x834a('0x21')];this[_0x834a('0x22')]=_0x2f93f0[_0x834a('0x22')];this[_0x834a('0x23')]=_0x2f93f0['agents'];this[_0x834a('0x24')]=_0x2f93f0[_0x834a('0x24')];this[_0x834a('0x25')]=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this[_0x834a('0x26')]={};this[_0x834a('0x27')]={};this[_0x834a('0x28')]={};this['startPredictive']={};this[_0x834a('0x29')]={};this[_0x834a('0x2a')]={};this['queueBooked']={};this[_0x834a('0x2b')]={};this[_0x834a('0x2c')]={};ami['on'](_0x834a('0x2d'),this['syncAgentConnect']['bind'](this));ami['on']('queuecallerabandon',this[_0x834a('0x2e')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x834a('0x2f')](this));ami['on'](_0x834a('0x30'),this['syncAgentComplete'][_0x834a('0x2f')](this));ami['on'](_0x834a('0x31'),this['syncQueueSummary'][_0x834a('0x2f')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0x834a('0x2f')](this));ami['on'](_0x834a('0x32'),this[_0x834a('0x33')][_0x834a('0x2f')](this));ami['on'](_0x834a('0x34'),this[_0x834a('0x35')][_0x834a('0x2f')](this));ami['on'](_0x834a('0x36'),this[_0x834a('0x37')][_0x834a('0x2f')](this));ami['on'](_0x834a('0x38'),this[_0x834a('0x39')][_0x834a('0x2f')](this));ami['on'](_0x834a('0x3a'),this[_0x834a('0x3b')][_0x834a('0x2f')](this));this[_0x834a('0x3c')]();this['loopClearZombieChannels']();RpcSetting[_0x834a('0x3d')]()['then'](function(_0x985524){previewRecallmeReminderInterval=_0x985524[_0x834a('0x3e')];});}function isNotNull(_0x395150){return _0x395150!==null&&!_[_0x834a('0x3f')](_0x395150);}function msgResponse(_0x526bb2,_0x510761,_0x45b5fc){return{'action':_0x526bb2,'response':_0x510761,'message':_0x45b5fc,'stack':_0x45b5fc};}function emit(_0x19191b,_0x5a8243,_0x3df03b){io['to'](_0x19191b)[_0x834a('0x40')](_0x5a8243,_0x3df03b);}function emitOutboundVoiceQueueSummary(_0x3ee723){if(_0x3ee723[_0x834a('0x41')]===_0x834a('0x42')){logger[_0x834a('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x834a('0x44')](_0x3ee723,{'showHidden':![],'depth':null}));emit(util[_0x834a('0x45')]('voice:queue:%s',_0x3ee723[_0x834a('0x46')]),_0x834a('0x47'),_0x3ee723);}}function checkGetDataPredictive(_0x55fb82){if(isNotNull(_0x55fb82)&&!_['isEmpty'](_0x55fb82)){loggerPredictive[_0x834a('0x48')](_0x834a('0x49'));loggerPredictive[_0x834a('0x48')](_0x834a('0x4a'),_0x55fb82[_0x834a('0x4b')]);loggerPredictive[_0x834a('0x48')](_0x834a('0x4c'),_0x55fb82['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x834a('0x48')](_0x834a('0x4d'),_0x55fb82['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x834a('0x48')](_0x834a('0x4e'),_0x55fb82[_0x834a('0x4f')]);loggerPredictive['info'](_0x834a('0x50'),_0x55fb82['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x834a('0x48')](_0x834a('0x51'),_0x55fb82['predictiveIntervalAvgTalktime']);loggerPredictive[_0x834a('0x48')](_0x834a('0x52'));if(_0x55fb82['predictiveIntervalTotalCalls']>0x0){if(!_[_0x834a('0x3f')](_0x55fb82[_0x834a('0x53')])&&_0x55fb82[_0x834a('0x53')]>0x0){return!![];}loggerPredictive[_0x834a('0x48')](_0x834a('0x54'));if(!_[_0x834a('0x3f')](_0x55fb82['predictiveIntervalAvgHoldtime'])&&_0x55fb82['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x834a('0x48')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x834a('0x55'));}}else{loggerPredictive[_0x834a('0x48')](_0x834a('0x56'));}return![];}function mergeDataErlangB(_0x5898c2){return function(_0x1ef7a0){loggerPredictive[_0x834a('0x48')]('---------\x20ErlangB\x20---------');loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1ef7a0[_0x834a('0x57')]);loggerPredictive['info'](_0x834a('0x58'),_0x1ef7a0[_0x834a('0x59')]);loggerPredictive[_0x834a('0x48')](_0x834a('0x5a'),_0x1ef7a0[_0x834a('0x5b')]);loggerPredictive['info'](_0x834a('0x5c'),_0x1ef7a0['erlangBusyFactor']);loggerPredictive[_0x834a('0x48')](_0x834a('0x5a'),_0x1ef7a0['erlangAbandonmentRate']);loggerPredictive['info'](_0x834a('0x52'));_['merge'](_0x5898c2,_0x1ef7a0);};}function ifInterval(_0x26a434,_0x5b2ce7){if(_[_0x834a('0x3f')](_0x5b2ce7)){return![];}return utils[_0x834a('0x5d')](undefined,_0x5b2ce7)<_0x26a434*0x3c;}function clearPredictiveAttributes(_0x58dd51){if(_0x58dd51[_0x834a('0x29')]){_0x58dd51[_0x834a('0x29')]=undefined;loggerPredictive['debug'](_0x58dd51[_0x834a('0x46')],_0x834a('0x5e'));}if(_0x58dd51[_0x834a('0x5f')]){_0x58dd51['startPredictive']=undefined;loggerPredictive[_0x834a('0x43')](_0x58dd51[_0x834a('0x46')],'startPredictive\x20value\x20cleared');}if(_0x58dd51[_0x834a('0x60')]){clearInterval(_0x58dd51['handlePredictive']);_0x58dd51['handlePredictive']=undefined;loggerPredictive[_0x834a('0x43')](_0x58dd51[_0x834a('0x46')],_0x834a('0x61'));}}function loggerCatchPredictive(_0x3fef4f,_0x335111){return function(_0x4e29af){loggerPredictive[_0x834a('0x62')](_0x335111[_0x834a('0x46')],_0x3fef4f);loggerPredictive[_0x834a('0x62')](_0x4e29af[_0x834a('0x63')]);clearPredictiveAttributes(_0x335111);};}function loggerCatch(_0x4f5143){return function(_0xeaa1da){logger[_0x834a('0x62')](_0x4f5143,util[_0x834a('0x44')](_0xeaa1da,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x38537b,_0x384513,_0x33a1cd){return function(_0x4cf211){utils['checkContactLowerLimitOriginate'](_0x384513,_0x33a1cd,0x0);_0x384513[_0x834a('0x64')]=0x0;logger[_0x834a('0x62')](_0x38537b,util[_0x834a('0x44')](_0x4cf211,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x58ab78){return function(_0x3c0cc5){if(isNotNull(_0x3c0cc5)&&isNotNull(_0x3c0cc5[0x0])){if(_0x3c0cc5[0x0][_0x834a('0x65')]>0x0){_0x58ab78[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x68')];logger['info'](_0x834a('0x69')+_0x58ab78[_0x834a('0x46')],_0x3c0cc5[0x0]['contactsRescheduled'],'contacts');}else{_0x58ab78[_0x834a('0x66')]=utils[_0x834a('0x67')]['NO_AVAILABLE_CONTACTS'];logger[_0x834a('0x48')](_0x834a('0x6a')+_0x58ab78[_0x834a('0x46')]);}}};}function createObjHistory(_0x534d16,_0x31d0f5,_0xd4c76,_0x4087de,_0x34de7c){_0x534d16['message']=_0xd4c76;var _0x37b868=new Action(_0x534d16,_0x31d0f5);var _0x43453c=new History(_0x37b868);_0x43453c[_0x834a('0x6b')]=_0x4087de;_0x43453c['statedesc']=_0x34de7c;_0x43453c[_0x834a('0x6c')]=_0x37b868[_0x834a('0x6d')];return _0x43453c;}function unlockQueueStatus(_0x2d5ce4,_0x291230){setTimeout(function(){if(_[_0x834a('0x3f')](_0x2d5ce4[_0x834a('0x6e')])){loggerBooked[_0x834a('0x62')](_0x834a('0x6f'),_0x291230);}_0x2d5ce4[_0x834a('0x6e')]=!![];loggerBooked[_0x834a('0x48')](_0x834a('0x70'),_0x291230,JSON[_0x834a('0x71')](_['pick'](_0x2d5ce4,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0x34df59){return function(){if(!isNotNull(_0x34df59['Interval'])){_0x34df59[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x72')];throw _0x34df59[_0x834a('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x34df59[_0x834a('0x73')][_0x834a('0x74')])){_0x34df59[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x72')];throw _0x34df59['name']+_0x834a('0x75');}if(!isNotNull(_['isEmpty'](_0x34df59[_0x834a('0x73')][_0x834a('0x74')]))){_0x34df59[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x72')];throw _0x34df59[_0x834a('0x46')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x15c955){return function(){if(!utils['isIVRCampaignActive'](_0x15c955)){_0x15c955['message']=utils[_0x834a('0x67')][_0x834a('0x76')];throw _0x15c955[_0x834a('0x46')]+_0x834a('0x77');}};}function emitCampaignSummary(_0x375adf){if(utils[_0x834a('0x78')](_0x375adf)){emit(util[_0x834a('0x45')](_0x834a('0x79'),_0x375adf[_0x834a('0x46')]),_0x834a('0x7a'),_0x375adf);}}function loggerCatchQueueSummary(_0x4771b4,_0x2b77e8){return function(_0x295d48){clearPredictiveAttributes(_0x2b77e8);emitCampaignSummary(_0x2b77e8);loggerSyncQueueSummary[_0x834a('0x43')](_0x4771b4,util[_0x834a('0x44')](_0x295d48,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1408a9){if(_0x1408a9['sendMessageOneNotActive']){if(_0x1408a9['originated']===0x0){_0x1408a9[_0x834a('0x7b')]=![];_0x1408a9[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x76')];loggerSyncQueueSummary[_0x834a('0x43')](_0x834a('0x7c'),_0x1408a9[_0x834a('0x46')],'is\x20not\x20active');}else{_0x1408a9[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x7d')];loggerSyncQueueSummary[_0x834a('0x43')](_0x834a('0x7c'),_0x1408a9[_0x834a('0x46')],_0x834a('0x7e'));}emitCampaignSummary(_0x1408a9);}}function myreject(_0x3bae15){return function(_0x299a26){return _0x3bae15(msgResponse(_0x834a('0x7f'),'Error',JSON[_0x834a('0x71')](_0x299a26)));};}Dialer[_0x834a('0x1c')]['isTrunkReachable']=function(_0x31b416){return!_[_0x834a('0x3f')](_0x31b416)&&_0x31b416&&!_[_0x834a('0x3f')](_0x31b416[_0x834a('0x46')])&&!_[_0x834a('0x3f')](_0x31b416[_0x834a('0x80')])&&_0x31b416[_0x834a('0x80')]&&(this[_0x834a('0x24')][util[_0x834a('0x45')]('SIP/%s',_0x31b416[_0x834a('0x46')])]['status']==='reachable'||this[_0x834a('0x24')][util[_0x834a('0x45')](_0x834a('0x81'),_0x31b416[_0x834a('0x46')])][_0x834a('0x82')]===_0x834a('0x83'));};Dialer[_0x834a('0x1c')][_0x834a('0x84')]=function(_0x2b620f){var _0x1a7cfa=this;return function(){if(!_0x1a7cfa[_0x834a('0x85')](_0x2b620f[_0x834a('0x86')])){if(!_0x1a7cfa[_0x834a('0x85')](_0x2b620f[_0x834a('0x87')])){_0x2b620f['message']=utils[_0x834a('0x67')]['TRUNK_NOT_REACHABLE'];throw _0x2b620f[_0x834a('0x46')]+_0x834a('0x88');}}};};Dialer[_0x834a('0x1c')][_0x834a('0x89')]=function(_0x260f86,_0x35cb05,_0x1a1848,_0x590afa){var _0x29d393=this;return function(){var _0x4d64a8=!![];return _0x29d393[_0x834a('0x8a')](_0x260f86,_0x35cb05,_0x1a1848,_0x590afa,_0x4d64a8);};};Dialer[_0x834a('0x1c')][_0x834a('0x8b')]=function(_0x132ef9,_0x37a0b1,_0x4ef813,_0x3b6d4b){var _0x3c8be3=this;return function(){var _0x3bc32c=![];return _0x3c8be3[_0x834a('0x8a')](_0x132ef9[_0x834a('0x74')],_0x37a0b1,_0x4ef813,_0x3b6d4b,_0x3bc32c);};};Dialer[_0x834a('0x1c')][_0x834a('0x8a')]=function(_0x46d81c,_0x427ebe,_0xd2c9a,_0x11c40b,_0x5ec870){var _0x2e9e8d=[];return new Promise(function(_0x1481cf,_0x353fc0){if(!isNotNull(_0x46d81c)){_0x11c40b[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x72')];return _0x353fc0(msgResponse('ifTime','Failure',_0xd2c9a+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x46d81c)){_0x11c40b['message']=utils[_0x834a('0x67')][_0x834a('0x8c')];return _0x353fc0(msgResponse(_0x834a('0x8d'),_0x834a('0x8e'),_0xd2c9a+_0x834a('0x8f')));}if(_0x427ebe&&_[_0x834a('0x3f')](config[_0x834a('0x90')][_0x427ebe])){_0x11c40b[_0x834a('0x66')]=utils[_0x834a('0x67')]['UNKNOWN_TIMEZONE'];return _0x353fc0(msgResponse('ifTime','Failure',_0xd2c9a+'\x20Timezone\x20unknow\x20'+_0x427ebe));}if(_['isArray'](_0x46d81c)){for(var _0x5e806f=0x0;_0x5e806f<_0x46d81c['length'];_0x5e806f+=0x1){_0x2e9e8d['push'](ami[_0x834a('0x91')]({'action':'command','command':util['format'](_0x834a('0x92'),_0x46d81c[_0x5e806f][_0x834a('0x93')],!_['isUndefined'](config[_0x834a('0x90')][_0x427ebe])?_0x427ebe:'')})[_0x834a('0x94')](function(_0x45b8ef){return _0x45b8ef[_0x834a('0x95')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x353fc0)));}}else{_0x2e9e8d['push'](ami[_0x834a('0x91')]({'action':_0x834a('0x96'),'command':util[_0x834a('0x45')]('iftime\x20%s,%s',_0x46d81c,!_['isUndefined'](config['timezones'][_0x427ebe])?_0x427ebe:'')})[_0x834a('0x94')](function(_0x49b402){return _0x49b402['content'][_0x834a('0x97')](_0x834a('0x98'))>=0x0;})['catch'](myreject(_0x353fc0)));}Promise[_0x834a('0x99')](_0x2e9e8d)[_0x834a('0x94')](function(_0x5823bb){var _0x394e20=_[_0x834a('0x9a')](_0x5823bb);if(_0x394e20){return _0x1481cf(_0x394e20);}else{_0x11c40b['message']=_0x5ec870?utils[_0x834a('0x67')][_0x834a('0x9b')]:utils['CAMPAIGN_STATUS'][_0x834a('0x9c')];return _0x353fc0(msgResponse(_0x834a('0x9d'),_0x834a('0x8e'),_0x834a('0x9e')+_0x5ec870+'\x20'+_0xd2c9a+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x46d81c,{'showHidden':![],'depth':null})+_0x834a('0x9f')+_0x427ebe));}})[_0x834a('0xa0')](function(_0x2d9fe1){return _0x353fc0(msgResponse(_0x834a('0x8d'),'Failure',JSON['stringify'](_0x2d9fe1)));});});};Dialer[_0x834a('0x1c')][_0x834a('0x3c')]=function(){var _0x10b88d=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x10b88d['syncCampaigns']();},0x3e8);});};Dialer[_0x834a('0x1c')][_0x834a('0xa1')]=function(){var _0x23f6e8=this;var _0x4996d6;for(var _0x1fce20 in this['campaigns']){if(typeof this[_0x834a('0x22')][_0x1fce20]!==_0x834a('0xa2')){_0x4996d6=this[_0x834a('0x22')][_0x1fce20];if(utils[_0x834a('0x78')](_0x4996d6)&&utils[_0x834a('0xa3')](_0x4996d6)){_0x4996d6[_0x834a('0x7b')]=!![];Promise[_0x834a('0xa4')]()[_0x834a('0x94')](checkIsIVRCampaignActive(_0x4996d6))[_0x834a('0x94')](checkInterval(_0x4996d6))[_0x834a('0x94')](_0x23f6e8['checkIsTrunkReachable'](_0x4996d6))['then'](_0x23f6e8[_0x834a('0x89')](_0x4996d6[_0x834a('0xa5')],_0x4996d6[_0x834a('0xa6')],_0x4996d6[_0x834a('0x46')],_0x4996d6))[_0x834a('0x94')](_0x23f6e8[_0x834a('0x8b')](_0x4996d6[_0x834a('0x73')],_0x4996d6[_0x834a('0xa6')],_0x4996d6[_0x834a('0x46')],_0x4996d6))['then'](_0x23f6e8['launchHandleIvr'](_0x4996d6))[_0x834a('0xa0')](loggerCatchQueueSummary(_0x834a('0xa7'),_0x4996d6));}else{notSendMessagesCampaign(_0x4996d6);}}}};Dialer[_0x834a('0x1c')][_0x834a('0xa8')]=function(_0x362224){if(_0x362224[_0x834a('0xa9')]!==_0x834a('0xaa')){clearPredictiveAttributes(_0x362224);}switch(_0x362224[_0x834a('0xa9')]){case _0x834a('0xab'):this[_0x834a('0xac')](_0x362224,0x1);break;case'power':this[_0x834a('0xac')](_0x362224,_0x362224[_0x834a('0xad')]);break;case _0x834a('0xaa'):this[_0x834a('0xaa')](_0x362224);break;case'booked':this[_0x834a('0xac')](_0x362224,0x1);break;default:logger[_0x834a('0x62')](_0x834a('0xae'),_0x362224['name'],_0x834a('0xaf'));}};Dialer['prototype']['ifTime']=function(_0x383f95,_0x2e1035){var _0x45e038=_0x383f95[_0x834a('0xa6')];var _0x28d3bd=_0x2e1035?_0x383f95[_0x834a('0xa5')]:_0x383f95[_0x834a('0x73')][_0x834a('0x74')];logger[_0x834a('0xb0')](_0x834a('0xb1'),_0x28d3bd,_0x45e038,_0x383f95['name'],util[_0x834a('0x45')](_0x834a('0xb2'),_0x383f95[_0x834a('0x46')],_0x383f95['id']));var _0x4ebb76=null;return Interval[_0x834a('0xb3')](_0x28d3bd,_0x45e038)['then'](function(_0x52ce5e){if(_0x52ce5e===!![]){return _0x52ce5e;}else{_0x383f95[_0x834a('0x66')]=_0x2e1035?utils[_0x834a('0x67')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x834a('0x67')][_0x834a('0x9c')];_0x4ebb76=msgResponse(_0x834a('0x9d'),_0x834a('0x8e'),_0x834a('0x9e')+_0x2e1035+'\x20'+_0x383f95[_0x834a('0x46')]+_0x834a('0xb4')+util[_0x834a('0x44')](_0x28d3bd,{'showHidden':![],'depth':null})+_0x834a('0x9f')+_0x45e038);}if(_0x4ebb76!==null){logger[_0x834a('0xb0')](_0x834a('0xb5'),_0x4ebb76);_0x4ebb76[_0x834a('0xb6')]=_0x2e1035;throw _0x4ebb76;}})[_0x834a('0xa0')](function(_0x5efbb8){logger[_0x834a('0x62')](_0x834a('0xb7'),_0x5efbb8);throw msgResponse(_0x834a('0x7f'),_0x834a('0xb8'),util[_0x834a('0x44')](_0x5efbb8,{'showHidden':![],'depth':null}));});};Dialer[_0x834a('0x1c')]['syncAgentConnect']=function(_0x518936){if(this['voiceQueues'][_0x518936[_0x834a('0xb9')]]){if(this[_0x834a('0x27')][_0x518936[_0x834a('0xba')]]&&this[_0x834a('0x27')][_0x518936['uniqueid']]['type']!==_0x834a('0xbb')){this['updateOriginated'](this['voiceQueues'][_0x518936['queue']]);this['uniqueId'][_0x518936[_0x834a('0xba')]][_0x834a('0xbc')]=moment()[_0x834a('0x45')](_0x834a('0xbd'));}}};Dialer[_0x834a('0x1c')][_0x834a('0xbe')]=function(_0x5f3845){var _0x14030b=this[_0x834a('0x27')][_0x5f3845[_0x834a('0xba')]];if(this[_0x834a('0x21')][_0x5f3845[_0x834a('0xb9')]]){if(_0x14030b&&_0x14030b['type']!=='ivr'){delete this['uniqueId'][_0x5f3845['uniqueid']];this['voiceQueues'][_0x5f3845[_0x834a('0xb9')]][_0x834a('0xbf')]+=0x1;var _0x50cbb9=new AgentComplete(_0x14030b,_0x5f3845);if(_0x5f3845[_0x834a('0xc0')]===_0x834a('0xc1')){_0x50cbb9[_0x834a('0xc2')]=this[_0x834a('0x21')][_0x5f3845['queue']]['dialQueueProject2']&&this[_0x834a('0x21')][_0x5f3845[_0x834a('0xb9')]]['dialAgiAfterHangupAgent']?moment()[_0x834a('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x50cbb9)['catch'](loggerCatch(_0x834a('0xc3')));hopperUtils[_0x834a('0xc4')](_0x50cbb9)[_0x834a('0xa0')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x834a('0x1c')][_0x834a('0x2e')]=function(_0x3dcea5){var _0x3e85c2=this[_0x834a('0x27')][_0x3dcea5[_0x834a('0xba')]];var _0x170886=this;var _0x1f171a=![];var _0x3455c7;var _0x12fa99;if(this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]]){if(_0x3e85c2&&_0x3e85c2['type']!==_0x834a('0xbb')){delete this[_0x834a('0x27')][_0x3dcea5[_0x834a('0xba')]];this[_0x834a('0xc5')](this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]]);_0x3e85c2[_0x834a('0xc6')]=moment()['format'](_0x834a('0xbd'));var _0x364173=new QueueCallerAbandon(_0x3e85c2,_0x3dcea5);if(utils[_0x834a('0x5d')](_0x3e85c2[_0x834a('0xc6')],_0x3e85c2[_0x834a('0xc7')])>=_0x3e85c2[_0x834a('0xc8')]){this['voiceQueues'][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xc9')]+=0x1;this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xca')]+=0x1;this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xcb')]+=0x1;_0x364173[_0x834a('0x6b')]=0xa;_0x364173[_0x834a('0xcc')]=_0x834a('0xcd');_0x364173[_0x834a('0xce')]=_0x834a('0xcf');_0x364173['agiafterat']=this[_0x834a('0x21')][_0x3dcea5['queue']][_0x834a('0xd0')]?moment()[_0x834a('0x45')](_0x834a('0xbd')):undefined;_0x364173[_0x834a('0xd1')]+=0x1;_0x364173[_0x834a('0xd2')]+=0x1;_0x3455c7=this['voiceQueues'][_0x3dcea5[_0x834a('0xb9')]]['dialDropRetryFrequency'];_0x12fa99=this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xd3')];hopperUtils['verifyAdditionalPhones'](_0x364173,_0x364173[_0x834a('0x6b')],_0x3e85c2['voiceQueue'])[_0x834a('0x94')](function(_0x1f135b){_0x1f171a=_0x1f135b[_0x834a('0xd4')]==0x1;if(_0x364173['countdropretry']>=_0x170886[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xd5')]){_0x170886[_0x834a('0xd6')](_0x364173,_0x1f135b['additional']);}else{hopperUtils[_0x834a('0xd7')]({'active':![],'countdropretry':_0x364173[_0x834a('0xd1')],'scheduledat':moment()[_0x834a('0xd8')](_0x170886[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xd9')],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x3e85c2[_0x834a('0xdb')],'ListId':_0x3e85c2[_0x834a('0xdc')],'VoiceQueueId':_0x3e85c2['VoiceQueueId']||undefined,'CampaignId':_0x3e85c2['CampaignId']||undefined})[_0x834a('0xa0')](loggerCatch('[rescheduleContact][Drop]'));var _0x49065a=new History(_0x364173);_0x49065a[_0x834a('0x6b')]=0xa;_0x49065a[_0x834a('0xcc')]=_0x834a('0xcd');_0x49065a[_0x834a('0x6d')]=moment()[_0x834a('0x45')](_0x834a('0xbd'));_0x49065a['endtime']=_0x49065a['starttime'];_0x49065a['calleridname']=_0x364173[_0x834a('0xdd')];_0x49065a[_0x834a('0xde')]=_0x364173['calleridnum'];hopperUtils[_0x834a('0xdf')](_0x49065a)['catch'](loggerCatch(_0x834a('0xe0')));}})[_0x834a('0x94')](function(){if(_0x1f171a)hopperUtils[_0x834a('0xe1')](_0x364173,_0x3455c7,_0x12fa99)['then'](function(){return 0x1;});});}else{this[_0x834a('0x21')][_0x3dcea5['queue']][_0x834a('0x4f')]+=0x1;this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xe2')]+=0x1;_0x364173['state']=0xb;_0x364173[_0x834a('0xcc')]=_0x834a('0xe3');_0x364173[_0x834a('0xce')]='CALLEREXIT';_0x364173['countabandonedretry']+=0x1;_0x364173['countglobal']+=0x1;_0x3455c7=this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xe4')];_0x12fa99=this['voiceQueues'][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xd3')];hopperUtils['verifyAdditionalPhones'](_0x364173,_0x364173['state'],_0x3e85c2[_0x834a('0xe5')])[_0x834a('0x94')](function(_0x32724c){if(_0x364173['countabandonedretry']>=_0x170886[_0x834a('0x21')][_0x3dcea5['queue']][_0x834a('0xe6')]){_0x170886['queueCallerAbandonCreateState'](_0x364173,_0x32724c[_0x834a('0xd4')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x364173['countabandonedretry'],'scheduledat':moment()['add'](_0x170886[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xe4')],'minutes')[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x3e85c2[_0x834a('0xdb')],'ListId':_0x3e85c2['ListId'],'VoiceQueueId':_0x3e85c2[_0x834a('0xe7')]||undefined,'CampaignId':_0x3e85c2[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0xe9')));var _0x5ebb00=new History(_0x364173);_0x5ebb00[_0x834a('0x6b')]=0xb;_0x5ebb00[_0x834a('0xcc')]=_0x834a('0xe3');_0x5ebb00[_0x834a('0x6d')]=moment()[_0x834a('0x45')](_0x834a('0xbd'));_0x5ebb00[_0x834a('0x6c')]=_0x5ebb00[_0x834a('0x6d')];_0x5ebb00['calleridname']=_0x364173[_0x834a('0xdd')];_0x5ebb00[_0x834a('0xde')]=_0x364173[_0x834a('0xde')];hopperUtils['createHistory'](_0x5ebb00)[_0x834a('0xa0')](loggerCatch(_0x834a('0xea')));}})[_0x834a('0x94')](function(){if(_0x1f171a)hopperUtils[_0x834a('0xe1')](_0x364173,_0x3455c7,_0x12fa99)[_0x834a('0x94')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x834a('0x35')]=function(_0x3d82d0){if(this[_0x834a('0xeb')][_0x3d82d0[_0x834a('0xba')]]){this[_0x834a('0xeb')][_0x3d82d0['uniqueid']][_0x834a('0xec')]=_0x3d82d0[_0x834a('0xec')];}if(this[_0x834a('0x27')][_0x3d82d0[_0x834a('0xba')]]){this[_0x834a('0x27')][_0x3d82d0[_0x834a('0xba')]][_0x834a('0xec')]=_0x3d82d0['channel'];}};Dialer[_0x834a('0x1c')][_0x834a('0x39')]=function(_0x4c2c88){if(!this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]){return;}var _0x2e181a=this['voiceQueues'][this['actions'][_0x4c2c88[_0x834a('0xed')]][_0x834a('0xb9')]][_0x834a('0xee')]||'rrmemory';if(_0x2e181a===_0x834a('0xef')){if(this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]&&_[_0x834a('0xf0')](this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]][_0x834a('0xf1')])&&_0x4c2c88[_0x834a('0x82')]==='1'&&_0x4c2c88['paused']==='0'){if(this[_0x834a('0x23')][_0x4c2c88[_0x834a('0xf2')]]){if(!this[_0x834a('0x23')][_0x4c2c88[_0x834a('0xf2')]]['locked']){this[_0x834a('0x23')][_0x4c2c88['stateinterface']][_0x834a('0xf1')]=!![];this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]][_0x834a('0xf1')]=!![];this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]['stateinterface']=_0x4c2c88[_0x834a('0xf2')];}}}}else if(_0x2e181a===_0x834a('0xf3')){if(this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]){if(this[_0x834a('0x23')][_0x4c2c88[_0x834a('0xf2')]]){this[_0x834a('0xeb')][_0x4c2c88['actionid']][_0x834a('0xf2')]=_0x4c2c88[_0x834a('0xf2')];if(_[_0x834a('0xf0')](this['queueBooked'][this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]['queue']])){this['queueBooked'][this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]['queue']]=[];}this[_0x834a('0xf4')][this['actions'][_0x4c2c88[_0x834a('0xed')]]['queue']][_0x834a('0xf5')](_[_0x834a('0xf6')](_['pick'](this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]],[_0x834a('0xf7'),_0x834a('0xf2')]),{'status':_0x4c2c88[_0x834a('0x82')],'paused':_0x4c2c88[_0x834a('0xf8')]}));}}}};Dialer[_0x834a('0x1c')]['syncQueueStatusComplete']=function(_0x4a80a8){if(!this['actions'][_0x4a80a8['actionid']]){return;}var _0x32b5a4=this;var _0x818400=this[_0x834a('0x21')][this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]];var _0x39d35e=_0x818400[_0x834a('0xee')]||_0x834a('0xf3');if(_0x39d35e===_0x834a('0xef')){if(this['actions'][_0x4a80a8['actionid']]&&this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xf2')]){this[_0x834a('0xf9')][_0x834a('0xfa')](this['actions'][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xf7')],this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xf2')])[_0x834a('0xa0')](function(_0xe0603a){logger[_0x834a('0x62')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x834a('0x44')](_0xe0603a,{'showHidden':![],'depth':null}));})['finally'](function(){_0x32b5a4[_0x834a('0xc5')](_0x32b5a4[_0x834a('0x21')][_0x32b5a4[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]);_0x32b5a4[_0x834a('0x23')][_0x32b5a4[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xf2')]]['locked']=![];delete _0x32b5a4[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]];unlockQueueStatus(_0x818400);});}else{this[_0x834a('0xc5')](this[_0x834a('0x21')][this[_0x834a('0xeb')][_0x4a80a8['actionid']][_0x834a('0xb9')]]);hopperUtils[_0x834a('0xd7')]({'active':![],'ContactId':this['actions'][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xdb')],'ListId':this['actions'][_0x4a80a8['actionid']][_0x834a('0xdc')],'VoiceQueueId':this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xe7')]||undefined,'CampaignId':this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0xfb')));delete this['actions'][_0x4a80a8[_0x834a('0xed')]];unlockQueueStatus(_0x818400);}}else if(_0x39d35e===_0x834a('0xf3')){var _0x538853;if(this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]]&&!_[_0x834a('0xfc')](this[_0x834a('0xf4')][this[_0x834a('0xeb')][_0x4a80a8['actionid']][_0x834a('0xb9')]])){if(this[_0x834a('0x2b')][_0x32b5a4[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]){this['queueBookedRR'][_0x32b5a4[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]=this[_0x834a('0x2b')][this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]?this[_0x834a('0x2b')][this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]:this[_0x834a('0xf4')][this['actions'][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]?this['queueBooked'][this['actions'][_0x4a80a8[_0x834a('0xed')]]['queue']][_0x834a('0xfd')]||0x0:0x0;}this[_0x834a('0xf4')][this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]['_rr']=this['queueBookedRR'][this[_0x834a('0xeb')][_0x4a80a8['actionid']][_0x834a('0xb9')]];for(var _0x2521b4=0x0;_0x2521b4=_0x33b7d1[_0x834a('0x125')]){_0x510b90[_0x834a('0x126')](_0x360a13,_0xa1ea44,_0x38ae79,'reason19\x20machine....');}else{if(_0x360a13[_0x834a('0x11e')]>=_0x33b7d1[_0x834a('0x127')]){_0x510b90['createStateFinal'](_0x360a13,_0xa1ea44,_0x38ae79,_0x834a('0x128'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x360a13[_0x834a('0x11e')],'scheduledat':moment()[_0x834a('0xd8')](_0x33b7d1['dialMachineRetryFrequency'],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x360a13[_0x834a('0xdb')],'ListId':_0x360a13['ListId'],'VoiceQueueId':_0x360a13[_0x834a('0xe7')]||undefined,'CampaignId':_0x360a13[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x129')));_0xa1ea44({'reschedule':0x1});}}});}if(_0x549685[_0x834a('0x41')]==='ivr'&&this[_0x834a('0x22')][_0x549685['queue']][_0x834a('0x11a')]&&_0x2c6e66[_0x834a('0x110')]===_0x834a('0x111')){delete this[_0x834a('0x27')][_0x2c6e66[_0x834a('0xba')]];this[_0x834a('0xc5')](this[_0x834a('0x22')][_0x549685[_0x834a('0xb9')]]);_0x35a8ad=new Hangup(_0x549685,_0x2c6e66);_0x35a8ad[_0x834a('0x6b')]=0x12;_0x35a8ad[_0x834a('0xcc')]=_0x834a('0x113');_0x35a8ad[_0x834a('0x114')]=_0x834a('0x11d');ami[_0x834a('0x40')](_0x834a('0x11f'),ut[_0x834a('0x115')](_0x35a8ad,_0x834a('0x116')));this['saveInDb'](_0x35a8ad,_0x834a('0x12a'),'[syncHangupInAMDIvr]');}if(_0x549685[_0x834a('0x41')]==='ivr'&&this[_0x834a('0x22')][_0x549685[_0x834a('0xb9')]]['dialAMDActive']&&_0x2c6e66[_0x834a('0x110')]===_0x834a('0x11b')){return new Promise(function(_0x17b1c6,_0x54f4bc){delete _0x510b90[_0x834a('0x27')][_0x2c6e66['uniqueid']];_0x510b90[_0x834a('0xc5')](_0x510b90['campaigns'][_0x549685[_0x834a('0xb9')]]);_0x510b90['campaigns'][_0x549685['queue']][_0x834a('0xbf')]+=0x1;_0x510b90['campaigns'][_0x549685['queue']][_0x834a('0x112')]+=0x1;var _0x5f2870=_0x510b90[_0x834a('0x22')][_0x549685[_0x834a('0xb9')]];var _0x4bdd56=new Hangup(_0x549685,_0x2c6e66);_0x4bdd56[_0x834a('0x6b')]=0x13;_0x4bdd56[_0x834a('0xcc')]='Machine';_0x4bdd56['membername']=_0x834a('0x11d');_0x4bdd56['countmachineretry']+=0x1;_0x4bdd56[_0x834a('0xd2')]+=0x1;_0x4bdd56[_0x834a('0x116')]=!![];ami[_0x834a('0x40')]('custom:amd',ut['buildObj'](_0x4bdd56,_0x834a('0x116')));hopperUtils[_0x834a('0xdf')](_0x4bdd56)[_0x834a('0xa0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4bdd56['countbusyretry']+_0x4bdd56[_0x834a('0x121')]+_0x4bdd56[_0x834a('0x12b')]+_0x4bdd56['countnosuchnumberretry']+_0x4bdd56[_0x834a('0xd1')]+_0x4bdd56[_0x834a('0x123')]+_0x4bdd56[_0x834a('0x11e')]+_0x4bdd56[_0x834a('0x124')]>=_0x5f2870['dialGlobalMaxRetry']){_0x510b90['stateGlobal'](_0x4bdd56,_0x17b1c6,_0x54f4bc,'reason19\x20machine....');}else{if(_0x4bdd56[_0x834a('0x11e')]>=_0x5f2870[_0x834a('0x127')]){_0x510b90[_0x834a('0x12c')](_0x4bdd56,_0x17b1c6,_0x54f4bc,_0x834a('0x128'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x4bdd56[_0x834a('0x11e')],'scheduledat':moment()[_0x834a('0xd8')](_0x5f2870[_0x834a('0x12d')],_0x834a('0xda'))[_0x834a('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4bdd56['ContactId'],'ListId':_0x4bdd56['ListId'],'VoiceQueueId':_0x4bdd56[_0x834a('0xe7')]||undefined,'CampaignId':_0x4bdd56[_0x834a('0xe8')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x17b1c6({'reschedule':0x1});}}});}}};Dialer[_0x834a('0x1c')]['syncHangup']=function(_0x2b89cc){var _0x3f0a10=this[_0x834a('0x27')][_0x2b89cc[_0x834a('0xba')]];var _0x2710c8;if(_0x3f0a10&&_0x3f0a10[_0x834a('0x41')]===_0x834a('0xbb')){delete this['uniqueId'][_0x2b89cc[_0x834a('0xba')]];this[_0x834a('0xc5')](this[_0x834a('0x22')][_0x3f0a10['queue']]);this[_0x834a('0x22')][_0x3f0a10[_0x834a('0xb9')]][_0x834a('0x12e')]+=0x1;_0x2710c8=new Hangup(_0x3f0a10,_0x2b89cc);hopperUtils['createHistory'](_0x2710c8)['catch'](loggerCatch(_0x834a('0x12f')));hopperUtils[_0x834a('0xc4')](_0x2710c8)[_0x834a('0xa0')](loggerCatch(_0x834a('0x130')));}if(_0x3f0a10&&_0x3f0a10[_0x834a('0x41')]!==_0x834a('0xbb')&&isNotNull(this[_0x834a('0x21')][_0x3f0a10[_0x834a('0xb9')]][_0x834a('0x131')])){delete this[_0x834a('0x27')][_0x2b89cc[_0x834a('0xba')]];this['updateOriginated'](this[_0x834a('0x21')][_0x3f0a10['queue']]);this[_0x834a('0x21')][_0x3f0a10[_0x834a('0xb9')]][_0x834a('0xbf')]+=0x1;this[_0x834a('0x21')][_0x3f0a10['queue']][_0x834a('0x112')]+=0x1;_0x2710c8=new Hangup(_0x3f0a10,_0x2b89cc);_0x2710c8[_0x834a('0x6b')]=0x10;_0x2710c8['statedesc']=_0x834a('0x132');_0x2710c8[_0x834a('0x114')]=_0x834a('0x133');hopperUtils['createHistory'](_0x2710c8)[_0x834a('0xa0')](loggerCatch(_0x834a('0x12f')));hopperUtils[_0x834a('0xc4')](_0x2710c8)['catch'](loggerCatch(_0x834a('0x130')));}if(_0x3f0a10&&_0x3f0a10['type']!==_0x834a('0xbb')&&!isNotNull(this[_0x834a('0x21')][_0x3f0a10[_0x834a('0xb9')]][_0x834a('0x131')])){delete this[_0x834a('0x27')][_0x2b89cc[_0x834a('0xba')]];this[_0x834a('0xc5')](this[_0x834a('0x21')][_0x3f0a10[_0x834a('0xb9')]]);this[_0x834a('0x21')][_0x3f0a10[_0x834a('0xb9')]][_0x834a('0x134')]+=0x1;_0x2710c8=new Hangup(_0x3f0a10,_0x2b89cc);_0x2710c8[_0x834a('0x6b')]=0xc;_0x2710c8[_0x834a('0xcc')]=_0x2b89cc[_0x834a('0x135')];_0x2710c8[_0x834a('0x114')]=_0x834a('0x136');hopperUtils['createHistory'](_0x2710c8)['catch'](loggerCatch(_0x834a('0x12f')));hopperUtils[_0x834a('0xc4')](_0x2710c8)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x834a('0x1c')][_0x834a('0xb')]=function(_0x418133){var _0x426622=this;if(!_0x426622[_0x834a('0x2c')][_0x418133[_0x834a('0x46')]]){_0x426622[_0x834a('0x2c')][_0x418133[_0x834a('0x46')]]={'running':![]};}else if(_0x426622[_0x834a('0x2c')][_0x418133['name']][_0x834a('0x137')]===!![]){return;}else if(_0x426622[_0x834a('0x2c')][_0x418133['name']][_0x834a('0x137')]===![]){_0x426622['queuesSummary'][_0x418133[_0x834a('0x46')]][_0x834a('0x137')]=!![];}var _0xf058c5=_0x426622[_0x834a('0x21')][_0x418133[_0x834a('0x46')]];var _0x4d25e4=_0xf058c5[_0x834a('0x66')]!==utils['CAMPAIGN_STATUS'][_0x834a('0x76')];var _0x15ad3f=utils[_0x834a('0x138')](_0xf058c5);_0xf058c5[_0x834a('0x139')]=utils[_0x834a('0x13a')](_0xf058c5,_0x426622[_0x834a('0x24')]);Promise['resolve']()[_0x834a('0x94')](function(){if(_0xf058c5[_0x834a('0x139')]===utils[_0x834a('0x67')]['INACTIVE']){if(_0x4d25e4){clearPredictiveAttributes(_0xf058c5);_0x418133[_0x834a('0x5f')]=undefined;_0x418133['startProgressive']=undefined;}if(_0xf058c5['statusMessage']===utils[_0x834a('0x67')][_0x834a('0x76')]){_0x418133[_0x834a('0x13b')]=0x0;_0x418133[_0x834a('0xf8')]=0x0;_0x418133['inUse']=0x0;_0x418133[_0x834a('0x13c')]=0x0;_0x418133[_0x834a('0x13d')]=0x0;}}else if(_0xf058c5[_0x834a('0x139')]===utils[_0x834a('0x67')][_0x834a('0x13e')]&&!_0x15ad3f){return _0x426622['ifTime'](_0xf058c5,!![])[_0x834a('0x94')](function(){return _0x426622['ifTime'](_0xf058c5,![]);})['then'](function(){return _0x426622[_0x834a('0xa8')](_0xf058c5);})['catch'](function(_0x37d9f9){loggerSyncQueueSummary[_0x834a('0x43')]('[syncQueueSummary]',util['inspect'](_0x37d9f9,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xf058c5);});}else{clearPredictiveAttributes(_0xf058c5);}})[_0x834a('0x94')](function(){var _0x362bee=_0x418133[_0x834a('0x13f')](_0xf058c5);if(_0x362bee||_0xf058c5[_0x834a('0x140')]){_0xf058c5['queueSummaryCountersUpdated']=![];_0x418133[_0x834a('0x141')](_0xf058c5);Object[_0x834a('0x142')](_0xf058c5,_0x418133);emitOutboundVoiceQueueSummary(_0x418133);}_0x426622[_0x834a('0x2c')][_0xf058c5[_0x834a('0x46')]][_0x834a('0x137')]=![];})[_0x834a('0xa0')](function(_0x39ff9e){logger[_0x834a('0x62')](_0x834a('0x143'),util[_0x834a('0x44')](_0x39ff9e,{'showHidden':![],'depth':null}));_0x426622['queuesSummary'][_0xf058c5['name']][_0x834a('0x137')]=![];});};Dialer['prototype'][_0x834a('0x144')]=_[_0x834a('0x145')](function(){var _0xe32860=_['filter'](this['voiceQueues'],function(_0x654ff2){return _0x654ff2[_0x834a('0x146')];});var _0x832a3f=_[_0x834a('0x147')](this[_0x834a('0x23')],function(_0x78ce38){return _0x78ce38[_0x834a('0x148')]&&_0x78ce38['status']==='reachable';});if(_0xe32860[_0x834a('0x149')]>0x0&&_0x832a3f['length']>0x0){return Promise[_0x834a('0xa4')]()['then'](cmHopper['handlePreviewRecallNotifications'](_[_0x834a('0x14a')](_0xe32860,'id'),previewRecallmeReminderInterval,_[_0x834a('0x14a')](_0x832a3f,'id')))[_0x834a('0x94')](function(_0x382a2b){for(var _0x59deeb=0x0;_0x59deeb<_0x382a2b['length'];_0x59deeb++){var _0xc97696=_0x382a2b[_0x59deeb][_0x834a('0x14b')]['name'];if(_0xc97696)io['to'](util[_0x834a('0x45')](_0x834a('0x14c'),_0xc97696))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x382a2b[_0x59deeb]});}})['catch'](function(_0x233580){logger[_0x834a('0x62')]('checkPreviewRecallReminder',_0x233580);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x834a('0x1c')][_0x834a('0x14d')]=function(){var _0x187763=this;setInterval(function(){_0x187763[_0x834a('0x14e')](_0x187763['uniqueId'],_0x834a('0x14f'));_0x187763[_0x834a('0x14e')](_0x187763[_0x834a('0xeb')],'[actions]');},0x32c8);};Dialer[_0x834a('0x1c')][_0x834a('0x14e')]=function(_0x1c6d09,_0x537126){var _0x387856=this;for(var _0x5ad4bf in _0x1c6d09){if(typeof _0x1c6d09[_0x5ad4bf]!==_0x834a('0xa2')){this[_0x834a('0x20')][_0x834a('0x1d')](function(){if(!_[_0x834a('0xf0')](_0x1c6d09[_0x5ad4bf])){return ami[_0x834a('0x91')]({'action':_0x834a('0x82'),'channel':_0x1c6d09[_0x5ad4bf][_0x834a('0xec')]})['catch'](function(_0x3ab8c7){if(_0x3ab8c7['message']===_0x834a('0x150')){setTimeout(function(){if(_0x1c6d09[_0x5ad4bf]&&_0x1c6d09[_0x5ad4bf][_0x834a('0x41')]!==_0x834a('0xbb')){_0x387856['updateOriginated'](_0x387856[_0x834a('0x21')][_0x1c6d09[_0x5ad4bf][_0x834a('0xb9')]]);logger['error']('[Dialer][checkChannel]',_0x537126,_0x5ad4bf,_0x1c6d09[_0x5ad4bf][_0x834a('0xb9')]);delete _0x1c6d09[_0x5ad4bf];}if(_0x1c6d09[_0x5ad4bf]&&_0x1c6d09[_0x5ad4bf]['type']===_0x834a('0xbb')){_0x387856[_0x834a('0xc5')](_0x387856[_0x834a('0x22')][_0x1c6d09[_0x5ad4bf][_0x834a('0xb9')]]);logger[_0x834a('0x62')](_0x834a('0x151'),_0x537126,_0x5ad4bf,_0x1c6d09[_0x5ad4bf]['queue']);delete _0x1c6d09[_0x5ad4bf];}},0x2328);}});}});}}};Dialer[_0x834a('0x1c')]['getVoiceQueueRtPauses']=function(_0x50135b){return Promise[_0x834a('0xa4')]()[_0x834a('0x94')](voiceQueueRt[_0x834a('0x152')](_0x50135b))[_0x834a('0xa0')](loggerCatch(_0x834a('0x153')));};Dialer[_0x834a('0x1c')][_0x834a('0xc5')]=function(_0x3cae54){if(!_[_0x834a('0x3f')](_0x3cae54)&&_0x3cae54!==null){if(typeof _0x3cae54[_0x834a('0x154')]!==_0x834a('0xa2')){if(_0x3cae54['originated']>0x0){_0x3cae54['originated']-=0x1;}else{logger[_0x834a('0x62')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x834a('0x62')](_0x834a('0x155'));}};Dialer[_0x834a('0x1c')]['loggerHandler']=function(_0x4ba4eb,_0x1ddc29){var _0x4355d8=this;return function(_0x1a75bb){_0x4355d8['updateOriginated'](_0x1ddc29);logger[_0x834a('0x62')](_0x4ba4eb,util[_0x834a('0x44')](_0x1a75bb,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x834a('0x156')]=function(_0x39c487,_0x261617,_0xdf216d){var _0x411991={'state':0x19,'statedesc':_0x834a('0x157')};this[_0x834a('0xc5')](_0x261617);this['saveInDb'](_[_0x834a('0xf6')](_0x411991,_[_0x834a('0x100')](_0xdf216d,['ContactId',_0x834a('0xdc'),_0x834a('0x158'),'VoiceQueueId','CampaignId'])),_0x834a('0x159'),'[emptyContact]');logger[_0x834a('0x62')](_0x39c487);};Dialer[_0x834a('0x1c')][_0x834a('0x117')]=function(_0x6b9d70,_0x144a16,_0x2b10b2){hopperUtils['createHistory'](_0x6b9d70)[_0x834a('0xa0')](loggerCatch(_0x144a16));hopperUtils['moveContactManagedDialer'](_0x6b9d70)[_0x834a('0xa0')](loggerCatch(_0x2b10b2));};Dialer[_0x834a('0x1c')][_0x834a('0xd6')]=function(_0x31efcd,_0x321287){hopperUtils[_0x834a('0xdf')](_0x31efcd)[_0x834a('0xa0')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x321287==0x0){hopperUtils[_0x834a('0xc4')](_0x31efcd)[_0x834a('0xa0')](loggerCatch(_0x834a('0x15a')));}};Dialer['prototype'][_0x834a('0x15b')]=function(_0xc83d79){return Promise[_0x834a('0xa4')]()[_0x834a('0x94')](cmHopper['handlePreviewRecallNotifications'](_0xc83d79['id'],previewRecallmeReminderInterval))['then'](function(_0x347a9d){for(var _0x186971=0x0;_0x186971<_0x347a9d[_0x834a('0x149')];_0x186971++){var _0xbe2024=_0x347a9d[_0x186971][_0x834a('0x14b')][_0x834a('0x46')];if(_0xbe2024)io['to'](util[_0x834a('0x45')]('user:%s',_0xbe2024))['emit'](_0x834a('0x15c'),{'hopper':_0x347a9d[_0x186971]});}})[_0x834a('0xa0')](function(){});};Dialer[_0x834a('0x1c')]['launchHandleIvr']=function(_0x261d12){var _0x2d008f=this;return function(){_0x2d008f[_0x834a('0x15d')](_0x261d12);};};Dialer[_0x834a('0x1c')][_0x834a('0x15e')]=function(_0x449be3,_0x109acd){var _0xa45e83=this;var _0x55d0fd=uuid['v4']();this[_0x834a('0xeb')][_0x55d0fd]=new Action(_0x449be3,_0x109acd,_0x55d0fd);return new Promise(function(_0x4dd31a,_0x3f4f82){if(_[_0x834a('0x3f')](_0x449be3)&&typeof _0x449be3!=='object'){return _0x3f4f82(msgResponse('originate','Failure',_0x834a('0x15f')));}if(_[_0x834a('0x3f')](_0x109acd[_0x834a('0x160')])||_0x109acd[_0x834a('0x160')]===null){return _0x3f4f82(msgResponse('originate',_0x834a('0x8e'),_0x834a('0x161')));}var _0x26928f={'XMD-CALLERID':_0xa45e83[_0x834a('0xeb')][_0x55d0fd][_0x834a('0x162')](),'XMD-AGI':_0x449be3[_0x834a('0x131')]?util[_0x834a('0x45')]('\x22agi://%s/square,%s\x22',ipAgi,_0x449be3[_0x834a('0x131')]):_0x834a('0x163'),'XMD-AGIAFTER':_0x449be3[_0x834a('0xd0')]?util[_0x834a('0x45')](_0x834a('0x164'),ipAgi,_0x449be3[_0x834a('0xd0')]):'NONE','XMD-QUEUE':utils[_0x834a('0x165')](_0x449be3)?util[_0x834a('0x45')](_0x834a('0x166'),_0x449be3[_0x834a('0x46')],_0x449be3[_0x834a('0x167')]||'',_0x449be3[_0x834a('0x168')]?'c':'',_0x449be3['dialQueueTimeout']||0x3):_0x834a('0x163'),'XMD-CONTACTID':_0x109acd[_0x834a('0xdb')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xa45e83['actions'][_0x55d0fd][_0x834a('0x162')](),'XMD-AMD':_0x449be3['dialAMDActive']?_0x834a('0x13e'):_0x834a('0x163'),'XMD-DESTINATION':_0x834a('0x10f')};if(_0x449be3[_0x834a('0x11a')]){_0x26928f[_0x834a('0x169')]=_0x449be3[_0x834a('0x16a')]||0x9c4;_0x26928f['XMD-AMDGREETING']=_0x449be3['dialAMDGreeting']||0x5dc;_0x26928f[_0x834a('0x16b')]=_0x449be3[_0x834a('0x16c')]||0x320;_0x26928f[_0x834a('0x16d')]=_0x449be3[_0x834a('0x16e')]||0x1388;_0x26928f['XMD-AMDMINWORDLENGTH']=_0x449be3['dialAMDMinWordLength']||0x64;_0x26928f['XMD-AMDBETWEENWORDSSILENCE']=_0x449be3['dialAMDBetweenWordsSilence']||0x32;_0x26928f[_0x834a('0x16f')]=_0x449be3[_0x834a('0x170')]||0x3;_0x26928f[_0x834a('0x171')]=_0x449be3[_0x834a('0x172')]||0x100;_0x26928f[_0x834a('0x173')]=_0x449be3[_0x834a('0x174')]||0x1388;}if(utils[_0x834a('0x165')](_0x449be3)){_0x26928f[_0x834a('0x175')]=_0x109acd[_0x834a('0xe7')];}else{_0x26928f[_0x834a('0x176')]=_0x109acd[_0x834a('0xe8')];}var _0x53906e=utils['setXMDContactVariables'](_0x109acd[_0x834a('0x177')]);Object[_0x834a('0x142')](_0x26928f,_0x53906e);var _0x201664=_0xa45e83[_0x834a('0x85')](_0x449be3[_0x834a('0x86')])?utils[_0x834a('0x178')](_0x449be3[_0x834a('0x86')]['callerid'],_0x449be3[_0x834a('0x179')],_0x449be3[_0x834a('0x17a')]>0x0?utils[_0x834a('0x17b')](_0x449be3[_0x834a('0x17c')],_0x449be3[_0x834a('0x17a')]):_0x449be3[_0x834a('0x17c')]):utils[_0x834a('0x178')](_[_0x834a('0xf0')](_0x449be3[_0x834a('0x87')])?_0x449be3[_0x834a('0x86')]['callerid']:_0x449be3[_0x834a('0x87')]['callerid'],_0x449be3[_0x834a('0x179')],_0x449be3[_0x834a('0x17a')]>0x0?utils[_0x834a('0x17b')](_0x449be3[_0x834a('0x17c')],_0x449be3[_0x834a('0x17a')]):_0x449be3['dialOriginateCallerIdNumber']);if(_0x201664){_0x26928f[_0x834a('0x17d')]=_0xa45e83[_0x834a('0xeb')][_0x55d0fd][_0x834a('0x17e')]=utils[_0x834a('0x17f')](_0x201664);_0x26928f[_0x834a('0x180')]=_0x109acd[_0x834a('0x160')];}_0x449be3[_0x834a('0x181')]=_0x26928f;return ami[_0x834a('0x91')]({'actionid':_0x55d0fd,'action':_0x834a('0x182'),'channel':_0xa45e83[_0x834a('0x85')](_0x449be3[_0x834a('0x86')])?util[_0x834a('0x45')](_0x834a('0x183'),_0x449be3[_0x834a('0x86')][_0x834a('0x46')],isNotNull(_0x449be3['dialPrefix'])?_0x449be3[_0x834a('0x184')][_0x834a('0x185')]()||'':'',_0x449be3[_0x834a('0x186')]>0x0?_0x109acd['phone']['substring'](_0x449be3[_0x834a('0x186')]):_0x109acd[_0x834a('0x160')]):util[_0x834a('0x45')](_0x834a('0x183'),_[_0x834a('0xf0')](_0x449be3[_0x834a('0x87')])?_0x449be3['Trunk'][_0x834a('0x46')]:_0x449be3['TrunkBackup']['name'],isNotNull(_0x449be3['dialPrefix'])?_0x449be3['dialPrefix'][_0x834a('0x185')]()||'':'',_0x449be3['dialCutDigit']>0x0?_0x109acd[_0x834a('0x160')][_0x834a('0x187')](_0x449be3[_0x834a('0x186')]):_0x109acd[_0x834a('0x160')]),'callerid':_0x201664,'Exten':_0x834a('0x10f'),'Context':_0x834a('0x188'),'Priority':'1','variable':_0x26928f,'timeout':(_0x449be3[_0x834a('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55d0fd})[_0x834a('0x94')](function(_0x55b04c){return _0x4dd31a(_0x55b04c);})[_0x834a('0xa0')](function(_0x55999d){_0x449be3['outboundOriginateFailureCallsDay']+=0x1;var _0x21916b=new History(_0xa45e83['actions'][_0x55d0fd]);logger[_0x834a('0x62')](util[_0x834a('0x45')](_0x834a('0x18a'),JSON['stringify'](_0x55999d)));_0x21916b['state']=0xe;_0x21916b[_0x834a('0xcc')]='OriginateError';_0x21916b['starttime']=moment()[_0x834a('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x21916b[_0x834a('0x6c')]=_0x21916b[_0x834a('0x6d')];hopperUtils['createHistory'](_0x21916b)['catch'](loggerCatch('[originate][error]'));_0xa45e83[_0x834a('0xc4')](_0x21916b)[_0x834a('0xa0')](loggerCatch('[originate][error]'))[_0x834a('0x1f')](function(){delete _0xa45e83[_0x834a('0xeb')][_0x55d0fd];return _0x3f4f82(msgResponse(_0x834a('0x182'),'Error',_0x834a('0x18b')));});});});};Dialer[_0x834a('0x1c')][_0x834a('0x18c')]=function(_0x38dc50,_0x4430d6,_0x494881){var _0x505684=new History(_0x4430d6);if(_0x505684['countbusyretry']+_0x505684[_0x834a('0x121')]+_0x505684[_0x834a('0x12b')]+_0x505684[_0x834a('0x122')]+_0x505684[_0x834a('0xd1')]+_0x505684[_0x834a('0x123')]+_0x505684[_0x834a('0x11e')]+_0x505684[_0x834a('0x124')]>=_0x494881['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x38dc50){case 0x3:if(_0x505684[_0x834a('0x12b')]>=_0x494881[_0x834a('0x18d')]-0x1){return!![];}hopperUtils[_0x834a('0xd7')]({'active':![],'countnoanswerretry':_0x505684[_0x834a('0x12b')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0x18e')],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684['ListId'],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x505684[_0x834a('0x120')]>=_0x494881[_0x834a('0x18f')]-0x1){return!![];}hopperUtils[_0x834a('0xd7')]({'active':![],'countbusyretry':_0x505684[_0x834a('0x120')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0x190')],_0x834a('0xda'))['format'](_0x834a('0xbd')),'ContactId':_0x505684['ContactId'],'ListId':_0x505684[_0x834a('0xdc')],'VoiceQueueId':_0x505684['VoiceQueueId']||undefined,'CampaignId':_0x505684['CampaignId']||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x191')));break;case 0x8:if(_0x505684['countcongestionretry']>=_0x494881['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x834a('0xd7')]({'active':![],'countcongestionretry':_0x505684[_0x834a('0x121')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0x192')],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684[_0x834a('0xdc')],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x193')));break;case 0x0:if(_0x505684[_0x834a('0x122')]>=_0x494881[_0x834a('0x194')]-0x1){return!![];}else{hopperUtils[_0x834a('0xd7')]({'active':![],'countnosuchnumberretry':_0x505684[_0x834a('0x122')]+=0x1,'scheduledat':moment()['add'](_0x494881['dialNoSuchNumberRetryFrequency'],'minutes')[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684[_0x834a('0xdc')],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684['CampaignId']||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x195')));}break;case 0xa:if(_0x505684[_0x834a('0xd1')]>=_0x494881[_0x834a('0xd5')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x505684[_0x834a('0xd1')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881['dialDropRetryFrequency'],'minutes')[_0x834a('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684['ListId'],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x196')));break;case 0xb:if(_0x505684['countabandonedretry']>=_0x494881[_0x834a('0xe6')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x505684[_0x834a('0x123')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0xe4')],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684['ListId'],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})['catch'](loggerCatch(_0x834a('0xe9')));break;case 0x13:if(_0x505684['countmachineretry']>=_0x494881[_0x834a('0x127')]-0x1){return!![];}hopperUtils[_0x834a('0xd7')]({'active':![],'countmachineretry':_0x505684[_0x834a('0x11e')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0x12d')],_0x834a('0xda'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684[_0x834a('0xdc')],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x505684['countagentrejectretry']>=_0x494881['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x505684[_0x834a('0x124')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0x197')],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684['ListId'],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x198')));break;default:return!![];}};Dialer[_0x834a('0x1c')]['callProgressDetecting']=function(_0x510884,_0xc82621,_0x4956b3){var _0x424e75=this;var _0x13df24=new History(_0x510884);var _0x430f65=![];var _0x50ab7a;var _0x1badbd;return new Promise(function(_0x4c6c71,_0x5b6a83){if(_['isUndefined'](_0xc82621)&&typeof _0xc82621!==_0x834a('0x199')){return _0x5b6a83(msgResponse(_0x834a('0x19a'),_0x834a('0x8e'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x4956b3)&&typeof _0x4956b3!=='object'){return _0x5b6a83(msgResponse('[callProgressDetecting]',_0x834a('0x8e'),_0x834a('0x19b')));}hopperUtils[_0x834a('0x19c')](_0x13df24,_0x4956b3[_0x834a('0xc0')],_0xc82621)[_0x834a('0x94')](function(_0x533143){if(_0x533143['additional']==0x1)_0x430f65=!![];switch(_0x4956b3['reason']){case'0':_0xc82621['outboundNoSuchCallsDay']+=0x1;_0x13df24[_0x834a('0x6b')]=0x0;_0x13df24[_0x834a('0xcc')]=_0x834a('0x19d');_0x13df24[_0x834a('0x122')]+=0x1;_0x13df24[_0x834a('0xd2')]+=0x1;ami[_0x834a('0x40')](_0x834a('0x19e'),ut['buildObj'](_0x510884,_0x834a('0x19f')));_0x50ab7a=_0xc82621['dialNoSuchNumberRetryFrequency'];_0x1badbd=_0xc82621[_0x834a('0xd3')];hopperUtils[_0x834a('0xdf')](_0x13df24)['catch'](loggerCatch(_0x834a('0x1a0')));if(_0x424e75[_0x834a('0x18c')](0x0,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x122')]>=_0xc82621['dialNoSuchNumberMaxRetry']){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1a1'));}else{_0x424e75['stateGlobal'](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1a1'));}}break;case'3':_0xc82621[_0x834a('0x1a2')]+=0x1;_0x13df24['state']=0x3;_0x13df24[_0x834a('0xcc')]=_0x834a('0x1a3');_0x13df24[_0x834a('0x12b')]+=0x1;_0x13df24[_0x834a('0xd2')]+=0x1;var _0x7cd6cf=ut[_0x834a('0x1a4')](_0x510884,_0xc82621);ami[_0x834a('0x40')](_0x834a('0x1a5'),_0x7cd6cf);_0x50ab7a=_0xc82621[_0x834a('0x18e')];_0x1badbd=_0xc82621[_0x834a('0xd3')];hopperUtils['createHistory'](_0x13df24)[_0x834a('0xa0')](loggerCatch(_0x834a('0x1a6')));if(_0x424e75[_0x834a('0x18c')](0x3,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x12b')]>=_0xc82621[_0x834a('0x18d')]){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,'reason\x203\x20ringing\x20no\x20answer');}else{_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1a7'));}}break;case'5':_0xc82621['outboundBusyCallsDay']+=0x1;_0x13df24[_0x834a('0x6b')]=0x5;_0x13df24[_0x834a('0xcc')]=_0x834a('0x1a8');_0x13df24['countbusyretry']+=0x1;_0x13df24[_0x834a('0xd2')]+=0x1;ami[_0x834a('0x40')](_0x834a('0x1a9'),ut[_0x834a('0x115')](_0x510884,_0x834a('0x1aa')));_0x50ab7a=_0xc82621[_0x834a('0x190')];_0x1badbd=_0xc82621[_0x834a('0xd3')];hopperUtils['createHistory'](_0x13df24)[_0x834a('0xa0')](loggerCatch(_0x834a('0x1ab')));if(_0x424e75[_0x834a('0x18c')](0x5,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x120')]>=_0xc82621[_0x834a('0x18f')]){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1ac'));}else{_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1ac'));}}break;case'8':_0xc82621[_0x834a('0x1ad')]+=0x1;_0x13df24[_0x834a('0x6b')]=0x8;_0x13df24[_0x834a('0xcc')]=_0x834a('0x1ae');_0x13df24[_0x834a('0x121')]+=0x1;_0x13df24[_0x834a('0xd2')]+=0x1;_0x50ab7a=_0xc82621[_0x834a('0x192')];_0x1badbd=_0xc82621['callAdditionalPhoneAfterMin'];ami[_0x834a('0x40')]('custom:agentcongestion',ut['buildObj'](_0x510884,'congestion'));hopperUtils[_0x834a('0xdf')](_0x13df24)[_0x834a('0xa0')](loggerCatch(_0x834a('0x1af')));if(_0x424e75['checkRetriveMax'](0x8,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x121')]>=_0xc82621[_0x834a('0x1b0')]){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,'reason\x208\x20congestion');}else{_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1b1'));}}break;case'11':_0xc82621[_0x834a('0x1b2')]+=0x1;_0x13df24[_0x834a('0x6b')]=0xb;_0x13df24[_0x834a('0xcc')]='Abandoned';_0x13df24[_0x834a('0x123')]+=0x1;_0x13df24[_0x834a('0xd2')]+=0x1;_0x50ab7a=_0xc82621[_0x834a('0xe4')];_0x1badbd=_0xc82621[_0x834a('0xd3')];hopperUtils[_0x834a('0xdf')](_0x13df24)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x424e75[_0x834a('0x18c')](0xb,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x123')]>=_0xc82621['dialAbandonedMaxRetry']){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1b3'));}else{_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,'reason\x2011\x20abandoned');}}break;case'20':_0xc82621[_0x834a('0x1b4')]+=0x1;_0x13df24[_0x834a('0x6b')]=0x14;_0x13df24[_0x834a('0xcc')]=_0x834a('0x1b5');_0x13df24[_0x834a('0x124')]+=0x1;_0x13df24['countglobal']+=0x1;_0x50ab7a=_0xc82621[_0x834a('0x197')];_0x1badbd=_0xc82621[_0x834a('0xd3')];ami['emit'](_0x834a('0x1b6'),ut['buildObj'](_0x510884,_0x834a('0x1b7')));hopperUtils[_0x834a('0xdf')](_0x13df24)['catch'](loggerCatch(_0x834a('0x1b8')));if(_0x424e75[_0x834a('0x18c')](0x14,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x124')]>=_0xc82621[_0x834a('0x1b9')]){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1ba'));}else{_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1ba'));}}break;default:_0xc82621[_0x834a('0x134')]+=0x1;_0x13df24['state']=0xc;_0x13df24[_0x834a('0xcc')]=_0x4956b3[_0x834a('0xc0')];_0x50ab7a=_0xc82621['dialAgentRejectRetryFrequency'];_0x1badbd=_0xc82621[_0x834a('0xd3')];hopperUtils['createHistory'](_0x13df24)[_0x834a('0xa0')](loggerCatch(_0x834a('0x1bb')));if(_0x424e75['checkRetriveMax'](_0x4956b3[_0x834a('0xc0')],_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x120')]+_0x13df24[_0x834a('0x121')]+_0x13df24[_0x834a('0x12b')]+_0x13df24[_0x834a('0x122')]+_0x13df24[_0x834a('0xd1')]+_0x13df24[_0x834a('0x123')]+_0x13df24[_0x834a('0x11e')]+_0x13df24[_0x834a('0x124')]>=_0xc82621[_0x834a('0x125')]){_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x4956b3['reason']);}else{_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x4956b3[_0x834a('0xc0')]);}}}})['then'](function(){if(_0x430f65){hopperUtils[_0x834a('0xe1')](_0x13df24,_0x50ab7a,_0x1badbd)[_0x834a('0x94')](function(){return _0x4c6c71(0x1);});}});});};Dialer[_0x834a('0x1c')]['stateGlobal']=function(_0x27a63b,_0x1d940f,_0x25fe57,_0x1496b9){var _0x4c0dfe=new Final(_0x27a63b);_0x4c0dfe[_0x834a('0x6b')]=0xf;_0x4c0dfe[_0x834a('0xcc')]='Global';this[_0x834a('0x12c')](_0x4c0dfe,_0x1d940f,_0x25fe57,_0x1496b9);};Dialer[_0x834a('0x1c')][_0x834a('0x12c')]=function(_0x1ba8a0,_0x4c5ef2,_0x4fa4bd,_0xa0b8f){hopperUtils[_0x834a('0xc4')](_0x1ba8a0)['then'](function(){return _0x4c5ef2(msgResponse('[callProgressDetecting]','Success',_0xa0b8f));})[_0x834a('0xa0')](function(){return _0x4fa4bd(msgResponse(_0x834a('0x1bc'),_0x834a('0x8e'),_0x834a('0x1bd')));});};Dialer[_0x834a('0x1c')][_0x834a('0xaa')]=function(_0x43dc28){var _0x422511=_0x43dc28[_0x834a('0x1be')]/0x64;var _0x4e0cf9=_0x43dc28[_0x834a('0xca')]/(_0x43dc28['outboundDropCallsDayTimeout']+_0x43dc28[_0x834a('0xbf')]);var _0x18669f=Math[_0x834a('0x1bf')](_0x43dc28[_0x834a('0x1c0')]*(_0x43dc28[_0x834a('0x1c1')]/0x64));var _0x46938d=Math[_0x834a('0x1bf')](_0x43dc28[_0x834a('0x1c0')]*(_0x43dc28[_0x834a('0x1c2')]/0x64));var _0x3caca8=_0x43dc28[_0x834a('0x13b')]+_0x43dc28[_0x834a('0x13c')];var _0x10fc56=Math['floor'](_0x43dc28[_0x834a('0x57')]*_0x43dc28[_0x834a('0x5b')]*_0x43dc28[_0x834a('0x1c3')]*_0x43dc28['predictiveIntervalMultiplicativeFactor']);if(_[_0x834a('0x3f')](_0x43dc28[_0x834a('0x29')])){if(!_[_0x834a('0x3f')](_0x43dc28[_0x834a('0x5f')])){_0x43dc28[_0x834a('0x5f')]=undefined;loggerPredictive[_0x834a('0x62')](_0x834a('0x1c4'),_0x834a('0x1c5'));}if(!_[_0x834a('0x3f')](_0x43dc28[_0x834a('0x60')])){loggerPredictive[_0x834a('0x62')]('[startMethodPredictive][StartProgressive]',_0x834a('0x1c6'));clearInterval(_0x43dc28['handlePredictive']);_0x43dc28[_0x834a('0x60')]=undefined;}_0x43dc28['startProgressive']=moment()[_0x834a('0x45')](_0x834a('0xbd'));loggerPredictive['info'](_0x43dc28['name'],'collection\x20data\x20in\x20progressive\x20at',_0x43dc28['startProgressive']);this[_0x834a('0xac')](_0x43dc28,0x1);}else if(ifInterval(_0x43dc28['dialPredictiveInterval'],_0x43dc28['startProgressive'])){this[_0x834a('0xac')](_0x43dc28,0x1);loggerPredictiveCalls['info'](_0x834a('0x1c7'),_0x43dc28[_0x834a('0x29')],_0x43dc28['name']);_0x43dc28['erlangCalls']=0x0;_0x43dc28['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x422511<_0x4e0cf9&&_0x43dc28['dialPredictiveOptimization']===_0x834a('0x1c8')){clearPredictiveAttributes(_0x43dc28);loggerPredictive['info'](_0x834a('0x1c9'),_0x834a('0x1ca'),_0x4e0cf9,_0x834a('0x29'),_0x43dc28[_0x834a('0x46')]);}else if(_0x10fc56<_0x43dc28[_0x834a('0xcb')]&&_0x43dc28[_0x834a('0x1cb')]===_0x834a('0x1c8')){clearPredictiveAttributes(_0x43dc28);loggerPredictive[_0x834a('0x48')](_0x834a('0x1cc'),_0x834a('0x1cd'),_0x10fc56,'Drop\x20in\x20this\x20interval',_0x43dc28[_0x834a('0xcb')],_0x834a('0x29'),_0x43dc28[_0x834a('0x46')]);}else if(!ifInterval(_0x43dc28[_0x834a('0x1ce')],_0x43dc28['startProgressive'])&&_[_0x834a('0x3f')](_0x43dc28[_0x834a('0x5f')])&&!_[_0x834a('0x3f')](_0x43dc28[_0x834a('0x29')])){_0x43dc28['startPredictive']=moment()['format'](_0x834a('0xbd'));loggerPredictive[_0x834a('0x48')](_0x43dc28[_0x834a('0x46')],_0x834a('0x1cf'),_0x43dc28['startPredictive']);hopperUtils['avgHandleTime'](_0x43dc28['dialPredictiveInterval'])[_0x834a('0x94')](this[_0x834a('0x1d0')](_0x43dc28))[_0x834a('0x94')](mergeDataErlangB(_0x43dc28))[_0x834a('0x94')](this[_0x834a('0x1d1')](_0x43dc28))[_0x834a('0xa0')](loggerCatchPredictive(_0x834a('0x1d2'),_0x43dc28));}else if(!ifInterval(_0x43dc28[_0x834a('0x1ce')],_0x43dc28[_0x834a('0x5f')])){_0x43dc28[_0x834a('0xcb')]=0x0;_0x43dc28[_0x834a('0x5f')]=moment()[_0x834a('0x45')](_0x834a('0xbd'));loggerPredictive[_0x834a('0x48')](_0x43dc28[_0x834a('0x46')],'recalculate\x20predictive\x20at',_0x43dc28[_0x834a('0x5f')]);clearInterval(_0x43dc28['handlePredictive']);_0x43dc28[_0x834a('0x60')]=undefined;hopperUtils[_0x834a('0x1d3')](_0x43dc28[_0x834a('0x1ce')])[_0x834a('0x94')](this['getDataPredictive'](_0x43dc28))[_0x834a('0x94')](mergeDataErlangB(_0x43dc28))[_0x834a('0x94')](this['startMethodPredictive'](_0x43dc28))[_0x834a('0xa0')](loggerCatchPredictive(_0x834a('0x1d4'),_0x43dc28));}else if(_0x43dc28[_0x834a('0x1c0')]&&_0x3caca8<_0x43dc28[_0x834a('0x1c0')]-_0x46938d){clearPredictiveAttributes(_0x43dc28);loggerPredictive['info'](_0x43dc28['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3caca8,')\x20are\x20less\x20than\x20threshold\x20(',_0x43dc28[_0x834a('0x1c0')],'-',_0x46938d,'=',_0x43dc28[_0x834a('0x1c0')]-_0x46938d,')');}else if(_0x43dc28[_0x834a('0x1c0')]&&_0x3caca8>_0x43dc28[_0x834a('0x1c0')]+_0x18669f){clearPredictiveAttributes(_0x43dc28);loggerPredictive[_0x834a('0x48')](_0x43dc28[_0x834a('0x46')],_0x834a('0x1d5'),_0x3caca8,')\x20are\x20more\x20than\x20threshold\x20(',_0x43dc28[_0x834a('0x1c0')],'+',_0x18669f,'=',_0x43dc28[_0x834a('0x1c0')]+_0x18669f,')');}};Dialer[_0x834a('0x1c')]['getDataPredictive']=function(_0x583201){var _0x3b205a=this;return function(_0x4c612d){return new Promise(function(_0x44f65d,_0x1e7cc8){_[_0x834a('0xf6')](_0x583201,_0x4c612d[0x0]);if(checkGetDataPredictive(_0x4c612d[0x0])){var _0x489c67=_0x583201['predictiveIntervalAvailable']=_0x583201[_0x834a('0x13c')]+_0x583201['available'];var _0x26fdf4=_0x583201['dialPredictiveInterval']*0x3c;var _0x2babfe=_0x4c612d[0x0][_0x834a('0x53')]+_0x4c612d[0x0][_0x834a('0x1d6')];var _0x495de5=(_0x4c612d[0x0][_0x834a('0x1d7')]+_0x4c612d[0x0][_0x834a('0xc9')]+_0x4c612d[0x0][_0x834a('0x4f')])/_0x4c612d[0x0][_0x834a('0x4b')];_0x583201['predictiveIntervalHitRate']=_0x495de5>0x0?_0x495de5:0x1;switch(_0x583201[_0x834a('0x1cb')]){case _0x834a('0x1c8'):var _0x1c2bca=_0x583201[_0x834a('0x1be')]/0x64;return _0x3b205a[_0x834a('0x1d8')](_0x489c67,_0x26fdf4,_0x2babfe,_0x495de5,_0x1c2bca)[_0x834a('0x94')](function(_0x1a4067){return _0x44f65d(_0x1a4067);});case'agentBusyFactor':var _0x3fb982=_0x583201[_0x834a('0x1be')]/0x64;return _0x3b205a[_0x834a('0x1d9')](_0x489c67,_0x26fdf4,_0x2babfe,_0x495de5,_0x3fb982)[_0x834a('0x94')](function(_0xb918d){return _0x44f65d(_0xb918d);});default:return _0x1e7cc8(msgResponse('[getDataPredictive]',_0x834a('0x8e'),_0x834a('0x1da')));}}else{return _0x1e7cc8(msgResponse(_0x834a('0x1db'),_0x834a('0x8e'),'check\x20failure'));}});};};Dialer[_0x834a('0x1c')][_0x834a('0x1dc')]=function(_0x4be2cd){var _0x4db9a7=this;return function(_0x298492){return new Promise(function(_0x469fc1,_0x5cd107){_['merge'](_0x4be2cd,_0x298492[0x0]);if(checkGetDataPredictive(_0x298492[0x0])){loggerPredictive[_0x834a('0x48')](JSON[_0x834a('0x71')](_0x298492[0x0]));if(_0x4be2cd[_0x834a('0x1cb')]===_0x834a('0x1c8')){return _0x4db9a7[_0x834a('0x152')](_0x4be2cd['id'])[_0x834a('0x94')](function(_0x1879c7){var _0x16910e=_0x4be2cd[_0x834a('0x1dd')]-_0x1879c7[0x0][_0x834a('0x1de')];var _0x4c107d=_0x4be2cd[_0x834a('0x1ce')]*0x3c;var _0x25d145=_0x298492[0x0][_0x834a('0x53')]+_0x298492[0x0][_0x834a('0x1d6')];var _0x5dbadf=(_0x298492[0x0][_0x834a('0x1d7')]+_0x298492[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x298492[0x0][_0x834a('0x4f')])/_0x298492[0x0][_0x834a('0x4b')];var _0x5d3616=_0x4be2cd[_0x834a('0x1be')]/0x64;_0x4be2cd[_0x834a('0x1df')]=_0x1879c7[0x0]['outboundQueuePauses']||0x0;_0x4be2cd[_0x834a('0x1c3')]=_0x5dbadf>0x0?_0x5dbadf:0x1;return _0x4db9a7[_0x834a('0x1d8')](_0x16910e,_0x4c107d,_0x25d145,_0x5dbadf,_0x5d3616);})[_0x834a('0x94')](function(_0x1b12fc){return _0x469fc1(_0x1b12fc);})['catch'](function(_0x2220b0){return _0x5cd107(msgResponse(_0x834a('0x1e0'),_0x834a('0x8e'),JSON[_0x834a('0x71')](_0x2220b0)));});}if(_0x4be2cd[_0x834a('0x1cb')]===_0x834a('0x1e1')){return _0x4db9a7[_0x834a('0x152')](_0x4be2cd['id'])[_0x834a('0x94')](function(_0x459f99){var _0x5e658d=_0x4be2cd['loggedIn']-_0x459f99[0x0]['outboundQueuePauses'];var _0x47cfb9=_0x4be2cd[_0x834a('0x1ce')]*0x3c;var _0x19645c=_0x298492[0x0][_0x834a('0x53')]+_0x298492[0x0][_0x834a('0x1d6')];var _0x333806=(_0x298492[0x0]['predictiveIntervalAnsweredCalls']+_0x298492[0x0][_0x834a('0xc9')]+_0x298492[0x0][_0x834a('0x4f')])/_0x298492[0x0][_0x834a('0x4b')];var _0x205118=_0x4be2cd[_0x834a('0x1be')]/0x64;_0x4be2cd['predictiveIntervalPauses']=_0x459f99[0x0][_0x834a('0x1de')]||0x0;_0x4be2cd[_0x834a('0x1c3')]=_0x333806>0x0?_0x333806:0x1;return _0x4db9a7[_0x834a('0x1d9')](_0x5e658d,_0x47cfb9,_0x19645c,_0x333806,_0x205118);})[_0x834a('0x94')](function(_0x3eb71c){return _0x469fc1(_0x3eb71c);})[_0x834a('0xa0')](function(_0x54f44b){return _0x5cd107(msgResponse(_0x834a('0x1e0'),_0x834a('0x8e'),JSON[_0x834a('0x71')](_0x54f44b)));});}}else{return _0x5cd107(msgResponse(_0x834a('0x1db'),_0x834a('0x8e'),'check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x306e81){var _0x5c805f=this;return function(){var _0x449ce2=0x0;var _0x2d69c7=Math[_0x834a('0x1e2')](_0x306e81[_0x834a('0x59')]*0x3e8);if(_0x2d69c7>0x0){_0x2d69c7=_0x2d69c7<0x64?0x64:_0x2d69c7;loggerPredictive['info'](_0x306e81[_0x834a('0x46')],'one\x20call\x20every:',_0x2d69c7,'milliseconds');_0x306e81['handlePredictive']=setInterval(function(){_0x5c805f[_0x834a('0x60')](_0x306e81);loggerPredictiveCalls['info'](_0x834a('0x1e3'),_0x449ce2+=0x1);},_0x2d69c7);}else{loggerPredictive[_0x834a('0x48')](_0x306e81[_0x834a('0x46')],_0x834a('0x1e4'));}};};Dialer[_0x834a('0x1c')][_0x834a('0x1e5')]=function(_0x55021f,_0x492d9c){var _0x5cbca0=this;return function(_0x438599){if(_[_0x834a('0xfc')](_0x438599)){if(_[_0x834a('0xf0')](_0x492d9c['UserId'])||!_0x492d9c[_0x834a('0x1e6')]){if(_0x55021f['dialMethod']===_0x834a('0x9')){_0x55021f[_0x834a('0x6e')]=_[_0x834a('0x3f')](_0x55021f['queueStatusComplete'])?!![]:_0x55021f['queueStatusComplete'];var _0x3f2723=uuid['v4']();_0x5cbca0[_0x834a('0xeb')][_0x3f2723]=new Action(_0x55021f,_0x492d9c,_0x3f2723);loggerBooked[_0x834a('0x48')](_0x834a('0x1e7'),_0x3f2723,_0x834a('0x1e8'),JSON[_0x834a('0x71')](_0x55021f['queueStatusComplete']),'Queue:\x20',_0x55021f['name']);if(_0x55021f[_0x834a('0x6e')]){_0x55021f[_0x834a('0x6e')]=![];_0x5cbca0[_0x834a('0xf4')][_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xb9')]]=[];ami[_0x834a('0x91')]({'actionid':_0x3f2723,'action':_0x834a('0x1e9'),'queue':_0x55021f[_0x834a('0x46')]})[_0x834a('0xa0')](function(){_0x5cbca0[_0x834a('0xc5')](_0x55021f);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xdb')],'ListId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xdc')],'VoiceQueueId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723]['VoiceQueueId']||undefined,'CampaignId':_0x5cbca0['actions'][_0x3f2723][_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x1ea')));delete _0x5cbca0[_0x834a('0xeb')][_0x3f2723];});}else{loggerBooked[_0x834a('0x48')](_0x834a('0x1eb'),JSON[_0x834a('0x71')](_0x55021f['queueStatusComplete']),'Queue:\x20',_0x55021f['name']);_0x5cbca0['updateOriginated'](_0x55021f);hopperUtils[_0x834a('0xd7')]({'active':![],'ContactId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xdb')],'ListId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xdc')],'VoiceQueueId':_0x5cbca0['actions'][_0x3f2723][_0x834a('0xe7')]||undefined,'CampaignId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x1ea')));delete _0x5cbca0[_0x834a('0xeb')][_0x3f2723];}}else{return _0x5cbca0['actionOriginate'](_0x55021f,_0x492d9c);}}else{if(utils[_0x834a('0x5d')](undefined,_0x492d9c[_0x834a('0x1ec')])<_0x55021f[_0x834a('0x1ed')]*0x3c){if(_0x492d9c['Agent']&&!_0x492d9c[_0x834a('0x14b')]['voicePause']){_0x5cbca0[_0x834a('0xf9')][_0x834a('0xfa')](_0x492d9c['id'])['finally'](function(){_0x5cbca0['updateOriginated'](_0x55021f);});}else{hopperUtils[_0x834a('0x1ee')]({'active':![]},_0x492d9c['id'],0x1)['finally'](function(){_0x5cbca0[_0x834a('0xc5')](_0x55021f);});}}else{_0x55021f[_0x834a('0x1ef')]+=0x1;_0x5cbca0[_0x834a('0xc5')](_0x55021f);if(_0x55021f[_0x834a('0x1f0')]){hopperUtils[_0x834a('0xd7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x492d9c[_0x834a('0xdb')],'ListId':_0x492d9c['ListId'],'VoiceQueueId':_0x492d9c[_0x834a('0xe7')]||undefined,'CampaignId':_0x492d9c[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x1f1')));hopperUtils[_0x834a('0xdf')](createObjHistory(_0x55021f,_0x492d9c,utils[_0x834a('0x67')][_0x834a('0x1f2')],0x17,'RecallInQueue'))[_0x834a('0xa0')](loggerCatch(_0x834a('0x1f3')));}else{_0x5cbca0[_0x834a('0x117')](createObjHistory(_0x55021f,_0x492d9c,utils[_0x834a('0x67')][_0x834a('0x1f4')],0x16,_0x834a('0x1f5')),_0x834a('0x1f6'),_0x834a('0x1f7'));}}}}else{_0x55021f[_0x834a('0x1f8')]+=0x1;_0x5cbca0[_0x834a('0x117')](createObjHistory(_0x55021f,_0x492d9c,utils[_0x834a('0x67')][_0x834a('0x1f9')],0xd,_0x834a('0x1fa')),_0x834a('0x1fb'),_0x834a('0x1fc'));throw _0x834a('0x1fd');}};};Dialer['prototype'][_0x834a('0x15d')]=function(_0x3abd70){var _0x8eb27e=this;var _0x4ee5a9=_0x3abd70[_0x834a('0x1fe')]-_0x3abd70[_0x834a('0x154')];emitCampaignSummary(_0x3abd70);if(_0x4ee5a9>0x0&&_0x3abd70[_0x834a('0x64')]==0x0){if(_0x4ee5a9>this[_0x834a('0x25')]){_0x4ee5a9=this[_0x834a('0x25')];}_0x3abd70[_0x834a('0x64')]=0x1;hopperUtils[_0x834a('0x1ff')](_0x3abd70,_0x4ee5a9)[_0x834a('0x94')](function(_0x405c83){_0x3abd70[_0x834a('0x64')]=0x0;if(_0x405c83){if(!utils['checkContactEmpty'](_0x405c83)){_0x3abd70['message']=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactCampaign2][Empty]'+_0x3abd70[_0x834a('0x46')]);}else{_0x3abd70[_0x834a('0x154')]+=_0x405c83['length'];_0x3abd70['message']=utils[_0x834a('0x67')]['RUNNING'];for(var _0x27fd11=0x0;_0x27fd11<_0x405c83[_0x834a('0x149')];_0x27fd11+=0x1){_0x3abd70[_0x834a('0x200')]+=0x1;if(_[_0x834a('0xf0')](_0x405c83[_0x27fd11])||_['isNil'](_0x405c83[_0x27fd11][_0x834a('0x177')])||_[_0x834a('0xf0')](_0x405c83[_0x27fd11][_0x834a('0x160')])){_0x8eb27e[_0x834a('0x156')](_0x834a('0x201'),_0x3abd70,_0x405c83[_0x27fd11]);}else{hopperUtils[_0x834a('0x202')](_[_0x834a('0x100')](_0x405c83[_0x27fd11],[_0x834a('0xe8'),_0x834a('0x160')]))[_0x834a('0x94')](_0x8eb27e[_0x834a('0x1e5')](_0x3abd70,_0x405c83[_0x27fd11]))[_0x834a('0xa0')](_0x8eb27e['loggerHandler'](_0x834a('0x203'),_0x3abd70));}}}}})[_0x834a('0xa0')](loggerGetContactDialer('[getContactCampaign2]',_0x3abd70,_0x4ee5a9));}};Dialer['prototype'][_0x834a('0xac')]=function(_0x3c9236,_0x390ed3){var _0x20bf92=this;var _0x463ed0=[];if(_0x390ed3<0x1||_0x3c9236[_0x834a('0xa9')]===_0x834a('0x9')){_0x390ed3=0x1;}var _0x54e351=Math[_0x834a('0x1e2')](_0x3c9236[_0x834a('0x13b')]*_0x390ed3)-_0x3c9236[_0x834a('0x154')];if(_0x3c9236['dialLimitQueue']>0x0){var _0x795ab4=_0x3c9236[_0x834a('0x204')]-_0x3c9236[_0x834a('0x154')]-_0x3c9236['talking']-_0x3c9236[_0x834a('0x13d')];if(_0x54e351>_0x795ab4){_0x54e351=_0x795ab4;}}if(_0x54e351>0x0&&_0x3c9236[_0x834a('0x64')]==0x0){if(_0x3c9236['dialMethod']===_0x834a('0x9')){_0x54e351=0x1;}if(_0x54e351>this['maxNumberOriginate']){_0x54e351=this[_0x834a('0x25')];}for(var _0x381c85 in this[_0x834a('0x23')]){if(typeof this['agents'][_0x381c85]!=='undefined'){if(this[_0x834a('0x23')][_0x381c85][_0x834a('0x6b')]===_0x834a('0x205')&&this[_0x834a('0x23')][_0x381c85]['status']===_0x834a('0x206')){_0x463ed0['push'](this['agents'][_0x381c85]['id']);}}}_0x3c9236[_0x834a('0x64')]=0x1;hopperUtils[_0x834a('0x207')](_0x3c9236,_0x463ed0,_0x54e351)[_0x834a('0x94')](function(_0x1ae865){_0x3c9236[_0x834a('0x64')]=0x0;if(_0x1ae865){if(!utils['checkContactEmpty'](_0x1ae865)){hopperUtils[_0x834a('0x208')](_0x3c9236)[_0x834a('0x94')](sendMessageReschedule(_0x3c9236))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3c9236['originated']+=_0x1ae865['length'];_0x3c9236[_0x834a('0x66')]=_0x3c9236['dialMethod']==='booked'?utils[_0x834a('0x67')][_0x834a('0x13e')]:utils['CAMPAIGN_STATUS'][_0x834a('0x209')];for(var _0xed6e46=0x0;_0xed6e46<_0x1ae865['length'];_0xed6e46+=0x1){if(_['isNil'](_0x1ae865[_0xed6e46])||_[_0x834a('0xf0')](_0x1ae865[_0xed6e46][_0x834a('0x177')])||_['isNil'](_0x1ae865[_0xed6e46][_0x834a('0x160')])){_0x20bf92['emptyContact'](_0x834a('0x201'),_0x3c9236,_0x1ae865[_0xed6e46]);}else{hopperUtils[_0x834a('0x20a')](_['pick'](_0x1ae865[_0xed6e46],['VoiceQueueId',_0x834a('0x160')]))[_0x834a('0x94')](_0x20bf92[_0x834a('0x1e5')](_0x3c9236,_0x1ae865[_0xed6e46]))[_0x834a('0xa0')](_0x20bf92[_0x834a('0x20b')](_0x834a('0x201'),_0x3c9236));}}}}})[_0x834a('0xa0')](loggerGetContactDialer(_0x834a('0x20c'),_0x3c9236,_0x54e351));}};Dialer[_0x834a('0x1c')][_0x834a('0x60')]=function(_0x358d83){if(_0x358d83[_0x834a('0x204')]>0x0){var _0x4cf8b2=_0x358d83[_0x834a('0x204')]-_0x358d83[_0x834a('0x154')]-_0x358d83[_0x834a('0x13c')];if(_0x4cf8b2>0x0&&_0x358d83[_0x834a('0x64')]==0x0){this['tryOriginatePredictive'](_0x358d83);}else{loggerPredictiveCalls[_0x834a('0x48')](_0x834a('0x20d'));}}else{this[_0x834a('0x20e')](_0x358d83);}};Dialer[_0x834a('0x1c')]['tryOriginatePredictive']=function(_0x30fcfb){var _0x544285=this;var _0x8596d0=[];_0x30fcfb[_0x834a('0x154')]+=0x1;for(var _0xc309ee in this[_0x834a('0x23')]){if(typeof this[_0x834a('0x23')][_0xc309ee]!==_0x834a('0xa2')){if(this[_0x834a('0x23')][_0xc309ee][_0x834a('0x6b')]===_0x834a('0x205')&&this['agents'][_0xc309ee][_0x834a('0x82')]==='reachable'){_0x8596d0[_0x834a('0xf5')](this['agents'][_0xc309ee]['id']);}}}_0x30fcfb[_0x834a('0x64')]=0x1;return this['getContactDialer'](_0x30fcfb['id'],_0x8596d0,0x1,_0x30fcfb[_0x834a('0x20f')],_0x30fcfb)[_0x834a('0x94')](function(_0x5270ce){_0x30fcfb[_0x834a('0x64')]=0x1;if(_0x5270ce){if(!utils[_0x834a('0x210')](_0x5270ce)){utils[_0x834a('0x211')](_0x30fcfb,0x1,0x0);return hopperUtils[_0x834a('0x208')](_0x30fcfb)[_0x834a('0x94')](sendMessageReschedule(_0x30fcfb))[_0x834a('0xa0')](loggerCatch(_0x834a('0x212')));}else{_0x30fcfb[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x209')];if(_[_0x834a('0xf0')](_0x5270ce[0x0])||_[_0x834a('0xf0')](_0x5270ce[0x0][_0x834a('0x177')])||_[_0x834a('0xf0')](_0x5270ce[0x0]['phone'])){_0x544285[_0x834a('0x156')](_0x834a('0x201'),_0x30fcfb,_0x5270ce[0x0]);}else{return hopperUtils[_0x834a('0x20a')](_[_0x834a('0x100')](_0x5270ce[0x0],[_0x834a('0xe7'),_0x834a('0x160')]))[_0x834a('0x94')](_0x544285['checkContactBlack'](_0x30fcfb,_0x5270ce[0x0]))[_0x834a('0xa0')](_0x544285[_0x834a('0x20b')](_0x834a('0x213'),_0x30fcfb));}}}})[_0x834a('0xa0')](loggerGetContactDialer(_0x834a('0x214'),_0x30fcfb,0x1));};Dialer[_0x834a('0x1c')]['abandonmentRate']=function(_0x5073f2,_0x591feb,_0x55fc26,_0x749234,_0x27f6cd,_0x342aa1){loggerPredictive[_0x834a('0x48')](_0x834a('0x215'));loggerPredictive[_0x834a('0x48')](_0x834a('0x216'),_0x5073f2);loggerPredictive[_0x834a('0x48')](_0x834a('0x217'),_0x591feb);loggerPredictive[_0x834a('0x48')](_0x834a('0x218'),_0x55fc26);loggerPredictive['info'](_0x834a('0x219'),_0x749234);loggerPredictive['info'](_0x834a('0x21a'),_0x27f6cd);loggerPredictive[_0x834a('0x48')]('---------------------------');return new Promise(function(_0x5c58be,_0x1afd00){if(_0x5073f2<=0x0||isNaN(_0x5073f2)){return _0x1afd00(msgResponse('[abandonmentRate]','Error',_0x834a('0x21b')+_0x5073f2));}if(_0x55fc26<=0x0||isNaN(_0x55fc26)){return _0x1afd00(msgResponse(_0x834a('0x21c'),'Error',_0x834a('0x21d')+_0x55fc26));}if(_0x749234<=0x0||isNaN(_0x749234)){return _0x1afd00(msgResponse('[abandonmentRate]',_0x834a('0xb8'),_0x834a('0x21e')+_0x749234));}if(_0x591feb<=0x0||isNaN(_0x591feb)){return _0x1afd00(msgResponse(_0x834a('0x21c'),_0x834a('0xb8'),'interval\x20=\x20'+_0x591feb));}if(_0x27f6cd<=0x0||isNaN(_0x27f6cd)){return _0x1afd00(msgResponse(_0x834a('0x21c'),_0x834a('0xb8'),_0x834a('0x21f')+_0x27f6cd));}_0x342aa1=_0x342aa1||0x0;var _0x3dc671=0x1/_0x55fc26;var _0x6c8de7=0x0;var _0x2d2972=0x0;var _0x225aae=0x0;var _0x32f369=0x0;for(var _0x98a24d=0x0;_0x225aae<_0x27f6cd;_0x98a24d+=0x1){_0x2d2972=_0x98a24d/_0x591feb;_0x6c8de7=(_0x749234*_0x2d2972+_0x342aa1)/_0x3dc671;_0x225aae=utils[_0x834a('0x220')](_0x6c8de7,_0x5073f2);_0x32f369=_0x6c8de7/_0x5073f2*(0x1-utils[_0x834a('0x220')](_0x6c8de7,_0x5073f2));}return _0x5c58be({'erlangCalls':_0x98a24d,'erlangCallToSecond':_0x591feb/_0x98a24d,'erlangAbandonmentRate':_0x225aae,'erlangBusyFactor':_0x32f369});});};Dialer['prototype'][_0x834a('0x1d9')]=function(_0x40abf6,_0x53e564,_0xa24be1,_0x17470d,_0x54cc6a,_0x308f9e){loggerPredictive[_0x834a('0x48')](_0x834a('0x221'));loggerPredictive['info'](_0x834a('0x216'),_0x40abf6);loggerPredictive[_0x834a('0x48')](_0x834a('0x217'),_0x53e564);loggerPredictive[_0x834a('0x48')](_0x834a('0x218'),_0xa24be1);loggerPredictive[_0x834a('0x48')](_0x834a('0x219'),_0x17470d);loggerPredictive[_0x834a('0x48')](_0x834a('0x222'),_0x54cc6a);loggerPredictive[_0x834a('0x48')](_0x834a('0x52'));return new Promise(function(_0x24279c,_0x1d7e2e){if(_0x40abf6<=0x0||isNaN(_0x40abf6)){return _0x1d7e2e(msgResponse(_0x834a('0x223'),_0x834a('0xb8'),'m\x20=\x20'+_0x40abf6));}if(_0xa24be1<=0x0||isNaN(_0xa24be1)){return _0x1d7e2e(msgResponse(_0x834a('0x223'),'Error',_0x834a('0x21d')+_0xa24be1));}if(_0x17470d<=0x0||isNaN(_0x17470d)){return _0x1d7e2e(msgResponse('[busyFactor]','Error',_0x834a('0x21e')+_0x17470d));}if(_0x53e564<=0x0||isNaN(_0x53e564)){return _0x1d7e2e(msgResponse(_0x834a('0x223'),_0x834a('0xb8'),_0x834a('0x224')+_0x53e564));}if(_0x54cc6a<=0x0||isNaN(_0x54cc6a)){return _0x1d7e2e(msgResponse(_0x834a('0x223'),_0x834a('0xb8'),'Umin\x20=\x20'+_0x54cc6a));}_0x308f9e=_0x308f9e||0x0;var _0x2b25e4=0x1/_0xa24be1;var _0x2693a5=0x0;var _0x3f84b9=0x0;var _0x5c3ef1=0x0;var _0x265d4e=0x0;for(var _0x1f2061=0x0;_0x265d4e<_0x54cc6a;_0x1f2061+=0x1){_0x3f84b9=_0x1f2061/_0x53e564;_0x2693a5=(_0x17470d*_0x3f84b9+_0x308f9e)/_0x2b25e4;_0x5c3ef1=utils[_0x834a('0x220')](_0x2693a5,_0x40abf6);_0x265d4e=_0x2693a5/_0x40abf6*(0x1-utils[_0x834a('0x220')](_0x2693a5,_0x40abf6));}return _0x24279c({'erlangCalls':_0x1f2061,'erlangCallToSecond':_0x53e564/_0x1f2061,'erlangAbandonmentRate':_0x5c3ef1,'erlangBusyFactor':_0x265d4e});});};module[_0x834a('0x225')]=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 625b448..d36427b 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 _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 +var _0x2b75=['idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x55e059,_0x2df2c5){var _0x1e6bb7=function(_0x15799b){while(--_0x15799b){_0x55e059['push'](_0x55e059['shift']());}};_0x1e6bb7(++_0x2df2c5);}(_0x2b75,0x180));var _0x52b7=function(_0xb14bf0,_0x53485e){_0xb14bf0=_0xb14bf0-0x0;var _0x4743ed=_0x2b75[_0xb14bf0];return _0x4743ed;};'use strict';var util=require(_0x52b7('0x0'));var _=require(_0x52b7('0x1'));var moment=require(_0x52b7('0x2'));function checkNameSurname(_0x980110,_0x543198,_0x1aef21){var _0x156118='';if(!_[_0x52b7('0x3')](_0x543198)&&_0x52b7('0x4')===typeof _0x543198){_0x156118+=_0x543198;}if(!_['isNil'](_0x1aef21)&&_0x52b7('0x4')===typeof _0x1aef21){_0x156118+='\x20'+_0x1aef21;}if(_0x156118!==''){return _0x156118;}return _0x980110;}function Action(_0xe61f7b,_0x287be1,_0xf2a33){this[_0x52b7('0x5')]=_0xe61f7b;this[_0x52b7('0x6')]=_0xf2a33||undefined;this[_0x52b7('0x7')]=checkNameSurname(_0x287be1[_0x52b7('0x8')][_0x52b7('0x9')],_0x287be1[_0x52b7('0x8')][_0x52b7('0xa')],_0x287be1['Contact']['lastName']);this[_0x52b7('0xb')]=_0x287be1[_0x52b7('0x9')];this[_0x52b7('0xc')]=_0xe61f7b[_0x52b7('0x7')];this[_0x52b7('0xd')]=_0x287be1['active']||![];this['type']=_0xe61f7b[_0x52b7('0xe')];this[_0x52b7('0xf')]=_0xe61f7b[_0x52b7('0xf')]||0x3;this[_0x52b7('0x10')]=_0x287be1[_0x52b7('0x10')];this[_0x52b7('0x11')]=_0x287be1[_0x52b7('0x11')];this[_0x52b7('0x12')]=_0x287be1[_0x52b7('0x12')];this[_0x52b7('0x13')]=_0x287be1['countnoanswerretry'];this['countnosuchnumberretry']=_0x287be1[_0x52b7('0x14')];this[_0x52b7('0x15')]=_0x287be1[_0x52b7('0x15')];this[_0x52b7('0x16')]=_0x287be1[_0x52b7('0x16')];this['countmachineretry']=_0x287be1[_0x52b7('0x17')];this['countagentrejectretry']=_0x287be1[_0x52b7('0x18')];this[_0x52b7('0x19')]=_0x287be1[_0x52b7('0x19')];this[_0x52b7('0x1a')]=_0x287be1[_0x52b7('0x1a')];this['UserId']=_0x287be1[_0x52b7('0x1b')];this[_0x52b7('0x1c')]=_0x287be1[_0x52b7('0x1c')];this[_0x52b7('0x1d')]=_0x287be1[_0x52b7('0x1d')];this[_0x52b7('0x1e')]=_0x287be1['id'];this[_0x52b7('0x1f')]=_0x287be1['Contact'][_0x52b7('0xa')]||'';this[_0x52b7('0x20')]=moment()[_0x52b7('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x52b7('0x22')]=_0x287be1['callback'];this[_0x52b7('0x23')]=_0x287be1[_0x52b7('0x23')];this[_0x52b7('0x24')]=_0x287be1['callbackat'];this[_0x52b7('0x25')]=_0x287be1['recallme'];this['originatecalleridnum']='';this[_0x52b7('0x26')]='';}Action[_0x52b7('0x27')][_0x52b7('0x28')]=function(){return util[_0x52b7('0x21')](_0x52b7('0x29'),this['name'],this['voiceQueue'][_0x52b7('0x2a')]>0x0?this[_0x52b7('0xb')][_0x52b7('0x2b')](this['voiceQueue'][_0x52b7('0x2a')]):this['number']);};Action['prototype'][_0x52b7('0x2c')]=function(){return this['queue'];};module[_0x52b7('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 1145c1f..8fb0af7 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 _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 +var _0xb968=['starttime','responsetime','answertime','endtime','format','ringtime','getSeconds','holdtime','talktime','queue','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','statedesc','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb968,0xe9));var _0x8b96=function(_0x1bda86,_0xa19e1){_0x1bda86=_0x1bda86-0x0;var _0x1abc6b=_0xb968[_0x1bda86];return _0x1abc6b;};'use strict';var moment=require(_0x8b96('0x0'));var utils=require('../utils');function AgentComplete(_0x10a9d0,_0x3d40ec){this['state']=0x4;this[_0x8b96('0x1')]='Answer';this[_0x8b96('0x2')]=_0x10a9d0['scheduledat'];this[_0x8b96('0x3')]=_0x10a9d0[_0x8b96('0x3')];this[_0x8b96('0x4')]=_0x10a9d0[_0x8b96('0x3')]==='outbound'?'queue':_0x10a9d0[_0x8b96('0x3')];this[_0x8b96('0x5')]=_0x10a9d0['countbusyretry'];this['countcongestionretry']=_0x10a9d0[_0x8b96('0x6')];this['countnoanswerretry']=_0x10a9d0['countnoanswerretry'];this[_0x8b96('0x7')]=_0x10a9d0['countbusyretry']+_0x10a9d0[_0x8b96('0x6')]+_0x10a9d0[_0x8b96('0x8')]+_0x10a9d0['countnosuchnumberretry']+_0x10a9d0[_0x8b96('0x9')]+_0x10a9d0[_0x8b96('0xa')]+_0x10a9d0[_0x8b96('0xb')]+_0x10a9d0['countagentrejectretry'];this[_0x8b96('0xc')]=_0x10a9d0[_0x8b96('0xc')];this['countdropretry']=_0x10a9d0['countdropretry'];this[_0x8b96('0xa')]=_0x10a9d0[_0x8b96('0xa')];this[_0x8b96('0xb')]=_0x10a9d0['countmachineretry'];this[_0x8b96('0xd')]=_0x10a9d0[_0x8b96('0xd')];this['uniqueid']=_0x3d40ec[_0x8b96('0xe')];this[_0x8b96('0xf')]=_0x10a9d0[_0x8b96('0x10')];this[_0x8b96('0x11')]=_0x10a9d0[_0x8b96('0x12')];this[_0x8b96('0x13')]=_0x10a9d0['starttime'];this[_0x8b96('0x14')]=_0x10a9d0['responsetime'];this[_0x8b96('0x15')]=_0x10a9d0[_0x8b96('0x15')];this[_0x8b96('0x16')]=moment()[_0x8b96('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8b96('0x18')]=utils[_0x8b96('0x19')](_0x10a9d0[_0x8b96('0x14')],_0x10a9d0[_0x8b96('0x13')]);this[_0x8b96('0x1a')]=utils[_0x8b96('0x19')](_0x10a9d0['answertime'],_0x10a9d0[_0x8b96('0x14')]);this[_0x8b96('0x1b')]=utils[_0x8b96('0x19')](this[_0x8b96('0x16')],_0x10a9d0['answertime']);this[_0x8b96('0x1c')]=_0x3d40ec[_0x8b96('0x1c')];this['membername']=_0x3d40ec['membername'];this[_0x8b96('0x1d')]=_0x3d40ec['reason'];this[_0x8b96('0x1e')]=_0x10a9d0[_0x8b96('0x1e')];this[_0x8b96('0x1f')]=_0x10a9d0[_0x8b96('0x1f')];this[_0x8b96('0x20')]=_0x10a9d0[_0x8b96('0x20')];this[_0x8b96('0x21')]=_0x10a9d0[_0x8b96('0x21')];this['ContactId']=_0x10a9d0['ContactId'];this[_0x8b96('0x22')]=_0x10a9d0['ListId'];this[_0x8b96('0x23')]=_0x10a9d0[_0x8b96('0x23')];this[_0x8b96('0x24')]=_0x10a9d0[_0x8b96('0x24')];this['CampaignId']=_0x10a9d0[_0x8b96('0x25')];this[_0x8b96('0x26')]=_0x10a9d0['originatecalleridnum']||'';this[_0x8b96('0x27')]=_0x10a9d0[_0x8b96('0x27')]||'';this['agiafterat']=_0x10a9d0[_0x8b96('0x28')];}module[_0x8b96('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 4633074..a8fb9c3 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 _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 +var _0xc6b3=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countnoanswerretry','countglobal','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime'];(function(_0x4cf555,_0x37dddd){var _0x216497=function(_0x3af113){while(--_0x3af113){_0x4cf555['push'](_0x4cf555['shift']());}};_0x216497(++_0x37dddd);}(_0xc6b3,0x113));var _0x3c6b=function(_0x5c2bef,_0x16806e){_0x5c2bef=_0x5c2bef-0x0;var _0xd60cc1=_0xc6b3[_0x5c2bef];return _0xd60cc1;};'use strict';function Final(_0x366a31){this[_0x3c6b('0x0')]=_0x366a31['uniqueid'];this[_0x3c6b('0x1')]=_0x366a31['scheduledat'];this['type']=_0x366a31[_0x3c6b('0x2')];this[_0x3c6b('0x3')]=_0x366a31['type']===_0x3c6b('0x4')?'queue':_0x366a31[_0x3c6b('0x2')];this['countbusyretry']=_0x366a31['countbusyretry'];this['countcongestionretry']=_0x366a31['countcongestionretry'];this[_0x3c6b('0x5')]=_0x366a31[_0x3c6b('0x5')];this[_0x3c6b('0x6')]=_0x366a31[_0x3c6b('0x7')]+_0x366a31[_0x3c6b('0x8')]+_0x366a31[_0x3c6b('0x5')]+_0x366a31['countnosuchnumberretry']+_0x366a31[_0x3c6b('0x9')]+_0x366a31[_0x3c6b('0xa')]+_0x366a31[_0x3c6b('0xb')]+_0x366a31[_0x3c6b('0xc')];this['countnosuchnumberretry']=_0x366a31[_0x3c6b('0xd')];this['countdropretry']=_0x366a31[_0x3c6b('0x9')];this['countabandonedretry']=_0x366a31[_0x3c6b('0xa')];this['countmachineretry']=_0x366a31[_0x3c6b('0xb')];this[_0x3c6b('0xc')]=_0x366a31[_0x3c6b('0xc')];this[_0x3c6b('0xe')]=_0x366a31[_0x3c6b('0xe')];this[_0x3c6b('0xf')]=_0x366a31[_0x3c6b('0xf')];this[_0x3c6b('0x10')]=_0x366a31['calleridnum'];this[_0x3c6b('0x11')]=_0x366a31[_0x3c6b('0x11')];this[_0x3c6b('0x12')]=_0x366a31[_0x3c6b('0x12')];this[_0x3c6b('0x13')]=_0x366a31[_0x3c6b('0x12')];this[_0x3c6b('0x14')]=_0x366a31[_0x3c6b('0x14')]||0x0;this[_0x3c6b('0x15')]=_0x366a31['holdtime']||0x0;this[_0x3c6b('0x16')]=_0x366a31['talktime']||0x0;this[_0x3c6b('0x17')]=_0x366a31[_0x3c6b('0x17')];this[_0x3c6b('0x18')]=_0x366a31['callbackuniqueid'];this[_0x3c6b('0x19')]=_0x366a31[_0x3c6b('0x19')];this['recallme']=_0x366a31[_0x3c6b('0x1a')];this[_0x3c6b('0x1b')]=_0x366a31['ContactId'];this['ListId']=_0x366a31[_0x3c6b('0x1c')];this['UserId']=_0x366a31[_0x3c6b('0x1d')];this[_0x3c6b('0x1e')]=_0x366a31[_0x3c6b('0x1e')];this[_0x3c6b('0x1f')]=_0x366a31[_0x3c6b('0x1f')];this['originatecalleridnum']=_0x366a31[_0x3c6b('0x20')]||'';this[_0x3c6b('0x21')]=_0x366a31[_0x3c6b('0x21')]||'';this[_0x3c6b('0x22')]=_0x366a31[_0x3c6b('0x22')];this[_0x3c6b('0x23')]=_0x366a31[_0x3c6b('0x23')];}module[_0x3c6b('0x24')]=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 a6ab0ca..ca07a2a 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 _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 +var _0x62f8=['getSeconds','talktime','endtime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x2fef92,_0x153cf8){var _0x47749f=function(_0x474282){while(--_0x474282){_0x2fef92['push'](_0x2fef92['shift']());}};_0x47749f(++_0x153cf8);}(_0x62f8,0xab));var _0x862f=function(_0x23a9ab,_0xaf9122){_0x23a9ab=_0x23a9ab-0x0;var _0x16d76c=_0x62f8[_0x23a9ab];return _0x16d76c;};'use strict';var moment=require(_0x862f('0x0'));var utils=require('../utils');function Hangup(_0x3171f9,_0x37231a){this['state']=0x4;this[_0x862f('0x1')]=_0x862f('0x2');this['scheduledat']=_0x3171f9[_0x862f('0x3')];this[_0x862f('0x4')]=_0x3171f9[_0x862f('0x4')];this[_0x862f('0x5')]=_0x3171f9[_0x862f('0x4')]===_0x862f('0x6')?_0x862f('0x7'):_0x3171f9[_0x862f('0x4')];this[_0x862f('0x8')]=_0x3171f9[_0x862f('0x8')]||![];this['countbusyretry']=_0x3171f9[_0x862f('0x9')];this[_0x862f('0xa')]=_0x3171f9[_0x862f('0xa')];this[_0x862f('0xb')]=_0x3171f9[_0x862f('0xb')];this[_0x862f('0xc')]=_0x3171f9[_0x862f('0x9')]+_0x3171f9['countcongestionretry']+_0x3171f9[_0x862f('0xb')]+_0x3171f9[_0x862f('0xd')]+_0x3171f9[_0x862f('0xe')]+_0x3171f9[_0x862f('0xf')]+_0x3171f9[_0x862f('0x10')]+_0x3171f9[_0x862f('0x11')];this[_0x862f('0xd')]=_0x3171f9[_0x862f('0xd')];this['countdropretry']=_0x3171f9[_0x862f('0xe')];this[_0x862f('0xf')]=_0x3171f9[_0x862f('0xf')];this[_0x862f('0x10')]=_0x3171f9[_0x862f('0x10')];this[_0x862f('0x11')]=_0x3171f9[_0x862f('0x11')];this[_0x862f('0x12')]=_0x37231a[_0x862f('0x12')];this[_0x862f('0x13')]=_0x3171f9['name'];this['calleridnum']=_0x3171f9['number'];this[_0x862f('0x14')]=_0x3171f9[_0x862f('0x14')];this[_0x862f('0x15')]=_0x3171f9[_0x862f('0x15')];this['endtime']=moment()['format'](_0x862f('0x16'));this[_0x862f('0x17')]=utils[_0x862f('0x18')](_0x3171f9[_0x862f('0x15')],_0x3171f9[_0x862f('0x14')]);this['holdtime']=0x0;this[_0x862f('0x19')]=utils[_0x862f('0x18')](this[_0x862f('0x1a')],_0x3171f9[_0x862f('0x15')]);this[_0x862f('0x7')]=_0x3171f9[_0x862f('0x7')];this['membername']=_0x862f('0x1b');this[_0x862f('0x1c')]=_0x37231a[_0x862f('0x1d')];this[_0x862f('0x1e')]=_0x3171f9[_0x862f('0x1e')];this[_0x862f('0x1f')]=_0x3171f9['callbackuniqueid'];this[_0x862f('0x20')]=_0x3171f9[_0x862f('0x20')];this[_0x862f('0x21')]=_0x3171f9[_0x862f('0x21')];this[_0x862f('0x22')]=_0x3171f9[_0x862f('0x22')];this[_0x862f('0x23')]=_0x3171f9[_0x862f('0x23')];this[_0x862f('0x24')]=_0x3171f9['UserId'];this[_0x862f('0x25')]=_0x3171f9['VoiceQueueId'];this[_0x862f('0x26')]=_0x3171f9[_0x862f('0x26')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 346f36e..a999907 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 _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 +var _0xae3d=['countmachineretry','countagentrejectretry','calleridname','number','starttime','responsetime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countnosuchnumberretry'];(function(_0x2bf8fe,_0x657518){var _0x456632=function(_0x162ff6){while(--_0x162ff6){_0x2bf8fe['push'](_0x2bf8fe['shift']());}};_0x456632(++_0x657518);}(_0xae3d,0x1d0));var _0xdae3=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xae3d[_0x35da42];return _0x370035;};'use strict';var utils=require('../utils');function History(_0x539418){this['uniqueid']=_0x539418[_0xdae3('0x0')];this[_0xdae3('0x1')]=_0x539418[_0xdae3('0x1')]||undefined;this[_0xdae3('0x2')]=_0x539418[_0xdae3('0x2')];this[_0xdae3('0x3')]=_0x539418[_0xdae3('0x2')]==='outbound'?_0xdae3('0x4'):_0x539418['type'];this[_0xdae3('0x5')]=_0x539418[_0xdae3('0x5')];this[_0xdae3('0x6')]=_0x539418[_0xdae3('0x6')];this['countnoanswerretry']=_0x539418['countnoanswerretry'];this[_0xdae3('0x7')]=_0x539418[_0xdae3('0x5')]+_0x539418[_0xdae3('0x6')]+_0x539418[_0xdae3('0x8')]+_0x539418['countnosuchnumberretry']+_0x539418[_0xdae3('0x9')]+_0x539418[_0xdae3('0xa')]+_0x539418['countmachineretry']+_0x539418['countagentrejectretry'];this[_0xdae3('0xb')]=_0x539418['countnosuchnumberretry'];this['countdropretry']=_0x539418[_0xdae3('0x9')];this[_0xdae3('0xa')]=_0x539418['countabandonedretry'];this[_0xdae3('0xc')]=_0x539418[_0xdae3('0xc')];this[_0xdae3('0xd')]=_0x539418[_0xdae3('0xd')];this[_0xdae3('0x4')]=_0x539418[_0xdae3('0x4')];this[_0xdae3('0xe')]=_0x539418['name'];this['calleridnum']=_0x539418[_0xdae3('0xf')];this[_0xdae3('0x10')]=_0x539418[_0xdae3('0x10')];this['responsetime']=_0x539418[_0xdae3('0x11')];this['endtime']=_0x539418[_0xdae3('0x11')];this['ringtime']=utils[_0xdae3('0x12')](_0x539418[_0xdae3('0x11')],_0x539418[_0xdae3('0x10')]);this[_0xdae3('0x13')]=0x0;this[_0xdae3('0x14')]=0x0;this[_0xdae3('0x15')]=_0x539418['callback'];this[_0xdae3('0x16')]=_0x539418[_0xdae3('0x16')];this[_0xdae3('0x17')]=_0x539418[_0xdae3('0x17')];this[_0xdae3('0x18')]=_0x539418[_0xdae3('0x18')];this[_0xdae3('0x19')]=_0x539418[_0xdae3('0x19')];this[_0xdae3('0x1a')]=_0x539418[_0xdae3('0x1a')];this[_0xdae3('0x1b')]=_0x539418[_0xdae3('0x1b')];this[_0xdae3('0x1c')]=_0x539418[_0xdae3('0x1c')];this['CampaignId']=_0x539418['CampaignId'];this[_0xdae3('0x1d')]=_0x539418[_0xdae3('0x1d')]||'';this[_0xdae3('0x1e')]=_0x539418[_0xdae3('0x1e')]||'';this[_0xdae3('0x1f')]=_0x539418[_0xdae3('0x1f')];this['statedesc']=_0x539418[_0xdae3('0x20')];}module[_0xdae3('0x21')]=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 a5e4ada..ad27612 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 _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 +var _0x3440=['countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','droptime','dropreason','endtime','ringtime','getSeconds','responsetime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue','countcongestionretry'];(function(_0x3fc642,_0x2f77b2){var _0x3e8a47=function(_0x3b0529){while(--_0x3b0529){_0x3fc642['push'](_0x3fc642['shift']());}};_0x3e8a47(++_0x2f77b2);}(_0x3440,0x18e));var _0x0344=function(_0x45c4a7,_0x54093f){_0x45c4a7=_0x45c4a7-0x0;var _0xfa3b3f=_0x3440[_0x45c4a7];return _0xfa3b3f;};'use strict';var utils=require(_0x0344('0x0'));function QueueCallerAbandon(_0x290a77,_0x3b2f05){this[_0x0344('0x1')]=_0x290a77[_0x0344('0x1')];this[_0x0344('0x2')]=_0x290a77['type'];this[_0x0344('0x3')]=_0x290a77['type']===_0x0344('0x4')?_0x0344('0x5'):_0x290a77[_0x0344('0x2')];this['countbusyretry']=_0x290a77['countbusyretry'];this[_0x0344('0x6')]=_0x290a77[_0x0344('0x6')];this[_0x0344('0x7')]=_0x290a77[_0x0344('0x7')];this[_0x0344('0x8')]=_0x290a77[_0x0344('0x9')]+_0x290a77['countcongestionretry']+_0x290a77[_0x0344('0x7')]+_0x290a77['countnosuchnumberretry']+_0x290a77[_0x0344('0xa')]+_0x290a77[_0x0344('0xb')]+_0x290a77[_0x0344('0xc')]+_0x290a77[_0x0344('0xd')];this[_0x0344('0xe')]=_0x290a77['countnosuchnumberretry'];this[_0x0344('0xa')]=_0x290a77[_0x0344('0xa')];this[_0x0344('0xb')]=_0x290a77[_0x0344('0xb')];this[_0x0344('0xc')]=_0x290a77[_0x0344('0xc')];this[_0x0344('0xd')]=_0x290a77[_0x0344('0xd')];this[_0x0344('0xf')]=_0x3b2f05[_0x0344('0xf')];this[_0x0344('0x10')]=_0x290a77[_0x0344('0x11')];this[_0x0344('0x12')]=_0x290a77[_0x0344('0x13')];this[_0x0344('0x14')]=_0x290a77['starttime'];this['responsetime']=_0x290a77['responsetime'];this[_0x0344('0x15')]=_0x290a77[_0x0344('0x15')];this[_0x0344('0x16')]=_0x290a77['dropreason'];this[_0x0344('0x17')]=this[_0x0344('0x15')];this[_0x0344('0x18')]=utils[_0x0344('0x19')](_0x290a77[_0x0344('0x1a')],_0x290a77['starttime']);this[_0x0344('0x1b')]=utils[_0x0344('0x19')](this['droptime'],_0x290a77[_0x0344('0x1a')]);this[_0x0344('0x1c')]=0x0;this['queue']=_0x3b2f05[_0x0344('0x5')];this['membername']=_0x3b2f05[_0x0344('0x1d')];this[_0x0344('0x1e')]=_0x3b2f05['reason'];this[_0x0344('0x1f')]=_0x290a77[_0x0344('0x1f')];this[_0x0344('0x20')]=_0x290a77[_0x0344('0x20')];this[_0x0344('0x21')]=_0x290a77[_0x0344('0x21')];this[_0x0344('0x22')]=_0x290a77['recallme'];this['ContactId']=_0x290a77[_0x0344('0x23')];this[_0x0344('0x24')]=_0x290a77[_0x0344('0x24')];this['UserId']=_0x290a77[_0x0344('0x25')];this[_0x0344('0x26')]=_0x290a77[_0x0344('0x26')];this['CampaignId']=_0x290a77[_0x0344('0x27')];this[_0x0344('0x28')]=_0x290a77[_0x0344('0x28')]||'';this[_0x0344('0x29')]=_0x290a77['originatecalleridname']||'';this['agiafterat']=_0x290a77[_0x0344('0x2a')];this['state']=_0x290a77[_0x0344('0x2b')];this[_0x0344('0x2c')]=_0x290a77[_0x0344('0x2c')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index b8f2f26..e3b8170 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 _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 +var _0xdf55=['createHistory','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xdf55,0x83));var _0x5df5=function(_0x45dfd0,_0x43439b){_0x45dfd0=_0x45dfd0-0x0;var _0x1df4a2=_0xdf55[_0x45dfd0];return _0x1df4a2;};'use strict';var util=require(_0x5df5('0x0'));var logger=require(_0x5df5('0x1'))('dialer');var cmHopper=require(_0x5df5('0x2'));var cmHopperAdditionalPhone=require(_0x5df5('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x5df5('0x4'));function inspectError(_0x773e15){return util[_0x5df5('0x5')](_0x773e15,{'showHidden':![],'depth':null});}function getContactDialer(_0x521007,_0x289af4,_0x417341){return cmHopper[_0x5df5('0x6')](_0x521007['id'],_0x289af4,_0x417341,_0x521007[_0x5df5('0x7')])[_0x5df5('0x8')](function(_0x2b7ed9){_0x521007[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialer]',inspectError(_0x2b7ed9));});}exports[_0x5df5('0x6')]=getContactDialer;function getContactDialerIvr(_0x403d8b,_0x41941e){return cmHopper['getContactDialerIvr'](_0x403d8b['id'],_0x41941e,_0x403d8b['dialOrderByScheduledAt'])[_0x5df5('0x8')](function(_0x4e80bd){_0x403d8b[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialerIvr]',inspectError(_0x4e80bd));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x40322d){return cmHopper[_0x5df5('0xb')](_0x40322d)[_0x5df5('0x8')](function(_0x4c3d6f){logger[_0x5df5('0xa')](_0x5df5('0xc'),inspectError(_0x4c3d6f));});}exports[_0x5df5('0xb')]=countReScheduled;function rescheduleContact(_0x463990){return cmHopper[_0x5df5('0xd')](_0x463990)[_0x5df5('0x8')](function(_0x555d3f){logger[_0x5df5('0xa')]('[rescheduleContact]',inspectError(_0x555d3f));});}exports[_0x5df5('0xd')]=rescheduleContact;function unlockContact(_0x33f818,_0x5b0ad9,_0x3657c8){return cmHopper[_0x5df5('0xe')](_0x33f818,_0x5b0ad9,_0x3657c8)['catch'](function(_0x27b3fb){logger[_0x5df5('0xa')]('[unlockContact]',inspectError(_0x27b3fb));});}exports[_0x5df5('0xe')]=unlockContact;function moveContactManagedDialer(_0x45813f){return cmHopper[_0x5df5('0xf')](_0x45813f)[_0x5df5('0x8')](function(_0x215d59){logger['error']('[moveContactManagedDialer]',inspectError(_0x215d59));});}exports[_0x5df5('0xf')]=moveContactManagedDialer;function checkIsBlackList(_0x5d8dfd){return cmHopperBlack[_0x5df5('0x10')](_0x5d8dfd)[_0x5df5('0x8')](function(_0xa939e4){logger[_0x5df5('0xa')](_0x5df5('0x11'),inspectError(_0xa939e4));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x1d6474){return cmHopperBlack[_0x5df5('0x12')](_0x1d6474)[_0x5df5('0x8')](function(_0x34af1d){logger[_0x5df5('0xa')](_0x5df5('0x13'),inspectError(_0x34af1d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2e99a1,_0x2e862d,_0x8742a7){return cmHopperAdditionalPhone[_0x5df5('0x14')](_0x2e99a1,_0x2e862d,_0x8742a7)['catch'](function(_0x4358ba){logger[_0x5df5('0xa')](_0x5df5('0x15'),inspectError(_0x4358ba));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x52206d,_0x532923,_0x357fb0){return cmHopperAdditionalPhone[_0x5df5('0x16')](_0x52206d,_0x532923,_0x357fb0)[_0x5df5('0x8')](function(_0xa7f4b3){logger[_0x5df5('0xa')](_0x5df5('0x17'),inspectError(_0xa7f4b3));});}exports[_0x5df5('0x16')]=swapAdditionalPhones;function avgHandleTime(_0x28723e){return cmHopperHistory['avgHandleTime'](_0x28723e)[_0x5df5('0x8')](function(_0x4fc1a1){logger[_0x5df5('0xa')](_0x5df5('0x18'),inspectError(_0x4fc1a1));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x3854d0){return cmHopperHistory['createHistory'](_0x3854d0)[_0x5df5('0x8')](function(_0x4cccf1){logger[_0x5df5('0xa')]('[createHistory]',inspectError(_0x4cccf1));});}exports[_0x5df5('0x19')]=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 61c881d..7f979d6 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 _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 +var _0x0a8e=['match','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','erlangb','checkContactLowerLimitOriginate','description','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','../../../../config/logger','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','type','dialActive','isQueueCampaignActive','active','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage'];(function(_0x2dc37d,_0x1fa435){var _0x1059d8=function(_0x43734e){while(--_0x43734e){_0x2dc37d['push'](_0x2dc37d['shift']());}};_0x1059d8(++_0x1fa435);}(_0x0a8e,0xc7));var _0xe0a8=function(_0x2fa143,_0x4c4301){_0x2fa143=_0x2fa143-0x0;var _0x5b32cb=_0x0a8e[_0x2fa143];return _0x5b32cb;};'use strict';var _=require(_0xe0a8('0x0'));var moment=require(_0xe0a8('0x1'));var util=require('util');var logger=require(_0xe0a8('0x2'))('dialer');var timezones=require(_0xe0a8('0x3'))[_0xe0a8('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xe0a8('0x5'),'CONTACTS_RESCHEDULED':_0xe0a8('0x6'),'DEACTIVATED':_0xe0a8('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xe0a8('0x8'),'INACTIVE':_0xe0a8('0x9'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xe0a8('0xa'),'NULL_INTERVAL':_0xe0a8('0xb'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xe0a8('0xc'),'QUEUE_RECALL':_0xe0a8('0xd'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xe0a8('0xe'),'UNKNOWN_TIMEZONE':_0xe0a8('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xe0a8('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x259ec3){return _0x259ec3[_0xe0a8('0x11')]===_0xe0a8('0x12');}exports[_0xe0a8('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x47fb19){return _0x47fb19['type']===_0xe0a8('0x14');}exports[_0xe0a8('0x15')]=isIVRCampaign;function isOutboundQueue(_0x8c7deb){return _0x8c7deb[_0xe0a8('0x16')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x4e64b0){return _0x4e64b0[_0xe0a8('0x17')];}exports[_0xe0a8('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2a21b5){return _0x2a21b5[_0xe0a8('0x19')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x3c81be,_0x9124bc){var _0x5ba630=moment(_0x3c81be)[_0xe0a8('0x1a')](0x0);var _0x1b030f=moment(_0x9124bc)['milliseconds'](0x0);return _0x5ba630[_0xe0a8('0x1b')](_0x1b030f,'seconds');}exports[_0xe0a8('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x2d2988,_0x9d7ae1){var _0x4bc7aa=![];var _0x5f2e00=_0x2d2988[_0xe0a8('0x11')]!==_0x9d7ae1[_0xe0a8('0x11')]||_0x2d2988['dialActive']!==_0x9d7ae1['dialActive']||_0x2d2988[_0xe0a8('0x1d')]!==_0x9d7ae1[_0xe0a8('0x1d')];var _0x230cbf=_0x2d2988[_0xe0a8('0x1e')]!==_0x9d7ae1['available']||_0x2d2988[_0xe0a8('0x1f')]!==_0x9d7ae1[_0xe0a8('0x1f')]||_0x2d2988[_0xe0a8('0x20')]!==_0x9d7ae1[_0xe0a8('0x20')]||_0x2d2988[_0xe0a8('0x21')]!==_0x9d7ae1[_0xe0a8('0x21')]||_0x2d2988['talking']!==_0x9d7ae1[_0xe0a8('0x22')]||_0x2d2988[_0xe0a8('0x23')]!==_0x9d7ae1['pTalking']||_0x2d2988['waiting']!==_0x9d7ae1[_0xe0a8('0x24')]||_0x2d2988[_0xe0a8('0x25')]!==_0x9d7ae1[_0xe0a8('0x25')]||_0x2d2988[_0xe0a8('0x26')]!==_0x9d7ae1[_0xe0a8('0x26')];if(_0x2d2988['Trunk']&&_0x9d7ae1[_0xe0a8('0x27')]){_0x4bc7aa=_0x2d2988['Trunk'][_0xe0a8('0x28')]!==_0x9d7ae1[_0xe0a8('0x27')][_0xe0a8('0x28')]||_0x2d2988[_0xe0a8('0x27')][_0xe0a8('0x19')]!==_0x9d7ae1[_0xe0a8('0x27')][_0xe0a8('0x19')];}return _0x5f2e00||_0x230cbf||_0x4bc7aa;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x23175b){var _0x3cd290=null;var _0x1cd500=_0x23175b[_0xe0a8('0x29')];if(_[_0xe0a8('0x2a')](_0x23175b[_0xe0a8('0x2b')])||_[_0xe0a8('0x2a')](_0x23175b['Interval'])||_['isNil'](_0x23175b[_0xe0a8('0x2c')]['Intervals'])){_0x3cd290=CAMPAIGN_STATUS[_0xe0a8('0x2d')];}else if(_[_0xe0a8('0x2e')](_0x23175b[_0xe0a8('0x2b')])||_[_0xe0a8('0x2e')](_0x23175b[_0xe0a8('0x2c')][_0xe0a8('0x2f')])){_0x3cd290=CAMPAIGN_STATUS[_0xe0a8('0x30')];}else if(_0x1cd500&&!timezones[_0x1cd500]){_0x3cd290=CAMPAIGN_STATUS[_0xe0a8('0x31')];}return _0x3cd290;}function checkAnyValidTrunk(_0x4af1b4,_0x4ca6b0){var _0x4056d9=null;var _0x1a7d50='SIP/';var _0x52a7d1=[_0xe0a8('0x32'),_0xe0a8('0x33')];var _0x44d3f0=!![];if(_0x4af1b4['Trunk']&&_0x4af1b4['Trunk'][_0xe0a8('0x19')]){_0x1a7d50+=_0x4af1b4[_0xe0a8('0x27')][_0xe0a8('0x28')];_0x4056d9=_0x4ca6b0[_0x1a7d50];_0x44d3f0=_0x52a7d1[_0xe0a8('0x34')](_0x4056d9[_0xe0a8('0x35')]);}else if(_0x4af1b4[_0xe0a8('0x36')]&&_0x4af1b4[_0xe0a8('0x36')][_0xe0a8('0x19')]){_0x1a7d50+=_0x4af1b4[_0xe0a8('0x36')][_0xe0a8('0x28')];_0x4056d9=_0x4ca6b0[_0x1a7d50];_0x44d3f0=_0x52a7d1[_0xe0a8('0x34')](_0x4056d9[_0xe0a8('0x35')]);}return _0x44d3f0;}function getQueueCampaignStatusMessage(_0x23e9d5,_0x153dd5){var _0x2b8207=CAMPAIGN_STATUS[_0xe0a8('0x37')];var _0x38e7b6=isPreviewCampaign(_0x23e9d5);if(!isQueueCampaignActive(_0x23e9d5)){if(_0x38e7b6){_0x2b8207=CAMPAIGN_STATUS[_0xe0a8('0x38')];}else{if(_0x23e9d5[_0xe0a8('0x26')]===0x0&&_0x23e9d5[_0xe0a8('0x22')]===0x0&&_0x23e9d5['waiting']===0x0&&(_0x23e9d5[_0xe0a8('0x23')]||0x0)===0x0){_0x2b8207=CAMPAIGN_STATUS[_0xe0a8('0x38')];}else{_0x2b8207=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x23e9d5['loggedIn']===0x0){_0x2b8207=CAMPAIGN_STATUS[_0xe0a8('0x39')];}else if(!checkAnyValidTrunk(_0x23e9d5,_0x153dd5)){_0x2b8207=CAMPAIGN_STATUS[_0xe0a8('0x3a')];}else if(!isPreviewCampaign(_0x23e9d5)){var _0x5a7193=checkAnyValidQueueCampaignInterval(_0x23e9d5);if(_0x5a7193){_0x2b8207=_0x5a7193;}}return _0x2b8207;}exports[_0xe0a8('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x13d6b1){var _0x4686bb=CAMPAIGN_STATUS[_0xe0a8('0x3c')];if(_0x13d6b1[_0xe0a8('0x26')]===0x0&&_0x13d6b1[_0xe0a8('0x22')]===0x0&&_0x13d6b1[_0xe0a8('0x24')]===0x0&&(_0x13d6b1['pTalking']||0x0)===0x0){_0x4686bb=CAMPAIGN_STATUS[_0xe0a8('0x38')];}return _0x4686bb;}exports[_0xe0a8('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xd8fd51){var _0x45cfca=_0xd8fd51[_0xe0a8('0x3e')](/"(.*?)"/);return _0x45cfca?_0x45cfca[0x1]:_0xd8fd51;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x2633ba,_0x561261,_0x9f1ed5){if(!_[_0xe0a8('0x3f')](_0x9f1ed5)&&typeof _0x9f1ed5===_0xe0a8('0x40')&&!_[_0xe0a8('0x2e')](_0x9f1ed5)){if(!_[_0xe0a8('0x3f')](_0x561261)&&typeof _0x561261===_0xe0a8('0x40')&&!_[_0xe0a8('0x2e')](_0x561261)){return util[_0xe0a8('0x41')](_0xe0a8('0x42'),_0x561261,_0x9f1ed5);}return util[_0xe0a8('0x41')]('\x22%s\x22\x20<%s>',_0x9f1ed5,_0x9f1ed5);}if(!_['isUndefined'](_0x2633ba)&&typeof _0x2633ba===_0xe0a8('0x40')&&!_[_0xe0a8('0x2e')](_0x2633ba)){return _0x2633ba;}return'\x22\x22\x20<>';}exports[_0xe0a8('0x43')]=getCallerId;function getCallerIdRandom(_0x3db294,_0x1a282e){var _0x569b92;var _0x23f632;var _0x5e0d85;if(_0x1a282e<=0x0){_0x1a282e=0x1;}_0x569b92=new RegExp(_0xe0a8('0x44')+_0x1a282e+'}$');_0x23f632=Math[_0xe0a8('0x45')](0xa,_0x1a282e-0x1);_0x5e0d85=Math[_0xe0a8('0x45')](0xa,_0x1a282e)-0x1;return util['format']('%s',_[_0xe0a8('0x46')](_0x3db294,_0x569b92,_[_0xe0a8('0x47')](_0x23f632,_0x5e0d85)['toString']()));}exports[_0xe0a8('0x48')]=getCallerIdRandom;function decrementOriginate(_0x1ce4a2){if(_0x1ce4a2[_0xe0a8('0x26')]&&_0x1ce4a2[_0xe0a8('0x26')]>0x0){_0x1ce4a2[_0xe0a8('0x26')]-=0x1;}else{logger[_0xe0a8('0x49')](_0xe0a8('0x4a'));}}exports[_0xe0a8('0x4b')]=decrementOriginate;function checkContactEmpty(_0x22af0c){return _0x22af0c&&_0x22af0c[_0xe0a8('0x4c')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x1fe0b1,_0x581eef){if(_0x581eef===0x0){return 0x0;}var _0x2ddef1=0x1;for(var _0x45bc20=0x1;_0x45bc20<=_0x581eef;_0x45bc20+=0x1){_0x2ddef1=0x1+_0x2ddef1*_0x45bc20/_0x1fe0b1;}return 0x1/_0x2ddef1;}exports[_0xe0a8('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x1d3152,_0xf452b0,_0x23ee84){if(_0xf452b0>_0x23ee84){for(var _0x4250cd=0x0;_0x4250cd<_0xf452b0-_0x23ee84;_0x4250cd+=0x1){decrementOriginate(_0x1d3152);}}}exports[_0xe0a8('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x57d2c9){var _0x343db2={};var _0x539856=['id','createdAt',_0xe0a8('0x4f'),_0xe0a8('0x50'),_0xe0a8('0x51')];if(_0x57d2c9){for(var _0x2e705e in _0x57d2c9){if(typeof _0x57d2c9[_0x2e705e]!==_0xe0a8('0x52')){if(!_[_0xe0a8('0x2a')](_0x57d2c9[_0x2e705e])&&!_0x539856[_0xe0a8('0x34')](_0x2e705e)){_0x343db2[util[_0xe0a8('0x41')](_0xe0a8('0x53'),_0xe0a8('0x54'),_0x2e705e[_0xe0a8('0x55')]())]=_0x57d2c9[_0x2e705e];}}}}return _0x343db2;}exports[_0xe0a8('0x56')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2bb3175..ec1bf38 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(_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 +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x3f47df,_0x1d3b79){var _0x3e2ac4=function(_0x2525c6){while(--_0x2525c6){_0x3f47df['push'](_0x3f47df['shift']());}};_0x3e2ac4(++_0x1d3b79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 cad80b8..4f2c0ad 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 _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 +var _0x761f=['reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','ext','isTrunkReachable','isNil','active','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','exports','util','lodash','bluebird','uuid','moment','./util/gs','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0x761f,0x11e));var _0xf761=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x761f[_0x486f4a];return _0x135d99;};'use strict';var util=require(_0xf761('0x0'));var _=require(_0xf761('0x1'));var BPromise=require(_0xf761('0x2'));var uuid=require(_0xf761('0x3'));var moment=require(_0xf761('0x4'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0xf761('0x5'));var logger=require('../../../config/logger')('fax');var ami=require('../ami');var rpcDb=require(_0xf761('0x6'));var Channel=require('./channel');var ut=require(_0xf761('0x7'));var Action=require(_0xf761('0x8'));var faxAccount=require(_0xf761('0x9'));var attachment=require(_0xf761('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2d166c){this[_0xf761('0xb')]={};this[_0xf761('0xc')]=_0x2d166c[_0xf761('0xc')];this[_0xf761('0xd')]=_0x2d166c[_0xf761('0xd')];this[_0xf761('0xe')]={};ami['on'](_0xf761('0xf'),this[_0xf761('0x10')][_0xf761('0x11')](this));ami['on'](_0xf761('0x12'),this[_0xf761('0x13')]['bind'](this));ami['on'](_0xf761('0x14'),this[_0xf761('0x15')][_0xf761('0x11')](this));ami['on'](_0xf761('0x16'),this['syncNewExten'][_0xf761('0x11')](this));ami['on'](_0xf761('0x17'),this[_0xf761('0x18')][_0xf761('0x11')](this));ami['on'](_0xf761('0x19'),this[_0xf761('0x1a')]['bind'](this));ami['on'](_0xf761('0x1b'),this[_0xf761('0x1c')]['bind'](this));ami['on'](_0xf761('0x1d'),this[_0xf761('0x1e')][_0xf761('0x11')](this));}Fax[_0xf761('0x1f')]['syncNewchannel']=function(_0x42b04e){if(_0x42b04e[_0xf761('0x20')]===_0xf761('0x21')){for(var _0x5f51f2 in this['faxAccounts']){if(this['faxAccounts'][_0xf761('0x22')](_0x5f51f2)){if(_0x42b04e[_0xf761('0x23')]===this[_0xf761('0xc')][_0x5f51f2][_0xf761('0x24')]){this[_0xf761('0xb')][_0x42b04e[_0xf761('0x25')]]={};this['channels'][_0x42b04e['uniqueid']][_0xf761('0x26')]=_0x42b04e[_0xf761('0x26')];this[_0xf761('0xb')][_0x42b04e['uniqueid']]['id']=this[_0xf761('0xc')][_0x5f51f2]['id'];this[_0xf761('0xb')][_0x42b04e[_0xf761('0x25')]][_0xf761('0x27')]=this['faxAccounts'][_0x5f51f2]['name'];logger[_0xf761('0x28')](_0x42b04e[_0xf761('0x25')],_0xf761('0x29'));}}}}if(this[_0xf761('0xe')][_0x42b04e[_0xf761('0x25')]]){this['channels'][_0x42b04e[_0xf761('0x25')]]={};this[_0xf761('0xb')][_0x42b04e[_0xf761('0x25')]][_0xf761('0x26')]=_0x42b04e['channel'];logger['info'](_0x42b04e[_0xf761('0x25')],_0xf761('0x29'));}};Fax[_0xf761('0x1f')]['syncVarSet']=function(_0x3eb3e2){if(this[_0xf761('0xb')][_0x3eb3e2[_0xf761('0x25')]]){for(var _0x7ba306 in _0x3eb3e2[_0xf761('0x2a')]){if(_0x3eb3e2[_0xf761('0x2a')][_0xf761('0x22')](_0x7ba306)){this[_0xf761('0xb')][_0x3eb3e2[_0xf761('0x25')]][_0x7ba306]=_0x3eb3e2[_0xf761('0x2b')];}}}};Fax[_0xf761('0x1f')][_0xf761('0x15')]=function(_0x2c4fbd){if(this['channels'][_0x2c4fbd[_0xf761('0x25')]]){this['channels'][_0x2c4fbd['uniqueid']]['channelstate']=_0x2c4fbd[_0xf761('0x2c')];this[_0xf761('0xb')][_0x2c4fbd['uniqueid']][_0xf761('0x2d')]=_0x2c4fbd[_0xf761('0x2d')];}};Fax[_0xf761('0x1f')][_0xf761('0x2e')]=function(_0x22f418){if(this['channels'][_0x22f418['uniqueid']]){for(var _0x38a30f in _0x22f418[_0xf761('0x2a')]){if(_0x22f418[_0xf761('0x2a')][_0xf761('0x22')](_0x38a30f)){this[_0xf761('0xb')][_0x22f418[_0xf761('0x25')]][_0x38a30f]=_0x22f418[_0xf761('0x2b')];}}}};Fax['prototype'][_0xf761('0x18')]=function(_0x3008b2){if(this[_0xf761('0xb')][_0x3008b2[_0xf761('0x25')]]){this[_0xf761('0xb')][_0x3008b2[_0xf761('0x25')]][_0xf761('0x2f')]=_0x3008b2[_0xf761('0x2f')];this['channels'][_0x3008b2[_0xf761('0x25')]][_0xf761('0x30')]=_0x3008b2['status'];this[_0xf761('0xb')][_0x3008b2[_0xf761('0x25')]][_0xf761('0x24')]=_0x3008b2[_0xf761('0x24')];this['channels'][_0x3008b2[_0xf761('0x25')]][_0xf761('0x31')]=_0x3008b2['filename'];logger[_0xf761('0x28')](_0x3008b2['uniqueid'],_0xf761('0x32'));}};Fax['prototype']['syncReceiveFax']=function(_0x3cfdbb){var _0x9b314e=this;if(this[_0xf761('0xb')][_0x3cfdbb['uniqueid']]){var _0xfbdb73=this['channels'][_0x3cfdbb['uniqueid']]['id'];this['channels'][_0x3cfdbb[_0xf761('0x25')]][_0xf761('0x33')]=_0x3cfdbb[_0xf761('0x33')];this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]][_0xf761('0x34')]=_0x3cfdbb[_0xf761('0x34')];this['channels'][_0x3cfdbb['uniqueid']][_0xf761('0x24')]=_0x3cfdbb['localstationid'];this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]]['resolution']=_0x3cfdbb[_0xf761('0x35')];this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]][_0xf761('0x36')]=_0x3cfdbb[_0xf761('0x36')];this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]]['filename']=_0x3cfdbb['filename'];this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]][_0xf761('0x37')]=_0x3cfdbb[_0xf761('0x37')];if(this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]][_0xf761('0x34')]>0x0){tiff2pdf(_0x3cfdbb[_0xf761('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x5ef363){logger[_0xf761('0x28')](_0x3cfdbb[_0xf761('0x25')],_0xf761('0x38'),_0x5ef363[_0xf761('0x39')]);attachment[_0xf761('0x3a')]({'name':path[_0xf761('0x3b')](_0x3cfdbb[_0xf761('0x31')])['name'],'basename':path['parse'](_0x3cfdbb[_0xf761('0x31')])['name']+_0xf761('0x3c'),'type':_0xf761('0x3d')})[_0xf761('0x3e')](function(_0x42a577){faxAccount[_0xf761('0x3f')](_0xfbdb73,{'from':_0x3cfdbb[_0xf761('0x37')],'mapKey':'fax','body':path[_0xf761('0x3b')](_0x3cfdbb[_0xf761('0x31')])[_0xf761('0x27')]+_0xf761('0x3c'),'AttachmentId':_0x42a577['id']})['catch'](function(_0x417ac3){logger[_0xf761('0x40')](_0x3cfdbb[_0xf761('0x25')],_0xf761('0x41'),JSON[_0xf761('0x42')](_0x417ac3));});})[_0xf761('0x43')](function(_0x5b6053){logger[_0xf761('0x40')](_0x3cfdbb['uniqueid'],_0xf761('0x44'),JSON[_0xf761('0x42')](_0x5b6053));});});}logger[_0xf761('0x28')](_0x3cfdbb[_0xf761('0x25')],_0xf761('0x44'));}};Fax[_0xf761('0x1f')]['syncOriginateResponse']=function(_0x457392){if(this['actions'][_0x457392['uniqueid']]){_[_0xf761('0x45')](this[_0xf761('0xb')][_0x457392[_0xf761('0x25')]],_[_0xf761('0x46')](_0x457392,['response',_0xf761('0x47')]));}};function updateStatus(_0xb990ed){if(_0xb990ed[_0xf761('0x48')]){faxMessage[_0xf761('0x49')](_0xb990ed[_0xf761('0x48')],{'failMessage':_0xf761('0x4a')})['then'](function(_0x38902f){ut[_0xf761('0x4b')](_0xf761('0x4c'),_0x38902f);})[_0xf761('0x43')](function(_0xed8364){ut[_0xf761('0x4b')]('[Fax][Message][Error][NoUpdate1]',_0xed8364);});}else{ut[_0xf761('0x4b')](_0xf761('0x4d'));}}Fax['prototype']['updateStatus']=function(_0x33e8f5,_0x312aa9,_0x5846bc){var _0x43c2e3=this;var _0x3a1267={};if(_0x312aa9){_0x3a1267={'read':_0x312aa9};}else{_0x3a1267={'failMessage':_0x5846bc};}if(this['actions'][_0x33e8f5][_0xf761('0x48')]){faxMessage[_0xf761('0x49')](this['actions'][_0x33e8f5][_0xf761('0x48')],_0x3a1267)['then'](function(_0x2b91ea){ut[_0xf761('0x4b')]('[Fax][Message][Updated]',_0x2b91ea);})[_0xf761('0x43')](function(_0x4df9d3){ut['logger'](_0xf761('0x4e'),_0x4df9d3);})[_0xf761('0x4f')](function(){delete _0x43c2e3[_0xf761('0xb')][_0x33e8f5];delete _0x43c2e3['actions'][_0x33e8f5];});}else{ut[_0xf761('0x4b')](_0xf761('0x50'));delete this['channels'][_0x33e8f5];delete this[_0xf761('0xe')][_0x33e8f5];}};Fax[_0xf761('0x1f')][_0xf761('0x1c')]=function(_0x2281da){var _0x19f541=this;if(this['channels'][_0x2281da['uniqueid']]){if(this['actions'][_0x2281da[_0xf761('0x25')]]){this[_0xf761('0xb')][_0x2281da[_0xf761('0x25')]]['id']=this[_0xf761('0xe')][_0x2281da[_0xf761('0x25')]]['id'];this[_0xf761('0xb')][_0x2281da['uniqueid']][_0xf761('0x27')]=this[_0xf761('0xe')][_0x2281da[_0xf761('0x25')]][_0xf761('0x27')];}logger['info'](_0x2281da[_0xf761('0x25')],this[_0xf761('0xe')][_0x2281da[_0xf761('0x25')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0xf761('0x42')](this[_0xf761('0xb')][_0x2281da[_0xf761('0x25')]]));if(this['actions'][_0x2281da[_0xf761('0x25')]]){if(this[_0xf761('0xb')][_0x2281da['uniqueid']][_0xf761('0x51')]>0x0&&this[_0xf761('0xb')][_0x2281da[_0xf761('0x25')]][_0xf761('0x17')]===_0xf761('0x52')){this[_0xf761('0x53')](_0x2281da['uniqueid'],!![]);}else{this[_0xf761('0x53')](_0x2281da['uniqueid'],![],this[_0xf761('0xb')][_0x2281da[_0xf761('0x25')]][_0xf761('0x54')]?_0xf761('0x55')+this['channels'][_0x2281da[_0xf761('0x25')]][_0xf761('0x54')]:_0xf761('0x56'));}}}};Fax['prototype'][_0xf761('0x57')]=function(_0x597e9e){var _0x13ccd7=this;return new BPromise(function(_0x178d85,_0x282f43){_0x13ccd7[_0xf761('0x58')](_0x597e9e,_0x13ccd7[_0xf761('0xc')][_0x597e9e['FaxAccountId']])[_0xf761('0x3e')](function(_0x169866){ut['logger'](_0xf761('0x59'),_0x169866);_0x178d85(ut['message'](_0xf761('0x5a')));})[_0xf761('0x43')](function(_0xcfedf9){ut[_0xf761('0x4b')](_0xf761('0x5b'),_0xcfedf9);updateStatus(_0x597e9e);_0x282f43(ut[_0xf761('0x39')](_0xf761('0x5c')));});});};Fax['prototype']['checkAfterSend']=function(_0x3b675d){var _0x6ac40f=this;return new BPromise(function(_0x1665df,_0x396ad7){var _0x33c39f=_0x6ac40f[_0xf761('0x5d')](_0x6ac40f[_0xf761('0xc')][_0x3b675d[_0xf761('0x5e')]][_0xf761('0x5f')],_0x3b675d);if(_0x33c39f[_0xf761('0x60')]){_0x1665df(ut['message'](_0xf761('0x61')));}else{_0x396ad7(ut['message'](_0x33c39f['message']));}});};function originate(_0x6f14c9,_0x411fdf,_0x3af3ff){return new BPromise(function(_0x12d74c,_0x4251ff){if(_0x3af3ff){var _0x4a72d9=util[_0xf761('0x62')](_0xf761('0x63'),path['parse'](_0x6f14c9['path'])[_0xf761('0x27')],_0x6f14c9[_0xf761('0x64')]);gs['execute'](_0x4a72d9)[_0xf761('0x3e')](function(){_0x6f14c9['path']=util[_0xf761('0x62')]('%s/%s.tif',path[_0xf761('0x3b')](_0x6f14c9['path'])[_0xf761('0x65')],path[_0xf761('0x3b')](_0x6f14c9[_0xf761('0x64')])[_0xf761('0x27')]);_0x411fdf[_0xf761('0x66')]=_0x6f14c9[_0xf761('0x64')];ut[_0xf761('0x4b')](_0xf761('0x67'),'');ami['Action'](ut['variablesAction'](_0x6f14c9,_0x411fdf))['then'](function(_0x2a19b2){_0x12d74c(_0x2a19b2);})['catch'](function(_0x3e5ab1){_0x4251ff(_0x3e5ab1);});})[_0xf761('0x43')](function(_0x592689){_0x4251ff(_0x592689);});}else{ami[_0xf761('0x68')](ut['variablesAction'](_0x6f14c9,_0x411fdf))[_0xf761('0x3e')](function(_0x541da8){_0x12d74c(_0x541da8);})[_0xf761('0x43')](function(_0x3b4209){_0x4251ff(_0x3b4209);});}});}Fax['prototype'][_0xf761('0x58')]=function(_0x278308,_0x41034c){var _0x44224a=this;return new BPromise(function(_0x3daf24,_0x301beb){var _0x970f5f=uuid['v4']();var _0x490f49=ut['addVariables'](_0x278308,_0x41034c);_0x44224a[_0xf761('0xe')][_0x970f5f]=new Action(_0x970f5f,_0x41034c,_0x278308);var _0xa65d2e=_0x44224a['actions'][_0x970f5f];if(path[_0xf761('0x3b')](_0x278308[_0xf761('0x64')])[_0xf761('0x69')]===_0xf761('0x3c')){originate(_0xa65d2e,_0x490f49,!![])[_0xf761('0x3e')](function(_0x12eedb){_0x3daf24(_0x12eedb);})['catch'](function(_0x35453c){_0x301beb(_0x35453c);});}else{originate(_0xa65d2e,_0x490f49,![])[_0xf761('0x3e')](function(_0x546e60){_0x3daf24(_0x546e60);})['catch'](function(_0x3842a8){_0x301beb(_0x3842a8);});}});};Fax['prototype'][_0xf761('0x6a')]=function(_0x3df5ff){return!_[_0xf761('0x6b')](_0x3df5ff)&&!_['isNil'](_0x3df5ff[_0xf761('0x27')])&&!_['isNil'](_0x3df5ff['active'])&&_0x3df5ff[_0xf761('0x6c')]&&!_['isNil'](this[_0xf761('0xd')][util[_0xf761('0x62')](_0xf761('0x6d'),_0x3df5ff['name'])])&&!_[_0xf761('0x6b')](this[_0xf761('0xd')][util[_0xf761('0x62')](_0xf761('0x6d'),_0x3df5ff[_0xf761('0x27')])][_0xf761('0x30')])&&(this[_0xf761('0xd')][util['format']('SIP/%s',_0x3df5ff[_0xf761('0x27')])]['status']===_0xf761('0x6e')||this['trunks'][util['format'](_0xf761('0x6d'),_0x3df5ff[_0xf761('0x27')])][_0xf761('0x30')]===_0xf761('0x6f'));};Fax[_0xf761('0x1f')][_0xf761('0x5d')]=function(_0x930ed0,_0x13e2c7){if(!this['isTrunkReachable'](_0x930ed0)){ut[_0xf761('0x4b')](_0xf761('0x70'),_[_0xf761('0x6b')](_0x930ed0)?'':_0x930ed0['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xf761('0x71')};}if(_[_0xf761('0x6b')](_0x13e2c7['fax'])){ut[_0xf761('0x4b')](_0xf761('0x72'),JSON['stringify'](_0x13e2c7));return{'isValid':![],'message':_0xf761('0x73')};}if(_['isNil'](_0x13e2c7[_0xf761('0x64')])){ut[_0xf761('0x4b')](_0xf761('0x74'),JSON[_0xf761('0x42')](_0x13e2c7));return{'isValid':![],'message':_0xf761('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xf761('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 33ab6dc..98d2831 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 _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 +var _0x6e7f=['../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','../../../config/logger','lodash'];(function(_0x209129,_0x2664d4){var _0x120374=function(_0x5b664c){while(--_0x5b664c){_0x209129['push'](_0x209129['shift']());}};_0x120374(++_0x2664d4);}(_0x6e7f,0x198));var _0xf6e7=function(_0xbceef9,_0x2baad2){_0xbceef9=_0xbceef9-0x0;var _0x4581b1=_0x6e7f[_0xbceef9];return _0x4581b1;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xf6e7('0x0'))('preview');var _=require(_0xf6e7('0x1'));var faxAccount=require(_0xf6e7('0x2'));function loggerCatch(_0x468a9f){return function(_0x145409){logger[_0xf6e7('0x3')](_0x468a9f,util[_0xf6e7('0x4')](_0x145409,{'showHidden':![],'depth':null}));};}exports[_0xf6e7('0x5')]=function(_0x2ce375,_0x56d9aa){return BPromise[_0xf6e7('0x6')]()[_0xf6e7('0x7')](faxAccount[_0xf6e7('0x5')](_0x2ce375,_0x56d9aa))[_0xf6e7('0x8')](loggerCatch(_0xf6e7('0x9')));}; \ 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 6b69b17..652b2b0 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 _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 +var _0xe441=['info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','exec','execute'];(function(_0x594374,_0x27bbe1){var _0xb2139f=function(_0x396924){while(--_0x396924){_0x594374['push'](_0x594374['shift']());}};_0xb2139f(++_0x27bbe1);}(_0xe441,0xb3));var _0x1e44=function(_0x3f1ba3,_0x41fd23){_0x3f1ba3=_0x3f1ba3-0x0;var _0x28045a=_0xe441[_0x3f1ba3];return _0x28045a;};'use strict';var util=require('util');var logger=require(_0x1e44('0x0'))('fax');var BPromise=require('bluebird');var exec=require('child_process')[_0x1e44('0x1')];exports[_0x1e44('0x2')]=function(_0x3a4c1d){return new BPromise(function(_0x269b0d,_0x19d596){exec(_0x3a4c1d,function(_0xeef32e,_0x210499,_0x261444){logger[_0x1e44('0x3')](_0x1e44('0x4'),_0x210499);if(_0xeef32e){logger[_0x1e44('0x3')](_0x1e44('0x4'),_0x1e44('0x5'),util[_0x1e44('0x6')](_0xeef32e,{'showHidden':![],'depth':null}),_0x210499,_0x261444);_0x19d596(_0xeef32e);}_0x269b0d(_0x210499);});});}; \ 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 10be007..ac939ab 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 _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 +var _0x24ab=['../../../../config/logger','fax','message','logger','info','inspect','ecm','minrate','maxrate','format','faxdetect','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x24ab,0x1c9));var _0xb24a=function(_0x20bdb3,_0x3a6456){_0x20bdb3=_0x20bdb3-0x0;var _0x3ff02a=_0x24ab[_0x20bdb3];return _0x3ff02a;};'use strict';var util=require(_0xb24a('0x0'));var _=require(_0xb24a('0x1'));var moment=require(_0xb24a('0x2'));var logger=require(_0xb24a('0x3'))(_0xb24a('0x4'));exports[_0xb24a('0x5')]=function(_0x36c489){return{'message':_0x36c489};};exports[_0xb24a('0x6')]=function(_0x11b3d1,_0x3d5117){logger[_0xb24a('0x7')](_0x11b3d1,util[_0xb24a('0x8')](_0x3d5117,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1cf4a0,_0x1bb40f){var _0x4db52c={'XMF-ECM':_0x1bb40f[_0xb24a('0x9')],'XMF-HEADERINFO':_0x1bb40f['headerinfo'],'XMF-MINRATE':_0x1bb40f[_0xb24a('0xa')],'XMF-MAXRATE':_0x1bb40f[_0xb24a('0xb')],'XMF-MODEM':util[_0xb24a('0xc')]('\x22%s\x22',_0x1bb40f['modem']),'XMF-GATEWAY':_0x1bb40f['gateway'],'XMF-FAXDETECT':_0x1bb40f[_0xb24a('0xd')],'XMF-T38TIMEOUT':_0x1bb40f['t38timeout'],'XMF-LOCALSTATIONID':_0x1bb40f[_0xb24a('0xe')],'XMF-PATH':_0x1cf4a0[_0xb24a('0xf')]};return _0x4db52c;};exports[_0xb24a('0x10')]=function(_0x26ef91,_0x1bb638){return{'actionid':_0x26ef91[_0xb24a('0x11')],'action':_0xb24a('0x12'),'channel':_0x26ef91['channel'],'Exten':_0xb24a('0x13'),'Context':_0xb24a('0x14'),'Priority':'1','callerid':util[_0xb24a('0xc')](_0xb24a('0x15'),_0x26ef91['headerinfo']?_0x26ef91[_0xb24a('0x16')]:'',_0x26ef91[_0xb24a('0xe')]),'variable':_0x1bb638,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x26ef91[_0xb24a('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 8ebe58d..f448d72 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 _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 +var _0xf3b4=['inspect','listen','[index.js][main]','moment','./report','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','getAgents','then','initAgents','getTelephones','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]'];(function(_0x4a7a43,_0x2ebf66){var _0x52329f=function(_0x3f6539){while(--_0x3f6539){_0x4a7a43['push'](_0x4a7a43['shift']());}};_0x52329f(++_0x2ebf66);}(_0xf3b4,0x10b));var _0x4f3b=function(_0x3d3a6e,_0x252431){_0x3d3a6e=_0x3d3a6e-0x0;var _0x3b0087=_0xf3b4[_0x3d3a6e];return _0x3b0087;};'use strict';var util=require('util');var moment=require(_0x4f3b('0x0'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x4f3b('0x1'));var Acw=require(_0x4f3b('0x2'));var Trigger=require(_0x4f3b('0x3'));var Dialer=require('./dialer');var Preview=require(_0x4f3b('0x4'));var Fax=require('./fax');var user=require(_0x4f3b('0x5'));var voiceQueue=require(_0x4f3b('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x4f3b('0x7'));var trunk=require(_0x4f3b('0x8'));var trigger=require(_0x4f3b('0x9'));var template=require(_0x4f3b('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x4f3b('0xb'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x4f3b('0xc'));var salesforce=require(_0x4f3b('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x4f3b('0xe'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x4f3b('0xf'));var freshsales=require(_0x4f3b('0x10'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x4f3b('0x11'));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(_0x4f3b('0x12'))(_0x4f3b('0x13'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x4f3b('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4f3b('0x15')](_0x4f3b('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x4f3b('0x16')]()['then'](user[_0x4f3b('0x17')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x19')]())['then'](user[_0x4f3b('0x1a')]())['then'](realtime['initTelephones']())[_0x4f3b('0x18')](trunk['getTrunks']())[_0x4f3b('0x18')](realtime['initTrunks']())[_0x4f3b('0x18')](voiceQueue[_0x4f3b('0x1b')]())['then'](realtime[_0x4f3b('0x1c')]())[_0x4f3b('0x18')](trigger[_0x4f3b('0x1d')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x1e')]())['then'](template[_0x4f3b('0x1f')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x20')]())[_0x4f3b('0x18')](zendesk[_0x4f3b('0x21')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x22')]())['then'](salesforce[_0x4f3b('0x23')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x24')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x4f3b('0x18')](realtime[_0x4f3b('0x25')]())[_0x4f3b('0x18')](freshdesk[_0x4f3b('0x26')]())['then'](realtime[_0x4f3b('0x27')]())[_0x4f3b('0x18')](desk[_0x4f3b('0x28')]())[_0x4f3b('0x18')](realtime['initDeskAccounts']())[_0x4f3b('0x18')](zoho[_0x4f3b('0x29')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x2a')]())[_0x4f3b('0x18')](vtiger['getVtigerAccounts']())[_0x4f3b('0x18')](realtime[_0x4f3b('0x2b')]())[_0x4f3b('0x18')](freshsales['getFreshsalesAccounts']())[_0x4f3b('0x18')](realtime[_0x4f3b('0x2c')]())[_0x4f3b('0x18')](servicenow[_0x4f3b('0x2d')]())[_0x4f3b('0x18')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x4f3b('0x2e')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x2f')]())[_0x4f3b('0x18')](campaign['getCampaigns']())[_0x4f3b('0x18')](realtime[_0x4f3b('0x30')]())[_0x4f3b('0x18')](voiceExtension[_0x4f3b('0x31')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x32')]())['then'](faxAccount[_0x4f3b('0x33')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x34')]())[_0x4f3b('0x18')](function(){return realtime;});}function initParams(){return Promise[_0x4f3b('0x16')]()[_0x4f3b('0x18')](voiceQueueReport[_0x4f3b('0x35')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x36')]())[_0x4f3b('0x18')](cmHopperHistory[_0x4f3b('0x37')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x38')]())[_0x4f3b('0x18')](cmHopperHistory[_0x4f3b('0x39')]())['then'](realtime[_0x4f3b('0x3a')]())[_0x4f3b('0x18')](voiceCallReport[_0x4f3b('0x3b')]())[_0x4f3b('0x18')](realtime['initVoiceCallReports']())[_0x4f3b('0x3c')](function(_0x367d2a){logger[_0x4f3b('0x3d')](_0x4f3b('0x3e'),util[_0x4f3b('0x3f')](_0x367d2a,{'showHidden':![],'depth':null}));});}function main(){return server[_0x4f3b('0x40')](realtime,preview,fax)[_0x4f3b('0x18')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x4f3b('0x18')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x4f3b('0x3c')](function(_0x5193ed){logger[_0x4f3b('0x3d')](_0x4f3b('0x41'),util['inspect'](_0x5193ed,{'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 a0b6c83..8bd3b44 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 _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 +var _0xde6c=['prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','email','address','onhold','format','user:%s','emit','user:ami:update','user:presence','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','accountcode','fullname','state','unknown','status','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local'];(function(_0x777456,_0x57998f){var _0x5895b0=function(_0x3b9ce4){while(--_0x3b9ce4){_0x777456['push'](_0x777456['shift']());}};_0x5895b0(++_0x57998f);}(_0xde6c,0x119));var _0xcde6=function(_0x5114aa,_0x4596b9){_0x5114aa=_0x5114aa-0x0;var _0x1841bc=_0xde6c[_0x5114aa];return _0x1841bc;};'use strict';var _=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var moment=require('moment');var Redis=require(_0xcde6('0x2'));var config=require(_0xcde6('0x3'));config[_0xcde6('0x4')]=_[_0xcde6('0x5')](config['redis'],{'host':_0xcde6('0x6'),'port':0x18eb});var io=require(_0xcde6('0x7'))(new Redis(config[_0xcde6('0x4')]));function Agent(_0x59bc91){this['id']=_0x59bc91['id']||0x0;this[_0xcde6('0x8')]=_0x59bc91[_0xcde6('0x8')]||'';this['email']=_0x59bc91['email']||'';this[_0xcde6('0x9')]=_0x59bc91['accountcode']||'';this[_0xcde6('0xa')]=_0x59bc91[_0xcde6('0xa')]||'';this[_0xcde6('0xb')]=_0xcde6('0xc');this['stateTime']=0x0;this[_0xcde6('0xd')]=_0xcde6('0xc');this['address']='';this[_0xcde6('0xe')]='';this[_0xcde6('0xf')]='';this[_0xcde6('0x10')]='';this[_0xcde6('0x11')]=_0x59bc91[_0xcde6('0x11')]||![];this[_0xcde6('0x12')]=_0xcde6('0xc');this[_0xcde6('0x13')]=0x0;this[_0xcde6('0x14')]='';this[_0xcde6('0x15')]='';this['onhold']=![];this[_0xcde6('0x16')]=![];}Agent[_0xcde6('0x17')][_0xcde6('0x18')]=function(_0x33dbdb){if(!_0x33dbdb[_0xcde6('0xb')]){return;}var _0x35ce40=null;var _0xf78084=_0x33dbdb[_0xcde6('0xb')][_0xcde6('0x19')]();switch(_0xf78084){case _0xcde6('0x1a'):_0xf78084='idle';break;case _0xcde6('0x1b'):_0xf78084=_0xcde6('0x1c');break;}if(this[_0xcde6('0x12')]!==_0xf78084||_0x33dbdb['statePause']){_0x35ce40=_['toNumber'](moment()['format']('x'));}var _0x44451e={'id':this['id'],'name':this['name'],'email':this[_0xcde6('0x1d')],'accountcode':this[_0xcde6('0x9')],'fullname':this['fullname'],'state':this[_0xcde6('0xb')],'stateTime':this['stateTime'],'status':this[_0xcde6('0xd')],'address':this[_0xcde6('0x1e')],'voiceStatus':_0xf78084||this[_0xcde6('0x12')],'voiceStatusTime':_0x35ce40||this[_0xcde6('0x13')],'voiceStatusCallerIdNumber':this[_0xcde6('0x14')],'voiceStatusQueue':this[_0xcde6('0x15')],'interface':this[_0xcde6('0x10')],'onhold':this[_0xcde6('0x1f')]};if(this['voiceStatus']!==_0xf78084){this[_0xcde6('0x12')]=_0xf78084;io['to'](util[_0xcde6('0x20')](_0xcde6('0x21'),_0x44451e['name']))[_0xcde6('0x22')](_0xcde6('0x23'),_0x44451e);io['emit'](_0xcde6('0x24'),_0x44451e);}};module[_0xcde6('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 4093bba..ebe343d 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 _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 +var _0xc893=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x25ede0,_0x29dc39){var _0x16fc37=function(_0x13e4d1){while(--_0x13e4d1){_0x25ede0['push'](_0x25ede0['shift']());}};_0x16fc37(++_0x29dc39);}(_0xc893,0x126));var _0x3c89=function(_0x59d35c,_0x3968fc){_0x59d35c=_0x59d35c-0x0;var _0x34628b=_0xc893[_0x59d35c];return _0x34628b;};'use strict';function Campaign(_0x4a0101){this['id']=_0x4a0101['id']||0x0;this[_0x3c89('0x0')]=_0x4a0101['name']||'';this['type']=_0x4a0101[_0x3c89('0x1')]||_0x3c89('0x2');this['originated']=0x0;this[_0x3c89('0x3')]=0x0;this[_0x3c89('0x4')]=0x0;this[_0x3c89('0x5')]=0x0;this[_0x3c89('0x6')]='';this[_0x3c89('0x7')]=!![];this[_0x3c89('0x8')]=_0x4a0101[_0x3c89('0x8')];this[_0x3c89('0x9')]=_0x4a0101[_0x3c89('0x9')];this[_0x3c89('0xa')]=_0x4a0101[_0x3c89('0xa')]||null;this[_0x3c89('0xb')]=_0x4a0101['dialGlobalInterval']?_0x4a0101[_0x3c89('0xb')]:null;this['dialOriginateCallerIdName']=_0x4a0101['dialOriginateCallerIdName'];this[_0x3c89('0xc')]=_0x4a0101[_0x3c89('0xc')];this[_0x3c89('0xd')]=_0x4a0101[_0x3c89('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x4a0101[_0x3c89('0xe')];this[_0x3c89('0xf')]=_0x4a0101['dialCongestionRetryFrequency'];this[_0x3c89('0x10')]=_0x4a0101[_0x3c89('0x10')];this[_0x3c89('0x11')]=_0x4a0101[_0x3c89('0x11')];this[_0x3c89('0x12')]=_0x4a0101[_0x3c89('0x12')];this[_0x3c89('0x13')]=_0x4a0101[_0x3c89('0x13')];this['dialGlobalMaxRetry']=_0x4a0101[_0x3c89('0x14')];this[_0x3c89('0x15')]=_0x4a0101[_0x3c89('0x15')]||0x3;this[_0x3c89('0x16')]=_0x4a0101[_0x3c89('0x16')]||0x96;this[_0x3c89('0x17')]=_0x4a0101[_0x3c89('0x17')]||0x3;this[_0x3c89('0x18')]=_0x4a0101[_0x3c89('0x18')]||0x96;this[_0x3c89('0x19')]=_0x4a0101[_0x3c89('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x4a0101[_0x3c89('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x4a0101[_0x3c89('0x1b')]||0x3;this[_0x3c89('0x1c')]=_0x4a0101[_0x3c89('0x1c')]||0x96;this[_0x3c89('0x1d')]=_0x4a0101[_0x3c89('0x1d')]||0x3;this[_0x3c89('0x1e')]=_0x4a0101[_0x3c89('0x1e')]||0x96;this[_0x3c89('0x1f')]=_0x4a0101[_0x3c89('0x1f')]||'DESC';this[_0x3c89('0x20')]=_0x4a0101[_0x3c89('0x20')]||undefined;this[_0x3c89('0x21')]=_0x4a0101[_0x3c89('0x21')]||undefined;this[_0x3c89('0x22')]=_0x4a0101[_0x3c89('0x22')]||undefined;this[_0x3c89('0x23')]=_0x4a0101['TrunkBackup']?_0x4a0101[_0x3c89('0x23')]:undefined;this['Trunk']=_0x4a0101['Trunk']?_0x4a0101['Trunk']:undefined;this[_0x3c89('0x24')]=_0x4a0101[_0x3c89('0x24')]?_0x4a0101[_0x3c89('0x24')]:undefined;this['SquareProject']=_0x4a0101['SquareProject']?_0x4a0101[_0x3c89('0x25')]:undefined;this[_0x3c89('0x26')]=_0x4a0101[_0x3c89('0x25')]?_0x4a0101[_0x3c89('0x25')][_0x3c89('0x0')]:undefined;this[_0x3c89('0x27')]=_0x4a0101[_0x3c89('0x27')]||![];this[_0x3c89('0x28')]=_0x4a0101[_0x3c89('0x28')];this[_0x3c89('0x29')]=_0x4a0101[_0x3c89('0x29')];this[_0x3c89('0x2a')]=_0x4a0101[_0x3c89('0x2a')];this[_0x3c89('0x2b')]=_0x4a0101['dialAMDTotalAnalysisTime'];this[_0x3c89('0x2c')]=_0x4a0101['dialAMDMinWordLength'];this[_0x3c89('0x2d')]=_0x4a0101[_0x3c89('0x2d')];this[_0x3c89('0x2e')]=_0x4a0101[_0x3c89('0x2e')];this[_0x3c89('0x2f')]=_0x4a0101[_0x3c89('0x2f')];this['dialAMDMaximumWordLength']=_0x4a0101['dialAMDMaximumWordLength'];}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 5476b3e..a245180 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 _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 +var _0x40af=['exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime'];(function(_0x176a6c,_0x1ab0c6){var _0x5de870=function(_0x3bb69c){while(--_0x3bb69c){_0x176a6c['push'](_0x176a6c['shift']());}};_0x5de870(++_0x1ab0c6);}(_0x40af,0x8d));var _0xf40a=function(_0x48d540,_0x9ce255){_0x48d540=_0x48d540-0x0;var _0x55cc39=_0x40af[_0x48d540];return _0x55cc39;};'use strict';function Channel(){this['starttime']=null;this[_0xf40a('0x0')]='';this[_0xf40a('0x1')]='';this[_0xf40a('0x2')]=0x0;this[_0xf40a('0x3')]='';this[_0xf40a('0x4')]=undefined;this[_0xf40a('0x5')]=undefined;this[_0xf40a('0x6')]=0x0;this[_0xf40a('0x7')]='';this[_0xf40a('0x8')]=0x0;this[_0xf40a('0x9')]=0x0;this[_0xf40a('0xa')]=0x0;this['answered']=![];this[_0xf40a('0xb')]=null;this[_0xf40a('0xc')]=null;this[_0xf40a('0xd')]=![];this['abandoned']=![];this[_0xf40a('0xe')]='';this[_0xf40a('0xf')]='';this[_0xf40a('0x10')]=0x0;this['billableseconds']=0x0;this[_0xf40a('0x11')]=0x0;this[_0xf40a('0x12')]=null;this[_0xf40a('0x13')]=null;this[_0xf40a('0x14')]=null;this['monitor']=![];this[_0xf40a('0x15')]=null;this[_0xf40a('0x16')]=null;this[_0xf40a('0x17')]=[];this['transfercalleridnum']=undefined;this[_0xf40a('0x18')]=undefined;this[_0xf40a('0x19')]=undefined;this[_0xf40a('0x1a')]=0x0;}module[_0xf40a('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 9b0ace2..b3b3f38 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 _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 +var _0xddf2=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xddf2,0x1da));var _0x2ddf=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xddf2[_0x3ab51d];return _0x29a04e;};'use strict';function DeskAccount(_0x232018){this['id']=_0x232018['id']||0x0;this[_0x2ddf('0x0')]=_0x232018[_0x2ddf('0x0')]||'';this[_0x2ddf('0x1')]=_0x232018[_0x2ddf('0x1')]||'';this['remoteUri']=_0x232018[_0x2ddf('0x2')]||'';this[_0x2ddf('0x3')]=_0x232018[_0x2ddf('0x3')]||'';this[_0x2ddf('0x4')]=_0x232018[_0x2ddf('0x4')]||'';this[_0x2ddf('0x5')]=_0x232018[_0x2ddf('0x5')]||'';this['consumerSecret']=_0x232018[_0x2ddf('0x6')]||'';this[_0x2ddf('0x7')]=_0x232018[_0x2ddf('0x7')]||'';this[_0x2ddf('0x8')]=_0x232018[_0x2ddf('0x8')]||'';this[_0x2ddf('0x9')]=_0x232018['type']||'';this[_0x2ddf('0xa')]=_0x232018[_0x2ddf('0xa')]||'';this[_0x2ddf('0xb')]=_0x232018['Configurations']||{};}module[_0x2ddf('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 37bc0e8..f56b1f8 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 _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 +var _0x4fc0=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x2b677d,_0x5900a7){var _0x454f4d=function(_0x4a6f42){while(--_0x4a6f42){_0x2b677d['push'](_0x2b677d['shift']());}};_0x454f4d(++_0x5900a7);}(_0x4fc0,0x13f));var _0x04fc=function(_0x5b2735,_0x148bd5){_0x5b2735=_0x5b2735-0x0;var _0x2f0d8f=_0x4fc0[_0x5b2735];return _0x2f0d8f;};'use strict';function Dynamics365Account(_0x3829a8){this['id']=_0x3829a8['id']||0x0;this['name']=_0x3829a8[_0x04fc('0x0')]||'';this['username']=_0x3829a8[_0x04fc('0x1')]||'';this['password']=_0x3829a8[_0x04fc('0x2')]||'';this[_0x04fc('0x3')]=_0x3829a8[_0x04fc('0x3')]||'';this[_0x04fc('0x4')]=_0x3829a8[_0x04fc('0x4')]||'';this[_0x04fc('0x5')]=_0x3829a8[_0x04fc('0x5')]||'';this[_0x04fc('0x6')]=_0x3829a8[_0x04fc('0x6')]||{};this[_0x04fc('0x7')]=_0x3829a8[_0x04fc('0x7')]||'';this[_0x04fc('0x8')]=_0x3829a8[_0x04fc('0x8')]||![];this[_0x04fc('0x9')]=_0x3829a8['Configurations']||{};this[_0x04fc('0xa')]=_0x3829a8[_0x04fc('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 66c1e8b..87a4fba 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 _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 +var _0xbacb=['headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','ListId','key','name','description','ecm'];(function(_0x762415,_0x56faf7){var _0x5ac5ab=function(_0x5376be){while(--_0x5376be){_0x762415['push'](_0x762415['shift']());}};_0x5ac5ab(++_0x56faf7);}(_0xbacb,0x15b));var _0xbbac=function(_0x479056,_0x439a5b){_0x479056=_0x479056-0x0;var _0x24392b=_0xbacb[_0x479056];return _0x24392b;};'use strict';function FaxAccount(_0x261e02){this['id']=_0x261e02['id']||0x0;this[_0xbbac('0x0')]=_0x261e02[_0xbbac('0x0')]||'';this[_0xbbac('0x1')]=_0x261e02[_0xbbac('0x1')];this[_0xbbac('0x2')]=_0x261e02[_0xbbac('0x2')];this[_0xbbac('0x3')]=_0x261e02[_0xbbac('0x3')];this[_0xbbac('0x4')]=_0x261e02[_0xbbac('0x4')];this['minrate']=_0x261e02['minrate']||0x960;this[_0xbbac('0x5')]=_0x261e02[_0xbbac('0x5')]||0x3840;this[_0xbbac('0x6')]=_0x261e02['modem']||_0xbbac('0x7');this['gateway']=_0x261e02[_0xbbac('0x8')]||'no';this[_0xbbac('0x9')]=_0x261e02[_0xbbac('0x9')]||'no';this['t38timeout']=_0x261e02[_0xbbac('0xa')]||0x1388;this[_0xbbac('0xb')]=_0x261e02[_0xbbac('0xb')]||'SIP';this['Trunk']=_0x261e02['Trunk']?_0x261e02['Trunk']:undefined;this['ListId']=_0x261e02[_0xbbac('0xc')];this[_0xbbac('0xd')]=_0x261e02[_0xbbac('0xd')];}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 fa03ca5..68db4bd 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 _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 +var _0x5a2d=['remoteUri','Configurations','name','username','apiKey','token'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5a2d,0x14c));var _0xd5a2=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x5a2d[_0x3ee1fe];return _0x1ae57a;};'use strict';function FreshdeskAccount(_0x1bd010){this['id']=_0x1bd010['id']||0x0;this[_0xd5a2('0x0')]=_0x1bd010[_0xd5a2('0x0')]||'';this[_0xd5a2('0x1')]=_0x1bd010['username']||'';this[_0xd5a2('0x2')]=_0x1bd010[_0xd5a2('0x3')]||'';this[_0xd5a2('0x4')]=_0x1bd010[_0xd5a2('0x4')]||'';this['serverUrl']=_0x1bd010['serverUrl']||'';this[_0xd5a2('0x5')]=_0x1bd010[_0xd5a2('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 70d46d8..e659f47 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 _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 +var _0x4af9=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x36e990,_0x146bcc){var _0x53406b=function(_0x3ae92e){while(--_0x3ae92e){_0x36e990['push'](_0x36e990['shift']());}};_0x53406b(++_0x146bcc);}(_0x4af9,0x12c));var _0x94af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4af9[_0x3dd15e];return _0x231fd0;};'use strict';function FreshsalesAccount(_0x1c0e9e){this['id']=_0x1c0e9e['id']||0x0;this[_0x94af('0x0')]=_0x1c0e9e['name']||'';this['username']=_0x1c0e9e[_0x94af('0x1')]||'';this[_0x94af('0x2')]=_0x1c0e9e[_0x94af('0x3')]||'';this[_0x94af('0x4')]=_0x1c0e9e[_0x94af('0x4')]||'';this[_0x94af('0x5')]=_0x1c0e9e[_0x94af('0x5')]||'';this['Configurations']=_0x1c0e9e[_0x94af('0x6')]||{};}module[_0x94af('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index ee6dde1..40962ab 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 _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 +var _0xbd58=['queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','voice','routealias','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt'];(function(_0x3ba267,_0x4ab961){var _0x47360b=function(_0x489c57){while(--_0x489c57){_0x3ba267['push'](_0x3ba267['shift']());}};_0x47360b(++_0x4ab961);}(_0xbd58,0xd7));var _0x8bd5=function(_0x182f4a,_0xb40b93){_0x182f4a=_0x182f4a-0x0;var _0x584933=_0xbd58[_0x182f4a];return _0x584933;};'use strict';function QueueReport(){this[_0x8bd5('0x0')]=_0x8bd5('0x1');this[_0x8bd5('0x2')]='';this[_0x8bd5('0x3')]='';this[_0x8bd5('0x4')]='';this['queue']='';this[_0x8bd5('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x8bd5('0x6')]=0x1;this[_0x8bd5('0x7')]=![];this[_0x8bd5('0x8')]=null;this['queuecallercomplete']=![];this[_0x8bd5('0x9')]=null;this[_0x8bd5('0xa')]=![];this[_0x8bd5('0xb')]=null;this['originalposition']=0x1;this[_0x8bd5('0xc')]='';this[_0x8bd5('0xd')]='';this[_0x8bd5('0xe')]='';this[_0x8bd5('0xf')]='';this[_0x8bd5('0x10')]='';this[_0x8bd5('0x11')]='';this[_0x8bd5('0x12')]='';this[_0x8bd5('0x13')]=0x0;this[_0x8bd5('0x14')]=![];this[_0x8bd5('0x15')]='';this['motionChannel']=_0x8bd5('0x16');this[_0x8bd5('0x17')]=null;this['mohtime']=0x0;this['variables']={};}module[_0x8bd5('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index dcbb3b6..c348e88 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 _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 +var _0x8a7b=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x217157,_0x24a15e){var _0xefe526=function(_0x1f9743){while(--_0x1f9743){_0x217157['push'](_0x217157['shift']());}};_0xefe526(++_0x24a15e);}(_0x8a7b,0x188));var _0xb8a7=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x8a7b[_0x5b740b];return _0x6f8f4e;};'use strict';function SalesforceAccount(_0x39b031){this['id']=_0x39b031['id']||0x0;this[_0xb8a7('0x0')]=_0x39b031['name']||'';this[_0xb8a7('0x1')]=_0x39b031[_0xb8a7('0x1')]||'';this[_0xb8a7('0x2')]=_0x39b031[_0xb8a7('0x2')]||'';this[_0xb8a7('0x3')]=_0x39b031[_0xb8a7('0x3')]||'';this[_0xb8a7('0x4')]=_0x39b031[_0xb8a7('0x4')]||'';this[_0xb8a7('0x5')]=_0x39b031[_0xb8a7('0x5')]||'';this['securityToken']=_0x39b031[_0xb8a7('0x6')]||'';this[_0xb8a7('0x7')]=_0x39b031[_0xb8a7('0x7')]||_0xb8a7('0x8');this['serverUrl']=_0x39b031[_0xb8a7('0x9')]||'';this[_0xb8a7('0xa')]=_0x39b031[_0xb8a7('0xa')]||{};}module[_0xb8a7('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index be46ebf..5f57606 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 _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 +var _0x813a=['name','password','remoteUri','serverUrl','exports'];(function(_0x16d8f9,_0x38fbbf){var _0x5d8cde=function(_0x9649aa){while(--_0x9649aa){_0x16d8f9['push'](_0x16d8f9['shift']());}};_0x5d8cde(++_0x38fbbf);}(_0x813a,0xe1));var _0xa813=function(_0x1caacc,_0x58a4bf){_0x1caacc=_0x1caacc-0x0;var _0x52eb08=_0x813a[_0x1caacc];return _0x52eb08;};'use strict';function ServicenowAccount(_0x5a7b07){this['id']=_0x5a7b07['id']||0x0;this[_0xa813('0x0')]=_0x5a7b07[_0xa813('0x0')]||'';this['username']=_0x5a7b07['username']||'';this[_0xa813('0x1')]=_0x5a7b07[_0xa813('0x1')]||'';this[_0xa813('0x2')]=_0x5a7b07[_0xa813('0x2')]||'';this[_0xa813('0x3')]=_0x5a7b07[_0xa813('0x3')]||'';this['Configurations']=_0x5a7b07['Configurations']||{};}module[_0xa813('0x4')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index f82c402..c3983f0 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 _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 +var _0x240c=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xf6a649,_0x3b54e3){var _0x2fe97d=function(_0x4153d9){while(--_0x4153d9){_0xf6a649['push'](_0xf6a649['shift']());}};_0x2fe97d(++_0x3b54e3);}(_0x240c,0x82));var _0xc240=function(_0x5a1d21,_0x418cc4){_0x5a1d21=_0x5a1d21-0x0;var _0x55549b=_0x240c[_0x5a1d21];return _0x55549b;};'use strict';function SugarcrmAccount(_0x820cf2){this['id']=_0x820cf2['id']||0x0;this[_0xc240('0x0')]=_0x820cf2[_0xc240('0x0')]||'';this[_0xc240('0x1')]=_0x820cf2[_0xc240('0x1')]||'';this[_0xc240('0x2')]=_0x820cf2['password']||'';this['remoteUri']=_0x820cf2[_0xc240('0x3')]||'';this['serverUrl']=_0x820cf2[_0xc240('0x4')]||'';this[_0xc240('0x5')]=_0x820cf2['Configurations']||{};}module[_0xc240('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 b604ec2..0e90b57 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 _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 +var _0xaaff=['unknown','address','exports','name','accountcode'];(function(_0x3170b2,_0x4770ca){var _0xb9428b=function(_0xc420c1){while(--_0xc420c1){_0x3170b2['push'](_0x3170b2['shift']());}};_0xb9428b(++_0x4770ca);}(_0xaaff,0xad));var _0xfaaf=function(_0x4a9801,_0x548afb){_0x4a9801=_0x4a9801-0x0;var _0x2b089a=_0xaaff[_0x4a9801];return _0x2b089a;};'use strict';function Telephone(_0x367f93){this['id']=_0x367f93['id']||0x0;this[_0xfaaf('0x0')]=_0x367f93[_0xfaaf('0x0')]||'';this[_0xfaaf('0x1')]=_0x367f93[_0xfaaf('0x1')]||'';this['state']=_0xfaaf('0x2');this['stateTime']=0x0;this['status']=_0xfaaf('0x2');this[_0xfaaf('0x3')]='';}module[_0xfaaf('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index b77e14a..ad401aa 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_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 +var _0xb10b=['name','html'];(function(_0x46be11,_0x24e7ea){var _0xe372d=function(_0x56010b){while(--_0x56010b){_0x46be11['push'](_0x46be11['shift']());}};_0xe372d(++_0x24e7ea);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b9b30,_0x4ebf7d){_0x4b9b30=_0x4b9b30-0x0;var _0x8577a9=_0xb10b[_0x4b9b30];return _0x8577a9;};'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 5bb6c21..f66ee0a 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 _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 +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x5680d1,_0x22eb8e){var _0x5b1d61=function(_0x1b2838){while(--_0x1b2838){_0x5680d1['push'](_0x5680d1['shift']());}};_0x5b1d61(++_0x22eb8e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xb7e7[_0x42f009];return _0x22a1e0;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 4d6ef2d..552c28c 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 _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 +var _0x1ad5=['registrationtime','address','defaultuser','name','state','stateTime','status','registry','indexOf','split','host','port','domain','domainport','unknown'];(function(_0x398fbb,_0x43220d){var _0x132e5c=function(_0x54ca84){while(--_0x54ca84){_0x398fbb['push'](_0x398fbb['shift']());}};_0x132e5c(++_0x43220d);}(_0x1ad5,0xe4));var _0x51ad=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1ad5[_0x502c7d];return _0x30b7ed;};'use strict';function Trunk(_0x3ad2e1){this['id']=_0x3ad2e1['id']||0x0;this['active']=_0x3ad2e1['active']||![];this[_0x51ad('0x0')]=_0x3ad2e1[_0x51ad('0x0')]||'';this[_0x51ad('0x1')]='unknown';this[_0x51ad('0x2')]=0x0;this[_0x51ad('0x3')]='unknown';this[_0x51ad('0x4')]=_0x3ad2e1[_0x51ad('0x4')]&&_0x3ad2e1['registry'][_0x51ad('0x5')](':')?_0x3ad2e1[_0x51ad('0x4')][_0x51ad('0x6')](':')[0x0]:'';this[_0x51ad('0x7')]='';this[_0x51ad('0x8')]='';this[_0x51ad('0x9')]='';this[_0x51ad('0xa')]='';this['refresh']='';this['stateRegistry']=_0x51ad('0xb');this[_0x51ad('0xc')]='';this[_0x51ad('0xd')]='';this[_0x51ad('0xe')]=_0x3ad2e1['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index bb53263..2ca48b7 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 _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 +var _0xa32d=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x5e03c5,_0x265655){var _0x15c461=function(_0x33e479){while(--_0x33e479){_0x5e03c5['push'](_0x5e03c5['shift']());}};_0x15c461(++_0x265655);}(_0xa32d,0x1f0));var _0xda32=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa32d[_0x57b54c];return _0x59cc19;};'use strict';function voiceExtension(_0x5da626){this['id']=_0x5da626['id']||0x0;this[_0xda32('0x0')]=_0x5da626[_0xda32('0x0')]||'';this[_0xda32('0x1')]=_0x5da626['recordingFormat']||_0xda32('0x2');this['mandatoryDisposition']=_0x5da626[_0xda32('0x3')]||![];}module[_0xda32('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 46c99ba..f5f0cd5 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 _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 +var _0x52f6=['outboundReCallsDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','leastrecent','linear','random','ringall','roundrobin','rrordered','name','monitor_format','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','busy','inUse','invalid','loggedIn','onHold','ringing','talking','unavailable','acw','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS'];(function(_0x3a8065,_0x4d6d7a){var _0x18b057=function(_0x334f3c){while(--_0x334f3c){_0x3a8065['push'](_0x3a8065['shift']());}};_0x18b057(++_0x4d6d7a);}(_0x52f6,0x11f));var _0x652f=function(_0x525435,_0x5e9205){_0x525435=_0x525435-0x0;var _0x4691f9=_0x52f6[_0x525435];return _0x4691f9;};'use strict';var monitorFormat={'wav':_0x652f('0x0'),'wav49':_0x652f('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x652f('0x2'),'linear':_0x652f('0x3'),'random':_0x652f('0x4'),'ringall':_0x652f('0x5'),'rr':_0x652f('0x6'),'rrmemory':'rrmemory','rrordered':_0x652f('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x680040){this['id']=_0x680040['id']||0x0;this[_0x652f('0x8')]=_0x680040[_0x652f('0x8')]||'';this[_0x652f('0x9')]=_0x680040['monitor_format']||'';this['type']=_0x680040['type']||_0x652f('0xa');this[_0x652f('0xb')]=0x0;this[_0x652f('0xc')]=0x0;this[_0x652f('0xd')]=0x0;this[_0x652f('0xe')]=0x0;this[_0x652f('0xf')]=0x0;this[_0x652f('0x10')]=0x0;this[_0x652f('0x11')]=0x0;this['abandoned']=0x0;this[_0x652f('0x12')]=0x0;this[_0x652f('0x13')]=0x0;this[_0x652f('0x14')]=0x0;this[_0x652f('0x15')]=0x0;this[_0x652f('0x16')]=0x0;this['notInUse']=0x0;this[_0x652f('0x17')]=0x0;this['paused']=0x0;this[_0x652f('0x18')]=0x0;this['ringInUse']=0x0;this[_0x652f('0x19')]=0x0;this[_0x652f('0x1a')]=0x0;this['unknown']=0x0;this[_0x652f('0x1b')]=_0x680040['acw']||![];this['acwTimeout']=_0x680040['acwTimeout']||0xa;this[_0x652f('0x1c')]=_0x680040['autopause']||'no';this[_0x652f('0x1d')]=!![];this[_0x652f('0x1e')]='';this[_0x652f('0x1f')]='';this[_0x652f('0x20')]=0x0;this[_0x652f('0x21')]=0x0;this[_0x652f('0x22')]=_0x680040['dialTimezone']||null;this[_0x652f('0x23')]=_0x680040[_0x652f('0x23')]?_0x680040['dialGlobalInterval']:null;this[_0x652f('0x24')]=_0x680040[_0x652f('0x24')];this[_0x652f('0x25')]=_0x680040[_0x652f('0x25')]||_0x652f('0x26');this['dialLimitChannel']=_0x680040[_0x652f('0x27')]||0x0;this[_0x652f('0x28')]=_0x680040[_0x652f('0x28')]||0x0;this[_0x652f('0x29')]=_0x680040[_0x652f('0x29')]||0x1;this[_0x652f('0x2a')]=_0x680040[_0x652f('0x2a')]||_0x652f('0x2b');this[_0x652f('0x2c')]=_0x680040['dialPredictiveOptimizationPercentage']||0.03;this[_0x652f('0x2d')]=_0x680040[_0x652f('0x2d')]||0x258;this[_0x652f('0x2e')]=_0x680040[_0x652f('0x2e')]||_0x652f('0x2f');this['dialOriginateCallerIdNumber']=_0x680040[_0x652f('0x30')]||_0x652f('0x2f');this['dialOriginateTimeout']=_0x680040['dialOriginateTimeout']||0x1e;this[_0x652f('0x31')]=_0x680040[_0x652f('0x31')]||_0x652f('0x32');this[_0x652f('0x33')]=_0x680040[_0x652f('0x33')]||0x3;this['dialQueueProject']=_0x680040[_0x652f('0x34')]||undefined;this[_0x652f('0x35')]=_0x680040[_0x652f('0x35')]||0x3;this[_0x652f('0x36')]=_0x680040[_0x652f('0x36')]||0x96;this['dialBusyMaxRetry']=_0x680040['dialBusyMaxRetry']||0x3;this[_0x652f('0x37')]=_0x680040[_0x652f('0x37')]||0x96;this['dialNoAnswerMaxRetry']=_0x680040[_0x652f('0x38')]||0x3;this['dialNoAnswerRetryFrequency']=_0x680040[_0x652f('0x39')]||0x96;this[_0x652f('0x3a')]=_0x680040[_0x652f('0x3a')]||0x3;this[_0x652f('0x3b')]=_0x680040['dialNoSuchNumberRetryFrequency']||0x96;this[_0x652f('0x3c')]=_0x680040[_0x652f('0x3c')]||0x3;this[_0x652f('0x3d')]=_0x680040[_0x652f('0x3d')]||0x96;this['dialAbandonedMaxRetry']=_0x680040[_0x652f('0x3e')]||0x3;this[_0x652f('0x3f')]=_0x680040[_0x652f('0x3f')]||0x96;this[_0x652f('0x40')]=_0x680040[_0x652f('0x40')]||0x3;this[_0x652f('0x41')]=_0x680040[_0x652f('0x41')]||0x96;this['dialAgentRejectMaxRetry']=_0x680040[_0x652f('0x42')]||0x3;this[_0x652f('0x43')]=_0x680040[_0x652f('0x43')]||0x96;this[_0x652f('0x44')]=_0x680040[_0x652f('0x44')]||0x3;this[_0x652f('0x45')]=_0x680040['dialGlobalMaxRetry']||0x4;this[_0x652f('0x46')]=_0x680040[_0x652f('0x46')]?_0x680040['Trunk']:undefined;this[_0x652f('0x47')]=_0x680040[_0x652f('0x47')]?_0x680040['TrunkBackup']:undefined;this['dialPrefix']=_0x680040[_0x652f('0x48')]||undefined;this[_0x652f('0x49')]=_0x680040[_0x652f('0x49')]?_0x680040[_0x652f('0x49')]:undefined;this[_0x652f('0x4a')]=_0x680040[_0x652f('0x4a')]||_0x652f('0x4b');this[_0x652f('0x4c')]=_0x680040[_0x652f('0x4c')]||undefined;this[_0x652f('0x4d')]=_0x680040[_0x652f('0x4d')]||undefined;this[_0x652f('0x4e')]=strategy[_0x680040[_0x652f('0x4e')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x680040[_0x652f('0x4f')]||![];this['dialAMDInitialSilence']=_0x680040[_0x652f('0x50')];this['dialAMDGreeting']=_0x680040[_0x652f('0x51')];this[_0x652f('0x52')]=_0x680040['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x680040[_0x652f('0x53')];this['dialAMDMinWordLength']=_0x680040[_0x652f('0x54')];this['dialAMDBetweenWordsSilence']=_0x680040[_0x652f('0x55')];this[_0x652f('0x56')]=_0x680040[_0x652f('0x56')];this['dialAMDSilenceThreshold']=_0x680040[_0x652f('0x57')];this[_0x652f('0x58')]=_0x680040[_0x652f('0x58')];this['outboundRejectCallsDay']=0x0;this[_0x652f('0x59')]=0x0;this[_0x652f('0x5a')]=_0x680040[_0x652f('0x5a')];this[_0x652f('0x5b')]=0x0;this[_0x652f('0x5c')]=0x0;this[_0x652f('0x5d')]=0x0;this[_0x652f('0x5e')]=0x0;this[_0x652f('0x5f')]=0x0;this[_0x652f('0x60')]=0x0;this[_0x652f('0x61')]=0x0;this[_0x652f('0x62')]=0x0;this[_0x652f('0x63')]=0x0;this[_0x652f('0x64')]=0x0;this[_0x652f('0x65')]=0x0;this[_0x652f('0x66')]=0x0;this[_0x652f('0x67')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x652f('0x68')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x652f('0x69')]=1.05;this[_0x652f('0x6a')]=0x0;this[_0x652f('0x6b')]=0x0;this[_0x652f('0x6c')]=0x0;this[_0x652f('0x6d')]=0x0;this[_0x652f('0x6e')]=0x0;this[_0x652f('0x6f')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x652f('0x70')]=0x0;this[_0x652f('0x71')]=_0x680040['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x652f('0x72')]=_0x680040[_0x652f('0x73')]||0xa;this[_0x652f('0x74')]=0x0;this[_0x652f('0x75')]=0x0;this[_0x652f('0x76')]=0x1;this[_0x652f('0x77')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x652f('0x78')]=_0x680040['dialRecallMeTimeout']||0x1e;this[_0x652f('0x79')]=_0x680040[_0x652f('0x79')]||![];this[_0x652f('0x7a')]=!!_0x680040[_0x652f('0x7a')]||![];this['dialPreviewRecallmeReminder']=!!_0x680040['dialPreviewRecallmeReminder']||![];this[_0x652f('0x7b')]=_0x680040['dialQueueProject2']||undefined;this[_0x652f('0x7c')]=_0x680040['dialAgiAfterHangupClient']||![];this[_0x652f('0x7d')]=_0x680040[_0x652f('0x7d')]||![];this['monitor_format']=monitorFormat[_0x680040[_0x652f('0x9')]]?monitorFormat[_0x680040[_0x652f('0x9')]]:undefined;this['mandatoryDisposition']=_0x680040[_0x652f('0x7e')]||![];this[_0x652f('0x7f')]=_0x680040['mandatoryDispositionPause']?_0x680040['mandatoryDispositionPause']:undefined;this[_0x652f('0x80')]=![];}module[_0x652f('0x81')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index e8adaa7..5371b48 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 _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 +var _0x0686=['createReport','ringInUse','callers','length','online','incall','includes','status','notInUse','booked','keys','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid'];(function(_0x46c007,_0x51bef3){var _0x3dc844=function(_0x7aa9dc){while(--_0x7aa9dc){_0x46c007['push'](_0x46c007['shift']());}};_0x3dc844(++_0x51bef3);}(_0x0686,0x123));var _0x6068=function(_0x812b,_0x30cde0){_0x812b=_0x812b-0x0;var _0x4c49da=_0x0686[_0x812b];return _0x4c49da;};'use strict';var INBOUND_COUNTERS=[_0x6068('0x0'),_0x6068('0x1'),_0x6068('0x2'),_0x6068('0x3'),_0x6068('0x4'),_0x6068('0x5'),_0x6068('0x6')];var OUTBOUND_COUNTERS=['available',_0x6068('0x7'),_0x6068('0x8'),_0x6068('0x1'),_0x6068('0x2'),_0x6068('0x9'),_0x6068('0xa'),_0x6068('0xb'),_0x6068('0xc'),_0x6068('0xd'),_0x6068('0xe'),'outboundNoAnswerCallsDay',_0x6068('0xf'),_0x6068('0x10'),_0x6068('0x11'),_0x6068('0x12'),_0x6068('0x3'),_0x6068('0x13'),_0x6068('0x5'),'sumBillable',_0x6068('0x14'),_0x6068('0x15'),_0x6068('0x6')];function VoiceQueueSummary(_0x26c658){this['id']=_0x26c658['id'];this[_0x6068('0x16')]=_0x26c658['name'];this[_0x6068('0x17')]=_0x26c658[_0x6068('0x17')];this['abandoned']=_0x26c658[_0x6068('0x18')]||0x0;this[_0x6068('0x7')]=_0x26c658[_0x6068('0x7')]||0x0;this[_0x6068('0x0')]=_0x26c658[_0x6068('0x0')]||0x0;this[_0x6068('0x19')]=_0x26c658[_0x6068('0x19')]||0x0;this[_0x6068('0x8')]=_0x26c658[_0x6068('0x8')]||0x0;this['invalid']=_0x26c658[_0x6068('0x1a')]||0x0;this[_0x6068('0x1')]=_0x26c658['loggedIn']||0x0;this[_0x6068('0x2')]=_0x26c658[_0x6068('0x2')]||0x0;this[_0x6068('0x1b')]=_0x26c658[_0x6068('0x1b')]||0x0;this['notInUse']=_0x26c658['notInUse']||0x0;this[_0x6068('0x3')]=_0x26c658[_0x6068('0x3')]||0x0;this[_0x6068('0x4')]=_0x26c658[_0x6068('0x4')]||0x0;this['ringInUse']=_0x26c658['ringInUse'];this[_0x6068('0x1c')]=_0x26c658[_0x6068('0x1c')];this[_0x6068('0x14')]=_0x26c658[_0x6068('0x14')];this[_0x6068('0x1d')]=_0x26c658[_0x6068('0x1d')]||0x0;this[_0x6068('0x5')]=_0x26c658['talking']||0x0;this['total']=_0x26c658['total']||0x0;this[_0x6068('0x1e')]=_0x26c658[_0x6068('0x1e')];this[_0x6068('0x1f')]=_0x26c658[_0x6068('0x1f')]||0x0;this[_0x6068('0x20')]=_0x26c658[_0x6068('0x20')]||0x0;this[_0x6068('0x21')]=_0x26c658[_0x6068('0x21')]||0x0;this['waiting']=_0x26c658[_0x6068('0x6')]||0x0;if(_0x26c658[_0x6068('0x1e')]==='outbound'){this[_0x6068('0x13')]=_0x26c658[_0x6068('0x13')]||0x0;this[_0x6068('0x22')]=_0x26c658[_0x6068('0x22')];this[_0x6068('0x23')]=_0x26c658['dialMethod'];this[_0x6068('0x24')]=_0x26c658['dialOriginateCallerIdName'];this[_0x6068('0x25')]=_0x26c658[_0x6068('0x25')];this[_0x6068('0x26')]=_0x26c658[_0x6068('0x26')];this[_0x6068('0x27')]=_0x26c658[_0x6068('0x27')];this[_0x6068('0x28')]=_0x26c658[_0x6068('0x28')];this[_0x6068('0x29')]=_0x26c658[_0x6068('0x29')];this['outboundAnswerCallsDay']=_0x26c658[_0x6068('0xb')];this[_0x6068('0xc')]=_0x26c658[_0x6068('0xc')];this[_0x6068('0xd')]=_0x26c658[_0x6068('0xd')];this[_0x6068('0xe')]=_0x26c658[_0x6068('0xe')];this[_0x6068('0x2a')]=_0x26c658['outboundDropCallsDayACS'];this[_0x6068('0x2b')]=_0x26c658[_0x6068('0x2b')];this[_0x6068('0x2c')]=_0x26c658[_0x6068('0x2c')];this[_0x6068('0x2d')]=_0x26c658[_0x6068('0x2d')];this[_0x6068('0xf')]=_0x26c658[_0x6068('0xf')];this['outboundOriginateFailureCallsDay']=_0x26c658[_0x6068('0x2e')];this[_0x6068('0x10')]=_0x26c658[_0x6068('0x10')];this[_0x6068('0x11')]=_0x26c658[_0x6068('0x11')];this[_0x6068('0x12')]=_0x26c658['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x26c658[_0x6068('0x2f')];this['predictiveIntervalAvgHoldtime']=_0x26c658['predictiveIntervalAvgHoldtime'];this[_0x6068('0x30')]=_0x26c658[_0x6068('0x30')];this['predictiveIntervalDroppedCallsCallersExit']=_0x26c658[_0x6068('0x31')];this[_0x6068('0x32')]=_0x26c658[_0x6068('0x32')];this[_0x6068('0x33')]=_0x26c658[_0x6068('0x33')];this[_0x6068('0x34')]=_0x26c658['predictiveIntervalErlangCallsDroppedCalls'];this[_0x6068('0x35')]=_0x26c658[_0x6068('0x35')];this[_0x6068('0x36')]=_0x26c658[_0x6068('0x36')];this[_0x6068('0x37')]=_0x26c658[_0x6068('0x37')];this[_0x6068('0x38')]=_0x26c658['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x26c658[_0x6068('0x39')];this['originated']=_0x26c658[_0x6068('0x9')];this[_0x6068('0x3a')]=_0x26c658[_0x6068('0x3a')];this[_0x6068('0x3b')]=_0x26c658[_0x6068('0x3b')];this['erlangAbandonmentRate']=_0x26c658[_0x6068('0x3c')];this[_0x6068('0x3d')]=_0x26c658['erlangBusyFactor'];this[_0x6068('0x3e')]=_0x26c658['startPredictive'];this['startProgressive']=_0x26c658[_0x6068('0x3f')];this[_0x6068('0x40')]=_0x26c658[_0x6068('0x40')];this[_0x6068('0x41')]=_0x26c658[_0x6068('0x41')];}if(_0x26c658[_0x6068('0x42')]){this[_0x6068('0x42')]={'id':_0x26c658['Trunk']['id'],'name':_0x26c658['Trunk'][_0x6068('0x16')],'active':_0x26c658[_0x6068('0x42')][_0x6068('0x43')],'callerid':_0x26c658[_0x6068('0x42')][_0x6068('0x44')]};}}VoiceQueueSummary['prototype'][_0x6068('0x45')]=function(_0x107f3e,_0x3494e8,_0xebd21c,_0x3d4fab){this[_0x6068('0x2')]=0x0;this[_0x6068('0x5')]=0x0;this['paused']=0x0;this[_0x6068('0x20')]=0x0;this['notInUse']=0x0;this[_0x6068('0x8')]=0x0;this[_0x6068('0x19')]=0x0;this[_0x6068('0x1a')]=0x0;this[_0x6068('0x1f')]=0x0;this[_0x6068('0x4')]=0x0;this[_0x6068('0x46')]=0x0;this[_0x6068('0x1b')]=0x0;if(_0xebd21c){if(_0xebd21c[_0x6068('0x0')]){this[_0x6068('0x0')]=Number(_0xebd21c[_0x6068('0x0')]);}if(_0xebd21c['loggedin']){this[_0x6068('0x1')]=Number(_0xebd21c['loggedin']);}if(_0xebd21c['callers']){this['waiting']=Number(_0xebd21c[_0x6068('0x47')]);}}for(var _0x3d5a18=0x0;_0x3d5a18<_0x107f3e[_0x6068('0x48')];_0x3d5a18++){var _0x116450=_0x3494e8['SIP/'+_0x107f3e[_0x3d5a18][_0x6068('0x16')]];if(_0x116450&&_0x116450[_0x6068('0x49')]){this[_0x6068('0x2')]+=0x1;}if(_0x107f3e[_0x3d5a18][_0x6068('0x4a')]==='1'){this[_0x6068('0x5')]+=0x1;}if(_0x107f3e[_0x3d5a18][_0x6068('0x3')]==='1'&&!['2','7','8'][_0x6068('0x4b')](_0x107f3e[_0x3d5a18][_0x6068('0x4c')])){this['paused']+=0x1;}switch(_0x107f3e[_0x3d5a18][_0x6068('0x4c')]){case'0':this[_0x6068('0x20')]+=0x1;break;case'1':this[_0x6068('0x4d')]+=0x1;break;case'2':this[_0x6068('0x8')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x6068('0x1a')]+=0x1;break;case'5':this[_0x6068('0x1f')]+=0x1;break;case'6':this[_0x6068('0x4')]+=0x1;break;case'7':this[_0x6068('0x46')]+=0x1;break;case'8':this[_0x6068('0x1b')]+=0x1;break;}}if(this[_0x6068('0x23')]===_0x6068('0x4e')){var _0x273756=Object[_0x6068('0x4f')](_0x3d4fab);for(var _0x5e8bf8=0x0;_0x5e8bf8<_0x273756['length'];_0x5e8bf8++){var _0x1eb37d=_0x273756[_0x5e8bf8];var _0x44d298=_0x3d4fab[_0x1eb37d];if(_0x44d298[_0x6068('0x50')]===this['name']&&_0x44d298[_0x6068('0x1e')]===_0x6068('0x51')&&_0x44d298[_0x6068('0x52')]===_0x6068('0x53')){this[_0x6068('0x5')]+=0x1;}}if(this[_0x6068('0x5')]>this[_0x6068('0x8')]){this[_0x6068('0x5')]=this[_0x6068('0x8')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x6068('0x54')][_0x6068('0x55')]=function(_0x19b997){var _0x5d3823=![];if(_0x19b997){_0x5d3823=INBOUND_COUNTERS[_0x6068('0x56')](function(_0x21b8b2){return this[_0x21b8b2]!==_0x19b997[_0x21b8b2];},this);}return _0x5d3823;};VoiceQueueSummary['prototype'][_0x6068('0x57')]=function(_0x1a6f42){var _0x5a3499=![];var _0x446677=![];var _0x79a00f=![];if(_0x1a6f42){_0x5a3499=this[_0x6068('0x23')]!==_0x1a6f42[_0x6068('0x23')]||this[_0x6068('0x22')]!==_0x1a6f42[_0x6068('0x22')]||this['message']!==_0x1a6f42['message']||this[_0x6068('0x41')]!==_0x1a6f42[_0x6068('0x41')];_0x446677=OUTBOUND_COUNTERS[_0x6068('0x56')](function(_0x2bc2a9){return this[_0x2bc2a9]!==_0x1a6f42[_0x2bc2a9];},this);if(this['Trunk']&&_0x1a6f42[_0x6068('0x42')]){_0x79a00f=this['Trunk'][_0x6068('0x16')]!==_0x1a6f42[_0x6068('0x42')]['name']||this[_0x6068('0x42')]['active']!==_0x1a6f42[_0x6068('0x42')]['active'];}}return _0x5a3499||_0x446677||_0x79a00f;};VoiceQueueSummary[_0x6068('0x54')][_0x6068('0x58')]=function(_0x341b46){this[_0x6068('0x7')]=_0x341b46['answered'];this[_0x6068('0x40')]=_0x341b46[_0x6068('0x40')];this[_0x6068('0x41')]=_0x341b46[_0x6068('0x41')];this[_0x6068('0x9')]=_0x341b46[_0x6068('0x9')];this[_0x6068('0xa')]=_0x341b46[_0x6068('0xa')];this[_0x6068('0xb')]=_0x341b46[_0x6068('0xb')];this[_0x6068('0xc')]=_0x341b46['outboundBlacklistCallsDay'];this[_0x6068('0xd')]=_0x341b46[_0x6068('0xd')];this[_0x6068('0xe')]=_0x341b46[_0x6068('0xe')];this['outboundNoAnswerCallsDay']=_0x341b46[_0x6068('0x2d')];this[_0x6068('0xf')]=_0x341b46[_0x6068('0xf')];this['outboundReCallsDay']=_0x341b46[_0x6068('0x10')];this[_0x6068('0x11')]=_0x341b46['outboundRejectCallsDay'];this[_0x6068('0x12')]=_0x341b46[_0x6068('0x12')];this[_0x6068('0x1c')]=_0x341b46[_0x6068('0x1c')];this[_0x6068('0x14')]=_0x341b46['sumDuration'];this[_0x6068('0x15')]=_0x341b46[_0x6068('0x15')];if(this[_0x6068('0x23')]===_0x6068('0x59')){this['pTalking']=_0x341b46[_0x6068('0x13')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index e596462..8f7956c 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 _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 +var _0x418c=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x418c,0x120));var _0xc418=function(_0x3e33f7,_0x32918e){_0x3e33f7=_0x3e33f7-0x0;var _0x422027=_0x418c[_0x3e33f7];return _0x422027;};'use strict';function VtigerAccount(_0x42a2e0){this['id']=_0x42a2e0['id']||0x0;this[_0xc418('0x0')]=_0x42a2e0[_0xc418('0x0')]||'';this[_0xc418('0x1')]=_0x42a2e0[_0xc418('0x1')]||'';this[_0xc418('0x2')]=_0x42a2e0[_0xc418('0x2')]||'';this[_0xc418('0x3')]=_0x42a2e0[_0xc418('0x3')]||'';this[_0xc418('0x4')]=_0x42a2e0[_0xc418('0x4')]||'';this[_0xc418('0x5')]=_0x42a2e0[_0xc418('0x5')]||{};}module[_0xc418('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 07cb6a4..343497d 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 _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 +var _0xfeba=['type','serverUrl','Configurations','name','username','token','remoteUri','authType'];(function(_0x4f9876,_0x2cf1d1){var _0x24b845=function(_0x4079a2){while(--_0x4079a2){_0x4f9876['push'](_0x4f9876['shift']());}};_0x24b845(++_0x2cf1d1);}(_0xfeba,0xeb));var _0xafeb=function(_0x141afc,_0x1822f7){_0x141afc=_0x141afc-0x0;var _0x13750c=_0xfeba[_0x141afc];return _0x13750c;};'use strict';function ZendeskAccount(_0xe6a33){this['id']=_0xe6a33['id']||0x0;this[_0xafeb('0x0')]=_0xe6a33[_0xafeb('0x0')]||'';this[_0xafeb('0x1')]=_0xe6a33['username']||'';this['password']=_0xe6a33['password']||'';this[_0xafeb('0x2')]=_0xe6a33[_0xafeb('0x2')]||'';this[_0xafeb('0x3')]=_0xe6a33[_0xafeb('0x3')]||'';this[_0xafeb('0x4')]=_0xe6a33[_0xafeb('0x4')]||'';this[_0xafeb('0x5')]=_0xe6a33[_0xafeb('0x5')]||'integrationTab';this['serverUrl']=_0xe6a33[_0xafeb('0x6')]||'';this[_0xafeb('0x7')]=_0xe6a33['Configurations']||{};}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 3fc5e36..a2fc2b2 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 _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 +var _0x1ce8=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','host','zone','clientId'];(function(_0x5e404a,_0x4ce384){var _0x1c804d=function(_0x3ffee9){while(--_0x3ffee9){_0x5e404a['push'](_0x5e404a['shift']());}};_0x1c804d(++_0x4ce384);}(_0x1ce8,0xb0));var _0x81ce=function(_0x2adcb7,_0x55e06e){_0x2adcb7=_0x2adcb7-0x0;var _0x29aa90=_0x1ce8[_0x2adcb7];return _0x29aa90;};'use strict';function ZohoAccount(_0x240640){this['id']=_0x240640['id']||0x0;this[_0x81ce('0x0')]=_0x240640[_0x81ce('0x0')]||'';this['description']=_0x240640['description']||'';this[_0x81ce('0x1')]=_0x240640[_0x81ce('0x1')]||'';this['zone']=_0x240640[_0x81ce('0x2')]||'';this[_0x81ce('0x3')]=_0x240640['clientId']||'';this[_0x81ce('0x4')]=_0x240640[_0x81ce('0x4')]||'';this['serverUrl']=_0x240640[_0x81ce('0x5')]||'';this['code']=_0x240640[_0x81ce('0x6')]||'';this[_0x81ce('0x7')]=_0x240640[_0x81ce('0x7')]||'';this[_0x81ce('0x8')]=_0x240640[_0x81ce('0x8')]||{};}module[_0x81ce('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ecbedd7..487a739 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 _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 +var _0x4888=['SIP/%s','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','calleridname','number','exports','lodash','moment','isNil','string','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent'];(function(_0xdfe644,_0xed6928){var _0x32483e=function(_0x42da68){while(--_0x42da68){_0xdfe644['push'](_0xdfe644['shift']());}};_0x32483e(++_0xed6928);}(_0x4888,0x198));var _0x8488=function(_0x3ea022,_0x2d5328){_0x3ea022=_0x3ea022-0x0;var _0x3b97a2=_0x4888[_0x3ea022];return _0x3b97a2;};'use strict';var util=require('util');var _=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));function checkNameSurname(_0x2af900,_0x13b2f0,_0x257275){var _0xacc8f0='';if(!_[_0x8488('0x2')](_0x13b2f0)&&'string'===typeof _0x13b2f0){_0xacc8f0+=_0x13b2f0;}if(!_[_0x8488('0x2')](_0x257275)&&_0x8488('0x3')===typeof _0x257275){_0xacc8f0+='\x20'+_0x257275;}if(_0xacc8f0!==''){return _0xacc8f0;}return _0x2af900;}function Action(_0x1a97f4,_0x421292,_0x326887,_0x19e508,_0x5250a1){this['uniqueid']=_0x326887||undefined;this['idContact']=_0x1a97f4['id'];this['queue']=_0x421292[_0x8488('0x4')];this[_0x8488('0x5')]=_0x421292['type'];this[_0x8488('0x6')]=_0x8488('0x7');this[_0x8488('0x8')]=![];this[_0x8488('0x9')]=_['isNil'](_0x1a97f4[_0x8488('0xa')])?undefined:_0x1a97f4[_0x8488('0xa')][_0x8488('0x4')];this[_0x8488('0xb')]=this[_0x8488('0x9')]?util['format'](_0x8488('0xc'),this[_0x8488('0x9')]):_0x19e508||undefined;this['calleridname']=checkNameSurname(_0x1a97f4['Contact'][_0x8488('0xd')],_0x1a97f4['Contact'][_0x8488('0xe')],_0x1a97f4['Contact']['lastName']);this[_0x8488('0xf')]=_0x1a97f4[_0x8488('0xf')]||![];this[_0x8488('0x10')]=_0x1a97f4[_0x8488('0xd')];this[_0x8488('0x11')]=_0x1a97f4[_0x8488('0x11')];this[_0x8488('0x12')]=_0x1a97f4['countbusyretry']||0x0;this[_0x8488('0x13')]=_0x1a97f4[_0x8488('0x13')]||0x0;this[_0x8488('0x14')]=_0x1a97f4[_0x8488('0x14')]||0x0;this[_0x8488('0x15')]=(_0x1a97f4[_0x8488('0x12')]||0x0)+(_0x1a97f4[_0x8488('0x13')]||0x0)+(_0x1a97f4[_0x8488('0x14')]||0x0)+(_0x1a97f4[_0x8488('0x16')]||0x0)+(_0x1a97f4[_0x8488('0x17')]||0x0)+(_0x1a97f4[_0x8488('0x18')]||0x0)+(_0x1a97f4[_0x8488('0x19')]||0x0)+(_0x1a97f4[_0x8488('0x1a')]||0x0);this['countnosuchnumberretry']=_0x1a97f4['countnosuchnumberretry']||0x0;this[_0x8488('0x17')]=_0x1a97f4[_0x8488('0x17')]||0x0;this[_0x8488('0x18')]=_0x1a97f4[_0x8488('0x18')]||0x0;this[_0x8488('0x19')]=_0x1a97f4[_0x8488('0x19')]||0x0;this[_0x8488('0x1a')]=_0x1a97f4[_0x8488('0x1a')]||0x0;this[_0x8488('0x1b')]=_0x1a97f4['callback'];this[_0x8488('0x1c')]=_0x1a97f4[_0x8488('0x1c')];this[_0x8488('0x1d')]=_0x1a97f4[_0x8488('0x1d')];this[_0x8488('0x1e')]=_0x1a97f4['recallme'];this['ContactId']=_0x1a97f4['ContactId'];this['ListId']=_0x1a97f4[_0x8488('0x1f')];this['UserId']=_['isNil'](_0x1a97f4[_0x8488('0xa')])?_0x1a97f4[_0x8488('0x20')]:_0x1a97f4[_0x8488('0xa')]['id'];this[_0x8488('0x21')]=_0x1a97f4[_0x8488('0x21')];this['originatecalleridnum']='';this[_0x8488('0x22')]='';}Action[_0x8488('0x23')][_0x8488('0x24')]=function(){return util[_0x8488('0x25')](_0x8488('0x26'),this[_0x8488('0x27')],this[_0x8488('0x28')]);};module[_0x8488('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 03e6382..8d63191 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 _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 +var _0x275f=['available','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','isNil','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','status','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','agentReadyId','then','length','scheduledat','Agent','run','catch','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','loggedIn','isActive','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','total','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','outboundBusyCallsDay','dialBusyRetryFrequency','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','custom:amd','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated','ANSWER','destlinkedid','queueSummaryCountersUpdated','isUndefined','object','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','updateOriginated','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','VoiceQueueId','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','variables','[originated][increment]','originated:\x20','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','filterKey','keys','variable','value','error','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','hangup','syncHangup','dialend','syncDialEnd','bind','newexten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking'];(function(_0x11acc9,_0x28841d){var _0x5d4de8=function(_0x19e79d){while(--_0x19e79d){_0x11acc9['push'](_0x11acc9['shift']());}};_0x5d4de8(++_0x28841d);}(_0x275f,0x111));var _0xf275=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0x275f[_0x411e71];return _0x226ae3;};'use strict';var util=require('util');var _=require(_0xf275('0x0'));var uuid=require(_0xf275('0x1'));var moment=require(_0xf275('0x2'));var Redis=require(_0xf275('0x3'));var config=require(_0xf275('0x4'));var logger=require(_0xf275('0x5'))(_0xf275('0x6'));var loggerAction=require(_0xf275('0x5'))(_0xf275('0x7'));var ami=require(_0xf275('0x8'));var rpcDb=require(_0xf275('0x9'));var cmHopperAdditionalPhone=require(_0xf275('0xa'));var Action=require(_0xf275('0xb'));var ut=require(_0xf275('0xc'));var utils=require(_0xf275('0xd'));config[_0xf275('0xe')]=_[_0xf275('0xf')](config[_0xf275('0xe')],{'host':_0xf275('0x10'),'port':0x18eb});var io=require(_0xf275('0x11'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xf275('0x12')][_0xf275('0x13')]=function(_0x53facc){this[_0xf275('0x14')]=this[_0xf275('0x14')]?this[_0xf275('0x14')][_0xf275('0x15')](_0x53facc):_0x53facc();};function Preview(_0xe6acd3){this[_0xf275('0x16')]=new Sequence();this[_0xf275('0x17')]=_0xe6acd3[_0xf275('0x18')];this[_0xf275('0x19')]=_0xe6acd3[_0xf275('0x19')];this[_0xf275('0x1a')]={};this[_0xf275('0x1b')]=_0xe6acd3['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xf275('0x1c')]['bind'](this));ami['on'](_0xf275('0x1d'),this[_0xf275('0x1e')]['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0xf275('0x1f'),this[_0xf275('0x20')][_0xf275('0x21')](this));ami['on'](_0xf275('0x22'),this['syncNewExten']['bind'](this));ami['on'](_0xf275('0x23'),this[_0xf275('0x24')][_0xf275('0x21')](this));ami['on'](_0xf275('0x25'),this['syncAttendedTransfer'][_0xf275('0x21')](this));ami['on'](_0xf275('0x26'),this[_0xf275('0x27')][_0xf275('0x21')](this));this[_0xf275('0x28')](this[_0xf275('0x17')]);}function emit(_0x493b58,_0x53dfad,_0x55a46d){io['to'](_0x493b58)[_0xf275('0x29')](_0x53dfad,_0x55a46d);}function emitVoiceQueueChannelRemove(_0x34bd67){logger[_0xf275('0x2a')](_0xf275('0x2b'),JSON[_0xf275('0x2c')](_0x34bd67));emit(util[_0xf275('0x2d')](_0xf275('0x2e'),_0x34bd67[_0xf275('0x2f')]),_0xf275('0x30'),_0x34bd67);io[_0xf275('0x29')](_0xf275('0x31'),_0x34bd67);}function notSendMessagesQueue(_0x6d9b2b){if(_0x6d9b2b[_0xf275('0x32')]){if(_0x6d9b2b['originated']===0x0&&_0x6d9b2b[_0xf275('0x33')]===0x0){_0x6d9b2b[_0xf275('0x32')]=![];_0x6d9b2b[_0xf275('0x34')]=0x0;_0x6d9b2b['paused']=0x0;_0x6d9b2b[_0xf275('0x35')]=utils[_0xf275('0x36')][_0xf275('0x37')];ut[_0xf275('0x38')](_0xf275('0x39'),_0x6d9b2b[_0xf275('0x2f')]+_0xf275('0x3a'));}else{_0x6d9b2b[_0xf275('0x35')]=utils[_0xf275('0x36')][_0xf275('0x3b')];ut[_0xf275('0x38')](_0xf275('0x39'),_0x6d9b2b['name']+'\x20is\x20deactivated');}}}Preview[_0xf275('0x12')][_0xf275('0x28')]=function(){var _0x45950e=this;setInterval(function(){_0x45950e[_0xf275('0x3c')]();},0x7cf);};Preview[_0xf275('0x12')]['syncCampaigns']=function(){var _0x1386df=this[_0xf275('0x17')];this[_0xf275('0x3d')]+=0x1;for(var _0x34a858 in _0x1386df){if(_0x1386df[_0xf275('0x3e')](_0x34a858)&&(_0x1386df[_0x34a858][_0xf275('0x3f')]===_0xf275('0x6')||_0x1386df[_0x34a858][_0xf275('0x3f')]===_0xf275('0x40'))&&_0x1386df[_0x34a858]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xf275('0x41')]();}}if(_0x1386df[_0xf275('0x3e')](_0x34a858)&&_0x1386df[_0x34a858][_0xf275('0x3f')]===_0xf275('0x6')&&_0x1386df[_0x34a858]['type']==='outbound'){if(_0x1386df[_0x34a858][_0xf275('0x42')]){this[_0xf275('0x43')](_0x1386df[_0x34a858]);if(_0x1386df[_0x34a858][_0xf275('0x44')])this['recallMe'](_0x1386df[_0x34a858]);}else{notSendMessagesQueue(_0x1386df[_0x34a858]);}}}};Preview[_0xf275('0x12')]['clearZombieChannel']=function(_0x5ef6ae){var _0x1b5dc5=this;this[_0xf275('0x16')][_0xf275('0x13')](function(){if(!_[_0xf275('0x45')](_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae])){loggerAction[_0xf275('0x2a')](_0xf275('0x46'),_0x5ef6ae,'Queue',_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae][_0xf275('0x47')],'originated:\x20',JSON[_0xf275('0x2c')](_0x1b5dc5[_0xf275('0x17')][_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae][_0xf275('0x47')]]['originated']),_0xf275('0x48'),JSON[_0xf275('0x2c')](_0x1b5dc5[_0xf275('0x17')][_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae][_0xf275('0x47')]][_0xf275('0x33')]),JSON[_0xf275('0x2c')](_0x1b5dc5['actions'][_0x5ef6ae][_0xf275('0x49')]),JSON[_0xf275('0x2c')](_[_0xf275('0x4a')](_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae],[_0xf275('0x4b'),_0xf275('0x4c'),'VoiceQueueId',_0xf275('0x4d')])));return ami[_0xf275('0x4e')]({'action':_0xf275('0x4f'),'channel':_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae]['channel']})['catch'](function(_0x20ef4d){if(_0x20ef4d['message']===_0xf275('0x50')){setTimeout(function(){if(_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae]){ut['updateOriginated'](_0x1b5dc5['campaignsPreview'][_0x1b5dc5['actions'][_0x5ef6ae][_0xf275('0x47')]],_0xf275('0x51'));if(_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae]['dialAnswer']===!![]){ut[_0xf275('0x52')](_0x1b5dc5[_0xf275('0x17')][_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae]['queue']],_0xf275('0x51'));ut['loggerError'](_0xf275('0x53')+_0x5ef6ae,_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae][_0xf275('0x47')]);}ut[_0xf275('0x54')](_0xf275('0x55')+_0x5ef6ae,_0x1b5dc5['actions'][_0x5ef6ae][_0xf275('0x47')]);delete _0x1b5dc5['actions'][_0x5ef6ae];}},0x2328);}});}});};Preview[_0xf275('0x12')][_0xf275('0x41')]=function(){var _0x2aa6f8=this;loggerAction['info'](_0xf275('0x56'),_[_0xf275('0x57')](this['actions']));for(var _0xbebe43 in this[_0xf275('0x1a')]){if(_0x2aa6f8['actions'][_0xf275('0x3e')](_0xbebe43)){_0x2aa6f8[_0xf275('0x58')](_0xbebe43);}}};Preview['prototype'][_0xf275('0x59')]=function(_0x4280a2){var _0x50ad23=this;rpcDb[_0xf275('0x5a')](_0x4280a2['id'],ut[_0xf275('0x5b')](this[_0xf275('0x1b')]))[_0xf275('0x5c')](function(_0x10d49b){if(!_[_0xf275('0x45')](_0x10d49b)){for(var _0x357b94=0x0;_0x357b94<_0x10d49b[_0xf275('0x5d')];_0x357b94+=0x1){if(ut['getDiff'](_0x10d49b[_0x357b94][_0xf275('0x5e')])<_0x4280a2['dialRecallMeTimeout']*0x3c){if(_0x10d49b[_0x357b94][_0xf275('0x5f')]&&!_0x10d49b[_0x357b94][_0xf275('0x5f')]['voicePause']){_0x50ad23[_0xf275('0x60')](_0x10d49b[_0x357b94]['id'])['then'](ut['logger2']('[RecallMe]'))[_0xf275('0x61')](ut[_0xf275('0x62')](_0xf275('0x63')));}else{rpcDb[_0xf275('0x64')](_0x10d49b[_0x357b94]['id']);}}else{var _0x1c256a=new Action(_0x10d49b[_0x357b94],_0x4280a2);_0x1c256a[_0xf275('0x65')]=moment()[_0xf275('0x2d')](_0xf275('0x66'));_0x4280a2['outboundReCallsDay']+=0x1;ut[_0xf275('0x67')](_0x1c256a,0x17,_0xf275('0x68'));if(_0x4280a2[_0xf275('0x69')]){rpcDb[_0xf275('0x6a')](ut['createBody'](_0x10d49b[_0x357b94]));rpcDb[_0xf275('0x6b')](_0x1c256a,_0xf275('0x6c'));}else{ut[_0xf275('0x67')](_0x1c256a,0x16,_0xf275('0x6d'));rpcDb[_0xf275('0x6b')](_0x1c256a,_0xf275('0x6e'));rpcDb['createCustomerFinal'](_0x1c256a,_0xf275('0x6e'));}}}}})['catch'](ut[_0xf275('0x62')](_0xf275('0x6f')));};Preview[_0xf275('0x12')]['setMessage']=function(_0x4e698a){_0x4e698a[_0xf275('0x32')]=!![];if(ut['IsNotLoggedIn'](_0x4e698a[_0xf275('0x70')])){_0x4e698a[_0xf275('0x35')]=utils[_0xf275('0x36')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xf275('0x71')](_0x4e698a['dialActive'])){_0x4e698a[_0xf275('0x35')]=utils[_0xf275('0x36')][_0xf275('0x37')];}else if(!this['isTrunkReachable'](_0x4e698a[_0xf275('0x72')])){if(!this['isTrunkReachable'](_0x4e698a[_0xf275('0x73')])){_0x4e698a['message']=utils[_0xf275('0x36')][_0xf275('0x74')];}else{_0x4e698a[_0xf275('0x35')]=utils[_0xf275('0x36')][_0xf275('0x75')];}}else{_0x4e698a[_0xf275('0x35')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}};Preview[_0xf275('0x12')][_0xf275('0x76')]=function(_0x1b6482,_0x459b83,_0x432cee){var _0x413910=this;var _0x3733ff=this[_0xf275('0x1a')][_0x459b83];var _0x98a54f=this[_0xf275('0x17')][_0x3733ff['queue']];var _0x3eae73;var _0x27a867=![];var _0x1a8b80=0x2;var _0x456463=0x3;if(_0x98a54f){switch(_0x432cee){case'1':_0x98a54f[_0xf275('0x77')]+=0x1;_0x3733ff[_0xf275('0x78')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x0,_0xf275('0x7b'));ami['emit'](_0xf275('0x7c'),ut[_0xf275('0x7d')](_0x3733ff,'nosuchnumber'));rpcDb[_0xf275('0x6b')](_0x3733ff,'[callProgressDetectingCustomer][logNoSuch]');_0x413910[_0xf275('0x7e')](_0x3733ff,'0',_0x98a54f)[_0xf275('0x5c')](function(_0x5adf8c){_0x27a867=_0x5adf8c[_0xf275('0x7f')]==0x1;_0x1a8b80=_0x98a54f[_0xf275('0x80')];_0x456463=_0x98a54f[_0xf275('0x81')];if(!_0x27a867){if(ut[_0xf275('0x7a')](_0x3733ff)>=_0x98a54f[_0xf275('0x82')]){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0x86'));}else{if(_0x3733ff[_0xf275('0x78')]>=_0x98a54f['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x3733ff,_0xf275('0x86'));}else{rpcDb['rescheduleContact'](ut[_0xf275('0x87')](_0x3733ff,_0xf275('0x78'),_0x98a54f[_0xf275('0x80')]),_0x3733ff[_0xf275('0x88')],_0x3733ff[_0xf275('0x89')]);}}delete this[_0xf275('0x1a')][_0x1b6482[_0xf275('0x8a')]];}else{_0x3733ff[_0xf275('0x78')]++;logger[_0xf275('0x2a')](_0xf275('0x8b'),_0x3733ff[_0xf275('0x78')]);logger[_0xf275('0x2a')]('id',_0x3733ff[_0xf275('0x8c')]);_0x413910[_0xf275('0x8d')]({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countnosuchnumberretry':_0x3733ff[_0xf275('0x78')]}})[_0xf275('0x5c')](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)['then'](function(){});});}});break;case'ANSWER':var _0x5e7722=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3733ff['responsetime']=_0x5e7722;_0x3733ff[_0xf275('0x8f')]=_0x5e7722;_0x3733ff['dialAnswer']=!![];_0x98a54f[_0xf275('0x33')]+=0x1;logger[_0xf275('0x2a')](_0xf275('0x90'),_0x3733ff[_0xf275('0x91')],_0xf275('0x92'),_0x98a54f['name'],_0xf275('0x48'),_0x98a54f['pTalking']);ami['emit'](_0xf275('0x93'),ut[_0xf275('0x7d')](_0x3733ff,_0xf275('0x94'),this['campaignsPreview'][_0x3733ff[_0xf275('0x47')]]));if(_0x98a54f[_0xf275('0x95')]){ami[_0xf275('0x29')]('custom:agentConnectPreview',ut[_0xf275('0x96')](_0x3733ff));}break;case'16':ami[_0xf275('0x29')](_0xf275('0x97'),ut[_0xf275('0x7d')](_0x3733ff,_0xf275('0x98'),this[_0xf275('0x17')][_0x3733ff[_0xf275('0x47')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x3733ff,_0xf275('0x98')));_0x98a54f['outboundAnswerCallsDay']+=0x1;_0x98a54f[_0xf275('0x99')]+=0x1;_0x98a54f['answered']+=0x1;ut['decrementTalkink'](_0x98a54f,'[16]');_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x4,_0xf275('0x9a'));rpcDb['createCustomerHistory'](_0x3733ff,_0xf275('0x9b'));rpcDb['createCustomerFinal'](_0x3733ff,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xf275('0x9c')](_0x3733ff);_0x98a54f['sumDuration']+=_0x3733ff[_0xf275('0x9d')];_0x98a54f[_0xf275('0x9e')]+=_0x3733ff[_0xf275('0x9d')];logger[_0xf275('0x2a')](_0xf275('0x9f'),_0x3733ff[_0xf275('0x91')],_0xf275('0x92'),_0x98a54f[_0xf275('0x2f')],'pTalking:\x20',_0x98a54f[_0xf275('0x33')]);delete this[_0xf275('0x1a')][_0x1b6482[_0xf275('0x8a')]];break;case'BUSY':_0x98a54f[_0xf275('0xa0')]+=0x1;_0x3733ff['countbusyretry']+=0x1;_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x5,'Busy');_0x1a8b80=_0x98a54f[_0xf275('0xa1')];_0x456463=_0x98a54f['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentbusy',ut[_0xf275('0x7d')](_0x3733ff,'busy'));rpcDb[_0xf275('0x6b')](_0x3733ff,_0xf275('0xa2'));_0x413910[_0xf275('0x7e')](_0x3733ff,'5',_0x98a54f)[_0xf275('0x5c')](function(_0x427b5e){_0x27a867=_0x427b5e['additional']==0x1;if(!_0x27a867){if(ut[_0xf275('0x7a')](_0x3733ff)>=_0x98a54f[_0xf275('0x82')]){_0x3eae73=ut['cloneAction'](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xa3'));}else{if(_0x3733ff[_0xf275('0xa4')]>=_0x98a54f[_0xf275('0xa5')]){rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xa2'));}else{rpcDb['rescheduleContact'](ut[_0xf275('0x87')](_0x3733ff,'countbusyretry',_0x98a54f[_0xf275('0xa1')]),_0x3733ff[_0xf275('0x88')],_0x3733ff[_0xf275('0x89')]);}}}else{_0x3733ff['countbusyretry']++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countbusyretry':_0x3733ff[_0xf275('0xa4')]}})[_0xf275('0x5c')](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)['then'](function(){});});}});break;case _0xf275('0xa6'):_0x98a54f[_0xf275('0xa7')]+=0x1;_0x3733ff[_0xf275('0xa8')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut['totalGlobal'](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x3,_0xf275('0xa9'));_0x1a8b80=_0x98a54f[_0xf275('0xaa')];_0x456463=_0x98a54f[_0xf275('0x81')];var _0x5af372=ut['buildNoAnswerEventPayload'](_0x3733ff,_0x98a54f);ami[_0xf275('0x29')](_0xf275('0xab'),_0x5af372);rpcDb[_0xf275('0x6b')](_0x3733ff,'[callProgressDetectingCustomer][logNoAnswer]');_0x413910['verifyAdditionalPhones'](_0x3733ff,'3',_0x98a54f)[_0xf275('0x5c')](function(_0x47576a){_0x27a867=_0x47576a[_0xf275('0x7f')]==0x1;if(!_0x27a867){if(ut['totalGlobal'](_0x3733ff)>=_0x98a54f[_0xf275('0x82')]){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xac'));}else{if(_0x3733ff[_0xf275('0xa8')]>=_0x98a54f['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x3733ff,_0xf275('0xad'));}else{rpcDb[_0xf275('0xae')](ut[_0xf275('0x87')](_0x3733ff,_0xf275('0xa8'),_0x98a54f[_0xf275('0xaa')]),_0x3733ff[_0xf275('0x88')],_0x3733ff[_0xf275('0x89')]);}}}else{_0x3733ff['countnoanswerretry']++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff['idContact'],'field':{'countnoanswerretry':_0x3733ff[_0xf275('0xa8')]}})[_0xf275('0x5c')](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});});}});break;case _0xf275('0xaf'):_0x98a54f[_0xf275('0xb0')]+=0x1;_0x3733ff[_0xf275('0xb1')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x8,_0xf275('0xb2'));_0x1a8b80=_0x98a54f[_0xf275('0xb3')];_0x456463=_0x98a54f[_0xf275('0x81')];ami[_0xf275('0x29')]('custom:agentcongestion',ut['buildObj'](_0x3733ff,'congestion'));rpcDb[_0xf275('0x6b')](_0x3733ff,_0xf275('0xb4'));_0x413910[_0xf275('0x7e')](_0x3733ff,'8',_0x98a54f)[_0xf275('0x5c')](function(_0x1f8035){_0x27a867=_0x1f8035[_0xf275('0x7f')]==0x1;if(!_0x27a867){if(ut['totalGlobal'](_0x3733ff)>=_0x98a54f['dialGlobalMaxRetry']){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xb5'));}else{if(_0x3733ff[_0xf275('0xb1')]>=_0x98a54f[_0xf275('0xb6')]){rpcDb['createCustomerFinal'](_0x3733ff,_0xf275('0xb4'));}else{rpcDb[_0xf275('0xae')](ut[_0xf275('0x87')](_0x3733ff,_0xf275('0xb1'),_0x98a54f[_0xf275('0xa1')]),_0x3733ff['unlockAgent'],_0x3733ff[_0xf275('0x89')]);}}}else{_0x3733ff['countcongestionretry']++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countcongestionretry':_0x3733ff['countcongestionretry']}})['then'](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});});}});break;case'CANCEL':_0x98a54f['outboundRejectCallsDay']+=0x1;_0x3733ff[_0xf275('0xb7')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut['totalGlobal'](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x14,_0xf275('0xb8'));_0x1a8b80=_0x98a54f[_0xf275('0xb9')];_0x456463=_0x98a54f[_0xf275('0x81')];ami[_0xf275('0x29')](_0xf275('0xba'),ut[_0xf275('0x7d')](_0x3733ff,'agentreject'));rpcDb[_0xf275('0x6b')](_0x3733ff,'[syncHangupRequest][logAgentReject]');_0x413910[_0xf275('0x7e')](_0x3733ff,'20',_0x98a54f)[_0xf275('0x5c')](function(_0x59683c){_0x27a867=_0x59683c['additional']==0x1;if(!_0x27a867){if(ut['totalGlobal'](_0x3733ff)>=_0x98a54f['dialGlobalMaxRetry']){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0x14,'AgentReject');rpcDb[_0xf275('0x85')](_0x3eae73,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x3733ff[_0xf275('0xb7')]>=_0x98a54f['dialAgentRejectMaxRetry']){rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xbb'));}else{rpcDb[_0xf275('0xae')](ut['scheduledAt'](_0x3733ff,_0xf275('0xb7'),_0x98a54f[_0xf275('0xb9')]),_0x3733ff[_0xf275('0x88')],_0x3733ff['activeContact']);}}}else{_0x3733ff[_0xf275('0xa8')]++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countnoanswerretry':_0x3733ff[_0xf275('0xa8')]}})[_0xf275('0x5c')](function(){_0x413910['swapAdditionalPhones'](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});});}});break;case _0xf275('0xbc'):_0x98a54f[_0xf275('0xbd')]+=0x1;_0x3733ff[_0xf275('0xbe')]+=0x1;_0x3733ff['countglobal']=ut[_0xf275('0x7a')](_0x3733ff);ut['logCustomer'](_0x3733ff,0xb,_0xf275('0xbf'));rpcDb[_0xf275('0x6b')](_0x3733ff,_0xf275('0xc0'));_0x413910[_0xf275('0x7e')](_0x3733ff,'11',_0x98a54f)[_0xf275('0x5c')](function(_0x6f3325){_0x27a867=_0x6f3325[_0xf275('0x7f')]==0x1;if(!_0x27a867){if(ut[_0xf275('0x7a')](_0x3733ff)>=_0x98a54f['dialGlobalMaxRetry']){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0xf,'Global');rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xc0'));}else{if(_0x3733ff[_0xf275('0xc1')]>=_0x98a54f[_0xf275('0xc2')]){rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xc0'));}else{rpcDb[_0xf275('0xae')](ut['scheduledAt'](_0x3733ff,_0xf275('0xbe'),_0x98a54f[_0xf275('0xc3')]),_0x3733ff['unlockAgent'],_0x3733ff['activeContact']);}}}else{_0x3733ff['countnoanswerretry']++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countnoanswerretry':_0x3733ff['countnoanswerretry']}})[_0xf275('0x5c')](function(){_0x413910['swapAdditionalPhones'](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});});}});break;case'18':_0x98a54f[_0xf275('0xc4')]+=0x1;_0x3733ff[_0xf275('0xc5')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x12,_0x1b6482['cause-txt']||_0x1b6482[_0xf275('0xc6')]);ami[_0xf275('0x29')]('custom:amd',ut[_0xf275('0x7d')](_0x3733ff,_0xf275('0xc7')));rpcDb['createCustomerHistory'](_0x3733ff,_0xf275('0xc8'));_0x413910[_0xf275('0x7e')](_0x3733ff,'18',_0x98a54f)[_0xf275('0x5c')](function(_0x5aa198){_0x27a867=_0x5aa198[_0xf275('0x7f')]==0x1;if(!_0x27a867){if(ut[_0xf275('0x7a')](_0x3733ff)>=_0x98a54f[_0xf275('0x82')]){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0x12,'Global');rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xc8'));}else{rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xc8'));}}else{_0x3733ff[_0xf275('0xa8')]++;_0x413910['incrementPreviewCounters']({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countnoanswerretry':_0x3733ff[_0xf275('0xa8')]}})[_0xf275('0x5c')](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});});}});delete this[_0xf275('0x1a')][_0x1b6482['linkedid']];break;case'19':_0x98a54f[_0xf275('0xc4')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x13,_0x1b6482[_0xf275('0xc9')]||_0x1b6482[_0xf275('0xc6')]);ami[_0xf275('0x29')](_0xf275('0xca'),ut[_0xf275('0x7d')](_0x3733ff,'amd'));rpcDb[_0xf275('0x6b')](_0x3733ff,'[callProgressDetectingCustomer][machine]');_0x413910['verifyAdditionalPhones'](_0x3733ff,'18',_0x98a54f)[_0xf275('0x5c')](function(_0x459346){_0x27a867=_0x459346[_0xf275('0x7f')]==0x1;if(!_0x27a867){if(ut[_0xf275('0x7a')](_0x3733ff)>=_0x98a54f['dialGlobalMaxRetry']){_0x3eae73=ut['cloneAction'](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xcb'));}else{rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xcb'));}}else{_0x3733ff['countnoanswerretry']++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff['idContact'],'field':{'countnoanswerretry':_0x3733ff[_0xf275('0xa8')]}})['then'](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)['then'](function(){});});}});delete this['actions'][_0x1b6482[_0xf275('0x8a')]];break;default:if(_0x3733ff['dialAnswer']){ut['decrementTalkink'](_0x98a54f,'[default]');ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x98a54f['name'],_0x1b6482);}_0x98a54f['outboundUnknownCallsDay']+=0x1;_0x3733ff[_0xf275('0x79')]=ut['totalGlobal'](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0xc,_0x1b6482[_0xf275('0xc9')]||_0x1b6482[_0xf275('0xc6')]);_0x1a8b80=_0x98a54f[_0xf275('0xb9')];_0x456463=_0x98a54f[_0xf275('0x81')];rpcDb[_0xf275('0x6b')](_0x3733ff,_0xf275('0xcc'));_0x413910[_0xf275('0x7e')](_0x3733ff,'20',_0x98a54f)[_0xf275('0x5c')](function(_0x438809){_0x27a867=_0x438809['additional']==0x1;if(!_0x27a867){if(ut['totalGlobal'](_0x3733ff)>=_0x98a54f[_0xf275('0x82')]){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xcd'));}delete this[_0xf275('0x1a')][_0x1b6482[_0xf275('0x8a')]];}else{_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});}});}if(!(_0x3733ff[_0xf275('0x49')]&&_0x432cee==='16')){ut['updateOriginated'](_0x98a54f,_0xf275('0xce'));logger[_0xf275('0x2a')]('[originated][decrement][callProgressDetectingCustomer]',_0x3733ff[_0xf275('0x91')],_0xf275('0x92'),_0x98a54f[_0xf275('0x2f')],'originated:\x20',_0x98a54f[_0xf275('0xcf')]);}if(_0x432cee!==_0xf275('0xd0')){delete this[_0xf275('0x1a')][_0x1b6482['linkedid']];delete this[_0xf275('0x1a')][_0x1b6482[_0xf275('0xd1')]];}_0x98a54f[_0xf275('0xd2')]=!![];}};Preview[_0xf275('0x12')]['callProgressDetectingAgent']=function(_0x45424f,_0x4022a5,_0x24c055){if(_[_0xf275('0xd3')](_0x4022a5)&&_0xf275('0xd4')!==typeof _0x4022a5){return;}if(_[_0xf275('0xd3')](_0x24c055)&&_0xf275('0xd4')!==typeof _0x24c055){return;}switch(_0x24c055['reason']){case'0':ut['logAgent'](_0x45424f,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x45424f,_0xf275('0xd5'));break;case'3':ut[_0xf275('0xd6')](_0x45424f,0x3,_0xf275('0xa9'));rpcDb[_0xf275('0xd7')](_0x45424f,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xf275('0xd6')](_0x45424f,0x5,_0xf275('0xd8'));rpcDb['createAgentHistory'](_0x45424f,_0xf275('0xd9'));break;case'8':ut[_0xf275('0xd6')](_0x45424f,0x8,_0xf275('0xb2'));rpcDb[_0xf275('0xd7')](_0x45424f,_0xf275('0xda'));break;case'22':ut[_0xf275('0xd6')](_0x45424f,0x16,_0xf275('0xdb'));rpcDb[_0xf275('0xd7')](_0x45424f,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xf275('0xd6')](_0x45424f,0xc,_0x24c055[_0xf275('0xdc')]);rpcDb[_0xf275('0xd7')](_0x45424f,_0xf275('0xda'));}ut[_0xf275('0xdd')](_0x4022a5,_0xf275('0xde'));logger['info'](_0xf275('0xdf'),_0x45424f[_0xf275('0x91')],_0xf275('0x92'),_0x4022a5[_0xf275('0x2f')],'originated:\x20',_0x4022a5[_0xf275('0xcf')]);delete this['actions'][_0x45424f[_0xf275('0x91')]];};Preview['prototype']['verifyAdditionalPhones']=function(_0x27be6a,_0x5593b2,_0x30c258){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x27be6a,_0x5593b2,_0x30c258)[_0xf275('0x61')](logger[_0xf275('0x2a')](_0xf275('0xe0')));};Preview[_0xf275('0x12')][_0xf275('0x8e')]=function(_0x17764e,_0x58d77c,_0x356a6e){return cmHopperAdditionalPhone[_0xf275('0x8e')](_0x17764e,_0x58d77c,_0x356a6e)[_0xf275('0x61')](logger[_0xf275('0x2a')](_0xf275('0xe1')));};Preview[_0xf275('0x12')][_0xf275('0x8d')]=function(_0x49bf68){return Promise[_0xf275('0xe2')]()[_0xf275('0x5c')](cmHopperAdditionalPhone[_0xf275('0x8d')](_0x49bf68))[_0xf275('0x61')](logger[_0xf275('0x2a')](_0xf275('0xe3')));};Preview[_0xf275('0x12')][_0xf275('0xe4')]=function(_0xe650c7,_0x117953,_0x28027e,_0x525b82,_0xd4870d){var _0x6a4326=this;return new Promise(function(_0x39ae99,_0xe1483){if(_[_0xf275('0x45')](_0x117953)||_[_0xf275('0x45')](_0x117953[_0xf275('0xe5')])||_[_0xf275('0x45')](_0x117953[_0xf275('0xe6')])||_['isNil'](_0x117953['VoiceQueueId'])){_0xe1483(ut[_0xf275('0x35')](_0xf275('0xe7'),_0x525b82,_0xd4870d));return;}var _0x4aa4e2=uuid['v4']();var _0x2b30f8=_0x6a4326['campaignsPreview'][_0x117953[_0xf275('0xe8')]['name']];var _0x3023a4=_0x28027e?_0x6a4326[_0xf275('0x1b')][_0x28027e]['id']:undefined;_0x6a4326[_0xf275('0x1a')][_0x4aa4e2]=new Action(_0x117953,_0x2b30f8,_0x4aa4e2,_0x28027e,_0x3023a4);var _0x324cdc=_0x6a4326['actions'][_0x4aa4e2];_0x324cdc[_0xf275('0x88')]=_0x525b82;_0x324cdc[_0xf275('0x89')]=_0xd4870d;_0x324cdc[_0xf275('0xe9')]=_0x28027e;if(_[_0xf275('0xea')](_0xe650c7)){_0x6a4326[_0xf275('0xeb')](_0x324cdc,_0x2b30f8,_0x117953,_0x28027e)[_0xf275('0x5c')](function(_0x2b3866){logger['info'](_0xf275('0xec'),_0xf275('0xed')+_0x324cdc[_0xf275('0x47')]+_0xf275('0xee')+_0x324cdc[_0xf275('0x8c')],JSON['stringify'](_0x2b3866));ami[_0xf275('0x29')](_0xf275('0xef'),ut['buildObj'](_0x324cdc,_0xf275('0xf0'),_0x6a4326[_0xf275('0x17')][_0x324cdc[_0xf275('0x47')]]));_0x39ae99(ut['message'](_0xf275('0xf1')));})[_0xf275('0x61')](function(_0x43aba8){ut[_0xf275('0x38')](_0xf275('0xf2'),_0x43aba8);_0xe1483(ut[_0xf275('0x35')](_0xf275('0xf3'),_0x525b82,_0xd4870d));});}else{_0x2b30f8[_0xf275('0xf4')]+=0x1;ut['logBlacklist'](_0x324cdc);rpcDb[_0xf275('0xf5')](_0x324cdc,_0xf275('0xf6'));delete _0x6a4326[_0xf275('0x1a')][_0x4aa4e2];_0xe1483(ut[_0xf275('0x35')](_0xf275('0xf7'),_0x525b82,_0xd4870d));}});};Preview[_0xf275('0x12')][_0xf275('0xf8')]=function(_0xc556a7){return!_[_0xf275('0x45')](_0xc556a7)&&!_[_0xf275('0x45')](_0xc556a7[_0xf275('0x2f')])&&!_[_0xf275('0x45')](_0xc556a7['active'])&&_0xc556a7[_0xf275('0xf9')]&&!_['isNil'](this[_0xf275('0x19')][util[_0xf275('0x2d')]('SIP/%s',_0xc556a7[_0xf275('0x2f')])])&&!_['isNil'](this[_0xf275('0x19')][util[_0xf275('0x2d')](_0xf275('0xfa'),_0xc556a7[_0xf275('0x2f')])][_0xf275('0x4f')])&&(this[_0xf275('0x19')][util[_0xf275('0x2d')](_0xf275('0xfa'),_0xc556a7['name'])]['status']===_0xf275('0xfb')||this[_0xf275('0x19')][util['format'](_0xf275('0xfa'),_0xc556a7[_0xf275('0x2f')])]['status']===_0xf275('0xfc'));};Preview[_0xf275('0x12')]['run']=function(_0x237e45,_0x7b2d8c){return this[_0xf275('0xfd')](_0x237e45,_0x7b2d8c)[_0xf275('0x5c')](function(_0x161178){return _['pick'](_0x161178,['message']);})[_0xf275('0x61')](function(_0x4923c3){if(_0x4923c3[_0xf275('0xfe')]){rpcDb[_0xf275('0xff')](_0x237e45);}if(_0x4923c3['active']){rpcDb['disableContact'](_0x237e45);}throw _[_0xf275('0x4a')](_0x4923c3,[_0xf275('0x35')]);});};Preview[_0xf275('0x12')][_0xf275('0xfd')]=function(_0x8fd422,_0x3d24cf){var _0x39687a=this;var _0x2be3d9,_0x10dfaa;return rpcDb[_0xf275('0x100')](_0x8fd422)[_0xf275('0x5c')](function(_0x5c7cdc){if(!_[_0xf275('0x45')](_0x5c7cdc[0x0])){_0x10dfaa=_0x5c7cdc[0x0][_0xf275('0x101')]?![]:!![];_0x2be3d9=_0x5c7cdc[0x0]['recallme']?!![]:![];_0x2be3d9=_0x3d24cf?!![]:_0x2be3d9;}var _0x574b34=_0x39687a['validateContact'](_0x5c7cdc);if(_0x574b34[_0xf275('0x102')]){rpcDb[_0xf275('0x103')](_['pick'](_0x5c7cdc[0x0],[_0xf275('0x104'),_0xf275('0xe6')]))[_0xf275('0x5c')](function(_0x422bee){_0x39687a[_0xf275('0xe4')](_0x422bee,_0x5c7cdc[0x0],_0x3d24cf,_0x10dfaa,_0x2be3d9)[_0xf275('0x5c')](function(_0x43e14d){return _0x43e14d;})['catch'](function(_0x4f1e88){throw _0x4f1e88;});})[_0xf275('0x61')](function(_0x1e25ae){ut['logger'](_0xf275('0x105'),_0x1e25ae);throw ut[_0xf275('0x35')](_0xf275('0x106'),_0x10dfaa,_0x2be3d9);});}else{throw ut[_0xf275('0x35')](_0x574b34[_0xf275('0x35')],_0x10dfaa,_0x2be3d9);}})[_0xf275('0x61')](function(_0xca836b){ut[_0xf275('0x38')](_0xf275('0x107'),_0xca836b);throw ut[_0xf275('0x35')](_0xf275('0x106'),![],!![]);});};Preview[_0xf275('0x12')][_0xf275('0x108')]=function(_0xd70dcf){if(_[_0xf275('0x45')](_0xd70dcf)||_['isEmpty'](_0xd70dcf)||!_[_0xf275('0x45')](_0xd70dcf[0x0][_0xf275('0x5f')])&&_['isNil'](_0xd70dcf[0x0][_0xf275('0x5f')][_0xf275('0x2f')])){ut[_0xf275('0x38')](_0xf275('0x109'),_0xd70dcf);return{'isValid':![],'message':_0xf275('0x10a')};}var _0x399b0c=this[_0xf275('0x17')][_0xd70dcf[0x0]['Queue']['name']];_0x399b0c[_0xf275('0x35')]=utils[_0xf275('0x36')][_0xf275('0x75')];if(_['isNil'](_0x399b0c)){ut[_0xf275('0x38')](_0xf275('0x10b'),_0x399b0c);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xf275('0xf8')](_0x399b0c['Trunk'])){ut[_0xf275('0x38')](_0xf275('0x10c'),_0xf275('0x10d')+_0x399b0c['name']+_0xf275('0x10e'));if(!this[_0xf275('0xf8')](_0x399b0c[_0xf275('0x73')])){ut[_0xf275('0x38')](_0xf275('0x10c'),_0x399b0c[_0xf275('0x2f')]+_0xf275('0x10f'));return{'isValid':![],'message':_0xf275('0x110')};}}if(!ut['isActive'](_0x399b0c['dialActive'])){ut[_0xf275('0x38')]('[Preview][validateContact][Campaign\x20Active]',_0x399b0c[_0xf275('0x2f')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x399b0c[_0xf275('0x2f')]+_0xf275('0x111')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0xf275('0xeb')]=function(_0x399bd8,_0x70912,_0x1f16eb,_0x3af53b){var _0xeb6174=this;return new Promise(function(_0x57c2d1,_0x180d0f){var _0x26e2c3=_0x399bd8[_0xf275('0x91')];var _0x4ed301=_0xeb6174[_0xf275('0xf8')](_0x70912['Trunk'])?util[_0xf275('0x2d')](_0xf275('0x112'),_0x70912[_0xf275('0x72')]['name'],_[_0xf275('0x45')](_0x70912[_0xf275('0x113')])?'':_0x70912['dialPrefix'][_0xf275('0x114')]()||'',_0x70912[_0xf275('0x115')]>0x0?_0x1f16eb[_0xf275('0xe6')]['substring'](_0x70912[_0xf275('0x115')]):_0x1f16eb['phone']):util[_0xf275('0x2d')]('SIP/%s/%s%s',_[_0xf275('0x45')](_0x70912[_0xf275('0x73')])?_0x70912[_0xf275('0x72')][_0xf275('0x2f')]:_0x70912[_0xf275('0x73')][_0xf275('0x2f')],_['isNil'](_0x70912[_0xf275('0x113')])?'':_0x70912[_0xf275('0x113')][_0xf275('0x114')]()||'',_0x70912[_0xf275('0x115')]>0x0?_0x1f16eb[_0xf275('0xe6')]['substring'](_0x70912[_0xf275('0x115')]):_0x1f16eb[_0xf275('0xe6')]);var _0xebe072=_0xeb6174[_0xf275('0xf8')](_0x70912[_0xf275('0x72')])?ut[_0xf275('0x116')](_0x70912['Trunk'][_0xf275('0x117')],_0x70912[_0xf275('0x118')],_0x70912[_0xf275('0x119')]>0x0?ut[_0xf275('0x11a')](_0x70912[_0xf275('0x11b')],_0x70912[_0xf275('0x119')]):_0x70912['dialOriginateCallerIdNumber']):ut[_0xf275('0x116')](_['isNil'](_0x70912['TrunkBackup'])?_0x70912[_0xf275('0x72')][_0xf275('0x117')]:_0x70912[_0xf275('0x73')][_0xf275('0x117')],_0x70912[_0xf275('0x118')],_0x70912['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xf275('0x11a')](_0x70912[_0xf275('0x11b')],_0x70912[_0xf275('0x119')]):_0x70912[_0xf275('0x11b')]);if(_0xebe072){_0x399bd8[_0xf275('0x11c')]=ut[_0xf275('0x11d')](_0xebe072);_0x399bd8[_0xf275('0x11e')]=ut[_0xf275('0x11f')](_0xebe072);}var _0x2ba5ec=ut[_0xf275('0x120')](_0x70912,_0x1f16eb,_0x4ed301,_0xebe072,_0x26e2c3,_0x399bd8);var _0x25ff6e=utils[_0xf275('0x121')](_0x1f16eb['Contact']);Object[_0xf275('0x122')](_0x2ba5ec,_0x25ff6e);_[_0xf275('0x123')](_0x399bd8,ut['toLowerVariables'](_0x2ba5ec));_0x399bd8[_0xf275('0x65')]=moment()[_0xf275('0x2d')](_0xf275('0x66'));_0x70912[_0xf275('0x124')]=_0x2ba5ec;var _0x392a2a=ut['variablesAction'](_0x399bd8,_0x70912,_0x2ba5ec,_0x399bd8['activeContact'],_0x3af53b);return ami[_0xf275('0x4e')](_0x392a2a)[_0xf275('0x5c')](function(_0x1432cf){_0x70912[_0xf275('0xcf')]+=0x1;logger[_0xf275('0x2a')](_0xf275('0x125'),_0x26e2c3,_0xf275('0x92'),_0x70912[_0xf275('0x2f')],_0xf275('0x126'),_0x70912[_0xf275('0xcf')]);_0x57c2d1(_0x1432cf);})[_0xf275('0x61')](function(_0x27be1d){ut[_0xf275('0xd6')](_0x399bd8,0xe,'OriginateError');rpcDb[_0xf275('0xd7')](_0x399bd8,_0xf275('0x127'));_0x180d0f(_0x27be1d);});});};Preview[_0xf275('0x12')][_0xf275('0x128')]=function(_0x324cb1){if(this[_0xf275('0x1a')][_0x324cb1[_0xf275('0x8a')]]){this[_0xf275('0x1a')][_0x324cb1[_0xf275('0x8a')]][_0xf275('0x129')]=_0x324cb1['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x5b1cf8){var _0x27d361=this;var _0x4e7545=this[_0xf275('0x1a')][_0x5b1cf8[_0xf275('0x12a')]];if(_0x4e7545){if(_0x4e7545[_0xf275('0xe9')]&&this[_0xf275('0x1b')][_0x4e7545[_0xf275('0xe9')]]){ut['logLookAgent'](_0x4e7545,this[_0xf275('0x1b')][_0x4e7545[_0xf275('0xe9')]][_0xf275('0x2f')],this[_0xf275('0x1b')][_0x4e7545['lookAgent']]['id']);}var _0x9a746=_[_0xf275('0x12b')](_0x4e7545);_0x9a746['responsetime']=moment()[_0xf275('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x451a93=_0x27d361[_0xf275('0x17')][_0x4e7545[_0xf275('0x47')]];if(ut[_0xf275('0x12c')](_0x5b1cf8[_0xf275('0x12d')])){if(_0x4e7545[_0xf275('0x88')]){rpcDb[_0xf275('0xff')](_0x4e7545[_0xf275('0x8c')]);}if(_0x4e7545[_0xf275('0x89')]){rpcDb['disableContact'](_0x4e7545['idContact']);}ami['emit'](_0xf275('0x12e'),ut[_0xf275('0x7d')](_0x4e7545,_0xf275('0x12f'),this['campaignsPreview'][_0x4e7545[_0xf275('0x47')]]));this['callProgressDetectingAgent'](_0x9a746,_0x451a93,_0x5b1cf8);}else{_0x4e7545[_0xf275('0x65')]=moment()[_0xf275('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x9a746,0x4,'Answer');rpcDb[_0xf275('0xd7')](_0x9a746,_0xf275('0x130'));}}};Preview[_0xf275('0x12')][_0xf275('0x1e')]=function(_0x5bfaf8){var _0x299f9c=this[_0xf275('0x1a')][_0x5bfaf8[_0xf275('0x8a')]];var _0x27f94d;if(_0x299f9c){_0x27f94d=this[_0xf275('0x17')][_0x299f9c[_0xf275('0x47')]];logger[_0xf275('0x2a')](_0xf275('0x131'),_0x5bfaf8[_0xf275('0x8a')],_0xf275('0x92'),_0x27f94d[_0xf275('0x2f')],_0xf275('0x48'),_0x27f94d[_0xf275('0x33')]);}if(this['actions'][_0x5bfaf8[_0xf275('0x8a')]]&&_0x5bfaf8[_0xf275('0x8a')]!==_0x5bfaf8[_0xf275('0x91')]){if(_0x5bfaf8[_0xf275('0x132')]==='16'&&this[_0xf275('0x1a')][_0x5bfaf8['linkedid']][_0xf275('0x49')]){this[_0xf275('0x76')](_0x5bfaf8,_0x5bfaf8[_0xf275('0x8a')],_0x5bfaf8['cause']);}else if(this[_0xf275('0x1a')][_0x5bfaf8[_0xf275('0x8a')]][_0xf275('0x49')]){logger[_0xf275('0x2a')](_0xf275('0x133'),_0x5bfaf8['linkedid'],_0x5bfaf8[_0xf275('0x132')],_0xf275('0x92'),_0x27f94d[_0xf275('0x2f')],'pTalking:\x20',_0x27f94d[_0xf275('0x33')]);this[_0xf275('0x76')](_0x5bfaf8,_0x5bfaf8[_0xf275('0x8a')],_0x5bfaf8[_0xf275('0x132')]);}}else if(_0x299f9c&&_[_0xf275('0x45')](_0x299f9c['statedesc'])&&_0x27f94d[_0xf275('0x134')]&&_0x5bfaf8[_0xf275('0x8a')]===_0x5bfaf8[_0xf275('0x91')]&&_['isNil'](_0x5bfaf8[_0xf275('0xdc')])&&_0x5bfaf8['cause']==='16'&&_0x5bfaf8[_0xf275('0x135')]==='6'&&_[_0xf275('0xd3')](_0x299f9c[_0xf275('0x136')])){if(_0x299f9c[_0xf275('0x88')]){rpcDb[_0xf275('0xff')](_0x299f9c[_0xf275('0x8c')]);}if(_0x299f9c['activeContact']){rpcDb[_0xf275('0x64')](_0x299f9c[_0xf275('0x8c')]);}_0x5bfaf8[_0xf275('0xdc')]='22';this['callProgressDetectingAgent'](_0x299f9c,_0x27f94d,_0x5bfaf8);}else if(_0x299f9c&&_0x299f9c[_0xf275('0x136')]){if(_0x5bfaf8[_0xf275('0x132')]==='16'&&this[_0xf275('0x1a')][_0x5bfaf8['linkedid']][_0xf275('0x49')]){logger['info'](_0xf275('0x137'),_0x5bfaf8[_0xf275('0x8a')],_0x5bfaf8['cause'],_0xf275('0x92'),_0x27f94d['name'],'pTalking:\x20',_0x27f94d[_0xf275('0x33')]);this[_0xf275('0x76')](_0x5bfaf8,_0x5bfaf8[_0xf275('0x8a')],_0x5bfaf8[_0xf275('0x132')]);}else if(this[_0xf275('0x1a')][_0x5bfaf8[_0xf275('0x8a')]][_0xf275('0x49')]){logger[_0xf275('0x2a')]('[syncHangup][talking][cause]',_0x5bfaf8[_0xf275('0x8a')],_0x5bfaf8[_0xf275('0x132')],_0xf275('0x92'),_0x27f94d['name'],_0xf275('0x48'),_0x27f94d[_0xf275('0x33')]);this[_0xf275('0x76')](_0x5bfaf8,_0x5bfaf8['linkedid'],_0x5bfaf8[_0xf275('0x132')]);}}};Preview[_0xf275('0x12')][_0xf275('0x20')]=function(_0x3d5e2c){if(this[_0xf275('0x1a')][_0x3d5e2c[_0xf275('0xd1')]]&&_0x3d5e2c['destlinkedid']!==_0x3d5e2c[_0xf275('0x138')]){this[_0xf275('0x76')](_0x3d5e2c,_0x3d5e2c[_0xf275('0xd1')],_0x3d5e2c[_0xf275('0xc6')]);}};Preview['prototype'][_0xf275('0x139')]=function(_0x1923e1){if(this['actions'][_0x1923e1['linkedid']]&&_0x1923e1[_0xf275('0x8a')]!==_0x1923e1['uniqueid']&&!this[_0xf275('0x1a')][_0x1923e1[_0xf275('0x8a')]][_0xf275('0x49')]){if(_0x1923e1[_0xf275('0x132')]==='1'){this[_0xf275('0x76')](_0x1923e1,_0x1923e1['linkedid'],_0x1923e1[_0xf275('0x132')]);}}};Preview[_0xf275('0x12')][_0xf275('0x13a')]=function(_0x1a4ef5,_0x56d031,_0x344a4f){if(this[_0xf275('0x1a')][_0x1a4ef5]){if(_['isNil'](this['actions'][_0x1a4ef5][_0xf275('0x124')])){this[_0xf275('0x1a')][_0x1a4ef5]['variables']={};}this[_0xf275('0x1a')][_0x1a4ef5]['variables'][_0x56d031]=_0x344a4f;}};Preview[_0xf275('0x12')]['syncVarSet']=function(_0x53f45e){try{if(!_[_0xf275('0x45')](_0x53f45e)){if(ut[_0xf275('0x13b')](_['keys'](_0x53f45e['variable'])[0x0])){this[_0xf275('0x13a')](_0x53f45e['uniqueid'],_[_0xf275('0x13c')](_0x53f45e[_0xf275('0x13d')])[0x0],_0x53f45e[_0xf275('0x13e')]);}}}catch(_0x2e5d9c){logger[_0xf275('0x13f')]('[syncVarSet][Preview]',util[_0xf275('0x140')](_0x2e5d9c,{'showHidden':![],'depth':null}));}};Preview[_0xf275('0x12')][_0xf275('0x141')]=function(_0x11036a){if(_0x11036a){if(this[_0xf275('0x1a')][_0x11036a[_0xf275('0x142')]]){this[_0xf275('0x1a')][_0x11036a[_0xf275('0x142')]]['transfer']=!![];}}};Preview[_0xf275('0x12')]['syncBlindTransfer']=function(_0x5656ae){if(_0x5656ae){if(this['actions'][_0x5656ae['transfererlinkedid']]){this[_0xf275('0x1a')][_0x5656ae[_0xf275('0x143')]][_0xf275('0x136')]=!![];}}};module[_0xf275('0x144')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 4370f64..7eef595 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 _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 +var _0x6559=['unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','rescheduleContact','util','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20'];(function(_0x434409,_0x3bebe2){var _0x36bf49=function(_0x50e769){while(--_0x50e769){_0x434409['push'](_0x434409['shift']());}};_0x36bf49(++_0x3bebe2);}(_0x6559,0x187));var _0x9655=function(_0x79a6e8,_0x1c2b24){_0x79a6e8=_0x79a6e8-0x0;var _0xeeb993=_0x6559[_0x79a6e8];return _0xeeb993;};'use strict';var util=require(_0x9655('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x9655('0x1'));var cmHopper=require(_0x9655('0x2'));var cmHopperHistory=require(_0x9655('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x9655('0x4'));function loggerCatch(_0x55fdba){return function(_0x4b3747){logger[_0x9655('0x5')](_0x55fdba,util[_0x9655('0x6')](_0x4b3747,{'showHidden':![],'depth':null}));};}function create(_0x152f57){return cmHopperHistory['createHistory'](_0x152f57)[_0x9655('0x7')](loggerCatch(_0x9655('0x8')));}function createAgent(_0x4ed073){return BPromise[_0x9655('0x9')]()[_0x9655('0xa')](agentReportPreview['createHistory'](_0x4ed073))[_0x9655('0x7')](loggerCatch(_0x9655('0x8')));}function moveContact(_0x3b5d7a){return cmHopper[_0x9655('0xb')](_0x3b5d7a,!![])[_0x9655('0x7')](loggerCatch(_0x9655('0xc')));}exports[_0x9655('0xd')]=function(_0x5585b5){return cmHopperBlack[_0x9655('0xd')](_0x5585b5)[_0x9655('0x7')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x53c671){return BPromise[_0x9655('0x9')]()[_0x9655('0xa')](cmHopper[_0x9655('0xe')](_0x53c671))['catch'](loggerCatch(_0x9655('0xf')));};exports[_0x9655('0x10')]=function(_0x15b106,_0x46e519){create(_0x15b106)[_0x9655('0x7')](loggerCatch(_0x46e519));moveContact(_0x15b106)[_0x9655('0x7')](loggerCatch(_0x46e519));};exports[_0x9655('0x11')]=function(_0x56275b,_0x19e097){createAgent(_0x56275b)[_0x9655('0x7')](loggerCatch(_0x19e097));};exports[_0x9655('0x12')]=function(_0x41a574,_0x5237f9){create(_0x41a574)['catch'](loggerCatch(_0x5237f9));};exports[_0x9655('0x13')]=function(_0x3c4e0f,_0x525547){moveContact(_0x3c4e0f)[_0x9655('0x7')](loggerCatch(_0x525547));};exports['rescheduleContact']=function(_0x28c4d2,_0x46c95f,_0x3e91e3){if(_0x46c95f){_0x28c4d2[_0x9655('0x14')]=null;}if(_0x3e91e3){_0x28c4d2[_0x9655('0x15')]=![];}return cmHopper['rescheduleContact'](_0x28c4d2)['catch'](loggerCatch(_0x9655('0x16')));};exports[_0x9655('0x17')]=function(_0x5aec8e){return cmHopper[_0x9655('0x17')](_0x5aec8e)[_0x9655('0x7')](loggerCatch(_0x9655('0x18')));};exports[_0x9655('0x19')]=function(_0x24f197){return cmHopper[_0x9655('0x19')]({'UserId':null},_0x24f197,0x1)['catch'](loggerCatch(_0x9655('0x1a')));};exports['disableContact']=function(_0x545127){return cmHopper['unlockContact']({'active':![]},_0x545127,0x1)['catch'](loggerCatch(_0x9655('0x1b')));};exports[_0x9655('0x1c')]=function(_0x1c57f9){var _0x30d9a2={};_0x30d9a2[_0x9655('0x1d')]=_0x1c57f9['type'];_0x30d9a2['uniqueid']=_0x1c57f9[_0x9655('0x1e')];_0x30d9a2[_0x9655('0x1f')]=_0x1c57f9[_0x9655('0x1f')];_0x30d9a2[_0x9655('0x20')]=_0x1c57f9[_0x9655('0x20')];_0x30d9a2[_0x9655('0x21')]=_0x1c57f9[_0x9655('0x21')];_0x30d9a2['queuecallerjoinAt']=_0x1c57f9['answertime'];_0x30d9a2[_0x9655('0x22')]=_0x1c57f9[_0x9655('0x23')];_0x30d9a2[_0x9655('0x24')]=0x1;_0x30d9a2['queuecallercompleteAt']=_0x1c57f9[_0x9655('0x25')];_0x30d9a2[_0x9655('0x26')]=_0x1c57f9['membername'];_0x30d9a2[_0x9655('0x27')]=_0x9655('0x28');_0x30d9a2[_0x9655('0x29')]=_0x9655('0x2a');_0x30d9a2[_0x9655('0x2b')]=0x0;_0x30d9a2['assigned']=0x1;_0x30d9a2[_0x9655('0x2c')]=_0x1c57f9[_0x9655('0x2d')];_0x30d9a2['queuecallerexitreason']=_0x9655('0x2e');return BPromise['resolve']()[_0x9655('0xa')](voiceQueueReport[_0x9655('0x2f')](_0x30d9a2))[_0x9655('0x7')](loggerCatch(_0x9655('0x30')));};exports['getContactRecallMe']=function(_0x2b659d,_0x44d752){return BPromise[_0x9655('0x9')]()['then'](cmHopper[_0x9655('0x31')](_0x2b659d,_0x44d752))[_0x9655('0x7')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x9655('0x32')]=function(_0x5a7e2d){return cmHopper[_0x9655('0x33')](_0x5a7e2d,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 7d39d3d..2632d38 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 _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 +var _0xe038=['campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','recallme','UserId','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridNumber','match','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','../../../../config/logger','env','XCALLY_IP_AGI','../../dialer/utils','error','inspect','logger','info','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','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','responsetime','endtime','logAgent','state','ringtime','getSeconds','starttime','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','variablesAction','calleridname','uniqueid','originate','channelAgent','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','voice','mandatoryDisposition','buildObj','buildAcw','queue','interface','agentReadyId','getDiff','milliseconds','seconds','filterKey','type'];(function(_0x2301ab,_0x12a3a8){var _0x4837b8=function(_0x49daae){while(--_0x49daae){_0x2301ab['push'](_0x2301ab['shift']());}};_0x4837b8(++_0x12a3a8);}(_0xe038,0xa8));var _0x8e03=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xe038[_0x1928c9];return _0x51b5fb;};'use strict';var util=require(_0x8e03('0x0'));var _=require('lodash');var moment=require(_0x8e03('0x1'));var logger=require(_0x8e03('0x2'))('preview');var ipAgi=process[_0x8e03('0x3')][_0x8e03('0x4')]||'127.0.0.1';var utils=require(_0x8e03('0x5'));exports['loggerCatch']=function(_0x4aaef0){return function(_0x3c6a54){logger[_0x8e03('0x6')](_0x4aaef0,util[_0x8e03('0x7')](_0x3c6a54,{'showHidden':![],'depth':null}));};};exports[_0x8e03('0x8')]=function(_0x55dd54,_0x21f768){logger[_0x8e03('0x9')](_0x55dd54,util[_0x8e03('0x7')](_0x21f768,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x989791,_0x481f4f){logger[_0x8e03('0x6')](_0x989791,util['inspect'](_0x481f4f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3d4756){return function(_0x4bc589){logger['info'](_0x3d4756,util[_0x8e03('0x7')](_0x4bc589,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x4b6ae9,_0x519f19,_0x3475f1){return{'message':_0x4b6ae9,'unlock':_0x519f19,'active':_0x3475f1};};exports[_0x8e03('0xa')]=function(_0x13ff42,_0x2892a3,_0x428a3d){if(!_[_0x8e03('0xb')](_0x428a3d)&&_0x8e03('0xc')===typeof _0x428a3d&&!_['isEmpty'](_0x428a3d)){if(!_[_0x8e03('0xb')](_0x2892a3)&&_0x8e03('0xc')===typeof _0x2892a3&&!_[_0x8e03('0xd')](_0x2892a3)){return util[_0x8e03('0xe')](_0x8e03('0xf'),_0x2892a3,_0x428a3d);}return util[_0x8e03('0xe')](_0x8e03('0xf'),_0x428a3d,_0x428a3d);}if(!_['isUndefined'](_0x13ff42)&&'string'===typeof _0x13ff42&&!_[_0x8e03('0xd')](_0x13ff42)){return _0x13ff42;}return _0x8e03('0x10');};exports['isActive']=function(_0x3f7cba){if(_[_0x8e03('0x11')](_0x3f7cba)){return![];}return _0x3f7cba;};exports['addVariables']=function(_0x6c70ad,_0x2b6d27,_0x19926b,_0x584c58,_0x4009e3,_0x10590e){var _0x1cca2e={'XMD-QUEUE':_0x2b6d27['Queue']?_0x2b6d27[_0x8e03('0x12')]['name']:'','XMD-CALLERID':_0x584c58,'XMD-CALLERID-PREVIEW':_0x10590e?util[_0x8e03('0xe')](_0x8e03('0xf'),_0x10590e['calleridname'],_0x10590e[_0x8e03('0x13')]):_0x584c58,'XMD-DIALID':_0x4009e3,'XMD-CONTACTID':_0x2b6d27[_0x8e03('0x14')],'XMD-CDRTYPE':_0x8e03('0x15'),'CALLERID(all)':_0x584c58,'XMD-VOICEQUEUEID':_0x2b6d27[_0x8e03('0x16')],'XMD-DIALCHANNEL':_0x19926b,'XMD-DIALTIMEOUT':_0x6c70ad[_0x8e03('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0x8e03('0xe')](_0x8e03('0x18'),_0x6c70ad['dialQueueProject2']?'g':'',_[_0x8e03('0xd')](_0x6c70ad[_0x8e03('0x19')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x6c70ad[_0x8e03('0x1a')]||'','XMD-AGI':_0x6c70ad[_0x8e03('0x1b')]?util['format'](_0x8e03('0x1c'),ipAgi,_0x6c70ad[_0x8e03('0x1b')]):_0x8e03('0x1d'),'XMD-AGIAFTER':_0x6c70ad[_0x8e03('0x1e')]?util[_0x8e03('0xe')](_0x8e03('0x1c'),ipAgi,_0x6c70ad[_0x8e03('0x1e')]):_0x8e03('0x1d'),'XMD-ORIGINATECALLERIDNUM':_0x10590e?_0x10590e[_0x8e03('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x10590e?_0x10590e[_0x8e03('0x20')]:'','XMD-DESTINATION':_0x8e03('0x21'),'SIPADDHEADER':_0x8e03('0x22')};if(!_[_0x8e03('0xd')](_0x6c70ad[_0x8e03('0x19')])){_0x1cca2e[util[_0x8e03('0xe')]('%s',_0x8e03('0x23'))]=_0x6c70ad[_0x8e03('0x19')];_0x1cca2e[util[_0x8e03('0xe')]('%s',_0x8e03('0x24'))]=_0x4009e3;}return _0x1cca2e;};exports[_0x8e03('0x25')]=function(_0x50690a){var _0x2881e8={};for(var _0x93bbd3 in _0x50690a){if(_0x50690a[_0x8e03('0x26')](_0x93bbd3)){_0x2881e8[util[_0x8e03('0xe')]('%s',_[_0x8e03('0x27')](_0x93bbd3))]=_0x50690a[_0x93bbd3];}}return{'variables':_0x2881e8};};exports[_0x8e03('0x28')]=function(_0x1b551a,_0x35db4a){if(!_[_0x8e03('0x11')](_0x1b551a)){if(_0x1b551a[_0x8e03('0x26')](_0x8e03('0x29'))){if(_0x1b551a[_0x8e03('0x29')]>0x0){_0x1b551a[_0x8e03('0x29')]-=0x1;}else{logger['error'](_0x8e03('0x2a'),_0x35db4a);}}}else{logger[_0x8e03('0x6')](_0x8e03('0x2b'),_0x35db4a);}};exports[_0x8e03('0x2c')]=function(_0x47a9e1){var _0x165525=moment()['format'](_0x8e03('0x2d'));_0x47a9e1['state']=0xd;_0x47a9e1[_0x8e03('0x2e')]=_0x8e03('0x2f');_0x47a9e1['starttime']=_0x165525;_0x47a9e1[_0x8e03('0x30')]=_0x165525;_0x47a9e1[_0x8e03('0x31')]=_0x165525;};exports[_0x8e03('0x32')]=function(_0x13d81d,_0x47d8e1,_0x491478){var _0x1be37f=moment()[_0x8e03('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x13d81d[_0x8e03('0x33')]=_0x47d8e1;_0x13d81d[_0x8e03('0x2e')]=_0x491478;_0x13d81d['responsetime']=_0x1be37f;_0x13d81d[_0x8e03('0x34')]=utils[_0x8e03('0x35')](_0x13d81d[_0x8e03('0x30')],_0x13d81d[_0x8e03('0x36')]);};exports[_0x8e03('0x37')]=function(_0x4953f9,_0x557203,_0x2b64d6){_0x4953f9[_0x8e03('0x38')]=_0x557203;_0x4953f9['UserId']=_0x2b64d6;};exports[_0x8e03('0x39')]=function(_0x3c9954,_0x302a84,_0x4eeb6e){var _0x566e6c=moment()[_0x8e03('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c9954[_0x8e03('0x33')]=_0x302a84;_0x3c9954['statedesc']=_0x4eeb6e;_0x3c9954[_0x8e03('0x30')]=_0x3c9954['responsetime']?_0x3c9954[_0x8e03('0x30')]:_0x566e6c;_0x3c9954['endtime']=_0x3c9954[_0x8e03('0x31')]?_0x3c9954[_0x8e03('0x31')]:_0x566e6c;_0x3c9954[_0x8e03('0x34')]=utils[_0x8e03('0x35')](_0x3c9954['responsetime']||0x0,_0x3c9954['starttime']||0x0);_0x3c9954[_0x8e03('0x3a')]=_0x3c9954[_0x8e03('0x3b')]?utils[_0x8e03('0x35')](_0x3c9954[_0x8e03('0x31')],_0x3c9954[_0x8e03('0x3b')]):0x0;};exports[_0x8e03('0x3c')]=function(_0x510626){return _0x510626==='Failure';};exports[_0x8e03('0x3d')]=function(_0x4036de,_0x2a7b98,_0x3606d3,_0x419344,_0xbd63ab){var _0x1c76df=_0x419344?'RECALL':_0x4036de[_0x8e03('0x3e')];_0x1c76df=_0xbd63ab?'BOOKED':_0x1c76df;return{'actionid':_0x4036de[_0x8e03('0x3f')],'action':_0x8e03('0x40'),'channel':_0x4036de[_0x8e03('0x41')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x1c76df,_0x4036de['calleridnum']),'Exten':_0x8e03('0x21'),'Context':'from-sip','Priority':'1','variable':_0x3606d3,'timeout':(_0x2a7b98[_0x8e03('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4036de['uniqueid']};};exports['totalGlobal']=function(_0x2a39cf){return _0x2a39cf[_0x8e03('0x43')]+_0x2a39cf['countcongestionretry']+_0x2a39cf[_0x8e03('0x44')]+_0x2a39cf[_0x8e03('0x45')]+_0x2a39cf[_0x8e03('0x46')];};exports['cloneAction']=function(_0x4a959a){var _0x47a09d=_[_0x8e03('0x47')](_0x4a959a);_0x47a09d[_0x8e03('0x33')]=0xf;_0x47a09d['statedesc']='Global';return _0x47a09d;};exports[_0x8e03('0x48')]=function(_0x313f12,_0x4b3117,_0x4a9858){var _0x4921d8={};_0x4921d8[_0x4b3117]=_0x313f12[_0x4b3117];_0x4921d8[_0x8e03('0x49')]=![];_0x4921d8[_0x8e03('0x4a')]=moment()[_0x8e03('0x4b')](_0x4a9858,'minutes')[_0x8e03('0xe')](_0x8e03('0x2d'));_0x4921d8[_0x8e03('0x14')]=_0x313f12[_0x8e03('0x14')];_0x4921d8[_0x8e03('0x4c')]=_0x313f12[_0x8e03('0x4c')];_0x4921d8[_0x8e03('0x16')]=_0x313f12[_0x8e03('0x16')]||undefined;return _0x4921d8;};exports[_0x8e03('0x4d')]=function(_0x538708,_0xb13b3e){if(!_[_0x8e03('0x11')](_0x538708)){if(_0x538708[_0x8e03('0x4e')]>0x0){_0x538708['pTalking']-=0x1;}else{logger[_0x8e03('0x6')](_0xb13b3e,_0x8e03('0x4f'));}}else{logger[_0x8e03('0x6')](_0xb13b3e,_0x8e03('0x50'));}};exports[_0x8e03('0x51')]=function(_0x5eac3d){if(_0x5eac3d<=0x0){return!![];}return![];};function buildObj(_0x3cc5ae,_0x17fbc4,_0x1bdd8d){_0x3cc5ae[_0x8e03('0x52')]=_0x17fbc4;_0x3cc5ae[_0x8e03('0x53')]=_0x3cc5ae['queue'];_0x3cc5ae['interface']=_0x3cc5ae[_0x8e03('0x41')];_0x3cc5ae['motionChannel']=_0x8e03('0x54');if(_0x1bdd8d){_0x3cc5ae[_0x8e03('0x55')]=_0x1bdd8d[_0x8e03('0x55')];}return _0x3cc5ae;}exports[_0x8e03('0x56')]=buildObj;exports[_0x8e03('0x57')]=function(_0x5e6852){var _0x169e91={};_0x169e91[_0x8e03('0x58')]=_0x5e6852['queue'];_0x169e91[_0x8e03('0x59')]=_0x5e6852[_0x8e03('0x41')];_0x169e91['uniqueid']=_0x5e6852[_0x8e03('0x3f')];return _0x169e91;};exports[_0x8e03('0x5a')]=function(_0x393636){var _0x4c2824=[];for(var _0x34205a in _0x393636){if(_0x393636[_0x8e03('0x26')](_0x34205a)){if(!_[_0x8e03('0x11')](_0x393636[_0x34205a])&&_0x393636[_0x34205a][_0x8e03('0x33')]==='not_inuse'&&_0x393636[_0x34205a]['status']==='reachable'){_0x4c2824['push'](_0x393636[_0x34205a]['id']);}}}return _0x4c2824;};exports[_0x8e03('0x5b')]=function(_0x4db3a4){var _0x149f0d=moment()[_0x8e03('0x5c')](0x0);var _0xdbc328=moment(_0x4db3a4)['milliseconds'](0x0);return _0x149f0d['diff'](_0xdbc328,_0x8e03('0x5d'));};exports['createBody']=function(_0x58fc03){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x58fc03[_0x8e03('0x14')],'ListId':_0x58fc03[_0x8e03('0x4c')],'VoiceQueueId':_0x58fc03[_0x8e03('0x16')]||undefined,'CampaignId':_0x58fc03['CampaignId']||undefined};};exports[_0x8e03('0x5e')]=function(_0x3b458f){if(_0x3b458f===_0x8e03('0x3f')||_0x3b458f==='idContact'||_0x3b458f==='queue'||_0x3b458f===_0x8e03('0x5f')||_0x3b458f===_0x8e03('0x60')||_0x3b458f===_0x8e03('0x61')||_0x3b458f===_0x8e03('0x38')||_0x3b458f===_0x8e03('0x41')||_0x3b458f===_0x8e03('0x3e')||_0x3b458f===_0x8e03('0x49')||_0x3b458f===_0x8e03('0x13')||_0x3b458f==='scheduledat'||_0x3b458f===_0x8e03('0x43')||_0x3b458f==='countcongestionretry'||_0x3b458f===_0x8e03('0x44')||_0x3b458f===_0x8e03('0x62')||_0x3b458f===_0x8e03('0x63')||_0x3b458f===_0x8e03('0x64')||_0x3b458f==='callbackat'||_0x3b458f===_0x8e03('0x65')||_0x3b458f===_0x8e03('0x14')||_0x3b458f===_0x8e03('0x4c')||_0x3b458f===_0x8e03('0x66')||_0x3b458f===_0x8e03('0x16')||_0x3b458f==='sipcallid'||_0x3b458f==='xmd-voicequeueid'||_0x3b458f===_0x8e03('0x67')||_0x3b458f===_0x8e03('0x68')||_0x3b458f===_0x8e03('0x69')||_0x3b458f===_0x8e03('0x6a')||_0x3b458f===_0x8e03('0x6b')||_0x3b458f===_0x8e03('0x6c')||_0x3b458f===_0x8e03('0x6d')||_0x3b458f==='xmd-dialchannel'||_0x3b458f==='xmd-contactid'||_0x3b458f===_0x8e03('0x6e')||_0x3b458f===_0x8e03('0x6f')||_0x3b458f==='xmd-agiafter'||_0x3b458f==='xmd-agi'||_0x3b458f===_0x8e03('0x70')||_0x3b458f==='rtpaudioqosbridged'||_0x3b458f===_0x8e03('0x71')||_0x3b458f===_0x8e03('0x72')||_0x3b458f===_0x8e03('0x73')||_0x3b458f===_0x8e03('0x74')||_0x3b458f===_0x8e03('0x75')||_0x3b458f==='rtpaudioqosrttbridged'||_0x3b458f===_0x8e03('0x70')||_0x3b458f===_0x8e03('0x76')||_0x3b458f===_0x8e03('0x71')||_0x3b458f===_0x8e03('0x72')||_0x3b458f===_0x8e03('0x73')||_0x3b458f===_0x8e03('0x74')||_0x3b458f===_0x8e03('0x75')||_0x3b458f===_0x8e03('0x77')||_0x3b458f==='bridgepeer'||_0x3b458f===_0x8e03('0x78')||_0x3b458f===_0x8e03('0x33')||_0x3b458f===_0x8e03('0x2e')){return![];}return!![];};exports[_0x8e03('0x79')]=function(_0x2b4ba8,_0xb2701a){var _0x1ea5cf,_0x5a56d7,_0x197707;if(_0xb2701a<=0x0){_0xb2701a=0x1;}_0x1ea5cf=new RegExp('\x5cw{0,'+_0xb2701a+'}$');_0x5a56d7=Math[_0x8e03('0x7a')](0xa,_0xb2701a-0x1);_0x197707=Math[_0x8e03('0x7a')](0xa,_0xb2701a)-0x1;return util[_0x8e03('0xe')]('%s',_[_0x8e03('0x7b')](_0x2b4ba8,_0x1ea5cf,_[_0x8e03('0x7c')](_0x5a56d7,_0x197707)));};exports['extractCalleridName']=function(_0x4dd738){var _0x362f63=_0x4dd738['match'](/"(.*?)"/);return _0x362f63?_0x362f63[0x1]:_0x4dd738;};exports[_0x8e03('0x7d')]=function(_0x1830af){var _0x35984b=_0x1830af[_0x8e03('0x7e')](/<(.*?)>/);return _0x35984b?_0x35984b[0x1]:_0x1830af;};function buildNoAnswerEventPayload(_0x50f19a,_0x53babd){var _0x2d2ac7=buildObj(_0x50f19a,_0x8e03('0x7f'));if(!_['isEmpty'](_0x53babd[_0x8e03('0x80')])){Object['keys'](_0x53babd['variables'])[_0x8e03('0x81')](function(_0x32711f){_0x2d2ac7[_0x32711f[_0x8e03('0x82')]()]=_0x53babd[_0x8e03('0x80')][_0x32711f];});}return _0x2d2ac7;}exports[_0x8e03('0x83')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a74ee2c..74b467a 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 _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 +var _0xd1a3=['number','boolean','queuepause','reload','voicequeuechannelhangup','voicequeuechannelredirect','string'];(function(_0x288f73,_0x5d378b){var _0x417fe3=function(_0x2ebdc3){while(--_0x2ebdc3){_0x288f73['push'](_0x288f73['shift']());}};_0x417fe3(++_0x5d378b);}(_0xd1a3,0xc3));var _0x3d1a=function(_0x534e79,_0x24dbfe){_0x534e79=_0x534e79-0x0;var _0x381f13=_0xd1a3[_0x534e79];return _0x381f13;};'use strict';exports['queueadd']={'queue':{'type':_0x3d1a('0x0'),'required':!![]},'interface':{'type':_0x3d1a('0x0'),'required':!![]},'membername':{'type':_0x3d1a('0x0'),'required':!![]},'penalty':{'type':_0x3d1a('0x1'),'required':![]},'paused':{'type':_0x3d1a('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x3d1a('0x0'),'required':!![]}};exports[_0x3d1a('0x3')]={'interface':{'type':_0x3d1a('0x0'),'required':!![]},'paused':{'type':_0x3d1a('0x2')},'reason':{'type':_0x3d1a('0x0'),'required':![]}};exports[_0x3d1a('0x4')]={'module':{'type':_0x3d1a('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x3d1a('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x3d1a('0x0'),'required':!![]},'filename':{'type':_0x3d1a('0x0')},'format':{'type':_0x3d1a('0x0')},'mixmonitorid':{'type':'string'}};exports[_0x3d1a('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x3d1a('0x6')]={'uniqueid':{'type':_0x3d1a('0x0'),'required':!![]},'exten':{'type':_0x3d1a('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 ce9530b..4b2338a 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 _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 +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x562fdb,_0x5684bb){var _0x318876=function(_0xcd34d9){while(--_0xcd34d9){_0x562fdb['push'](_0x562fdb['shift']());}};_0x318876(++_0x5684bb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x23fe6d,_0x4ec422){_0x23fe6d=_0x23fe6d-0x0;var _0x3854c0=_0x5f2f[_0x23fe6d];return _0x3854c0;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index a53dced..5eac97c 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 _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 +var _0x53dd=['hasOwnProperty'];(function(_0x258862,_0x24f1f8){var _0x14e744=function(_0x5bdc56){while(--_0x5bdc56){_0x258862['push'](_0x258862['shift']());}};_0x14e744(++_0x24f1f8);}(_0x53dd,0x1e7));var _0xd53d=function(_0x23f9a2,_0x30eef5){_0x23f9a2=_0x23f9a2-0x0;var _0x3b9c50=_0x53dd[_0x23f9a2];return _0x3b9c50;};'use strict';function mergeDBDataToRealtime(_0x43eb8c,_0x1e0e52){var _0x15ebd1=Object['assign']({},_0x43eb8c);for(var _0x2c3b31 in _0x1e0e52){if(_0x15ebd1[_0xd53d('0x0')](_0x2c3b31)){_0x15ebd1[_0x2c3b31]=_0x1e0e52[_0x2c3b31];}}return _0x15ebd1;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 240c65c..b9f9f1d 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 _0x2883=['membername','monitor','monitors','monitorFilename','filename','createdAt','exten','xcally-motion-preview','connectedlinename','xcally-motion-dialer','voiceAgentReport','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','attendedTransfer','exports','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','attendedtransfer','findAgent','find','isNil','accountcode','SIP/%s','length','lastAssignedTo','name','interface','format','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','calleridpreview','originatecalleridnum','destinationchannel','callerid','disposition','connectedlinenum','\x22%s\x22\x20<%s>','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;_0x54530a','calleridname','transfers','uniqueid','blindTransfer','linkedid','getCallType','UserId','monitor','monitors','monitorFilename','filename','connectedlinename','membername'];(function(_0x5c6272,_0xd82df5){var _0x19c236=function(_0x332352){while(--_0x332352){_0x5c6272['push'](_0x5c6272['shift']());}};_0x19c236(++_0xd82df5);}(_0xa3d2,0x11a));var _0x2a3d=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0xa3d2[_0x4164f2];return _0x2575c7;};'use strict';var _=require(_0x2a3d('0x0'));var moment=require('moment');var util=require(_0x2a3d('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x2a3d('0x2'));var RpcVoiceCallReport=require(_0x2a3d('0x3'));var RpcVoiceDialReport=require(_0x2a3d('0x4'));var RpcMemberReport=require(_0x2a3d('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x2a3d('0x6'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x2a3d('0x7'));var VoiceDialReport=require(_0x2a3d('0x8'));var UserReport=require('./userReport');function Report(_0x40268b){this['realtime']=_0x40268b;this['agents']=_0x40268b[_0x2a3d('0x9')];this[_0x2a3d('0xa')]=_0x40268b[_0x2a3d('0xa')];}Report['prototype']['sync']=function(_0x5ce405){var _0x570c38=new VoiceQueueReport(this[_0x2a3d('0xb')]);var _0x3c0524=new VoiceAgentReport(this[_0x2a3d('0xb')]);var _0xded9be=new VoiceDialReport(this[_0x2a3d('0xb')]);var _0x1a36ce=new VoiceCallReport(this[_0x2a3d('0xb')]);var _0x69730a=new UserReport(this['realtime']);if(config[_0x2a3d('0xc')]&&config[_0x2a3d('0xc')][_0x2a3d('0xd')]){ami['on'](_0x2a3d('0xe'),this[_0x2a3d('0xf')]['bind'](this));ami['on'](_0x2a3d('0x10'),this[_0x2a3d('0x11')][_0x2a3d('0x12')](this));ami['on'](_0x2a3d('0x13'),this[_0x2a3d('0x14')][_0x2a3d('0x12')](this));ami['on'](_0x2a3d('0x15'),this[_0x2a3d('0x16')]['bind'](this));ami['on'](_0x2a3d('0x17'),this['blindTransfer'][_0x2a3d('0x12')](this));ami['on'](_0x2a3d('0x18'),this['attendedTransfer'][_0x2a3d('0x12')](this));}};Report[_0x2a3d('0x19')]['findAgent']=function(_0xb1726b){var _0x43809d;_0x43809d=_[_0x2a3d('0x1a')](this[_0x2a3d('0x9')],function(_0x418230){return _0x418230[_0x2a3d('0x1b')]==_0xb1726b||_0x418230['name']==_0xb1726b;});if(_[_0x2a3d('0x1c')](_0x43809d)){var _0x43e43a=_[_0x2a3d('0x1a')](this['telephones'],function(_0x410bdf){return _0x410bdf[_0x2a3d('0x1b')]==_0xb1726b||_0x410bdf[_0x2a3d('0x1d')]==_0xb1726b;});if(_0x43e43a){_0x43809d=_[_0x2a3d('0x1a')](this[_0x2a3d('0x9')],function(_0x1293f5){return _0x1293f5[_0x2a3d('0x1e')]==util[_0x2a3d('0x1f')]('SIP/%s',_0x43e43a[_0x2a3d('0x1d')]);});}}return _0x43809d;};Report['prototype']['voiceQueueReport']=function(_0x586d4f){for(var _0x28ab86=0x0;_0x28ab86<_0x586d4f[_0x2a3d('0x20')];_0x28ab86+=0x1){var _0x51bf31=this[_0x2a3d('0x21')](_0x586d4f[_0x28ab86][_0x2a3d('0x22')]);if(_0x51bf31){_0x586d4f[_0x28ab86][_0x2a3d('0x1b')]=_0x51bf31[_0x2a3d('0x1b')];_0x586d4f[_0x28ab86][_0x2a3d('0x23')]=!![];_0x586d4f[_0x28ab86][_0x2a3d('0x24')]=_0x51bf31[_0x2a3d('0x1d')];_0x586d4f[_0x28ab86]['interface']=_['isNil'](_0x51bf31[_0x2a3d('0x1e')])?util['format'](_0x2a3d('0x25'),_0x51bf31['name']):_0x51bf31[_0x2a3d('0x1e')];if(_0x586d4f[_0x28ab86][_0x2a3d('0x26')]){_0x586d4f[_0x28ab86][_0x2a3d('0x27')]=moment()['format'](_0x2a3d('0x28'));}if(_0x586d4f[_0x28ab86][_0x2a3d('0x29')]){_0x586d4f[_0x28ab86][_0x2a3d('0x2a')]=moment()[_0x2a3d('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x586d4f[_0x28ab86]);}RpcVoiceQueueReport[_0x2a3d('0x2b')](_0x586d4f[_0x28ab86]);}};function extractCalleridNumber(_0x230394){var _0x4a87a7=_0x230394[_0x2a3d('0x2c')](/<(.*?)>/);return _0x4a87a7?_0x4a87a7[0x1]:_0x230394;}Report['prototype'][_0x2a3d('0x2d')]=function(_0x28eb2f){for(var _0x478b48=0x0;_0x478b480x0?!![]:![];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;_0x1cd7b60x0?!![]:![];if(!_0x799ebb){return this[_0x3011('0x1a')](this['summary'][_0x3011('0x6f')]);}};VoiceQueueReport[_0x3011('0xc')]['syncQueueMember']=function(_0x3bf6f8){var _0x353635=this[_0x3011('0x4d')]['id'];if(this[_0x3011('0x4d')][_0x3011('0x68')][_0x353635]&&this['summary']['queuestatus'][_0x353635][_0x3bf6f8[_0x3011('0x67')]]){this[_0x3011('0x4d')][_0x3011('0x68')][_0x353635][_0x3bf6f8[_0x3011('0x67')]][_0x3011('0x12')][_0x3011('0x70')](_0x3bf6f8);}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0x71')]=function(_0x4b1662){var _0x4512ad=this;try{if(this[_0x3011('0x63')](_0x4b1662)&&this[_0x3011('0x63')](_0x4b1662[_0x3011('0x55')])){logger['debug'](_0x3011('0x72'),util[_0x3011('0x48')](_0x4b1662,{'showHidden':![],'depth':null}));var _0x120c65=this[_0x3011('0x14')][_0x4b1662[_0x3011('0x55')]];if(_0x120c65){logger[_0x3011('0x5f')](_0x3011('0x73'),_0x120c65[_0x3011('0x61')]);this[_0x3011('0x4d')][_0x3011('0x65')][_0x120c65[_0x3011('0x61')]]={'summaryEvent':_0x4b1662};this[_0x3011('0x4d')][_0x3011('0x6e')]+=0x1;return ami['Action']({'action':_0x3011('0x68'),'queue':_0x120c65[_0x3011('0x61')]})[_0x3011('0x74')](function(_0x28ec9e){if(!_0x4512ad['summary'][_0x3011('0x68')][_0x4b1662[_0x3011('0x67')]]){_0x4512ad[_0x3011('0x4d')][_0x3011('0x68')][_0x4b1662[_0x3011('0x67')]]={};}_0x4512ad[_0x3011('0x4d')][_0x3011('0x68')][_0x4b1662['actionid']][_0x28ec9e['actionid']]={'queue':_0x120c65[_0x3011('0x61')],'agents':[]};})[_0x3011('0x43')](function(_0x5af8b5){throw _0x5af8b5;});}}}catch(_0x525cb9){logger[_0x3011('0x46')](_0x3011('0x75'),util[_0x3011('0x48')](_0x525cb9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')]['syncQueueSummaryComplete']=function(_0x129a89){if(this[_0x3011('0x4d')][_0x3011('0x6e')]>0x0){this[_0x3011('0x4d')]['completeEvent']=_0x129a89;return;}logger[_0x3011('0x5f')](_0x3011('0x76'),util[_0x3011('0x48')](_0x129a89,{'showHidden':![],'depth':null}));this[_0x3011('0x4d')]=initializeSummary();ami['emit'](_0x3011('0x77'),{});};VoiceQueueReport[_0x3011('0xc')][_0x3011('0x78')]=function(_0x841c3a){try{if(this[_0x3011('0x63')](_0x841c3a)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x841c3a['uniqueid'],util[_0x3011('0x48')](_0x841c3a,{'showHidden':![],'depth':null}));if(_[_0x3011('0x64')](this['queueReports'][_0x841c3a[_0x3011('0x53')]])){this[_0x3011('0x10')][_0x841c3a['uniqueid']]=[];}if(_[_0x3011('0x64')](this[_0x3011('0x13')][_0x841c3a[_0x3011('0x53')]])){this['channels'][_0x841c3a[_0x3011('0x53')]]={};}var _0x5b85e2=new QueueReport();_0x5b85e2[_0x3011('0x55')]=_0x841c3a[_0x3011('0x55')];_0x5b85e2[_0x3011('0x5d')]=this[_0x3011('0x14')][_0x5b85e2['queue']]&&this['voiceQueues'][_0x5b85e2[_0x3011('0x55')]][_0x3011('0x5d')]?this[_0x3011('0x14')][_0x5b85e2[_0x3011('0x55')]][_0x3011('0x5d')]||'inbound':_0x3011('0x5e');_0x5b85e2[_0x3011('0x79')]=moment()[_0x3011('0x60')](_0x3011('0x7a'));_0x5b85e2[_0x3011('0x7b')]=_0x841c3a[_0x3011('0x7b')];_0x5b85e2[_0x3011('0x7c')]=_0x841c3a['count'];_0x5b85e2[_0x3011('0x53')]=_0x841c3a[_0x3011('0x53')];_0x5b85e2[_0x3011('0x7d')]=this['channels'][_0x841c3a[_0x3011('0x53')]][_0x3011('0x7d')];logger[_0x3011('0x7e')](_0x3011('0x7f'),_0x5b85e2[_0x3011('0x55')],_0x5b85e2['type']);Object['assign'](_0x5b85e2,_[_0x3011('0x80')](_0x841c3a,_['keys'](_0x5b85e2)));this[_0x3011('0x10')][_0x841c3a[_0x3011('0x53')]]['push'](_0x5b85e2);this[_0x3011('0x13')][_0x841c3a[_0x3011('0x53')]]=_0x5b85e2;this[_0x3011('0x51')](_0x5b85e2,_0x3011('0x1e'));}}catch(_0x5b5778){logger[_0x3011('0x46')](_0x3011('0x81'),_0x841c3a[_0x3011('0x53')],util[_0x3011('0x48')](_0x5b5778,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0x20')]=function(_0x5b1cf7){try{if(this[_0x3011('0x63')](_0x5b1cf7)){logger[_0x3011('0x5f')](_0x3011('0x82'),_0x5b1cf7['uniqueid'],util[_0x3011('0x48')](_0x5b1cf7,{'showHidden':![],'depth':null}));if(this[_0x3011('0x10')][_0x5b1cf7['uniqueid']]){var _0x366364=_[_0x3011('0x83')](this['queueReports'][_0x5b1cf7[_0x3011('0x53')]]);_0x366364[_0x3011('0x84')]=![];_0x366364[_0x3011('0x85')]=null;_0x366364['holdtime']=_0x5b1cf7[_0x3011('0x86')];_0x366364[_0x3011('0x87')]=_0x5b1cf7[_0x3011('0x87')];_0x366364[_0x3011('0x1f')]=!![];_0x366364[_0x3011('0x88')]=moment()[_0x3011('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x366364['queuecallerexitreason']=_0x3011('0x89');_0x366364[_0x3011('0x8a')]=null;logger[_0x3011('0x7e')](_0x3011('0x8b'),_0x366364[_0x3011('0x55')],_0x366364[_0x3011('0x5d')]);this[_0x3011('0x13')][_0x5b1cf7[_0x3011('0x53')]]=_0x366364;this[_0x3011('0x4e')](_0x366364,'queuecallerabandon');}}}catch(_0x5cb3ab){logger[_0x3011('0x46')](_0x3011('0x82'),_0x5b1cf7[_0x3011('0x53')],util[_0x3011('0x48')](_0x5cb3ab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0x22')]=function(_0x4abaff){try{if(this[_0x3011('0x63')](_0x4abaff)){logger[_0x3011('0x5f')](_0x3011('0x8c'),_0x4abaff[_0x3011('0x53')],util['inspect'](_0x4abaff,{'showHidden':![],'depth':null}));if(this[_0x3011('0x10')][_0x4abaff[_0x3011('0x53')]]){var _0x2bd38e=_[_0x3011('0x83')](this[_0x3011('0x10')][_0x4abaff[_0x3011('0x53')]]);_0x2bd38e[_0x3011('0x8d')]=moment()[_0x3011('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x2bd38e[_0x3011('0x8e')]=_0x4abaff[_0x3011('0x8e')];_0x2bd38e[_0x3011('0x8f')]=_0x4abaff[_0x3011('0x8f')];logger[_0x3011('0x7e')](_0x3011('0x90'),_0x2bd38e[_0x3011('0x55')],_0x2bd38e[_0x3011('0x5d')],_0x4abaff[_0x3011('0x8e')],_0x4abaff[_0x3011('0x8f')]);this[_0x3011('0x13')][_0x4abaff['uniqueid']]=_0x2bd38e;this[_0x3011('0x51')](_0x2bd38e,_0x3011('0x21'));}}}catch(_0x2e3f35){logger[_0x3011('0x46')]('[%s][voiceQueueReport][queuecallerleave]',_0x4abaff[_0x3011('0x53')],util[_0x3011('0x48')](_0x2e3f35,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0x25')]=function(_0x1526b6){try{if(this[_0x3011('0x63')](_0x1526b6)){logger[_0x3011('0x5f')](_0x3011('0x91'),_0x1526b6[_0x3011('0x53')],util[_0x3011('0x48')](_0x1526b6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1526b6['uniqueid']]){var _0x3d684a=_[_0x3011('0x83')](this[_0x3011('0x10')][_0x1526b6[_0x3011('0x53')]]);_0x3d684a[_0x3011('0x84')]=!![];_0x3d684a[_0x3011('0x59')]=_0x3011('0x92');logger[_0x3011('0x7e')](_0x3011('0x93'),_0x3d684a[_0x3011('0x55')],_0x3d684a['type']);}}}catch(_0x2a1dc0){logger[_0x3011('0x46')](_0x3011('0x91'),_0x1526b6[_0x3011('0x53')],util[_0x3011('0x48')](_0x2a1dc0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3011('0x94')]=function(_0x2fdbdb){try{if(this[_0x3011('0x63')](_0x2fdbdb)){logger[_0x3011('0x5f')](_0x3011('0x95'),_0x2fdbdb[_0x3011('0x53')],util[_0x3011('0x48')](_0x2fdbdb,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2fdbdb[_0x3011('0x53')]]){var _0x1118f5=_[_0x3011('0x83')](this[_0x3011('0x10')][_0x2fdbdb[_0x3011('0x53')]]);_0x1118f5[_0x3011('0x1f')]=![];_0x1118f5[_0x3011('0x88')]=null;_0x1118f5[_0x3011('0x96')]=!![];_0x1118f5[_0x3011('0x8a')]=_0x2fdbdb[_0x3011('0x97')];_0x1118f5['holdtime']=_0x2fdbdb[_0x3011('0x86')];_0x1118f5['queuecallercomplete']=!![];_0x1118f5['queuecallerexit']=![];_0x1118f5[_0x3011('0x98')]=null;if(!_0x1118f5[_0x3011('0x99')]){if(_0x2fdbdb[_0x3011('0x9a')]==_0x3011('0x99')){_0x1118f5[_0x3011('0x59')]=_0x3011('0x9b');logger['info'](_0x3011('0x9c'),_0x1118f5[_0x3011('0x55')],_0x1118f5[_0x3011('0x5d')]);}else{if(_[_0x3011('0x9d')](_0x2fdbdb[_0x3011('0x42')][_0x3011('0x9e')](),_0x3011('0x9f'))){if(this[_0x3011('0x10')][_0x2fdbdb[_0x3011('0xa0')]]){var _0x19e5d5=_[_0x3011('0x83')](this['queueReports'][_0x2fdbdb[_0x3011('0xa0')]]);_0x19e5d5[_0x3011('0x84')]=![];_0x19e5d5[_0x3011('0x3b')]=!![];_0x19e5d5[_0x3011('0x98')]=moment(_0x1118f5[_0x3011('0x79')])[_0x3011('0xa1')](_0x2fdbdb[_0x3011('0x86')],_0x3011('0xa2'))[_0x3011('0x60')](_0x3011('0x7a'));_0x19e5d5[_0x3011('0x59')]='FORWARDTRANSFER';_0x19e5d5[_0x3011('0x99')]=!![];_0x19e5d5[_0x3011('0xa3')]=_0x3011('0xa4');_0x19e5d5[_0x3011('0xa5')]=_0x2fdbdb[_0x3011('0xa6')];_0x19e5d5['transferuniqueid']=_0x2fdbdb[_0x3011('0x53')];logger[_0x3011('0x7e')](_0x3011('0xa7'),_0x19e5d5['queue'],_0x19e5d5[_0x3011('0x5d')]);var _0xe588d0=this[_0x3011('0x10')][_0x2fdbdb[_0x3011('0xa0')]];this[_0x3011('0x10')][_0x2fdbdb[_0x3011('0xa0')]]=this['queueReports'][_0x2fdbdb[_0x3011('0x53')]];this[_0x3011('0x10')][_0x2fdbdb[_0x3011('0x53')]]=_0xe588d0;}}else{_0x1118f5['queuecallerexitreason']='COMPLETEDBY'+_0x2fdbdb[_0x3011('0x9a')]['toUpperCase']();logger[_0x3011('0x7e')](_0x3011('0xa8'),_0x1118f5[_0x3011('0x55')],_0x1118f5[_0x3011('0x5d')],_0x1118f5[_0x3011('0x59')]);}}}this[_0x3011('0x13')][_0x2fdbdb[_0x3011('0x53')]]=_0x1118f5;}}}catch(_0xfb6317){logger[_0x3011('0x46')](_0x3011('0x95'),_0x2fdbdb['uniqueid'],util[_0x3011('0x48')](_0xfb6317,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0xa9')]=function(_0x13013a){try{if(this[_0x3011('0x63')](_0x13013a)){logger[_0x3011('0x5f')](_0x3011('0xaa'),_0x13013a[_0x3011('0x53')],util[_0x3011('0x48')](_0x13013a,{'showHidden':![],'depth':null}));this['addVariable'](_0x13013a[_0x3011('0x53')],_['keys'](_0x13013a[_0x3011('0xab')])[0x0],_0x13013a['value']);if(this['queueReports'][_0x13013a[_0x3011('0x53')]]){var _0x204279=_[_0x3011('0x83')](this[_0x3011('0x10')][_0x13013a[_0x3011('0x53')]]);if(_0x204279){if(this[_0x3011('0x63')](_0x13013a['variable'])&&this[_0x3011('0x63')](_0x13013a['variable'][_0x3011('0x68')])){switch(_0x13013a[_0x3011('0xac')]){case'CONTINUE':_0x204279[_0x3011('0x3b')]=![];_0x204279[_0x3011('0x98')]=null;break;case _0x3011('0xad'):_0x204279[_0x3011('0xae')]=_0x3011('0xaf');_0x204279[_0x3011('0x3b')]=!![];_0x204279[_0x3011('0x98')]=moment()[_0x3011('0x60')](_0x3011('0x7a'));_0x204279[_0x3011('0x8d')]=moment()[_0x3011('0x60')](_0x3011('0x7a'));logger[_0x3011('0x5f')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x13013a[_0x3011('0x53')],util['inspect'](_0x204279,{'showHidden':![],'depth':null}));ami['emit'](_0x3011('0xb0'),_0x204279);break;default:_0x204279[_0x3011('0x3b')]=!![];_0x204279['queuecallerexitAt']=moment()[_0x3011('0x60')](_0x3011('0x7a'));_0x204279['queuecallerleaveAt']=moment()[_0x3011('0x60')]('YYYY-MM-DD\x20HH:mm:ss');}_0x204279[_0x3011('0x1f')]=![];_0x204279[_0x3011('0x88')]=null;_0x204279['queuecallerexitreason']=_0x13013a[_0x3011('0xac')];this[_0x3011('0x13')][_0x13013a[_0x3011('0x53')]]=_0x204279;this[_0x3011('0x4e')](_0x204279,_0x3011('0x26'));}else if(this[_0x3011('0x63')](_0x13013a[_0x3011('0xab')])&&this[_0x3011('0x63')](_0x13013a[_0x3011('0xab')][_0x3011('0xb1')])){if(!_0x204279[_0x3011('0x1f')]){_0x204279[_0x3011('0x3b')]=!![];_0x204279[_0x3011('0x98')]=moment()['format'](_0x3011('0x7a'));_0x204279[_0x3011('0x59')]=_0x3011('0xb2');_0x204279[_0x3011('0x8d')]=moment()['format'](_0x3011('0x7a'));this['channels'][_0x13013a[_0x3011('0x53')]]=_0x204279;}}logger[_0x3011('0x7e')](_0x3011('0xb3'),_0x13013a['uniqueid'],_0x204279[_0x3011('0x55')],_0x204279[_0x3011('0x5d')],_[_0x3011('0xb4')](_0x13013a[_0x3011('0xab')])[0x0],_0x13013a[_0x3011('0xac')]);_0x204279[_0x3011('0x16')]=this[_0x3011('0x16')][_0x13013a[_0x3011('0x53')]];}}}}catch(_0xcede8d){logger[_0x3011('0x46')](_0x3011('0xaa'),_0x13013a[_0x3011('0x53')],util['inspect'](_0xcede8d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0xb5')]=function(_0x5a3ff8,_0x317693,_0x441de5){var _0x45d160=[_0x3011('0xb6'),_0x3011('0xb7'),'rtpaudioqosjitter',_0x3011('0xb8'),_0x3011('0xb9'),_0x3011('0xba'),'rtpaudioqosrtt',_0x3011('0xbb'),_0x3011('0xbc'),'sipuri',_0x3011('0xbd'),_0x3011('0xbe'),_0x3011('0xbf'),_0x3011('0xc0'),_0x3011('0xc1'),_0x3011('0xc2'),_0x3011('0x97'),_0x3011('0xc3'),_0x3011('0xc4')];if(!_['isNil'](_0x317693)&&!_[_0x3011('0xc5')](_0x45d160,_0x317693)){if(_[_0x3011('0x64')](this[_0x3011('0x16')][_0x5a3ff8])){this[_0x3011('0x16')][_0x5a3ff8]={};}this[_0x3011('0x16')][_0x5a3ff8][_0x317693]=_0x441de5;}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0xc6')]=function(_0x12aab8,_0x1fd072,_0x4f912b){try{var _0x2fc6ea={};if(this[_0x3011('0x10')][_0x12aab8]){for(var _0x4afddd=0x0;_0x4afddd=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 +var _0x3b4d=['SIP/%s','interface','TALKING','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','accountcode','toNumber','uniqueid','voiceDialReport','Request','membername','starttime','endtime','seconds','agent','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','format'];(function(_0x19d85d,_0x229beb){var _0x43e958=function(_0x1ee536){while(--_0x1ee536){_0x19d85d['push'](_0x19d85d['shift']());}};_0x43e958(++_0x229beb);}(_0x3b4d,0x1e4));var _0xd3b4=function(_0x1a91f0,_0x11e203){_0x1a91f0=_0x1a91f0-0x0;var _0x12f862=_0x3b4d[_0x1a91f0];return _0x12f862;};'use strict';var moment=require(_0xd3b4('0x0'));var _=require(_0xd3b4('0x1'));var util=require(_0xd3b4('0x2'));var client=require(_0xd3b4('0x3'));exports[_0xd3b4('0x4')]=function(_0x3f4193){var _0x43e9d3=_0x3f4193[_0xd3b4('0x5')]||_0x3f4193[_0xd3b4('0x6')];return client['Request'](_0xd3b4('0x7'),{'body':{'channel':_0xd3b4('0x8'),'membername':_0x3f4193[_0xd3b4('0x9')],'interface':_[_0xd3b4('0xa')](_0x3f4193['interface'])?util[_0xd3b4('0xb')](_0xd3b4('0xc'),_0x3f4193[_0xd3b4('0x9')]):_0x3f4193[_0xd3b4('0xd')],'type':_0xd3b4('0xe'),'enterAt':_0x3f4193[_0xd3b4('0xf')],'exitAt':_0x43e9d3,'duration':moment(_0x43e9d3)[_0xd3b4('0x10')](_0x3f4193[_0xd3b4('0xf')],'seconds'),'data1':_0xd3b4('0x11'),'data2':_0x3f4193[_0xd3b4('0x12')],'data3':_0x3f4193[_0xd3b4('0x13')],'data4':null,'data5':_0x3f4193[_0xd3b4('0x14')],'role':'agent','internal':_0x3f4193[_0xd3b4('0x15')]?_[_0xd3b4('0x16')](_0x3f4193[_0xd3b4('0x15')]):undefined,'uniqueid':_0x3f4193[_0xd3b4('0x17')]},'log':_0xd3b4('0x7')});};exports[_0xd3b4('0x18')]=function(_0x56a17d){return client[_0xd3b4('0x19')](_0xd3b4('0x7'),{'body':{'channel':'voice','membername':_0x56a17d[_0xd3b4('0x1a')],'interface':_0x56a17d[_0xd3b4('0xd')],'type':'TALKING','enterAt':_0x56a17d[_0xd3b4('0x1b')],'exitAt':_0x56a17d[_0xd3b4('0x1c')],'duration':moment(_0x56a17d['endtime'])[_0xd3b4('0x10')](_0x56a17d[_0xd3b4('0x1b')],'seconds')>=0x0?moment(_0x56a17d[_0xd3b4('0x1c')])[_0xd3b4('0x10')](_0x56a17d[_0xd3b4('0x1b')],_0xd3b4('0x1d')):null,'data1':'outbound','data2':_0x56a17d[_0xd3b4('0x15')],'data3':_0x56a17d['exten'],'data4':_0x56a17d['dialstring']||null,'role':_0xd3b4('0x1e'),'internal':_0x56a17d[_0xd3b4('0x15')]?_[_0xd3b4('0x16')](_0x56a17d['accountcode']):undefined,'uniqueid':_0x56a17d['uniqueid']},'log':_0xd3b4('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 0bf47a3..bbdae7b 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 _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 +var _0xefe2=['stopRecordingOnTransfer','GetSettings','../client','getSettings','ShowSetting'];(function(_0x343a44,_0x29b655){var _0x5a4586=function(_0x22b48e){while(--_0x22b48e){_0x343a44['push'](_0x343a44['shift']());}};_0x5a4586(++_0x29b655);}(_0xefe2,0xd9));var _0x2efe=function(_0x2fc4e8,_0x1a5f6c){_0x2fc4e8=_0x2fc4e8-0x0;var _0x211edf=_0xefe2[_0x2fc4e8];return _0x211edf;};'use strict';var client=require(_0x2efe('0x0'));exports[_0x2efe('0x1')]=function(){return client['Request'](_0x2efe('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2efe('0x3'),'previewRecallmeReminderInterval']},'log':_0x2efe('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 626d6a5..0f3f1d2 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 _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 +var _0x658b=['name','html','../client','getTemplates','GetTemplate'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x658b,0x11f));var _0xb658=function(_0x4eff9f,_0xa12c70){_0x4eff9f=_0x4eff9f-0x0;var _0x4b64d4=_0x658b[_0x4eff9f];return _0x4b64d4;};'use strict';var client=require(_0xb658('0x0'));exports[_0xb658('0x1')]=function(_0x147c69){return function(_0x56a15c){return client['Request'](_0xb658('0x2'),{'options':{'raw':!![],'attributes':['id',_0xb658('0x3'),_0xb658('0x4')]},'log':_0xb658('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index efe1588..5b5481a 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 _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 +var _0xa223=['name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0xa223,0x97));var _0x3a22=function(_0x2c5d10,_0x121aff){_0x2c5d10=_0x2c5d10-0x0;var _0x38ccca=_0xa223[_0x2c5d10];return _0x38ccca;};'use strict';var client=require(_0x3a22('0x0'));exports[_0x3a22('0x1')]=function(_0x33e5bb){return function(_0x504ebf){return client['Request'](_0x3a22('0x2'),{'options':{'raw':![],'attributes':['id',_0x3a22('0x3'),_0x3a22('0x4'),_0x3a22('0x5')],'include':[{'model':_0x3a22('0x6'),'as':_0x3a22('0x7'),'attributes':['id',_0x3a22('0x8'),_0x3a22('0x9'),'value']},{'model':_0x3a22('0x6'),'as':_0x3a22('0xa'),'attributes':['id','field',_0x3a22('0x9'),_0x3a22('0xb')]},{'model':_0x3a22('0xc'),'as':_0x3a22('0xd'),'attributes':['id',_0x3a22('0xe'),_0x3a22('0xf'),_0x3a22('0x10'),_0x3a22('0x11'),_0x3a22('0x12'),_0x3a22('0x13'),_0x3a22('0x14'),_0x3a22('0x15')]}]},'log':_0x3a22('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 83adb6e..d2a6489 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 _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 +var _0x4a99=['GetTrunk','../client','Request','name','defaultuser'];(function(_0x48348c,_0x324a05){var _0x1ae35a=function(_0x5c4056){while(--_0x5c4056){_0x48348c['push'](_0x48348c['shift']());}};_0x1ae35a(++_0x324a05);}(_0x4a99,0x1aa));var _0x94a9=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4a99[_0x4243a3];return _0x1b2a33;};'use strict';var client=require(_0x94a9('0x0'));exports['getTrunks']=function(_0x5cd1fa){return function(_0x21254e){return client[_0x94a9('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x94a9('0x2'),'registry',_0x94a9('0x3')]},'log':_0x94a9('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4bcba8a..d6dc941 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_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 +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 6b28f3f..da1b5cd 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 _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 +var _0x07a9=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x5518ff,_0x4913fe){var _0x5f4ede=function(_0x2e0f2d){while(--_0x2e0f2d){_0x5518ff['push'](_0x5518ff['shift']());}};_0x5f4ede(++_0x4913fe);}(_0x07a9,0xa6));var _0x907a=function(_0xb7a47d,_0x4b6e17){_0xb7a47d=_0xb7a47d-0x0;var _0x1e5c73=_0x07a9[_0xb7a47d];return _0x1e5c73;};'use strict';var client=require(_0x907a('0x0'));exports[_0x907a('0x1')]=function(_0x50ba98){return client[_0x907a('0x2')](_0x907a('0x3'),{'body':_0x50ba98,'log':_0x907a('0x3')});};exports[_0x907a('0x4')]=function(_0x415f75,_0x450daa,_0x5d83a0){return client[_0x907a('0x2')]('UpdateVoiceAgentReport',{'body':_0x415f75,'options':{'where':{'uniqueid':_0x450daa,'interface':_0x5d83a0,'agentcomplete':!![]}},'log':_0x907a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9c4b414..f27656a 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 _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 +var _0xbd8d=['outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbd8d,0x1c2));var _0xdbd8=function(_0x512c43,_0x420db3){_0x512c43=_0x512c43-0x0;var _0x43bdcb=_0xbd8d[_0x512c43];return _0x43bdcb;};'use strict';var moment=require(_0xdbd8('0x0'));var util=require(_0xdbd8('0x1'));var _=require('lodash');var client=require(_0xdbd8('0x2'));exports['create']=function(_0x22f83c){return client[_0xdbd8('0x3')](_0xdbd8('0x4'),{'body':_[_0xdbd8('0x5')](_0x22f83c,{'source':_0x22f83c[_0xdbd8('0x6')],'destinationcontext':_0x22f83c[_0xdbd8('0x7')],'callerid':_0x22f83c[_0xdbd8('0x8')],'amaflags':_0xdbd8('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0xdbd8('0xa')]=function(){return function(){return client[_0xdbd8('0x3')](_0xdbd8('0xb'),{'options':{'where':{'type':[_0xdbd8('0xc')],'createdAt':{'$between':[moment()[_0xdbd8('0xd')](_0xdbd8('0xe'))['format'](_0xdbd8('0xf')),moment()[_0xdbd8('0x10')](_0xdbd8('0xe'))['format'](_0xdbd8('0xf'))]}},'attributes':['type',_0xdbd8('0x11'),_0xdbd8('0x12'),_0xdbd8('0x13')]},'log':_0xdbd8('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 453289a..b53a6a4 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 _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 +var _0x83c9=['../client','create','CreateVoiceDialReport'];(function(_0x28b734,_0x3b3693){var _0xa5033e=function(_0x1fa4b2){while(--_0x1fa4b2){_0x28b734['push'](_0x28b734['shift']());}};_0xa5033e(++_0x3b3693);}(_0x83c9,0x15c));var _0x983c=function(_0x4b8156,_0x437af2){_0x4b8156=_0x4b8156-0x0;var _0x4a819c=_0x83c9[_0x4b8156];return _0x4a819c;};'use strict';var client=require(_0x983c('0x0'));exports[_0x983c('0x1')]=function(_0x515bb5){return client['Request'](_0x983c('0x2'),{'body':_0x515bb5,'log':_0x983c('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ce5462c..98424c9 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 _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 +var _0x5106=['exten','recordingFormat','../client','Request'];(function(_0x20aef9,_0x6448f8){var _0xfbfe36=function(_0x3ad7c9){while(--_0x3ad7c9){_0x20aef9['push'](_0x20aef9['shift']());}};_0xfbfe36(++_0x6448f8);}(_0x5106,0x116));var _0x6510=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5106[_0x4565bf];return _0x5610ba;};'use strict';var client=require(_0x6510('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x6510('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x6510('0x2'),_0x6510('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d588f64..472e92f 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 _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 +var _0x4f4e=['active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid'];(function(_0x5e7d12,_0x5cb43d){var _0x324f2a=function(_0xe0ce6d){while(--_0xe0ce6d){_0x5e7d12['push'](_0x5e7d12['shift']());}};_0x324f2a(++_0x5cb43d);}(_0x4f4e,0x193));var _0xe4f4=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0x4f4e[_0x3ebb69];return _0x421e59;};'use strict';var client=require(_0xe4f4('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xe4f4('0x1')](_0xe4f4('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe4f4('0x3'),_0xe4f4('0x4'),_0xe4f4('0x5'),_0xe4f4('0x6'),_0xe4f4('0x7'),'dialActive','dialMethod',_0xe4f4('0x8'),_0xe4f4('0x9'),_0xe4f4('0xa'),_0xe4f4('0xb'),_0xe4f4('0xc'),_0xe4f4('0xd'),_0xe4f4('0xe'),_0xe4f4('0xf'),_0xe4f4('0x10'),_0xe4f4('0x11'),_0xe4f4('0x12'),_0xe4f4('0x13'),_0xe4f4('0x14'),_0xe4f4('0x15'),_0xe4f4('0x16'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xe4f4('0x17'),_0xe4f4('0x18'),'dialTimezone',_0xe4f4('0x19'),_0xe4f4('0x1a'),_0xe4f4('0x1b'),_0xe4f4('0x1c'),_0xe4f4('0x1d'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0xe4f4('0x1e'),_0xe4f4('0x1f'),_0xe4f4('0x20'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xe4f4('0x21'),'timeout',_0xe4f4('0x22'),_0xe4f4('0x23'),_0xe4f4('0x24'),_0xe4f4('0x25'),_0xe4f4('0x26'),_0xe4f4('0x27'),_0xe4f4('0x6'),_0xe4f4('0x28'),_0xe4f4('0x29'),_0xe4f4('0x2a'),_0xe4f4('0x2b'),'dialNoSuchNumberRetryFrequency',_0xe4f4('0x2c'),_0xe4f4('0x2d'),_0xe4f4('0x2e'),_0xe4f4('0x2f'),_0xe4f4('0x30'),_0xe4f4('0x31'),'dialAgentRejectMaxRetry',_0xe4f4('0x32'),_0xe4f4('0x33'),_0xe4f4('0x34'),_0xe4f4('0x35'),_0xe4f4('0x36'),_0xe4f4('0x37')],'include':[{'model':_0xe4f4('0x38'),'as':_0xe4f4('0x38'),'attributes':['id',_0xe4f4('0x39'),_0xe4f4('0x3a'),_0xe4f4('0x3b')]},{'model':_0xe4f4('0x3c'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xe4f4('0x38'),'as':_0xe4f4('0x3d'),'attributes':['id',_0xe4f4('0x39'),_0xe4f4('0x3a'),_0xe4f4('0x3b')]},{'model':'Interval','as':_0xe4f4('0x3e'),'attributes':['id',_0xe4f4('0x39')],'include':[{'model':_0xe4f4('0x3e'),'as':_0xe4f4('0x3f'),'attributes':['id',_0xe4f4('0x39'),_0xe4f4('0x40')]}]}]},'log':_0xe4f4('0x41')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ef089e9..98d8137 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(_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 +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(_0x4e846e,_0x347bc7){var _0x167d94=function(_0x1197b5){while(--_0x1197b5){_0x4e846e['push'](_0x4e846e['shift']());}};_0x167d94(++_0x347bc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 b3822ae..a00c0b3 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 _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 +var _0x0444=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x2ec058,_0x37f0c8){var _0x3a53b9=function(_0x13161c){while(--_0x13161c){_0x2ec058['push'](_0x2ec058['shift']());}};_0x3a53b9(++_0x37f0c8);}(_0x0444,0xd0));var _0x4044=function(_0x2d7031,_0x26b709){_0x2d7031=_0x2d7031-0x0;var _0x1359b5=_0x0444[_0x2d7031];return _0x1359b5;};'use strict';var client=require('../client');exports[_0x4044('0x0')]=function(_0x223093){return function(){return client[_0x4044('0x1')](_0x4044('0x2'),{'options':{'where':{'VoiceQueueId':_0x223093,'paused':!![]},'raw':!![]},'log':_0x4044('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 451af08..012680e 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_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 +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3227b7,_0x5922b5){var _0x258c38=function(_0x438df5){while(--_0x438df5){_0x3227b7['push'](_0x3227b7['shift']());}};_0x258c38(++_0x5922b5);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8546558..7aabd87 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 _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 +var _0x8253=['origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','attendedTransfer','result','origtransfererchannel'];(function(_0x517a6d,_0x573c38){var _0x5579d1=function(_0x35f68f){while(--_0x35f68f){_0x517a6d['push'](_0x517a6d['shift']());}};_0x5579d1(++_0x573c38);}(_0x8253,0x1b1));var _0x3825=function(_0x1534d4,_0x33c784){_0x1534d4=_0x1534d4-0x0;var _0x274edd=_0x8253[_0x1534d4];return _0x274edd;};'use strict';var client=require(_0x3825('0x0'));exports[_0x3825('0x1')]={};exports['blindTransfer']=function(_0x2391f7){return client[_0x3825('0x2')](_0x3825('0x3'),{'body':{'result':_0x2391f7['result'],'transfererchannel':_0x2391f7[_0x3825('0x4')],'transferercalleridnum':_0x2391f7['transferercalleridnum'],'transferercalleridname':_0x2391f7[_0x3825('0x5')],'transfererconnectedlinenum':_0x2391f7[_0x3825('0x6')],'transfererconnectedlinename':_0x2391f7['transfererconnectedlinename'],'transfereraccountcode':_0x2391f7[_0x3825('0x7')],'transferercontext':_0x2391f7[_0x3825('0x8')],'transfererexten':_0x2391f7[_0x3825('0x9')],'transfererlinkedid':_0x2391f7[_0x3825('0xa')],'transfereechannel':_0x2391f7['transfereechannel'],'transfereecalleridnum':_0x2391f7[_0x3825('0xb')],'transfereecalleridname':_0x2391f7[_0x3825('0xc')],'transfereeconnectedlinenum':_0x2391f7['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2391f7[_0x3825('0xd')],'transfereeaccountcode':_0x2391f7[_0x3825('0xe')],'transfereecontext':_0x2391f7[_0x3825('0xf')],'transfereeexten':_0x2391f7['transfereeexten'],'transfereelinkedid':_0x2391f7[_0x3825('0x10')],'isexternal':_0x2391f7[_0x3825('0x11')],'context':_0x2391f7[_0x3825('0x12')],'extension':_0x2391f7[_0x3825('0x13')],'type':'blind'},'log':_0x3825('0x3')});};exports[_0x3825('0x14')]=function(_0x11571b){return client['Request'](_0x3825('0x3'),{'body':{'result':_0x11571b[_0x3825('0x15')],'transfererchannel':_0x11571b[_0x3825('0x16')],'transferercalleridnum':_0x11571b[_0x3825('0x17')],'transferercalleridname':_0x11571b['origtransferercalleridname'],'transfererconnectedlinenum':_0x11571b[_0x3825('0x18')],'transfererconnectedlinename':_0x11571b[_0x3825('0x19')],'transfereraccountcode':_0x11571b[_0x3825('0x1a')],'transferercontext':_0x11571b[_0x3825('0x1b')],'transfererexten':_0x11571b[_0x3825('0x1c')],'transfererlinkedid':_0x11571b[_0x3825('0x1d')],'transfereechannel':_0x11571b[_0x3825('0x1e')],'transfereecalleridnum':_0x11571b[_0x3825('0x1f')],'transfereecalleridname':_0x11571b[_0x3825('0x20')],'transfereeconnectedlinenum':_0x11571b[_0x3825('0x21')],'transfereeconnectedlinename':_0x11571b['transfertargetconnectedlinename'],'transfereeaccountcode':_0x11571b['transfertargetaccountcode'],'transfereecontext':_0x11571b['transfertargetcontext'],'transfereeexten':_0x11571b['transfertargetexten'],'transfereelinkedid':_0x11571b[_0x3825('0x22')],'isexternal':_0x11571b[_0x3825('0x11')],'context':_0x11571b[_0x3825('0x23')],'extension':_0x11571b[_0x3825('0x24')],'type':_0x3825('0x25')},'log':_0x3825('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 950c7b6..6a05454 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_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 +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(_0xa554fd,_0x36e9c7){var _0x1524a8=function(_0x266515){while(--_0x266515){_0xa554fd['push'](_0xa554fd['shift']());}};_0x1524a8(++_0x36e9c7);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f1753,_0x458f6d){_0x2f1753=_0x2f1753-0x0;var _0x56a164=_0xb10b[_0x2f1753];return _0x56a164;};'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 20eabcd..e4e5a41 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 _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 +var _0x5a87=['info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','fax','scheduledAt','updatedAt','union','resolve','then','isEmpty'];(function(_0x28572f,_0x820594){var _0x4045ab=function(_0x363149){while(--_0x363149){_0x28572f['push'](_0x28572f['shift']());}};_0x4045ab(++_0x820594);}(_0x5a87,0x194));var _0x75a8=function(_0x19331b,_0x175110){_0x19331b=_0x19331b-0x0;var _0x54221b=_0x5a87[_0x19331b];return _0x54221b;};'use strict';var _=require('lodash');var BPromise=require(_0x75a8('0x0'));var Redis=require(_0x75a8('0x1'));var util=require(_0x75a8('0x2'));var config=require(_0x75a8('0x3'));var logger=require(_0x75a8('0x4'))(_0x75a8('0x5'));var cmContactRpc=require(_0x75a8('0x6'));config[_0x75a8('0x7')]=_[_0x75a8('0x8')](config[_0x75a8('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x75a8('0x9'))(new Redis(config[_0x75a8('0x7')]));function emit(_0x5d7add,_0x3500b0,_0x4c64a8,_0x174ffa,_0x9b4554){logger['info']('[CM][%s][%s]',_0x5d7add,_0x3500b0['id'],_0x4c64a8,_0x174ffa,JSON[_0x75a8('0xa')](_0x9b4554));io['to'](_0x4c64a8)[_0x75a8('0xb')](_0x174ffa,_0x9b4554);}exports[_0x75a8('0xc')]=function(_0x2b79a3,_0x51e55b,_0x31aa16,_0x2be0ca){var _0x388d1d,_0x32ff06;var _0x5141a0={};var _0x122676;var _0x130897=Number(_0x31aa16[_0x75a8('0xd')]);var _0x51f1e6=_0x31aa16['data2']?Boolean(Number(_0x31aa16[_0x75a8('0xe')])):![];var _0x1c1211;var _0x3bf792=![];if(!_[_0x75a8('0xf')](_0x31aa16[_0x75a8('0x10')])){if(_0x31aa16['data5']=='1')_0x3bf792=!![];}if(!_0x3bf792){if(_0x2be0ca['xmd-contactid']){_0x5141a0['id']=_0x2be0ca[_0x75a8('0x11')];}}if(!_0x5141a0['id']){_0x5141a0[_0x75a8('0x12')]=_0x130897;_0x1c1211=_0x31aa16['data3']&&_0x31aa16[_0x75a8('0x13')]!=='0'?_0x31aa16['data3'][_0x75a8('0x14')](','):[_0x75a8('0x15')];_0x5141a0[_0x75a8('0x16')]=_['map'](_0x1c1211,function(_0x36648f){var _0x1781cd={};_0x1781cd[_0x36648f]=_0x2be0ca['routeId']?_0x2be0ca[_0x75a8('0x17')]:_0x2be0ca[_0x75a8('0x18')];return _0x1781cd;});_0x122676=_0x2be0ca[_0x75a8('0x19')]?_0x2be0ca[_0x75a8('0x17')]:_0x2be0ca['calleridnum'];}var _0x48d518=['id',_0x75a8('0x1a'),_0x75a8('0x1b'),_0x75a8('0x15'),_0x75a8('0x1c'),_0x75a8('0x1d'),'ListId','createdAt',_0x75a8('0x1e'),_0x75a8('0x1f')];var _0x3c43d2=_[_0x75a8('0x20')](_0x48d518,_0x1c1211);BPromise[_0x75a8('0x21')]()[_0x75a8('0x22')](cmContactRpc['getContacts']({'attributes':_0x3c43d2,'where':_0x5141a0,'phone':_0x122676}))[_0x75a8('0x22')](function(_0x3f3375){_0x32ff06=_0x3f3375;if(!_[_0x75a8('0x23')](_0x32ff06)){if(_0x32ff06['length']===0x1){_0x388d1d=_0x32ff06[0x0];logger[_0x75a8('0x24')](_0x75a8('0x25'),_0x2be0ca['uniqueid'],_0x51e55b['id'],_0x388d1d['id']);}else{logger[_0x75a8('0x24')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2be0ca[_0x75a8('0x26')],_0x51e55b['id'],_['map'](_0x32ff06,'id')['join'](','));}return;}else{logger['info'](_0x75a8('0x27'),_0x2be0ca[_0x75a8('0x26')],_0x51e55b['id']);var _0x4290bf={'ListId':_0x130897};var _0x1ce518=_0x31aa16[_0x75a8('0x28')]&&_0x31aa16[_0x75a8('0x28')]!=='0'?_0x31aa16[_0x75a8('0x28')]:'phone';if(_0x51f1e6){logger['info'](_0x75a8('0x29'),_0x2be0ca[_0x75a8('0x26')],_0x51e55b['id']);_0x4290bf[_0x1ce518]=_[_0x75a8('0xf')](_0x2be0ca[_0x75a8('0x19')])?_0x2be0ca[_0x75a8('0x18')]:_0x2be0ca[_0x75a8('0x17')];if(_['isNil'](_0x2be0ca[_0x75a8('0x19')])){_0x4290bf[_0x75a8('0x1a')]=_0x2be0ca[_0x75a8('0x2a')]&&_0x2be0ca[_0x75a8('0x2a')]!==_0x75a8('0x2b')?_0x2be0ca[_0x75a8('0x2a')]:_0x75a8('0x2c');}else{_0x4290bf['firstName']=_0x2be0ca[_0x75a8('0x2d')]&&_0x2be0ca['destcalleridname']!==_0x75a8('0x2b')?_0x2be0ca[_0x75a8('0x2d')]:_0x75a8('0x2c');}return BPromise[_0x75a8('0x21')]()[_0x75a8('0x22')](cmContactRpc['createContact'](_0x4290bf))[_0x75a8('0x22')](function(_0x2e527d){_0x388d1d=_0x2e527d;_0x32ff06[_0x75a8('0x2e')](_0x2e527d);if(_0x388d1d){logger[_0x75a8('0x24')](_0x75a8('0x2f'),_0x2be0ca[_0x75a8('0x26')],_0x51e55b['id'],_0x388d1d['id']);}return;});}else{logger[_0x75a8('0x24')](_0x75a8('0x30'),_0x2be0ca[_0x75a8('0x26')],_0x51e55b['id']);_0x4290bf[_0x1ce518]=_['isNil'](_0x2be0ca[_0x75a8('0x19')])?_0x2be0ca[_0x75a8('0x18')]:_0x2be0ca[_0x75a8('0x17')];if(_[_0x75a8('0xf')](_0x2be0ca[_0x75a8('0x19')])){_0x4290bf[_0x75a8('0x1a')]=_0x2be0ca['calleridname']&&_0x2be0ca['calleridname']!==''?_0x2be0ca['calleridname']:_0x75a8('0x2c');}else{_0x4290bf[_0x75a8('0x1a')]=_0x2be0ca[_0x75a8('0x2d')]&&_0x2be0ca['destcalleridname']!==_0x75a8('0x2b')?_0x2be0ca[_0x75a8('0x2d')]:_0x75a8('0x2c');}_0x388d1d=_0x4290bf;_0x32ff06[_0x75a8('0x2e')](_0x4290bf);return;}}})[_0x75a8('0x22')](function(){if(_0x2b79a3){emit(_0x2be0ca[_0x75a8('0x26')],_0x51e55b,util[_0x75a8('0x31')](_0x75a8('0x32'),_0x2b79a3[_0x75a8('0x33')]),util[_0x75a8('0x31')]('trigger:%s',_0x31aa16[_0x75a8('0x34')]['toLowerCase']()),{'evt':_[_0x75a8('0x35')](_0x2be0ca,{'autoCreate':_0x51f1e6}),'contact':_0x388d1d===undefined?{}:_0x388d1d,'contacts':_0x32ff06[_0x75a8('0x36')]===0x0?undefined:_0x32ff06});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 5fb68d1..d6a20c8 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 _0xe83c=['urlforward','script','parse','query','replace','channel','every','AllConditions','checkConditions','some','AnyConditions','debug','checkTrigger:\x20trigger','evt','account','chat','ChatWebsiteId','operator','AccountId','value','interaction','message','event','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','equals','exports','util','lodash','url','ioredis','./urlforward','./cmContact','./script','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','salesforceAccounts','servicenowAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:substatus','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','motionChannel','undefined','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','data2','template\x20not\x20found','buildUri','isNil','data3','data4','location','windowWidth','data5','800','windowHeight','data6','600','winApplication','render','winArguments','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','integration','accounts','queue'];(function(_0x3c3c27,_0x2f06f0){var _0x118caa=function(_0x53ce8e){while(--_0x53ce8e){_0x3c3c27['push'](_0x3c3c27['shift']());}};_0x118caa(++_0x2f06f0);}(_0xe83c,0x1a6));var _0xce83=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0xe83c[_0x13f980];return _0x27153c;};'use strict';var util=require(_0xce83('0x0'));var _=require(_0xce83('0x1'));var url=require(_0xce83('0x2'));var Mustache=require('mustache');var Redis=require(_0xce83('0x3'));var urlforward=require(_0xce83('0x4'));var integration=require('./integration');var cmContact=require(_0xce83('0x5'));var script=require(_0xce83('0x6'));var config=require('../../../config/environment');var logger=require(_0xce83('0x7'))(_0xce83('0x8'));var ami=require(_0xce83('0x9'));config[_0xce83('0xa')]=_['defaults'](config[_0xce83('0xa')],{'host':_0xce83('0xb'),'port':0x18eb});var io=require(_0xce83('0xc'))(new Redis(config[_0xce83('0xa')]));var operators={'equals':function(_0x349105,_0x29b141){return _0x349105==_0x29b141;},'not_equals':function(_0x6db6d2,_0x6ff439){return _0x6db6d2!=_0x6ff439;}};var barAndWebActions=[_0xce83('0xd'),_0xce83('0x2'),_0xce83('0xe')];function Trigger(_0x23f837){this[_0xce83('0xf')]=_0x23f837[_0xce83('0xf')];this[_0xce83('0x10')]=_0x23f837[_0xce83('0x10')];this[_0xce83('0x11')]=_0x23f837[_0xce83('0x11')];this[_0xce83('0x12')]=_0x23f837['templates'];this[_0xce83('0x13')]=_0x23f837[_0xce83('0x13')];this[_0xce83('0x14')]=_0x23f837['zendeskAccounts'];this['freshdeskAccounts']=_0x23f837[_0xce83('0x15')];this['salesforceAccounts']=_0x23f837['salesforceAccounts'];this[_0xce83('0x16')]=_0x23f837['sugarcrmAccounts'];this[_0xce83('0x17')]=_0x23f837[_0xce83('0x17')];this[_0xce83('0x18')]=_0x23f837[_0xce83('0x18')];this[_0xce83('0x19')]=_0x23f837[_0xce83('0x19')];this['servicenowAccounts']=_0x23f837['servicenowAccounts'];this[_0xce83('0x1a')]=_0x23f837[_0xce83('0x1a')];this[_0xce83('0x1b')]=_0x23f837[_0xce83('0x1b')];this['accounts']={'zendesk':this[_0xce83('0x14')],'salesforce':this[_0xce83('0x1c')],'freshdesk':this[_0xce83('0x15')],'sugarcrm':this[_0xce83('0x16')],'zoho':this[_0xce83('0x17')],'desk':this['deskAccounts'],'vtiger':this[_0xce83('0x19')],'dynamics365':this[_0xce83('0x1a')],'freshsales':this[_0xce83('0x1b')],'servicenow':this[_0xce83('0x1d')]};ami['on'](_0xce83('0x1e'),this[_0xce83('0x1f')][_0xce83('0x20')](this));ami['on'](_0xce83('0x21'),this[_0xce83('0x1f')]['bind'](this));ami['on'](_0xce83('0x22'),this[_0xce83('0x1f')]['bind'](this));ami['on'](_0xce83('0x23'),this['syncCustomEvent'][_0xce83('0x20')](this));ami['on'](_0xce83('0x24'),this[_0xce83('0x1f')][_0xce83('0x20')](this));ami['on'](_0xce83('0x25'),this[_0xce83('0x1f')][_0xce83('0x20')](this));ami['on'](_0xce83('0x26'),this['syncCustomEvent'][_0xce83('0x20')](this));ami['on'](_0xce83('0x27'),this[_0xce83('0x1f')][_0xce83('0x20')](this));ami['on'](_0xce83('0x28'),this['syncCustomEvent'][_0xce83('0x20')](this));ami['on'](_0xce83('0x29'),this['syncCustomEvent'][_0xce83('0x20')](this));ami['on'](_0xce83('0x2a'),this[_0xce83('0x1f')]['bind'](this));ami['on'](_0xce83('0x2b'),this['syncCustomEvent'][_0xce83('0x20')](this));ami['on'](_0xce83('0x2c'),this[_0xce83('0x2d')][_0xce83('0x20')](this));ami['on'](_0xce83('0x2e'),this[_0xce83('0x2d')][_0xce83('0x20')](this));ami['on'](_0xce83('0x2f'),this[_0xce83('0x2d')][_0xce83('0x20')](this));ami['on']('custom:newinteraction',this[_0xce83('0x1f')][_0xce83('0x20')](this));ami['on']('custom:closedinteraction',this[_0xce83('0x1f')][_0xce83('0x20')](this));ami['on'](_0xce83('0x30'),this[_0xce83('0x1f')][_0xce83('0x20')](this));ami['on']('custom:incomingmessage',this[_0xce83('0x1f')][_0xce83('0x20')](this));ami['on'](_0xce83('0x31'),this['syncCustomEvent'][_0xce83('0x20')](this));ami['on']('custom:acceptmessage',this[_0xce83('0x1f')][_0xce83('0x20')](this));ami['on'](_0xce83('0x32'),this['syncCustomEvent'][_0xce83('0x20')](this));ami['on']('custom:offlineMessage',this[_0xce83('0x1f')]['bind'](this));}Trigger[_0xce83('0x33')][_0xce83('0x34')]=function(_0x2be6a0,_0x3419af,_0x2c12cd){logger[_0xce83('0x35')](_0x2be6a0,_0x3419af,JSON[_0xce83('0x36')](_0x2c12cd));io['to'](_0x2be6a0)[_0xce83('0x34')](_0x3419af,_0x2c12cd);};Trigger['prototype'][_0xce83('0x1f')]=function(_0xd81add){var _0x2eb631=_['clone'](_0xd81add);if(typeof _0x2eb631[_0xce83('0x37')]===_0xce83('0x38')){_0x2eb631['motionChannel']='voice';}logger['debug']('syncCustomEvent',util[_0xce83('0x39')](_0x2eb631,{'showHidden':!![],'depth':null}));this[_0xce83('0x3a')](_0x2eb631);};Trigger['prototype']['syncAgentDial']=function(_0xc509f5){if(this[_0xce83('0x10')][_0xc509f5[_0xce83('0x3b')]]){this['syncCustomEvent'](_0xc509f5);}};Trigger[_0xce83('0x33')][_0xce83('0x3a')]=function(_0x1ce00c){var _0x291ae6;for(var _0x2ec6e7 in this[_0xce83('0xf')]){if(this[_0xce83('0xf')][_0xce83('0x3c')](_0x2ec6e7)){if(this[_0xce83('0xf')][_0x2ec6e7][_0xce83('0x3d')]){_0x291ae6=this[_0xce83('0x3e')](this[_0xce83('0xf')][_0x2ec6e7],_0x1ce00c);if(_0x291ae6){_[_0xce83('0x3f')](_0x1ce00c,_0x1ce00c['variables']);for(var _0xe82afc=0x0,_0x1c7341,_0x2bbe9c,_0x5d5c2d;_0xe82afc0x0){_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 +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(_0xd34cfd,_0x50eb91){var _0x547845=function(_0x1c3c77){while(--_0x1c3c77){_0xd34cfd['push'](_0xd34cfd['shift']());}};_0x547845(++_0x50eb91);}(_0x3e74,0x175));var _0x43e7=function(_0x581996,_0x45e00e){_0x581996=_0x581996-0x0;var _0x291b63=_0x3e74[_0x581996];return _0x291b63;};'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 d52a836..a3ed298 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 _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 +var _0x2088=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','data5','POST','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','length','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','lastIndexOf','enduserId','toLowerCase','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','customField','idField','substring','indexOf','content','ticketType','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','assign','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token'];(function(_0x176a82,_0x530048){var _0x51737f=function(_0x159ba4){while(--_0x159ba4){_0x176a82['push'](_0x176a82['shift']());}};_0x51737f(++_0x530048);}(_0x2088,0x1d0));var _0x8208=function(_0x4dbda8,_0xbce830){_0x4dbda8=_0x4dbda8-0x0;var _0x1149ed=_0x2088[_0x4dbda8];return _0x1149ed;};'use strict';var _=require(_0x8208('0x0'));var rp=require(_0x8208('0x1'));var util=require(_0x8208('0x2'));var intUtil=require('./util');var md5=require(_0x8208('0x3'));var Redis=require(_0x8208('0x4'));var logger=require(_0x8208('0x5'))(_0x8208('0x6'));var config=require('../../../../config/environment');config[_0x8208('0x7')]=_[_0x8208('0x8')](config['redis'],{'host':_0x8208('0x9'),'port':0x18eb});var io=require(_0x8208('0xa'))(new Redis(config[_0x8208('0x7')]));function getAuthToken(_0x5e1b48,_0xa76645,_0x26d382){if(_0x5e1b48[_0x8208('0xb')]){_0x5e1b48[_0x8208('0xc')]=_0x5e1b48[_0x8208('0xd')][_0x8208('0xe')];_0x5e1b48['tenantId']=_0x5e1b48[_0x8208('0xd')][_0x8208('0xf')];return Promise['resolve'](_0x5e1b48['CloudProvider'][_0x8208('0x10')]);}var _0x30e374={'method':_0x8208('0x11'),'uri':_0xa76645,'form':{'client_id':_0x5e1b48['clientId'],'resource':_0x5e1b48[_0x8208('0xc')],'username':_0x5e1b48['username'],'password':_0x5e1b48[_0x8208('0x12')],'grant_type':_0x8208('0x12'),'client_secret':_0x5e1b48[_0x8208('0x13')]},'json':!![]};return rp(_0x30e374)[_0x8208('0x14')](function(_0x257b2b){return _0x257b2b[_0x8208('0x15')];})[_0x8208('0x16')](function(_0x36d1e6){logger[_0x8208('0x17')]('['+[_0x26d382['toUpperCase']()]+_0x8208('0x18'));return _0x36d1e6[_0x8208('0x19')];});}function getUser(_0x564aef,_0x406104,_0x2e9b63,_0x5e0a63,_0x266aa8,_0x2fea0a){return new Promise(function(_0x12e3be,_0x506efc){return getAuthToken(_0x406104,_0x5e0a63,_0x2fea0a)[_0x8208('0x14')](function(_0x2c6592){var _0x1e3614={'method':_0x8208('0x1a'),'uri':_0x266aa8+_0x8208('0x1b'),'headers':{'Authorization':_0x8208('0x1c')+_0x2c6592,'OData-Version':_0x8208('0x1d')},'json':!![]};return rp(_0x1e3614);})[_0x8208('0x14')](function(_0x4643a9){var _0x13fbd8=_0x4643a9[_0x8208('0x1e')];var _0x130a08=![];var _0x2cd3cc=null;if(!_['isNil'](_0x2e9b63)){if(intUtil[_0x8208('0x1f')](_0x2e9b63[_0x8208('0x20')])){_0x564aef['userEmail']=_0x2e9b63['email'];for(_0x2cd3cc=0x0;_0x2cd3cc<_0x13fbd8['length'];_0x2cd3cc++){if(_0x13fbd8[_0x2cd3cc][_0x8208('0x21')]===_0x2e9b63['email']&&!_0x13fbd8[_0x2cd3cc]['isdisabled']){_0x130a08=!![];logger[_0x8208('0x22')]('['+[_0x2fea0a[_0x8208('0x23')]()]+_0x8208('0x24')+_0x13fbd8[_0x2cd3cc]['systemuserid']+'!');_0x564aef[_0x8208('0x25')]=_0x13fbd8[_0x2cd3cc][_0x8208('0x26')];}}}}if(!_0x130a08){logger[_0x8208('0x22')]('['+[_0x2fea0a[_0x8208('0x23')]()]+_0x8208('0x27'));_0x564aef[_0x8208('0x28')]=_0x406104[_0x8208('0x29')];for(_0x2cd3cc=0x0;_0x2cd3cc<_0x13fbd8[_0x8208('0x2a')];_0x2cd3cc++){if(_0x13fbd8[_0x2cd3cc]['internalemailaddress']===_0x406104['username']){_0x564aef[_0x8208('0x25')]=_0x13fbd8[_0x2cd3cc][_0x8208('0x26')];}}}_0x12e3be(_0x564aef);})[_0x8208('0x16')](function(_0xfb9b41){_0x506efc(_0xfb9b41['message']);});});}function createEndUser(_0x46bf84,_0x53ecdc,_0x1b8d2c,_0x54e26d,_0x5e7cb2,_0x599091,_0x3a53df){return new Promise(function(_0x65073,_0x26eea8){return getAuthToken(_0x53ecdc,_0x1b8d2c,_0x599091)[_0x8208('0x14')](function(_0x4da20f){var _0x4e5427=_0x599091['toLowerCase']()===_0x8208('0x2b')?_0x5e7cb2[_0x8208('0x2c')]:_0x5e7cb2[_0x8208('0x2d')];var _0x402c3c={'method':_0x8208('0x11'),'uri':_0x54e26d+_0x8208('0x2e'),'body':{'fullname':_0x4e5427,'firstname':_0x4e5427,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x46bf84[_0x8208('0x25')]+')'},'headers':{'Authorization':_0x8208('0x1c')+_0x4da20f,'OData-Version':_0x8208('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x402c3c['body'][_0x3a53df]=_0x4e5427;return rp(_0x402c3c);})[_0x8208('0x14')](function(_0x44de1b){var _0x699a12=_0x44de1b[_0x8208('0x2f')][_0x8208('0x30')];var _0x3b3617=_0x699a12['substring'](_0x699a12[_0x8208('0x31')]('(')+0x1,_0x699a12[_0x8208('0x31')](')'));_0x46bf84[_0x8208('0x32')]=_0x3b3617;_0x65073(_0x46bf84);})[_0x8208('0x16')](function(_0x5f4593){_0x26eea8(_0x5f4593[_0x8208('0x19')]);});});}function getEndUser(_0x4869c6,_0x4ae4d4,_0x13a444,_0x3130d4,_0x16fc9b,_0x400a28,_0x37a931,_0x4ee385){var _0x299b12=_0x400a28[_0x8208('0x33')]()===_0x8208('0x2b')?_0x16fc9b[_0x8208('0x2c')]:_0x16fc9b[_0x8208('0x2d')];return getAuthToken(_0x4ae4d4,_0x13a444,_0x400a28)[_0x8208('0x14')](function(_0x6d12f6){_0x4ee385=_0x4ee385?_0x4ee385:'telephone1';var _0x4599ea={'method':'GET','uri':_0x3130d4+_0x8208('0x34')+_0x4ee385+_0x8208('0x35')+_0x4ee385+_0x8208('0x36')+_0x299b12[_0x8208('0x37')]('+',_0x8208('0x38'))+'\x27','headers':{'Authorization':_0x8208('0x1c')+_0x6d12f6,'If-None-Match':null,'OData-Version':_0x8208('0x1d')},'json':!![]};return rp(_0x4599ea);})[_0x8208('0x14')](function(_0xd5bb46){var _0x206d7e=![];if(!_0xd5bb46)return _0x206d7e;var _0x4d377d=_0xd5bb46['value'];for(var _0xfc7e63=0x0;_0xfc7e63<_0x4d377d[_0x8208('0x2a')];_0xfc7e63++){if(_0x4d377d[_0xfc7e63][_0x4ee385]===_0x299b12){_0x206d7e=!![];_0x4869c6[_0x8208('0x32')]=_0x4d377d[_0xfc7e63][_0x8208('0x39')];}}return _0x206d7e;})['then'](function(_0x48293e){if(_0x48293e)return _0x4869c6;if(_0x37a931===_0x8208('0x3a')){logger[_0x8208('0x22')]('['+[_0x400a28[_0x8208('0x23')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x4869c6;}return createEndUser(_0x4869c6,_0x4ae4d4,_0x13a444,_0x3130d4,_0x16fc9b,_0x400a28,_0x4ee385)['then'](function(_0x286a98){logger[_0x8208('0x22')]('['+[_0x400a28[_0x8208('0x23')]()]+_0x8208('0x3b'),_0x286a98[_0x8208('0x32')]);return _0x286a98;});});}function getCustomFields(_0x3de714,_0x1621c9,_0x2742be){var _0x3a1cf7={};if(_0x3de714['length']>0x0){_[_0x8208('0x3c')](_0x3de714,function(_0x105c0f){if(_[_0x8208('0x3d')]([_0x8208('0x3e'),_0x8208('0x3f')],_0x105c0f['type'])&&_0x105c0f[_0x8208('0x40')]&&!_0x105c0f[_0x8208('0x41')]){var _0x1751ec=_0x105c0f[_0x8208('0x42')][_0x8208('0x33')]();var _0x3bc138=_0x1751ec[_0x8208('0x43')](0x0,_0x1751ec[_0x8208('0x44')]('_'));var _0x47ead0=_0x1751ec['substring'](_0x1751ec[_0x8208('0x44')]('_')+0x1);if(_0x3bc138===_0x2742be){_0x3a1cf7[_0x47ead0]=_0x105c0f[_0x8208('0x45')];}}});}return _0x3a1cf7;}function getTicket(_0x16c070,_0x5ed213,_0x43da4b,_0xb3080,_0xa8dae2,_0x57f49,_0x5cf3e1){return new Promise(function(_0x1edb86,_0x527153){var _0x30fff5;return getAuthToken(_0x5ed213,_0x43da4b,_0x5cf3e1)['then'](function(_0x4c8023){if(_0x57f49[_0x8208('0x46')]==='incident'){_0x30fff5={'method':_0x8208('0x11'),'uri':_0xb3080+'incidents','body':Object['assign']({},{'title':intUtil[_0x8208('0x47')](_0x57f49[_0x8208('0x48')],_0xa8dae2,'\x20'),'description':intUtil['getString'](_0x57f49[_0x8208('0x49')],_0xa8dae2,'\x0a'),'customerid_contact@odata.bind':_0x16c070[_0x8208('0x32')]?_0x8208('0x4a')+_0x16c070[_0x8208('0x32')]+')':undefined,'ownerid@odata.bind':_0x8208('0x4b')+_0x16c070[_0x8208('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x57f49[_0x8208('0x4c')],_0xa8dae2,_0x57f49[_0x8208('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x4c8023,'OData-Version':_0x8208('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x57f49['ticketType']===_0x8208('0x4d')){var _0x582e3b=_0x16c070[_0x8208('0x32')]?[{'partyid_systemuser@odata.bind':_0x8208('0x4b')+_0x16c070[_0x8208('0x25')]+')','participationtypemask':_0x16c070[_0x8208('0x4e')]===_0x8208('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x8208('0x4a')+_0x16c070[_0x8208('0x32')]+')','participationtypemask':_0x16c070[_0x8208('0x4e')]===_0x8208('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x8208('0x4b')+_0x16c070['userId']+')','participationtypemask':_0x16c070[_0x8208('0x4e')]==='queue'?0x2:0x1}];_0x30fff5={'method':_0x8208('0x11'),'uri':_0xb3080+_0x8208('0x50'),'body':Object[_0x8208('0x51')]({},{'subject':intUtil[_0x8208('0x47')](_0x57f49[_0x8208('0x48')],_0xa8dae2,'\x20'),'phonenumber':String(_0xa8dae2[_0x8208('0x2d')]),'description':intUtil[_0x8208('0x47')](_0x57f49[_0x8208('0x49')],_0xa8dae2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x16c070['enduserId']?_0x8208('0x4a')+_0x16c070[_0x8208('0x32')]+')':undefined,'ownerid@odata.bind':_0x8208('0x4b')+_0x16c070['userId']+')','directioncode':_0x16c070[_0x8208('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x582e3b},getCustomFields(_0x57f49[_0x8208('0x4c')],_0xa8dae2,_0x57f49[_0x8208('0x46')])),'headers':{'Authorization':_0x8208('0x1c')+_0x4c8023,'OData-Version':_0x8208('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x30fff5);})[_0x8208('0x14')](function(_0x381ecc){var _0x39178c=_0x381ecc[_0x8208('0x2f')][_0x8208('0x30')];var _0x3e5e85=_0x39178c[_0x8208('0x43')](_0x39178c[_0x8208('0x31')]('(')+0x1,_0x39178c['lastIndexOf'](')'));_0x16c070[_0x8208('0x52')]=_0x3e5e85;_0x1edb86(_0x16c070);})[_0x8208('0x16')](function(_0x273caf){_0x527153(_0x273caf[_0x8208('0x19')]);});});}function emit(_0xa569f2,_0x5e392c,_0x4f3e0b,_0x955bab){var _0x48eff3={'uri':util['format'](_0x8208('0x53'),_0xa569f2,_0x4f3e0b,_0x955bab)};io['to'](util[_0x8208('0x54')](_0x8208('0x55'),_0x5e392c))[_0x8208('0x56')]('trigger:browser:url',_0x48eff3);}exports['cs']=function(_0x464c8e,_0x4ad726,_0x31072a,_0x402b03,_0x5b9c28,_0x1db2ab,_0xc7cf50,_0x38045a){var _0x1aef60={};_0x1db2ab['remoteUri']=_0x1db2ab[_0x8208('0xb')]?intUtil[_0x8208('0x57')](_0x1db2ab[_0x8208('0xd')][_0x8208('0xe')]):intUtil['stripTrailingSlash'](_0x1db2ab[_0x8208('0xc')]);_0x1db2ab[_0x8208('0x58')]=intUtil['stripTrailingSlash'](_0x1db2ab[_0x8208('0x58')]);_0x1aef60[_0x8208('0x4e')]=_0x38045a===_0x8208('0x4f')||_0x38045a===_0x8208('0x59')?_0x8208('0x4f'):'outbound';var _0x5edcf3=_0x1db2ab[_0x8208('0xb')]?util['format']('%s/api/data/v9.0/',_0x1db2ab['CloudProvider'][_0x8208('0xe')]):util[_0x8208('0x54')]('%s/api/data/v9.0/',_0x1db2ab[_0x8208('0xc')]);var _0x10696d=util[_0x8208('0x54')](_0x8208('0x5a'),_0x1db2ab['tenantId']);var _0x5470c4=util[_0x8208('0x54')](_0x8208('0x5b'),_0x1db2ab['serverUrl'],_0x4ad726[_0x8208('0x5c')],md5(_0x4ad726[_0x8208('0x5c')]));if(_0x5b9c28&&_0x5b9c28[_0x8208('0x5d')]){logger[_0x8208('0x22')]('[QUEUE]',_0x8208('0x5e'));_0x4ad726['recordingURL']=_0x5470c4;}else if(_0xc7cf50&&_0xc7cf50[_0x8208('0x5f')]&&_0xc7cf50['recordingFormat']!==_0x8208('0x60')){logger['info'](_0x8208('0x61'),_0x8208('0x5e'));_0x4ad726[_0x8208('0x62')]=_0x5470c4;}else{_0x4ad726[_0x8208('0x62')]='';}return getUser(_0x1aef60,_0x1db2ab,_0x402b03,_0x10696d,_0x5edcf3,_0x38045a)[_0x8208('0x14')](function(_0x68a660){logger[_0x8208('0x22')]('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x63'),_0x68a660[_0x8208('0x25')]);logger['info']('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x64'),_0x68a660[_0x8208('0x28')]);return getEndUser(_0x68a660,_0x1db2ab,_0x10696d,_0x5edcf3,_0x4ad726,_0x38045a,_0x31072a[_0x8208('0x65')],_0x31072a['additionalSearchContact']);})[_0x8208('0x14')](function(_0x1bcdaa){logger['info']('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x66'),_0x1bcdaa['enduserId']);logger[_0x8208('0x22')]('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x67'),_0x4ad726['calleridnum']);return getTicket(_0x1bcdaa,_0x1db2ab,_0x10696d,_0x5edcf3,_0x4ad726,_0x31072a,_0x38045a);})[_0x8208('0x14')](function(_0x4e043){logger[_0x8208('0x22')](util[_0x8208('0x54')]('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x68'),_0x31072a['ticketType'],_0x4e043[_0x8208('0x52')]));logger['info'](util[_0x8208('0x54')]('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x69'),_0x38045a));if(_0x38045a!==_0x8208('0x59')&&_0x31072a[_0x8208('0x6a')]){logger[_0x8208('0x22')]('['+_0x38045a[_0x8208('0x23')]()+']',_0x8208('0x6b'));emit(_0x1db2ab[_0x8208('0xc')],_0x402b03[_0x8208('0x6c')],_0x31072a[_0x8208('0x46')],_0x4e043[_0x8208('0x52')]);}})[_0x8208('0x16')](function(_0x1d84ec){logger[_0x8208('0x17')]('['+_0x38045a['toUpperCase']()+_0x8208('0x6d'),_0x1d84ec[_0x8208('0x19')]);console[_0x8208('0x17')](_0x8208('0x6e'),_0x1d84ec);});}; \ 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 23aef02..35608c5 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 _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 +var _0x4aee=['push','content','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','catch','unmanaged','Authorization','lastevent','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','
','name','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','forEach','includes','string','picklist','type','nameField','customField','idField'];(function(_0x37435c,_0x409780){var _0x2c26f0=function(_0x57c932){while(--_0x57c932){_0x37435c['push'](_0x37435c['shift']());}};_0x2c26f0(++_0x409780);}(_0x4aee,0x76));var _0xe4ae=function(_0x39ea3d,_0x36b866){_0x39ea3d=_0x39ea3d-0x0;var _0x940f78=_0x4aee[_0x39ea3d];return _0x940f78;};'use strict';var _=require(_0xe4ae('0x0'));var rp=require(_0xe4ae('0x1'));var md5=require(_0xe4ae('0x2'));var util=require(_0xe4ae('0x3'));var Redis=require('ioredis');var intUtil=require(_0xe4ae('0x4'));var config=require(_0xe4ae('0x5'));var logger=require(_0xe4ae('0x6'))('freshdesk');config[_0xe4ae('0x7')]=_[_0xe4ae('0x8')](config[_0xe4ae('0x7')],{'host':_0xe4ae('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe4ae('0x7')]));var headers={'Content-Type':_0xe4ae('0xa'),'Accept':_0xe4ae('0xa')};function emit(_0x2f086c,_0x123f51,_0x1bac1f){io['to'](_0x2f086c)['emit'](_0x123f51,_0x1bac1f);}function getTicket(_0x5d5c7d,_0x466dce,_0x436441,_0x3fb9a9,_0x1ca5f6){logger[_0xe4ae('0xb')](_0xe4ae('0xc'));var _0x58fe0c=_[_0xe4ae('0xd')]({'responder_id':_0x466dce['id'],'requester_id':_0x436441['id'],'name':util[_0xe4ae('0xe')](_0xe4ae('0xf'),_0x1ca5f6[_0xe4ae('0x10')]),'phone':_0x1ca5f6[_0xe4ae('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3fb9a9[_0xe4ae('0x12')],_0x1ca5f6,'\x20'),'description':intUtil[_0xe4ae('0x13')](_0x3fb9a9['Descriptions'],_0x1ca5f6,_0xe4ae('0x14')),'tags':getTags(_0x3fb9a9['Tags'],_0xe4ae('0x15'))},getCustomFields(_0x3fb9a9['Fields'],_0x1ca5f6));_0x58fe0c[_0xe4ae('0x16')]=_['mapValues'](_['keyBy'](_0x58fe0c['custom_fields'],'id'),_0xe4ae('0x17'));return request({'uri':util[_0xe4ae('0xe')](_0xe4ae('0x18'),_0x5d5c7d[_0xe4ae('0x19')]),'method':_0xe4ae('0x1a'),'body':_0x58fe0c})[_0xe4ae('0x1b')](function(_0x4e2a2f){logger['info'](_0xe4ae('0x1c'));return _0x4e2a2f;});}function getUser(_0x8c4a25,_0x5c208b){if(intUtil[_0xe4ae('0x1d')](_0x5c208b)){return request({'uri':util['format'](_0xe4ae('0x1e'),_0x8c4a25['remoteUri']),'qs':{'email':_0x5c208b}})[_0xe4ae('0x1b')](function(_0x2aa2ac){if(_0x2aa2ac[_0xe4ae('0x1f')]){logger[_0xe4ae('0xb')](_0xe4ae('0x20'));return _[_0xe4ae('0x21')](_0x2aa2ac,function(_0x5dd0ec){return _0x5dd0ec[_0xe4ae('0x22')][_0xe4ae('0x23')]===_0x5c208b;});}else{logger[_0xe4ae('0xb')](_0xe4ae('0x24'));return request({'uri':util['format'](_0xe4ae('0x25'),_0x8c4a25[_0xe4ae('0x19')])})[_0xe4ae('0x1b')](function(_0x31b297){logger[_0xe4ae('0xb')](_0xe4ae('0x26'));return _0x31b297;});}});}else{logger[_0xe4ae('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xe4ae('0x25'),_0x8c4a25[_0xe4ae('0x19')])})[_0xe4ae('0x1b')](function(_0xa6aa08){logger[_0xe4ae('0xb')](_0xe4ae('0x26'));return _0xa6aa08;});}}function getEndUser(_0x3cb90e,_0x98dc7,_0x19300f){logger['info'](_0xe4ae('0x27'),_0x19300f);return request({'uri':util['format'](_0xe4ae('0x28'),_0x3cb90e['remoteUri']),'qs':{'phone':_0x19300f}})[_0xe4ae('0x1b')](function(_0x798203){if(_0x798203['length']){logger['info']('Enduser\x20found!');return _['find'](_0x798203,{'phone':_0x19300f});}else{logger[_0xe4ae('0xb')](_0xe4ae('0x29'));return request({'uri':util[_0xe4ae('0xe')](_0xe4ae('0x28'),_0x3cb90e['remoteUri']),'method':_0xe4ae('0x1a'),'body':{'name':_0x98dc7,'phone':_0x19300f}})[_0xe4ae('0x1b')](function(_0x1fc922){logger[_0xe4ae('0xb')](_0xe4ae('0x2a'));return _0x1fc922;});}});}function getAuth(_0x406be1){return util[_0xe4ae('0xe')](_0xe4ae('0x2b'),new Buffer(_0x406be1[_0xe4ae('0x2c')]+':X')[_0xe4ae('0x2d')]('base64'));}function request(_0xffbfe){logger[_0xe4ae('0x2e')](_0xe4ae('0x2f'),JSON['stringify'](_0xffbfe));return rp(_[_0xe4ae('0x8')](_0xffbfe,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5efa6b,_0x2fce4b){var _0x124c93=[];if(_0x5efa6b&&_0x5efa6b['length']>0x0){_0x124c93=_['map'](_0x5efa6b,_0x2fce4b);}return _0x124c93;}function getCustomFields(_0x5dc34b,_0x4845a4){var _0x13aa4f=[];var _0x47bf35={'custom_fields':[]};if(_0x5dc34b['length']>0x0){_[_0xe4ae('0x30')](_0x5dc34b,function(_0x85570){if(_[_0xe4ae('0x31')]([_0xe4ae('0x32'),_0xe4ae('0x33')],_0x85570[_0xe4ae('0x34')])&&_0x85570[_0xe4ae('0x35')]&&!_0x85570[_0xe4ae('0x36')]){_0x47bf35[_0x85570[_0xe4ae('0x35')]['toLowerCase']()]=_0x85570['content'][_0xe4ae('0x2d')]();}else if(_['includes'](['string',_0xe4ae('0x33')],_0x85570['type'])&&_0x85570[_0xe4ae('0x37')]&&_0x85570[_0xe4ae('0x36')]){_0x47bf35[_0xe4ae('0x16')][_0xe4ae('0x38')]({'id':_0x85570['idField'],'value':_0x85570[_0xe4ae('0x39')][_0xe4ae('0x2d')]()});}else if(_0x85570[_0xe4ae('0x34')]==='variable'&&_0x85570[_0xe4ae('0x3a')]&&_0x85570[_0xe4ae('0x37')]&&_0x85570['customField']){_0x4845a4[_0x85570[_0xe4ae('0x3a')]]&&_0x47bf35[_0xe4ae('0x16')][_0xe4ae('0x38')]({'id':_0x85570['idField'],'value':_0x4845a4[_0x85570[_0xe4ae('0x3a')]][_0xe4ae('0x2d')]()});}else if(_0x85570[_0xe4ae('0x34')]===_0xe4ae('0x3b')&&_0x85570[_0xe4ae('0x3c')]&&_0x85570[_0xe4ae('0x3c')]['name']&&_0x85570[_0xe4ae('0x37')]&&_0x85570[_0xe4ae('0x36')]){_0x4845a4[_0x85570[_0xe4ae('0x3c')]['name'][_0xe4ae('0x3d')]()]&&_0x47bf35[_0xe4ae('0x16')][_0xe4ae('0x38')]({'id':_0x85570[_0xe4ae('0x37')],'value':_0x4845a4[_0x85570[_0xe4ae('0x3c')][_0xe4ae('0x15')]['toLowerCase']()][_0xe4ae('0x2d')]()});}});}return _0x47bf35;}exports[_0xe4ae('0x3e')]=function(_0x502a78,_0x472139,_0x5dc04e,_0x17b1da,_0x5d0f42,_0x513e97){var _0x17bab2,_0x153539;_0x513e97[_0xe4ae('0x19')]=intUtil[_0xe4ae('0x3f')](_0x513e97[_0xe4ae('0x19')]);_0x513e97['serverUrl']=intUtil[_0xe4ae('0x3f')](_0x513e97['serverUrl']);if(_0x5d0f42&&_0x5d0f42[_0xe4ae('0x40')]){logger[_0xe4ae('0xb')](_0xe4ae('0x41'),_0xe4ae('0x42'));_0x472139[_0xe4ae('0x43')]=util[_0xe4ae('0xe')](_0xe4ae('0x44'),_0x513e97[_0xe4ae('0x45')],_0x472139[_0xe4ae('0x46')],md5(_0x472139[_0xe4ae('0x46')]));}else{_0x472139[_0xe4ae('0x43')]='';}headers['Authorization']=getAuth(_0x513e97);return getUser(_0x513e97,_0x17b1da['email'])[_0xe4ae('0x1b')](function(_0x602356){_0x17bab2=_0x602356;logger[_0xe4ae('0xb')](_0xe4ae('0x47'),_0x17bab2['id']);return getEndUser(_0x513e97,_0x472139[_0xe4ae('0x10')],_0x472139[_0xe4ae('0x11')]);})[_0xe4ae('0x1b')](function(_0x290c80){_0x153539=_0x290c80;logger[_0xe4ae('0xb')](_0xe4ae('0x48'),_0x153539['id']);return getTicket(_0x513e97,_0x17bab2,_0x153539,_0x5dc04e,_0x472139);})[_0xe4ae('0x1b')](function(_0x47f452){if(_0x47f452&&_0x47f452['id']){logger['info'](_0xe4ae('0x1c'));logger[_0xe4ae('0xb')](_0xe4ae('0x49'),_0x47f452['id']);logger[_0xe4ae('0xb')]('[QUEUE]',_0xe4ae('0x4a'));emit(util[_0xe4ae('0xe')](_0xe4ae('0x4b'),_0x17b1da[_0xe4ae('0x15')]),_0xe4ae('0x4c'),{'uri':util[_0xe4ae('0xe')]('%s/helpdesk/tickets/%d',_0x513e97[_0xe4ae('0x19')],_0x47f452['id'])});}})['catch'](function(_0x22bd12){logger[_0xe4ae('0x4d')]('[QUEUE]',JSON[_0xe4ae('0x4e')](_0x22bd12));});};exports['outbound']=function(_0x404461,_0x1ca21d,_0x37aeea,_0x2a3ee2,_0x24befd,_0x42c752,_0x4583fd){var _0x283fc6,_0x1a3068;_0x42c752[_0xe4ae('0x19')]=intUtil[_0xe4ae('0x3f')](_0x42c752[_0xe4ae('0x19')]);_0x42c752[_0xe4ae('0x45')]=intUtil['stripTrailingSlash'](_0x42c752[_0xe4ae('0x45')]);if(_0x4583fd&&_0x4583fd[_0xe4ae('0x4f')]&&_0x4583fd[_0xe4ae('0x4f')]!==_0xe4ae('0x50')){logger[_0xe4ae('0xb')](_0xe4ae('0x51'),_0xe4ae('0x42'));_0x1ca21d[_0xe4ae('0x43')]=util['format'](_0xe4ae('0x44'),_0x42c752['serverUrl'],_0x1ca21d[_0xe4ae('0x46')],md5(_0x1ca21d[_0xe4ae('0x46')]));}headers['Authorization']=getAuth(_0x42c752);return getUser(_0x42c752,_0x2a3ee2[_0xe4ae('0x23')])['then'](function(_0x229538){_0x283fc6=_0x229538;logger[_0xe4ae('0xb')](_0xe4ae('0x47'),_0x283fc6['id']);return getEndUser(_0x42c752,_0x1ca21d['destcalleridname'],_0x1ca21d[_0xe4ae('0x52')]);})['then'](function(_0x9ad9ee){_0x1a3068=_0x9ad9ee;logger[_0xe4ae('0xb')](_0xe4ae('0x48'),_0x1a3068['id']);return getTicket(_0x42c752,_0x283fc6,_0x1a3068,_0x37aeea,_0x1ca21d);})[_0xe4ae('0x1b')](function(_0x18abe0){if(_0x18abe0&&_0x18abe0['id']){logger[_0xe4ae('0xb')](_0xe4ae('0x1c'));logger['info'](_0xe4ae('0x49'),_0x18abe0['id']);logger[_0xe4ae('0xb')]('[OUTBOUND]',_0xe4ae('0x4a'));emit(util[_0xe4ae('0xe')](_0xe4ae('0x4b'),_0x2a3ee2[_0xe4ae('0x15')]),_0xe4ae('0x4c'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x42c752[_0xe4ae('0x19')],_0x18abe0['id'])});}})[_0xe4ae('0x53')](function(_0x5d9dd0){logger[_0xe4ae('0x4d')](_0xe4ae('0x51'),JSON[_0xe4ae('0x4e')](_0x5d9dd0));});};exports[_0xe4ae('0x54')]=function(_0x1b22ee,_0x5c0e6e,_0x15ff9a,_0x1f3d25,_0x59bc8f,_0x1146bf){var _0x1fcc66,_0x4f1d2b;_0x1146bf[_0xe4ae('0x19')]=intUtil[_0xe4ae('0x3f')](_0x1146bf[_0xe4ae('0x19')]);_0x1146bf['serverUrl']=intUtil[_0xe4ae('0x3f')](_0x1146bf[_0xe4ae('0x45')]);if(_0x59bc8f&&_0x59bc8f[_0xe4ae('0x40')]){logger['info']('['+_0x5c0e6e['lastevent']['toUpperCase']()+']',_0xe4ae('0x42'));_0x5c0e6e[_0xe4ae('0x43')]=util[_0xe4ae('0xe')](_0xe4ae('0x44'),_0x1146bf[_0xe4ae('0x45')],_0x5c0e6e['uniqueid'],md5(_0x5c0e6e[_0xe4ae('0x46')]));}else{_0x5c0e6e[_0xe4ae('0x43')]='';}headers[_0xe4ae('0x55')]=getAuth(_0x1146bf);return getUser(_0x1146bf,'')[_0xe4ae('0x1b')](function(_0x187727){_0x1fcc66=_0x187727;logger[_0xe4ae('0xb')]('The\x20User\x20ID\x20is:',_0x1fcc66['id']);return getEndUser(_0x1146bf,_0x5c0e6e[_0xe4ae('0x10')],_0x5c0e6e[_0xe4ae('0x11')]);})[_0xe4ae('0x1b')](function(_0x521c4e){_0x4f1d2b=_0x521c4e;logger['info'](_0xe4ae('0x48'),_0x4f1d2b['id']);return getTicket(_0x1146bf,_0x1fcc66,_0x4f1d2b,_0x15ff9a,_0x5c0e6e);})[_0xe4ae('0x1b')](function(_0x1a26a1){if(_0x1a26a1){logger[_0xe4ae('0xb')](_0xe4ae('0x1c'));logger['info'](_0xe4ae('0x49'),_0x1a26a1['id']);}})[_0xe4ae('0x53')](function(_0x42f678){logger[_0xe4ae('0x4d')]('['+_0x5c0e6e[_0xe4ae('0x56')]['toUpperCase']()+']',JSON[_0xe4ae('0x4e')](_0x42f678));});}; \ 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 785abf8..c8cabee 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 _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 +var _0x6f61=['Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','add','task','Task\x20created:','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash','adminEmail','username','toLowerCase','outbound','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','message','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x6f61,0x124));var _0x16f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6f61[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var rp=require(_0x16f6('0x0'));var md5=require(_0x16f6('0x1'));var util=require(_0x16f6('0x2'));var moment=require('moment');var Promise=require(_0x16f6('0x3'));var Redis=require(_0x16f6('0x4'));var intUtil=require(_0x16f6('0x5'));var config=require(_0x16f6('0x6'));var logger=require('../../../../config/logger')(_0x16f6('0x7'));config[_0x16f6('0x8')]=_[_0x16f6('0x9')](config[_0x16f6('0x8')],{'host':_0x16f6('0xa'),'port':0x18eb});var io=require(_0x16f6('0xb'))(new Redis(config[_0x16f6('0x8')]));function getAdminId(_0x5d42f5,_0xeee067,_0x4e8a95,_0x5cde52){return new Promise(function(_0x34793a,_0x20d2b0){var _0x1193cc=![];var _0x3270b0={'method':_0x16f6('0xc'),'uri':_0x5cde52+_0x16f6('0xd'),'json':!![]};_0x3270b0[_0x16f6('0xe')]=_0x4e8a95;logger[_0x16f6('0xf')](_0x16f6('0x10'));return rp(_0x3270b0)[_0x16f6('0x11')](function(_0x15b9ae){if(_0x15b9ae){var _0x5b0f63=_0x15b9ae['users'];var _0x40c0d1=null;for(_0x40c0d1=0x0;_0x40c0d1<_0x5b0f63[_0x16f6('0x12')];_0x40c0d1++){if(_0x5b0f63[_0x40c0d1]['email']===_0x5d42f5['adminEmail']){_0x5d42f5[_0x16f6('0x13')]=_0x5b0f63[_0x40c0d1]['id'];_0x1193cc=!![];}}if(_0x1193cc){logger[_0x16f6('0xf')](_0x16f6('0x14'),_0x5d42f5[_0x16f6('0x13')]);_0x34793a(_0x5d42f5);}else{_0x20d2b0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x20d2b0({'statusCode':0x194,'message':_0x16f6('0x15')});}})[_0x16f6('0x16')](function(_0x4f0c2f){logger[_0x16f6('0x17')]('['+[_0xeee067[_0x16f6('0x18')]()]+']',_0x4f0c2f['message']);_0x20d2b0(_0x4f0c2f);});});}function getUser(_0x1ab5e2,_0x5726af,_0x11ee1c){return function(_0x3693ce){return new Promise(function(_0x349c8a,_0x523f9b){var _0x44e157={'method':_0x16f6('0xc'),'uri':_0x11ee1c+'/api/selector/owners','json':!![]};_0x44e157[_0x16f6('0xe')]=_0x5726af;logger[_0x16f6('0xf')](_0x16f6('0x19'));return rp(_0x44e157)[_0x16f6('0x11')](function(_0x520c6a){if(_0x520c6a){var _0x5447c6=_0x520c6a['users'];var _0x35a5f0=![];var _0x3c7957=null;if(_0x3693ce[_0x16f6('0x1a')]!==null){logger[_0x16f6('0xf')](_0x16f6('0x1b'),_0x3693ce[_0x16f6('0x1a')]);_0x3693ce[_0x16f6('0x1c')]=_0x3693ce[_0x16f6('0x1a')];for(_0x3c7957=0x0;_0x3c7957<_0x5447c6[_0x16f6('0x12')];_0x3c7957++){if(_0x5447c6[_0x3c7957][_0x16f6('0x1d')]===_0x3693ce[_0x16f6('0x1a')]){_0x35a5f0=!![];_0x3693ce[_0x16f6('0x1e')]=_0x5447c6[_0x3c7957]['id'];logger[_0x16f6('0xf')](_0x16f6('0x1f'),_0x3693ce[_0x16f6('0x1e')]);}}}if(!_0x35a5f0){logger[_0x16f6('0xf')](_0x16f6('0x20'));_0x3693ce['userEmail']=_0x3693ce['adminEmail'];_0x3693ce[_0x16f6('0x1e')]=_0x3693ce[_0x16f6('0x13')];_0x35a5f0=!![];}if(_0x35a5f0){_0x349c8a(_0x3693ce);}else{_0x523f9b({'statusCode':0x194,'message':_0x16f6('0x15')});}}else{_0x523f9b({'statusCode':0x194,'message':_0x16f6('0x15')});}})['catch'](function(_0x5332a4){logger['error']('['+[_0x1ab5e2[_0x16f6('0x18')]()]+']',_0x5332a4[_0x16f6('0x21')]);_0x523f9b(_0x5332a4);});});};}function searchContact(_0x211965,_0x123b06,_0x266fbc,_0x293505){return new Promise(function(_0x1646e1,_0x239656){var _0x310af3={'method':_0x16f6('0xc'),'headers':_0x123b06,'uri':_0x211965+'/api/lookup?q='+_0x293505+'&f='+_0x266fbc+'&entities=contact','json':!![]};rp(_0x310af3)[_0x16f6('0x11')](function(_0x4bb78a){var _0x18aea3=_[_0x16f6('0x22')](_0x4bb78a[_0x16f6('0x23')]['contacts'],[_0x266fbc,_0x293505]);_0x1646e1(_0x18aea3);})[_0x16f6('0x16')](function(_0x2c9417){_0x239656(_0x2c9417);});});}function getEndUser(_0x13bf74,_0x3e84d8,_0x9b6860){return function(_0x55d9c5){return new Promise(function(_0x3ebbf9,_0x5f2778){logger[_0x16f6('0xf')](util[_0x16f6('0x24')](_0x16f6('0x25'),_0x55d9c5[_0x16f6('0x26')]));searchContact(_0x9b6860,_0x3e84d8,_0x16f6('0x27'),_0x55d9c5[_0x16f6('0x26')])[_0x16f6('0x11')](function(_0x37584b){if(_0x37584b){_0x55d9c5['endUserId']=_0x37584b['id'];logger['info'](_0x16f6('0x28'),_0x55d9c5['endUserId']);return _0x3ebbf9(_0x55d9c5);}searchContact(_0x9b6860,_0x3e84d8,_0x16f6('0x29'),_0x55d9c5[_0x16f6('0x26')])['then'](function(_0xc9f349){if(_0xc9f349){_0x55d9c5[_0x16f6('0x2a')]=_0xc9f349['id'];logger[_0x16f6('0xf')](_0x16f6('0x2b'),_0x55d9c5[_0x16f6('0x2a')]);return _0x3ebbf9(_0x55d9c5);}createEndUser(_0x55d9c5,_0x13bf74,_0x3e84d8,_0x9b6860)[_0x16f6('0x11')](function(_0x4d66f1){logger[_0x16f6('0xf')](_0x16f6('0x2c'),_0x4d66f1[_0x16f6('0x2a')]);return _0x3ebbf9(_0x4d66f1);});});})[_0x16f6('0x16')](function(_0x52ef1f){_0x5f2778(_0x52ef1f);});});};}function createEndUser(_0x39dec9,_0x52b38b,_0x1abfff,_0x5ba343){return new Promise(function(_0x2b7a1e,_0x16e4f4){var _0x478311=moment();var _0x3ba517={'method':_0x16f6('0x2d'),'uri':_0x5ba343+_0x16f6('0x2e'),'body':{'contact':{'last_name':_0x39dec9[_0x16f6('0x26')],'work_number':_0x39dec9[_0x16f6('0x26')],'mobile_number':_0x39dec9[_0x16f6('0x26')],'owner_id':_0x39dec9['userId'],'created_at':_0x478311[_0x16f6('0x24')](_0x16f6('0x2f'))}},'json':!![]};_0x3ba517['headers']=_0x1abfff;logger[_0x16f6('0xf')](_0x16f6('0x30'));return rp(_0x3ba517)[_0x16f6('0x11')](function(_0x58c09e){_0x39dec9['endUserId']=_0x58c09e[_0x16f6('0x31')]['id'];_0x2b7a1e(_0x39dec9);})[_0x16f6('0x16')](function(_0x126331){logger[_0x16f6('0x17')]('['+[_0x52b38b[_0x16f6('0x18')]()]+']',_0x126331['message']);_0x16e4f4(_0x126331[_0x16f6('0x21')]);});});}function getTicket(_0x503120,_0x18eb0b,_0x3525a0,_0x255ec3,_0x5a0f29){return function(_0x5130f8){logger[_0x16f6('0xf')](_0x16f6('0x32'));return new Promise(function(_0x4501e1,_0x467d36){var _0x51558d=moment();var _0x42cb3f={'method':_0x16f6('0x2d'),'uri':_0x3525a0+_0x16f6('0x33'),'body':{'title':intUtil[_0x16f6('0x34')](_0x255ec3[_0x16f6('0x35')],_0x5a0f29,'\x20'),'description':intUtil[_0x16f6('0x34')](_0x255ec3['Descriptions'],_0x5a0f29,'\x0a'),'owner_id':_0x5130f8[_0x16f6('0x1e')],'creater_id':_0x5130f8['adminId'],'targetable_id':_0x5130f8['endUserId'],'targetable_type':'Contact','created_at':_0x51558d[_0x16f6('0x24')](_0x16f6('0x2f')),'due_date':_0x51558d[_0x16f6('0x36')](0x1e,'m')[_0x16f6('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x42cb3f[_0x16f6('0xe')]=_0x18eb0b;return rp(_0x42cb3f)[_0x16f6('0x11')](function(_0x467b39){_0x5130f8['ticketId']=_0x467b39[_0x16f6('0x37')]['id'];logger[_0x16f6('0xf')](_0x16f6('0x38'),_0x5130f8[_0x16f6('0x39')]);_0x4501e1(_0x5130f8);})[_0x16f6('0x16')](function(_0x469ce9){logger[_0x16f6('0x17')]('['+[_0x503120['toUpperCase']()]+']',_0x469ce9['message']);_0x467d36(_0x469ce9['message']);});});};}function emit(_0x5407cd,_0x43d5d2,_0x3832ba){var _0x5c06bc={'uri':_0x5407cd+'/contacts/'+_0x3832ba};io['to'](util[_0x16f6('0x24')](_0x16f6('0x3a'),_0x43d5d2))[_0x16f6('0x3b')](_0x16f6('0x3c'),_0x5c06bc);}exports['cs']=function(_0x270c3b,_0xa12810,_0x382284,_0x315d10,_0x50b5e4,_0x1be13c,_0x1e3611,_0x499434){var _0x1d1aed={};var _0x4c3c91={'Authorization':_0x16f6('0x3d')+_0x1be13c['apiKey']};_0x1be13c[_0x16f6('0x3e')]=intUtil['stripTrailingSlash'](_0x1be13c[_0x16f6('0x3e')]);_0x1be13c[_0x16f6('0x3f')]=intUtil[_0x16f6('0x40')](_0x1be13c[_0x16f6('0x3f')]);var _0x196a38=_0x1be13c[_0x16f6('0x3e')];_0x1d1aed[_0x16f6('0x41')]=_0x1be13c[_0x16f6('0x42')];_0x1d1aed[_0x16f6('0x26')]=_0x499434[_0x16f6('0x43')]()===_0x16f6('0x44')?_0xa12810['destcalleridnum']:_0xa12810['calleridnum'];_0x1d1aed['callDirection']=_0x499434===_0x16f6('0x45')||_0x499434===_0x16f6('0x46')?_0x16f6('0x45'):'outbound';if(_0x315d10){_0x1d1aed[_0x16f6('0x1a')]=_0x315d10[_0x16f6('0x1d')];}var _0x2df5f9=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1be13c[_0x16f6('0x3f')],_0xa12810[_0x16f6('0x47')],md5(_0xa12810['uniqueid']));if(_0x50b5e4&&_0x50b5e4[_0x16f6('0x48')]){logger['info'](_0x16f6('0x49'),'Recording\x20is\x20enabled!');_0xa12810[_0x16f6('0x4a')]=_0x2df5f9;}else if(_0x1e3611&&_0x1e3611[_0x16f6('0x4b')]&&_0x1e3611[_0x16f6('0x4b')]!==_0x16f6('0x4c')){logger['info'](_0x16f6('0x4d'),_0x16f6('0x4e'));_0xa12810[_0x16f6('0x4a')]=_0x2df5f9;}else{_0xa12810[_0x16f6('0x4a')]='';}return getAdminId(_0x1d1aed,_0x499434,_0x4c3c91,_0x196a38)['then'](getUser(_0x499434,_0x4c3c91,_0x196a38))['then'](getEndUser(_0x499434,_0x4c3c91,_0x196a38))[_0x16f6('0x11')](getTicket(_0x499434,_0x4c3c91,_0x196a38,_0x382284,_0xa12810))[_0x16f6('0x11')](function(_0x3c6cf7){logger[_0x16f6('0xf')](util[_0x16f6('0x24')](_0x16f6('0x4f'),_0x3c6cf7['ticketId']));if(_0x499434!==_0x16f6('0x46')){logger[_0x16f6('0xf')]('['+[_0x499434[_0x16f6('0x18')]()]+']',_0x16f6('0x50'));emit(_0x196a38,_0x315d10[_0x16f6('0x51')],_0x3c6cf7['endUserId']);}})[_0x16f6('0x16')](function(_0x136249){logger[_0x16f6('0x17')]('['+[_0x499434[_0x16f6('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x16f6('0x52')](_0x136249,{'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 79d263a..5a4a4f7 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 _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 +var _0xd37b=['./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','unmanaged','desk','dynamics365','log','unknown\x20integration','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xd37b,0x19a));var _0xbd37=function(_0x3e7278,_0x5b79fe){_0x3e7278=_0x3e7278-0x0;var _0x19450d=_0xd37b[_0x3e7278];return _0x19450d;};'use strict';var _=require(_0xbd37('0x0'));var util=require(_0xbd37('0x1'));var zendesk=require(_0xbd37('0x2'));var salesforce=require(_0xbd37('0x3'));var sugarcrm=require(_0xbd37('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xbd37('0x5'));var desk=require(_0xbd37('0x6'));var vtiger=require(_0xbd37('0x7'));var servicenow=require(_0xbd37('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xbd37('0x9'));var integrations=[_0xbd37('0xa'),_0xbd37('0xb'),_0xbd37('0xc'),_0xbd37('0xd'),_0xbd37('0xe'),'desk',_0xbd37('0xf'),'dynamics365',_0xbd37('0x10'),_0xbd37('0x11')];exports[_0xbd37('0x12')]=function(_0x176c55,_0x439da4,_0x4aa71c,_0x43c391,_0x46e1ee,_0x11891c){if(_0x4aa71c){if(_[_0xbd37('0x13')](integrations,_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')]())){try{var _0x1ed010=null;var _0x32c1ee='';var _0x50c218=_0x4aa71c[_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')]()];if(_0x50c218){var _0x3c25a9=_0x50c218[_0x176c55[_0xbd37('0x16')]];if(_0x3c25a9){var _0x261b4a=_[_0xbd37('0x17')](_0x3c25a9[_0xbd37('0x18')],{'id':parseInt(_0x176c55[_0xbd37('0x19')],0xa)});if(_0x261b4a){if(_0x43c391){if(_0x46e1ee&&_0x439da4['queue']){_0x32c1ee=_0xbd37('0x1a');}else if(_0x439da4['routeId']){_0x32c1ee=_0xbd37('0x1b');}else{console['log']('EVENT\x20UNKNOWN',_0x439da4);}}else{_0x32c1ee=_0xbd37('0x1c');}switch(_0x176c55['data1'][_0xbd37('0x15')]()){case _0xbd37('0xa'):zendesk[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0xb'):salesforce[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0xc'):sugarcrm[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0xd'):freshdesk[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0xe'):zoho[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0x1d'):desk[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0xf'):vtiger[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0x10'):freshsales['cs'](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c,_0x32c1ee);break;case _0xbd37('0x11'):servicenow['cs'](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c,_0x32c1ee);break;case _0xbd37('0x1e'):dynamics365['cs'](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c,_0x32c1ee);break;default:console[_0xbd37('0x1f')](_0xbd37('0x20'));}}else{_0x1ed010=require('../../../../config/logger')(_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')]());_0x1ed010['error']('[EXEC]',util['format'](_0xbd37('0x21'),_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')](),_0x176c55[_0xbd37('0x19')]));}}else{_0x1ed010=require(_0xbd37('0x22'))(_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')]());_0x1ed010[_0xbd37('0x23')](_0xbd37('0x24'),util['format'](_0xbd37('0x25'),_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')](),_0x176c55['data2']));}}else{}}catch(_0x37d9b7){console['error'](_0x37d9b7);}}}}; \ 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 924c29d..812ab81 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 _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 +var _0x76a4=['WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','sobject','User','find','execute','then','length','Email','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','Account','cloneDeep','lead','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Name','upperFirst','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','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','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','account'];(function(_0x395ee2,_0x1fdf36){var _0x673f0=function(_0x3f848c){while(--_0x3f848c){_0x395ee2['push'](_0x395ee2['shift']());}};_0x673f0(++_0x1fdf36);}(_0x76a4,0xf3));var _0x476a=function(_0x55a2ec,_0x1ff1d0){_0x55a2ec=_0x55a2ec-0x0;var _0x1bf5af=_0x76a4[_0x55a2ec];return _0x1bf5af;};'use strict';var _=require(_0x476a('0x0'));var rp=require('request-promise');var moment=require(_0x476a('0x1'));var BPromise=require(_0x476a('0x2'));var md5=require(_0x476a('0x3'));var jsforce=require(_0x476a('0x4'));var util=require(_0x476a('0x5'));var Redis=require(_0x476a('0x6'));var intUtil=require(_0x476a('0x7'));var config=require(_0x476a('0x8'));var logger=require(_0x476a('0x9'))(_0x476a('0xa'));config[_0x476a('0xb')]=_[_0x476a('0xc')](config[_0x476a('0xb')],{'host':_0x476a('0xd'),'port':0x18eb});var io=require(_0x476a('0xe'))(new Redis(config[_0x476a('0xb')]));function emit(_0x375e98,_0x3626a0,_0x457f28){io['to'](_0x375e98)[_0x476a('0xf')](_0x3626a0,_0x457f28);}function getTicket(_0x370456,_0x920eb6,_0x439515,_0x12c13e,_0x57aef0,_0x17350d,_0x53faee,_0x2a3593){var _0x3facc7=Object['assign']({},{'OwnerId':_0x920eb6['id'],'Subject':intUtil[_0x476a('0x10')](_0x12c13e[_0x476a('0x11')],_0x57aef0,'\x20'),'Description':intUtil['getString'](_0x12c13e[_0x476a('0x12')],_0x57aef0,'\x0a')},getCustomFields(_0x17350d,_0x57aef0));if(_0x439515){if(_0x12c13e[_0x476a('0x13')]===_0x476a('0x14')){_0x3facc7[_0x476a('0x15')]=moment['utc']();_0x3facc7[_0x476a('0x16')]=![];_0x3facc7[_0x476a('0x17')]=![];if(_0x439515[_0x476a('0x18')]===_0x476a('0x19')||_0x439515[_0x476a('0x18')]==='lead'){_0x3facc7['WhoId']=_0x439515['id'];}else if(_0x439515[_0x476a('0x18')]===_0x476a('0x1a')){_0x3facc7[_0x476a('0x1b')]=_0x439515['id'];}}else if(_0x12c13e[_0x476a('0x13')]===_0x476a('0x1c')){if(_0x439515[_0x476a('0x18')]===_0x476a('0x19')){_0x3facc7[_0x476a('0x1d')]=_0x439515['id'];}else if(_0x439515[_0x476a('0x18')]==='account'){_0x3facc7[_0x476a('0x1e')]=_0x439515['id'];}else if(_0x439515['endUserType']==='lead'&&_0x12c13e['leadId']){_0x3facc7[_0x12c13e[_0x476a('0x1f')]]=_0x439515['id'];}else{logger[_0x476a('0x20')](_0x476a('0x21'));}}}return _0x53faee['sobject'](_0x12c13e['ticketType'])[_0x476a('0x22')](_0x3facc7);}function getUser(_0x393c67,_0x4cc82f,_0x5ecec3){if(!_['isNil'](_0x4cc82f)&&intUtil[_0x476a('0x23')](_0x4cc82f)){var _0x5b24c7={'Email':_0x4cc82f};var _0x446a15={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5ecec3[_0x476a('0x24')](_0x476a('0x25'))[_0x476a('0x26')](_0x5b24c7,_0x446a15)[_0x476a('0x27')]()[_0x476a('0x28')](function(_0xc091b1){if(_0xc091b1[_0x476a('0x29')]){var _0x4e48ff=_[_0x476a('0x26')](_0xc091b1,function(_0x907b03){return _0x907b03[_0x476a('0x2a')]===_0x4cc82f;});if(_0x4e48ff){logger[_0x476a('0x20')]('Agent\x20%s\x20found.',_0x4cc82f);return BPromise[_0x476a('0x2b')]({'id':_0x4e48ff['Id'],'name':_0x4e48ff['Name']});}}else{logger[_0x476a('0x20')](_0x476a('0x2c'),_0x4cc82f);return _0x5ecec3['identity']()['then'](function(_0x13d12f){return BPromise['resolve']({'id':_0x13d12f[_0x476a('0x2d')],'name':_0x13d12f[_0x476a('0x2e')]});});}});}else{logger[_0x476a('0x20')](_0x476a('0x2c'),_0x4cc82f);return _0x5ecec3[_0x476a('0x2f')]()[_0x476a('0x28')](function(_0x4071f1){return BPromise['resolve']({'id':_0x4071f1[_0x476a('0x2d')],'name':_0x4071f1[_0x476a('0x2e')]});});}}function getEndUser(_0x2e66c7,_0x2d16bc,_0x2c4c20,_0x167cd6,_0x11bab7){var _0x48fa81={'$or':{'Phone':_0x167cd6}};var _0x411f71={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x476a('0x2b')]()[_0x476a('0x28')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x167cd6,_0x2d16bc['moduleSearch']);switch(_0x2d16bc[_0x476a('0x30')]){case _0x476a('0x31'):var _0x336c59=_['cloneDeep'](_0x48fa81);if(_0x2d16bc[_0x476a('0x32')]){var _0x470198={};_0x470198[_0x2d16bc['additionalSearchContact']]=_0x167cd6;_[_0x476a('0x33')](_0x336c59[_0x476a('0x34')],_0x470198);}return _0x11bab7[_0x476a('0x24')](_0x476a('0x35'))['find'](_0x336c59,_0x411f71)['execute']()[_0x476a('0x28')](function(_0x352417){if(_0x352417&&_0x352417[_0x476a('0x29')]){return _0x352417;}else{var _0x43357a=_['cloneDeep'](_0x48fa81);if(_0x2d16bc[_0x476a('0x36')]){var _0x247b1f={};_0x247b1f[_0x2d16bc[_0x476a('0x36')]]=_0x167cd6;_[_0x476a('0x33')](_0x43357a[_0x476a('0x34')],_0x247b1f);}return _0x11bab7['sobject'](_0x476a('0x37'))[_0x476a('0x26')](_0x43357a,_0x411f71);}});case'account_contact_lead':var _0x4a9274=_['cloneDeep'](_0x48fa81);if(_0x2d16bc['additionalSearchAccount']){var _0x470198={};_0x470198[_0x2d16bc[_0x476a('0x38')]]=_0x167cd6;_[_0x476a('0x33')](_0x4a9274[_0x476a('0x34')],_0x470198);}return _0x11bab7['sobject'](_0x476a('0x39'))[_0x476a('0x26')](_0x4a9274,_0x411f71)[_0x476a('0x27')]()['then'](function(_0x8da777){if(_0x8da777&&_0x8da777[_0x476a('0x29')]){return _0x8da777;}else{var _0x198170=_[_0x476a('0x3a')](_0x48fa81);if(_0x2d16bc[_0x476a('0x32')]){var _0x4d84d1={};_0x4d84d1[_0x2d16bc['additionalSearchContact']]=_0x167cd6;_['merge'](_0x198170[_0x476a('0x34')],_0x4d84d1);}return _0x11bab7[_0x476a('0x24')](_0x476a('0x35'))['find'](_0x198170,_0x411f71)['then'](function(_0x54e0d6){if(_0x54e0d6&&_0x54e0d6[_0x476a('0x29')]){return _0x54e0d6;}else{var _0x492f35=_[_0x476a('0x3a')](_0x48fa81);if(_0x2d16bc[_0x476a('0x36')]){var _0x38bc70={};_0x38bc70[_0x2d16bc[_0x476a('0x36')]]=_0x167cd6;_['merge'](_0x492f35['$or'],_0x38bc70);}return _0x11bab7[_0x476a('0x24')](_0x476a('0x37'))['find'](_0x492f35,_0x411f71);}});}});case _0x476a('0x19'):var _0x336c59=_[_0x476a('0x3a')](_0x48fa81);if(_0x2d16bc[_0x476a('0x32')]){var _0x470198={};_0x470198[_0x2d16bc[_0x476a('0x32')]]=_0x167cd6;_[_0x476a('0x33')](_0x336c59[_0x476a('0x34')],_0x470198);}return _0x11bab7[_0x476a('0x24')](_0x476a('0x35'))[_0x476a('0x26')](_0x336c59,_0x411f71)[_0x476a('0x27')]();case _0x476a('0x3b'):var _0x5340fd=_['cloneDeep'](_0x48fa81);if(_0x2d16bc[_0x476a('0x36')]){var _0x470198={};_0x470198[_0x2d16bc[_0x476a('0x36')]]=_0x167cd6;_[_0x476a('0x33')](_0x5340fd[_0x476a('0x34')],_0x470198);}return _0x11bab7[_0x476a('0x24')](_0x476a('0x37'))[_0x476a('0x26')](_0x5340fd,_0x411f71);case _0x476a('0x1a'):var _0x4a9274=_[_0x476a('0x3a')](_0x48fa81);if(_0x2d16bc[_0x476a('0x38')]){var _0x470198={};_0x470198[_0x2d16bc[_0x476a('0x38')]]=_0x167cd6;_[_0x476a('0x33')](_0x4a9274[_0x476a('0x34')],_0x470198);}return _0x11bab7['sobject']('Account')[_0x476a('0x26')](_0x4a9274,_0x411f71);default:return null;}})[_0x476a('0x28')](function(_0x1d2e89){if(_0x1d2e89&&_0x1d2e89[_0x476a('0x29')]){var _0x46a220=_[_0x476a('0x3c')](_0x1d2e89);if(_0x46a220){return BPromise[_0x476a('0x2b')]({'id':_0x46a220['Id'],'name':_0x46a220['Name'],'phone':_0x46a220[_0x476a('0x3d')],'endUserType':_0x46a220[_0x476a('0x3e')]['type'][_0x476a('0x3f')]()});}}})[_0x476a('0x28')](function(_0x5033be){if(_0x5033be){logger[_0x476a('0x20')](_0x476a('0x40'),_0x5033be[_0x476a('0x18')],_0x167cd6);return BPromise[_0x476a('0x2b')](_0x5033be);}else{logger[_0x476a('0x20')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x167cd6);var _0x42022b={'Phone':_0x167cd6};if(_0x2d16bc['moduleCreate']){if(_0x2d16bc[_0x476a('0x41')]==='contact'){logger[_0x476a('0x20')](_0x476a('0x42'),_0x167cd6,_0x2d16bc[_0x476a('0x41')]);_0x42022b[_0x476a('0x43')]=_0x2c4c20!==_0x476a('0x44')?_0x2c4c20:util[_0x476a('0x45')](_0x476a('0x46'),_0x167cd6);}else if(_0x2d16bc['moduleCreate']===_0x476a('0x3b')){logger['info'](_0x476a('0x42'),_0x167cd6,_0x2d16bc[_0x476a('0x41')]);_0x42022b[_0x476a('0x43')]=_0x2c4c20!==_0x476a('0x44')?_0x2c4c20:util[_0x476a('0x45')](_0x476a('0x46'),_0x167cd6);_0x42022b[_0x476a('0x47')]=_0x476a('0x48');}else if(_0x2d16bc[_0x476a('0x41')]===_0x476a('0x1a')){logger[_0x476a('0x20')](_0x476a('0x42'),_0x167cd6,_0x2d16bc[_0x476a('0x41')]);_0x42022b[_0x476a('0x49')]=_0x2c4c20!==_0x476a('0x44')?_0x2c4c20:util[_0x476a('0x45')](_0x476a('0x46'),_0x167cd6);}else{return null;}}return _0x11bab7['sobject'](_[_0x476a('0x4a')](_0x2d16bc[_0x476a('0x41')]))[_0x476a('0x22')](_0x42022b)['then'](function(_0x4baaae){return BPromise['resolve']({'id':_0x4baaae['id'],'endUserType':_0x2d16bc[_0x476a('0x41')]});});}});}function getCustomFields(_0xeb811f,_0x72891a){var _0x2ba9ee={};if(_0xeb811f[_0x476a('0x29')]>0x0){_['forEach'](_0xeb811f,function(_0x567c9f){if(_[_0x476a('0x4b')]([_0x476a('0x4c'),_0x476a('0x4d')],_0x567c9f[_0x476a('0x4e')])&&_0x567c9f[_0x476a('0x4f')]){_0x2ba9ee[_0x567c9f[_0x476a('0x4f')]]=_0x567c9f[_0x476a('0x50')][_0x476a('0x51')]();}else if(_0x567c9f[_0x476a('0x4e')]===_0x476a('0x52')&&_0x567c9f['variableName']&&_0x567c9f[_0x476a('0x4f')]){_0x72891a[_0x567c9f[_0x476a('0x53')]]&&(_0x2ba9ee[_0x567c9f['idField']]=_0x72891a[_0x567c9f[_0x476a('0x53')]]['toString']());}else if(_0x567c9f[_0x476a('0x4e')]==='customVariable'&&_0x567c9f[_0x476a('0x54')]&&_0x567c9f['Variable'][_0x476a('0x55')]&&_0x567c9f[_0x476a('0x4f')]){_0x72891a[_0x567c9f['Variable'][_0x476a('0x55')][_0x476a('0x3f')]()]&&(_0x2ba9ee[_0x567c9f[_0x476a('0x4f')]]=_0x72891a[_0x567c9f[_0x476a('0x54')][_0x476a('0x55')][_0x476a('0x3f')]()]['toString']());}});}return _0x2ba9ee;}function getConnection(_0x5580dd){var _0x10e689=_0x5580dd[_0x476a('0x56')][_0x476a('0x57')](_0x5580dd[_0x476a('0x58')]);var _0x333d28=new jsforce[(_0x476a('0x59'))]({'oauth2':{'loginUrl':_0x5580dd[_0x476a('0x5a')]||_0x476a('0x5b'),'clientId':_0x5580dd[_0x476a('0x5c')],'clientSecret':_0x5580dd[_0x476a('0x5d')]}});return _0x333d28[_0x476a('0x5e')](_0x5580dd[_0x476a('0x5f')],_0x10e689)[_0x476a('0x28')](function(){logger['info']('Connection\x20established.');return _0x333d28;});}exports[_0x476a('0x60')]=function(_0x1f600d,_0x373aaf,_0x4e2386,_0x24be92,_0x5c5d59,_0xfc8067){var _0x126cb4,_0x4c6d8e,_0x38de8b,_0x405560;_0xfc8067[_0x476a('0x61')]=intUtil['stripTrailingSlash'](_0xfc8067['serverUrl']);_0xfc8067[_0x476a('0x5a')]=intUtil[_0x476a('0x62')](_0xfc8067[_0x476a('0x5a')]);if(_0x5c5d59&&_0x5c5d59[_0x476a('0x63')]){logger[_0x476a('0x20')](_0x476a('0x64'),_0x476a('0x65'));_0x373aaf['recordingURL']=util[_0x476a('0x45')](_0x476a('0x66'),_0xfc8067['serverUrl'],_0x373aaf['uniqueid'],md5(_0x373aaf[_0x476a('0x67')]));}else{_0x373aaf[_0x476a('0x68')]='';}return getConnection(_0xfc8067)['then'](function(_0xe695ee){_0x405560=_0xe695ee;return getUser(_0xfc8067,_0x24be92['email'],_0x405560);})[_0x476a('0x28')](function(_0x7b3e51){_0x126cb4=_0x7b3e51;return getEndUser(_0xfc8067,_0x4e2386,_0x373aaf[_0x476a('0x69')],_0x373aaf[_0x476a('0x6a')],_0x405560);})['then'](function(_0x3b6423){_0x4c6d8e=_0x3b6423;return getTicket(_0xfc8067,_0x126cb4,_0x4c6d8e,_0x4e2386,_0x373aaf,_0x4e2386[_0x476a('0x6b')],_0x405560,_0x476a('0x60'));})['then'](function(_0x3b0762){_0x38de8b=_0x3b0762;logger[_0x476a('0x20')](_0x476a('0x6c'),_0x38de8b['id']);logger[_0x476a('0x20')](_0x476a('0x6d'),_0x38de8b['id'],_0x24be92[_0x476a('0x55')],_0xfc8067[_0x476a('0x4e')]);switch(_0xfc8067['type']){case _0x476a('0x6e'):emit(util[_0x476a('0x45')](_0x476a('0x6f'),_0x24be92[_0x476a('0x55')]),_0x476a('0x70'),{'recordId':_0x38de8b['id']});break;case'newTab':emit(util[_0x476a('0x45')](_0x476a('0x6f'),_0x24be92[_0x476a('0x55')]),_0x476a('0x71'),{'uri':util[_0x476a('0x45')](_0x476a('0x72'),_0x405560[_0x476a('0x73')],_0x38de8b['id'])});break;default:logger[_0x476a('0x74')](_0x476a('0x75'));}})[_0x476a('0x76')](function(_0x4c28e0){logger[_0x476a('0x74')]('[QUEUE]',_0x4c28e0);});};exports[_0x476a('0x77')]=function(_0x525abf,_0x38f9df,_0x288731,_0x5f0501,_0x24511b,_0x3888f0,_0x4bfe09){var _0x2afb13,_0xbc9a91,_0x3115e5,_0x2bf101;_0x3888f0[_0x476a('0x61')]=intUtil[_0x476a('0x62')](_0x3888f0[_0x476a('0x61')]);_0x3888f0['remoteUri']=intUtil[_0x476a('0x62')](_0x3888f0[_0x476a('0x5a')]);if(_0x4bfe09&&_0x4bfe09[_0x476a('0x78')]&&_0x4bfe09[_0x476a('0x78')]!==_0x476a('0x79')){logger[_0x476a('0x20')](_0x476a('0x7a'),'Recording\x20is\x20enabled!');_0x38f9df[_0x476a('0x68')]=util[_0x476a('0x45')](_0x476a('0x66'),_0x3888f0['serverUrl'],_0x38f9df['uniqueid'],md5(_0x38f9df[_0x476a('0x67')]));}return getConnection(_0x3888f0)[_0x476a('0x28')](function(_0x1c818c){_0x2bf101=_0x1c818c;return getUser(_0x3888f0,_0x5f0501[_0x476a('0x7b')],_0x2bf101);})[_0x476a('0x28')](function(_0x47c6af){_0x2afb13=_0x47c6af;return getEndUser(_0x3888f0,_0x288731,_0x38f9df[_0x476a('0x7c')],_0x38f9df[_0x476a('0x7d')],_0x2bf101);})[_0x476a('0x28')](function(_0x542556){_0xbc9a91=_0x542556;return getTicket(_0x3888f0,_0x2afb13,_0xbc9a91,_0x288731,_0x38f9df,_0x288731[_0x476a('0x6b')],_0x2bf101,_0x476a('0x77'));})[_0x476a('0x28')](function(_0x3671b2){_0x3115e5=_0x3671b2;logger['info'](_0x476a('0x7e'),_0x3115e5['id']);logger['info'](_0x476a('0x7f'),_0x3115e5['id'],_0x5f0501[_0x476a('0x55')],_0x3888f0[_0x476a('0x4e')]);switch(_0x3888f0[_0x476a('0x4e')]){case _0x476a('0x6e'):emit(util[_0x476a('0x45')](_0x476a('0x6f'),_0x5f0501[_0x476a('0x55')]),_0x476a('0x70'),{'recordId':_0x3115e5['id']});break;case'newTab':emit(util[_0x476a('0x45')](_0x476a('0x6f'),_0x5f0501[_0x476a('0x55')]),_0x476a('0x71'),{'uri':util[_0x476a('0x45')]('%s/%s/e',_0x2bf101[_0x476a('0x73')],_0x3115e5['id'])});break;default:logger['error'](_0x476a('0x7a'),_0x476a('0x80'));}})['catch'](function(_0x2a7272){logger[_0x476a('0x74')](_0x476a('0x7a'),_0x2a7272);});};exports[_0x476a('0x81')]=function(_0x30f6d2,_0x5ba7dc,_0x2cee36,_0x27db06,_0x1d5dab,_0x355b97){var _0x3b7e15,_0x479b94,_0x2c0c7e,_0x14c00b;_0x355b97[_0x476a('0x61')]=intUtil[_0x476a('0x62')](_0x355b97[_0x476a('0x61')]);_0x355b97[_0x476a('0x5a')]=intUtil[_0x476a('0x62')](_0x355b97[_0x476a('0x5a')]);if(_0x1d5dab&&_0x1d5dab[_0x476a('0x63')]){logger[_0x476a('0x20')]('['+_0x5ba7dc[_0x476a('0x82')][_0x476a('0x83')]()+']',_0x476a('0x65'));_0x5ba7dc[_0x476a('0x68')]=util[_0x476a('0x45')](_0x476a('0x66'),_0x355b97[_0x476a('0x61')],_0x5ba7dc[_0x476a('0x67')],md5(_0x5ba7dc[_0x476a('0x67')]));}else{_0x5ba7dc[_0x476a('0x68')]='';}return getConnection(_0x355b97)[_0x476a('0x28')](function(_0x3a682a){_0x14c00b=_0x3a682a;if(!_[_0x476a('0x84')](_0x27db06)){return getUser(_0x355b97,_0x27db06['name'],_0x14c00b);}else{return getUser(_0x355b97,null,_0x14c00b);}})[_0x476a('0x28')](function(_0x48c99a){_0x3b7e15=_0x48c99a;return getEndUser(_0x355b97,_0x2cee36,_0x5ba7dc['calleridname'],_0x5ba7dc[_0x476a('0x6a')],_0x14c00b);})[_0x476a('0x28')](function(_0x4f4d25){_0x479b94=_0x4f4d25;return getTicket(_0x355b97,_0x3b7e15,_0x479b94,_0x2cee36,_0x5ba7dc,_0x2cee36[_0x476a('0x6b')],_0x14c00b);})['then'](function(_0x31b1b7){_0x2c0c7e=_0x31b1b7;logger[_0x476a('0x20')]('['+_0x5ba7dc[_0x476a('0x82')]['toUpperCase']()+_0x476a('0x85'),_0x2c0c7e['id']);logger[_0x476a('0x20')]('['+_0x5ba7dc[_0x476a('0x82')][_0x476a('0x83')]()+_0x476a('0x86'),_0x355b97[_0x476a('0x4e')]);})[_0x476a('0x76')](function(_0xa0e74d){logger[_0x476a('0x74')]('['+_0x5ba7dc[_0x476a('0x82')][_0x476a('0x83')]()+']',_0xa0e74d);});}; \ 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 c366854..acb1ad7 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 _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 +var _0xec19=['Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','%s/api/now/table/','remoteUri','isNil','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','true','userId','adminEmail','],\x20getUser\x20crm','catch','error','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D'];(function(_0x7cd36,_0x26f475){var _0x3e884a=function(_0x338eee){while(--_0x338eee){_0x7cd36['push'](_0x7cd36['shift']());}};_0x3e884a(++_0x26f475);}(_0xec19,0x95));var _0x9ec1=function(_0xff9595,_0x46129d){_0xff9595=_0xff9595-0x0;var _0x3a8352=_0xec19[_0xff9595];return _0x3a8352;};'use strict';var _=require(_0x9ec1('0x0'));var Promise=require('bluebird');var rp=require(_0x9ec1('0x1'));var util=require(_0x9ec1('0x2'));var md5=require(_0x9ec1('0x3'));var Redis=require(_0x9ec1('0x4'));var intUtil=require(_0x9ec1('0x5'));var config=require(_0x9ec1('0x6'));var logger=require('../../../../config/logger')(_0x9ec1('0x7'));config[_0x9ec1('0x8')]=_[_0x9ec1('0x9')](config['redis'],{'host':_0x9ec1('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x3a9bc4,_0x4bb325,_0xc1ed0e,_0x439f58,_0x1440e5,_0x44caec){return new Promise(function(_0x449d0c,_0x14db2f){var _0x2d97e2={'method':_0x9ec1('0xb'),'uri':_0x439f58+_0x9ec1('0xc')+'&'+_0x1440e5+'&'+_0x44caec,'auth':_0x4bb325,'json':!![]};return rp(_0x2d97e2)[_0x9ec1('0xd')](function(_0x1b6f4e){if(_0x1b6f4e[_0x9ec1('0xe')]['length']>0x0){_0xc1ed0e[_0x9ec1('0xf')]=_0x1b6f4e[_0x9ec1('0xe')][0x0][_0x9ec1('0x10')];}logger[_0x9ec1('0x11')]('['+[_0x3a9bc4[_0x9ec1('0x12')]()]+_0x9ec1('0x13'),_0xc1ed0e);_0x449d0c(_0xc1ed0e);})['catch'](function(_0x55858a){logger['error']('['+[_0x3a9bc4[_0x9ec1('0x12')]()]+']',_0x55858a['message']);_0x14db2f(_0x55858a['message']);});});}function getUser(_0x3a478d,_0x502bcf,_0x15534b,_0x278cda,_0x308045){return function(_0xfb9d4b){logger[_0x9ec1('0x11')]('['+[_0x3a478d[_0x9ec1('0x12')]()]+_0x9ec1('0x14'),_0xfb9d4b);return new Promise(function(_0x246493,_0x32450b){if(intUtil[_0x9ec1('0x15')](_0xfb9d4b[_0x9ec1('0x16')])){var _0x5ccde4={'method':'GET','uri':_0x15534b+_0x9ec1('0x17')+_0xfb9d4b[_0x9ec1('0x16')]+'&'+_0x278cda+'&'+_0x308045,'auth':_0x502bcf,'json':!![]};logger[_0x9ec1('0x11')]('['+[_0x3a478d[_0x9ec1('0x12')]()]+_0x9ec1('0x18'),_0x5ccde4);return rp(_0x5ccde4)[_0x9ec1('0xd')](function(_0x15b4c1){logger['info']('['+[_0x3a478d['toUpperCase']()]+'],\x20getUser\x20entity',_0x15b4c1);if(_0x15b4c1['result'][_0x9ec1('0x19')]>0x0&&String(_0x15b4c1[_0x9ec1('0xe')][0x0]['active'])===_0x9ec1('0x1a')){_0xfb9d4b[_0x9ec1('0x1b')]=_0x15b4c1[_0x9ec1('0xe')][0x0][_0x9ec1('0x10')];}else{_0xfb9d4b[_0x9ec1('0x1b')]=_0xfb9d4b[_0x9ec1('0xf')];_0xfb9d4b['userEmail']=_0xfb9d4b[_0x9ec1('0x1c')];}logger['info']('['+[_0x3a478d[_0x9ec1('0x12')]()]+_0x9ec1('0x1d'),_0xfb9d4b);_0x246493(_0xfb9d4b);})[_0x9ec1('0x1e')](function(_0x3bb228){logger[_0x9ec1('0x1f')]('['+[_0x3a478d[_0x9ec1('0x12')]()]+']',_0x3bb228['message']);_0x32450b(_0x3bb228[_0x9ec1('0x20')]);});}else{logger[_0x9ec1('0x11')]('['+[_0x3a478d[_0x9ec1('0x12')]()]+_0x9ec1('0x21'));_0xfb9d4b[_0x9ec1('0x1b')]=_0xfb9d4b[_0x9ec1('0xf')];_0xfb9d4b[_0x9ec1('0x16')]=_0xfb9d4b['adminEmail'];_0x246493(_0xfb9d4b);}});};}function createEndUser(_0x1a5903,_0x25ecd6,_0x13ccff,_0x3b143f,_0x50270c){logger['info']('['+[_0x1a5903[_0x9ec1('0x12')]()]+_0x9ec1('0x22'),_0x13ccff);return new Promise(function(_0x2722b5,_0x1b3dba){var _0x20bdf5={'method':'POST','uri':_0x3b143f+'sys_user?'+_0x50270c,'body':{'user_name':_0x13ccff['endUserNumber'],'roles':'user','first_name':_0x13ccff['endUserNumber'],'active':_0x9ec1('0x1a'),'date_format':_0x9ec1('0x23'),'phone':_0x13ccff[_0x9ec1('0x24')]},'auth':_0x25ecd6,'json':!![]};return rp(_0x20bdf5)[_0x9ec1('0xd')](function(_0x495dcb){logger[_0x9ec1('0x11')]('['+[_0x1a5903['toUpperCase']()]+_0x9ec1('0x25'),_0x495dcb[_0x9ec1('0xe')]);_0x13ccff[_0x9ec1('0x26')]=_0x495dcb[_0x9ec1('0xe')][_0x9ec1('0x10')];_0x2722b5(_0x13ccff);})[_0x9ec1('0x1e')](function(_0x2573f6){logger[_0x9ec1('0x1f')]('['+[_0x1a5903['toUpperCase']()]+']',_0x2573f6[_0x9ec1('0x20')]);_0x1b3dba(_0x2573f6[_0x9ec1('0x20')]);});});}function getEndUser(_0x2a677f,_0x47a6c5,_0x52b70a,_0x5e3d07,_0x1d9585){return function(_0xa40ad5){logger[_0x9ec1('0x11')]('['+[_0x2a677f['toUpperCase']()]+_0x9ec1('0x27'),_0xa40ad5);return new Promise(function(_0x154c1a,_0x40eeb3){var _0x9df6ea={'method':_0x9ec1('0xb'),'uri':_0x52b70a+_0x9ec1('0x28')+_0xa40ad5[_0x9ec1('0x24')]+'&'+_0x5e3d07+'&'+_0x1d9585,'auth':_0x47a6c5,'json':!![]};return rp(_0x9df6ea)[_0x9ec1('0xd')](function(_0x3e9e5c){if(_0x3e9e5c[_0x9ec1('0xe')]['length']>0x0){_0xa40ad5[_0x9ec1('0x26')]=_0x3e9e5c['result'][0x0][_0x9ec1('0x10')];logger[_0x9ec1('0x11')]('['+[_0x2a677f[_0x9ec1('0x12')]()]+'],\x20getEndUser\x20crm',_0xa40ad5);_0x154c1a(_0xa40ad5);}else{return createEndUser(_0x2a677f,_0x47a6c5,_0xa40ad5,_0x52b70a,_0x5e3d07)['then'](function(_0x441cf8){logger[_0x9ec1('0x11')]('['+[_0x2a677f[_0x9ec1('0x12')]()]+_0x9ec1('0x29'),_0x441cf8);_0x154c1a(_0x441cf8);});}})[_0x9ec1('0x1e')](function(_0x5bb4a7){logger[_0x9ec1('0x1f')]('['+[_0x2a677f[_0x9ec1('0x12')]()]+']',_0x5bb4a7[_0x9ec1('0x20')]);_0x40eeb3(_0x5bb4a7[_0x9ec1('0x20')]);});});};}function getCustomFields(_0x1bfd58,_0x33f3d5){var _0x239a44={};if(_0x1bfd58[_0x9ec1('0x19')]>0x0){_[_0x9ec1('0x2a')](_0x1bfd58,function(_0x338447){if(_[_0x9ec1('0x2b')]([_0x9ec1('0x2c'),_0x9ec1('0x2d')],_0x338447[_0x9ec1('0x2e')])&&_0x338447['nameField']&&!_0x338447[_0x9ec1('0x2f')]){_0x239a44[_0x338447['nameField'][_0x9ec1('0x30')]()]=_0x338447[_0x9ec1('0x31')][_0x9ec1('0x32')]();}else if(_[_0x9ec1('0x2b')]([_0x9ec1('0x2c'),_0x9ec1('0x2d')],_0x338447[_0x9ec1('0x2e')])&&_0x338447['idField']&&_0x338447['customField']){_0x239a44[_0x338447[_0x9ec1('0x33')][_0x9ec1('0x30')]()]=_0x338447[_0x9ec1('0x31')][_0x9ec1('0x32')]();}else if(_0x338447[_0x9ec1('0x2e')]===_0x9ec1('0x34')&&_0x338447[_0x9ec1('0x35')]&&_0x338447[_0x9ec1('0x33')]&&_0x338447[_0x9ec1('0x2f')]){_0x239a44[_0x338447['idField'][_0x9ec1('0x30')]()]=_0x33f3d5[_0x338447[_0x9ec1('0x35')]][_0x9ec1('0x32')]();}else if(_0x338447['type']===_0x9ec1('0x36')&&_0x338447['Variable']&&_0x338447[_0x9ec1('0x37')][_0x9ec1('0x38')]&&_0x338447['idField']&&_0x338447[_0x9ec1('0x2f')]){_0x239a44[_0x338447[_0x9ec1('0x33')][_0x9ec1('0x30')]()]=_0x33f3d5[_0x338447[_0x9ec1('0x37')][_0x9ec1('0x38')][_0x9ec1('0x30')]()][_0x9ec1('0x32')]();}});}return _0x239a44;}function getTicket(_0x27f35a,_0x485692,_0x4a0d23,_0x5df530,_0x159064,_0x4223f2){return function(_0x4d7d07){logger[_0x9ec1('0x11')]('['+[_0x27f35a['toUpperCase']()]+_0x9ec1('0x39'),_0x4d7d07);return new Promise(function(_0x368a2b,_0x21da19){var _0x307a4f=_0x27f35a[_0x9ec1('0x30')]()===_0x9ec1('0x3a')?_0x4d7d07['userId']:_0x4d7d07[_0x9ec1('0x26')];var _0x59d84a={'method':_0x9ec1('0x3b'),'uri':_0x4a0d23+_0x9ec1('0x3c')+'?'+_0x4223f2,'body':Object[_0x9ec1('0x3d')]({},{'active':_0x9ec1('0x1a'),'caller_id':_0x307a4f,'assigned_to':_0x4d7d07[_0x9ec1('0x1b')],'short_description':intUtil[_0x9ec1('0x3e')](_0x5df530[_0x9ec1('0x3f')],_0x159064,'\x20'),'description':intUtil[_0x9ec1('0x3e')](_0x5df530['Descriptions'],_0x159064,'\x0a')},getCustomFields(_0x5df530[_0x9ec1('0x40')],_0x159064)),'auth':_0x485692,'json':!![]};return rp(_0x59d84a)[_0x9ec1('0xd')](function(_0x5788cb){logger[_0x9ec1('0x11')]('['+[_0x27f35a[_0x9ec1('0x12')]()]+_0x9ec1('0x41'),_0x5788cb['result']);_0x4d7d07[_0x9ec1('0x42')]=_0x5788cb['result'][_0x9ec1('0x10')];_0x4d7d07[_0x9ec1('0x43')]=_0x5788cb[_0x9ec1('0xe')]['number'];logger[_0x9ec1('0x11')]('['+[_0x27f35a[_0x9ec1('0x12')]()]+_0x9ec1('0x44'),_0x4d7d07);_0x368a2b(_0x4d7d07);})[_0x9ec1('0x1e')](function(_0x5db200){logger[_0x9ec1('0x1f')]('['+[_0x27f35a[_0x9ec1('0x12')]()]+']',_0x5db200[_0x9ec1('0x20')]);_0x21da19(_0x5db200[_0x9ec1('0x20')]);});});};}function createRemoteTag(_0x1f7b6a,_0x5e0a40,_0x3cfb12,_0xfc414f){return new Promise(function(_0x2da3a8,_0x5f52b5){var _0x3e02a7={'method':_0x9ec1('0x3b'),'uri':_0x3cfb12+_0x9ec1('0x45')+'?'+_0xfc414f,'body':{'short_description':_0x1f7b6a,'global':!![],'active':!![],'name':_0x1f7b6a},'auth':_0x5e0a40,'json':!![]};return rp(_0x3e02a7)['then'](function(_0x3b4c8d){var _0x174dcc=_0x3b4c8d[_0x9ec1('0xe')]['sys_id'];_0x2da3a8(_0x174dcc);});});}function getRemoteTag(_0x567b6a,_0x527e9a,_0x40e73f,_0xfce72a,_0x52cd00){return new Promise(function(_0x42a363,_0x4b17d2){var _0x75808e={'method':_0x9ec1('0xb'),'uri':_0x40e73f+_0x9ec1('0x45')+_0x9ec1('0x46')+_0x567b6a+'&'+_0xfce72a,'auth':_0x527e9a,'json':!![]};return rp(_0x75808e)[_0x9ec1('0xd')](function(_0x1b698e){if(_0x1b698e['result'][_0x9ec1('0x19')]>0x0){var _0x39dbad=_0x1b698e['result'][0x0][_0x9ec1('0x10')];_0x42a363(_0x39dbad);}else{return createRemoteTag(_0x567b6a,_0x527e9a,_0x40e73f,_0xfce72a)['then'](function(_0x98d3de){_0x42a363(_0x98d3de);});}});});}function assignTagToIncident(_0x50d63b,_0x2f3446,_0x5478a2,_0x5d8a8d,_0x917291){return new Promise(function(_0x36fcac,_0x3dfa91){var _0x11cea2={'method':_0x9ec1('0x3b'),'uri':_0x5478a2+'label_entry'+'?'+_0x917291,'body':{'label':_0x50d63b,'table':'incident','id_type':_0x9ec1('0x47'),'table_key':_0x5d8a8d[_0x9ec1('0x42')],'title':_0x9ec1('0x48')+_0x5d8a8d[_0x9ec1('0x43')],'id_display':_0x5d8a8d[_0x9ec1('0x43')]},'auth':_0x2f3446,'json':!![]};return rp(_0x11cea2)['then'](function(_0x2ea8ac){_0x36fcac();})[_0x9ec1('0x1e')](function(){_0x36fcac();});});}function manageTags(_0x59440b,_0x46093e,_0x552c3d,_0x7b546e,_0x17b32d,_0x5d6bc5,_0x25bed9){return new Promise(function(_0x3b3b3c,_0x3714c0){var _0x5162d3=[];_0x46093e[_0x9ec1('0x2a')](function(_0x34d439){_0x5162d3[_0x9ec1('0x49')](getRemoteTag(_0x34d439,_0x552c3d,_0x7b546e,_0x5d6bc5,_0x25bed9));});return Promise[_0x9ec1('0x4a')](_0x5162d3)[_0x9ec1('0xd')](function(_0x11d4d2){if(_0x11d4d2['length']){logger[_0x9ec1('0x11')]('['+[_0x59440b[_0x9ec1('0x12')]()]+_0x9ec1('0x4b'),_0x11d4d2);var _0x40f7de=[];_0x11d4d2[_0x9ec1('0x2a')](function(_0x49aaaf){_0x40f7de[_0x9ec1('0x49')](assignTagToIncident(_0x49aaaf,_0x552c3d,_0x7b546e,_0x17b32d,_0x5d6bc5));});return Promise[_0x9ec1('0x4a')](_0x40f7de)[_0x9ec1('0xd')](function(){_0x3b3b3c();})[_0x9ec1('0x1e')](function(){_0x3b3b3c();});}else{_0x3b3b3c();}});});}function getTags(_0x10c21d,_0x51246b,_0x1214a5,_0x3709fc,_0x27cb3d,_0x5a56af){return function(_0x30b649){return new Promise(function(_0x161db1,_0x2d403a){var _0x5d5e23=[];var _0x3717ee=_0x3709fc[_0x9ec1('0x4c')];if(_0x3717ee&&_0x3717ee[_0x9ec1('0x19')]>0x0){_0x5d5e23=_[_0x9ec1('0x4d')](_0x3717ee,'name');}if(_0x5d5e23[_0x9ec1('0x19')]>0x0){return manageTags(_0x10c21d,_0x5d5e23,_0x51246b,_0x1214a5,_0x30b649,_0x27cb3d,_0x5a56af)[_0x9ec1('0xd')](function(){_0x161db1(_0x30b649);});}else{_0x161db1(_0x30b649);}});};}function emit(_0xcc44a1,_0x4391e1,_0x38bdf4){var _0x249a20=_0x9ec1('0x4e')+_0x9ec1('0x4f')+_0x9ec1('0x50')+'%255EORDERBYDESCnumber';var _0x2bc761={'uri':_0xcc44a1+_0x9ec1('0x51')+_0x38bdf4+_0x249a20};io['to'](util[_0x9ec1('0x52')](_0x9ec1('0x53'),_0x4391e1))[_0x9ec1('0x54')]('trigger:browser:url',_0x2bc761);}exports['cs']=function(_0x48c5c1,_0x2635b7,_0x21cd4a,_0x577094,_0x5cc6e2,_0x37a8fc,_0x335991,_0x36bae4){var _0x25c741={};var _0x2e9e72={'user':_0x37a8fc[_0x9ec1('0x55')],'pass':_0x37a8fc[_0x9ec1('0x56')]};var _0x467bc0=_0x9ec1('0x57');var _0x494eaf=_0x9ec1('0x58');_0x37a8fc['remoteUri']=intUtil[_0x9ec1('0x59')](_0x37a8fc['remoteUri']);_0x37a8fc['serverUrl']=intUtil[_0x9ec1('0x59')](_0x37a8fc['serverUrl']);var _0x38fc50=util[_0x9ec1('0x52')](_0x9ec1('0x5a'),_0x37a8fc[_0x9ec1('0x5b')]);_0x25c741[_0x9ec1('0x16')]=!_[_0x9ec1('0x5c')](_0x577094)?_0x577094['email']:null;_0x25c741[_0x9ec1('0x1c')]=_0x37a8fc['email'];_0x25c741[_0x9ec1('0x24')]=_0x36bae4[_0x9ec1('0x30')]()===_0x9ec1('0x3a')?_0x2635b7[_0x9ec1('0x5d')]:_0x2635b7[_0x9ec1('0x5e')];_0x25c741[_0x9ec1('0x5f')]=_0x36bae4===_0x9ec1('0x60')||_0x36bae4==='unmanaged'?'queue':_0x9ec1('0x3a');var _0x25593a=util[_0x9ec1('0x52')](_0x9ec1('0x61'),_0x37a8fc['serverUrl'],_0x2635b7[_0x9ec1('0x62')],md5(_0x2635b7[_0x9ec1('0x62')]));if(_0x5cc6e2&&_0x5cc6e2[_0x9ec1('0x63')]){logger[_0x9ec1('0x11')](_0x9ec1('0x64'),_0x9ec1('0x65'));_0x2635b7[_0x9ec1('0x66')]=_0x25593a;}else if(_0x335991&&_0x335991['recordingFormat']&&_0x335991[_0x9ec1('0x67')]!==_0x9ec1('0x68')){logger[_0x9ec1('0x11')](_0x9ec1('0x69'),'Recording\x20is\x20enabled!');_0x2635b7[_0x9ec1('0x66')]=_0x25593a;}else{_0x2635b7['recordingURL']='';}return getAdminUser(_0x36bae4,_0x2e9e72,_0x25c741,_0x38fc50,_0x494eaf,_0x467bc0)[_0x9ec1('0xd')](getUser(_0x36bae4,_0x2e9e72,_0x38fc50,_0x494eaf,_0x467bc0))[_0x9ec1('0xd')](getEndUser(_0x36bae4,_0x2e9e72,_0x38fc50,_0x494eaf,_0x467bc0))[_0x9ec1('0xd')](getTicket(_0x36bae4,_0x2e9e72,_0x38fc50,_0x21cd4a,_0x2635b7,_0x494eaf))['then'](function(_0x4f0fa9){logger['info'](util['format'](_0x9ec1('0x6a'),_0x4f0fa9['ticketId']));logger[_0x9ec1('0x11')](util[_0x9ec1('0x52')]('call\x20direction:\x20%s',_0x36bae4));if(_0x36bae4!==_0x9ec1('0x6b')){logger['info']('['+[_0x36bae4['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x37a8fc[_0x9ec1('0x5b')],_0x577094['name'],_0x4f0fa9['ticketId']);}})[_0x9ec1('0x1e')](function(_0x20c5b3){logger[_0x9ec1('0x1f')]('['+[_0x36bae4[_0x9ec1('0x12')]()]+_0x9ec1('0x6c'),util[_0x9ec1('0x6d')](_0x20c5b3,{'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 2a20a02..7b71dfc 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 _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 +var _0x146a=['Inbound','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','lastevent','toUpperCase','isNil','lodash','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','Creating\x20new\x20ticket...','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','slice','duration_hours','parent_id','parent_type','Contacts','name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','then','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','toLowerCase','toString','content','Variable','custom_fields','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Fields'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x146a,0x8d));var _0xa146=function(_0x5ee0ee,_0x3ce413){_0x5ee0ee=_0x5ee0ee-0x0;var _0x198093=_0x146a[_0x5ee0ee];return _0x198093;};'use strict';var _=require(_0xa146('0x0'));var rp=require('request-promise');var BPromise=require(_0xa146('0x1'));var md5=require('md5');var util=require(_0xa146('0x2'));var Redis=require(_0xa146('0x3'));var intUtil=require(_0xa146('0x4'));var config=require(_0xa146('0x5'));var logger=require(_0xa146('0x6'))(_0xa146('0x7'));config[_0xa146('0x8')]=_[_0xa146('0x9')](config[_0xa146('0x8')],{'host':_0xa146('0xa'),'port':0x18eb});var io=require(_0xa146('0xb'))(new Redis(config[_0xa146('0x8')]));var def={'method':_0xa146('0xc'),'json':!![]};function emit(_0x910957,_0x584894,_0x2ea082){io['to'](_0x910957)['emit'](_0x584894,_0x2ea082);}function getTicket(_0x550b80,_0x4ff822,_0x41896d,_0x4b00db,_0x142775,_0x4d96a9,_0x3ce960,_0x319175){logger['info'](_0xa146('0xd'));var _0x2d03aa=new Date();var _0x5d624d=[{'name':'name','value':intUtil[_0xa146('0xe')](_0x4b00db[_0xa146('0xf')],_0x142775,'\x20')},{'name':'assigned_user_id','value':_0x4ff822['id']},{'name':_0xa146('0x10'),'value':_0x4ff822['id']},{'name':_0xa146('0x11'),'value':intUtil['getString'](_0x4b00db[_0xa146('0x12')],_0x142775,'\x0a')},{'name':_0xa146('0x13'),'value':_0x2d03aa[_0xa146('0x14')]()[_0xa146('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0xa146('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xa146('0x17'),'value':_0x41896d['id']},{'name':_0xa146('0x18'),'value':_0xa146('0x19')},{'name':'parent_name','value':_0x41896d[_0xa146('0x1a')]},{'name':'direction','value':_0x319175}];if(_0x4d96a9[_0xa146('0x1b')]){_[_0xa146('0x1c')](_0x4d96a9,function(_0x89b632){if(_0x142775[_0x89b632[_0xa146('0x1d')]]){_0x5d624d[_0xa146('0x1e')]({'name':_0x89b632[_0xa146('0x1f')],'value':_0x142775[_0x89b632['variableName']]});}});}return request({'form':{'method':_0xa146('0x20'),'input_type':'JSON','response_type':_0xa146('0x21'),'rest_data':JSON[_0xa146('0x22')]({'session':_0x3ce960['id'],'module_name':_0xa146('0x23'),'name_value_list':_0x5d624d})}});}function getAuth(_0x4c7a7f){return util[_0xa146('0x24')](_0xa146('0x25'),new Buffer(_0x4c7a7f[_0xa146('0x26')]+':X')['toString'](_0xa146('0x27')));}function getServerInfo(_0x45977f){return request({'form':{'method':_0xa146('0x28'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa146('0x22')]({'session':_0x45977f['id']})}});}function getUser(_0x267246,_0x9a5cb6,_0x32d256){if(!_['isNil'](_0x9a5cb6)){logger[_0xa146('0x29')](_0xa146('0x2a'),_0x9a5cb6);return request({'form':{'method':_0xa146('0x2b'),'input_type':'JSON','response_type':_0xa146('0x21'),'rest_data':JSON[_0xa146('0x22')]({'session':_0x32d256['id'],'module_name':_0xa146('0x2c'),'query':util[_0xa146('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x9a5cb6),'order_by':'','offset':'0','select_fields':['id',_0xa146('0x1a'),_0xa146('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x15ef5a){if(_0x15ef5a['entry_list'][_0xa146('0x1b')]){var _0x49bef0=_['find'](_0x15ef5a['entry_list'],function(_0x65e1ef){return _0x65e1ef[_0xa146('0x2e')][_0xa146('0x2d')][_0xa146('0x2f')]===_0x9a5cb6;});if(_0x49bef0){logger[_0xa146('0x29')](_0xa146('0x30'));return BPromise['resolve']({'id':_0x49bef0[_0xa146('0x2e')]['id']['value'],'name':_0x49bef0[_0xa146('0x2e')][_0xa146('0x1a')][_0xa146('0x2f')]});}}logger[_0xa146('0x29')](_0xa146('0x31'));return BPromise[_0xa146('0x32')]({'id':_0x32d256[_0xa146('0x2e')][_0xa146('0x33')][_0xa146('0x2f')],'name':_0x32d256[_0xa146('0x2e')][_0xa146('0x2d')][_0xa146('0x2f')]});});}else{logger[_0xa146('0x29')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x32d256[_0xa146('0x2e')][_0xa146('0x33')]['value'],'name':_0x32d256[_0xa146('0x2e')]['user_name']['value']});}}function getEndUser(_0x300efd,_0x4e6ac9,_0x6128d5,_0x31b90e){logger['info'](_0xa146('0x34'),_0x6128d5);return request({'form':{'method':_0xa146('0x2b'),'input_type':_0xa146('0x21'),'response_type':_0xa146('0x21'),'rest_data':JSON['stringify']({'session':_0x31b90e['id'],'module_name':_0xa146('0x19'),'query':util[_0xa146('0x24')](_0xa146('0x35'),_0x6128d5),'order_by':'','offset':'0','select_fields':['id','name',_0xa146('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x45ea08){if(_0x45ea08[_0xa146('0x37')][_0xa146('0x1b')]){var _0x18ee6f=_[_0xa146('0x38')](_0x45ea08[_0xa146('0x37')],function(_0x2e9740){return _0x2e9740[_0xa146('0x2e')][_0xa146('0x36')][_0xa146('0x2f')]===_0x6128d5;});if(_0x18ee6f){logger[_0xa146('0x29')]('Enduser\x20found!');return BPromise[_0xa146('0x32')]({'id':_0x18ee6f[_0xa146('0x2e')]['id'][_0xa146('0x2f')],'name':_0x18ee6f[_0xa146('0x2e')]['name']['value'],'phone':_0x18ee6f['name_value_list'][_0xa146('0x36')][_0xa146('0x2f')]});}}else{logger['info'](_0xa146('0x39'));return request({'form':{'method':_0xa146('0x20'),'input_type':_0xa146('0x21'),'response_type':_0xa146('0x21'),'rest_data':JSON[_0xa146('0x22')]({'session':_0x31b90e['id'],'module_name':_0xa146('0x19'),'name_value_list':[{'name':_0xa146('0x3a'),'value':_0x4e6ac9!==_0xa146('0x3b')?_0x4e6ac9:util[_0xa146('0x24')]('Caller\x20-\x20%s',_0x6128d5)},{'name':_0xa146('0x36'),'value':_0x6128d5}]})}})[_0xa146('0x3c')](function(_0x40de5a){logger[_0xa146('0x29')](_0xa146('0x3d'));return BPromise[_0xa146('0x32')]({'id':_0x40de5a['id'],'name':_0x40de5a[_0xa146('0x37')][_0xa146('0x3a')][_0xa146('0x2f')],'phone':_0x40de5a[_0xa146('0x37')][_0xa146('0x36')]['value']});});}});}function request(_0x1a4bee){logger[_0xa146('0x3e')](_0xa146('0x3f'),JSON['stringify'](_0x1a4bee));return rp(_[_0xa146('0x40')](def,_0x1a4bee));}function getTags(_0x203d5a,_0x27e97d){var _0x5450f5=[];if(_0x203d5a&&_0x203d5a[_0xa146('0x1b')]>0x0){_0x5450f5=_[_0xa146('0x41')](_0x203d5a,_0x27e97d);}return _0x5450f5;}function getCustomFields(_0x47748c,_0x2371cd){var _0x20e3f3=[];var _0x16cc18={'custom_fields':[]};if(_0x47748c['length']>0x0){_['forEach'](_0x47748c,function(_0x39d431){if(_0x39d431[_0xa146('0x42')]===_0xa146('0x43')&&_0x39d431['nameField']&&!_0x39d431[_0xa146('0x44')]){_0x16cc18[_0x39d431['nameField'][_0xa146('0x45')]()]=_0x39d431['content'][_0xa146('0x46')]();}else if(_0x39d431[_0xa146('0x42')]===_0xa146('0x43')&&_0x39d431[_0xa146('0x1f')]&&_0x39d431[_0xa146('0x44')]){_0x16cc18['custom_fields'][_0xa146('0x1e')]({'id':_0x39d431[_0xa146('0x1f')],'value':_0x39d431[_0xa146('0x47')][_0xa146('0x46')]()});}else if(_0x39d431[_0xa146('0x42')]==='variable'&&_0x39d431[_0xa146('0x1d')]&&_0x39d431[_0xa146('0x1f')]&&_0x39d431[_0xa146('0x44')]){_0x2371cd[_0x39d431['variableName']]&&_0x16cc18['custom_fields']['push']({'id':_0x39d431['idField'],'value':_0x2371cd[_0x39d431['variableName']][_0xa146('0x46')]()});}else if(_0x39d431[_0xa146('0x42')]==='customVariable'&&_0x39d431[_0xa146('0x48')]&&_0x39d431[_0xa146('0x48')][_0xa146('0x1a')]&&_0x39d431['idField']&&_0x39d431[_0xa146('0x44')]){_0x2371cd[_0x39d431[_0xa146('0x48')]['name'][_0xa146('0x45')]()]&&_0x16cc18[_0xa146('0x49')][_0xa146('0x1e')]({'id':_0x39d431[_0xa146('0x1f')],'value':_0x2371cd[_0x39d431[_0xa146('0x48')][_0xa146('0x1a')]['toLowerCase']()][_0xa146('0x46')]()});}});}return _0x16cc18;}function getConnection(_0x363875){return request({'method':_0xa146('0xc'),'form':{'method':_0xa146('0x4a'),'input_type':'JSON','response_type':_0xa146('0x21'),'rest_data':JSON[_0xa146('0x22')]({'user_auth':{'user_name':_0x363875[_0xa146('0x4b')],'password':_0x363875[_0xa146('0x4c')],'encryption':'PLAIN'},'application':_0xa146('0x4d')})}})[_0xa146('0x3c')](function(_0x553f7b){var _0x1da92a=_0x553f7b;if(_0x1da92a['id']){def[_0xa146('0x4e')]=_0x1da92a['id'];return BPromise[_0xa146('0x32')](_0x1da92a);}else{throw new Error(util[_0xa146('0x24')](_0xa146('0x4f'),_0x363875['id']));}});}function setRelationship(_0x1b57b1,_0x1f53fa,_0x336b8f,_0x125014){return request({'form':{'method':_0xa146('0x50'),'input_type':_0xa146('0x21'),'response_type':_0xa146('0x21'),'rest_data':JSON['stringify']({'session':_0x1b57b1['id'],'module_name':'Calls','module_id':_0x336b8f['id'],'link_field_name':_0x125014,'related_ids':[_0x1f53fa['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x166023,_0x2737d9,_0x5b27e9,_0x18319f,_0x43106c,_0xca5e83){var _0x230327,_0x1ef410,_0x1bff95,_0x38dd3b;_0xca5e83['remoteUri']=intUtil[_0xa146('0x51')](_0xca5e83['remoteUri']);_0xca5e83[_0xa146('0x52')]=intUtil['stripTrailingSlash'](_0xca5e83[_0xa146('0x52')]);def[_0xa146('0x53')]=util[_0xa146('0x24')](_0xa146('0x54'),_0xca5e83[_0xa146('0x55')]);if(_0x43106c&&_0x43106c[_0xa146('0x56')]){logger[_0xa146('0x29')](_0xa146('0x57'),_0xa146('0x58'));_0x2737d9[_0xa146('0x59')]=util[_0xa146('0x24')](_0xa146('0x5a'),_0xca5e83[_0xa146('0x52')],_0x2737d9[_0xa146('0x5b')],md5(_0x2737d9[_0xa146('0x5b')]));}else{_0x2737d9[_0xa146('0x59')]='';}return getConnection(_0xca5e83)[_0xa146('0x3c')](function(_0x3d2e26){_0x38dd3b=_0x3d2e26;return getUser(_0xca5e83,_0x18319f[_0xa146('0x1a')],_0x38dd3b);})[_0xa146('0x3c')](function(_0x268310){_0x230327=_0x268310;logger[_0xa146('0x29')](_0xa146('0x5c'),_0x230327['id']);return getEndUser(_0xca5e83,_0x2737d9['calleridname'],_0x2737d9[_0xa146('0x5d')],_0x38dd3b);})[_0xa146('0x3c')](function(_0x3d9548){_0x1ef410=_0x3d9548;logger[_0xa146('0x29')]('The\x20Enduser\x20ID\x20is:',_0x1ef410['id']);return getTicket(_0xca5e83,_0x230327,_0x1ef410,_0x5b27e9,_0x2737d9,_0x5b27e9[_0xa146('0x5e')],_0x38dd3b,_0xa146('0x5f'));})[_0xa146('0x3c')](function(_0x15c2d1){_0x1bff95=_0x15c2d1;logger[_0xa146('0x29')]('Ticket\x20created!');logger[_0xa146('0x29')]('The\x20Ticket\x20ID\x20is:',_0x1bff95['id']);return setRelationship(_0x38dd3b,_0x230327,_0x1bff95,_0xa146('0x60'));})[_0xa146('0x3c')](function(){return setRelationship(_0x38dd3b,_0x1ef410,_0x1bff95,_0xa146('0x61'));})['then'](function(){return getServerInfo(_0x38dd3b);})[_0xa146('0x3c')](function(_0x7b75ad){var _0x563764=parseInt(_0x7b75ad[_0xa146('0x62')][_0xa146('0x63')](0x0));var _0x14c12e=util[_0xa146('0x24')](_0xa146('0x64'),_0xca5e83['remoteUri'],_0x1bff95['id']);if(_0x563764>0x6){_0x14c12e=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xca5e83[_0xa146('0x55')],_0x1bff95['id']);}logger[_0xa146('0x29')](_0xa146('0x57'),_0xa146('0x65'));emit(util[_0xa146('0x24')](_0xa146('0x66'),_0x18319f[_0xa146('0x1a')]),'trigger:browser:url',{'uri':_0x14c12e});})[_0xa146('0x67')](function(_0x2a1445){logger[_0xa146('0x68')]('[QUEUE]',JSON[_0xa146('0x22')](_0x2a1445));});};exports[_0xa146('0x69')]=function(_0x168f9f,_0xfdcafa,_0x2dd08d,_0x431ba9,_0x230571,_0x892459,_0x48948e){var _0x2c0445,_0x4450ef,_0x29a99b,_0x30860c;_0x892459[_0xa146('0x55')]=intUtil[_0xa146('0x51')](_0x892459[_0xa146('0x55')]);_0x892459[_0xa146('0x52')]=intUtil[_0xa146('0x51')](_0x892459[_0xa146('0x52')]);def['uri']=util['format'](_0xa146('0x54'),_0x892459[_0xa146('0x55')]);if(_0x48948e&&_0x48948e[_0xa146('0x6a')]&&_0x48948e['recordingFormat']!=='none'){logger[_0xa146('0x29')]('[OUTBOUND]',_0xa146('0x58'));_0xfdcafa[_0xa146('0x59')]=util[_0xa146('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x892459[_0xa146('0x52')],_0xfdcafa[_0xa146('0x5b')],md5(_0xfdcafa[_0xa146('0x5b')]));}return getConnection(_0x892459)[_0xa146('0x3c')](function(_0x23e3a7){_0x30860c=_0x23e3a7;return getUser(_0x892459,_0x431ba9[_0xa146('0x1a')],_0x30860c);})['then'](function(_0x393de3){_0x2c0445=_0x393de3;logger['info'](_0xa146('0x5c'),_0x2c0445['id']);return getEndUser(_0x892459,_0xfdcafa[_0xa146('0x6b')],_0xfdcafa[_0xa146('0x6c')],_0x30860c);})[_0xa146('0x3c')](function(_0x506d28){_0x4450ef=_0x506d28;logger['info'](_0xa146('0x6d'),_0x4450ef['id']);return getTicket(_0x892459,_0x2c0445,_0x4450ef,_0x2dd08d,_0xfdcafa,_0x2dd08d['Fields'],_0x30860c,_0xa146('0x6e'));})[_0xa146('0x3c')](function(_0x438f2a){_0x29a99b=_0x438f2a;logger[_0xa146('0x29')](_0xa146('0x6f'));logger[_0xa146('0x29')](_0xa146('0x70'),_0x29a99b['id']);return setRelationship(_0x30860c,_0x2c0445,_0x29a99b,_0xa146('0x60'));})[_0xa146('0x3c')](function(){return setRelationship(_0x30860c,_0x4450ef,_0x29a99b,_0xa146('0x61'));})[_0xa146('0x3c')](function(){return getServerInfo(_0x30860c);})[_0xa146('0x3c')](function(_0x4806ef){var _0x5d9f8f=parseInt(_0x4806ef['version']['charAt'](0x0));var _0x5ef381=util['format'](_0xa146('0x64'),_0x892459[_0xa146('0x55')],_0x29a99b['id']);if(_0x5d9f8f>0x6){_0x5ef381=util[_0xa146('0x24')](_0xa146('0x71'),_0x892459['remoteUri'],_0x29a99b['id']);}logger['info']('[OUTBOUND]',_0xa146('0x65'));emit(util[_0xa146('0x24')](_0xa146('0x66'),_0x431ba9[_0xa146('0x1a')]),'trigger:browser:url',{'uri':_0x5ef381});})[_0xa146('0x67')](function(_0x599467){logger[_0xa146('0x68')]('[OUTBOUND]',JSON['stringify'](_0x599467));});};exports[_0xa146('0x72')]=function(_0x33f5f3,_0x1dd55e,_0x24019c,_0x3d205b,_0x107276,_0x19ff71){var _0x4d0c60,_0x32b1ab,_0x59be1f,_0x1dafb4;_0x19ff71[_0xa146('0x55')]=intUtil[_0xa146('0x51')](_0x19ff71[_0xa146('0x55')]);_0x19ff71[_0xa146('0x52')]=intUtil[_0xa146('0x51')](_0x19ff71[_0xa146('0x52')]);def['uri']=util[_0xa146('0x24')](_0xa146('0x54'),_0x19ff71[_0xa146('0x55')]);if(_0x107276&&_0x107276[_0xa146('0x56')]){logger[_0xa146('0x29')]('['+_0x1dd55e[_0xa146('0x73')][_0xa146('0x74')]()+']',_0xa146('0x58'));_0x1dd55e[_0xa146('0x59')]=util['format'](_0xa146('0x5a'),_0x19ff71[_0xa146('0x52')],_0x1dd55e[_0xa146('0x5b')],md5(_0x1dd55e[_0xa146('0x5b')]));}else{_0x1dd55e['recordingURL']='';}return getConnection(_0x19ff71)[_0xa146('0x3c')](function(_0x174e37){_0x1dafb4=_0x174e37;if(!_[_0xa146('0x75')](_0x3d205b)){return getUser(_0x19ff71,_0x3d205b[_0xa146('0x1a')],_0x1dafb4);}else{return getUser(_0x19ff71,null,_0x1dafb4);}})[_0xa146('0x3c')](function(_0x3b675a){_0x4d0c60=_0x3b675a;logger[_0xa146('0x29')](_0xa146('0x5c'),_0x4d0c60['id']);return getEndUser(_0x19ff71,_0x1dd55e['calleridname'],_0x1dd55e[_0xa146('0x5d')],_0x1dafb4);})['then'](function(_0x2fc8fb){_0x32b1ab=_0x2fc8fb;logger[_0xa146('0x29')](_0xa146('0x6d'),_0x32b1ab['id']);return getTicket(_0x19ff71,_0x4d0c60,_0x32b1ab,_0x24019c,_0x1dd55e,_0x24019c[_0xa146('0x5e')],_0x1dafb4,'Inbound');})[_0xa146('0x3c')](function(_0x323fd4){_0x59be1f=_0x323fd4;logger[_0xa146('0x29')](_0xa146('0x6f'));logger[_0xa146('0x29')](_0xa146('0x70'),_0x59be1f['id']);return setRelationship(_0x1dafb4,_0x4d0c60,_0x59be1f,_0xa146('0x60'));})['then'](function(){return setRelationship(_0x1dafb4,_0x32b1ab,_0x59be1f,'contacts');})[_0xa146('0x3c')](function(){return getServerInfo(_0x1dafb4);})[_0xa146('0x67')](function(_0x4c63c3){logger[_0xa146('0x68')]('['+_0x1dd55e[_0xa146('0x73')][_0xa146('0x74')]()+']',JSON[_0xa146('0x22')](_0x4c63c3));});}; \ 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 53619fa..ec797d9 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 _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 +var _0xa14c=['string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','keyContent','join','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','getString','sortBy','length'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa14c,0xb9));var _0xca14=function(_0xd8a99d,_0x5426fc){_0xd8a99d=_0xd8a99d-0x0;var _0x23da1c=_0xa14c[_0xd8a99d];return _0x23da1c;};'use strict';var _=require(_0xca14('0x0'));var util=require('util');exports[_0xca14('0x1')]=function(_0x1ac7ed,_0x3bac3a,_0x1aaa9a){var _0x4b3b72=[];if(_0x1ac7ed['length']>0x0){var _0x3d53c8=_[_0xca14('0x2')](_0x1ac7ed,['id']);for(var _0xba519c=0x0;_0xba519c<_0x3d53c8[_0xca14('0x3')];_0xba519c++){var _0x1fe822=_0x3d53c8[_0xba519c];if(_0x1fe822['type']===_0xca14('0x4')){_0x4b3b72[_0xca14('0x5')](_0x1fe822[_0xca14('0x6')]);}else if(_0x1fe822[_0xca14('0x7')]===_0xca14('0x8')&&_0x1fe822['variableName']){_0x3bac3a[_0x1fe822[_0xca14('0x9')]]&&_0x4b3b72[_0xca14('0x5')](_0x3bac3a[_0x1fe822[_0xca14('0x9')]][_0xca14('0xa')]());}else if(_0x1fe822[_0xca14('0x7')]===_0xca14('0xb')&&_0x1fe822[_0xca14('0xc')]&&_0x1fe822[_0xca14('0xc')][_0xca14('0xd')]){_0x3bac3a[_0x1fe822[_0xca14('0xc')][_0xca14('0xd')][_0xca14('0xe')]()]&&_0x4b3b72['push'](_0x3bac3a[_0x1fe822[_0xca14('0xc')][_0xca14('0xd')]['toLowerCase']()][_0xca14('0xa')]());}else if(_0x1fe822[_0xca14('0x7')]==='keyValue'){if(_0x1fe822[_0xca14('0xf')]===_0xca14('0x4')&&_0x1fe822['key']){_0x4b3b72[_0xca14('0x5')](util[_0xca14('0x10')](_0xca14('0x11'),_0x1fe822[_0xca14('0x12')],_0x1fe822[_0xca14('0x13')]));}else if(_0x1fe822[_0xca14('0xf')]===_0xca14('0x8')&&_0x1fe822[_0xca14('0x9')]&&_0x1fe822[_0xca14('0x12')]){_0x3bac3a[_0x1fe822[_0xca14('0x9')]]&&_0x4b3b72['push'](util[_0xca14('0x10')](_0xca14('0x11'),_0x1fe822[_0xca14('0x12')],_0x3bac3a[_0x1fe822['variableName']]));}else if(_0x1fe822[_0xca14('0xf')]==='customVariable'&&_0x1fe822['Variable']&&_0x1fe822['Variable'][_0xca14('0xd')]&&_0x1fe822[_0xca14('0x12')]){_0x3bac3a[_0x1fe822[_0xca14('0xc')][_0xca14('0xd')]['toLowerCase']()]&&_0x4b3b72[_0xca14('0x5')](util[_0xca14('0x10')](_0xca14('0x11'),_0x1fe822[_0xca14('0x12')],_0x3bac3a[_0x1fe822['Variable']['name'][_0xca14('0xe')]()]));}}}}return _0x4b3b72[_0xca14('0x14')](_0x1aaa9a);};exports['stripTrailingSlash']=function(_0x5a3b11){var _0x46c1c9=_0x5a3b11[_0xca14('0x15')](-0x1);if(_0x46c1c9==='/'){_0x5a3b11=_0x5a3b11[_0xca14('0x16')](0x0,_0x5a3b11[_0xca14('0x17')](_0x46c1c9));}return _0x5a3b11;};exports[_0xca14('0x18')]=function(_0x503da8){if(!_[_0xca14('0x19')](_0x503da8)&&_0x503da8!==''){var _0xa15793=/^(([^<>()\[\]\\.,;:\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 _0xa15793[_0xca14('0x1a')](String(_0x503da8)[_0xca14('0xe')]());}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 1067b81..187cff0 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa9e0,0x123));var _0x0a9e=function(_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 +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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 703348e..471965e 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 _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 +var _0x4645=['application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','includes','string','nameField','customField','content','type','idField','push','variable','variableName','customVariable','Variable','toLowerCase','custom_fields','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','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','/api/v2','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit'];(function(_0x31a478,_0x392438){var _0x35cef1=function(_0x2c7e92){while(--_0x2c7e92){_0x31a478['push'](_0x31a478['shift']());}};_0x35cef1(++_0x392438);}(_0x4645,0x65));var _0x5464=function(_0x34ed5b,_0x33f30b){_0x34ed5b=_0x34ed5b-0x0;var _0x355745=_0x4645[_0x34ed5b];return _0x355745;};'use strict';var _=require(_0x5464('0x0'));var rp=require(_0x5464('0x1'));var md5=require('md5');var util=require(_0x5464('0x2'));var Redis=require(_0x5464('0x3'));var intUtil=require(_0x5464('0x4'));var config=require(_0x5464('0x5'));var logger=require(_0x5464('0x6'))(_0x5464('0x7'));config[_0x5464('0x8')]=_['defaults'](config['redis'],{'host':_0x5464('0x9'),'port':0x18eb});var io=require(_0x5464('0xa'))(new Redis(config['redis']));function emit(_0x4cf34b,_0x2cb9ab,_0x5dfa1a){io['to'](_0x4cf34b)[_0x5464('0xb')](_0x2cb9ab,_0x5dfa1a);}var headers={'Content-Type':'application/json','Accept':_0x5464('0xc')};function getTicket(_0x208ddc,_0x1cb970,_0xb9a014,_0x249dc4,_0x4ee46a){logger[_0x5464('0xd')](_0x5464('0xe'));return request({'uri':util[_0x5464('0xf')](_0x5464('0x10'),_0x208ddc[_0x5464('0x11')]),'method':_0x5464('0x12'),'body':{'ticket':_[_0x5464('0x13')]({'requester_id':_0xb9a014['id'],'submitter_id':_0x1cb970?_0x1cb970['id']:undefined,'assignee_id':_0x1cb970?_0x1cb970['id']:undefined,'tags':getTags(_0x249dc4['Tags'],_0x5464('0x14')),'subject':intUtil[_0x5464('0x15')](_0x249dc4[_0x5464('0x16')],_0x4ee46a,'\x20'),'description':intUtil[_0x5464('0x15')](_0x249dc4[_0x5464('0x17')],_0x4ee46a,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5464('0x15')](_0x249dc4['Descriptions'],_0x4ee46a,'\x0a')}},getCustomFields(_0x249dc4['Fields'],_0x4ee46a))}})[_0x5464('0x18')](function(_0x3f4a4b){logger[_0x5464('0xd')](_0x5464('0x19'));return _0x3f4a4b[_0x5464('0x1a')];});}function getUser(_0x4ebad9,_0x2b00ed){if(intUtil[_0x5464('0x1b')](_0x2b00ed)){logger['info'](_0x5464('0x1c'),_0x2b00ed);return request({'uri':util[_0x5464('0xf')]('%s/search.json',_0x4ebad9['remoteUri']),'qs':{'query':util[_0x5464('0xf')](_0x5464('0x1d'),_0x2b00ed)}})[_0x5464('0x18')](function(_0x5c1345){if(_0x5c1345[_0x5464('0x1e')]){logger[_0x5464('0xd')](_0x5464('0x1f'));return _['find'](_0x5c1345['results'],{'email':_0x2b00ed,'role':_0x5464('0x20')});}else{logger[_0x5464('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x5464('0x21'),_0x4ebad9['remoteUri'])})[_0x5464('0x18')](function(_0x8d7cf3){logger[_0x5464('0xd')](_0x5464('0x22'));return _0x8d7cf3[_0x5464('0x23')];});}});}else{logger[_0x5464('0xd')](_0x5464('0x24'));return request({'uri':util[_0x5464('0xf')](_0x5464('0x21'),_0x4ebad9[_0x5464('0x11')])})[_0x5464('0x18')](function(_0x4fb680){logger['info'](_0x5464('0x22'));return _0x4fb680[_0x5464('0x23')];});}}function getEndUser(_0x342865,_0x3a9aab,_0x493090){logger[_0x5464('0xd')]('Searching\x20enduser\x20with\x20phone',_0x493090);return request({'uri':util[_0x5464('0xf')](_0x5464('0x25'),_0x342865['remoteUri']),'qs':{'query':util[_0x5464('0xf')](_0x5464('0x26'),_0x493090)}})['then'](function(_0x31024c){var _0x33510f;if(_0x31024c[_0x5464('0x27')]['length']){_0x31024c[_0x5464('0x27')]=_[_0x5464('0x28')](_0x31024c[_0x5464('0x27')],{'suspended':![],'role':_0x5464('0x29')});if(_0x31024c[_0x5464('0x27')][_0x5464('0x2a')]){_0x33510f=_[_0x5464('0x2b')](_0x31024c['results']);}}if(_0x33510f){logger[_0x5464('0xd')](_0x5464('0x2c'));return _0x33510f;}else{logger[_0x5464('0xd')](_0x5464('0x2d'));return request({'uri':util[_0x5464('0xf')](_0x5464('0x2e'),_0x342865[_0x5464('0x11')]),'method':_0x5464('0x12'),'body':{'user':{'role':'end-user','name':util[_0x5464('0xf')](_0x5464('0x2f'),_0x3a9aab||_0x493090),'phone':_0x493090}}})[_0x5464('0x18')](function(_0x442bf1){logger[_0x5464('0xd')](_0x5464('0x30'));return _0x442bf1[_0x5464('0x23')];});}});}function getAuth(_0xc3f482){var _0x5f50d9;if(_0xc3f482[_0x5464('0x31')]===_0x5464('0x32')){_0x5f50d9=util['format']('%s:%s',_0xc3f482['username'],_0xc3f482['password']);}else if(_0xc3f482[_0x5464('0x31')]===_0x5464('0x33')){_0x5f50d9=util['format']('%s/token:%s',_0xc3f482[_0x5464('0x34')],_0xc3f482[_0x5464('0x33')]);}return util[_0x5464('0xf')](_0x5464('0x35'),new Buffer(_0x5f50d9)[_0x5464('0x36')](_0x5464('0x37')));}function request(_0x338463){logger[_0x5464('0x38')](_0x5464('0x39'),JSON[_0x5464('0x3a')](_0x338463));return rp(_[_0x5464('0x3b')](_0x338463,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1e9251,_0x4727a2){var _0x60d039=[];if(_0x1e9251&&_0x1e9251[_0x5464('0x2a')]>0x0){_0x60d039=_[_0x5464('0x3c')](_0x1e9251,_0x4727a2);}return _0x60d039;}function getCustomFields(_0x4efbc2,_0xb3f577){var _0x483637=[];var _0x1bc404={'custom_fields':[]};if(_0x4efbc2[_0x5464('0x2a')]>0x0){_[_0x5464('0x3d')](_0x4efbc2,function(_0x25a384){if(_[_0x5464('0x3e')]([_0x5464('0x3f'),'picklist'],_0x25a384['type'])&&_0x25a384[_0x5464('0x40')]&&!_0x25a384[_0x5464('0x41')]){_0x1bc404[_0x25a384[_0x5464('0x40')]['toLowerCase']()]=_0x25a384[_0x5464('0x42')][_0x5464('0x36')]();}else if(_[_0x5464('0x3e')]([_0x5464('0x3f'),'picklist'],_0x25a384[_0x5464('0x43')])&&_0x25a384[_0x5464('0x44')]&&_0x25a384[_0x5464('0x41')]){_0x1bc404['custom_fields'][_0x5464('0x45')]({'id':_0x25a384[_0x5464('0x44')],'value':_0x25a384[_0x5464('0x42')][_0x5464('0x36')]()});}else if(_0x25a384[_0x5464('0x43')]===_0x5464('0x46')&&_0x25a384[_0x5464('0x47')]&&_0x25a384[_0x5464('0x44')]&&_0x25a384[_0x5464('0x41')]){_0xb3f577[_0x25a384[_0x5464('0x47')]]&&_0x1bc404['custom_fields']['push']({'id':_0x25a384['idField'],'value':_0xb3f577[_0x25a384[_0x5464('0x47')]]['toString']()});}else if(_0x25a384['type']===_0x5464('0x48')&&_0x25a384[_0x5464('0x49')]&&_0x25a384[_0x5464('0x49')][_0x5464('0x14')]&&_0x25a384['idField']&&_0x25a384[_0x5464('0x41')]){_0xb3f577[_0x25a384[_0x5464('0x49')][_0x5464('0x14')][_0x5464('0x4a')]()]&&_0x1bc404[_0x5464('0x4b')][_0x5464('0x45')]({'id':_0x25a384[_0x5464('0x44')],'value':_0xb3f577[_0x25a384[_0x5464('0x49')][_0x5464('0x14')][_0x5464('0x4a')]()][_0x5464('0x36')]()});}});}return _0x1bc404;}exports['queue']=function(_0x192af6,_0x211713,_0x2e6f23,_0x12d799,_0x50eced,_0x1cf20e){var _0x1e9e91,_0x17602c;_0x1cf20e[_0x5464('0x11')]=intUtil[_0x5464('0x4c')](_0x1cf20e[_0x5464('0x11')]);_0x1cf20e['serverUrl']=intUtil[_0x5464('0x4c')](_0x1cf20e[_0x5464('0x4d')]);if(_0x50eced&&_0x50eced[_0x5464('0x4e')]){logger[_0x5464('0xd')](_0x5464('0x4f'),_0x5464('0x50'));_0x211713[_0x5464('0x51')]=util[_0x5464('0xf')](_0x5464('0x52'),_0x1cf20e[_0x5464('0x4d')],_0x211713['uniqueid'],md5(_0x211713[_0x5464('0x53')]));}else{_0x211713['recordingURL']='';}headers[_0x5464('0x54')]=getAuth(_0x1cf20e);return getUser(_0x1cf20e,_0x12d799[_0x5464('0x55')])[_0x5464('0x18')](function(_0x3dc016){_0x1e9e91=_0x3dc016;logger['info'](_0x5464('0x56'),_0x1e9e91['id']);return getEndUser(_0x1cf20e,_0x211713[_0x5464('0x57')],_0x211713[_0x5464('0x58')]);})[_0x5464('0x18')](function(_0x5287ad){_0x17602c=_0x5287ad;logger['info'](_0x5464('0x59'),_0x17602c['id']);return getTicket(_0x1cf20e,_0x1e9e91,_0x17602c,_0x2e6f23,_0x211713);})[_0x5464('0x18')](function(_0x3eca50){if(_0x3eca50){logger[_0x5464('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3eca50['id']);switch(_0x1cf20e[_0x5464('0x43')]){case _0x5464('0x5a'):logger[_0x5464('0xd')](_0x5464('0x4f'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1cf20e[_0x5464('0x11')],_0x1e9e91['id'],_0x3eca50['id']),'method':_0x5464('0x12')});case _0x5464('0x5b'):logger['info'](_0x5464('0x4f'),_0x5464('0x5c'));emit(util[_0x5464('0xf')](_0x5464('0x5d'),_0x12d799[_0x5464('0x14')]),_0x5464('0x5e'),{'uri':util['format'](_0x5464('0x5f'),_0x1cf20e['remoteUri'][_0x5464('0x60')]('/api/v2',''),_0x3eca50['id'])});break;default:logger[_0x5464('0x61')](_0x5464('0x4f'),_0x5464('0x62'));}}})[_0x5464('0x63')](function(_0x425cd2){logger[_0x5464('0x61')](_0x5464('0x64'),util[_0x5464('0x65')](_0x425cd2,{'showHidden':!![],'depth':null}));});};exports[_0x5464('0x66')]=function(_0x2bde3f,_0x26d448,_0x3a4966,_0x8b4163,_0x562718,_0x336568,_0x422831){var _0x1ee12b,_0x55fdd1;_0x336568[_0x5464('0x11')]=intUtil[_0x5464('0x4c')](_0x336568[_0x5464('0x11')]);_0x336568[_0x5464('0x4d')]=intUtil[_0x5464('0x4c')](_0x336568['serverUrl']);if(_0x422831&&_0x422831[_0x5464('0x67')]&&_0x422831['recordingFormat']!==_0x5464('0x68')){logger[_0x5464('0xd')]('[OUTBOUND]',_0x5464('0x50'));_0x26d448[_0x5464('0x51')]=util[_0x5464('0xf')](_0x5464('0x52'),_0x336568['serverUrl'],_0x26d448[_0x5464('0x53')],md5(_0x26d448[_0x5464('0x53')]));}headers['Authorization']=getAuth(_0x336568);return getUser(_0x336568,_0x8b4163[_0x5464('0x55')])[_0x5464('0x18')](function(_0x21a0da){_0x1ee12b=_0x21a0da;logger[_0x5464('0xd')](_0x5464('0x56'),_0x1ee12b['id']);return getEndUser(_0x336568,_0x26d448[_0x5464('0x69')],_0x26d448[_0x5464('0x6a')]);})[_0x5464('0x18')](function(_0x2330ce){_0x55fdd1=_0x2330ce;logger[_0x5464('0xd')](_0x5464('0x59'),_0x55fdd1['id']);return getTicket(_0x336568,_0x1ee12b,_0x55fdd1,_0x3a4966,_0x26d448);})[_0x5464('0x18')](function(_0x5ef45d){if(_0x5ef45d){logger['info'](_0x5464('0x6b'),_0x5ef45d['id']);switch(_0x336568[_0x5464('0x43')]){case _0x5464('0x5a'):logger[_0x5464('0xd')](_0x5464('0x6c'),_0x5464('0x6d'));return request({'uri':util['format'](_0x5464('0x6e'),_0x336568[_0x5464('0x11')],_0x1ee12b['id'],_0x5ef45d['id']),'method':_0x5464('0x12')});case _0x5464('0x5b'):logger[_0x5464('0xd')](_0x5464('0x6c'),_0x5464('0x5c'));emit(util[_0x5464('0xf')](_0x5464('0x5d'),_0x8b4163[_0x5464('0x14')]),_0x5464('0x5e'),{'uri':util['format'](_0x5464('0x5f'),_0x336568[_0x5464('0x11')][_0x5464('0x60')](_0x5464('0x6f'),''),_0x5ef45d['id'])});break;default:logger[_0x5464('0x61')](_0x5464('0x6c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5464('0x63')](function(_0x4aa5b8){logger[_0x5464('0x61')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x4aa5b8,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3ec640,_0x28aa32,_0x573308,_0x5040f8,_0xfa74a2,_0x32e9f7){var _0x15f894,_0xe264a1;_0x32e9f7[_0x5464('0x11')]=intUtil[_0x5464('0x4c')](_0x32e9f7[_0x5464('0x11')]);_0x32e9f7['serverUrl']=intUtil[_0x5464('0x4c')](_0x32e9f7[_0x5464('0x4d')]);if(_0xfa74a2&&_0xfa74a2[_0x5464('0x4e')]){logger[_0x5464('0xd')]('['+_0x28aa32['lastevent'][_0x5464('0x70')]()+']','Recording\x20is\x20enabled!');_0x28aa32[_0x5464('0x51')]=util[_0x5464('0xf')](_0x5464('0x52'),_0x32e9f7[_0x5464('0x4d')],_0x28aa32[_0x5464('0x53')],md5(_0x28aa32[_0x5464('0x53')]));}else{_0x28aa32[_0x5464('0x51')]='';}headers[_0x5464('0x54')]=getAuth(_0x32e9f7);return getUser(_0x32e9f7)[_0x5464('0x18')](function(_0x564d63){_0x15f894=_0x564d63;logger[_0x5464('0xd')](_0x5464('0x56'),_0x15f894['id']);return getEndUser(_0x32e9f7,_0x28aa32[_0x5464('0x57')],_0x28aa32['calleridnum']);})[_0x5464('0x18')](function(_0x41a098){_0xe264a1=_0x41a098;logger[_0x5464('0xd')](_0x5464('0x59'),_0xe264a1['id']);return getTicket(_0x32e9f7,_0x15f894,_0xe264a1,_0x573308,_0x28aa32);})[_0x5464('0x18')](function(_0x195e2d){if(_0x195e2d){logger[_0x5464('0xd')](_0x5464('0x6b'),_0x195e2d['id']);}})[_0x5464('0x63')](function(_0x46590a){logger['error']('['+_0x28aa32['lastevent'][_0x5464('0x70')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x5464('0x65')](_0x46590a,{'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 b691b15..ddbaab6 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 _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 +var _0xbfd5=['../../../../config/environment','../../../../config/logger','zoho','redis','defaults','emit','debug','[HTTP]','includes','string','picklist','type','idField','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','clientId','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','Administrator','user','profile','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','Contacts','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','mm:ss','utc','endtime','diff','starttime','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','Fields','POST','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','recordingFormat','none','[OUTBOUND]','zoho.eu','destcalleridname','destcalleridnum','Outbound','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','calleridname','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis'];(function(_0x3be224,_0x458155){var _0x152543=function(_0x469db9){while(--_0x469db9){_0x3be224['push'](_0x3be224['shift']());}};_0x152543(++_0x458155);}(_0xbfd5,0x1dc));var _0x5bfd=function(_0x25c045,_0x23937a){_0x25c045=_0x25c045-0x0;var _0x3ddf91=_0xbfd5[_0x25c045];return _0x3ddf91;};'use strict';var _=require(_0x5bfd('0x0'));var rp=require(_0x5bfd('0x1'));var md5=require(_0x5bfd('0x2'));var util=require(_0x5bfd('0x3'));var intUtil=require(_0x5bfd('0x4'));var moment=require(_0x5bfd('0x5'));var Redis=require(_0x5bfd('0x6'));var BPromise=require('bluebird');var config=require(_0x5bfd('0x7'));var logger=require(_0x5bfd('0x8'))(_0x5bfd('0x9'));config[_0x5bfd('0xa')]=_[_0x5bfd('0xb')](config[_0x5bfd('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bfd('0xa')]));function emit(_0x3ff872,_0x1d0ccc,_0x183892){io['to'](_0x3ff872)[_0x5bfd('0xc')](_0x1d0ccc,_0x183892);}function request(_0x3ac577){logger[_0x5bfd('0xd')](_0x5bfd('0xe'),JSON['stringify'](_0x3ac577));return rp(_0x3ac577);}function getCustomFields(_0x234022,_0x55f210){var _0x20fab1={};if(_0x234022['length']>0x0){_['forEach'](_0x234022,function(_0x13c7dc){if(_[_0x5bfd('0xf')]([_0x5bfd('0x10'),_0x5bfd('0x11')],_0x13c7dc[_0x5bfd('0x12')])&&_0x13c7dc[_0x5bfd('0x13')]){_0x20fab1[_0x13c7dc['idField']]=_0x13c7dc['content']['toString']();}else if(_0x13c7dc[_0x5bfd('0x12')]===_0x5bfd('0x14')&&_0x13c7dc[_0x5bfd('0x15')]&&_0x13c7dc[_0x5bfd('0x13')]&&_0x55f210[_0x13c7dc[_0x5bfd('0x15')]]){_0x20fab1[_0x13c7dc[_0x5bfd('0x13')]]=_0x55f210[_0x13c7dc[_0x5bfd('0x15')]]['toString']();}else if(_0x13c7dc[_0x5bfd('0x12')]===_0x5bfd('0x16')&&_0x13c7dc['Variable']&&_0x13c7dc[_0x5bfd('0x17')][_0x5bfd('0x18')]&&_0x13c7dc[_0x5bfd('0x13')]&&_0x55f210[_0x13c7dc[_0x5bfd('0x17')]['name'][_0x5bfd('0x19')]()]){_0x20fab1[_0x13c7dc[_0x5bfd('0x13')]]=_0x55f210[_0x13c7dc[_0x5bfd('0x17')][_0x5bfd('0x18')][_0x5bfd('0x19')]()][_0x5bfd('0x1a')]();}});}return _0x20fab1;}function getName(_0x1aa3a9){if(_0x1aa3a9[_0x5bfd('0x1b')]('\x20')>0x0){var _0x445d8d=_0x1aa3a9[_0x5bfd('0x1c')](/ (.+)/);if(_0x445d8d[0x1]){return _0x445d8d;}}return[_0x1aa3a9,_0x1aa3a9];}var accountsTokens={};function getAccessToken(_0x1ff24e){return new Promise(function(_0x2704aa,_0x4b24c3){if(!_['isNil'](accountsTokens[_0x1ff24e['id']])&&!_[_0x5bfd('0x1d')](accountsTokens[_0x1ff24e['id']][_0x5bfd('0x1e')])){if(moment()[_0x5bfd('0x1f')](accountsTokens[_0x1ff24e['id']][_0x5bfd('0x20')])){_0x2704aa(accountsTokens[_0x1ff24e['id']][_0x5bfd('0x1e')]);}}var _0x1dc630;switch(_0x1ff24e[_0x5bfd('0x21')]){case'US':_0x1dc630='https://accounts.zoho.com';break;case'AU':_0x1dc630=_0x5bfd('0x22');break;case'EU':_0x1dc630=_0x5bfd('0x23');break;case'IN':_0x1dc630='https://accounts.zoho.in';break;case'CN':_0x1dc630=_0x5bfd('0x24');break;default:_0x1dc630=_0x5bfd('0x23');break;}var _0x12bb38={'method':'POST','uri':_0x1dc630+'/oauth/v2/token','qs':{'refresh_token':_0x1ff24e['refreshToken'],'client_id':_0x1ff24e[_0x5bfd('0x25')],'client_secret':_0x1ff24e[_0x5bfd('0x26')],'grant_type':_0x5bfd('0x27')},'json':!![]};return rp(_0x12bb38)[_0x5bfd('0x28')](function(_0xc899c6){accountsTokens[_0x1ff24e['id']]={'access_token':_0xc899c6['access_token'],'expires_in':moment()['add'](_0xc899c6[_0x5bfd('0x20')],_0x5bfd('0x29'))};_0x2704aa(_0xc899c6[_0x5bfd('0x1e')]);})['catch'](function(_0x152b35){logger[_0x5bfd('0x2a')](_0x5bfd('0x2b'),_0x152b35[_0x5bfd('0x2c')]);_0x4b24c3(_0x152b35);});});}function getUser(_0xf2372f,_0x3520c2,_0x3255aa,_0x362465){logger[_0x5bfd('0x2d')](_0x5bfd('0x2e'));return request({'method':_0x5bfd('0x2f'),'uri':util[_0x5bfd('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0x3520c2),'qs':{'type':_0x5bfd('0x31')},'headers':{'Authorization':_0x5bfd('0x32')+_0xf2372f},'json':!![]})[_0x5bfd('0x28')](function(_0x470498){if(_0x470498[_0x5bfd('0x33')]){var _0x8ca9f0=-0x1;if(_[_0x5bfd('0x34')](_0x470498[_0x5bfd('0x33')])){if(!_[_0x5bfd('0x1d')](_0x362465)){_0x8ca9f0=_['findIndex'](_0x470498[_0x5bfd('0x33')],function(_0x2d1731){return _0x2d1731[_0x5bfd('0x35')]===_0x362465;});}if(_0x8ca9f0>=0x0){logger[_0x5bfd('0x2d')](_0x5bfd('0x36'));}else{logger[_0x5bfd('0x2d')](_0x5bfd('0x37'));_0x8ca9f0=_[_0x5bfd('0x38')](_0x470498[_0x5bfd('0x33')],function(_0x1d7f52){return _0x1d7f52['profile'][_0x5bfd('0x18')]===_0x5bfd('0x39');});}return _0x470498[_0x5bfd('0x33')][_0x8ca9f0];}else{if(_0x470498[_0x5bfd('0x3a')][_0x5bfd('0x3b')][_0x5bfd('0x18')]===_0x5bfd('0x39')){logger[_0x5bfd('0x2d')](_0x5bfd('0x37'));user=_0x470498[_0x5bfd('0x3a')];return user;}else{logger[_0x5bfd('0x2a')](_0x5bfd('0x3c'),JSON[_0x5bfd('0x3d')](_0x470498));throw new Error(_0x5bfd('0x3e')+JSON[_0x5bfd('0x3d')](_0x470498));}}}else{logger[_0x5bfd('0x2a')]('The\x20failing\x20result\x20is',JSON[_0x5bfd('0x3d')](_0x470498));throw new Error(_0x5bfd('0x3e')+JSON[_0x5bfd('0x3d')](_0x470498));}})[_0x5bfd('0x3f')](function(_0x1d6017){console['error'](_0x1d6017);});}function getZohoUser(_0x4adbc0,_0x2ceb54){return new BPromise(function(_0x324967,_0x3a69d9){request(_0x4adbc0)[_0x5bfd('0x28')](function(_0x38b6d2){var _0x32d7ba=null;if(_0x38b6d2){_0x32d7ba=_0x38b6d2[_0x5bfd('0x40')][0x0];_0x32d7ba[_0x5bfd('0x41')]=_0x2ceb54;}_0x324967(_0x32d7ba);})[_0x5bfd('0x3f')](function(_0x41e60c){_0x3a69d9(_0x41e60c);});});}function createEndUser(_0x18954e,_0x29214f,_0x1e9d8b,_0x43cc72,_0xafb370,_0x49368c){var _0x1e9d8b=getName(_0x1e9d8b);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x29214f+_0x5bfd('0x42')+_[_0x5bfd('0x43')](_0x49368c[_0x5bfd('0x44')])+'s','body':{'data':[{'Last_Name':_0x1e9d8b[0x1],'First_Name':_0x1e9d8b[0x0],'Phone':_0x43cc72,'Owner':{'name':!_[_0x5bfd('0x1d')](_0xafb370[_0x5bfd('0x45')][_0x5bfd('0x18')])?_0xafb370[_0x5bfd('0x45')][_0x5bfd('0x18')]:!_['isNil'](_0xafb370['first_name'])?_0xafb370[_0x5bfd('0x46')]+'\x20'+_0xafb370[_0x5bfd('0x47')]:_0xafb370[_0x5bfd('0x47')],'id':_0xafb370['id']}}]},'headers':{'Authorization':_0x5bfd('0x32')+_0x18954e},'json':!![]})[_0x5bfd('0x28')](function(_0xf37522){if(_0xf37522&&_0xf37522[_0x5bfd('0x40')][0x0][_0x5bfd('0x48')]===_0x5bfd('0x49')){var _0x37892a=_0xf37522['data'][0x0][_0x5bfd('0x4a')];_0x37892a[_0x5bfd('0x41')]=_[_0x5bfd('0x43')](_0x49368c[_0x5bfd('0x44')])+'s';return _0x37892a;}logger[_0x5bfd('0x2a')](_0x5bfd('0x3c'),JSON[_0x5bfd('0x3d')](data));throw new Error('Error:\x20'+JSON[_0x5bfd('0x3d')](data));})[_0x5bfd('0x3f')](function(_0x3beb13){console[_0x5bfd('0x4b')](_0x5bfd('0x4c'),_0x3beb13);});}function getEndUser(_0xdb4aa2,_0x40aaa3,_0x5f0539,_0x56ed80,_0x4dc775,_0x130adb,_0x29b337){var _0x2b8ff3={'method':_0x5bfd('0x2f'),'uri':'','headers':{'Authorization':_0x5bfd('0x32')+_0xdb4aa2},'json':!![]};switch(_0x29b337[_0x5bfd('0x4d')]){case _0x5bfd('0x4e'):_0x2b8ff3[_0x5bfd('0x4f')]=_0x5bfd('0x50')+_0x40aaa3+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4dc775+'))';return getZohoUser(_0x2b8ff3,_0x5bfd('0x51'))[_0x5bfd('0x28')](function(_0x12ae29){if(_0x12ae29)return _0x12ae29;_0x2b8ff3[_0x5bfd('0x4f')]=_0x5bfd('0x50')+_0x40aaa3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4dc775+'))';return getZohoUser(_0x2b8ff3,_0x5bfd('0x52'))[_0x5bfd('0x28')](function(_0x378204){if(_0x378204)return _0x378204;if(_0x29b337['moduleCreate']!=_0x5bfd('0x53')){return createEndUser(_0xdb4aa2,_0x40aaa3,_0x56ed80,_0x4dc775,_0x130adb,_0x29b337);}else{return{};}});});break;case'contact':_0x2b8ff3['uri']=_0x5bfd('0x50')+_0x40aaa3+_0x5bfd('0x54')+_0x4dc775+'))';return getZohoUser(_0x2b8ff3,_0x5bfd('0x51'))[_0x5bfd('0x28')](function(_0xce9c8c){if(_0xce9c8c)return _0xce9c8c;if(_0x29b337[_0x5bfd('0x44')]!=_0x5bfd('0x53')){return createEndUser(_0xdb4aa2,_0x40aaa3,_0x56ed80,_0x4dc775,_0x130adb,_0x29b337);}else{return{};}});break;case _0x5bfd('0x55'):_0x2b8ff3['uri']='https://www.zohoapis.'+_0x40aaa3+_0x5bfd('0x56')+_0x4dc775+'))';return getZohoUser(_0x2b8ff3,_0x5bfd('0x52'))[_0x5bfd('0x28')](function(_0x4dd9e1){if(_0x4dd9e1)return _0x4dd9e1;if(_0x29b337[_0x5bfd('0x44')]!=_0x5bfd('0x53')){return createEndUser(_0xdb4aa2,_0x40aaa3,_0x56ed80,_0x4dc775,_0x130adb,_0x29b337);}else{return{};}});break;}}function getCall(_0x13fe71,_0x1af0ad,_0x50677b,_0x5d2cc7,_0x49ede0,_0x14dfcc,_0x8169a2,_0x22b56d){logger[_0x5bfd('0x2d')](_0x5bfd('0x57'));var _0xb8ec15={};_0xb8ec15[_0x5bfd('0x58')]={'name':!_[_0x5bfd('0x1d')](_0x5d2cc7['role'][_0x5bfd('0x18')])&&!_[_0x5bfd('0x1d')](_0x5d2cc7[_0x5bfd('0x3b')][_0x5bfd('0x18')])&&_0x5d2cc7[_0x5bfd('0x3b')][_0x5bfd('0x18')]===_0x5bfd('0x59')?_0x5d2cc7[_0x5bfd('0x45')]['name']:!_[_0x5bfd('0x1d')](_0x5d2cc7['first_name'])?_0x5d2cc7[_0x5bfd('0x46')]+'\x20'+_0x5d2cc7[_0x5bfd('0x47')]:_0x5d2cc7['last_name'],'id':_0x5d2cc7['id']};_0xb8ec15[_0x5bfd('0x5a')]=intUtil[_0x5bfd('0x5b')](_0x14dfcc[_0x5bfd('0x5c')],_0x8169a2,'\x20');_0xb8ec15['Description']=intUtil['getString'](_0x14dfcc[_0x5bfd('0x5d')],_0x8169a2,'\x0a');if(_0x49ede0[_0x5bfd('0x41')]===_0x5bfd('0x51')){_0xb8ec15[_0x5bfd('0x5e')]={'name':!_[_0x5bfd('0x1d')](_0x49ede0[_0x5bfd('0x5f')])?_0x49ede0[_0x5bfd('0x5f')]:!_[_0x5bfd('0x1d')](_0x49ede0[_0x5bfd('0x60')])?_0x49ede0[_0x5bfd('0x60')]+'\x20'+_0x49ede0['Last_Name']:_0x49ede0[_0x5bfd('0x61')],'id':_0x49ede0['id']};}if(_0x49ede0['enduserType']===_0x5bfd('0x52')){_0xb8ec15[_0x5bfd('0x62')]={'name':!_[_0x5bfd('0x1d')](_0x49ede0[_0x5bfd('0x5f')])?_0x49ede0['Full_Name']:!_[_0x5bfd('0x1d')](_0x49ede0['First_Name'])?_0x49ede0[_0x5bfd('0x60')]+'\x20'+_0x49ede0[_0x5bfd('0x61')]:_0x49ede0[_0x5bfd('0x61')],'id':_0x49ede0['id']};_0xb8ec15[_0x5bfd('0x63')]=_['startCase'](_0x49ede0['enduserType']);}if(_0x8169a2[_0x5bfd('0x64')]){_0xb8ec15[_0x5bfd('0x65')]=moment['utc'](parseInt(_0x8169a2['talktime'])*0x3e8)[_0x5bfd('0x30')](_0x5bfd('0x66'));}else if(_0x8169a2['answertime']&&_0x8169a2['endtime']){_0xb8ec15[_0x5bfd('0x65')]=moment[_0x5bfd('0x67')](moment(_0x8169a2[_0x5bfd('0x68')],'YYYY-MM-DDTHH:mm:ss')[_0x5bfd('0x69')](moment(_0x8169a2[_0x5bfd('0x6a')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x5bfd('0x66'));}switch(_0x8169a2[_0x5bfd('0x6b')]){case _0x5bfd('0x6c'):_0xb8ec15['Call_Result']=_0x5bfd('0x6d');break;case _0x5bfd('0x6e'):case _0x5bfd('0x6f'):_0xb8ec15[_0x5bfd('0x70')]=_0x5bfd('0x71');break;case _0x5bfd('0x72'):_0xb8ec15[_0x5bfd('0x70')]=_0x5bfd('0x73');break;case _0x5bfd('0x74'):_0xb8ec15[_0x5bfd('0x70')]=_0x5bfd('0x75');break;case _0x5bfd('0x76'):_0xb8ec15[_0x5bfd('0x70')]=_0x5bfd('0x77');default:}_0xb8ec15[_0x5bfd('0x78')]=(_0x22b56d===_0x5bfd('0x79')?moment(_0x8169a2[_0x5bfd('0x6a')])[_0x5bfd('0x30')](_0x5bfd('0x7a')):moment(_0x8169a2[_0x5bfd('0x7b')])['format'](_0x5bfd('0x7a')))||moment()[_0x5bfd('0x30')]('YYYY-MM-DDTHH:mm:ss');_0xb8ec15[_0x5bfd('0x7c')]=_0x22b56d||_0x5bfd('0x7d');_0xb8ec15=_['merge'](_0xb8ec15,getCustomFields(_0x14dfcc[_0x5bfd('0x7e')],_0x8169a2));return request({'method':_0x5bfd('0x7f'),'uri':_0x5bfd('0x50')+_0x1af0ad+_0x5bfd('0x80'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x13fe71},'body':{'data':[_0xb8ec15]},'json':!![]})[_0x5bfd('0x28')](function(_0x5e6cbe){if(_0x5e6cbe&&_0x5e6cbe[_0x5bfd('0x40')][0x0][_0x5bfd('0x48')]===_0x5bfd('0x49')){logger[_0x5bfd('0x2d')](_0x5bfd('0x81'));return{'id':_0x5e6cbe[_0x5bfd('0x40')][0x0][_0x5bfd('0x4a')]['id']};}})['catch'](function(_0x1b9de9){logger[_0x5bfd('0x2d')]('err',_0x1b9de9[_0x5bfd('0x2c')]);console[_0x5bfd('0x4b')](_0x5bfd('0x82'),_0x1b9de9);});}exports[_0x5bfd('0x83')]=function(_0x3d79e2,_0x3d0ea2,_0x1448af,_0x47fc3c,_0x2322ca,_0x3ec1b4){var _0x224827,_0x461c16,_0x2a09fd;_0x3ec1b4[_0x5bfd('0x84')]=intUtil[_0x5bfd('0x85')](_0x3ec1b4[_0x5bfd('0x84')]);_0x3ec1b4['serverUrl']=intUtil[_0x5bfd('0x85')](_0x3ec1b4[_0x5bfd('0x86')]);if(_0x2322ca&&_0x2322ca['monitor_format']){logger[_0x5bfd('0x2d')](_0x5bfd('0x87'),_0x5bfd('0x88'));_0x3d0ea2[_0x5bfd('0x89')]=_0x3ec1b4[_0x5bfd('0x86')]+_0x5bfd('0x8a')+_0x3d0ea2[_0x5bfd('0x8b')]+_0x5bfd('0x8c')+md5(_0x3d0ea2[_0x5bfd('0x8b')]);}else{_0x3d0ea2[_0x5bfd('0x89')]='';}var _0x261365=_0x3ec1b4[_0x5bfd('0x84')]==='zoho.eu'?'eu':_0x5bfd('0x8d');return getAccessToken(_0x3ec1b4)[_0x5bfd('0x28')](function(_0x11d814){_0x2a09fd=_0x11d814;return getUser(_0x2a09fd,_0x261365,_0x3ec1b4,_0x47fc3c['email']);})[_0x5bfd('0x28')](function(_0x303305){_0x224827=_0x303305;logger[_0x5bfd('0x2d')](_0x5bfd('0x8e'),_0x224827['id']);return getEndUser(_0x2a09fd,_0x261365,_0x3ec1b4,_0x3d0ea2['calleridname'],_0x3d0ea2[_0x5bfd('0x8f')],_0x224827,_0x1448af);})[_0x5bfd('0x28')](function(_0x2eed02){_0x461c16=_0x2eed02;return getCall(_0x2a09fd,_0x261365,_0x3ec1b4,_0x224827,_0x461c16,_0x1448af,_0x3d0ea2,'Inbound');})['then'](function(_0x17b92d){if(_0x17b92d){logger['info'](_0x5bfd('0x90'),_0x17b92d['id']);logger[_0x5bfd('0x2d')]('[QUEUE]',_0x5bfd('0x91'));emit(util['format']('user:%s',_0x47fc3c[_0x5bfd('0x18')]),'trigger:browser:url',{'uri':_0x5bfd('0x92')+_0x3ec1b4[_0x5bfd('0x84')]+'/crm/EntityInfo.do?module=Calls&id='+_0x17b92d['id']});}})['catch'](function(_0x132184){logger[_0x5bfd('0x2a')](_0x5bfd('0x87'),JSON['stringify'](_0x132184));});};exports[_0x5bfd('0x79')]=function(_0x39d4e8,_0xe9747f,_0x5be8cc,_0x2c24a6,_0xd3afef,_0x1e2a29,_0xccbd62){var _0x51ecab,_0x20fe2a,_0x2bc413;_0x1e2a29['host']=intUtil['stripTrailingSlash'](_0x1e2a29[_0x5bfd('0x84')]);_0x1e2a29[_0x5bfd('0x86')]=intUtil[_0x5bfd('0x85')](_0x1e2a29[_0x5bfd('0x86')]);if(_0xccbd62&&_0xccbd62[_0x5bfd('0x93')]&&_0xccbd62[_0x5bfd('0x93')]!==_0x5bfd('0x94')){logger[_0x5bfd('0x2d')](_0x5bfd('0x95'),'Recording\x20is\x20enabled!');_0xe9747f[_0x5bfd('0x89')]=_0x1e2a29[_0x5bfd('0x86')]+_0x5bfd('0x8a')+_0xe9747f[_0x5bfd('0x8b')]+_0x5bfd('0x8c')+md5(_0xe9747f[_0x5bfd('0x8b')]);}var _0x478757=_0x1e2a29[_0x5bfd('0x84')]===_0x5bfd('0x96')?'eu':_0x5bfd('0x8d');return getAccessToken(_0x1e2a29)[_0x5bfd('0x28')](function(_0x5a599c){_0x2bc413=_0x5a599c;return getUser(_0x2bc413,_0x478757,_0x1e2a29,_0x2c24a6['email']);})[_0x5bfd('0x28')](function(_0x3eeb54){_0x51ecab=_0x3eeb54;logger[_0x5bfd('0x2d')]('The\x20User\x20ID\x20is:',_0x51ecab['id']);return getEndUser(_0x2bc413,_0x478757,_0x1e2a29,_0xe9747f[_0x5bfd('0x97')],_0xe9747f[_0x5bfd('0x98')],_0x51ecab,_0x5be8cc);})[_0x5bfd('0x28')](function(_0x1dec03){_0x20fe2a=_0x1dec03;return getCall(_0x2bc413,_0x478757,_0x1e2a29,_0x51ecab,_0x20fe2a,_0x5be8cc,_0xe9747f,_0x5bfd('0x99'));})[_0x5bfd('0x28')](function(_0x5dc2cd){if(_0x5dc2cd){logger[_0x5bfd('0x2d')]('The\x20Call\x20ID\x20is:',_0x5dc2cd['id']);logger[_0x5bfd('0x2d')](_0x5bfd('0x95'),_0x5bfd('0x91'));emit(util[_0x5bfd('0x30')](_0x5bfd('0x9a'),_0x2c24a6[_0x5bfd('0x18')]),_0x5bfd('0x9b'),{'uri':_0x5bfd('0x92')+_0x1e2a29[_0x5bfd('0x84')]+_0x5bfd('0x9c')+_0x5dc2cd['id']});}})[_0x5bfd('0x3f')](function(_0x10c8de){logger[_0x5bfd('0x2a')]('[OUTBOUND]',JSON[_0x5bfd('0x3d')](_0x10c8de));});};exports[_0x5bfd('0x9d')]=function(_0x21937c,_0x1838d9,_0x50d9ab,_0x2f5bc7,_0x22110f,_0x4856a3){var _0x1f0a40,_0x3e6a08,_0x3aa421;_0x4856a3[_0x5bfd('0x84')]=intUtil[_0x5bfd('0x85')](_0x4856a3['host']);_0x4856a3[_0x5bfd('0x86')]=intUtil[_0x5bfd('0x85')](_0x4856a3[_0x5bfd('0x86')]);if(_0x22110f&&_0x22110f[_0x5bfd('0x9e')]){logger[_0x5bfd('0x2d')]('['+_0x1838d9[_0x5bfd('0x6b')]['toUpperCase']()+']',_0x5bfd('0x88'));_0x1838d9['recordingURL']=_0x4856a3[_0x5bfd('0x86')]+_0x5bfd('0x8a')+_0x1838d9[_0x5bfd('0x8b')]+_0x5bfd('0x8c')+md5(_0x1838d9[_0x5bfd('0x8b')]);}else{_0x1838d9['recordingURL']='';}var _0x586f6d=_0x4856a3[_0x5bfd('0x84')]==='zoho.eu'?'eu':_0x5bfd('0x8d');return getAccessToken(_0x4856a3)['then'](function(_0x1d0656){_0x3aa421=_0x1d0656;return getUser(_0x3aa421,_0x586f6d,_0x4856a3);})[_0x5bfd('0x28')](function(_0x251712){_0x1f0a40=_0x251712;logger[_0x5bfd('0x2d')]('The\x20User\x20ID\x20is:',_0x1f0a40['id']);return getEndUser(_0x3aa421,_0x586f6d,_0x4856a3,_0x1838d9[_0x5bfd('0x9f')],_0x1838d9[_0x5bfd('0x8f')],_0x1f0a40,_0x50d9ab);})[_0x5bfd('0x28')](function(_0x502465){_0x3e6a08=_0x502465;return getCall(_0x3aa421,_0x586f6d,_0x4856a3,_0x1f0a40,_0x3e6a08,_0x50d9ab,_0x1838d9,_0x5bfd('0x7d'));})[_0x5bfd('0x28')](function(_0x113c03){if(_0x113c03){logger['info'](_0x5bfd('0x90'),_0x113c03['id']);}})[_0x5bfd('0x3f')](function(_0x5bdc9f){logger[_0x5bfd('0x2a')]('['+_0x1838d9[_0x5bfd('0x6b')][_0x5bfd('0xa0')]()+']',JSON[_0x5bfd('0x3d')](_0x5bdc9f));});}; \ 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 a746b19..7d6b700 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 _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 +var _0x8e13=['data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','Script'];(function(_0x32e779,_0x1c2596){var _0x47d7b3=function(_0x37c2d8){while(--_0x37c2d8){_0x32e779['push'](_0x32e779['shift']());}};_0x47d7b3(++_0x1c2596);}(_0x8e13,0x88));var _0x38e1=function(_0xcac40,_0xc0c8c4){_0xcac40=_0xcac40-0x0;var _0x411d1b=_0x8e13[_0xcac40];return _0x411d1b;};'use strict';var util=require(_0x38e1('0x0'));var sh=require(_0x38e1('0x1'));var Mustache=require(_0x38e1('0x2'));var logger=require('../../../../config/logger')(_0x38e1('0x3'));exports[_0x38e1('0x4')]=function(_0x3ad199,_0x3bc4df){var _0x2490a8=_0x3ad199[_0x38e1('0x5')]?_0x3ad199['data2']:_0x38e1('0x6');var _0x782cbf=_0x3ad199['data3']?Mustache['render'](_0x3ad199[_0x38e1('0x7')],_0x3bc4df):_0x3bc4df;sh[_0x38e1('0x4')](_0x782cbf,function(_0x5a93d5,_0xf028b0,_0x10431e){if(_0x5a93d5!==0x0){logger[_0x38e1('0x8')](util[_0x38e1('0x9')](_0x38e1('0xa'),_0x2490a8,_0x782cbf,_0x5a93d5,_0x10431e));}else{logger[_0x38e1('0xb')](util[_0x38e1('0x9')](_0x38e1('0xc'),_0x2490a8,_0x782cbf,_0xf028b0));}});}; \ 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 590066d..7d2a8b3 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 _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 +var _0x3244=['error','GET','POST','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5','headers','parse','data6'];(function(_0x4f3d9b,_0x321a3e){var _0x175ef2=function(_0x594c48){while(--_0x594c48){_0x4f3d9b['push'](_0x4f3d9b['shift']());}};_0x175ef2(++_0x321a3e);}(_0x3244,0xdb));var _0x4324=function(_0x3f8a27,_0x10f8b7){_0x3f8a27=_0x3f8a27-0x0;var _0x2b017b=_0x3244[_0x3f8a27];return _0x2b017b;};'use strict';var rp=require('request-promise');var util=require(_0x4324('0x0'));var _=require(_0x4324('0x1'));var Mustache=require('mustache');var logger=require(_0x4324('0x2'))('trigger');exports[_0x4324('0x3')]=function(_0x2df259,_0x56e42e){var _0x4104f4,_0x264341;var _0x5c0bf2={'method':_0x2df259[_0x4324('0x4')][_0x4324('0x5')](),'uri':Mustache[_0x4324('0x6')](_0x2df259[_0x4324('0x7')],_0x56e42e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2df259[_0x4324('0x8')])==='number'&&parseInt(_0x2df259[_0x4324('0x8')])>=0x1&&parseInt(_0x2df259[_0x4324('0x8')])<=0xa?parseInt(_0x2df259['data5'])*0x3e8:0x5*0x3e8};try{_0x5c0bf2[_0x4324('0x9')]=_0x2df259['data6']?JSON[_0x4324('0xa')](Mustache[_0x4324('0x6')](_0x2df259[_0x4324('0xb')],_0x56e42e)):{};}catch(_0x416166){logger[_0x4324('0xc')](_0x416166['stack']);}switch(_0x2df259['data1'][_0x4324('0x5')]()){case _0x4324('0xd'):case'DELETE':_0x4104f4=null;_0x5c0bf2['qs']=_0x56e42e;break;case _0x4324('0xe'):case _0x4324('0xf'):if(_0x2df259[_0x4324('0x10')]){try{_0x4104f4=JSON['parse'](Mustache[_0x4324('0x6')](_0x2df259[_0x4324('0x10')],_0x56e42e));_0x5c0bf2[_0x4324('0x11')]=_0x4104f4;}catch(_0x38022b){logger[_0x4324('0xc')](_0x38022b[_0x4324('0x12')]);logger['error'](_0x4324('0x13'));}}else{_0x4104f4=_0x56e42e;_0x5c0bf2['body']=_0x4104f4;}break;}logger[_0x4324('0x14')](util[_0x4324('0x15')](_0x4324('0x16'),_0x2df259[_0x4324('0x4')],_0x2df259[_0x4324('0x7')],JSON[_0x4324('0x17')](_0x5c0bf2)));rp(_0x5c0bf2)[_0x4324('0x18')](function(_0x1ef6d6){_0x4104f4=!_['isNil'](_0x4104f4)?_0x4324('0x19')+_0x4104f4:'';_0x264341=typeof _0x1ef6d6['body']===_0x4324('0x1a')?JSON['stringify'](_0x1ef6d6[_0x4324('0x11')]):_0x1ef6d6[_0x4324('0x11')];logger[_0x4324('0x14')](util[_0x4324('0x15')](_0x4324('0x1b'),_0x2df259[_0x4324('0x4')],_0x2df259[_0x4324('0x7')],_0x1ef6d6[_0x4324('0x1c')],_0x264341));})[_0x4324('0x1d')](function(_0x2e787a){logger[_0x4324('0xc')](util[_0x4324('0x15')](_0x4324('0x1e'),_0x2df259[_0x4324('0x4')],_0x2df259[_0x4324('0x7')],_0x2e787a['statusCode'],_0x2e787a[_0x4324('0x1f')],_0x2e787a[_0x4324('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 59af57c..6257115 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 _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 +var _0x210c=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','rpc','error','message','result'];(function(_0x39afbe,_0x5b50c9){var _0x24311d=function(_0x295280){while(--_0x295280){_0x39afbe['push'](_0x39afbe['shift']());}};_0x24311d(++_0x5b50c9);}(_0x210c,0xf0));var _0xc210=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0x210c[_0x4a9beb];return _0x2d4c58;};'use strict';var jayson=require(_0xc210('0x0'));var BPromise=require(_0xc210('0x1'));var logger=require(_0xc210('0x2'))(_0xc210('0x3'));var client=jayson[_0xc210('0x4')][_0xc210('0x5')]({'port':0x2329});client[_0xc210('0x6')]=function(_0x2f8223,_0x5a882b){return new BPromise(function(_0x128db3,_0x4fa6b6){return client[_0xc210('0x7')](_0x2f8223,_0x5a882b)['then'](function(_0x2f71d1){logger['debug'](_0xc210('0x8'),_0xc210('0x3'),_0x2f8223,_0x5a882b,_0x2f71d1);if(_0x2f71d1['error']){logger[_0xc210('0x9')](_0xc210('0x8'),_0xc210('0x3'),_0x2f8223,_0x2f71d1['error']['message'],_0x5a882b);return _0x4fa6b6(_0x2f71d1[_0xc210('0x9')][_0xc210('0xa')]);}else{return _0x128db3(_0x2f71d1[_0xc210('0xb')]);}})[_0xc210('0xc')](function(_0x2adf1b){logger['error'](_0xc210('0x8'),'routing',_0x2f8223,_0x2adf1b,_0x5a882b);return _0x4fa6b6(_0x2adf1b);});});};module[_0xc210('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f4c25b9..16eb78e 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 _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 +var _0xe430=['refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts'];(function(_0x3ee51d,_0x51cf1f){var _0x5524f9=function(_0xbbcd9){while(--_0xbbcd9){_0x3ee51d['push'](_0x3ee51d['shift']());}};_0x5524f9(++_0x51cf1f);}(_0xe430,0x128));var _0x0e43=function(_0x4d7df9,_0x51dae1){_0x4d7df9=_0x4d7df9-0x0;var _0x2b9291=_0xe430[_0x4d7df9];return _0x2b9291;};'use strict';var server=require(_0x0e43('0x0'));var Realtime=require(_0x0e43('0x1'));var EmailChannel=require(_0x0e43('0x2'));var mailAccount=require(_0x0e43('0x3'));var setting=require(_0x0e43('0x4'));var logger=require(_0x0e43('0x5'))(_0x0e43('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x0e43('0x7')](mailAccount[_0x0e43('0x8')]())['then'](realtime[_0x0e43('0x9')]())[_0x0e43('0x7')](function(){email[_0x0e43('0xa')](realtime[_0x0e43('0xb')]);return realtime;});}function main(){return server[_0x0e43('0xc')](realtime,email)[_0x0e43('0x7')](function(){return initRealtime();})[_0x0e43('0x7')](function(){return setting[_0x0e43('0xd')]();})[_0x0e43('0x7')](function(_0x2c7932){return setInterval(initRealtime,_0x2c7932[_0x0e43('0xe')]*0x3e8);})['catch'](function(_0x95d903){logger[_0x0e43('0xf')](_0x0e43('0x10'),_0x95d903);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 21cc791..ea7c9dd 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 _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 +var _0x27d4=['lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verify','then','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','prototype','Imap','messageStatus','total','stringify','emit','mailAccount:update','hasOwnProperty','active','provider','custom','service','imapAccounts','email','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','isNil','disabled','status','connected','messages','info','firstName'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0x27d4,0xf1));var _0x427d=function(_0x1751fb,_0x3f7254){_0x1751fb=_0x1751fb-0x0;var _0x508c24=_0x27d4[_0x1751fb];return _0x508c24;};'use strict';var _=require(_0x427d('0x0'));var moment=require(_0x427d('0x1'));var BPromise=require('bluebird');var md5=require(_0x427d('0x2'));var Redis=require(_0x427d('0x3'));var config=require(_0x427d('0x4'));var logger=require(_0x427d('0x5'))('email');config[_0x427d('0x6')]=_[_0x427d('0x7')](config['redis'],{'host':_0x427d('0x8'),'port':0x18eb});var io=require(_0x427d('0x9'))(new Redis(config[_0x427d('0x6')]));var EmailImap=require(_0x427d('0xa'));var EmailSmtp=require(_0x427d('0xb'));var mailAccount=require(_0x427d('0xc'));var md5Accounts={};function EmailChannel(_0x19b3de){logger['info'](_0x427d('0xd'));this[_0x427d('0xe')]=_0x19b3de[_0x427d('0xe')];this['imapAccounts']={};this[_0x427d('0xf')]=new EmailSmtp();}EmailChannel[_0x427d('0x10')]['emit']=function(_0x9179f5){var _0x448f7c=this['mailAccounts'][_0x9179f5];var _0x2c40f6={'id':_0x448f7c['id'],'name':_0x448f7c['name'],'key':_0x448f7c['key'],'active':_0x448f7c['active'],'Imap':{'status':_0x448f7c[_0x427d('0x11')]['status'],'messageStatus':_0x448f7c[_0x427d('0x11')][_0x427d('0x12')],'total':_0x448f7c[_0x427d('0x11')][_0x427d('0x13')]}};if(_['isNil'](md5Accounts[_0x9179f5])){md5Accounts[_0x9179f5]={};}var _0xfe660=md5(JSON[_0x427d('0x14')](_0x2c40f6));if(md5Accounts[_0x9179f5][_0x427d('0x2')]!==_0xfe660){md5Accounts[_0x9179f5]['md5']=_0xfe660;io[_0x427d('0x15')](_0x427d('0x16'),_0x2c40f6);}};EmailChannel[_0x427d('0x10')]['refresh']=function(_0x30acc7){for(var _0x8573aa in _0x30acc7){if(_0x30acc7[_0x427d('0x17')](_0x8573aa)){if(_0x30acc7[_0x8573aa][_0x427d('0x11')]&&_0x30acc7[_0x8573aa][_0x427d('0x18')]){var _0x3313c1=_0x30acc7[_0x8573aa][_0x427d('0x11')];if(!_0x3313c1['service']&&_0x30acc7[_0x8573aa][_0x427d('0x19')]!==_0x427d('0x1a'))_0x3313c1[_0x427d('0x1b')]=_0x30acc7[_0x8573aa][_0x427d('0x19')];if(!this[_0x427d('0x1c')][_0x427d('0x17')](_0x3313c1['id'])){this['imapAccounts'][_0x3313c1['id']]=new EmailImap(_0x3313c1,_0x30acc7[_0x8573aa][_0x427d('0x1d')]);this['imapAccounts'][_0x3313c1['id']]['on']('box',this[_0x427d('0x1e')]['bind'](this,_0x8573aa));this[_0x427d('0x1c')][_0x3313c1['id']]['on'](_0x427d('0x1d'),this[_0x427d('0x1f')]['bind'](this,_0x8573aa));this[_0x427d('0x1c')][_0x3313c1['id']]['on'](_0x427d('0x20'),this[_0x427d('0x21')][_0x427d('0x22')](this,_0x8573aa));this['imapAccounts'][_0x3313c1['id']]['on'](_0x427d('0x23'),this[_0x427d('0x24')][_0x427d('0x22')](this,_0x8573aa));}}else{if(_[_0x427d('0x25')](this[_0x427d('0xe')][_0x8573aa][_0x427d('0x11')])){this[_0x427d('0xe')][_0x8573aa]['Imap']={};}this[_0x427d('0xe')][_0x8573aa][_0x427d('0x11')]['status']=_0x427d('0x26');this[_0x427d('0xe')][_0x8573aa][_0x427d('0x11')][_0x427d('0x12')]='';this[_0x427d('0x15')](_0x8573aa);}}}};EmailChannel[_0x427d('0x10')]['handleImapBox']=function(_0x42dff2,_0x28f0d2){if(this[_0x427d('0xe')][_0x42dff2]){this['mailAccounts'][_0x42dff2][_0x427d('0x11')][_0x427d('0x27')]=_0x427d('0x28');this[_0x427d('0xe')][_0x42dff2][_0x427d('0x11')][_0x427d('0x12')]=_0x28f0d2['name'];if(_0x28f0d2[_0x427d('0x29')]){this['mailAccounts'][_0x42dff2][_0x427d('0x11')][_0x427d('0x13')]=_0x28f0d2[_0x427d('0x29')][_0x427d('0x13')];}return this['emit'](_0x42dff2);}};EmailChannel['prototype']['handleImapEmail']=function(_0x5a2ea2,_0x10a708){logger[_0x427d('0x2a')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x10a708[_0x427d('0x2b')],_0x10a708[_0x427d('0x2c')],_0x10a708[_0x427d('0x2d')],_0x5a2ea2);if(this['mailAccounts'][_0x5a2ea2]){return mailAccount[_0x427d('0x2e')](_0x5a2ea2,_0x10a708)['then'](function(_0x2e5a9f){if(_0x2e5a9f){logger['info'](_0x427d('0x2f'));}})[_0x427d('0x30')](function(_0x4d1896){logger[_0x427d('0x23')](_0x427d('0x31'),JSON['stringify'](_0x4d1896));});}};EmailChannel['prototype'][_0x427d('0x21')]=function(_0x4b0c29){if(this[_0x427d('0xe')][_0x4b0c29]&&this['mailAccounts'][_0x4b0c29][_0x427d('0x11')]){if(this[_0x427d('0x1c')][this[_0x427d('0xe')][_0x4b0c29][_0x427d('0x11')]['id']]){delete this[_0x427d('0x1c')][this[_0x427d('0xe')][_0x4b0c29][_0x427d('0x11')]['id']];}this['mailAccounts'][_0x4b0c29][_0x427d('0x11')][_0x427d('0x32')]=moment();this[_0x427d('0x15')](_0x4b0c29);}};EmailChannel[_0x427d('0x10')][_0x427d('0x24')]=function(_0x1088ec,_0xee3ca7){if(this[_0x427d('0xe')][_0x1088ec]){this[_0x427d('0xe')][_0x1088ec][_0x427d('0x11')]['status']=_0x427d('0x23');this[_0x427d('0xe')][_0x1088ec][_0x427d('0x11')][_0x427d('0x12')]=_0xee3ca7;return this[_0x427d('0x15')](_0x1088ec);}};EmailChannel[_0x427d('0x10')]['sendMail']=function(_0x45ab26,_0xc224f5){return this['smtp'][_0x427d('0x33')](_0x45ab26,_0xc224f5);};EmailChannel[_0x427d('0x10')][_0x427d('0x34')]=function(_0x14ef35){var _0x14f51c=this;if(this[_0x427d('0xe')][_0x14ef35['id']]){if(_[_0x427d('0x25')](this['mailAccounts'][_0x14ef35['id']]['Smtp'])){this['mailAccounts'][_0x14ef35['id']][_0x427d('0x35')]={};}this['mailAccounts'][_0x14ef35['id']][_0x427d('0x35')]['lastSync']=moment();return new BPromise(function(_0x2efe14,_0x20e82d){return _0x14f51c[_0x427d('0xf')][_0x427d('0x36')](_0x14ef35)[_0x427d('0x37')](function(_0x229022){_0x14f51c['mailAccounts'][_0x14ef35['id']][_0x427d('0x35')][_0x427d('0x27')]='verified';_0x14f51c[_0x427d('0xe')][_0x14ef35['id']]['Smtp'][_0x427d('0x12')]='';_0x14f51c[_0x427d('0x15')](_0x14ef35['id']);_0x2efe14(_0x229022);})['catch'](function(_0x5ae086){_0x14f51c[_0x427d('0xe')][_0x14ef35['id']][_0x427d('0x35')][_0x427d('0x27')]='error';_0x14f51c[_0x427d('0xe')][_0x14ef35['id']][_0x427d('0x35')][_0x427d('0x12')]=_0x5ae086;_0x14f51c[_0x427d('0x15')](_0x14ef35['id']);_0x20e82d(_0x5ae086);});});}return this[_0x427d('0xf')]['verify'](_0x14ef35);};module[_0x427d('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index c4ec593..741eb51 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 _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 +var _0xc1d8=['handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','length','fetch','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','simpleParser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','getAccount','account','once','ready','handleReady','end','bind','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox'];(function(_0x3961e5,_0x48475a){var _0x4096d0=function(_0x2a85c6){while(--_0x2a85c6){_0x3961e5['push'](_0x3961e5['shift']());}};_0x4096d0(++_0x48475a);}(_0xc1d8,0x115));var _0x8c1d=function(_0x5c5a90,_0x524356){_0x5c5a90=_0x5c5a90-0x0;var _0x56a378=_0xc1d8[_0x5c5a90];return _0x56a378;};'use strict';var _=require(_0x8c1d('0x0'));var util=require('util');var Imap=require(_0x8c1d('0x1'));var simpleParser=require(_0x8c1d('0x2'))[_0x8c1d('0x3')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x8c1d('0x4'))[_0x8c1d('0x5')];var utils=require(_0x8c1d('0x6'));var logger=require(_0x8c1d('0x7'))(_0x8c1d('0x8'));function EmailImap(_0x5a5631,_0x3be94d){this[_0x8c1d('0x9')]=_0x5a5631[_0x8c1d('0x9')];this['account']=this[_0x8c1d('0xa')](_0x5a5631,_0x3be94d);this[_0x8c1d('0x1')]=new Imap(this[_0x8c1d('0xb')]);this['imap'][_0x8c1d('0xc')](_0x8c1d('0xd'),this[_0x8c1d('0xe')]['bind'](this));this[_0x8c1d('0x1')][_0x8c1d('0xc')](_0x8c1d('0xf'),this['handleEnd'][_0x8c1d('0x10')](this));this[_0x8c1d('0x1')]['on'](_0x8c1d('0x11'),this[_0x8c1d('0x12')][_0x8c1d('0x10')](this));this['imap']['connect']();}util[_0x8c1d('0x13')](EmailImap,EventEmitter);EmailImap[_0x8c1d('0x14')]['getAccount']=function(_0x4c3a77,_0x5ddecb){var _0x49cb0a={'connTimeout':_0x4c3a77[_0x8c1d('0x15')]?_0x4c3a77[_0x8c1d('0x15')]*0x3e8:0x2710,'authTimeout':_0x4c3a77[_0x8c1d('0x16')]?_0x4c3a77[_0x8c1d('0x16')]*0x3e8:0x1388};if(_0x4c3a77[_0x8c1d('0x17')]){_0x49cb0a['user']=_0x4c3a77[_0x8c1d('0x18')];if(_0x4c3a77['modernAuthentication']){_0x49cb0a[_0x8c1d('0x19')]=utils[_0x8c1d('0x1a')](_0x4c3a77[_0x8c1d('0x1b')][_0x8c1d('0x1c')],_0x4c3a77['user']);}else{_0x49cb0a[_0x8c1d('0x1d')]=_0x4c3a77[_0x8c1d('0x1d')];}}else{if(_0x4c3a77[_0x8c1d('0x1e')]){_0x49cb0a['user']=_0x4c3a77[_0x8c1d('0x18')];_0x49cb0a['password']=_0x4c3a77[_0x8c1d('0x1d')];}}_0x49cb0a['email']=_0x5ddecb||_0x4c3a77[_0x8c1d('0x18')]||_0x8c1d('0x1f');_0x49cb0a[_0x8c1d('0x20')]=_0x4c3a77[_0x8c1d('0x20')];_0x49cb0a['port']=_0x4c3a77[_0x8c1d('0x21')]||0x3e1;if(_0x4c3a77[_0x8c1d('0x22')]){_0x49cb0a[_0x8c1d('0x22')]=!![];}else{_0x49cb0a[_0x8c1d('0x22')]=![];_0x49cb0a[_0x8c1d('0x23')]=_0x8c1d('0x24');}return _0x49cb0a;};EmailImap[_0x8c1d('0x14')][_0x8c1d('0xe')]=function(){this[_0x8c1d('0x1')][_0x8c1d('0x25')](this[_0x8c1d('0x9')],![],this[_0x8c1d('0x26')][_0x8c1d('0x10')](this));};EmailImap['prototype'][_0x8c1d('0x26')]=function(_0x23e3ee,_0x580ab4){if(_0x23e3ee){this[_0x8c1d('0x12')](_0x23e3ee,!![]);}else{this[_0x8c1d('0x27')](_0x8c1d('0x28'),_0x580ab4);this[_0x8c1d('0x29')]();}};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x2a')]=function(_0x492d17){if(_0x492d17){this[_0x8c1d('0x12')](_0x492d17,!![]);}else{this[_0x8c1d('0x1')][_0x8c1d('0xf')]();}};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x29')]=function(){this['imap'][_0x8c1d('0x2b')]([_0x8c1d('0x2c')],this['handleReadUnseen'][_0x8c1d('0x10')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x64b5e6,_0x28420b){if(_0x64b5e6){this[_0x8c1d('0x12')](_0x64b5e6,!![]);}else{if(_0x28420b[_0x8c1d('0x2d')]){try{var _0x4407e7=this[_0x8c1d('0x1')][_0x8c1d('0x2e')](_0x28420b,{'bodies':'','markSeen':!![]});_0x4407e7['on']('message',this[_0x8c1d('0x2f')][_0x8c1d('0x10')](this));_0x4407e7['once']('error',this[_0x8c1d('0x30')][_0x8c1d('0x10')](this));_0x4407e7['once'](_0x8c1d('0xf'),this['handleFetchEnd'][_0x8c1d('0x10')](this));}catch(_0x210c35){logger[_0x8c1d('0x11')](_0x210c35);}}else{this[_0x8c1d('0x1')][_0x8c1d('0x31')](!![],this[_0x8c1d('0x2a')][_0x8c1d('0x10')](this));}}};EmailImap['prototype'][_0x8c1d('0x2f')]=function(_0x33e5b3){_0x33e5b3['on'](_0x8c1d('0x32'),this[_0x8c1d('0x33')][_0x8c1d('0x10')](this));_0x33e5b3[_0x8c1d('0xc')]('attributes',this[_0x8c1d('0x34')][_0x8c1d('0x10')](this));_0x33e5b3[_0x8c1d('0xc')](_0x8c1d('0xf'),this[_0x8c1d('0x35')][_0x8c1d('0x10')](this));};EmailImap[_0x8c1d('0x14')]['handleMessageBody']=function(_0x4343b6){simpleParser(_0x4343b6,{'Iconv':Iconv},this[_0x8c1d('0x36')][_0x8c1d('0x10')](this));};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x34')]=function(){};EmailImap['prototype'][_0x8c1d('0x35')]=function(){};EmailImap['prototype'][_0x8c1d('0x36')]=function(_0x1e3465,_0x2efe59){if(_0x1e3465){logger['error'](_0x1e3465);}else{var _0x464407=this;utils[_0x8c1d('0x37')](this[_0x8c1d('0xb')],_0x2efe59,function(_0xb15723){_0x464407['emit'](_0x8c1d('0x8'),_0xb15723);});}};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x38')]=function(){this['imap'][_0x8c1d('0x31')](!![],this[_0x8c1d('0x2a')][_0x8c1d('0x10')](this));};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x30')]=function(_0x5a624b){this[_0x8c1d('0x12')](_0x5a624b);this['imap'][_0x8c1d('0x31')](!![],this[_0x8c1d('0x2a')]['bind'](this));};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x39')]=function(){this[_0x8c1d('0x27')](_0x8c1d('0xf'));};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x12')]=function(_0x36a4a5,_0x3145fb){logger[_0x8c1d('0x11')]('handleError',this[_0x8c1d('0xb')][_0x8c1d('0x8')],JSON[_0x8c1d('0x3a')](_0x36a4a5));var _0x59084c='';if(_0x36a4a5){if(_0x36a4a5[_0x8c1d('0x3b')]){_0x59084c=_0x36a4a5['textCode'];}else{for(var _0x2a149c in _0x36a4a5){if(_0x36a4a5[_0x8c1d('0x3c')](_0x2a149c)){_0x59084c+=_[_0x8c1d('0x3d')](_0x2a149c)+':\x20'+_0x36a4a5[_0x2a149c]+'\x0a';}}}}if(_0x3145fb){this[_0x8c1d('0x1')][_0x8c1d('0xf')]();}else{this['emit']('error',_0x59084c);this[_0x8c1d('0x27')](_0x8c1d('0xf'));}};module[_0x8c1d('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index f549a93..4ea2aa9 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 _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 +var _0x359e=['toString','prototype','verify','createTransport','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','use','sendMail'];(function(_0x56b017,_0x42535b){var _0x499d3a=function(_0x434ac5){while(--_0x434ac5){_0x56b017['push'](_0x56b017['shift']());}};_0x499d3a(++_0x42535b);}(_0x359e,0x17c));var _0xe359=function(_0x117552,_0x459a11){_0x117552=_0x117552-0x0;var _0x2d2768=_0x359e[_0x117552];return _0x2d2768;};'use strict';var nodemailer=require(_0xe359('0x0'));var inlineBase64=require(_0xe359('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xe359('0x2')]=function(_0x4c4180,_0x15ce29){return new Promise(function(_0x51536b,_0x3d9f19){var _0x129e8e=nodemailer['createTransport'](_0x4c4180);_0x129e8e[_0xe359('0x3')]('compile',inlineBase64());_0x129e8e[_0xe359('0x4')](_0x15ce29,function(_0x3853ec,_0x22b8e1){if(_0x3853ec){_0x3d9f19(_0x3853ec[_0xe359('0x5')]());}else{_0x51536b(_0x22b8e1);}});});};EmailSmtp[_0xe359('0x6')][_0xe359('0x7')]=function(_0x24cda0){return new Promise(function(_0x57672,_0x4b26f8){var _0x3f14ba=nodemailer[_0xe359('0x8')](_0x24cda0);_0x3f14ba[_0xe359('0x7')](function(_0x4bbc31,_0xe0c5c9){if(_0x4bbc31){_0x4b26f8(_0x4bbc31[_0xe359('0x5')]());}else{if(_0xe0c5c9){_0x57672(_0xe0c5c9);}else{_0x4b26f8(_0xe359('0x9'));}}});});};module[_0xe359('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index bdf274a..8de50a7 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 _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 +var _0x6b9f=['Empty\x20message

','user=','base64','lodash','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','html','includes','0x1?_0x2b3bc4[_0xf6b9('0x13')](0x0,-0x1)['join']('\x20'):_0x3a920f[_0xf6b9('0xe')];}return _0xf6b9('0x14');}function getLastName(_0x5dd980){var _0x369e05=_[_0xf6b9('0x8')](_0x5dd980['value']);if(_0x369e05&&_0x369e05[_0xf6b9('0xe')]){var _0x17460a=_0x369e05[_0xf6b9('0xe')][_0xf6b9('0x11')](/\s+/);return _0x17460a[_0xf6b9('0x12')]>0x1?_0x17460a[_0xf6b9('0x15')]():'';}return'';}function getMails(_0x15a51b,_0x46dbdb){var _0x1afe8e='';for(var _0x1b4881=0x0;_0x1b4881<_0x46dbdb[_0xf6b9('0x9')]['length'];_0x1b4881+=0x1){if(_0x46dbdb[_0xf6b9('0x9')][_0x1b4881]['address']!==_0x15a51b){if(!_[_0xf6b9('0x16')](_0x1afe8e)){_0x1afe8e+=',';}_0x1afe8e+=_0x46dbdb[_0xf6b9('0x9')][_0x1b4881][_0xf6b9('0xe')]||_0x46dbdb[_0xf6b9('0x9')][_0x1b4881][_0xf6b9('0xa')]||'';_0x1afe8e+='\x20<';_0x1afe8e+=_0x46dbdb[_0xf6b9('0x9')][_0x1b4881][_0xf6b9('0xa')]?_0x46dbdb[_0xf6b9('0x9')][_0x1b4881][_0xf6b9('0xa')]:_0xf6b9('0xb')+random[_0xf6b9('0xc')](0x6)+_0xf6b9('0xd');_0x1afe8e+='>';}}return _0x1afe8e;}function parseEmail(_0x4073d2,_0x2e9468,_0x4273c3){if(_0x2e9468[_0xf6b9('0x17')]){var _0x5ceb81=/)<[^<]*)*<\/script>/gi;while(_0x5ceb81['test'](_0x2e9468[_0xf6b9('0x17')])){_0x2e9468[_0xf6b9('0x17')]=_0x2e9468[_0xf6b9('0x17')]['replace'](_0x5ceb81,'');}if(_0x2e9468[_0xf6b9('0x17')][_0xf6b9('0x18')](_0xf6b9('0x19'))){var _0x176586=[];_0x2e9468[_0xf6b9('0x1a')][_0xf6b9('0x1b')](_0x3c7129=>{_0x176586[_0xf6b9('0x1c')](_0x3c7129[_0xf6b9('0x1d')]);});var _0x431ad4=/]+>/g;var _0x4fec3a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x42339d=_0x2e9468['html'][_0xf6b9('0x1e')](_0x4fec3a,_0xf6b9('0x1f'));var _0x519c1c=_0x42339d[_0xf6b9('0x1e')](_0x431ad4,_0xf6b9('0x20'));for(let _0x56afce=0x0;_0x56afce<_0x176586[_0xf6b9('0x12')];_0x56afce++){var _0x129bfd=_0x519c1c[_0xf6b9('0x1e')](_0xf6b9('0x20'),'\x20[Attachment:\x20'+_0x176586[_0x56afce]+'\x20]');_0x519c1c=_0x129bfd;}_0x2e9468[_0xf6b9('0x17')]=_0x519c1c;}_0x4273c3[_0xf6b9('0x21')]=_0x2e9468[_0xf6b9('0x17')];}else{_0x4273c3[_0xf6b9('0x21')]=_0x2e9468['textAsHtml'];}if(_0x4273c3[_0xf6b9('0x21')]){_0x4273c3[_0xf6b9('0x21')]=_0x4273c3[_0xf6b9('0x21')][_0xf6b9('0x1e')](/0x0){var _0x434c09=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0xf6b9('0x2f')];for(var _0x8fccec=0x0;_0x8fccec<_0x2e9468['headerLines'][_0xf6b9('0x12')];_0x8fccec++){var _0x4ddd84=_[_0xf6b9('0x10')](_0x434c09,_0x2e9468['headerLines'][_0x8fccec][_0xf6b9('0x30')]);if(_0x4ddd84>=0x0){_0x4273c3[_0xf6b9('0x31')]=!![];}}}return _0x4273c3;}exports[_0xf6b9('0x32')]=function(_0x460696,_0x14af30,_0x37bc4a){var _0x210be8={'from':getAddress(_0x14af30['from']),'firstName':getFirstName(_0x14af30[_0xf6b9('0x33')]),'lastName':getLastName(_0x14af30[_0xf6b9('0x33')]),'mapKey':'email','message':{'from':getMails(_0x460696[_0xf6b9('0x6')],_0x14af30['from']),'to':_0x460696[_0xf6b9('0x6')],'cc':'','subject':_0x14af30[_0xf6b9('0x34')]||'','messageId':_0x14af30[_0xf6b9('0x35')],'inReplyTo':_0x14af30[_0xf6b9('0x36')],'sentAt':moment(_0x14af30[_0xf6b9('0x37')])[_0xf6b9('0x38')](_0xf6b9('0x39')),'attach':![],'attachments':[]}};if(!_0x14af30[_0xf6b9('0x17')]&&!_0x14af30[_0xf6b9('0x3a')]){var _0x40ffa7=_[_0xf6b9('0x3b')](_0x14af30[_0xf6b9('0x1a')],{'contentType':_0xf6b9('0x3c')});if(_0x40ffa7[_0xf6b9('0x12')]){logger[_0xf6b9('0x3d')](util[_0xf6b9('0x38')](_0xf6b9('0x3e'),_0x14af30[_0xf6b9('0x35')]));tnef['parseBuffer'](_[_0xf6b9('0x3f')](_0x40ffa7)['content'],function(_0x1ab517,_0x1dd7ce){if(_0x1dd7ce){_0x14af30[_0xf6b9('0x17')]=_0x1dd7ce['BodyHTML']||'

Empty\x20message

';if(_0x1dd7ce[_0xf6b9('0x40')]){for(var _0x4f18f3=0x0;_0x4f18f3<_0x1dd7ce['Attachments']['length'];_0x4f18f3++){var _0x14d7bd=_0x1dd7ce[_0xf6b9('0x40')][_0x4f18f3];_0x210be8['message']['attachments'][_0xf6b9('0x1c')]({'filename':_0x14d7bd['Title'],'content':Buffer[_0xf6b9('0x33')](_0x14d7bd['Data'])});}}}_0x37bc4a(parseEmail(_0x460696,_0x14af30,_0x210be8));});}else{_0x14af30[_0xf6b9('0x17')]=_0xf6b9('0x41');_0x37bc4a(parseEmail(_0x460696,_0x14af30,_0x210be8));}}else{_0x37bc4a(parseEmail(_0x460696,_0x14af30,_0x210be8));}};exports['generateXOAuth2Token']=function(_0x83d62d,_0x2d03ab){var _0x7fa2fc=[_0xf6b9('0x42')+(_0x2d03ab||''),'auth=Bearer\x20'+_0x83d62d,'',''];return Buffer['from'](_0x7fa2fc[_0xf6b9('0x29')](''),'utf-8')['toString'](_0xf6b9('0x43'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 89b1d1c..b324216 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 _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 +var _0x4f00=['SERV','active','Smtp','exports','lodash','name','key'];(function(_0x428c99,_0x3f22c3){var _0x51c90f=function(_0x21a28e){while(--_0x21a28e){_0x428c99['push'](_0x428c99['shift']());}};_0x51c90f(++_0x3f22c3);}(_0x4f00,0x1ee));var _0x04f0=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x4f00[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x04f0('0x0'));function MailAccount(_0x297c1d){this['id']=_0x297c1d['id']||0x0;this[_0x04f0('0x1')]=_0x297c1d[_0x04f0('0x1')]||'Service';this[_0x04f0('0x2')]=_0x297c1d[_0x04f0('0x2')]||_0x04f0('0x3');this[_0x04f0('0x4')]=_0x297c1d['active']||![];this['Imap']=_0x297c1d['Imap']||[];this[_0x04f0('0x5')]=_0x297c1d[_0x04f0('0x5')]||[];}module[_0x04f0('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 5d75397..f292536 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 _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 +var _0xd0ba=['isUndefined','merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','length'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xd0ba,0xdf));var _0xad0b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xd0ba[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xad0b('0x0'));var MailAccount=require(_0xad0b('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x350d94,_0x44f4b4,_0x21b0e3){var _0x149fe2=_[_0xad0b('0x2')](_0x350d94,function(_0xa8e0c0,_0x450ebd){return _0xa8e0c0[_0x21b0e3];});for(var _0x46fd66 in _0x44f4b4){if(_0x44f4b4[_0xad0b('0x3')](_0x46fd66)){if(!_0x149fe2[_0x46fd66]){delete _0x44f4b4[_0x46fd66];}}}}Realtime[_0xad0b('0x4')][_0xad0b('0x5')]=function(_0x10c7bb,_0x36d418){for(var _0x965ac9 in _0x36d418){if(_0x10c7bb[_0xad0b('0x3')](_0x965ac9)){_0x10c7bb[_0x965ac9]=_0x36d418[_0x965ac9];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x844bae=this;return function(_0x2a44fe){if(_0x2a44fe){freeIsNotKey(_0x2a44fe,_0x844bae[_0xad0b('0x6')],'id');for(var _0x52476e=0x0,_0x48ce33={},_0x1aa38b={};_0x52476e<_0x2a44fe[_0xad0b('0x7')];_0x52476e+=0x1){_0x48ce33=_0x2a44fe[_0x52476e];if(_[_0xad0b('0x8')](_0x844bae[_0xad0b('0x6')][_0x48ce33['id']])){_0x844bae[_0xad0b('0x6')][_0x48ce33['id']]=new MailAccount(_0x48ce33);}else{_[_0xad0b('0x9')](_0x844bae['mailAccounts'][_0x48ce33['id']],_0x48ce33);}}}return _0x844bae[_0xad0b('0x6')];};};module[_0xad0b('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 06f53b5..a0de8eb 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 _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 +var _0xaa00=['Imap','CloudProvider','type','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','active','key','ListId'];(function(_0x42d7dc,_0x1c97d0){var _0x325710=function(_0x57054d){while(--_0x57054d){_0x42d7dc['push'](_0x42d7dc['shift']());}};_0x325710(++_0x1c97d0);}(_0xaa00,0x1f4));var _0x0aa0=function(_0x16f8fa,_0x532102){_0x16f8fa=_0x16f8fa-0x0;var _0x4682a2=_0xaa00[_0x16f8fa];return _0x4682a2;};'use strict';var client=require(_0x0aa0('0x0'));exports[_0x0aa0('0x1')]=function(){return function(){return client[_0x0aa0('0x2')](_0x0aa0('0x3'),{'options':{'attributes':['id',_0x0aa0('0x4'),_0x0aa0('0x5'),_0x0aa0('0x6'),'email',_0x0aa0('0x7'),_0x0aa0('0x8'),_0x0aa0('0x9'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x0aa0('0xa'),'include':[{'model':_0x0aa0('0xb'),'attributes':['id','name',_0x0aa0('0x6'),_0x0aa0('0xc'),'data5'],'as':_0x0aa0('0xb')}]},{'model':_0x0aa0('0xd'),'as':_0x0aa0('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x0aa0('0x4'),_0x0aa0('0x6'),'type','data5'],'as':'CloudProvider'}]}]},'log':_0x0aa0('0xf')});};};exports['notify']=function(_0x4d6679,_0x4aaaa5){return client['Request'](_0x0aa0('0x10'),{'account':{'id':_0x4d6679},'body':_0x4aaaa5,'log':_0x0aa0('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 4d9eab5..26e257d 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 _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 +var _0x6e98=['GetSettings'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x6e98,0x1d6));var _0x86e9=function(_0x54daf5,_0x528643){_0x54daf5=_0x54daf5-0x0;var _0xf70158=_0x6e98[_0x54daf5];return _0xf70158;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x86e9('0x0')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index c268d80..81ce44b 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_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 +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 d289c19..b589996 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 _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 +var _0x3462=['default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','defaults','redis','localhost','adapter'];(function(_0x4fcf67,_0x452b73){var _0x598eab=function(_0x26a5e7){while(--_0x26a5e7){_0x4fcf67['push'](_0x4fcf67['shift']());}};_0x598eab(++_0x452b73);}(_0x3462,0x8a));var _0x2346=function(_0x23ff04,_0x11d7ad){_0x23ff04=_0x23ff04-0x0;var _0x4e0f3f=_0x3462[_0x23ff04];return _0x4e0f3f;};'use strict';var _=require(_0x2346('0x0'));var http=require(_0x2346('0x1'));var express=require(_0x2346('0x2'));var sticky=require('sticky-session');var Redis=require(_0x2346('0x3'));var config=require(_0x2346('0x4'));var app=express();var server=http[_0x2346('0x5')](app);server[_0x2346('0x6')]=0xdbba0;if(sticky[_0x2346('0x7')](server,config[_0x2346('0x8')])){var socketio=require(_0x2346('0x9'))(server,{'transports':[_0x2346('0xa'),_0x2346('0xb')]});config['redis']=_[_0x2346('0xc')](config[_0x2346('0xd')],{'host':_0x2346('0xe'),'port':0x18eb});socketio[_0x2346('0xf')](require('socket.io-redis')({'pubClient':new Redis(config[_0x2346('0xd')]),'subClient':new Redis(config[_0x2346('0xd')])}));require('../../config/triggers')[_0x2346('0x10')]();require('../../config/socketio')['default'](socketio);require('../../config/express')[_0x2346('0x10')](app);require(_0x2346('0x11'))[_0x2346('0x10')](app);}else{server[_0x2346('0x12')](_0x2346('0x13'),function(){console[_0x2346('0x14')](_0x2346('0x15'),config[_0x2346('0x8')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e81c7ec..da96110 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 _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 +var _0x1753=['message','result','catch','exports','jayson/promise','../../config/logger','routing','client','request','then','debug','rpc','error'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x1753,0x86));var _0x3175=function(_0x3bc24e,_0x409e8b){_0x3bc24e=_0x3bc24e-0x0;var _0x1b70f7=_0x1753[_0x3bc24e];return _0x1b70f7;};'use strict';var jayson=require(_0x3175('0x0'));var BPromise=require('bluebird');var logger=require(_0x3175('0x1'))(_0x3175('0x2'));var client=jayson[_0x3175('0x3')]['http']({'port':0x2329});client['Request']=function(_0x31f195,_0x5a4ecd){return new BPromise(function(_0x235698,_0x13f753){return client[_0x3175('0x4')](_0x31f195,_0x5a4ecd)[_0x3175('0x5')](function(_0x1ffac7){logger[_0x3175('0x6')](_0x3175('0x7'),_0x3175('0x2'),_0x31f195,_0x5a4ecd,_0x1ffac7);if(_0x1ffac7[_0x3175('0x8')]){logger['error'](_0x3175('0x7'),_0x3175('0x2'),_0x31f195,_0x1ffac7[_0x3175('0x8')][_0x3175('0x9')],_0x5a4ecd);return _0x13f753(_0x1ffac7[_0x3175('0x8')][_0x3175('0x9')]);}else{return _0x235698(_0x1ffac7[_0x3175('0xa')]);}})[_0x3175('0xb')](function(_0x535496){logger[_0x3175('0x8')](_0x3175('0x7'),_0x3175('0x2'),_0x31f195,_0x535496,_0x5a4ecd);return _0x13f753(_0x535496);});});};module[_0x3175('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 4bf9e67..8484ca0 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 _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 +var _0xcf2e=['getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getSmsQueues','initSmsQueues'];(function(_0x582e69,_0x606d1a){var _0x5e9a96=function(_0x4cbb0f){while(--_0x4cbb0f){_0x582e69['push'](_0x582e69['shift']());}};_0x5e9a96(++_0x606d1a);}(_0xcf2e,0x14d));var _0xecf2=function(_0x50e89b,_0x4bded8){_0x50e89b=_0x50e89b-0x0;var _0x4b9202=_0xcf2e[_0x50e89b];return _0x4b9202;};'use strict';var BPromise=require(_0xecf2('0x0'));var server=require('./server');var Realtime=require(_0xecf2('0x1'));var user=require(_0xecf2('0x2'));var interval=require(_0xecf2('0x3'));var openchannelQueue=require(_0xecf2('0x4'));var chatQueue=require(_0xecf2('0x5'));var smsQueue=require(_0xecf2('0x6'));var mailQueue=require(_0xecf2('0x7'));var faxQueue=require(_0xecf2('0x8'));var whatsappQueue=require(_0xecf2('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xecf2('0xa')](user['getAgents']())[_0xecf2('0xa')](realtime[_0xecf2('0xb')]())[_0xecf2('0xa')](interval[_0xecf2('0xc')]())['then'](realtime[_0xecf2('0xd')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0xecf2('0xa')](realtime[_0xecf2('0xe')]())['then'](chatQueue['getChatQueues']())['then'](realtime['initChatQueues']())[_0xecf2('0xa')](smsQueue[_0xecf2('0xf')]())[_0xecf2('0xa')](realtime[_0xecf2('0x10')]())[_0xecf2('0xa')](mailQueue[_0xecf2('0x11')]())[_0xecf2('0xa')](realtime[_0xecf2('0x12')]())[_0xecf2('0xa')](faxQueue[_0xecf2('0x13')]())[_0xecf2('0xa')](realtime[_0xecf2('0x14')]())['then'](whatsappQueue[_0xecf2('0x15')]())[_0xecf2('0xa')](realtime[_0xecf2('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0xecf2('0x17')](realtime)[_0xecf2('0xa')](function(_0x4be9e2){return initRealtime();})[_0xecf2('0xa')](function(_0x1b2819){return setInterval(initRealtime,0x1388);})[_0xecf2('0x18')](function(_0x14c7f2){console['log'](_0x14c7f2);});}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 cf5eec8..65afd77 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_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 +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x1d67f6,_0x125103){var _0x11543f=function(_0x41b16f){while(--_0x41b16f){_0x1d67f6['push'](_0x1d67f6['shift']());}};_0x11543f(++_0x125103);}(_0x2ef3,0xba));var _0x32ef=function(_0x52f0ee,_0x3579a5){_0x52f0ee=_0x52f0ee-0x0;var _0x1173dc=_0x2ef3[_0x52f0ee];return _0x1173dc;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 1b3cca2..af336cd 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 _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 +var _0xbd42=['jayson/promise','client','http','request','then','error','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd42,0xee));var _0x2bd4=function(_0x4614d5,_0x5c8f33){_0x4614d5=_0x4614d5-0x0;var _0x265def=_0xbd42[_0x4614d5];return _0x265def;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x2bd4('0x0'));var client=jayson[_0x2bd4('0x1')][_0x2bd4('0x2')]({'port':0x232b});function request(_0x2e181e,_0x19eb68){return new BPromise(function(_0x16f710,_0x2595a3){return client[_0x2bd4('0x3')](_0x2e181e,_0x19eb68)[_0x2bd4('0x4')](function(_0x4ab216){if(_0x4ab216[_0x2bd4('0x5')]){return _0x2595a3(_0x4ab216[_0x2bd4('0x5')][_0x2bd4('0x6')]);}else{return _0x16f710(_0x4ab216['result']);}})['catch'](function(_0x14427a){return _0x2595a3(_0x14427a);});});}exports['sendMailMessage']=function(_0x6138f7,_0xe88bb1){return request('SendMail',{'account':_0x6138f7,'message':_0xe88bb1});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index e11184e..b62137d 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 _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 +var _0xd741=['whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatCurrentCapacity','smsStatus','openchannelStatus','isEqual','omit','emit','exports','moment','../../../config/environment','redis','defaults','localhost','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd741,0x1ad));var _0x1d74=function(_0xe6beab,_0x299dd7){_0xe6beab=_0xe6beab-0x0;var _0x452825=_0xd741[_0xe6beab];return _0x452825;};'use strict';var _=require('lodash');var moment=require(_0x1d74('0x0'));var Redis=require('ioredis');var config=require(_0x1d74('0x1'));config[_0x1d74('0x2')]=_[_0x1d74('0x3')](config[_0x1d74('0x2')],{'host':_0x1d74('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x3acd8b){this['id']=_0x3acd8b['id']||0x0;this['name']=_0x3acd8b[_0x1d74('0x5')]||'';this[_0x1d74('0x6')]=_0x3acd8b[_0x1d74('0x6')]||!![];this[_0x1d74('0x7')]=_0x3acd8b[_0x1d74('0x7')]||![];this['chatPause']=_0x3acd8b['chatPause']||![];this[_0x1d74('0x8')]=_0x3acd8b['mailPause']||![];this[_0x1d74('0x9')]=_0x3acd8b['faxPause']||![];this[_0x1d74('0xa')]=_0x3acd8b[_0x1d74('0xa')]||![];this[_0x1d74('0xb')]=_0x3acd8b[_0x1d74('0xb')]||![];this[_0x1d74('0xc')]=_0x1d74('0xd');this['chatStatusTime']=0x0;this[_0x1d74('0xe')]=_0x3acd8b['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x1d74('0xf')]=_0x1d74('0xd');this[_0x1d74('0x10')]=0x0;this[_0x1d74('0x11')]=_0x3acd8b[_0x1d74('0x11')]||0x0;this[_0x1d74('0x12')]=0x0;this[_0x1d74('0x13')]=_0x1d74('0xd');this[_0x1d74('0x14')]=0x0;this[_0x1d74('0x15')]=_0x3acd8b[_0x1d74('0x15')]||0x0;this[_0x1d74('0x16')]=0x0;this['smsStatus']='unknown';this[_0x1d74('0x17')]=0x0;this[_0x1d74('0x18')]=_0x3acd8b[_0x1d74('0x18')]||0x0;this[_0x1d74('0x19')]=0x0;this[_0x1d74('0x1a')]=_0x1d74('0xd');this[_0x1d74('0x1b')]=0x0;this[_0x1d74('0x1c')]=_0x3acd8b[_0x1d74('0x1c')]||0x0;this[_0x1d74('0x1d')]=0x0;this['openchannelStatus']=_0x1d74('0xd');this[_0x1d74('0x1e')]=0x0;this[_0x1d74('0x1f')]=_0x3acd8b[_0x1d74('0x1f')]||0x0;this[_0x1d74('0x20')]=0x0;this[_0x1d74('0x21')]=![];this[_0x1d74('0x22')]=undefined;this[_0x1d74('0x23')]={};this['faxWaitingInteractions']={};this[_0x1d74('0x24')]={};this[_0x1d74('0x25')]={};this[_0x1d74('0x26')]={};this[_0x1d74('0x27')]={};this['updateRealtime']();}Agent[_0x1d74('0x28')][_0x1d74('0x29')]=function(_0x37144b){if(this[_0x37144b+_0x1d74('0x2a')]>0x0){if(this[_0x37144b+_0x1d74('0x2b')]>0x0&&this[_0x37144b+_0x1d74('0x2a')]>=this[_0x37144b+_0x1d74('0x2b')]){return _0x1d74('0x2c');}else{return _0x1d74('0x2d');}}else{return _0x1d74('0x2e');}};Agent[_0x1d74('0x28')][_0x1d74('0x2f')]=function(){var _0x217bff=[_0x1d74('0x30'),_0x1d74('0x31'),_0x1d74('0x32'),'fax',_0x1d74('0x33'),_0x1d74('0x34')];for(var _0x2e9645=0x0;_0x2e9645<_0x217bff[_0x1d74('0x35')];_0x2e9645+=0x1){var _0x484c75=this[_0x1d74('0x29')](_0x217bff[_0x2e9645]);if(this[_0x217bff[_0x2e9645]+_0x1d74('0x36')]!==_0x484c75){this[_0x217bff[_0x2e9645]+_0x1d74('0x37')]=_[_0x1d74('0x38')](moment()[_0x1d74('0x39')]('x'));}this[_0x217bff[_0x2e9645]+_0x1d74('0x36')]=_0x484c75;}var _0x195a99={'id':this['id'],'name':this['name'],'online':this[_0x1d74('0x6')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x1d74('0x8')],'smsPause':this['smsPause'],'faxPause':this[_0x1d74('0x9')],'openchannelPause':this[_0x1d74('0xb')],'chatStatus':this[_0x1d74('0xc')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x1d74('0xe')],'chatCurrentCapacity':this[_0x1d74('0x3a')],'mailStatus':this[_0x1d74('0xf')],'mailStatusTime':this[_0x1d74('0x10')],'mailCapacity':this[_0x1d74('0x11')],'mailCurrentCapacity':this[_0x1d74('0x12')],'faxStatus':this[_0x1d74('0x13')],'faxStatusTime':this[_0x1d74('0x14')],'faxCapacity':this[_0x1d74('0x15')],'faxCurrentCapacity':this[_0x1d74('0x16')],'smsStatus':this[_0x1d74('0x3b')],'smsStatusTime':this[_0x1d74('0x17')],'smsCapacity':this[_0x1d74('0x18')],'smsCurrentCapacity':this[_0x1d74('0x19')],'whatsappStatus':this[_0x1d74('0x1a')],'whatsappStatusTime':this[_0x1d74('0x1b')],'whatsappCapacity':this[_0x1d74('0x1c')],'whatsappCurrentCapacity':this[_0x1d74('0x1d')],'openchannelStatus':this[_0x1d74('0x3c')],'openchannelStatusTime':this[_0x1d74('0x1e')],'openchannelCapacity':this[_0x1d74('0x1f')],'openchannelCurrentCapacity':this[_0x1d74('0x20')],'busy':this[_0x1d74('0x21')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x1d74('0x23')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x1d74('0x24')],'openchannelWaitingInteractions':this[_0x1d74('0x25')],'smsWaitingInteractions':this[_0x1d74('0x26')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};if(!_[_0x1d74('0x3d')](_[_0x1d74('0x3e')](this,[_0x1d74('0x6')]),_[_0x1d74('0x3e')](_0x195a99,[_0x1d74('0x6')]))){io[_0x1d74('0x3f')]('user:routing:update',_0x195a99);}};module[_0x1d74('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 283a500..72d9cb1 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 _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 +var _0x4667=['available','format','emit','exports','lodash','md5','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','chatPause'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x4667,0x162));var _0x7466=function(_0x29976,_0x35de12){_0x29976=_0x29976-0x0;var _0x5cd575=_0x4667[_0x29976];return _0x5cd575;};'use strict';var _=require(_0x7466('0x0'));var md5=require(_0x7466('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x7466('0x2')]=_[_0x7466('0x3')](config[_0x7466('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x7466('0x4'))(new Redis(config[_0x7466('0x2')]));function ChatQueue(_0x5b986a){this['id']=_0x5b986a['id']||0x0;this[_0x7466('0x5')]=_0x5b986a['name']||'';this[_0x7466('0x6')]=_0x5b986a['timeout']||0xa;this[_0x7466('0x7')]=_0x5b986a[_0x7466('0x7')]||_0x7466('0x8');this[_0x7466('0x9')]=_0x5b986a[_0x7466('0x9')];this['mapAgentsId']={};this[_0x7466('0xa')]=0x0;this[_0x7466('0x1')]='';this[_0x7466('0xb')]();this[_0x7466('0xc')]();}ChatQueue[_0x7466('0xd')][_0x7466('0xb')]=function(){var _0x2dda09=this['mapAgentsId'][_0x7466('0xe')];this[_0x7466('0xf')]=_[_0x7466('0x10')](this['Agents'],'id');this[_0x7466('0xf')]['_rr']=_0x2dda09;};ChatQueue[_0x7466('0xd')][_0x7466('0xc')]=function(){this[_0x7466('0x11')]=0x0;this[_0x7466('0x12')]=0x0;for(var _0x4689c8=0x0;_0x4689c8=0x0?this[_0x7466('0x15')]:0x0;var _0x585bab={'id':this['id'],'available':this[_0x7466('0x15')],'loggedIn':this[_0x7466('0x11')],'name':this[_0x7466('0x5')],'paused':this[_0x7466('0x12')],'waiting':this['waiting']};var _0x4b8a6d=md5(JSON['stringify'](_0x585bab));if(this['md5']!==_0x4b8a6d){this[_0x7466('0x1')]=_0x4b8a6d;io['to'](util[_0x7466('0x16')]('chat:queue:%s',_0x585bab[_0x7466('0x5')]))[_0x7466('0x17')]('chat_queue:save',_0x585bab);}};module[_0x7466('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e6d28dc..866ea6e 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 _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 +var _0xfb61=['available','waiting','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','map','updateRealtime','loggedIn','paused','length','faxPause'];(function(_0x527bdf,_0x20bd3a){var _0x33abdf=function(_0x415366){while(--_0x415366){_0x527bdf['push'](_0x527bdf['shift']());}};_0x33abdf(++_0x20bd3a);}(_0xfb61,0xf7));var _0x1fb6=function(_0x545fe3,_0x3b191f){_0x545fe3=_0x545fe3-0x0;var _0x480702=_0xfb61[_0x545fe3];return _0x480702;};'use strict';var _=require(_0x1fb6('0x0'));var md5=require(_0x1fb6('0x1'));var util=require(_0x1fb6('0x2'));var Redis=require(_0x1fb6('0x3'));var config=require(_0x1fb6('0x4'));config[_0x1fb6('0x5')]=_[_0x1fb6('0x6')](config['redis'],{'host':_0x1fb6('0x7'),'port':0x18eb});var io=require(_0x1fb6('0x8'))(new Redis(config[_0x1fb6('0x5')]));function FaxQueue(_0xd26d8e){this['id']=_0xd26d8e['id']||0x0;this[_0x1fb6('0x9')]=_0xd26d8e[_0x1fb6('0x9')]||'';this[_0x1fb6('0xa')]=_0xd26d8e[_0x1fb6('0xa')]||0xa;this['strategy']=_0xd26d8e[_0x1fb6('0xb')]||_0x1fb6('0xc');this[_0x1fb6('0xd')]=_0xd26d8e[_0x1fb6('0xd')];this[_0x1fb6('0xe')]={};this['waiting']=0x0;this[_0x1fb6('0x1')]='';this[_0x1fb6('0xf')]();this['updateRealtime']();}FaxQueue[_0x1fb6('0x10')]['updateRouting']=function(){var _0x8c87ed=this[_0x1fb6('0xe')]['_rr'];this['mapAgentsId']=_[_0x1fb6('0x11')](this[_0x1fb6('0xd')],'id');this[_0x1fb6('0xe')]['_rr']=_0x8c87ed;};FaxQueue[_0x1fb6('0x10')][_0x1fb6('0x12')]=function(){this[_0x1fb6('0x13')]=0x0;this[_0x1fb6('0x14')]=0x0;for(var _0x16bf78=0x0;_0x16bf78=0x0?this[_0x1fb6('0x17')]:0x0;var _0x48216b={'id':this['id'],'available':this[_0x1fb6('0x17')],'loggedIn':this[_0x1fb6('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1fb6('0x18')]};var _0x4bde0f=md5(JSON['stringify'](_0x48216b));if(this[_0x1fb6('0x1')]!==_0x4bde0f){this['md5']=_0x4bde0f;io['to'](util[_0x1fb6('0x19')](_0x1fb6('0x1a'),_0x48216b[_0x1fb6('0x9')]))[_0x1fb6('0x1b')](_0x1fb6('0x1c'),_0x48216b);}};module[_0x1fb6('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 6ae115c..e2b540b 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 _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 +var _0xe335=['Intervals','name'];(function(_0x58eaf0,_0x4a1875){var _0x45e959=function(_0x1e1289){while(--_0x1e1289){_0x58eaf0['push'](_0x58eaf0['shift']());}};_0x45e959(++_0x4a1875);}(_0xe335,0x9b));var _0x5e33=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe335[_0x19950b];return _0x3c6b41;};'use strict';function Interval(_0x39d4a3){this['id']=_0x39d4a3['id']||0x0;this[_0x5e33('0x0')]=_0x39d4a3[_0x5e33('0x0')]||'';this[_0x5e33('0x1')]=_0x39d4a3[_0x5e33('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 beb2258..ea14eb6 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 _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 +var _0xcc68=['../../../config/environment','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','length','online','loggedIn','mailPause','paused','available','stringify','format','emit','mail_queue:save','exports','md5','util','ioredis'];(function(_0x201583,_0x5e64fc){var _0x4cb47f=function(_0x1a0cb0){while(--_0x1a0cb0){_0x201583['push'](_0x201583['shift']());}};_0x4cb47f(++_0x5e64fc);}(_0xcc68,0xab));var _0x8cc6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcc68[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var md5=require(_0x8cc6('0x0'));var util=require(_0x8cc6('0x1'));var Redis=require(_0x8cc6('0x2'));var config=require(_0x8cc6('0x3'));config[_0x8cc6('0x4')]=_['defaults'](config[_0x8cc6('0x4')],{'host':_0x8cc6('0x5'),'port':0x18eb});var io=require(_0x8cc6('0x6'))(new Redis(config[_0x8cc6('0x4')]));function MailQueue(_0xc1a92d){this['id']=_0xc1a92d['id']||0x0;this['name']=_0xc1a92d[_0x8cc6('0x7')]||'';this['timeout']=_0xc1a92d['timeout']||0xa;this[_0x8cc6('0x8')]=_0xc1a92d[_0x8cc6('0x8')]||_0x8cc6('0x9');this[_0x8cc6('0xa')]=_0xc1a92d[_0x8cc6('0xa')];this[_0x8cc6('0xb')]={};this[_0x8cc6('0xc')]=0x0;this['md5']='';this[_0x8cc6('0xd')]();this[_0x8cc6('0xe')]();}MailQueue[_0x8cc6('0xf')]['updateRouting']=function(){var _0x14e73d=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x8cc6('0x10')](this[_0x8cc6('0xa')],'id');this[_0x8cc6('0xb')][_0x8cc6('0x11')]=_0x14e73d;};MailQueue[_0x8cc6('0xf')][_0x8cc6('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x5ee046=0x0;_0x5ee046=0x0?this[_0x8cc6('0x17')]:0x0;var _0x103509={'id':this['id'],'available':this[_0x8cc6('0x17')],'loggedIn':this[_0x8cc6('0x14')],'name':this['name'],'paused':this[_0x8cc6('0x16')],'waiting':this['waiting']};var _0x28ac04=md5(JSON[_0x8cc6('0x18')](_0x103509));if(this['md5']!==_0x28ac04){this[_0x8cc6('0x0')]=_0x28ac04;io['to'](util[_0x8cc6('0x19')]('mail:queue:%s',_0x103509['name']))[_0x8cc6('0x1a')](_0x8cc6('0x1b'),_0x103509);}};module[_0x8cc6('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 1a26925..15cb342 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 _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 +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x1c4b8d,_0x146a41){var _0x203346=function(_0x541d4d){while(--_0x541d4d){_0x1c4b8d['push'](_0x1c4b8d['shift']());}};_0x203346(++_0x146a41);}(_0x5fc3,0xa8));var _0x35fc=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0x5fc3[_0x7a3247];return _0x1bfde5;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 6bee2f4..86b52ee 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 _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 +var _0x2ce1=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','map','_rr','loggedIn','length','online','smsPause','paused','available','format','emit','sms_queue:save','exports','ioredis'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x2ce1,0x8b));var _0x12ce=function(_0xcc8967,_0x381427){_0xcc8967=_0xcc8967-0x0;var _0x393c0d=_0x2ce1[_0xcc8967];return _0x393c0d;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x12ce('0x0'));var config=require(_0x12ce('0x1'));config[_0x12ce('0x2')]=_[_0x12ce('0x3')](config['redis'],{'host':_0x12ce('0x4'),'port':0x18eb});var io=require(_0x12ce('0x5'))(new Redis(config['redis']));function SmsQueue(_0xf5b373){this['id']=_0xf5b373['id']||0x0;this[_0x12ce('0x6')]=_0xf5b373[_0x12ce('0x6')]||'';this['timeout']=_0xf5b373[_0x12ce('0x7')]||0xa;this['strategy']=_0xf5b373[_0x12ce('0x8')]||_0x12ce('0x9');this[_0x12ce('0xa')]=_0xf5b373['Agents'];this[_0x12ce('0xb')]={};this[_0x12ce('0xc')]=0x0;this[_0x12ce('0xd')]='';this[_0x12ce('0xe')]();this['updateRealtime']();}SmsQueue[_0x12ce('0xf')]['updateRouting']=function(){var _0x3a3d4d=this['mapAgentsId']['_rr'];this[_0x12ce('0xb')]=_[_0x12ce('0x10')](this[_0x12ce('0xa')],'id');this[_0x12ce('0xb')][_0x12ce('0x11')]=_0x3a3d4d;};SmsQueue[_0x12ce('0xf')]['updateRealtime']=function(){this[_0x12ce('0x12')]=0x0;this['paused']=0x0;for(var _0x12bcf2=0x0;_0x12bcf2=0x0?this[_0x12ce('0x17')]:0x0;var _0x2a0f3f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x12ce('0x12')],'name':this['name'],'paused':this[_0x12ce('0x16')],'waiting':this['waiting']};var _0xe24a11=md5(JSON['stringify'](_0x2a0f3f));if(this[_0x12ce('0xd')]!==_0xe24a11){this['md5']=_0xe24a11;io['to'](util[_0x12ce('0x18')]('sms:queue:%s',_0x2a0f3f['name']))[_0x12ce('0x19')](_0x12ce('0x1a'),_0x2a0f3f);}};module[_0x12ce('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b0b7f23..21cf872 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 _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 +var _0x7565=['prototype','map','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime'];(function(_0x51d5fa,_0x4046b4){var _0x56583c=function(_0x2aa4ed){while(--_0x2aa4ed){_0x51d5fa['push'](_0x51d5fa['shift']());}};_0x56583c(++_0x4046b4);}(_0x7565,0x1ef));var _0x5756=function(_0x6022b2,_0x258604){_0x6022b2=_0x6022b2-0x0;var _0x34e323=_0x7565[_0x6022b2];return _0x34e323;};'use strict';var _=require(_0x5756('0x0'));var md5=require('md5');var util=require(_0x5756('0x1'));var Redis=require(_0x5756('0x2'));var config=require(_0x5756('0x3'));config[_0x5756('0x4')]=_[_0x5756('0x5')](config[_0x5756('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x5756('0x6'))(new Redis(config[_0x5756('0x4')]));function WhatsappQueue(_0x40beab){this['id']=_0x40beab['id']||0x0;this[_0x5756('0x7')]=_0x40beab[_0x5756('0x7')]||'';this[_0x5756('0x8')]=_0x40beab[_0x5756('0x8')]||0xa;this[_0x5756('0x9')]=_0x40beab['strategy']||_0x5756('0xa');this[_0x5756('0xb')]=_0x40beab[_0x5756('0xb')];this[_0x5756('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x5756('0xd')]();this[_0x5756('0xe')]();}WhatsappQueue[_0x5756('0xf')][_0x5756('0xd')]=function(){var _0x394167=this[_0x5756('0xc')]['_rr'];this[_0x5756('0xc')]=_[_0x5756('0x10')](this[_0x5756('0xb')],'id');this[_0x5756('0xc')][_0x5756('0x11')]=_0x394167;};WhatsappQueue['prototype'][_0x5756('0xe')]=function(){this[_0x5756('0x12')]=0x0;this[_0x5756('0x13')]=0x0;for(var _0x380710=0x0;_0x380710=0x0?this[_0x5756('0x17')]:0x0;var _0x49c84e={'id':this['id'],'available':this[_0x5756('0x17')],'loggedIn':this[_0x5756('0x12')],'name':this[_0x5756('0x7')],'paused':this[_0x5756('0x13')],'waiting':this['waiting']};var _0x4d9174=md5(JSON[_0x5756('0x18')](_0x49c84e));if(this[_0x5756('0x19')]!==_0x4d9174){this[_0x5756('0x19')]=_0x4d9174;io['to'](util[_0x5756('0x1a')](_0x5756('0x1b'),_0x49c84e[_0x5756('0x7')]))[_0x5756('0x1c')](_0x5756('0x1d'),_0x49c84e);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 13570cb..2a5bc4a 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_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 +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 0e5e441..e85e6d5 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 _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 +var _0x3e8a=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3e8a,0x196));var _0xa3e8=function(_0x1f544e,_0x1edbbd){_0x1f544e=_0x1f544e-0x0;var _0x394caa=_0x3e8a[_0x1f544e];return _0x394caa;};'use strict';var client=require('../client');exports[_0xa3e8('0x0')]=function(_0x1dabd3,_0x1b368a){return client[_0xa3e8('0x1')]('UpdateChatInteraction',{'body':_0x1b368a,'options':{'where':{'id':_0x1dabd3}},'log':_0xa3e8('0x2')});};exports[_0xa3e8('0x3')]=function(_0x4d8502,_0x62ecac){return client[_0xa3e8('0x1')](_0xa3e8('0x4'),{'body':_0x62ecac,'options':{'where':{'id':_0x4d8502}},'log':_0xa3e8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 856ba42..45ed77d 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 _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 +var _0xa832=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x3b967e,_0x21da88){var _0x4f0f27=function(_0x579b70){while(--_0x579b70){_0x3b967e['push'](_0x3b967e['shift']());}};_0x4f0f27(++_0x21da88);}(_0xa832,0x82));var _0x2a83=function(_0x1e6027,_0x255d10){_0x1e6027=_0x1e6027-0x0;var _0x18171e=_0xa832[_0x1e6027];return _0x18171e;};'use strict';var client=require(_0x2a83('0x0'));exports[_0x2a83('0x1')]=function(_0x5312e8){return client[_0x2a83('0x2')](_0x2a83('0x3'),{'body':_0x5312e8,'log':_0x2a83('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 1940728..da587ab 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 _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 +var _0xa93e=['online','chatPause','getChatQueues','Request','GetChatQueue','timeout','User'];(function(_0x5843d2,_0x121877){var _0x6dd37=function(_0x3fe2dc){while(--_0x3fe2dc){_0x5843d2['push'](_0x5843d2['shift']());}};_0x6dd37(++_0x121877);}(_0xa93e,0x1df));var _0xea93=function(_0x59d1f3,_0x5c2e87){_0x59d1f3=_0x59d1f3-0x0;var _0x240d3d=_0xa93e[_0x59d1f3];return _0x240d3d;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0xea93('0x0')](_0xea93('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xea93('0x2'),'strategy'],'include':[{'model':_0xea93('0x3'),'as':'Agents','attributes':['id','name',_0xea93('0x4'),_0xea93('0x5')]}]},'log':_0xea93('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d9bfe1e..5743048 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 _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 +var _0x92f0=['CreateChatQueueReport','Request','UpdateChatQueueReport','DESC','create'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x92f0,0x10d));var _0x092f=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0x92f0[_0x326d35];return _0xd3f8f3;};'use strict';var client=require('../client');exports[_0x092f('0x0')]=function(_0x209c83){return client['Request'](_0x092f('0x1'),{'body':_0x209c83,'log':_0x092f('0x1')});};exports['update']=function(_0x47f54d,_0x16bf0b){return client[_0x092f('0x2')](_0x092f('0x3'),{'body':_0x16bf0b,'options':{'where':{'uniqueid':_0x47f54d},'order':[['id',_0x092f('0x4')]],'limit':0x1},'log':_0x092f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 33fca17..76294ac 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_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 +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1ddc32,_0x2b6aeb){var _0x14e4ce=function(_0x524da5){while(--_0x524da5){_0x1ddc32['push'](_0x1ddc32['shift']());}};_0x14e4ce(++_0x2b6aeb);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 21753b8..9eb54f4 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 _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 +var _0x13e3=['create','../client'];(function(_0x319ec7,_0x5dadae){var _0x5c2675=function(_0x27a202){while(--_0x27a202){_0x319ec7['push'](_0x319ec7['shift']());}};_0x5c2675(++_0x5dadae);}(_0x13e3,0xed));var _0x313e=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x13e3[_0xa45395];return _0x3c83d2;};'use strict';var client=require(_0x313e('0x0'));exports[_0x313e('0x1')]=function(_0x573c9a){return client['Request']('CreateFaxMessage',{'body':_0x573c9a,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2e00b67..760acd5 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 _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 +var _0xf6c2=['faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','User','Agents','online'];(function(_0xa940b7,_0x59344a){var _0x352428=function(_0x4a3dcd){while(--_0x4a3dcd){_0xa940b7['push'](_0xa940b7['shift']());}};_0x352428(++_0x59344a);}(_0xf6c2,0x1f0));var _0x2f6c=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf6c2[_0x3e5086];return _0xfeb102;};'use strict';var client=require('../client');exports[_0x2f6c('0x0')]=function(){return function(){return client[_0x2f6c('0x1')](_0x2f6c('0x2'),{'options':{'raw':![],'attributes':['id',_0x2f6c('0x3'),_0x2f6c('0x4'),'strategy'],'include':[{'model':_0x2f6c('0x5'),'as':_0x2f6c('0x6'),'attributes':['id',_0x2f6c('0x3'),_0x2f6c('0x7'),_0x2f6c('0x8')]}]},'log':_0x2f6c('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0523f4e..e57cadf 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 _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 +var _0x811e=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x25aa36,_0x3a8ea8){var _0x530d69=function(_0x4411e1){while(--_0x4411e1){_0x25aa36['push'](_0x25aa36['shift']());}};_0x530d69(++_0x3a8ea8);}(_0x811e,0x1cc));var _0xe811=function(_0xa024c3,_0x28ebc9){_0xa024c3=_0xa024c3-0x0;var _0x74f2e9=_0x811e[_0xa024c3];return _0x74f2e9;};'use strict';var client=require(_0xe811('0x0'));exports[_0xe811('0x1')]=function(_0x4d5a46){return client[_0xe811('0x2')](_0xe811('0x3'),{'body':_0x4d5a46,'log':'CreateFaxQueueReport'});};exports[_0xe811('0x4')]=function(_0x23912a,_0x2840e7){return client['Request'](_0xe811('0x5'),{'body':_0x2840e7,'options':{'where':{'uniqueid':_0x23912a},'order':[['id',_0xe811('0x6')]],'limit':0x1},'log':_0xe811('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 28fbdd2..34613ef 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 _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 +var _0xc068=['Intervals','interval','../client','getIntervals','GetInterval','name','Interval'];(function(_0x361687,_0x2aeba4){var _0x223327=function(_0x4cf28b){while(--_0x4cf28b){_0x361687['push'](_0x361687['shift']());}};_0x223327(++_0x2aeba4);}(_0xc068,0x1a6));var _0x8c06=function(_0xb6ef81,_0x7be25f){_0xb6ef81=_0xb6ef81-0x0;var _0xa6edfe=_0xc068[_0xb6ef81];return _0xa6edfe;};'use strict';var client=require(_0x8c06('0x0'));exports[_0x8c06('0x1')]=function(){return function(){return client['Request'](_0x8c06('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8c06('0x3')],'include':[{'model':_0x8c06('0x4'),'as':_0x8c06('0x5'),'attributes':['id',_0x8c06('0x3'),_0x8c06('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 67bd7cf..71e4cc4 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 _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 +var _0xf61e=['addTags','AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0xf61e,0x191));var _0xef61=function(_0x5c3a56,_0x582ecc){_0x5c3a56=_0x5c3a56-0x0;var _0x4e55de=_0xf61e[_0x5c3a56];return _0x4e55de;};'use strict';var client=require(_0xef61('0x0'));exports[_0xef61('0x1')]=function(_0xe535c3,_0xcf15bd){return client[_0xef61('0x2')](_0xef61('0x3'),{'body':_0xcf15bd,'options':{'where':{'id':_0xe535c3}},'log':_0xef61('0x4')});};exports[_0xef61('0x5')]=function(_0x2bd1d0,_0x14122a){return client[_0xef61('0x2')](_0xef61('0x6'),{'body':_0x14122a,'options':{'where':{'id':_0x2bd1d0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 46b369b..9ffb838 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 _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 +var _0x6b85=['../client','create','createMailMessage'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x6b85,0xc0));var _0x56b8=function(_0xd1e1d5,_0xc5f71c){_0xd1e1d5=_0xd1e1d5-0x0;var _0x4e7e61=_0x6b85[_0xd1e1d5];return _0x4e7e61;};'use strict';var client=require(_0x56b8('0x0'));exports[_0x56b8('0x1')]=function(_0x56ef1b){return client['Request']('CreateMailMessage',{'body':_0x56ef1b,'log':_0x56b8('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c6851a8..844a71b 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 _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 +var _0x778d=['User','Agents','online','mailPause','getMailQueues','Request','name','timeout','strategy'];(function(_0x31d3be,_0x3ffcae){var _0x1bf996=function(_0x523a8c){while(--_0x523a8c){_0x31d3be['push'](_0x31d3be['shift']());}};_0x1bf996(++_0x3ffcae);}(_0x778d,0x70));var _0xd778=function(_0xaf808c,_0x5f1ef1){_0xaf808c=_0xaf808c-0x0;var _0x318df8=_0x778d[_0xaf808c];return _0x318df8;};'use strict';var client=require('../client');exports[_0xd778('0x0')]=function(){return function(){return client[_0xd778('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xd778('0x2'),_0xd778('0x3'),_0xd778('0x4')],'include':[{'model':_0xd778('0x5'),'as':_0xd778('0x6'),'attributes':['id',_0xd778('0x2'),_0xd778('0x7'),_0xd778('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index ce61c3e..47eef5a 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 _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 +var _0x08c3=['DESC','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x223850,_0x4e556a){var _0x2a57ee=function(_0x370667){while(--_0x370667){_0x223850['push'](_0x223850['shift']());}};_0x2a57ee(++_0x4e556a);}(_0x08c3,0xd9));var _0x308c=function(_0x3b204d,_0x2868c6){_0x3b204d=_0x3b204d-0x0;var _0x31c4dd=_0x08c3[_0x3b204d];return _0x31c4dd;};'use strict';var client=require('../client');exports[_0x308c('0x0')]=function(_0x2ea513){return client['Request']('CreateMailQueueReport',{'body':_0x2ea513,'log':_0x308c('0x1')});};exports[_0x308c('0x2')]=function(_0x57abb4,_0x26e472){return client[_0x308c('0x3')](_0x308c('0x4'),{'body':_0x26e472,'options':{'where':{'uniqueid':_0x57abb4},'order':[['id',_0x308c('0x5')]],'limit':0x1},'log':_0x308c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index cee9644..12468b5 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 _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 +var _0xae8e=['addTagsToChatInteraction','../client','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction'];(function(_0x1d69d4,_0x10de54){var _0x5a4a09=function(_0x533090){while(--_0x533090){_0x1d69d4['push'](_0x1d69d4['shift']());}};_0x5a4a09(++_0x10de54);}(_0xae8e,0x1dc));var _0xeae8=function(_0x15eeb9,_0x4ab07e){_0x15eeb9=_0x15eeb9-0x0;var _0x5391d9=_0xae8e[_0x15eeb9];return _0x5391d9;};'use strict';var client=require(_0xeae8('0x0'));exports['update']=function(_0x34c030,_0x176934){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x176934,'options':{'where':{'id':_0x34c030}},'log':_0xeae8('0x1')});};exports['addTags']=function(_0x5539ee,_0x491529){return client[_0xeae8('0x2')](_0xeae8('0x3'),{'body':_0x491529,'options':{'where':{'id':_0x5539ee}},'log':_0xeae8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2900369..3fd80a8 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 _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 +var _0xcd6a=['createOpenchannelMessage','../client','create','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcd6a,0x79));var _0xacd6=function(_0x305347,_0x3cddbe){_0x305347=_0x305347-0x0;var _0x2076cc=_0xcd6a[_0x305347];return _0x2076cc;};'use strict';var client=require(_0xacd6('0x0'));exports[_0xacd6('0x1')]=function(_0x5193e3){return client[_0xacd6('0x2')]('CreateOpenchannelMessage',{'body':_0x5193e3,'log':_0xacd6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 253aa9b..738da96 100644 --- a/server/services/routing/rpc/openchannelQueue.js +++ b/server/services/routing/rpc/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x151b=['User','online','openchannelPause','../client','GetOpenchannelQueue','timeout','strategy'];(function(_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 +var _0x923d=['Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x4180c6,_0x642cf3){var _0xe0e5aa=function(_0x37f4e8){while(--_0x37f4e8){_0x4180c6['push'](_0x4180c6['shift']());}};_0xe0e5aa(++_0x642cf3);}(_0x923d,0xdf));var _0xd923=function(_0xf83d72,_0x4f67aa){_0xf83d72=_0xf83d72-0x0;var _0x23cea1=_0x923d[_0xf83d72];return _0x23cea1;};'use strict';var client=require('../client');exports[_0xd923('0x0')]=function(){return function(){return client[_0xd923('0x1')](_0xd923('0x2'),{'options':{'raw':![],'attributes':['id',_0xd923('0x3'),_0xd923('0x4'),_0xd923('0x5')],'include':[{'model':_0xd923('0x6'),'as':_0xd923('0x7'),'attributes':['id','name',_0xd923('0x8'),_0xd923('0x9')]}]},'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 1ed2272..eaad204 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 _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 +var _0x195e=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x34503b,_0x10ceec){var _0xdc2736=function(_0x15ac6f){while(--_0x15ac6f){_0x34503b['push'](_0x34503b['shift']());}};_0xdc2736(++_0x10ceec);}(_0x195e,0xa1));var _0xe195=function(_0x496224,_0x4ba496){_0x496224=_0x496224-0x0;var _0x430870=_0x195e[_0x496224];return _0x430870;};'use strict';var client=require(_0xe195('0x0'));exports['create']=function(_0x533cad){return client[_0xe195('0x1')](_0xe195('0x2'),{'body':_0x533cad,'log':_0xe195('0x2')});};exports[_0xe195('0x3')]=function(_0x28337c,_0x546613){return client[_0xe195('0x1')](_0xe195('0x4'),{'body':_0x546613,'options':{'where':{'uniqueid':_0x28337c},'order':[['id',_0xe195('0x5')]],'limit':0x1},'log':_0xe195('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0f7cd2d..1b39157 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 _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 +var _0xc5c7=['addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x13f00f,_0x425f9f){_0x13f00f=_0x13f00f-0x0;var _0x9d5330=_0xc5c7[_0x13f00f];return _0x9d5330;};'use strict';var client=require('../client');exports[_0x7c5c('0x0')]=function(_0x28e1a9,_0x2e1b3a){return client[_0x7c5c('0x1')](_0x7c5c('0x2'),{'body':_0x2e1b3a,'options':{'where':{'id':_0x28e1a9}},'log':_0x7c5c('0x3')});};exports['addTags']=function(_0xff325e,_0x2b4355){return client[_0x7c5c('0x1')](_0x7c5c('0x4'),{'body':_0x2b4355,'options':{'where':{'id':_0xff325e}},'log':_0x7c5c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 514956c..c4e464e 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 _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 +var _0x7782=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x1a9fb5,_0x20d367){var _0x53c0a2=function(_0x4340ad){while(--_0x4340ad){_0x1a9fb5['push'](_0x1a9fb5['shift']());}};_0x53c0a2(++_0x20d367);}(_0x7782,0xd6));var _0x2778=function(_0x6f7a64,_0x5e4222){_0x6f7a64=_0x6f7a64-0x0;var _0x48225f=_0x7782[_0x6f7a64];return _0x48225f;};'use strict';var client=require(_0x2778('0x0'));exports[_0x2778('0x1')]=function(_0x14fa59){return client[_0x2778('0x2')](_0x2778('0x3'),{'body':_0x14fa59,'log':_0x2778('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 4fecd42..9fbc7ed 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_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 +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x208426,_0x2b1a5c){var _0x4420f4=function(_0xd1661b){while(--_0xd1661b){_0x208426['push'](_0x208426['shift']());}};_0x4420f4(++_0x2b1a5c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xcb91[_0x3b4b1d];return _0x488c36;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 0287b52..b7d4a92 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_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 +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0xedd9,0xfc));var _0x9edd=function(_0x23c628,_0x320062){_0x23c628=_0x23c628-0x0;var _0x2dd978=_0xedd9[_0x23c628];return _0x2dd978;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 8ae1d2b..ec12c85 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(_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 +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x595209,_0x157b5c){var _0x59d27e=function(_0x113101){while(--_0x113101){_0x595209['push'](_0x595209['shift']());}};_0x59d27e(++_0x157b5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 cc49ddd..cc0a50d 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 _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 +var _0xbd0a=['Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','updateWhatsappInteraction','addTags'];(function(_0xbf083d,_0x4a2bf2){var _0x140eab=function(_0x4aa489){while(--_0x4aa489){_0xbf083d['push'](_0xbf083d['shift']());}};_0x140eab(++_0x4a2bf2);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x318e2e,_0x3db0e5){_0x318e2e=_0x318e2e-0x0;var _0x4fdc14=_0xbd0a[_0x318e2e];return _0x4fdc14;};'use strict';var client=require(_0xabd0('0x0'));exports['update']=function(_0x3b0fc0,_0x48c569){return client['Request']('UpdateWhatsappInteraction',{'body':_0x48c569,'options':{'where':{'id':_0x3b0fc0}},'log':_0xabd0('0x1')});};exports[_0xabd0('0x2')]=function(_0x41e52b,_0x3d1138){return client[_0xabd0('0x3')](_0xabd0('0x4'),{'body':_0x3d1138,'options':{'where':{'id':_0x41e52b}},'log':_0xabd0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index fe0f4ba..9fd4fd0 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 _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 +var _0x222f=['Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x24243b,_0x55c567){var _0x1a85ce=function(_0x28c017){while(--_0x28c017){_0x24243b['push'](_0x24243b['shift']());}};_0x1a85ce(++_0x55c567);}(_0x222f,0x1df));var _0xf222=function(_0x1f5e4a,_0x16111e){_0x1f5e4a=_0x1f5e4a-0x0;var _0x380da7=_0x222f[_0x1f5e4a];return _0x380da7;};'use strict';var client=require(_0xf222('0x0'));exports['create']=function(_0x31d867){return client[_0xf222('0x1')](_0xf222('0x2'),{'body':_0x31d867,'log':_0xf222('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 2deb7c3..927eb2c 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 _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 +var _0x8c36=['Agents','name','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy'];(function(_0x2af589,_0x220272){var _0x37c7f7=function(_0x486a3c){while(--_0x486a3c){_0x2af589['push'](_0x2af589['shift']());}};_0x37c7f7(++_0x220272);}(_0x8c36,0xc0));var _0x68c3=function(_0x2ca7dd,_0x21f79d){_0x2ca7dd=_0x2ca7dd-0x0;var _0x23a724=_0x8c36[_0x2ca7dd];return _0x23a724;};'use strict';var client=require(_0x68c3('0x0'));exports[_0x68c3('0x1')]=function(){return function(){return client[_0x68c3('0x2')](_0x68c3('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x68c3('0x4'),_0x68c3('0x5')],'include':[{'model':'User','as':_0x68c3('0x6'),'attributes':['id',_0x68c3('0x7'),'online',_0x68c3('0x8')]}]},'log':_0x68c3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 35f0a0e..2004bf6 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 _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 +var _0x816e=['DESC','../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x308ec2,_0xca47f4){var _0x5b4bf7=function(_0x2eaa36){while(--_0x2eaa36){_0x308ec2['push'](_0x308ec2['shift']());}};_0x5b4bf7(++_0xca47f4);}(_0x816e,0x1c8));var _0xe816=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x816e[_0x247fa1];return _0x244f35;};'use strict';var client=require(_0xe816('0x0'));exports[_0xe816('0x1')]=function(_0x485295){return client[_0xe816('0x2')]('CreateWhatsappQueueReport',{'body':_0x485295,'log':_0xe816('0x3')});};exports[_0xe816('0x4')]=function(_0x3cce17,_0x35a688){return client[_0xe816('0x2')](_0xe816('0x5'),{'body':_0x35a688,'options':{'where':{'uniqueid':_0x3cce17},'order':[['id',_0xe816('0x6')]],'limit':0x1},'log':_0xe816('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 8ac22d5..a05457f 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 _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 +var _0x83f9=['stop','find','agents','timeout','createQueue','channel','format','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','join'];(function(_0x4c5e8b,_0x11b9fa){var _0x3ca42e=function(_0x323316){while(--_0x323316){_0x4c5e8b['push'](_0x4c5e8b['shift']());}};_0x3ca42e(++_0x11b9fa);}(_0x83f9,0x106));var _0x983f=function(_0x5937f1,_0x22132e){_0x5937f1=_0x5937f1-0x0;var _0x1f40b9=_0x83f9[_0x5937f1];return _0x1f40b9;};'use strict';var schema=require(_0x983f('0x0'));var _=require(_0x983f('0x1'));var util=require(_0x983f('0x2'));var seqqueue=require(_0x983f('0x3'));var logger=require('../../../../config/logger')(_0x983f('0x4'));var strategy=require(_0x983f('0x5'));var queue=schema({'name':{'type':_0x983f('0x6'),'required':!![],'message':_0x983f('0x7')},'timeout':{'type':_0x983f('0x8'),'message':_0x983f('0x9')}});function writeLog(_0x45f569,_0x2bb0fd,_0x54df89){return logger[_0x983f('0xa')](util['format'](_0x983f('0xb'),_0x45f569,_0x2bb0fd[_0x983f('0xc')],_0x54df89));}function handleFindAgent(_0x380be5){return function(_0xa5acf4){return _0xa5acf4[_0x983f('0xc')][_0x983f('0xd')]()===_0x380be5[_0x983f('0xd')]();};}exports['consequence']=function(_0x44f894,_0x12ded0,_0x5745ed,_0x213722){return function(_0x5b1675){try{var _0x30176b={'name':_0x12ded0[0x0],'timeout':_0x12ded0[0x1]};var _0x52cdf8=queue[_0x983f('0x0')](_0x30176b,{'typecast':!![]});if(_0x52cdf8['length']){logger[_0x983f('0xe')](_0x983f('0xf'),_0x44f894,_['map'](_0x52cdf8,'message')[_0x983f('0x10')](',\x20'));_0x5b1675[_0x983f('0x11')]();}else{var _0xd3547b=_[_0x983f('0x12')](_0x5745ed[_0x983f('0x13')],handleFindAgent(_0x30176b[_0x983f('0xc')]));if(_0xd3547b){var _0x26a744=(_0x30176b[_0x983f('0x14')]||0xa)*0x3e8;var _0x5a5cb4,_0x560d32;var _0x252a0c=seqqueue[_0x983f('0x15')](_0x26a744);_0x252a0c['id']=_0x44f894;_0x252a0c['atimeout']=_0x26a744;_0x252a0c[_0x983f('0x16')]=_0x213722['channel'];writeLog(_0x44f894,_0xd3547b,util[_0x983f('0x17')](_0x983f('0x18'),_0x26a744));_0x5745ed[_0x983f('0x19')][_0x44f894]['on'](_0x983f('0x1a'),function(){logger[_0x983f('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x44f894);clearTimeout(_0x560d32);_0x560d32=undefined;_0x252a0c[_0x983f('0x1b')]();if(_0x5745ed['rules'][_0x44f894]){delete _0x5745ed[_0x983f('0x19')][_0x44f894];}_0x5b1675[_0x983f('0x11')]();});_0x5745ed[_0x983f('0x19')][_0x44f894]['on'](_0x983f('0x1c'),function(){if(_0x5745ed['rules'][_0x44f894]){delete _0x5745ed['rules'][_0x44f894];}});_0x560d32=setTimeout(function(){logger[_0x983f('0xa')](_0x983f('0x1d'),_0x44f894);clearTimeout(_0x560d32);_0x252a0c['close']();_0x5b1675['next']();},_0x26a744);strategy['agent'](_0x252a0c,_0xd3547b,_0x5745ed,_0x213722);}else{logger['error'](_0x983f('0x1e'),_0x44f894,_0x30176b['name']);_0x5b1675[_0x983f('0x11')]();}}}catch(_0x1da0b0){console['log'](_0x1da0b0);logger[_0x983f('0xe')]('[%s][QUEUE]\x20%s',_0x44f894,_0x1da0b0['stack']);_0x5b1675[_0x983f('0x11')]();}};}; \ 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 3f2ff3a..c75dbab 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 _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 +var _0x9d76=['providerResponse','dialogState','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','Message','create','then','info','body','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','amazonlex'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0x9d76,0x1ce));var _0x69d7=function(_0x1f6563,_0x216261){_0x1f6563=_0x1f6563-0x0;var _0x744817=_0x9d76[_0x1f6563];return _0x744817;};'use strict';var _=require(_0x69d7('0x0'));var moment=require(_0x69d7('0x1'));var AWS=require(_0x69d7('0x2'));var utils=require(_0x69d7('0x3'));var logger=require(_0x69d7('0x4'))(_0x69d7('0x5'));var rpc={'chatMessage':require(_0x69d7('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x69d7('0x7')),'smsMessage':require(_0x69d7('0x8')),'faxMessage':require(_0x69d7('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1a5c8d,_0x5caa1b){return function(_0x5ccbe1){try{if(!_[_0x69d7('0xa')](this[_0x69d7('0xb')][_0x69d7('0xc')])){logger['info'](_0x69d7('0xd'),_0x1a5c8d,_0x69d7('0xe'));return _0x5ccbe1[_0x69d7('0xf')]();}var _0x2383e1={'ContactId':this['contact']['id'],'sentAt':moment()[_0x69d7('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x69d7('0x11')};if(this[_0x69d7('0x12')]==='sms'||this[_0x69d7('0x12')]===_0x69d7('0x13')){_0x2383e1[_0x69d7('0x14')]=this[_0x69d7('0xb')][_0x69d7('0x14')];}var _0xa23cb9=this[_0x69d7('0x12')];if(_0xa23cb9===_0x69d7('0x15')){_0x2383e1[_0x69d7('0x16')]=this['account']['id'];}else{_0x2383e1[_[_0x69d7('0x17')](_0xa23cb9)+_0x69d7('0x18')]=this[_0x69d7('0x19')]['id'];}_0x2383e1[_[_0x69d7('0x17')](_0xa23cb9)+_0x69d7('0x1a')]=this['interaction']['id'];if(this[_0x69d7('0xb')][_0x69d7('0x1b')]){var _0x1fea2d=_0x5caa1b[0x4];if(!_['isEmpty'](_0x1fea2d)){_0x2383e1['body']=utils['getMustacheRender'](_0x1fea2d,this);return rpc[_0xa23cb9+_0x69d7('0x1c')][_0x69d7('0x1d')](_0x2383e1)[_0x69d7('0x1e')](function(_0x94951){logger[_0x69d7('0x1f')](_0x69d7('0xd'),_0x1a5c8d,_0x2383e1[_0x69d7('0x20')]);})[_0x69d7('0x21')](function(_0x2d6041){logger[_0x69d7('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1a5c8d,JSON[_0x69d7('0x23')](_0x2d6041));})[_0x69d7('0x24')](function(){logger[_0x69d7('0x1f')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1a5c8d);_0x5ccbe1[_0x69d7('0x25')]();});}else{logger[_0x69d7('0x1f')](_0x69d7('0x26'),_0x1a5c8d);_0x5ccbe1[_0x69d7('0x25')]();}}else{var _0x42b338=this;var _0x47c8ce=new AWS[(_0x69d7('0x27'))]({'accessKeyId':_0x5caa1b[0x0],'secretAccessKey':_0x5caa1b[0x1],'region':_0x5caa1b[0x2]});var _0x353977={'botAlias':_0x69d7('0x28'),'botName':_0x5caa1b[0x3],'inputText':this[_0x69d7('0x29')][_0x69d7('0x20')],'userId':this[_0x69d7('0x12')]+':'+this['interaction']['id']['toString']()};_0x47c8ce[_0x69d7('0x2a')](_0x353977,function(_0x2cad91,_0x579fe1){if(_0x2cad91){logger[_0x69d7('0x22')](_0x69d7('0xd'),_0x1a5c8d,_0x2cad91[_0x69d7('0x29')]);_0x5ccbe1[_0x69d7('0xf')]();}else if(_0x579fe1&&_0x579fe1[_0x69d7('0x29')]){_0x42b338[_0x69d7('0x20')][_0x69d7('0x2b')]=_0x579fe1;_0x2383e1[_0x69d7('0x20')]=_0x579fe1[_0x69d7('0x29')];_0x2383e1['providerName']=_0x69d7('0x2b');_0x2383e1[_0x69d7('0x2c')]=JSON['stringify'](_0x579fe1);return rpc[_0xa23cb9+_0x69d7('0x1c')][_0x69d7('0x1d')](_0x2383e1)[_0x69d7('0x1e')](function(_0x5e7741){logger[_0x69d7('0x1f')](_0x69d7('0xd'),_0x1a5c8d,_0x2383e1[_0x69d7('0x20')]);if(_0x579fe1[_0x69d7('0x2d')]=='Failed'){_0x5ccbe1['next']();}else{_0x5ccbe1['stop']();}})['catch'](function(_0x3ea026){logger[_0x69d7('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1a5c8d,JSON[_0x69d7('0x23')](_0x3ea026));_0x5ccbe1['next']();});}else{_0x5ccbe1[_0x69d7('0xf')]();}});}}catch(_0x51164a){logger[_0x69d7('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1a5c8d,JSON['stringify'](_0x51164a));_0x5ccbe1['stop']();}};}; \ 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 fd488ec..e15d620 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 _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 +var _0x8042=['stringify','catch','error','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','finally','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','mail','body','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','replace','','headers','All','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','then'];(function(_0x355e93,_0x30fe47){var _0x39c654=function(_0x1740fe){while(--_0x1740fe){_0x355e93['push'](_0x355e93['shift']());}};_0x39c654(++_0x30fe47);}(_0x8042,0x1ed));var _0x2804=function(_0x3ec0dd,_0x3a5e67){_0x3ec0dd=_0x3ec0dd-0x0;var _0x2818c7=_0x8042[_0x3ec0dd];return _0x2818c7;};'use strict';var _=require(_0x2804('0x0'));var moment=require(_0x2804('0x1'));var utils=require('./utils');var logger=require(_0x2804('0x2'))(_0x2804('0x3'));var rpc={'chatMessage':require(_0x2804('0x4')),'openchannelMessage':require(_0x2804('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2804('0x6')),'faxMessage':require(_0x2804('0x7')),'whatsappMessage':require(_0x2804('0x8')),'chatInteraction':require(_0x2804('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x2804('0xa')),'smsInteraction':require(_0x2804('0xb')),'faxInteraction':require(_0x2804('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x2804('0xd'));exports[_0x2804('0xe')]=function(_0x5c5739,_0x5c088a,_0x11cac0,_0x462dcd){return function(_0x1a2a01){try{var _0x34c542=this['channel'];if(_0x34c542===_0x2804('0xf')&&_0x462dcd[_0x2804('0x10')]['isAutoreply']){logger[_0x2804('0x11')](_0x2804('0x12'),_0x5c5739,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x1a2a01[_0x2804('0x13')]();}if(_0x5c088a[0x0]==='1'&&(_[_0x2804('0x14')](this['interaction']['created'])||!this[_0x2804('0x15')][_0x2804('0x16')])){logger['info'](_0x2804('0x12'),_0x5c5739,_0x2804('0x17'));return _0x1a2a01['next']();}if(_0x5c088a[0x0]==='2'&&this[_0x2804('0x15')][_0x2804('0x18')]){logger[_0x2804('0x11')](_0x2804('0x19'),_0x5c5739,_0x2804('0x1a'));return _0x1a2a01[_0x2804('0x13')]();}var _0x2794ea={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2804('0x1b')](_0x2804('0x1c')),'direction':_0x2804('0x1d')};if(this[_0x2804('0x1e')]===_0x2804('0xf')){_0x2794ea['body']=utils[_0x2804('0x1f')](_0x5c088a[0x2],this);}else{_0x2794ea[_0x2804('0x10')]=utils[_0x2804('0x1f')](_0x5c088a[0x1],this);}if(this[_0x2804('0x20')]){_0x2794ea['to']=this[_0x2804('0x20')]['from']||'';if(this['channel']==='mail'&&_0x5c088a[0x1]==='1'){_0x2794ea['cc']=this[_0x2804('0x20')]['cc']||'';}_0x2794ea[_0x2804('0x21')]=this[_0x2804('0x20')]['to']||'';_0x2794ea[_0x2804('0x22')]=this[_0x2804('0x20')][_0x2804('0x22')]||'';_0x2794ea[_0x2804('0x23')]=!![];if(this[_0x2804('0x20')][_0x2804('0x24')]){_0x2794ea[_0x2804('0x24')]='';_0x2794ea[_0x2804('0x24')]+=_[_0x2804('0x25')](this['message'][_0x2804('0x24')],_0x2804('0x26'))?'':'Re:\x20';_0x2794ea['subject']+=this[_0x2804('0x20')][_0x2804('0x24')];}}if(this[_0x2804('0x1e')]===_0x2804('0x27')){_0x2794ea[_0x2804('0x28')]=this[_0x2804('0x29')]['id'];}else{_0x2794ea[_[_0x2804('0x2a')](this[_0x2804('0x1e')])+_0x2804('0x2b')]=this[_0x2804('0x29')]['id'];}_0x2794ea[_[_0x2804('0x2a')](this[_0x2804('0x1e')])+_0x2804('0x2c')]=this[_0x2804('0x15')]['id'];var _0x212380=this[_0x2804('0x15')];if(rpc[this[_0x2804('0x1e')]+_0x2804('0x2d')]){if(this[_0x2804('0x1e')]==='mail'){_0x2794ea[_0x2804('0x2e')]=this[_0x2804('0x20')][_0x2804('0x2f')];_0x2794ea[_0x2804('0x30')]=''+_[_0x2804('0x31')](_0x2794ea[_0x2804('0x10')],_0x2804('0x32'),_0x2804('0x33'))+_0x2804('0x34');_0x2794ea[_0x2804('0x35')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x2804('0x36'),'Precedence':_0x2804('0x37')};return mailRpc[_0x2804('0x38')](this[_0x2804('0x29')]['smtpOptions'],_0x2794ea)['then'](function(_0xa283b2){logger[_0x2804('0x11')](_0x2804('0x39'),_0x5c5739);_0x2794ea[_0x2804('0x2f')]=_0xa283b2[_0x2804('0x20')]['messageId'];return rpc[_0x34c542+_0x2804('0x2d')]['create'](_0x2794ea);})[_0x2804('0x3a')](function(_0x53cfae){logger[_0x2804('0x11')](_0x2804('0x12'),_0x5c5739,JSON[_0x2804('0x3b')](_0x53cfae));})[_0x2804('0x3c')](function(_0x5450d4){logger[_0x2804('0x3d')]('[RPC][%s][AUTOREPLY]\x20%s',_0x5c5739,JSON[_0x2804('0x3b')](_0x5450d4));})['finally'](function(){Promise[_0x2804('0x3e')]()[_0x2804('0x3a')](function(){if(_0x5c088a[0x0]!=='2'||_0x212380[_0x2804('0x18')])return;return rpc[_0x34c542+_0x2804('0x3f')][_0x2804('0x40')](_0x212380['id'],{'autoreplyExecuted':!![]})[_0x2804('0x3a')](function(_0x5026c1){logger['info'](_0x2804('0x19'),_0x5c5739,JSON[_0x2804('0x3b')](_0x5026c1));})[_0x2804('0x3c')](function(_0x16dbab){logger['error'](_0x2804('0x41'),_0x5c5739,JSON['stringify'](_0x16dbab));});})[_0x2804('0x3a')](function(){_0x1a2a01[_0x2804('0x13')]();});});}else{return rpc[this[_0x2804('0x1e')]+_0x2804('0x2d')][_0x2804('0x42')](_0x2794ea)[_0x2804('0x3a')](function(){logger[_0x2804('0x11')](_0x2804('0x12'),_0x5c5739,_0x2794ea['body']);})[_0x2804('0x3c')](function(_0x14b621){logger[_0x2804('0x3d')](_0x2804('0x12'),_0x5c5739,JSON['stringify'](_0x14b621));})[_0x2804('0x43')](function(){Promise['resolve']()[_0x2804('0x3a')](function(){if(_0x5c088a[0x0]!=='2'||_0x212380[_0x2804('0x18')])return;return rpc[_0x34c542+_0x2804('0x3f')][_0x2804('0x40')](_0x212380['id'],{'autoreplyExecuted':!![]})['then'](function(_0x20142d){logger[_0x2804('0x11')](_0x2804('0x19'),_0x5c5739,JSON['stringify'](_0x20142d));})[_0x2804('0x3c')](function(_0x43c93e){logger[_0x2804('0x3d')](_0x2804('0x41'),_0x5c5739,JSON[_0x2804('0x3b')](_0x43c93e));});})[_0x2804('0x3a')](function(){_0x1a2a01[_0x2804('0x13')]();});});}}}catch(_0xa35177){logger[_0x2804('0x3d')](_0x2804('0x12'),_0x5c5739,JSON[_0x2804('0x3b')](_0xa35177));_0x1a2a01[_0x2804('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 1fb1087..09e7ba8 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 _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 +var _0x5574=['Interaction','interaction','then','info','catch','error','[%s][CLOSE]\x20%s','finally','stringify','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','system','channel'];(function(_0x422162,_0x159c4c){var _0x5af2f8=function(_0x46f5ad){while(--_0x46f5ad){_0x422162['push'](_0x422162['shift']());}};_0x5af2f8(++_0x159c4c);}(_0x5574,0xe6));var _0x4557=function(_0x29fdd7,_0x252b01){_0x29fdd7=_0x29fdd7-0x0;var _0x53357a=_0x5574[_0x29fdd7];return _0x53357a;};'use strict';var moment=require(_0x4557('0x0'));var logger=require('../../../../config/logger')(_0x4557('0x1'));var rpc={'chatInteraction':require(_0x4557('0x2')),'openchannelInteraction':require(_0x4557('0x3')),'smsInteraction':require(_0x4557('0x4')),'mailInteraction':require(_0x4557('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4557('0x6'))};exports[_0x4557('0x7')]=function(_0x362251,_0xf6383c,_0x42dcc2,_0x2ab204){return function(_0xf347b6){try{logger['info'](_0x4557('0x8'),_0x362251,_0xf6383c[0x0]);var _0x32fb4f={'closed':0x1,'closedAt':moment()[_0x4557('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x4557('0xa'),'disposition':_0xf6383c[0x0]};if(rpc[_0x2ab204[_0x4557('0xb')]+'Interaction']){rpc[_0x2ab204[_0x4557('0xb')]+_0x4557('0xc')]['update'](_0x2ab204[_0x4557('0xd')]['id'],_0x32fb4f)[_0x4557('0xe')](function(_0x419573){logger[_0x4557('0xf')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x362251,_0x2ab204[_0x4557('0xd')]['id']);})[_0x4557('0x10')](function(_0x18888a){logger[_0x4557('0x11')](_0x4557('0x12'),_0x362251,JSON['stringify'](_0x18888a));})[_0x4557('0x13')](function(){_0xf347b6['stop']();});}}catch(_0x57a93a){logger[_0x4557('0x11')](_0x4557('0x12'),_0x362251,JSON[_0x4557('0x14')](_0x57a93a));_0xf347b6[_0x4557('0x15')]();}};}; \ 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 a88cd8e..f11fff0 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 _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 +var _0xd9c8=['finally','stop','textRequest','message','result','fulfillment','speech','providerName','dialogflow','providerResponse','endConversation','error','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','sms','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify'];(function(_0x20a922,_0x315dd1){var _0x3f9f36=function(_0x302b85){while(--_0x302b85){_0x20a922['push'](_0x20a922['shift']());}};_0x3f9f36(++_0x315dd1);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd9c8[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x8d9c('0x0'));var moment=require(_0x8d9c('0x1'));var apiai=require('apiai-promise');var md5=require(_0x8d9c('0x2'));var utils=require(_0x8d9c('0x3'));var logger=require(_0x8d9c('0x4'))(_0x8d9c('0x5'));var rpc={'chatMessage':require(_0x8d9c('0x6')),'openchannelMessage':require(_0x8d9c('0x7')),'mailMessage':require(_0x8d9c('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x8d9c('0x9')]=function(_0x1ebb5a,_0x475edd){return function(_0x49c96f){try{if(!_[_0x8d9c('0xa')](this[_0x8d9c('0xb')][_0x8d9c('0xc')])){logger[_0x8d9c('0xd')](_0x8d9c('0xe'),_0x1ebb5a,_0x8d9c('0xf'));return _0x49c96f[_0x8d9c('0x10')]();}var _0xaa0a72={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8d9c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8d9c('0x12')};if(this['channel']===_0x8d9c('0x13')||this['channel']==='whatsapp'){_0xaa0a72[_0x8d9c('0x14')]=this['interaction'][_0x8d9c('0x14')];}var _0x416883=this[_0x8d9c('0x15')];if(_0x416883===_0x8d9c('0x16')){_0xaa0a72[_0x8d9c('0x17')]=this[_0x8d9c('0x18')]['id'];}else{_0xaa0a72[_[_0x8d9c('0x19')](_0x416883)+_0x8d9c('0x1a')]=this[_0x8d9c('0x18')]['id'];}_0xaa0a72[_[_0x8d9c('0x19')](_0x416883)+'InteractionId']=this[_0x8d9c('0xb')]['id'];if(this[_0x8d9c('0xb')][_0x8d9c('0x1b')]){var _0x24c036=_0x475edd[0x2];if(!_[_0x8d9c('0x1c')](_0x24c036)){_0xaa0a72[_0x8d9c('0x1d')]=utils[_0x8d9c('0x1e')](_0x24c036,this);return rpc[_0x416883+_0x8d9c('0x1f')][_0x8d9c('0x20')](_0xaa0a72)[_0x8d9c('0x21')](function(_0x48fffd){logger[_0x8d9c('0xd')](_0x8d9c('0xe'),_0x1ebb5a,_0xaa0a72['body']);})[_0x8d9c('0x22')](function(_0x224b53){logger['error'](_0x8d9c('0xe'),_0x1ebb5a,JSON[_0x8d9c('0x23')](_0x224b53));})[_0x8d9c('0x24')](function(){logger[_0x8d9c('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1ebb5a);_0x49c96f[_0x8d9c('0x25')]();});}else{logger[_0x8d9c('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1ebb5a);_0x49c96f['stop']();}}else{var _0x13de89=this;var _0x2d2bf7=apiai(_0x475edd[0x0],{'language':_0x475edd[0x1]||'en'});return _0x2d2bf7[_0x8d9c('0x26')](this[_0x8d9c('0x27')][_0x8d9c('0x1d')],{'sessionId':md5(this[_0x8d9c('0xb')]['id'])})[_0x8d9c('0x21')](function(_0x47ae95){_0x13de89[_0x8d9c('0x1d')]['dialogflow']=_0x47ae95;_0xaa0a72[_0x8d9c('0x1d')]=_0x47ae95[_0x8d9c('0x28')][_0x8d9c('0x29')][_0x8d9c('0x2a')];_0xaa0a72[_0x8d9c('0x2b')]=_0x8d9c('0x2c');_0xaa0a72[_0x8d9c('0x2d')]=JSON['stringify'](_0x47ae95);return rpc[_0x416883+'Message']['create'](_0xaa0a72)['then'](function(_0x5b0230){logger[_0x8d9c('0xd')](_0x8d9c('0xe'),_0x1ebb5a,_0xaa0a72[_0x8d9c('0x1d')]);if(_0x47ae95[_0x8d9c('0x28')]['metadata'][_0x8d9c('0x2e')]){_0x49c96f[_0x8d9c('0x10')]();}else{_0x49c96f['stop']();}})['catch'](function(_0x3f2b44){logger['error'](_0x8d9c('0xe'),_0x1ebb5a,JSON[_0x8d9c('0x23')](_0x3f2b44));_0x49c96f[_0x8d9c('0x10')]();});})['catch'](function(_0x5eaa3e){logger[_0x8d9c('0x2f')](_0x8d9c('0xe'),_0x1ebb5a,_0x5eaa3e[_0x8d9c('0x27')]);_0x49c96f[_0x8d9c('0x10')]();});}}catch(_0xf639a7){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x1ebb5a,JSON[_0x8d9c('0x23')](_0xf639a7));_0x49c96f['stop']();}};}; \ 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 430a962..2b5faca 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 _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 +var _0x4907=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','catch','finally','stop','replace','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','stack','dialogflow','md5','moment','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','out','sms','whatsapp','phone','interaction','channel'];(function(_0x541319,_0x1fcf8e){var _0x985156=function(_0x1cdb6c){while(--_0x1cdb6c){_0x541319['push'](_0x541319['shift']());}};_0x985156(++_0x1fcf8e);}(_0x4907,0xac));var _0x7490=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4907[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var dialogflow=require(_0x7490('0x0'));var md5=require(_0x7490('0x1'));var moment=require(_0x7490('0x2'));var Promise=require('bluebird');var logger=require(_0x7490('0x3'))('routing');var utils=require(_0x7490('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7490('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7490('0x6')),'faxMessage':require(_0x7490('0x7')),'whatsappMessage':require(_0x7490('0x8'))};function createMessage(_0x1230a2,_0x5c860a,_0x7b0d29,_0x154b44){return new Promise(function(_0x4b81b4,_0x4bb848){var _0x1c05c0=_[_0x7490('0x9')](_0x7b0d29);_0x1c05c0['body']=_0x154b44;return rpc[_0x5c860a+_0x7490('0xa')][_0x7490('0xb')](_0x1c05c0)[_0x7490('0xc')](function(){logger[_0x7490('0xd')](_0x7490('0xe'),_0x1230a2,_0x1c05c0[_0x7490('0xf')]);_0x4b81b4();})['catch'](function(_0x41983f){logger[_0x7490('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1230a2,JSON[_0x7490('0x11')](_0x41983f));_0x4bb848(_0x41983f);});});}exports[_0x7490('0x12')]=function(_0x28240b,_0x8d6288){return function(_0x221bf5){try{if(!_[_0x7490('0x13')](this['interaction'][_0x7490('0x14')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x28240b,_0x7490('0x15'));return _0x221bf5[_0x7490('0x16')]();}var _0x18a40e={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7490('0x17')};if(this['channel']===_0x7490('0x18')||this['channel']===_0x7490('0x19')){_0x18a40e[_0x7490('0x1a')]=this[_0x7490('0x1b')]['phone'];}var _0x3dae8b=this[_0x7490('0x1c')];if(_0x3dae8b===_0x7490('0x1d')){_0x18a40e[_0x7490('0x1e')]=this[_0x7490('0x1f')]['id'];}else{_0x18a40e[_[_0x7490('0x20')](_0x3dae8b)+_0x7490('0x21')]=this[_0x7490('0x1f')]['id'];}_0x18a40e[_['upperFirst'](_0x3dae8b)+_0x7490('0x22')]=this[_0x7490('0x1b')]['id'];if(this[_0x7490('0x1b')]['created']){var _0xc40766=_0x8d6288[0x4];if(!_[_0x7490('0x23')](_0xc40766)){_0x18a40e[_0x7490('0xf')]=utils['getMustacheRender'](_0xc40766,this);return rpc[_0x3dae8b+_0x7490('0xa')]['create'](_0x18a40e)['then'](function(_0xe7264c){logger[_0x7490('0xd')](_0x7490('0xe'),_0x28240b,_0x18a40e[_0x7490('0xf')]);})[_0x7490('0x24')](function(_0x1cd71f){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x28240b,JSON[_0x7490('0x11')](_0x1cd71f));})[_0x7490('0x25')](function(){logger[_0x7490('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x28240b);_0x221bf5[_0x7490('0x26')]();});}else{logger[_0x7490('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x28240b);_0x221bf5['stop']();}}else{var _0x1378bf=this;var _0x2b34bb=_0x8d6288[0x2][_0x7490('0x27')](/\\n/g,'\x0a');var _0x2154fc={'credentials':{'private_key':_0x2b34bb,'client_email':_0x8d6288[0x1]}};var _0x5c9a3e=new dialogflow[(_0x7490('0x28'))](_0x2154fc);var _0x1d7822=_0x5c9a3e['sessionPath'](_0x8d6288[0x0],md5(_0x1378bf[_0x7490('0x1b')]['id']));var _0x43ee73={'session':_0x1d7822,'queryInput':{'text':{'text':_0x1378bf[_0x7490('0x29')][_0x7490('0xf')],'languageCode':_0x8d6288[0x3]||'en'}}};return _0x5c9a3e[_0x7490('0x2a')](_0x43ee73)[_0x7490('0xc')](function(_0x13dbbd){if(_0x13dbbd&&_0x13dbbd[_0x7490('0x2b')]){_0x1378bf[_0x7490('0xf')][_0x7490('0x2c')]=_0x13dbbd;var _0x1db624=_0x13dbbd[0x0];var _0x558fe4=_0x1db624[_0x7490('0x2d')]['diagnosticInfo']&&_0x1db624[_0x7490('0x2d')][_0x7490('0x2e')][_0x7490('0x2f')]?_0x1db624['queryResult'][_0x7490('0x2e')]['fields'][_0x7490('0x30')][_0x7490('0x31')]:![];_0x1378bf[_0x7490('0xf')][_0x7490('0x32')]=_0x1db624['queryResult'][_0x7490('0x33')];_0x1378bf[_0x7490('0xf')][_0x7490('0x34')]=_0x1db624[_0x7490('0x2d')]['allRequiredParamsPresent'];_0x1378bf[_0x7490('0xf')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1db624['queryResult'][_0x7490('0x2e')]&&_0x1db624['queryResult']['diagnosticInfo'][_0x7490('0x2f')]?_0x1db624['queryResult'][_0x7490('0x2e')][_0x7490('0x2f')][_0x7490('0x30')][_0x7490('0x31')]:![];_0x1378bf[_0x7490('0xf')]['DIALOGFLOWV2_INTENTNAME']=_0x1db624['queryResult'][_0x7490('0x35')][_0x7490('0x36')];_0x1378bf[_0x7490('0xf')][_0x7490('0x37')]=_0x1db624['queryResult']['intent'][_0x7490('0x38')];_0x1378bf[_0x7490('0xf')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x1db624[_0x7490('0x2d')]['intent'][_0x7490('0x39')];_0x1378bf[_0x7490('0xf')]['DIALOGFLOWV2_LANGUAGECODE']=_0x1db624['queryResult']['languageCode'];_0x1378bf['body'][_0x7490('0x3a')]=_0x1db624[_0x7490('0x2d')][_0x7490('0x3b')];_0x1378bf[_0x7490('0xf')][_0x7490('0x3c')]=_0x1db624['queryResult'][_0x7490('0x3d')];_0x18a40e[_0x7490('0x3e')]='dialogflowV2';_0x18a40e[_0x7490('0x3f')]=JSON[_0x7490('0x11')](_0x13dbbd);var _0x41be14=[];for(var _0x58c3d6=0x0;_0x58c3d6<_0x13dbbd[_0x7490('0x2b')];_0x58c3d6++){var _0x488ee3=_0x13dbbd[_0x58c3d6];if(_0x488ee3&&_0x488ee3[_0x7490('0x2d')]&&_0x488ee3[_0x7490('0x2d')]['fulfillmentText']){_0x41be14[_0x7490('0x40')](createMessage(_0x28240b,_0x3dae8b,_0x18a40e,_0x488ee3['queryResult'][_0x7490('0x41')]));}}return Promise['all'](_0x41be14)['then'](function(){if(_0x558fe4){_0x221bf5[_0x7490('0x16')]();}else{_0x221bf5[_0x7490('0x26')]();}})['catch'](function(_0x51b11e){logger[_0x7490('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x28240b,JSON[_0x7490('0x11')](_0x51b11e));_0x221bf5['next']();});}})[_0x7490('0x24')](function(_0x258e03){logger['error'](_0x7490('0xe'),_0x28240b,_0x258e03['message'],_0x258e03[_0x7490('0x42')]);_0x221bf5[_0x7490('0x16')]();});}}catch(_0x2c6369){logger[_0x7490('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x28240b,JSON[_0x7490('0x11')](_0x2c6369));_0x221bf5[_0x7490('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 8a3bcd0..25dbfbb 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 _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 +var _0xc743=['info','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xc743,0x164));var _0x3c74=function(_0x16dcf7,_0x53d1ee){_0x16dcf7=_0x16dcf7-0x0;var _0x1d4553=_0xc743[_0x16dcf7];return _0x1d4553;};'use strict';var schema=require(_0x3c74('0x0'));var _=require(_0x3c74('0x1'));var htmlToText=require(_0x3c74('0x2'));var utils=require(_0x3c74('0x3'));var logger=require('../../../../config/logger')(_0x3c74('0x4'));var gotoif=schema({'condition':{'type':_0x3c74('0x5'),'required':!![],'message':_0x3c74('0x6')},'priorityTrue':{'type':_0x3c74('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x3c74('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x24c7c7,_0x24a4bc){return function(_0x4c2f29){try{var _0x40689e={'condition':htmlToText[_0x3c74('0x8')](utils[_0x3c74('0x9')](_0x24a4bc[0x0],this),{'wordwrap':![]})[_0x3c74('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x24a4bc[0x1],'priorityFalse':_0x24a4bc[0x2]};var _0x3d5228=gotoif[_0x3c74('0x0')](_0x40689e,{'typecast':!![]});if(_0x3d5228[_0x3c74('0xb')]){logger['error'](_0x3c74('0xc'),_0x24c7c7,_['map'](_0x3d5228,_0x3c74('0xd'))[_0x3c74('0xe')](',\x20'));_0x4c2f29[_0x3c74('0xf')]();}else{try{var _0x37f1fd=eval('('+_0x40689e[_0x3c74('0x10')]+')');var _0x2d5684=_0x37f1fd?_0x40689e[_0x3c74('0x11')]:_0x40689e[_0x3c74('0x12')];logger[_0x3c74('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x24c7c7,_0x40689e[_0x3c74('0x10')],_0x37f1fd,_0x2d5684||_0x3c74('0x14'));if(_0x2d5684){var _0x1e147d=_[_0x3c74('0x15')](_0x4c2f29['rules'](),{'p':_0x2d5684});if(_0x1e147d>=0x0){logger[_0x3c74('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x24c7c7,_0x2d5684||'next',_0x1e147d);_0x4c2f29[_0x3c74('0x14')](_0x1e147d);}else{logger[_0x3c74('0x13')](_0x3c74('0x16'),_0x24c7c7,_0x2d5684||_0x3c74('0x14'));_0x4c2f29[_0x3c74('0xf')]();}}else{_0x4c2f29[_0x3c74('0x14')]();}}catch(_0x4b915b){logger[_0x3c74('0x17')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x24c7c7,_0x4b915b['message']);_0x4c2f29[_0x3c74('0xf')]();}}}catch(_0xe394a){logger[_0x3c74('0x17')](_0x3c74('0xc'),_0x24c7c7,JSON[_0x3c74('0x18')](_0xe394a));_0x4c2f29[_0x3c74('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 8c77adb..6b7d779 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 _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 +var _0x7fb2=['stop','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x55559b,_0x58cc43){var _0x171100=function(_0x800903){while(--_0x800903){_0x55559b['push'](_0x55559b['shift']());}};_0x171100(++_0x58cc43);}(_0x7fb2,0x1a4));var _0x27fb=function(_0x51951e,_0x3efd3f){_0x51951e=_0x51951e-0x0;var _0x52c26d=_0x7fb2[_0x51951e];return _0x52c26d;};'use strict';var schema=require('validate');var _=require(_0x27fb('0x0'));var logger=require(_0x27fb('0x1'))(_0x27fb('0x2'));var gotop=schema({'priority':{'type':_0x27fb('0x3'),'required':!![],'message':_0x27fb('0x4')}});exports['consequence']=function(_0x188cd5,_0x2073f1){return function(_0x4e8f6c){try{var _0x5d5fc0={'priority':_0x2073f1[0x0]};var _0x455f67=gotop[_0x27fb('0x5')](_0x5d5fc0,{'typecast':!![]});if(_0x455f67[_0x27fb('0x6')]){logger[_0x27fb('0x7')](_0x27fb('0x8'),_0x188cd5,_[_0x27fb('0x9')](_0x455f67,_0x27fb('0xa'))[_0x27fb('0xb')](',\x20'));_0x4e8f6c['stop']();}else{logger[_0x27fb('0xc')](_0x27fb('0xd'),_0x188cd5,_0x5d5fc0['priority']);if(_0x5d5fc0[_0x27fb('0xe')]){var _0x5085cc=_[_0x27fb('0xf')](_0x4e8f6c[_0x27fb('0x10')](),{'p':_0x5d5fc0[_0x27fb('0xe')]});if(_0x5085cc>=0x0){logger['info'](_0x27fb('0x11'),_0x188cd5,_0x5d5fc0[_0x27fb('0xe')]||_0x27fb('0x12'),_0x5085cc);_0x4e8f6c[_0x27fb('0x12')](_0x5085cc);}else{logger[_0x27fb('0xc')](_0x27fb('0x13'),_0x188cd5,_0x5d5fc0[_0x27fb('0xe')]||_0x27fb('0x12'));_0x4e8f6c[_0x27fb('0x14')]();}}else{_0x4e8f6c['next']();}}}catch(_0x2ddd11){logger[_0x27fb('0x7')]('[%s][GOTOP]\x20%s',_0x188cd5,JSON[_0x27fb('0x15')](_0x2ddd11));_0x4e8f6c[_0x27fb('0x14')]();}};}; \ 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 acde5c5..9cd0b07 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 _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 +var _0xeae6=['interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','chat','account','upperFirst'];(function(_0x25c762,_0xc0156b){var _0x48e0af=function(_0x5038ec){while(--_0x5038ec){_0x25c762['push'](_0x25c762['shift']());}};_0x48e0af(++_0xc0156b);}(_0xeae6,0xc3));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6eae('0x0'));var utils=require(_0x6eae('0x1'));var logger=require(_0x6eae('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6eae('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6eae('0x4')),'faxMessage':require(_0x6eae('0x5')),'whatsappMessage':require(_0x6eae('0x6'))};exports[_0x6eae('0x7')]=function(_0x3e0903,_0x134c6a){return function(_0x19d1e9){try{var _0x778b34={'body':utils['getMustacheRender'](_0x134c6a[0x0],this),'ContactId':this['contact']['id']};if(this[_0x6eae('0x8')]===_0x6eae('0x9')){_0x778b34['ChatWebsiteId']=this[_0x6eae('0xa')]['id'];}else{_0x778b34[_[_0x6eae('0xb')](this['channel'])+'AccountId']=this[_0x6eae('0xa')]['id'];}_0x778b34[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x6eae('0xc')]['id'];if(rpc[this[_0x6eae('0x8')]+'Message']){return rpc[this[_0x6eae('0x8')]+_0x6eae('0xd')][_0x6eae('0xe')](_0x778b34)[_0x6eae('0xf')](function(_0x118bc0){logger[_0x6eae('0x10')](_0x6eae('0x11'),_0x3e0903,_0x778b34['body']);_0x19d1e9[_0x6eae('0x12')]();})[_0x6eae('0x13')](function(_0x147b90){logger[_0x6eae('0x14')](_0x6eae('0x11'),_0x3e0903,JSON[_0x6eae('0x15')](_0x147b90));_0x19d1e9[_0x6eae('0x16')]();});}}catch(_0x350393){logger[_0x6eae('0x14')](_0x6eae('0x11'),_0x3e0903,JSON[_0x6eae('0x15')](_0x350393));_0x19d1e9[_0x6eae('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 390b1e8..cfe74fc 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 _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 +var _0xd668=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','./utils'];(function(_0x4d8c9a,_0x163fdc){var _0x16c561=function(_0x3464d2){while(--_0x3464d2){_0x4d8c9a['push'](_0x4d8c9a['shift']());}};_0x16c561(++_0x163fdc);}(_0xd668,0x15e));var _0x8d66=function(_0x563025,_0x354482){_0x563025=_0x563025-0x0;var _0x564c94=_0xd668[_0x563025];return _0x564c94;};'use strict';var utils=require(_0x8d66('0x0'));var logger=require(_0x8d66('0x1'))(_0x8d66('0x2'));exports[_0x8d66('0x3')]=function(_0x5a6fc2,_0x4db4f7){return function(_0x385f7e){try{logger[_0x8d66('0x4')](_0x8d66('0x5'),_0x5a6fc2,utils[_0x8d66('0x6')](_0x4db4f7[0x0],this));_0x385f7e[_0x8d66('0x7')]();}catch(_0xfc5c9c){logger[_0x8d66('0x8')](_0x8d66('0x5'),_0x5a6fc2,JSON['stringify'](_0xfc5c9c));_0x385f7e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 6ad2784..6ce36ea 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 _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 +var _0x0e01=['../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','next','strategy','rrmemory','beepall','stack','validate','seq-queue','moment','ioredis','routing','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x63394b,_0x257d25){var _0x5a9e5b=function(_0x7cf872){while(--_0x7cf872){_0x63394b['push'](_0x63394b['shift']());}};_0x5a9e5b(++_0x257d25);}(_0x0e01,0x87));var _0x10e0=function(_0x39ef69,_0x43a3dd){_0x39ef69=_0x39ef69-0x0;var _0x48fd17=_0x0e01[_0x39ef69];return _0x48fd17;};'use strict';var schema=require(_0x10e0('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x10e0('0x1'));var moment=require(_0x10e0('0x2'));var Redis=require(_0x10e0('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x10e0('0x4'));var strategy=require('./strategy');config['redis']=_[_0x10e0('0x5')](config['redis'],{'host':_0x10e0('0x6'),'port':0x18eb});var io=require(_0x10e0('0x7'))(new Redis(config['redis']));var attributes=['id',_0x10e0('0x8'),_0x10e0('0x9'),_0x10e0('0xa'),'from',_0x10e0('0xb')];function emit(_0x5e4ea2,_0x55c2fc,_0x328910){io['to'](_0x5e4ea2)[_0x10e0('0xc')](_0x55c2fc,_0x328910);}function emitChannelQueueInteraction(_0x23d5e8,_0x494ecc,_0x304d5d,_0x3db643,_0x72a88e,_0x2d0236,_0x301c50,_0x471cdd){var _0x3c9ff4=_[_0x10e0('0xd')](_0x304d5d);_0x3c9ff4[_0x10e0('0x8')]=_0x471cdd;_0x3c9ff4[_0x10e0('0xa')]=_0x494ecc;_0x3c9ff4[_0x10e0('0x9')]=_0x3db643;_0x3c9ff4['id']=_0x72a88e;if(_0x2d0236){attributes[_0x10e0('0xe')](_['capitalize'](_0x23d5e8)+_0x10e0('0xf'));_0x301c50[util[_0x10e0('0x10')](_0x10e0('0x11'),_0x23d5e8)][_0x72a88e]=_[_0x10e0('0x12')](_0x3c9ff4,attributes);}else{delete _0x301c50[util[_0x10e0('0x10')]('%sQueuesWaitingInteractions',_0x23d5e8)][_0x72a88e];}emit(util[_0x10e0('0x10')](_0x10e0('0x13'),_0x23d5e8,_0x494ecc),util['format'](_0x10e0('0x14'),_0x23d5e8,_0x2d0236?_0x10e0('0x15'):_0x10e0('0x16')),_[_0x10e0('0x12')](_0x3c9ff4,attributes));}var rpc={'openchannelQueueReport':require(_0x10e0('0x17')),'mailQueueReport':require(_0x10e0('0x18')),'chatQueueReport':require(_0x10e0('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x10e0('0x1a')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x10e0('0x1b')),'mailInteraction':require(_0x10e0('0x1c')),'openchannelInteraction':require(_0x10e0('0x1d')),'smsInteraction':require(_0x10e0('0x1e')),'whatsappInteraction':require(_0x10e0('0x1f'))};var queue=schema({'name':{'type':_0x10e0('0x20'),'required':!![],'message':_0x10e0('0x21')},'timeout':{'type':_0x10e0('0x22'),'message':_0x10e0('0x23')}});function startRouting(_0x4daaf8,_0x3d87cd,_0x5b7779,_0x43396f){if(_0x4daaf8&&_0x3d87cd&&_0x5b7779){_0x3d87cd[_0x10e0('0x24')]+=0x1;var _0x422cb6={'uniqueid':_0x4daaf8,'from':_0x5b7779['body']?_0x5b7779[_0x10e0('0x25')][_0x10e0('0x26')]:'','joinAt':moment()[_0x10e0('0x10')](_0x10e0('0x27')),'ContactId':_0x5b7779[_0x10e0('0x28')]?_0x5b7779[_0x10e0('0x28')]['id']:null,'ListId':_0x5b7779['list']?_0x5b7779['list']['id']:null};_0x422cb6[_[_0x10e0('0x29')](_0x5b7779['channel'])+_0x10e0('0x2a')]=_0x3d87cd['id']||null;_0x422cb6[_[_0x10e0('0x29')](_0x5b7779['channel'])+_0x10e0('0xf')]=_0x5b7779[_0x10e0('0x2b')]?_0x5b7779[_0x10e0('0x2b')]['id']:null;_0x422cb6[_['upperFirst'](_0x5b7779[_0x10e0('0x2c')])+_0x10e0('0x2d')]=_0x5b7779[_0x10e0('0x2e')]?_0x5b7779['message']['id']:null;_0x422cb6[_[_0x10e0('0x29')](_0x5b7779[_0x10e0('0x2c')])+(_0x5b7779[_0x10e0('0x2c')]!==_0x10e0('0x2f')?_0x10e0('0x30'):_0x10e0('0x31'))]=_0x5b7779[_0x10e0('0x9')]?_0x5b7779[_0x10e0('0x9')]['id']:null;logger[_0x10e0('0x32')](util[_0x10e0('0x10')](_0x10e0('0x33'),_0x4daaf8,_0x3d87cd[_0x10e0('0x34')]));emitChannelQueueInteraction(_0x5b7779[_0x10e0('0x2c')],_0x3d87cd['name'],_0x422cb6,_0x5b7779[_0x10e0('0x9')][_0x10e0('0x34')],_0x5b7779[_0x10e0('0x2e')]['id'],!![],_0x43396f,_0x3d87cd['id']);if(rpc[_0x5b7779[_0x10e0('0x2c')]+'QueueReport']){return rpc[_0x5b7779[_0x10e0('0x2c')]+_0x10e0('0x35')]['create'](_0x422cb6)[_0x10e0('0x36')](function(_0x41f17d){logger['error'](_0x10e0('0x37'),_0x41f17d);});}}}function stopRouting(_0x525fcd,_0xb69e11,_0x279084,_0x547090){if(_0x525fcd&&_0xb69e11){_0xb69e11['waiting']-=0x1;var _0x5878a3={'leaveAt':moment()[_0x10e0('0x10')](_0x10e0('0x27')),'acceptAt':moment()[_0x10e0('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x10e0('0x38')};logger[_0x10e0('0x32')](util[_0x10e0('0x10')](_0x10e0('0x39'),_0x525fcd,_0xb69e11['name']));emitChannelQueueInteraction(_0x279084['channel'],_0xb69e11[_0x10e0('0x34')],_0x279084[_0x10e0('0x25')],_0x279084['account'][_0x10e0('0x34')],_0x279084[_0x10e0('0x2e')]['id'],![],_0x547090,_0xb69e11['id']);return rpc[_0x279084[_0x10e0('0x2c')]+_0x10e0('0x3a')][_0x10e0('0x3b')](_0x279084['interaction']['id'],{'queueId':_0xb69e11['id']})[_0x10e0('0x3c')](function(){if(rpc[_0x279084[_0x10e0('0x2c')]+_0x10e0('0x35')]){return rpc[_0x279084['channel']+_0x10e0('0x35')][_0x10e0('0x3b')](_0x525fcd,_0x5878a3)[_0x10e0('0x36')](function(_0x1d0556){logger[_0x10e0('0x3d')](_0x10e0('0x3e'),_0x1d0556);});}});}}function endRouting(_0x3ce0e4,_0x1429bc,_0x1e95ed,_0x5198b5){if(_0x3ce0e4&&_0x1429bc){_0x1429bc[_0x10e0('0x24')]-=0x1;var _0x3cb5a5={'leaveAt':moment()[_0x10e0('0x10')](_0x10e0('0x27')),'exitAt':moment()[_0x10e0('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x10e0('0x32')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x3ce0e4,_0x1429bc[_0x10e0('0x34')]));emitChannelQueueInteraction(_0x1e95ed[_0x10e0('0x2c')],_0x1429bc['name'],_0x1e95ed[_0x10e0('0x25')],_0x1e95ed['account'][_0x10e0('0x34')],_0x1e95ed[_0x10e0('0x2e')]['id'],![],_0x5198b5);if(rpc[_0x1e95ed[_0x10e0('0x2c')]+_0x10e0('0x35')]){return rpc[_0x1e95ed[_0x10e0('0x2c')]+_0x10e0('0x35')][_0x10e0('0x3b')](_0x3ce0e4,_0x3cb5a5)[_0x10e0('0x36')](function(_0xa55745){logger[_0x10e0('0x3d')](_0x10e0('0x3e'),_0xa55745);});}}}function handleFindQueue(_0x326cbe){return function(_0x5e3860){return _0x5e3860[_0x10e0('0x34')][_0x10e0('0x3f')]()===_0x326cbe[_0x10e0('0x3f')]();};}exports['consequence']=function(_0x163323,_0x3ce65b,_0x4e228a,_0x4931cc){return function(_0x464448){try{var _0x13d56d={'name':_0x3ce65b[0x0],'timeout':_0x3ce65b[0x1]};var _0x39faa0=queue[_0x10e0('0x0')](_0x13d56d,{'typecast':!![]});if(_0x39faa0[_0x10e0('0x40')]){logger[_0x10e0('0x3d')](_0x10e0('0x41'),_0x163323,_[_0x10e0('0x42')](_0x39faa0,_0x10e0('0x2e'))[_0x10e0('0x43')](',\x20'));_0x464448['stop']();}else{var _0x3cde37=_[_0x10e0('0x44')](_0x4e228a[_0x4931cc[_0x10e0('0x2c')]+'Queues'],handleFindQueue(_0x13d56d[_0x10e0('0x34')]));if(_0x3cde37){startRouting(_0x163323,_0x3cde37,_0x4931cc,_0x4e228a);var _0x6305a2=(_0x3cde37[_0x10e0('0x45')]||0xa)*0x3e8;var _0x2eb0ed=(_0x13d56d[_0x10e0('0x45')]||0x14)*0x3e8;var _0x1052f3;if(_0x6305a2>_0x2eb0ed){_0x2eb0ed=_0x6305a2;}var _0xf81cd6=seqqueue[_0x10e0('0x46')](_0x6305a2);_0xf81cd6['id']=_0x163323;_0xf81cd6[_0x10e0('0x47')]=_0x6305a2;_0xf81cd6[_0x10e0('0x48')]=_0x2eb0ed;_0xf81cd6[_0x10e0('0x2c')]=_0x4931cc[_0x10e0('0x2c')];_0x4e228a[_0x10e0('0x49')][_0x163323]['on'](_0x10e0('0x4a'),function(){logger[_0x10e0('0x32')](_0x10e0('0x4b'),_0x163323);stopRouting(_0x163323,_0x3cde37,_0x4931cc,_0x4e228a);clearTimeout(_0x1052f3);_0x1052f3=undefined;_0xf81cd6[_0x10e0('0x4c')](!![]);if(_0x4e228a[_0x10e0('0x49')][_0x163323]){delete _0x4e228a['rules'][_0x163323];}_0x464448[_0x10e0('0x4d')]();});_0x4e228a[_0x10e0('0x49')][_0x163323]['on']('complete',function(){if(_0x4e228a[_0x10e0('0x49')][_0x163323]){delete _0x4e228a[_0x10e0('0x49')][_0x163323];}});_0x1052f3=setTimeout(function(){logger[_0x10e0('0x32')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x163323);endRouting(_0x163323,_0x3cde37,_0x4931cc,_0x4e228a);clearTimeout(_0x1052f3);_0xf81cd6[_0x10e0('0x4c')](!![]);_0x464448[_0x10e0('0x4e')]();},_0x2eb0ed);switch(_0x3cde37[_0x10e0('0x4f')]){case _0x10e0('0x50'):strategy[_0x10e0('0x50')](_0xf81cd6,_0x3cde37,_0x4e228a,_0x4931cc);break;default:strategy[_0x10e0('0x51')](_0xf81cd6,_0x3cde37,_0x4e228a,_0x4931cc);}}else{logger[_0x10e0('0x3d')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x163323,_0x13d56d[_0x10e0('0x34')]);_0x464448[_0x10e0('0x4d')]();}}}catch(_0x293d5a){logger[_0x10e0('0x3d')](_0x10e0('0x41'),_0x163323,_0x293d5a[_0x10e0('0x52')]);_0x464448[_0x10e0('0x4d')]();}};}; \ 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 8d1d45a..c30a75f 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 _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 +var _0xd0bb=['RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','push','bind','handleTimeout','timeout','drained','prototype','handleRun','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xfc53fc,_0x4204d6){_0xfc53fc=_0xfc53fc-0x0;var _0x423828=_0xd0bb[_0xfc53fc];return _0x423828;};'use strict';var _=require(_0xbd0b('0x0'));var uuid=require(_0xbd0b('0x1'));var util=require(_0xbd0b('0x2'));var logger=require('../../../../../config/logger')(_0xbd0b('0x3'));var Agent=function(_0x4ab08f,_0x39b03a,_0x1f6ec3,_0x53e6ce){this[_0xbd0b('0x4')]=uuid['v4']();this['squeue']=_0x4ab08f;this[_0xbd0b('0x5')]=_0x39b03a;this[_0xbd0b('0x6')]=_0x1f6ec3;this[_0xbd0b('0x3')]=_0x53e6ce;this[_0xbd0b('0x7')][_0xbd0b('0x8')](this['handleRun'][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xb'),this['handleTimeout']['bind'](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xc'),this['handleDrained'][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')]['push']=function(){this[_0xbd0b('0x7')][_0xbd0b('0x8')](this[_0xbd0b('0xe')][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')][_0xbd0b('0xf')]=function(){this[_0xbd0b('0xa')](!![]);};Agent[_0xbd0b('0xd')][_0xbd0b('0xe')]=function(){logger['debug'](_0xbd0b('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']])){logger[_0xbd0b('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xbd0b('0x5')]['id']);setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}else{if(this[_0xbd0b('0x3')][_0xbd0b('0x14')]||util[_0xbd0b('0x15')](this['squeue']['id'],this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']],this[_0xbd0b('0x7')][_0xbd0b('0x16')],![])){this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=!![];this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']]['busyQueue']=undefined;util[_0xbd0b('0x18')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x19')](this['notificationId'],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],null,this[_0xbd0b('0x3')]);util[_0xbd0b('0x1a')](this['squeue']['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xbd0b('0x1b')+(this[_0xbd0b('0x3')][_0xbd0b('0x14')]?':FORCED':''));}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1c'),this[_0xbd0b('0x7')]['id'],this['agent']['id']);setTimeout(this['push'][_0xbd0b('0x9')](this),0x3e8);}}};Agent[_0xbd0b('0xd')][_0xbd0b('0xa')]=function(_0xf4ba04){if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']])){return logger[_0xbd0b('0x13')](_0xbd0b('0x1d'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1e'),this['squeue']['id'],this[_0xbd0b('0x5')]['id']);util[_0xbd0b('0x1f')](this[_0xbd0b('0x4')],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']],null,this[_0xbd0b('0x3')]);this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=![];this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x20')]=undefined;util[_0xbd0b('0x21')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x1a')](this[_0xbd0b('0x7')]['id'],this['realtime'][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xf4ba04?_0xbd0b('0x22'):_0xbd0b('0x23'));}if(!_0xf4ba04){setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}};function agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098){return new Agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098);}module[_0xbd0b('0x24')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index d3da8c8..a762aa4 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 _0x26e5=['isNil','Agents','length','realtime','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','saveWaitingNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype'];(function(_0x563749,_0x9a5ef9){var _0xe482b0=function(_0x36c2c1){while(--_0x36c2c1){_0x563749['push'](_0x563749['shift']());}};_0xe482b0(++_0x9a5ef9);}(_0x26e5,0x188));var _0x526e=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x26e5[_0x2c9b79];return _0x265032;};'use strict';var _=require(_0x526e('0x0'));var uuid=require(_0x526e('0x1'));var util=require(_0x526e('0x2'));var logger=require(_0x526e('0x3'))('routing');var Beepall=function(_0x2171df,_0x15f801,_0x111631,_0x1a44e2){this[_0x526e('0x4')]=uuid['v4']();this[_0x526e('0x5')]=_0x2171df;this[_0x526e('0x6')]=_0x15f801;this['realtime']=_0x111631;this[_0x526e('0x7')]=_0x1a44e2;this[_0x526e('0x5')][_0x526e('0x8')](this[_0x526e('0x9')][_0x526e('0xa')](this),this[_0x526e('0xb')]['bind'](this));this[_0x526e('0x5')]['on'](_0x526e('0xc'),this[_0x526e('0xb')][_0x526e('0xa')](this));this[_0x526e('0x5')]['on'](_0x526e('0xd'),this[_0x526e('0xe')]['bind'](this));};Beepall[_0x526e('0xf')][_0x526e('0x8')]=function(){this['squeue'][_0x526e('0x8')](this[_0x526e('0x9')]['bind'](this),this['handleTimeout']['bind'](this));};Beepall[_0x526e('0xf')][_0x526e('0xe')]=function(){this[_0x526e('0xb')](!![]);};Beepall[_0x526e('0xf')][_0x526e('0x9')]=function(){var _0x454dd6=!![];if(!_[_0x526e('0x10')](this[_0x526e('0x6')])&&!_[_0x526e('0x10')](this[_0x526e('0x6')][_0x526e('0x11')])&&this[_0x526e('0x6')]['Agents'][_0x526e('0x12')]>0x0){for(var _0x187b7d=0x0,_0x57b855;_0x187b7d0x0){for(var _0x3c117f=0x0,_0x500c5d;_0x3c117f0x0&&_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 +var _0x8375=['debug','isAgentAvailable','busy','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','hideNotification','checkWaitingNotifications','interaction','some','channel','InteractionId','WaitingInteractions','saveWaitingNotification','agents','removeWaitingNotification','writeLog','lodash','util','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','format','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save'];(function(_0x983e07,_0x13cb78){var _0x5376c5=function(_0x3e3c0e){while(--_0x3e3c0e){_0x983e07['push'](_0x983e07['shift']());}};_0x5376c5(++_0x13cb78);}(_0x8375,0xa8));var _0x5837=function(_0x5bd1aa,_0x137741){_0x5bd1aa=_0x5bd1aa-0x0;var _0x1e4db5=_0x8375[_0x5bd1aa];return _0x1e4db5;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var utils=require(_0x5837('0x2'));var Redis=require('ioredis');var config=require(_0x5837('0x3'));var logger=require(_0x5837('0x4'))(_0x5837('0x5'));config[_0x5837('0x6')]=_[_0x5837('0x7')](config[_0x5837('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5837('0x8'))(new Redis(config[_0x5837('0x6')]));function sendNotification(_0x365da3,_0x2e383c,_0x3b11c3,_0x5bc421,_0x508caf,_0x1e44c4){io['to'](util[_0x5837('0x9')]('user:%s',_0x5bc421[_0x5837('0xa')]))['emit'](_0x5837('0xb'),_0x5bc421);var _0x383e5e=_0x1e44c4||{};var _0x11cd29=_0x3b11c3[_0x5837('0xc')]('.');var _0x5585ff={'uniqueid':_0x2e383c,'channel':_0x11cd29[0x0],'id':_0x11cd29[0x1],'title':_0x11cd29[0x0]+_0x5837('0xd'),'interactionId':_0x11cd29[0x2],'queue':_0x508caf?_0x508caf['name']:null,'sound':_0x383e5e[_0x5837('0xe')][_0x5837('0xf')],'shake':_0x383e5e[_0x5837('0xe')][_0x5837('0x10')]};try{if(!_0x383e5e[_0x5837('0x11')]){_0x383e5e['body']={};}if(_0x508caf){_0x383e5e['body']['queue']=_0x508caf;}else if(_0x383e5e[_0x5837('0x11')][_0x5837('0x12')]){delete _0x383e5e[_0x5837('0x11')][_0x5837('0x12')];}_0x5585ff[_0x5837('0x13')]=utils[_0x5837('0x14')](_0x383e5e[_0x5837('0xe')][_0x5837('0x15')],_0x383e5e);}catch(_0x10d882){_0x5585ff['msg']=_0x5837('0x16');logger[_0x5837('0x17')](util['format'](_0x5837('0x18'),_0x2e383c,_0x10d882[_0x5837('0x19')]));}io['to'](util[_0x5837('0x9')]('user:%s',_0x5bc421['name']))['emit'](util[_0x5837('0x9')](_0x5837('0x1a'),_0x365da3?_0x5837('0x1b'):'remove'),_0x5585ff);}function writeLog(_0x3a3f13,_0x178c4c,_0x316d43){return logger[_0x5837('0x1c')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x3a3f13,_0x178c4c['name'],_0x316d43));}exports[_0x5837('0x1d')]=function(_0x5475c3,_0x275cb6,_0x2bd103,_0x32733a){if(_0x275cb6[_0x5837('0x1e')]){writeLog(_0x5475c3,_0x275cb6,'BUSY');return![];}if(!_0x275cb6['online']){writeLog(_0x5475c3,_0x275cb6,_0x5837('0x1f'));return![];}if(_0x275cb6[_0x2bd103+_0x5837('0x20')]){writeLog(_0x5475c3,_0x275cb6,_0x5837('0x21'));return![];}if(_0x32733a&&_0x275cb6['hasOwnProperty'](_0x2bd103+_0x5837('0x22'))&&_0x275cb6[_0x5837('0x23')](_0x2bd103+_0x5837('0x24'))){if(_0x275cb6[_0x2bd103+'Capacity']>0x0&&_0x275cb6[_0x2bd103+_0x5837('0x24')]>=_0x275cb6[_0x2bd103+_0x5837('0x22')]){writeLog(_0x5475c3,_0x275cb6,_0x2bd103[_0x5837('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x1d545c,_0x15655e,_0x23a4e3,_0x2ae6a0,_0x2d5c00){return sendNotification(!![],_0x1d545c,_0x15655e,_0x23a4e3,_0x2ae6a0,_0x2d5c00);};exports[_0x5837('0x26')]=function(_0x2baf9b,_0x2ee271,_0x492603,_0x2f0c8d,_0x13830f){return sendNotification(![],_0x2baf9b,_0x2ee271,_0x492603,_0x2f0c8d,_0x13830f);};exports[_0x5837('0x27')]=function(_0x3918ee,_0x1c9f32,_0x228f1){var _0x1761c1=_0x1c9f32[_0x5837('0x28')]['UserId'];if(!_0x1761c1&&_0x228f1){_0x1761c1=_0x228f1['id'];}var _0x4f7502=_[_0x5837('0x29')](_0x3918ee[_0x1c9f32[_0x5837('0x2a')]+'QueuesWaitingInteractions'],function(_0x298ea1){var _0x6ea409=_['capitalize'](_0x1c9f32[_0x5837('0x2a')])+_0x5837('0x2b');return _0x298ea1[_0x6ea409]===_0x1c9f32[_0x5837('0x28')]['id'];});if(!_0x4f7502&&_0x1761c1&&_0x3918ee['agents'][_0x1761c1]){_0x4f7502=_['some'](_0x3918ee['agents'][_0x1761c1][_0x1c9f32[_0x5837('0x2a')]+_0x5837('0x2c')],function(_0x200ec7){return _0x200ec7['id']===_0x1c9f32[_0x5837('0x28')]['id'];});}return _0x4f7502;};exports[_0x5837('0x2d')]=function(_0x4d2a08,_0x4bf885,_0x157107,_0x3bb513){if(_0x157107&&_0x157107['id']&&_0x4d2a08['agents']&&_0x4d2a08['agents'][_0x157107['id']]){_0x4d2a08[_0x5837('0x2e')][_0x157107['id']][_0x3bb513+'WaitingInteractions'][_0x4bf885['message']['id']]={'id':_0x4bf885[_0x5837('0x28')]['id']};}};exports[_0x5837('0x2f')]=function(_0x50dd31,_0x704f13,_0x323981,_0x2c8321){if(_0x323981&&_0x323981['id']&&_0x50dd31['agents']&&_0x50dd31[_0x5837('0x2e')][_0x323981['id']]){delete _0x50dd31[_0x5837('0x2e')][_0x323981['id']][_0x2c8321+_0x5837('0x2c')][_0x704f13[_0x5837('0x19')]['id']];}};exports[_0x5837('0x30')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 3b00e7b..34ad4c5 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 _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 +var _0xbe9a=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message'];(function(_0xcc2ec6,_0x2edc8e){var _0x4e8d8d=function(_0x4e5967){while(--_0x4e5967){_0xcc2ec6['push'](_0xcc2ec6['shift']());}};_0x4e8d8d(++_0x2edc8e);}(_0xbe9a,0x1a4));var _0xabe9=function(_0x13f853,_0x414bb2){_0x13f853=_0x13f853-0x0;var _0x2003ca=_0xbe9a[_0x13f853];return _0x2003ca;};'use strict';var schema=require(_0xabe9('0x0'));var sh=require('shelljs');var _=require(_0xabe9('0x1'));var utils=require(_0xabe9('0x2'));var logger=require(_0xabe9('0x3'))('routing');var system=schema({'command':{'type':_0xabe9('0x4'),'required':!![],'message':_0xabe9('0x5')}});exports[_0xabe9('0x6')]=function(_0x2dcb9d,_0x4bbaff){return function(_0x238c65){try{var _0x40b9aa={'command':_0x4bbaff[0x0]};var _0x1ee7e0=system[_0xabe9('0x0')](_0x40b9aa,{'typecast':!![]});if(_0x1ee7e0[_0xabe9('0x7')]){logger[_0xabe9('0x8')](_0xabe9('0x9'),_0x2dcb9d,_[_0xabe9('0xa')](_0x1ee7e0,_0xabe9('0xb'))['join'](',\x20'));logger[_0xabe9('0xc')](_0xabe9('0xd'),_0x2dcb9d);_0x238c65[_0xabe9('0xe')]();}else{var _0x1746f7=this;var _0x3dff04=utils[_0xabe9('0xf')](_0x4bbaff[0x0],this);logger[_0xabe9('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2dcb9d,_0x3dff04);sh[_0xabe9('0x10')](_[_0xabe9('0x11')](_0x3dff04),function(_0x5168fd,_0x3c4e89){logger[_0xabe9('0xc')](_0xabe9('0x12'),_0x2dcb9d,_0x5168fd);if(_0x5168fd==0x0){var _0x17858c=_0x3c4e89[_0xabe9('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x4bbaff[0x1])||_[_0xabe9('0x14')](_0x4bbaff[0x1])){logger[_0xabe9('0xc')](_0xabe9('0x15'),_0x2dcb9d);_0x1746f7['body'][_0x4bbaff[0x1]]=_0x17858c;}else{logger[_0xabe9('0xc')](_0xabe9('0x16'),_0x2dcb9d,_0x4bbaff[0x1],_0x17858c);_0x1746f7['body'][_0x4bbaff[0x1]]=_0x17858c;}}_0x238c65[_0xabe9('0xe')]();});}}catch(_0x50dac7){logger[_0xabe9('0x8')](_0xabe9('0x9'),_0x2dcb9d,_['isObject'](_0x50dac7)?JSON[_0xabe9('0x17')](_0x50dac7):_0x50dac7);logger[_0xabe9('0xc')](_0xabe9('0xd'),_0x2dcb9d);_0x238c65[_0xabe9('0xe')]();}};}; \ 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 1ab4637..3fb794a 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 _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 +var _0x4956=['../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','stringify','finally','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x4956,0x17d));var _0x6495=function(_0x564c9e,_0x3481ec){_0x564c9e=_0x564c9e-0x0;var _0x59319e=_0x4956[_0x564c9e];return _0x59319e;};'use strict';var schema=require('validate');var _=require(_0x6495('0x0'));var rpc={'chatInteraction':require(_0x6495('0x1')),'openchannelInteraction':require(_0x6495('0x2')),'smsInteraction':require(_0x6495('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x6495('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x6495('0x5'))(_0x6495('0x6'));var tag=schema({'tag':{'type':_0x6495('0x7'),'required':!![],'message':_0x6495('0x8')}});exports[_0x6495('0x9')]=function(_0x5c071d,_0x256dd1,_0x5a9857,_0x331d60){return function(_0x5f04ac){try{var _0x324243={'tag':_0x256dd1[0x0]};var _0x4be519=tag['validate'](_0x324243,{'typecast':!![]});if(_0x4be519[_0x6495('0xa')]){logger[_0x6495('0xb')]('[%s][TAG]\x20%s',_0x5c071d,_['map'](_0x4be519,_0x6495('0xc'))['join'](',\x20'));logger[_0x6495('0xd')](_0x6495('0xe'),_0x5c071d);_0x5f04ac[_0x6495('0xf')]();}else{var _0x4d8321={'ids':[_0x256dd1[0x0]]};if(rpc[_0x331d60['channel']+_0x6495('0x10')]){rpc[_0x331d60['channel']+'Interaction'][_0x6495('0x11')](_0x331d60[_0x6495('0x12')]['id'],_0x4d8321)[_0x6495('0x13')](function(_0x62a936){logger[_0x6495('0xd')](_0x6495('0x14'),_0x5c071d,_0x256dd1[0x1],_0x331d60['channel'],_0x331d60['interaction']['id']);})['catch'](function(_0x5cd397){logger[_0x6495('0xb')](_0x6495('0x15'),_0x5c071d,JSON[_0x6495('0x16')](_0x5cd397));logger[_0x6495('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5c071d);})[_0x6495('0x17')](function(){_0x5f04ac[_0x6495('0xf')]();});}}}catch(_0x136161){logger['error'](_0x6495('0x15'),_0x5c071d,_['isObject'](_0x136161)?JSON[_0x6495('0x16')](_0x136161):_0x136161);logger[_0x6495('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5c071d);_0x5f04ac[_0x6495('0xf')]();}};}; \ 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 7f83c24..43db550 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 _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 +var _0x6b8a=['[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','consequence','\x20-\x20','replace','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','params','stringify','utf8','POST','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error'];(function(_0xfa8f7f,_0x240f01){var _0x291537=function(_0x3eedfe){while(--_0x3eedfe){_0xfa8f7f['push'](_0xfa8f7f['shift']());}};_0x291537(++_0x240f01);}(_0x6b8a,0x16f));var _0xa6b8=function(_0x1aba44,_0x228eb7){_0x1aba44=_0x1aba44-0x0;var _0x3c0a1c=_0x6b8a[_0x1aba44];return _0x3c0a1c;};'use strict';var rp=require('request-promise');var logger=require(_0xa6b8('0x0'))('routing');var _=require(_0xa6b8('0x1'));var arr=[];exports[_0xa6b8('0x2')]=function(_0xc3399,_0x3f0071){return function(_0x870342){var _0x11a8bc=_0x3f0071[0xa];var _0x2e1b6e=_0x3f0071[0xb];var _0x56525e=_0x3f0071[0xc];var _0x4f6e8d=_0x3f0071[0xd];var _0x454473=_0x3f0071[0xe];var _0x1021d2=_0x3f0071[0xf]['replace'](/\n/g,_0xa6b8('0x3'));var _0x1e34b0=_0x3f0071[0x10][_0xa6b8('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x2e1b6e)){arr[_0xa6b8('0x5')](_0x2e1b6e);var _0x1777e2=_0x3f0071[0x3];var _0x5cc7c6=_0x3f0071[0x4];var _0x2b0ba0=_0x3f0071[0x1];var _0x557ded=_0x3f0071[0x0];var _0xaa250a={};_0xaa250a[_0xa6b8('0x6')]=_0x3f0071[0x8]+_0xa6b8('0x7')+_0x56525e+'|'+_0x11a8bc+'|'+_0x4f6e8d+'|'+_0x2e1b6e+'|'+_0x454473;_0xaa250a[_0xa6b8('0x8')]=_0x3f0071[0x7]+_0xa6b8('0x7')+_0x56525e+'|'+_0x11a8bc+'|'+_0x4f6e8d+'|'+_0x2e1b6e+'|'+_0x454473+'|'+_0x1021d2+'|'+_0x1e34b0;_0xaa250a[_0xa6b8('0x9')]=_0x3f0071[0x9];var _0x2c9f74={};_0x2c9f74[_0xa6b8('0xa')]=_0xa6b8('0xb');_0x2c9f74[_0xa6b8('0xc')]='login';var _0x3c59e6=[];_0x3c59e6[_0xa6b8('0x5')](_0x3f0071[0x2]);_0x3c59e6[_0xa6b8('0x5')](_0x3f0071[0x5]);_0x3c59e6[_0xa6b8('0x5')](_0x3f0071[0x6]);_0x2c9f74[_0xa6b8('0xd')]=_0x3c59e6;_0x2c9f74['id']=0x1;var _0x52dd53=JSON[_0xa6b8('0xe')](_0x2c9f74);var _0x2785af={'encoding':_0xa6b8('0xf'),'method':_0xa6b8('0x10'),'timeout':0x2710,'url':_0x1777e2,'headers':{'Content-Type':_0xa6b8('0x11')},'body':_0x52dd53};return rp(_0x2785af)[_0xa6b8('0x12')](function(_0x4262ce){const _0x5c3c1d=JSON['parse'](_0x4262ce);if(!_0x5c3c1d[_0xa6b8('0x13')][_0xa6b8('0x14')]){throw new Error(_0xa6b8('0x15'));}var _0x13f459=_0x2e1b6e;var _0x5331c4='channelId='+_0x2b0ba0+_0xa6b8('0x16')+_0x557ded+_0xa6b8('0x17')+_0x13f459+_0xa6b8('0x18')+JSON['stringify'](_0xaa250a);var _0x1ac942=_0x5cc7c6+'?'+_0x5331c4;return rp(_0x1ac942);})[_0xa6b8('0x12')](function(_0x2457a2){logger[_0xa6b8('0x19')](_0xa6b8('0x1a'),_0xc3399,_0x2457a2);_0x870342[_0xa6b8('0x1b')]();})['catch'](function(_0x3e5188){logger[_0xa6b8('0x1c')](_0xa6b8('0x1d'),_0xc3399,_[_0xa6b8('0x1e')](_0x3e5188)?JSON['stringify'](_0x3e5188):_0x3e5188);_0x870342[_0xa6b8('0x1b')]();});}else{logger[_0xa6b8('0x19')](_0xa6b8('0x1f'),_0xc3399);_0x870342[_0xa6b8('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 25170d1..11e2eda 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_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 +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x2e8f6a,_0x506688){var _0x29db49=function(_0x31b6fb){while(--_0x31b6fb){_0x2e8f6a['push'](_0x2e8f6a['shift']());}};_0x29db49(++_0x506688);}(_0xe706,0xa3));var _0x6e70=function(_0x4291dd,_0x95d82){_0x4291dd=_0x4291dd-0x0;var _0x152462=_0xe706[_0x4291dd];return _0x152462;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 960189f..2ede91a 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 _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 +var _0xd076=['values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','amazonlex','tag','TagId','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','rules','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','paused','waiting','mailQueues','name','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xd076,0xd4));var _0x6d07=function(_0x2f44cf,_0x25c0c1){_0x2f44cf=_0x2f44cf-0x0;var _0xc8ca1e=_0xd076[_0x2f44cf];return _0xc8ca1e;};'use strict';var _=require(_0x6d07('0x0'));var util=require(_0x6d07('0x1'));var path=require(_0x6d07('0x2'));var fs=require('fs');var jayson=require(_0x6d07('0x3'));var BPromise=require(_0x6d07('0x4'));var utils=require(_0x6d07('0x5'));var sUtils=require(_0x6d07('0x6'));var logger=require(_0x6d07('0x7'))(_0x6d07('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6d07('0x9')),'chatQueueReport':require(_0x6d07('0xa')),'smsQueueReport':require(_0x6d07('0xb')),'faxQueueReport':require(_0x6d07('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x6d07('0xd'));function getId(_0x87e9b7,_0x9a8d62,_0x50c270){return util[_0x6d07('0xe')](_0x6d07('0xf'),_0x87e9b7,_0x9a8d62||0x0,_0x50c270||0x0);}function getIntervals(_0x20a7c9,_0x5a16a6){var _0x396184=[];if(!_['isNil'](_0x5a16a6[_0x6d07('0x10')])&&!_[_0x6d07('0x11')](_0x20a7c9[_0x5a16a6[_0x6d07('0x10')]])&&!_[_0x6d07('0x11')](_0x20a7c9[_0x5a16a6[_0x6d07('0x10')]][_0x6d07('0x12')])){_0x396184=_[_0x6d07('0x13')](_0x20a7c9[_0x5a16a6[_0x6d07('0x10')]]['Intervals'],'interval');}else if(!_[_0x6d07('0x11')](_0x5a16a6[_0x6d07('0x14')])){_0x396184=[_0x5a16a6['interval']];}return _0x396184;}exports[_0x6d07('0x15')]=function(_0x323a10){_0x323a10['rules']={};return new BPromise(function(_0x177426,_0x274b7a){var _0x31e314={'Start':function(_0x409efd){var _0x28b63e=this;return new Promise(function(_0x17e9c1,_0x570fb8){if(_0x409efd){try{var _0xb35478=[];var _0x3db1ef=getId(_0x409efd[_0x6d07('0x16')],_0x409efd[_0x6d07('0x17')]?_0x409efd[_0x6d07('0x17')]['id']:0x0,_0x409efd[_0x6d07('0x18')]?_0x409efd[_0x6d07('0x18')]['id']:0x0);var _0x33b273=sUtils[_0x6d07('0x19')](_0x323a10,_0x409efd);if(!_0x33b273&&_0x409efd[_0x6d07('0x1a')]&&_['isArray'](_0x409efd[_0x6d07('0x1a')])&&_0x409efd[_0x6d07('0x1a')][_0x6d07('0x1b')]){for(var _0xeeba8f=0x0;_0xeeba8f<_0x409efd[_0x6d07('0x1a')][_0x6d07('0x1b')];_0xeeba8f+=0x1){var _0x43f37f=_0x409efd[_0x6d07('0x1a')][_0xeeba8f];if(fs[_0x6d07('0x1c')](path[_0x6d07('0x1d')](__dirname,_0x6d07('0x1a'),_0x43f37f[_0x6d07('0x1e')]+_0x6d07('0x1f')))){var _0x3119d4=[];switch(_0x43f37f['app'][_0x6d07('0x20')]()){case _0x6d07('0x21'):var _0x28a509=_0x43f37f[_0x6d07('0x22')]['split'](',');if(_0x409efd[_0x6d07('0x16')]===_0x6d07('0x23')){_0x3119d4[_0x6d07('0x24')](_0x28a509[0x0]);_0x3119d4['push'](_0x28a509[0x1]);_0x3119d4['push'](_0x28a509[_0x6d07('0x25')](0x2,_0x28a509[_0x6d07('0x1b')])[_0x6d07('0x1d')](','));}else{_0x3119d4[_0x6d07('0x24')](_0x28a509[0x0]);_0x3119d4[_0x6d07('0x24')](_0x28a509[_0x6d07('0x25')](0x1,_0x28a509['length'])[_0x6d07('0x1d')](','));}break;case _0x6d07('0x26'):var _0x4fc996=_0x43f37f['appdata']['split'](',');_0x3119d4['push'](_0x4fc996[0x0]);_0x3119d4['push'](_0x4fc996[0x1]);_0x3119d4[_0x6d07('0x24')](_0x4fc996[_0x6d07('0x25')](0x2,_0x4fc996[_0x6d07('0x1b')])['join'](','));break;case'dialogflowv2':var _0xf7c3af=_0x43f37f[_0x6d07('0x22')][_0x6d07('0x27')](',');_0x3119d4[_0x6d07('0x24')](_0xf7c3af[0x0]);_0x3119d4['push'](_0xf7c3af[0x1]);_0x3119d4['push'](_0xf7c3af[0x2]);_0x3119d4[_0x6d07('0x24')](_0xf7c3af[0x3]);_0x3119d4[_0x6d07('0x24')](_0xf7c3af[_0x6d07('0x25')](0x4,_0xf7c3af[_0x6d07('0x1b')])[_0x6d07('0x1d')](','));break;case _0x6d07('0x28'):var _0xaa44a7=_0x43f37f['appdata'][_0x6d07('0x27')](',');_0x3119d4[_0x6d07('0x24')](_0xaa44a7[0x0]);_0x3119d4[_0x6d07('0x24')](_0xaa44a7[0x1]);_0x3119d4[_0x6d07('0x24')](_0xaa44a7[0x2]);_0x3119d4[_0x6d07('0x24')](_0xaa44a7[0x3]);_0x3119d4[_0x6d07('0x24')](_0xaa44a7[_0x6d07('0x25')](0x4,_0xaa44a7[_0x6d07('0x1b')])[_0x6d07('0x1d')](','));break;case _0x6d07('0x17'):_0x3119d4[_0x6d07('0x24')](_0x43f37f[_0x6d07('0x22')]);break;case _0x6d07('0x29'):_0x3119d4[_0x6d07('0x24')](_0x43f37f[_0x6d07('0x2a')]);_0x3119d4[_0x6d07('0x24')](_0x43f37f[_0x6d07('0x22')]);break;case'tvox':var _0x16da75=utils['getMustacheRender'](_0x409efd[_0x6d07('0x2b')][_0x6d07('0x2c')],_0x409efd);var _0x304871=_0x43f37f['appdata'][_0x6d07('0x27')](',');_0x3119d4[_0x6d07('0x24')](_0x304871[0x0]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x1]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x2]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x3]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x4]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x5]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x6]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x7]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x8]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x9]);_0x3119d4[_0x6d07('0x24')](_0x304871[0xa]);_0x3119d4['push'](_0x409efd[_0x6d07('0x18')]['id']);_0x3119d4[_0x6d07('0x24')](_0x409efd[_0x6d07('0x17')]['id']);_0x3119d4[_0x6d07('0x24')](_0x43f37f[_0x6d07('0x2d')]);_0x3119d4[_0x6d07('0x24')](_0x409efd[_0x6d07('0x18')][_0x6d07('0x2e')]);_0x3119d4[_0x6d07('0x24')](_0x409efd[_0x6d07('0x2f')][_0x6d07('0x2f')]);_0x3119d4[_0x6d07('0x24')](_0x16da75);break;default:_0x3119d4=_['isNil'](_0x43f37f[_0x6d07('0x22')])?[]:_0x43f37f['appdata']['split'](',');}var _0x47ccfa={'id':util[_0x6d07('0xe')](_0x6d07('0x30'),_0x3db1ef,_0x43f37f['id'],_0x43f37f['app']),'condition':require(_0x6d07('0x31'))[_0x6d07('0x32')](_0x3db1ef,getIntervals(_0x323a10[_0x6d07('0x33')],_0x43f37f),_0x323a10),'consequence':require('./applications/'+_0x43f37f['app'])[_0x6d07('0x34')](_0x3db1ef,_0x3119d4,_0x323a10,_0x409efd),'p':_0x43f37f[_0x6d07('0x35')]||0x0};logger[_0x6d07('0x36')](_0x6d07('0x37'),_0x47ccfa['id'],_0x6d07('0x38'),getIntervals(_0x323a10[_0x6d07('0x33')],_0x43f37f)[_0x6d07('0x1d')](_0x6d07('0x39')));_0xb35478[_0x6d07('0x24')](_0x47ccfa);}else{logger[_0x6d07('0x3a')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x6d07('0x1a'),_0x43f37f[_0x6d07('0x1e')]+_0x6d07('0x1f')));}}_0x323a10[_0x6d07('0x3b')][_0x3db1ef]=new RuleEngine(_0xb35478);_0x323a10['rules'][_0x3db1ef]['execute'](_0x409efd,function(_0x3db718){logger['info']('Applications\x20executed',JSON[_0x6d07('0x3c')](_0x3db718[_0x6d07('0x3d')]));if(_0x323a10[_0x6d07('0x3b')][_0x3db1ef]){_0x323a10[_0x6d07('0x3b')][_0x3db1ef][_0x6d07('0x3e')](_0x6d07('0x3f'));}});return _0x17e9c1({'code':0xc8,'message':_0x409efd});}else{if(_0x33b273){logger['info'](util['format']('Skipped\x20routing\x20for\x20%s',_0x3db1ef));}else{logger[_0x6d07('0x36')]('No\x20applications\x20to\x20execute');}return _0x17e9c1({'code':0xc8,'message':_0x409efd});}}catch(_0xfab8cd){logger['error'](_0xfab8cd[_0x6d07('0x40')]);return _0x570fb8(_0x28b63e['error'](0x1f4,_0xfab8cd));}}return _0x570fb8(_0x6d07('0x41'));});},'AcceptMessage':function(_0x4b7d89){var _0x5c8083=this;return new Promise(function(_0x1c5f7d,_0x429a49){if(_0x4b7d89[_0x6d07('0x42')]&&_0x4b7d89[_0x6d07('0x42')]['id']){if(_0x323a10[_0x6d07('0x43')][_0x4b7d89[_0x6d07('0x42')]['id']]){_0x323a10[_0x6d07('0x43')][_0x4b7d89[_0x6d07('0x42')]['id']]['busy']=![];_0x323a10[_0x6d07('0x43')][_0x4b7d89[_0x6d07('0x42')]['id']][_0x6d07('0x44')]=undefined;}}if(_0x4b7d89[_0x6d07('0x17')]&&_0x4b7d89[_0x6d07('0x17')]['id']){try{var _0x3415b3=getId(_0x4b7d89['channel'],_0x4b7d89[_0x6d07('0x17')]?_0x4b7d89['message']['id']:0x0,_0x4b7d89[_0x6d07('0x18')]?_0x4b7d89[_0x6d07('0x18')]['id']:0x0);if(_0x323a10[_0x6d07('0x3b')][_0x3415b3]){_0x323a10['rules'][_0x3415b3][_0x6d07('0x3e')](_0x6d07('0x45'));if(rpc[_0x4b7d89['channel']+_0x6d07('0x46')]){rpc[_0x4b7d89['channel']+_0x6d07('0x46')][_0x6d07('0x47')](_0x3415b3,{'UserId':_0x4b7d89[_0x6d07('0x17')][_0x6d07('0x48')]})['catch'](function(){logger['error'](_0x6d07('0x49'));});}}return _0x1c5f7d({'code':0xc8,'message':_0x4b7d89});}catch(_0x38fc32){logger[_0x6d07('0x3a')](_0x38fc32['stack']);return _0x429a49(_0x5c8083[_0x6d07('0x3a')](0x1f4,_0x38fc32));}}logger['error'](_0x6d07('0x4a'));return _0x429a49(_0x5c8083[_0x6d07('0x3a')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2e0cae){var _0x3dbeab=this;return new Promise(function(_0x4e6656,_0x1cb98f){if(_0x2e0cae[_0x6d07('0x42')]&&_0x2e0cae[_0x6d07('0x42')]['id']){try{if(_0x323a10[_0x6d07('0x43')][_0x2e0cae[_0x6d07('0x42')]['id']]){_0x323a10[_0x6d07('0x43')][_0x2e0cae[_0x6d07('0x42')]['id']][_0x6d07('0x4b')]=![];_0x323a10[_0x6d07('0x43')][_0x2e0cae[_0x6d07('0x42')]['id']][_0x6d07('0x44')]=undefined;}return _0x4e6656({'code':0xc8,'message':_0x2e0cae});}catch(_0x5e1ecb){logger[_0x6d07('0x3a')](_0x5e1ecb[_0x6d07('0x40')]);return _0x1cb98f(_0x3dbeab[_0x6d07('0x3a')](0x1f4,_0x5e1ecb));}}logger[_0x6d07('0x3a')](_0x6d07('0x4a'));return _0x1cb98f(_0x3dbeab['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2884c2){var _0x621121=this;return new Promise(function(_0x3db116,_0xff3949){if(_0x2884c2[_0x6d07('0x16')]&&_0x2884c2[_0x6d07('0x18')]&&_0x2884c2[_0x6d07('0x18')]['id']){try{var _0x272799=getId(_0x2884c2[_0x6d07('0x16')],_0x2884c2[_0x6d07('0x17')]?_0x2884c2[_0x6d07('0x17')]['id']:0x0,_0x2884c2[_0x6d07('0x18')]?_0x2884c2[_0x6d07('0x18')]['id']:0x0);if(_0x323a10[_0x6d07('0x3b')][_0x272799]){_0x323a10[_0x6d07('0x3b')][_0x272799][_0x6d07('0x3e')](_0x6d07('0x45'));}return _0x3db116({'code':0xc8,'message':_0x2884c2});}catch(_0x19096d){logger[_0x6d07('0x3a')](_0x19096d[_0x6d07('0x40')]);return _0xff3949(_0x621121['error'](0x1f4,_0x19096d));}}logger[_0x6d07('0x3a')](_0x6d07('0x4a'));return _0xff3949(_0x621121[_0x6d07('0x3a')](0x1f4,_0x6d07('0x4a')));});},'AgentCapacity':function(_0x4b1e36){var _0x1a4421=this;return new Promise(function(_0x301a0e,_0x267e9d){if(_0x323a10[_0x6d07('0x43')][_0x6d07('0x4c')](_0x4b1e36['id'])){for(var _0x44e0e4 in _0x4b1e36[_0x6d07('0x4d')]){if(_0x4b1e36[_0x6d07('0x4d')][_0x6d07('0x4c')](_0x44e0e4)){if(_0x323a10[_0x6d07('0x43')][_0x4b1e36['id']][_0x6d07('0x4c')](_0x44e0e4+_0x6d07('0x4e'))){_0x323a10[_0x6d07('0x43')][_0x4b1e36['id']][_0x44e0e4+_0x6d07('0x4e')]=parseInt(_0x4b1e36[_0x6d07('0x4d')][_0x44e0e4],0xa);}}}_0x323a10[_0x6d07('0x43')][_0x4b1e36['id']][_0x6d07('0x4f')]();return _0x301a0e({'code':0xc8,'message':_0x323a10[_0x6d07('0x43')][_0x4b1e36['id']]});}else{return _0x267e9d(_0x1a4421[_0x6d07('0x3a')](0x1f4,_0x6d07('0x50')));}});},'Agents':function(_0x347a3e){return new Promise(function(_0x5072c0){var _0x5c4282=_['values'](_0x323a10[_0x6d07('0x43')]);if(_0x347a3e&&_0x347a3e['id']){var _0x404c6e=_[_0x6d07('0x51')](_0x5c4282,function(_0x33ccb4){return _0x33ccb4['id']===_0x347a3e['id'];});_0x5072c0(_0x404c6e);}else{_0x5072c0({'count':_0x5c4282['length'],'rows':_0x5c4282});}});},'ChatQueues':function(){return new Promise(function(_0x5735a1){var _0x27264d=[];for(var _0x388dc9 in _0x323a10[_0x6d07('0x52')]){if(_0x323a10[_0x6d07('0x52')][_0x6d07('0x4c')](_0x388dc9)){var _0x14b0ae=_0x323a10[_0x6d07('0x52')][_0x388dc9];var _0x1ceb5d={'id':_0x14b0ae['id'],'available':_0x14b0ae[_0x6d07('0x53')],'loggedIn':_0x14b0ae['loggedIn'],'name':_0x14b0ae['name'],'paused':_0x14b0ae[_0x6d07('0x54')],'waiting':_0x14b0ae[_0x6d07('0x55')]};_0x27264d[_0x6d07('0x24')](_0x1ceb5d);}}_0x5735a1({'count':_0x27264d[_0x6d07('0x1b')],'rows':_0x27264d});});},'MailQueues':function(){return new Promise(function(_0x47073a){var _0x508c58=[];for(var _0x3fd3a8 in _0x323a10[_0x6d07('0x56')]){if(_0x323a10[_0x6d07('0x56')]['hasOwnProperty'](_0x3fd3a8)){var _0x1989bd=_0x323a10[_0x6d07('0x56')][_0x3fd3a8];var _0x50b679={'id':_0x1989bd['id'],'available':_0x1989bd[_0x6d07('0x53')],'loggedIn':_0x1989bd['loggedIn'],'name':_0x1989bd[_0x6d07('0x57')],'paused':_0x1989bd[_0x6d07('0x54')],'waiting':_0x1989bd[_0x6d07('0x55')]};_0x508c58['push'](_0x50b679);}}_0x47073a({'count':_0x508c58[_0x6d07('0x1b')],'rows':_0x508c58});});},'OpenchannelQueues':function(){return new Promise(function(_0x39be9c){var _0x44a3ed=[];for(var _0x363f7d in _0x323a10[_0x6d07('0x58')]){if(_0x323a10[_0x6d07('0x58')][_0x6d07('0x4c')](_0x363f7d)){var _0xaccb1=_0x323a10['openchannelQueues'][_0x363f7d];var _0x1477ae={'id':_0xaccb1['id'],'available':_0xaccb1['available'],'loggedIn':_0xaccb1[_0x6d07('0x59')],'name':_0xaccb1[_0x6d07('0x57')],'paused':_0xaccb1[_0x6d07('0x54')],'waiting':_0xaccb1[_0x6d07('0x55')]};_0x44a3ed['push'](_0x1477ae);}}_0x39be9c({'count':_0x44a3ed[_0x6d07('0x1b')],'rows':_0x44a3ed});});},'SmsQueues':function(){return new Promise(function(_0x5af627){var _0x1632f9=[];for(var _0x45b131 in _0x323a10['smsQueues']){if(_0x323a10['smsQueues'][_0x6d07('0x4c')](_0x45b131)){var _0xe2c01e=_0x323a10[_0x6d07('0x5a')][_0x45b131];var _0x196bce={'id':_0xe2c01e['id'],'available':_0xe2c01e[_0x6d07('0x53')],'loggedIn':_0xe2c01e[_0x6d07('0x59')],'name':_0xe2c01e['name'],'paused':_0xe2c01e[_0x6d07('0x54')],'waiting':_0xe2c01e['waiting']};_0x1632f9[_0x6d07('0x24')](_0x196bce);}}_0x5af627({'count':_0x1632f9[_0x6d07('0x1b')],'rows':_0x1632f9});});},'FaxQueues':function(){return new Promise(function(_0xfacc9e){var _0x1db582=[];for(var _0x5a33b5 in _0x323a10['faxQueues']){if(_0x323a10[_0x6d07('0x5b')][_0x6d07('0x4c')](_0x5a33b5)){var _0x5126fb=_0x323a10['faxQueues'][_0x5a33b5];var _0x19a1b8={'id':_0x5126fb['id'],'available':_0x5126fb[_0x6d07('0x53')],'loggedIn':_0x5126fb[_0x6d07('0x59')],'name':_0x5126fb[_0x6d07('0x57')],'paused':_0x5126fb[_0x6d07('0x54')],'waiting':_0x5126fb[_0x6d07('0x55')]};_0x1db582[_0x6d07('0x24')](_0x19a1b8);}}_0xfacc9e({'count':_0x1db582[_0x6d07('0x1b')],'rows':_0x1db582});});},'WhatsappQueues':function(){return new Promise(function(_0x1a9b9f){var _0x512be6=[];for(var _0x186a80 in _0x323a10[_0x6d07('0x5c')]){if(_0x323a10[_0x6d07('0x5c')][_0x6d07('0x4c')](_0x186a80)){var _0x5dc45e=_0x323a10['whatsappQueues'][_0x186a80];var _0x4b8afd={'id':_0x5dc45e['id'],'available':_0x5dc45e[_0x6d07('0x53')],'loggedIn':_0x5dc45e[_0x6d07('0x59')],'name':_0x5dc45e[_0x6d07('0x57')],'paused':_0x5dc45e[_0x6d07('0x54')],'waiting':_0x5dc45e[_0x6d07('0x55')]};_0x512be6[_0x6d07('0x24')](_0x4b8afd);}}_0x1a9b9f({'count':_0x512be6[_0x6d07('0x1b')],'rows':_0x512be6});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xc48b1c){var _0x331251=_['values'](_0x323a10[_0x6d07('0x5d')]);_0xc48b1c({'count':_0x331251[_0x6d07('0x1b')],'rows':_0x331251});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3b5501){var _0x52f521=_[_0x6d07('0x5e')](_0x323a10['mailQueuesWaitingInteractions']);_0x3b5501({'count':_0x52f521[_0x6d07('0x1b')],'rows':_0x52f521});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xbee0e0){var _0x1e92a1=_['values'](_0x323a10[_0x6d07('0x5f')]);_0xbee0e0({'count':_0x1e92a1[_0x6d07('0x1b')],'rows':_0x1e92a1});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2381d5){var _0x4a0f1d=_['values'](_0x323a10[_0x6d07('0x60')]);_0x2381d5({'count':_0x4a0f1d[_0x6d07('0x1b')],'rows':_0x4a0f1d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5cf28c){var _0x2b26cd=_['values'](_0x323a10['faxQueuesWaitingInteractions']);_0x5cf28c({'count':_0x2b26cd[_0x6d07('0x1b')],'rows':_0x2b26cd});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2c432){var _0x1fe63d=_['values'](_0x323a10[_0x6d07('0x61')]);_0x2c432({'count':_0x1fe63d[_0x6d07('0x1b')],'rows':_0x1fe63d});});}};var _0x5dd88d=jayson[_0x6d07('0x62')](_0x31e314)['http']();_0x5dd88d['on'](_0x6d07('0x3a'),function(_0x21e1bd){logger[_0x6d07('0x3a')](JSON[_0x6d07('0x3c')](_0x21e1bd));return _0x274b7a(_0x21e1bd);});_0x5dd88d[_0x6d07('0x15')](0x232c,_0x6d07('0x63'),function(){console['log'](_0x6d07('0x64'),0x232c);return _0x177426(_0x6d07('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d52ba0a..06a7477 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 _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 +var _0xa1ef=['stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','../../../utils/iftime','../../../config/logger','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1ef,0x1ce));var _0xfa1e=function(_0x2dffd7,_0x50e766){_0x2dffd7=_0x2dffd7-0x0;var _0x55e83f=_0xa1ef[_0x2dffd7];return _0x55e83f;};'use strict';var _=require('lodash');var iftime=require(_0xfa1e('0x0'))['iftime'];var logger=require(_0xfa1e('0x1'))('routing');exports[_0xfa1e('0x2')]=function(_0x20c752,_0x37df27,_0x156b75){return function(_0x3c2b28){if(_0x156b75[_0xfa1e('0x3')]&&!_0x156b75[_0xfa1e('0x3')][_0x20c752]){logger[_0xfa1e('0x4')](_0xfa1e('0x5'),_0x20c752);return _0x3c2b28[_0xfa1e('0x6')]();}var _0x3af7cc=_0x37df27[_0xfa1e('0x7')](function(_0x1a8fa6){return iftime(_0x1a8fa6);});var _0x2b1aff=_[_0xfa1e('0x8')](_0x3af7cc);if(_0x2b1aff){logger['info'](_0xfa1e('0x9'),_0x20c752,_0x37df27[_0xfa1e('0xa')](_0xfa1e('0xb')),_0x2b1aff);_0x3c2b28['when'](_0x2b1aff);}else{logger[_0xfa1e('0x4')](_0xfa1e('0xc'),_0x20c752,_0x37df27[_0xfa1e('0xa')](_0xfa1e('0xb')));_0x3c2b28['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index f794eb8..a9f4659 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 _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 +var _0x9348=['clone','calleridname','transfer','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','rejected','indexOf','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agentcomplete','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','uniqueid','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transfereeuniqueid'];(function(_0x370d14,_0x1e801e){var _0xe41199=function(_0x36c812){while(--_0x36c812){_0x370d14['push'](_0x370d14['shift']());}};_0xe41199(++_0x1e801e);}(_0x9348,0x10d));var _0x8934=function(_0x69d845,_0x2f77e6){_0x69d845=_0x69d845-0x0;var _0x1efb81=_0x9348[_0x69d845];return _0x1efb81;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var utils=require(_0x8934('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x135b2c,_0x46a231){utils['info'](util[_0x8934('0x3')](_0x8934('0x4'),_0x135b2c['uniqueid'],_0x135b2c[_0x8934('0x5')],_0x135b2c[_0x8934('0x6')],_0x135b2c[_0x8934('0x7')],_0x135b2c[_0x8934('0x8')],_0x135b2c[_0x8934('0x9')],_0x135b2c[_0x8934('0xa')],_0x135b2c['lastevent']));if(_0x135b2c[_0x8934('0x6')]){utils[_0x8934('0xb')](_0x135b2c[_0x8934('0x6')])['then'](function(_0x4b470d){if(_0x4b470d){_0x135b2c['type']=_0x4b470d['type'];_0x135b2c[_0x8934('0xc')]=_0x135b2c['agentcomplete']?_0x4b470d[_0x8934('0xd')]:![];_0x135b2c[_0x8934('0xe')]=_0x135b2c[_0x8934('0xc')]?_0x4b470d[_0x8934('0xf')]:0x0;}utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);});}else{utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);}if(_0x46a231){delete transfers[_0x135b2c['uniqueid']];}else{delete agents[_0x135b2c[_0x8934('0x12')]];}}exports[_0x8934('0x13')]=function(_0x46bca5){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0x46bca5);agents[_0x46bca5[_0x8934('0x12')]]=_0x46bca5;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x19');agents[_0x46bca5[_0x8934('0x12')]]['connectedlinenum']=null;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x1a')]=null;utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x46bca5['uniqueid'],agents[_0x46bca5[_0x8934('0x12')]]['membername'],_0x46bca5[_0x8934('0x12')]));}catch(_0xa9c394){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0xa9c394);}};exports[_0x8934('0x1d')]=function(_0x5ae49f){try{if(!_[_0x8934('0x1e')](agents[_0x5ae49f[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x5ae49f);utils[_0x8934('0x1b')](util['format'](_0x8934('0x21'),_0x5ae49f[_0x8934('0x20')],agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x7')],_0x5ae49f[_0x8934('0x12')]));agents[_0x5ae49f['destuniqueid']][_0x8934('0x1d')]=!![];agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x22')]=utils['now']();agents[_0x5ae49f[_0x8934('0x12')]]['lastevent']=_0x8934('0x23');agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x24')]='timeout';agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x25')]=_0x5ae49f[_0x8934('0x26')]?parseInt(_0x5ae49f[_0x8934('0x26')])/0x3e8:0x0;agents[_0x5ae49f['destuniqueid']][_0x8934('0x27')]=0x0;unanswered[_0x8934('0x28')](_0x5ae49f[_0x8934('0x12')]);}}catch(_0x3d93c7){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x3d93c7);}};exports[_0x8934('0x29')]=function(_0x18938a){try{_['forIn'](agents,function(_0x1d068c,_0x3e973e){if(_0x1d068c['uniqueid']==_0x18938a[_0x8934('0x20')]&&!_[_0x8934('0x2a')](unanswered,_0x1d068c[_0x8934('0x12')])){utils[_0x8934('0x14')](util['format'](_0x8934('0x2b'),_0x18938a[_0x8934('0x20')]),_0x18938a);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2c'),_0x18938a['uniqueid'],_0x1d068c[_0x8934('0x7')],_0x1d068c['destuniqueid']));_0x1d068c['agentringnoanswer']=!![];_0x1d068c[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x1d068c[_0x8934('0x18')]=_0x8934('0x2d');_0x1d068c['reason']=_0x8934('0x2d');_0x1d068c[_0x8934('0x25')]=_0x18938a[_0x8934('0x25')];_0x1d068c[_0x8934('0x27')]=0x0;writeDB(_0x1d068c);}});}catch(_0x7b2a1c){utils['error'](util[_0x8934('0x3')](_0x8934('0x2b'),_0x18938a['uniqueid']),_0x7b2a1c);}};exports['agentconnect']=function(_0x845028){try{if(agents[_0x845028[_0x8934('0x12')]]){utils['debug'](util['format'](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x845028);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2f'),_0x845028[_0x8934('0x20')],agents[_0x845028[_0x8934('0x12')]][_0x8934('0x7')],_0x845028[_0x8934('0x12')]));agents[_0x845028[_0x8934('0x12')]][_0x8934('0x30')]=utils['now']();agents[_0x845028[_0x8934('0x12')]][_0x8934('0xa')]=_0x845028['connectedlinenum'];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x1a')]=_0x845028[_0x8934('0x1a')];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x25')]=_0x845028['ringtime'];agents[_0x845028['destuniqueid']]['lastevent']=_0x8934('0x31');_[_0x8934('0x32')](agents,function(_0x8814f6,_0x53581b){if(_0x8814f6[_0x8934('0x12')]!=_0x845028['destuniqueid']&&_0x8814f6['uniqueid']==_0x845028[_0x8934('0x20')]){_0x8814f6[_0x8934('0x27')]=0x0;_0x8814f6['holdtime']=_0x845028['ringtime'];_0x8814f6[_0x8934('0x1d')]=!![];_0x8814f6[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x8814f6['lastevent']=_0x8934('0x33');_0x8814f6['reason']=_0x8934('0x33');_0x8814f6['answeredelsewheredestinationuniqueid']=_0x845028[_0x8934('0x12')];_0x8814f6[_0x8934('0x34')]=_0x845028[_0x8934('0x7')];writeDB(_0x8814f6);}});}}catch(_0x566d67){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x566d67);}};exports['agentcomplete']=function(_0x2182db){try{if(!_[_0x8934('0x1e')](agents[_0x2182db[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0x2182db);utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2182db['uniqueid'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x7')],_0x2182db['destuniqueid']));agents[_0x2182db[_0x8934('0x12')]]['agentcomplete']=!![];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x36')]=utils['now']();agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x2182db[_0x8934('0x12')]]['agentcompleteAt'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x30')]);agents[_0x2182db['destuniqueid']][_0x8934('0x24')]=_0x2182db[_0x8934('0x24')];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x38');writeDB(agents[_0x2182db[_0x8934('0x12')]]);}}catch(_0xa45543){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0xa45543);}};exports[_0x8934('0x39')]=function(_0x2c322d){try{if(!_[_0x8934('0x1e')](agents[_0x2c322d[_0x8934('0x3a')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x3b'),_0x2c322d['uniqueid']),_0x2c322d);utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2c322d['uniqueid'],agents[_0x2c322d['transfereruniqueid']]['membername'],agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')]));agents[_0x2c322d[_0x8934('0x3a')]]['transfer']=!![];agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3c')]='blind';agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3d')]=_0x2c322d[_0x8934('0x3e')];agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x3f')]=agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')];}}catch(_0x3902fb){utils['error'](util[_0x8934('0x3')]('[%s][agents][blindtransfer]',_0x2c322d[_0x8934('0x20')]),_0x3902fb);}};exports[_0x8934('0x40')]=function(_0x2d776a){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x41'),_0x2d776a[_0x8934('0x42')]),_0x2d776a);if(_0x2d776a[_0x8934('0x42')]==_0x2d776a['origtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x43')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a['origtransfereruniqueid'],agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x7')]));agents[_0x2d776a[_0x8934('0x43')]]['transfer']=!![];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a['secondtransfereruniqueid']]['transferexten']=_0x2d776a['origtransfererexten'];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x42')];}if(_0x2d776a['transfereeuniqueid']&&agents[_0x2d776a[_0x8934('0x46')]]){agents[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x1;transfers[_0x2d776a['transfereeuniqueid']]=_[_0x8934('0x47')](agents[_0x2d776a[_0x8934('0x46')]]);transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x9')]=agents[_0x2d776a['secondtransfereruniqueid']]['calleridnum'];transfers[_0x2d776a['transfereeuniqueid']]['calleridname']=agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['agentconnectAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x2;}}else if(_0x2d776a[_0x8934('0x43')]==_0x2d776a['secondtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x42')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a[_0x8934('0x42')],agents[_0x2d776a[_0x8934('0x42')]]['membername']));agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x49')]=!![];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3d')]=_0x2d776a[_0x8934('0x4a')];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x43')];}if(_0x2d776a[_0x8934('0x4b')]&&agents[_0x2d776a[_0x8934('0x4b')]]){agents[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x1;transfers[_0x2d776a['transfertargetuniqueid']]=_['clone'](agents[_0x2d776a[_0x8934('0x4b')]]);transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x9')]=agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x9')];transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x48')]=agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x4b')]]['agentcalledAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a['transfertargetuniqueid']][_0x8934('0x30')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x4b')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x2;}}}catch(_0x544fa7){utils[_0x8934('0x1c')](util['format'](_0x8934('0x41'),_0x2d776a['origtransfereruniqueid']),_0x544fa7);}};exports[_0x8934('0x4d')]=function(_0x6b3376){try{utils[_0x8934('0x14')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x6b3376);if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]]['reason']===_0x8934('0x23')){if(_0x6b3376['cause']==='21'){agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=_0x8934('0x4f');agents[_0x6b3376[_0x8934('0x20')]]['lastevent']=_0x8934('0x4f');}utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376['uniqueid']]['reason'],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);var _0x1efd58=unanswered[_0x8934('0x50')](_0x6b3376[_0x8934('0x20')]);if(_0x1efd58>-0x1){unanswered[_0x8934('0x51')](_0x1efd58,0x1);}}if(transfers[_0x6b3376[_0x8934('0x20')]]){transfers[_0x6b3376[_0x8934('0x20')]]['agentcomplete']=!![];transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils['diffTime'](transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')],transfers[_0x6b3376['uniqueid']][_0x8934('0x30')]);transfers[_0x6b3376['uniqueid']]['reason']='agent';transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]=_0x8934('0x38');utils['info'](util[_0x8934('0x3')](_0x8934('0x52'),_0x6b3376['uniqueid'],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(transfers[_0x6b3376[_0x8934('0x20')]],!![]);}if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]){agents[_0x6b3376['uniqueid']][_0x8934('0x53')]=!![];agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x6b3376['uniqueid']][_0x8934('0x36')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]);agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x49')]?_0x8934('0x49'):_0x8934('0x54');agents[_0x6b3376['uniqueid']]['lastevent']=_0x8934('0x38');utils[_0x8934('0x1b')](util['format'](_0x8934('0x52'),_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);}}catch(_0x2d094e){utils[_0x8934('0x1c')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x2d094e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3ca6b3d..fbca5a7 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 _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 +var _0x5912=['transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstop]','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','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','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr','split','substring','includes','execif','gotoif','lastapplication','lodash','./utils','NO\x20ANSWER','ANSWERED','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','context','exten','calleridnum','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','destinationchannel','secondtransfererchannel','userfield'];(function(_0x49f65c,_0x15595d){var _0x57d131=function(_0x1a3666){while(--_0x1a3666){_0x49f65c['push'](_0x49f65c['shift']());}};_0x57d131(++_0x15595d);}(_0x5912,0xfd));var _0x2591=function(_0x572a4d,_0x62d3a9){_0x572a4d=_0x572a4d-0x0;var _0x2575ea=_0x5912[_0x572a4d];return _0x2575ea;};'use strict';var _=require(_0x2591('0x0'));var util=require('util');var utils=require(_0x2591('0x1'));var dispositions=[_0x2591('0x2'),'FAILED','FAILED',_0x2591('0x2'),_0x2591('0x2'),_0x2591('0x2'),_0x2591('0x3'),'BUSY','FAILED',_0x2591('0x4'),'FAILED'];var channels={};function writeDB(_0x12e02f){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x7'),_0x12e02f[_0x2591('0x8')],_0x12e02f['channel'],_0x12e02f[_0x2591('0x9')],_0x12e02f[_0x2591('0xa')],_0x12e02f['interface'],_0x12e02f['calleridnum'],_0x12e02f[_0x2591('0xb')],_0x12e02f[_0x2591('0xc')]));if(_0x12e02f[_0x2591('0xd')]){utils[_0x2591('0xe')](_0x12e02f['accountcode'])[_0x2591('0xf')](function(_0x3ac5e8){if(_0x3ac5e8){_0x12e02f['UserId']=_0x3ac5e8['id'];}utils[_0x2591('0x10')](_0x2591('0x11'),_0x12e02f);});}else{utils[_0x2591('0x10')](_0x2591('0x11'),_0x12e02f);}if(channels[_0x12e02f['uniqueid']]){delete channels[_0x12e02f[_0x2591('0x8')]];}}exports['newchannel']=function(_0x51dec7){try{utils[_0x2591('0x12')](util[_0x2591('0x6')](_0x2591('0x13'),_0x51dec7[_0x2591('0x8')]),_0x51dec7);if(_0x51dec7[_0x2591('0x8')]==_0x51dec7[_0x2591('0x14')]&&_0x51dec7[_0x2591('0x15')]!=_0x2591('0x16')){utils[_0x2591('0x5')](util[_0x2591('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x51dec7[_0x2591('0x8')],_0x51dec7[_0x2591('0x17')],_0x51dec7[_0x2591('0x18')]));channels[_0x51dec7[_0x2591('0x8')]]={'uniqueid':_0x51dec7['uniqueid'],'accountcode':_0x51dec7['accountcode'],'source':_0x51dec7[_0x2591('0x19')],'destination':_0x51dec7[_0x2591('0x18')],'destinationcontext':_0x51dec7[_0x2591('0x17')],'channel':_0x51dec7[_0x2591('0x15')],'starttime':utils[_0x2591('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x2591('0x1b')};}}catch(_0x40f562){utils[_0x2591('0x1c')](util[_0x2591('0x6')](_0x2591('0x13'),_0x51dec7[_0x2591('0x8')]),_0x40f562);}};exports['newstate']=function(_0x3954f0){try{utils[_0x2591('0x12')](util[_0x2591('0x6')](_0x2591('0x1d'),_0x3954f0[_0x2591('0x8')]),_0x3954f0);if(!_[_0x2591('0x1e')](channels[_0x3954f0[_0x2591('0x8')]])&&_0x3954f0['channelstate']==0x6){utils['info'](util['format'](_0x2591('0x1f'),_0x3954f0['uniqueid'],_0x3954f0[_0x2591('0x17')],_0x3954f0[_0x2591('0x15')]));if(_['isNil'](channels[_0x3954f0[_0x2591('0x8')]]['systemanswertime'])){channels[_0x3954f0[_0x2591('0x8')]][_0x2591('0x20')]=utils[_0x2591('0x1a')]();}}else if(!_[_0x2591('0x1e')](channels[_0x3954f0[_0x2591('0x14')]])&&_0x3954f0[_0x2591('0x21')]==0x6&&_0x3954f0[_0x2591('0x17')]!=_0x2591('0x22')){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x23'),_0x3954f0[_0x2591('0x8')],_0x3954f0[_0x2591('0x14')],_0x3954f0[_0x2591('0x17')],_0x3954f0['channel']));channels[_0x3954f0['linkedid']][_0x2591('0xd')]=_0x3954f0[_0x2591('0xd')];channels[_0x3954f0[_0x2591('0x14')]]['destinationchannel']=_0x3954f0[_0x2591('0x15')];if(_[_0x2591('0x1e')](channels[_0x3954f0[_0x2591('0x14')]][_0x2591('0x24')])){channels[_0x3954f0['linkedid']][_0x2591('0x24')]=utils['now']();}channels[_0x3954f0['linkedid']][_0x2591('0x25')]=dispositions[_[_0x2591('0x26')](_0x3954f0[_0x2591('0x21')])]||_0x2591('0x3');}}catch(_0x50a650){utils[_0x2591('0x1c')](util[_0x2591('0x6')](_0x2591('0x1d'),_0x3954f0[_0x2591('0x8')]),_0x50a650);}};exports[_0x2591('0x27')]=function(_0x37f3f6){try{if(!_[_0x2591('0x1e')](channels[_0x37f3f6[_0x2591('0x8')]])){utils['debug'](util[_0x2591('0x6')]('[%s][calls][hangup]',_0x37f3f6[_0x2591('0x8')]),_0x37f3f6);if(_[_0x2591('0x1e')](channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x28')])){channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x28')]=_0x37f3f6[_0x2591('0x29')]+'\x20<'+_0x37f3f6[_0x2591('0x19')]+'>';}utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x2a'),_0x37f3f6[_0x2591('0x8')],channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x28')],_0x37f3f6[_0x2591('0x2b')]));channels[_0x37f3f6['uniqueid']][_0x2591('0x2c')]=utils[_0x2591('0x1a')]();channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x2d')]=utils[_0x2591('0x2e')](channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x2c')],channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x2f')]);channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x30')]=channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x24')]?utils[_0x2591('0x2e')](channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x2c')],channels[_0x37f3f6[_0x2591('0x8')]]['answertime']):0x0;writeDB(channels[_0x37f3f6[_0x2591('0x8')]]);}}catch(_0x163216){utils[_0x2591('0x1c')](util['format']('[%s][calls][hangup]',_0x37f3f6[_0x2591('0x8')]),_0x163216);}};exports['attendedtransfer']=function(_0x1cf979){try{if(!_[_0x2591('0x1e')](channels[_0x1cf979['localtwolinkedid']])){utils[_0x2591('0x12')](util[_0x2591('0x6')](_0x2591('0x31'),_0x1cf979[_0x2591('0x32')]),_0x1cf979);if(channels[_0x1cf979[_0x2591('0x33')]][_0x2591('0x15')]==_0x1cf979[_0x2591('0x34')]){utils[_0x2591('0x5')](util[_0x2591('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1cf979[_0x2591('0x32')],_0x1cf979['localtwolinkedid'],_0x1cf979['secondtransfererchannel']));channels[_0x1cf979['localtwolinkedid']][_0x2591('0x35')]=_0x1cf979[_0x2591('0x36')];channels[_0x1cf979[_0x2591('0x33')]][_0x2591('0x37')]='_attended';}else if(channels[_0x1cf979[_0x2591('0x33')]][_0x2591('0x15')]=_0x1cf979[_0x2591('0x38')]){utils[_0x2591('0x5')](util['format'](_0x2591('0x39'),_0x1cf979['origtransfereruniqueid'],_0x1cf979[_0x2591('0x33')],_0x1cf979[_0x2591('0x3a')]));channels[_0x1cf979[_0x2591('0x33')]][_0x2591('0x35')]=_0x1cf979['origtransfererchannel'];channels[_0x1cf979[_0x2591('0x33')]]['userfield']=_0x2591('0x3b');}}}catch(_0x31f103){utils['error'](util[_0x2591('0x6')](_0x2591('0x31'),_0x1cf979[_0x2591('0x32')]),_0x31f103);}};exports[_0x2591('0x3c')]=function(_0x498a86){try{if(!_[_0x2591('0x1e')](channels[_0x498a86[_0x2591('0x8')]])){utils[_0x2591('0x12')](util[_0x2591('0x6')]('[%s][calls][musiconholdstart]',_0x498a86[_0x2591('0x8')]),_0x498a86);channels[_0x498a86[_0x2591('0x8')]]['musiconholdstartAt']=utils[_0x2591('0x1a')]();utils[_0x2591('0x5')](util[_0x2591('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x498a86[_0x2591('0x8')],channels[_0x498a86[_0x2591('0x8')]]['musiconholdstartAt']));}}catch(_0x4572f2){utils[_0x2591('0x1c')](util[_0x2591('0x6')]('[%s][calls][musiconholdstart]',_0x498a86[_0x2591('0x8')]),_0x4572f2);}};exports['musiconholdstop']=function(_0x4ee176){try{if(!_[_0x2591('0x1e')](channels[_0x4ee176['uniqueid']])){utils[_0x2591('0x12')](util[_0x2591('0x6')](_0x2591('0x3d'),_0x4ee176['uniqueid']),_0x4ee176);if(!_[_0x2591('0x1e')](channels[_0x4ee176['uniqueid']][_0x2591('0x3e')])){channels[_0x4ee176[_0x2591('0x8')]]['mohtime']+=utils[_0x2591('0x2e')](utils['now'](),channels[_0x4ee176[_0x2591('0x8')]]['musiconholdstartAt']);utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x3f'),_0x4ee176['uniqueid'],channels[_0x4ee176[_0x2591('0x8')]][_0x2591('0x40')]));delete channels[_0x4ee176['uniqueid']][_0x2591('0x3e')];}}}catch(_0x2167d0){utils['error'](util[_0x2591('0x6')](_0x2591('0x3d'),_0x4ee176[_0x2591('0x8')]),_0x2167d0);}};exports[_0x2591('0x41')]=function(_0x2d98b0){try{if(!_[_0x2591('0x1e')](channels[_0x2d98b0[_0x2591('0x8')]])){utils[_0x2591('0x12')](util['format']('[%s][calls][varset]',_0x2d98b0[_0x2591('0x8')]),_0x2d98b0);if(!_['isNil'](_0x2d98b0[_0x2591('0x42')][_0x2591('0x43')])){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x44'),_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x46')]=_0x2d98b0['value'];}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x47')])){utils[_0x2591('0x5')](util[_0x2591('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0['uniqueid']]['destination']=_0x2d98b0[_0x2591('0x45')];channels[_0x2d98b0['uniqueid']][_0x2591('0x28')]='\x22'+_0x2d98b0[_0x2591('0x45')]+'\x22\x20<'+_0x2d98b0['value']+'>';}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')]['xmd-callerid-preview'])||!_['isNil'](_0x2d98b0['variable'][_0x2591('0x48')])){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x49'),_0x2d98b0[_0x2591('0x8')],!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')]['xmd-callerid-preview'])?_0x2591('0x4a'):'xmd-callerid',_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x28')]=_0x2d98b0[_0x2591('0x45')];}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x4b')])||!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x4c')])){utils[_0x2591('0x5')](util['format'](_0x2591('0x49'),_0x2d98b0[_0x2591('0x8')],!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x4b')])?'xmd-queue':'xmcs-queue',_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0[_0x2591('0x8')]]['lastapplication']=_0x2591('0x4d');channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x4e')]=_0x2d98b0[_0x2591('0x45')];channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x9')]=!![];}if(!_[_0x2591('0x1e')](_0x2d98b0['variable'][_0x2591('0x4f')])){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x50'),_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0['uniqueid']][_0x2591('0x51')]=_0x2d98b0[_0x2591('0x45')];}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x52')])){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x53'),_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x54')]=_0x2d98b0['value'];}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x55')])){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x56'),_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x57')]=_0x2d98b0['value'];}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x58')])){utils[_0x2591('0x5')](util['format'](_0x2591('0x59'),_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0['uniqueid']][_0x2591('0x58')]=_0x2d98b0[_0x2591('0x45')];}}}catch(_0x37a6f2){utils[_0x2591('0x1c')](util['format']('[%s][calls][varset]',_0x2d98b0['uniqueid']),_0x37a6f2);}};exports['newexten']=function(_0x1dff1d){try{if(!_[_0x2591('0x1e')](channels[_0x1dff1d[_0x2591('0x8')]])){utils[_0x2591('0x12')](util[_0x2591('0x6')](_0x2591('0x5a'),_0x1dff1d[_0x2591('0x8')]),_0x1dff1d);utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x5b'),_0x1dff1d[_0x2591('0x8')],_0x1dff1d['application'],_0x1dff1d['appdata']));if(_0x1dff1d[_0x2591('0x5c')][_0x2591('0x5d')]()==_0x2591('0x5e')&&_['startsWith'](_0x1dff1d[_0x2591('0x5f')]['toLowerCase'](),_0x2591('0x60'))){var _0x56245a=_0x1dff1d[_0x2591('0x5f')][_0x2591('0x61')]('=');var _0x269cf0=_0x56245a[0x0][_0x2591('0x62')](_0x56245a[0x0]['lastIndexOf']('(')+0x1,_0x56245a[0x0]['lastIndexOf'](')'));var _0x384382=_0x56245a[0x1];channels[_0x1dff1d[_0x2591('0x8')]][_0x269cf0]=_0x384382;}if(!_[_0x2591('0x63')]([_0x2591('0x27'),'noop',_0x2591('0x64'),'set',_0x2591('0x65')],_0x1dff1d[_0x2591('0x5c')][_0x2591('0x5d')]())){channels[_0x1dff1d[_0x2591('0x8')]][_0x2591('0x66')]=_0x1dff1d[_0x2591('0x5c')];channels[_0x1dff1d[_0x2591('0x8')]][_0x2591('0x4e')]=_0x1dff1d['appdata'];}}}catch(_0x46971f){utils[_0x2591('0x1c')](util[_0x2591('0x6')]('[%s][calls][newexten]',_0x1dff1d[_0x2591('0x8')]),_0x46971f);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index fd86670..6c67ed8 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 _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 +var _0x4f83=['[core]\x20fullybooted','close','[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x2471ba,_0xb5cad){var _0x3464e3=function(_0x40e977){while(--_0x40e977){_0x2471ba['push'](_0x2471ba['shift']());}};_0x3464e3(++_0xb5cad);}(_0x4f83,0x15b));var _0x34f8=function(_0x2186af,_0x565f21){_0x2186af=_0x2186af-0x0;var _0x20023a=_0x4f83[_0x2186af];return _0x20023a;};'use strict';var utils=require(_0x34f8('0x0'));exports[_0x34f8('0x1')]=function(){utils[_0x34f8('0x2')](_0x34f8('0x3'));};exports[_0x34f8('0x4')]=function(){utils[_0x34f8('0x2')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0x34f8('0x2')](_0x34f8('0x5'));};exports['error']=function(_0x7d5252){utils['error']('[core]\x20error',_0x7d5252);};exports[_0x34f8('0x6')]=function(){utils[_0x34f8('0x2')](_0x34f8('0x7'));};exports['managerevent']=function(_0x15469f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 20d16e4..a9860b9 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 _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 +var _0x7096=['diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','split','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration'];(function(_0x29e4be,_0x40a76d){var _0x266025=function(_0x26466f){while(--_0x26466f){_0x29e4be['push'](_0x29e4be['shift']());}};_0x266025(++_0x40a76d);}(_0x7096,0x1e4));var _0x6709=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7096[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x6709('0x0'));var util=require(_0x6709('0x1'));var utils=require(_0x6709('0x2'));var dials={};function writeDB(_0x3fd03c){utils[_0x6709('0x3')](util[_0x6709('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x3fd03c[_0x6709('0x5')],_0x3fd03c[_0x6709('0x6')],_0x3fd03c[_0x6709('0x7')],_0x3fd03c[_0x6709('0x8')],_0x3fd03c[_0x6709('0x9')],_0x3fd03c['dialstatus']));utils[_0x6709('0xa')](_0x6709('0xb'),_0x3fd03c);delete dials[_0x3fd03c['uniqueid']];}exports[_0x6709('0xc')]=function(_0x2c58f0){try{utils[_0x6709('0xd')](util['format']('[%s][dials][newexten]',_0x2c58f0[_0x6709('0x5')]),_0x2c58f0);utils[_0x6709('0x3')](util[_0x6709('0x4')](_0x6709('0xe'),_0x2c58f0[_0x6709('0x5')],_0x2c58f0[_0x6709('0xf')],_0x2c58f0['appdata']));if(_0x2c58f0[_0x6709('0xf')][_0x6709('0x10')]()==_0x6709('0x11')&&_[_0x6709('0x12')](_0x2c58f0['appdata'][_0x6709('0x10')](),'cdr(routeid)')){var _0x31aff3=_0x2c58f0['appdata'][_0x6709('0x13')]('=');dials[_0x2c58f0[_0x6709('0x5')]]={'routeId':_0x31aff3[0x1]};}}catch(_0x54ebd7){utils['error'](util['format']('[%s][dials][newexten]',_0x2c58f0['uniqueid']),_0x54ebd7);}};exports['varset']=function(_0x43ab0b){try{utils[_0x6709('0xd')](util[_0x6709('0x4')](_0x6709('0x14'),_0x43ab0b[_0x6709('0x5')]),_0x43ab0b);if(!_[_0x6709('0x15')](_0x43ab0b[_0x6709('0x16')]['outboundrouteid'])){utils['info'](util[_0x6709('0x4')](_0x6709('0x17'),_0x43ab0b[_0x6709('0x5')],_0x43ab0b[_0x6709('0x18')]));dials[_0x43ab0b[_0x6709('0x5')]]={'routeId':_0x43ab0b['value']};}}catch(_0x1edaf7){utils[_0x6709('0x19')](util[_0x6709('0x4')]('[%s][dials][varset]',_0x43ab0b[_0x6709('0x5')]),_0x1edaf7);}};exports[_0x6709('0x1a')]=function(_0x30aef6){try{if(!_[_0x6709('0x15')](dials[_0x30aef6['uniqueid']])){utils[_0x6709('0xd')](util[_0x6709('0x4')](_0x6709('0x1b'),_0x30aef6[_0x6709('0x5')]),_0x30aef6);dials[_0x30aef6[_0x6709('0x5')]]=_[_0x6709('0x1c')](dials[_0x30aef6[_0x6709('0x5')]],_0x30aef6);dials[_0x30aef6['uniqueid']][_0x6709('0x1d')]=utils[_0x6709('0x1e')]();dials[_0x30aef6['uniqueid']][_0x6709('0x1f')]=_0x6709('0x20');utils[_0x6709('0x3')](util[_0x6709('0x4')](_0x6709('0x21'),_0x30aef6['uniqueid'],dials[_0x30aef6['uniqueid']][_0x6709('0x1d')]));}}catch(_0x1b2156){utils['error'](util[_0x6709('0x4')](_0x6709('0x1b'),_0x30aef6[_0x6709('0x5')]),_0x1b2156);}};exports[_0x6709('0x22')]=function(_0x559525){try{if(!_[_0x6709('0x15')](dials[_0x559525[_0x6709('0x5')]])){utils[_0x6709('0xd')](util[_0x6709('0x4')](_0x6709('0x23'),_0x559525['uniqueid']),_0x559525);dials[_0x559525[_0x6709('0x5')]][_0x6709('0x24')]=_0x559525['dialstatus'];if(_0x559525[_0x6709('0x24')]=='ANSWER'){dials[_0x559525['uniqueid']]=_['assign'](dials[_0x559525[_0x6709('0x5')]],_0x559525);dials[_0x559525[_0x6709('0x5')]][_0x6709('0x25')]=utils[_0x6709('0x1e')]();dials[_0x559525[_0x6709('0x5')]][_0x6709('0x1f')]='connect';utils[_0x6709('0x3')](util['format'](_0x6709('0x26'),_0x559525[_0x6709('0x5')],_0x559525['dialstatus'],dials[_0x559525[_0x6709('0x5')]][_0x6709('0x25')]));}else{utils[_0x6709('0x3')](util[_0x6709('0x4')](_0x6709('0x27'),_0x559525['uniqueid'],_0x559525[_0x6709('0x24')]));}}}catch(_0x4a9eef){utils[_0x6709('0x19')](util[_0x6709('0x4')](_0x6709('0x23'),_0x559525['uniqueid']),_0x4a9eef);}};exports['hangup']=function(_0x344a7d){try{if(!_[_0x6709('0x15')](dials[_0x344a7d[_0x6709('0x5')]])){utils[_0x6709('0xd')](util[_0x6709('0x4')]('[%s][dials][hangup]',_0x344a7d[_0x6709('0x5')]),_0x344a7d);utils[_0x6709('0x3')](util[_0x6709('0x4')](_0x6709('0x28'),_0x344a7d[_0x6709('0x5')],_0x344a7d[_0x6709('0x8')],_0x344a7d[_0x6709('0x29')],_0x344a7d[_0x6709('0x2a')]));dials[_0x344a7d[_0x6709('0x5')]]=_[_0x6709('0x1c')](dials[_0x344a7d[_0x6709('0x5')]],{'endtime':utils[_0x6709('0x1e')](),'lastevent':'complete'});dials[_0x344a7d[_0x6709('0x5')]][_0x6709('0x2b')]=utils[_0x6709('0x2c')](dials[_0x344a7d[_0x6709('0x5')]][_0x6709('0x2d')],dials[_0x344a7d[_0x6709('0x5')]][_0x6709('0x1d')]);dials[_0x344a7d[_0x6709('0x5')]][_0x6709('0x2e')]=utils[_0x6709('0x2c')](dials[_0x344a7d[_0x6709('0x5')]][_0x6709('0x25')]||dials[_0x344a7d['uniqueid']][_0x6709('0x2d')],dials[_0x344a7d[_0x6709('0x5')]]['starttime']);dials[_0x344a7d['uniqueid']][_0x6709('0x2f')]=dials[_0x344a7d['uniqueid']][_0x6709('0x25')]?utils[_0x6709('0x2c')](dials[_0x344a7d[_0x6709('0x5')]]['endtime'],dials[_0x344a7d['uniqueid']]['answertime']):0x0;writeDB(dials[_0x344a7d[_0x6709('0x5')]]);}}catch(_0x2115b8){utils['error'](util['format']('[%s][dials][hangup]',_0x344a7d['uniqueid']),_0x2115b8);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 20aea7c..0d58cc1 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 _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 +var _0xa4cc=['queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','xdr','disabled','env','production','local','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]'];(function(_0x4c007d,_0x289126){var _0x582594=function(_0x40f2eb){while(--_0x40f2eb){_0x4c007d['push'](_0x4c007d['shift']());}};_0x582594(++_0x289126);}(_0xa4cc,0xed));var _0xca4c=function(_0x4689bc,_0x5730fe){_0x4689bc=_0x4689bc-0x0;var _0x412dbb=_0xa4cc[_0x4689bc];return _0x412dbb;};var AsteriskManager=require('asterisk-manager');var config=require(_0xca4c('0x0'));var utils=require(_0xca4c('0x1'));var util=require('util');var isXDREnabled=config[_0xca4c('0x2')]&&config[_0xca4c('0x2')][_0xca4c('0x3')]?!config['xdr']['disabled']:!![];var isProduction=config[_0xca4c('0x4')]===_0xca4c('0x5')||![];var isLocalAsterisk=config[_0xca4c('0x2')]&&config[_0xca4c('0x2')][_0xca4c('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xca4c('0x7')][_0xca4c('0x8')],config['asterisk']['ip'],config[_0xca4c('0x7')]['username'],config[_0xca4c('0x7')][_0xca4c('0x9')],!![]);ami[_0xca4c('0xa')]();if(!isXDREnabled){utils[_0xca4c('0xb')](_0xca4c('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xca4c('0xb')](_0xca4c('0xd'));}else{var agents=require(_0xca4c('0xe'));var calls=require(_0xca4c('0xf'));var queues=require(_0xca4c('0x10'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xca4c('0x11'));var core=require(_0xca4c('0x12'));ami['on'](_0xca4c('0x13'),core[_0xca4c('0x13')]);ami['on'](_0xca4c('0x14'),core[_0xca4c('0x14')]);ami['on'](_0xca4c('0x15'),core[_0xca4c('0x15')]);ami['on']('error',core[_0xca4c('0x16')]);ami['on'](_0xca4c('0x17'),core[_0xca4c('0x17')]);ami['on'](_0xca4c('0x18'),core[_0xca4c('0x18')]);ami['on'](_0xca4c('0x19'),function(_0x35e988){try{utils['debug'](util[_0xca4c('0x1a')](_0xca4c('0x1b'),_0x35e988[_0xca4c('0x1c')]),_0x35e988);members['devicestatechange'](_0x35e988);}catch(_0x493be5){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x1b'),_0x35e988[_0xca4c('0x1c')]),_0x493be5);}});ami['on'](_0xca4c('0x1d'),function(_0x3274d5){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x1f'),_0x3274d5['uniqueid']),_0x3274d5);agents['agentcalled'](_0x3274d5);}catch(_0x454be0){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x1f'),_0x3274d5[_0xca4c('0x20')]),_0x454be0);}});ami['on'](_0xca4c('0x21'),function(_0x42b025){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x22'),_0x42b025['uniqueid']),_0x42b025);agents[_0xca4c('0x21')](_0x42b025);}catch(_0x7e41c8){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x22'),_0x42b025['uniqueid']),_0x7e41c8);}});ami['on'](_0xca4c('0x23'),function(_0x479e84){try{utils[_0xca4c('0x1e')](util['format'](_0xca4c('0x24'),_0x479e84['uniqueid']),_0x479e84);agents[_0xca4c('0x23')](_0x479e84);queues[_0xca4c('0x23')](_0x479e84);}catch(_0x42e7a7){utils['error'](util[_0xca4c('0x1a')](_0xca4c('0x24'),_0x479e84[_0xca4c('0x20')]),_0x42e7a7);}});ami['on'](_0xca4c('0x25'),function(_0x41184f){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x26'),_0x41184f[_0xca4c('0x20')]),_0x41184f);agents[_0xca4c('0x25')](_0x41184f);queues[_0xca4c('0x25')](_0x41184f);members[_0xca4c('0x25')](_0x41184f);}catch(_0x2d95a9){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')]('[%s][index][agentcomplete]',_0x41184f[_0xca4c('0x20')]),_0x2d95a9);}});ami['on'](_0xca4c('0x27'),function(_0x5ab7d4){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x28'),_0x5ab7d4[_0xca4c('0x20')]),_0x5ab7d4);agents[_0xca4c('0x27')](_0x5ab7d4);queues['queuecallerabandon'](_0x5ab7d4);}catch(_0x53070c){utils['error'](util['format'](_0xca4c('0x28'),_0x5ab7d4[_0xca4c('0x20')]),_0x53070c);}});ami['on'](_0xca4c('0x29'),function(_0x271774){try{utils['debug'](util[_0xca4c('0x1a')](_0xca4c('0x2a'),_0x271774['uniqueid']),_0x271774);queues[_0xca4c('0x29')](_0x271774);recordings[_0xca4c('0x29')](_0x271774);}catch(_0x336df9){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x2a'),_0x271774[_0xca4c('0x20')]),_0x336df9);}});ami['on'](_0xca4c('0x2b'),function(_0x7dec0a){try{utils[_0xca4c('0x1e')](util['format'](_0xca4c('0x2c'),_0x7dec0a['uniqueid']),_0x7dec0a);queues[_0xca4c('0x2b')](_0x7dec0a);}catch(_0x340c64){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')]('[%s][index][queuecallerleave]',_0x7dec0a[_0xca4c('0x20')]),_0x340c64);}});ami['on'](_0xca4c('0x2d'),function(_0x3e6fb4){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x2e'),_0x3e6fb4['uniqueid']),_0x3e6fb4);queues[_0xca4c('0x2d')](_0x3e6fb4);calls[_0xca4c('0x2d')](_0x3e6fb4);}catch(_0x3c2d69){utils[_0xca4c('0x16')](util['format'](_0xca4c('0x2e'),_0x3e6fb4[_0xca4c('0x20')]),_0x3c2d69);}});ami['on'](_0xca4c('0x2f'),function(_0x2c4bbc){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x30'),_0x2c4bbc[_0xca4c('0x20')]),_0x2c4bbc);queues[_0xca4c('0x2f')](_0x2c4bbc);calls[_0xca4c('0x2f')](_0x2c4bbc);}catch(_0x3290ca){utils[_0xca4c('0x16')](util['format']('[%s][index][musiconholdstop]',_0x2c4bbc[_0xca4c('0x20')]),_0x3290ca);}});ami['on'](_0xca4c('0x31'),function(_0x5a8ac5){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x32'),_0x5a8ac5['uniqueid']),_0x5a8ac5);calls['newstate'](_0x5a8ac5);recordings['newstate'](_0x5a8ac5);}catch(_0x4952d9){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x32'),_0x5a8ac5[_0xca4c('0x20')]),_0x4952d9);}});ami['on'](_0xca4c('0x33'),function(_0x5e353f){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x34'),_0x5e353f['uniqueid']),_0x5e353f);calls[_0xca4c('0x33')](_0x5e353f);recordings[_0xca4c('0x33')](_0x5e353f);dials[_0xca4c('0x33')](_0x5e353f);agents[_0xca4c('0x33')](_0x5e353f);queues[_0xca4c('0x33')](_0x5e353f);}catch(_0x5145a9){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')]('[%s][index][hangup]',_0x5e353f['uniqueid']),_0x5145a9);}});ami['on']('cdr',function(_0x299276){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x35'),_0x299276[_0xca4c('0x20')]),_0x299276);members[_0xca4c('0x36')](_0x299276);}catch(_0x36bae8){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x35'),_0x299276['uniqueid']),_0x36bae8);}});ami['on'](_0xca4c('0x37'),function(_0x426bbd){try{utils['debug'](util[_0xca4c('0x1a')](_0xca4c('0x38'),_0x426bbd[_0xca4c('0x20')]),_0x426bbd);queues[_0xca4c('0x37')](_0x426bbd);agents['blindtransfer'](_0x426bbd);transfers[_0xca4c('0x37')](_0x426bbd);}catch(_0x33671c){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x38'),_0x426bbd[_0xca4c('0x20')]),_0x33671c);}});ami['on']('attendedtransfer',function(_0x446663){try{utils['debug'](util['format'](_0xca4c('0x39'),_0x446663['origtransfereruniqueid']),_0x446663);queues[_0xca4c('0x3a')](_0x446663);transfers['attendedtransfer'](_0x446663);agents[_0xca4c('0x3a')](_0x446663);calls[_0xca4c('0x3a')](_0x446663);}catch(_0x1e9dee){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x39'),_0x446663[_0xca4c('0x3b')]),_0x1e9dee);}});ami['on']('varset',function(_0x324a74){try{utils[_0xca4c('0x1e')](util['format']('[%s][index][varset]',_0x324a74[_0xca4c('0x20')]),_0x324a74);queues[_0xca4c('0x3c')](_0x324a74);recordings[_0xca4c('0x3c')](_0x324a74);calls['varset'](_0x324a74);dials[_0xca4c('0x3c')](_0x324a74);}catch(_0xa32c56){utils['error'](util[_0xca4c('0x1a')](_0xca4c('0x3d'),_0x324a74[_0xca4c('0x20')]),_0xa32c56);}});ami['on'](_0xca4c('0x3e'),function(_0x2bd313){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x3f'),_0x2bd313['uniqueid']),_0x2bd313);calls['newexten'](_0x2bd313);recordings[_0xca4c('0x3e')](_0x2bd313);dials[_0xca4c('0x3e')](_0x2bd313);}catch(_0x228c22){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x3f'),_0x2bd313['uniqueid']),_0x228c22);}});ami['on'](_0xca4c('0x40'),function(_0x46d0e8){try{utils['debug'](util[_0xca4c('0x1a')]('[%s][index][newchannel]',_0x46d0e8[_0xca4c('0x20')]),_0x46d0e8);calls[_0xca4c('0x40')](_0x46d0e8);recordings['newchannel'](_0x46d0e8);}catch(_0x32f25c){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')]('[%s][index][newchannel]',_0x46d0e8['uniqueid']),_0x32f25c);}});ami['on'](_0xca4c('0x41'),function(_0x43d153){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')]('[%s][index][dialbegin]',_0x43d153['uniqueid']),_0x43d153);dials[_0xca4c('0x41')](_0x43d153);}catch(_0x522fbc){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x42'),_0x43d153[_0xca4c('0x20')]),_0x522fbc);}});ami['on'](_0xca4c('0x43'),function(_0xf8583e){try{utils[_0xca4c('0x1e')](util['format'](_0xca4c('0x44'),_0xf8583e[_0xca4c('0x20')]),_0xf8583e);dials[_0xca4c('0x43')](_0xf8583e);}catch(_0x318674){utils[_0xca4c('0x16')](util['format'](_0xca4c('0x44'),_0xf8583e[_0xca4c('0x20')]),_0x318674);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 49ae178..9bc11f0 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 _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 +var _0x8318=['./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','getUserByName','split','name','CreateMemberReport','catch','format','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','now','NOT_INUSE','exitAt','duration','diffTime','enterAt','error','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util'];(function(_0x29a578,_0x406599){var _0x1cebfe=function(_0x2cb7da){while(--_0x2cb7da){_0x29a578['push'](_0x29a578['shift']());}};_0x1cebfe(++_0x406599);}(_0x8318,0x6a));var _0x8831=function(_0x4b8e29,_0x5d5708){_0x4b8e29=_0x4b8e29-0x0;var _0x50cf62=_0x8318[_0x4b8e29];return _0x50cf62;};'use strict';var _=require(_0x8831('0x0'));var util=require(_0x8831('0x1'));var utils=require(_0x8831('0x2'));var members={};var exclude=[_0x8831('0x3'),_0x8831('0x4')];function writeDB(_0x2c2dc1){utils[_0x8831('0x5')](util['format'](_0x8831('0x6'),_0x2c2dc1['uniqueid'],_0x2c2dc1[_0x8831('0x7')],_0x2c2dc1[_0x8831('0x8')],_0x2c2dc1[_0x8831('0x9')],_0x2c2dc1[_0x8831('0xa')],_0x2c2dc1[_0x8831('0xb')]));if(_0x2c2dc1['interface']){utils[_0x8831('0xc')](_0x2c2dc1['interface'])[_0x8831('0xd')](function(_0x2f9dc8){if(_0x2f9dc8){_0x2c2dc1['membername']=_0x2f9dc8['name'];_0x2c2dc1[_0x8831('0xe')]=_0x2f9dc8[_0x8831('0xe')];utils[_0x8831('0xf')]('CreateMemberReport',_0x2c2dc1);}else{utils[_0x8831('0x10')](_0x2c2dc1['interface'][_0x8831('0x11')]('/')[0x1])['then'](function(_0xefd394){if(_0xefd394){_0x2c2dc1[_0x8831('0xa')]=_0xefd394[_0x8831('0x12')];_0x2c2dc1['internal']=_0xefd394[_0x8831('0xe')];utils[_0x8831('0xf')](_0x8831('0x13'),_0x2c2dc1);}});}})[_0x8831('0x14')](function(_0x6bf66e){utils['error'](util[_0x8831('0x15')]('[%s][members][writeDB]',_0x2c2dc1['uniqueid']),_0x6bf66e);});}delete members[_0x2c2dc1[_0x8831('0x7')]];}function startsWith(_0x55bdbe,_0x1343bc){return _[_0x8831('0x16')](_0x55bdbe,function(_0x5a43a6){return _[_0x8831('0x17')](_0x1343bc,_0x5a43a6);});}exports[_0x8831('0x18')]=function(_0x32ffe0){try{utils[_0x8831('0x19')](util[_0x8831('0x15')](_0x8831('0x1a'),members[_0x32ffe0[_0x8831('0x1b')]]?members[_0x32ffe0[_0x8831('0x1b')]][_0x8831('0x1c')]:_0x32ffe0['device']),_0x32ffe0);utils['info'](util[_0x8831('0x15')](_0x8831('0x1d'),members[_0x32ffe0['device']]?members[_0x32ffe0[_0x8831('0x1b')]]['uniqueid']:_0x32ffe0[_0x8831('0x1b')],_0x32ffe0[_0x8831('0x1e')],_0x32ffe0[_0x8831('0x1b')]));switch(_0x32ffe0[_0x8831('0x1e')]){case _0x8831('0x1f'):case'BUSY':if(!startsWith(exclude,_0x32ffe0[_0x8831('0x1b')])){members[_0x32ffe0[_0x8831('0x1b')]]={'channel':'voice','interface':_0x32ffe0['device'],'type':_0x8831('0x20'),'enterAt':utils[_0x8831('0x21')](),'role':'agent'};}break;case _0x8831('0x22'):if(!_['isNil'](members[_0x32ffe0['device']])){members[_0x32ffe0[_0x8831('0x1b')]][_0x8831('0x23')]=utils[_0x8831('0x21')]();members[_0x32ffe0['device']][_0x8831('0x24')]=utils[_0x8831('0x25')](members[_0x32ffe0['device']]['exitAt'],members[_0x32ffe0['device']][_0x8831('0x26')]);if(members[_0x32ffe0['device']][_0x8831('0x1c')]){writeDB(members[_0x32ffe0['device']]);}}break;default:break;}}catch(_0x486d2e){utils[_0x8831('0x27')](util[_0x8831('0x15')](_0x8831('0x1a'),members[_0x32ffe0[_0x8831('0x1b')]]?members[_0x32ffe0['device']][_0x8831('0x1c')]:_0x32ffe0['device']),_0x486d2e);}};exports[_0x8831('0x28')]=function(_0x5e20f5){try{if(!_[_0x8831('0x29')](members[_0x5e20f5[_0x8831('0x7')]])){utils['debug'](util['format'](_0x8831('0x2a'),_0x5e20f5[_0x8831('0x1c')]),_0x5e20f5);utils['info'](util[_0x8831('0x15')](_0x8831('0x2b'),_0x5e20f5[_0x8831('0x1c')],_0x5e20f5['interface'],_0x5e20f5[_0x8831('0x2c')]));members[_0x5e20f5[_0x8831('0x7')]]=_[_0x8831('0x2d')](members[_0x5e20f5[_0x8831('0x7')]],{'data4':_0x5e20f5[_0x8831('0x2c')],'uniqueid':_0x5e20f5['uniqueid']});}}catch(_0xf2e2a4){utils[_0x8831('0x27')](util[_0x8831('0x15')](_0x8831('0x2a'),_0x5e20f5[_0x8831('0x1c')]),_0xf2e2a4);}};exports[_0x8831('0x2e')]=function(_0x55d676){try{utils[_0x8831('0x19')](util[_0x8831('0x15')](_0x8831('0x2f'),_0x55d676[_0x8831('0x1c')]),_0x55d676);if(_0x55d676[_0x8831('0x8')]){var _0x51014d=_0x55d676['channel'][_0x8831('0x11')]('-')[0x0];if(!_[_0x8831('0x29')](members[_0x51014d])){members[_0x51014d]=_[_0x8831('0x2d')](members[_0x51014d],{'data1':members[_0x51014d][_0x8831('0x30')]||_0x55d676[_0x8831('0xb')],'data2':members[_0x51014d][_0x8831('0x9')]||_0x55d676[_0x8831('0x31')],'data3':members[_0x51014d]['data3']||_0x55d676[_0x8831('0x32')],'uniqueid':members[_0x51014d][_0x8831('0x1c')]||_0x55d676[_0x8831('0x1c')]});utils[_0x8831('0x5')](util['format'](_0x8831('0x33'),_0x55d676[_0x8831('0x1c')],members[_0x51014d]['data1'],members[_0x51014d]['data2'],members[_0x51014d][_0x8831('0x34')]));if(members[_0x51014d][_0x8831('0x23')]){writeDB(members[_0x51014d]);}}}if(_0x55d676[_0x8831('0x35')]){var _0x3b4b8e=_0x55d676[_0x8831('0x35')][_0x8831('0x11')]('-')[0x0];if(!_[_0x8831('0x29')](members[_0x3b4b8e])){members[_0x3b4b8e]=_[_0x8831('0x2d')](members[_0x3b4b8e],{'data1':members[_0x3b4b8e][_0x8831('0x30')]||_0x55d676['type'],'data2':members[_0x3b4b8e][_0x8831('0x9')]||_0x55d676['source'],'data3':members[_0x3b4b8e][_0x8831('0x34')]||_0x55d676[_0x8831('0x32')],'uniqueid':members[_0x3b4b8e][_0x8831('0x1c')]||_0x55d676[_0x8831('0x1c')]});utils[_0x8831('0x5')](util[_0x8831('0x15')](_0x8831('0x33'),_0x55d676[_0x8831('0x1c')],members[_0x3b4b8e][_0x8831('0x30')],members[_0x3b4b8e][_0x8831('0x9')],members[_0x3b4b8e][_0x8831('0x34')]));if(members[_0x3b4b8e][_0x8831('0x23')]){writeDB(members[_0x3b4b8e]);}}}}catch(_0x526f7a){utils[_0x8831('0x27')](util[_0x8831('0x15')](_0x8831('0x2f'),_0x55d676[_0x8831('0x1c')]),_0x526f7a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index af6edbc..00f73c0 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 _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 +var _0xe4b8=['[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','[%s][queues][queuecallerabandon]','queuecallerabandonAt','queuecallerleave','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','assigned','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0xe4b8,0x1a4));var _0x8e4b=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xe4b8[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x8e4b('0x0'));var util=require(_0x8e4b('0x1'));var utils=require(_0x8e4b('0x2'));var queues={};function writeDB(_0x519587){utils[_0x8e4b('0x3')](util['format'](_0x8e4b('0x4'),_0x519587['uniqueid'],_0x519587[_0x8e4b('0x5')],_0x519587[_0x8e4b('0x6')],_0x519587['lastAssignedTo'],_0x519587[_0x8e4b('0x7')],_0x519587[_0x8e4b('0x8')],_0x519587[_0x8e4b('0x9')]));if(_0x519587[_0x8e4b('0x6')]){utils[_0x8e4b('0xa')](_0x519587[_0x8e4b('0x6')])['then'](function(_0x2aa141){if(_0x2aa141){_0x519587[_0x8e4b('0xb')]=_0x2aa141['type'];}utils['request'](_0x8e4b('0xc'),_0x519587);});}else{utils[_0x8e4b('0xd')](_0x8e4b('0xc'),_0x519587);}if(_0x519587[_0x8e4b('0xe')]){delete queues[_0x519587[_0x8e4b('0xe')]];}else{delete queues[_0x519587[_0x8e4b('0xf')]];}}exports[_0x8e4b('0x10')]=function(_0x5be5a8){try{utils['debug'](util[_0x8e4b('0x11')](_0x8e4b('0x12'),_0x5be5a8[_0x8e4b('0xf')]),_0x5be5a8);utils[_0x8e4b('0x3')](util['format'](_0x8e4b('0x13'),_0x5be5a8[_0x8e4b('0xf')],_0x5be5a8[_0x8e4b('0x6')],_0x5be5a8['position']));queues[_0x5be5a8[_0x8e4b('0xf')]]=_[_0x8e4b('0x14')](_0x5be5a8,{'originalposition':_0x5be5a8[_0x8e4b('0x15')],'queuecallerjoinAt':utils[_0x8e4b('0x16')](),'mohtime':0x0});}catch(_0x27b098){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')](_0x8e4b('0x12'),_0x5be5a8[_0x8e4b('0xf')]),_0x27b098);}};exports[_0x8e4b('0x18')]=function(_0x1fc169){try{if(!_[_0x8e4b('0x19')](queues[_0x1fc169['uniqueid']])){utils[_0x8e4b('0x1a')](util['format'](_0x8e4b('0x1b'),_0x1fc169[_0x8e4b('0xf')]),_0x1fc169);if(queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x1c')]){if(!queues[_0x1fc169[_0x8e4b('0xf')]]['queuecallerabandon']&&!queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x1d')]){queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x1e')]=!![];queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x1f')]=utils[_0x8e4b('0x16')]();queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x9')]=_0x8e4b('0x20');}utils['info'](util[_0x8e4b('0x11')](_0x8e4b('0x21'),_0x1fc169[_0x8e4b('0xf')],queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x22')],queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x9')]));writeDB(queues[_0x1fc169['uniqueid']]);}else if(queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0xe')]){utils['info'](util[_0x8e4b('0x11')](_0x8e4b('0x23'),_0x1fc169[_0x8e4b('0xf')],queues[_0x1fc169[_0x8e4b('0xf')]]['name'],queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0xe')]));queues[queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0xe')]]=queues[_0x1fc169[_0x8e4b('0xf')]];queues[queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0xe')]][_0x8e4b('0x24')]=0x2;delete queues[_0x1fc169['uniqueid']];}}}catch(_0x31deef){utils['error'](util[_0x8e4b('0x11')](_0x8e4b('0x1b'),_0x1fc169[_0x8e4b('0xf')]),_0x31deef);}};exports[_0x8e4b('0x25')]=function(_0x237c8d){try{utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')](_0x8e4b('0x26'),_0x237c8d[_0x8e4b('0xf')]),_0x237c8d);if(!_[_0x8e4b('0x19')](_0x237c8d['variable'][_0x8e4b('0x27')])&&_0x237c8d['value'][_0x8e4b('0x28')]()!==_0x8e4b('0x29')){if(!_[_0x8e4b('0x19')](queues[_0x237c8d['uniqueid']])){queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x2a')]=![];queues[_0x237c8d[_0x8e4b('0xf')]]['queuecallerabandonAt']=null;queues[_0x237c8d[_0x8e4b('0xf')]]['queuecallerexit']=!![];queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x2b')]=utils[_0x8e4b('0x16')]();queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x9')]=_0x237c8d[_0x8e4b('0x2c')][_0x8e4b('0x28')]();utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')](_0x8e4b('0x2d'),_0x237c8d[_0x8e4b('0xf')],queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x22')],_0x237c8d['value'],queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x9')]));writeDB(queues[_0x237c8d[_0x8e4b('0xf')]]);}}else if(!_[_0x8e4b('0x19')](_0x237c8d[_0x8e4b('0x2e')][_0x8e4b('0x2f')])){if(!_[_0x8e4b('0x19')](queues[_0x237c8d['uniqueid']])&&!queues[_0x237c8d[_0x8e4b('0xf')]]['queuecallerabandon']){queues[_0x237c8d[_0x8e4b('0xf')]]['queuecallerabandon']=![];queues[_0x237c8d['uniqueid']]['queuecallerabandonAt']=null;queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x1d')]=!![];queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x2b')]=utils[_0x8e4b('0x16')]();queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x9')]='EXITWITHKEY';utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x237c8d[_0x8e4b('0xf')],queues[_0x237c8d['uniqueid']]['name'],_0x237c8d[_0x8e4b('0x2c')],queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x9')]));}}}catch(_0x382c16){utils[_0x8e4b('0x17')](util['format'](_0x8e4b('0x26'),_0x237c8d[_0x8e4b('0xf')]),_0x382c16);}};exports[_0x8e4b('0x2a')]=function(_0x9e160b){try{if(!_[_0x8e4b('0x19')](queues[_0x9e160b[_0x8e4b('0xf')]])){utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')](_0x8e4b('0x30'),_0x9e160b['uniqueid']),_0x9e160b);queues[_0x9e160b[_0x8e4b('0xf')]]['queuecallerexit']=![];queues[_0x9e160b['uniqueid']][_0x8e4b('0x2b')]=null;queues[_0x9e160b[_0x8e4b('0xf')]][_0x8e4b('0x2a')]=!![];queues[_0x9e160b[_0x8e4b('0xf')]][_0x8e4b('0x31')]=utils[_0x8e4b('0x16')]();queues[_0x9e160b[_0x8e4b('0xf')]][_0x8e4b('0x9')]='ABANDONED';utils[_0x8e4b('0x3')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x9e160b[_0x8e4b('0xf')],queues[_0x9e160b[_0x8e4b('0xf')]][_0x8e4b('0x22')],queues[_0x9e160b[_0x8e4b('0xf')]][_0x8e4b('0x9')]));}}catch(_0x39ba9d){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')]('[%s][queues][queuecallerabandon]',_0x9e160b[_0x8e4b('0xf')]),_0x39ba9d);}};exports[_0x8e4b('0x32')]=function(_0x5231b4){try{if(!_['isNil'](queues[_0x5231b4['uniqueid']])){utils['debug'](util[_0x8e4b('0x11')]('[%s][queues][queuecallerleave]',_0x5231b4[_0x8e4b('0xf')]),_0x5231b4);utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5231b4[_0x8e4b('0xf')],queues[_0x5231b4['uniqueid']]['name'],_0x5231b4[_0x8e4b('0x33')],_0x5231b4[_0x8e4b('0x34')]));queues[_0x5231b4['uniqueid']][_0x8e4b('0x32')]=!![];queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x1c')]=utils[_0x8e4b('0x16')]();queues[_0x5231b4['uniqueid']][_0x8e4b('0x35')]=utils[_0x8e4b('0x36')](queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x1c')],queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x37')]);queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x15')]=_0x5231b4[_0x8e4b('0x15')];queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x38')]=_0x5231b4[_0x8e4b('0x38')];queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x33')]=_0x5231b4[_0x8e4b('0x33')];queues[_0x5231b4['uniqueid']][_0x8e4b('0x34')]=_0x5231b4[_0x8e4b('0x34')];}}catch(_0x43f1a2){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')](_0x8e4b('0x39'),_0x5231b4[_0x8e4b('0xf')]),_0x43f1a2);}};exports[_0x8e4b('0x3a')]=function(_0x1e2a00){try{if(!_[_0x8e4b('0x19')](queues[_0x1e2a00['uniqueid']])){utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')]('[%s][queues][agentconnect]',_0x1e2a00[_0x8e4b('0xf')]),_0x1e2a00);utils[_0x8e4b('0x3')](util['format'](_0x8e4b('0x3b'),_0x1e2a00[_0x8e4b('0xf')],queues[_0x1e2a00[_0x8e4b('0xf')]][_0x8e4b('0x22')],_0x1e2a00[_0x8e4b('0x3c')],_0x1e2a00[_0x8e4b('0x3d')]));queues[_0x1e2a00[_0x8e4b('0xf')]]['queuecallerabandon']=![];queues[_0x1e2a00[_0x8e4b('0xf')]]['queuecallerabandon']=![];queues[_0x1e2a00['uniqueid']][_0x8e4b('0x31')]=null;queues[_0x1e2a00[_0x8e4b('0xf')]][_0x8e4b('0x1d')]=![];queues[_0x1e2a00['uniqueid']][_0x8e4b('0x9')]=null;queues[_0x1e2a00[_0x8e4b('0xf')]][_0x8e4b('0x2b')]=null;queues[_0x1e2a00[_0x8e4b('0xf')]]['assigned']=!![];queues[_0x1e2a00[_0x8e4b('0xf')]]['accountcode']=_0x1e2a00['destaccountcode'];queues[_0x1e2a00[_0x8e4b('0xf')]][_0x8e4b('0x3e')]=_0x1e2a00[_0x8e4b('0x3c')];}}catch(_0x2bc6c8){utils['error'](util[_0x8e4b('0x11')]('[%s][queues][agentconnect]',_0x1e2a00[_0x8e4b('0xf')]),_0x2bc6c8);}};exports[_0x8e4b('0x3f')]=function(_0x4e1595){try{if(!_[_0x8e4b('0x19')](queues[_0x4e1595[_0x8e4b('0xf')]])){if(queues[_0x4e1595['uniqueid']]['queuecallerleaveAt']){utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')]('[%s][queues][agentcomplete]',_0x4e1595[_0x8e4b('0xf')]),_0x4e1595);queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x2a')]=![];queues[_0x4e1595[_0x8e4b('0xf')]]['queuecallerabandon']=![];queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x31')]=null;queues[_0x4e1595[_0x8e4b('0xf')]]['queuecallerexit']=![];queues[_0x4e1595['uniqueid']][_0x8e4b('0x2b')]=null;queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x40')]=!![];queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x3e')]=_0x4e1595[_0x8e4b('0x3c')];queues[_0x4e1595[_0x8e4b('0xf')]]['queuecallercomplete']=!![];queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x1f')]=utils['now']();if(_0x4e1595[_0x8e4b('0x41')]==_0x8e4b('0x42')){if(!queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x42')]){queues[_0x4e1595[_0x8e4b('0xf')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x4e1595['uniqueid']][_0x8e4b('0x9')]=_0x8e4b('0x43')+_0x4e1595[_0x8e4b('0x41')]['toUpperCase']();}utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')](_0x8e4b('0x44'),_0x4e1595[_0x8e4b('0xf')],queues[_0x4e1595['uniqueid']][_0x8e4b('0x22')],_0x4e1595['membername'],queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x9')]));writeDB(queues[_0x4e1595['uniqueid']]);}}}catch(_0x290c88){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')]('[%s][queues][agentcomplete]',_0x4e1595['uniqueid']),_0x290c88);}};exports[_0x8e4b('0x45')]=function(_0x23e771){try{if(!_[_0x8e4b('0x19')](queues[_0x23e771[_0x8e4b('0x46')]])){utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')](_0x8e4b('0x47'),_0x23e771[_0x8e4b('0xf')]),_0x23e771);queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x42')]=!![];queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x48')]=_0x8e4b('0x49');queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x4a')]=_0x23e771[_0x8e4b('0x4b')];queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x4c')]=_0x23e771[_0x8e4b('0x46')];queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x9')]=_0x8e4b('0x4d');utils[_0x8e4b('0x3')](util['format'](_0x8e4b('0x4e'),_0x23e771[_0x8e4b('0xf')],queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x22')],_0x23e771['transfereeuniqueid'],_0x23e771[_0x8e4b('0x4b')]));}}catch(_0x562570){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')]('[%s][queues][blindtransfer]',_0x23e771['uniqueid']),_0x562570);}};exports[_0x8e4b('0x4f')]=function(_0x40f540){try{utils['debug'](util[_0x8e4b('0x11')]('[%s][queues][attendedtransfer]',_0x40f540[_0x8e4b('0x50')]),_0x40f540);if(_0x40f540[_0x8e4b('0x50')]==_0x40f540[_0x8e4b('0x51')]){if(!_[_0x8e4b('0x19')](queues[_0x40f540[_0x8e4b('0x52')]])){utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x40f540[_0x8e4b('0x50')],queues[_0x40f540[_0x8e4b('0x52')]][_0x8e4b('0x22')],_0x40f540['origtransfererexten']));queues[_0x40f540[_0x8e4b('0x52')]][_0x8e4b('0x42')]=!![];queues[_0x40f540['secondtransfererlinkedid']][_0x8e4b('0x48')]=_0x8e4b('0x53');queues[_0x40f540[_0x8e4b('0x52')]][_0x8e4b('0x4a')]=_0x40f540[_0x8e4b('0x54')];queues[_0x40f540[_0x8e4b('0x52')]]['transferuniqueid']=_0x40f540[_0x8e4b('0x50')];queues[_0x40f540['secondtransfererlinkedid']][_0x8e4b('0x9')]=_0x8e4b('0x55');}if(!_['isNil'](queues[_0x40f540[_0x8e4b('0x51')]])){if(_0x40f540['transfereelinkedid']&&queues[_0x40f540[_0x8e4b('0x56')]]){queues[_0x40f540[_0x8e4b('0x56')]]['queuecallerenterreason']=0x1;queues[_0x40f540[_0x8e4b('0x46')]]=_[_0x8e4b('0x57')](queues[_0x40f540[_0x8e4b('0x56')]]);queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0xe')]=_0x40f540[_0x8e4b('0x58')];queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x24')]=0x2;queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x7')]=queues[_0x40f540[_0x8e4b('0x52')]][_0x8e4b('0x7')];queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x59')]=queues[_0x40f540[_0x8e4b('0x52')]]['calleridname'];queues[_0x40f540[_0x8e4b('0x46')]]['queuecallerjoinAt']=utils[_0x8e4b('0x16')]();queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x1c')]=utils[_0x8e4b('0x16')]();queues[_0x40f540[_0x8e4b('0x46')]]['holdtime']=0x0;queues[_0x40f540['transfereeuniqueid']][_0x8e4b('0x5a')]=0x0;utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x40f540[_0x8e4b('0x50')],queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x22')],queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x7')],queues[_0x40f540[_0x8e4b('0x46')]]['calleridname']));}else{utils['info'](util[_0x8e4b('0x11')](_0x8e4b('0x5b'),_0x40f540[_0x8e4b('0x50')],queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0x22')],_0x40f540[_0x8e4b('0x52')]));queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0xe')]=_0x40f540[_0x8e4b('0x52')];}}}else if(_0x40f540[_0x8e4b('0x5c')]==_0x40f540[_0x8e4b('0x52')]){if(!_[_0x8e4b('0x19')](queues[_0x40f540['origtransfererlinkedid']])){utils[_0x8e4b('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x40f540[_0x8e4b('0x50')],queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0x22')],_0x40f540[_0x8e4b('0x5c')],_0x40f540[_0x8e4b('0x5d')]));queues[_0x40f540[_0x8e4b('0x51')]]['transfer']=!![];queues[_0x40f540['origtransfererlinkedid']][_0x8e4b('0x48')]=_0x8e4b('0x53');queues[_0x40f540['origtransfererlinkedid']]['transferexten']=_0x40f540['secondtransfererexten'];queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0x4c')]=_0x40f540[_0x8e4b('0x5c')];queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0x9')]=_0x8e4b('0x55');}if(!_[_0x8e4b('0x19')](queues[_0x40f540['secondtransfererlinkedid']])){if(_0x40f540[_0x8e4b('0x5e')]&&queues[_0x40f540['transfertargetlinkedid']]){queues[_0x40f540[_0x8e4b('0x5e')]][_0x8e4b('0x24')]=0x1;queues[_0x40f540['transfertargetuniqueid']]=_[_0x8e4b('0x57')](queues[_0x40f540[_0x8e4b('0x5e')]]);queues[_0x40f540[_0x8e4b('0x58')]]['transfereduniqueid']=_0x40f540[_0x8e4b('0x58')];queues[_0x40f540[_0x8e4b('0x58')]]['queuecallerenterreason']=0x2;queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x7')]=queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0x7')];queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x59')]=queues[_0x40f540['origtransfererlinkedid']][_0x8e4b('0x59')];queues[_0x40f540[_0x8e4b('0x58')]]['queuecallerjoinAt']=utils['now']();queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x1c')]=utils[_0x8e4b('0x16')]();queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x35')]=0x0;queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x5a')]=0x0;utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x40f540[_0x8e4b('0x50')],queues[_0x40f540['transfertargetuniqueid']][_0x8e4b('0x22')],queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0xe')],queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x7')],queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x59')]));}else{utils['info'](util['format'](_0x8e4b('0x5b'),_0x40f540[_0x8e4b('0x50')],queues[_0x40f540[_0x8e4b('0x52')]]['name'],_0x40f540[_0x8e4b('0x51')]));queues[_0x40f540[_0x8e4b('0x52')]]['transfereduniqueid']=_0x40f540['origtransfererlinkedid'];}}}}catch(_0x565227){utils['error'](util[_0x8e4b('0x11')](_0x8e4b('0x5f'),_0x40f540[_0x8e4b('0x50')]),_0x565227);}};exports[_0x8e4b('0x60')]=function(_0x10c0c4){try{if(!_[_0x8e4b('0x19')](queues[_0x10c0c4['uniqueid']])){utils['debug'](util[_0x8e4b('0x11')](_0x8e4b('0x61'),_0x10c0c4[_0x8e4b('0xf')]),_0x10c0c4);queues[_0x10c0c4[_0x8e4b('0xf')]]['musiconholdstartAt']=utils[_0x8e4b('0x16')]();utils[_0x8e4b('0x3')](util['format'](_0x8e4b('0x62'),_0x10c0c4['uniqueid'],queues[_0x10c0c4[_0x8e4b('0xf')]][_0x8e4b('0x22')],queues[_0x10c0c4[_0x8e4b('0xf')]]['musiconholdstartAt']));}}catch(_0x30fbf0){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')](_0x8e4b('0x61'),_0x10c0c4[_0x8e4b('0xf')]),_0x30fbf0);}};exports[_0x8e4b('0x63')]=function(_0x5885de){try{if(!_[_0x8e4b('0x19')](queues[_0x5885de[_0x8e4b('0xf')]])){if(!_[_0x8e4b('0x19')](queues[_0x5885de[_0x8e4b('0xf')]][_0x8e4b('0x64')])){utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')](_0x8e4b('0x65'),_0x5885de[_0x8e4b('0xf')]),_0x5885de);queues[_0x5885de[_0x8e4b('0xf')]][_0x8e4b('0x5a')]+=utils['diffTime'](utils[_0x8e4b('0x16')](),queues[_0x5885de[_0x8e4b('0xf')]][_0x8e4b('0x64')]);utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')](_0x8e4b('0x66'),_0x5885de['uniqueid'],queues[_0x5885de[_0x8e4b('0xf')]][_0x8e4b('0x22')],queues[_0x5885de['uniqueid']][_0x8e4b('0x5a')]));delete queues[_0x5885de['uniqueid']]['musiconholdstartAt'];}}}catch(_0x29b4d8){utils['error'](util['format'](_0x8e4b('0x65'),_0x5885de[_0x8e4b('0xf')]),_0x29b4d8);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 8c44d9d..236d036 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 _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 +var _0xa2b0=['toLowerCase','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','info','[%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','find','monitors','push','hangup','[%s][recordings][hangup]','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][newexten]','application','appdata','set','startsWith'];(function(_0x2c1683,_0x39c6ab){var _0xc229a5=function(_0x42a025){while(--_0x42a025){_0x2c1683['push'](_0x2c1683['shift']());}};_0xc229a5(++_0x39c6ab);}(_0xa2b0,0xc4));var _0x0a2b=function(_0x40f445,_0x3f81dd){_0x40f445=_0x40f445-0x0;var _0x33bf67=_0xa2b0[_0x40f445];return _0x33bf67;};'use strict';var _=require(_0x0a2b('0x0'));var util=require(_0x0a2b('0x1'));var utils=require(_0x0a2b('0x2'));var recordings={};function writeDB(_0x398332){utils['info'](util[_0x0a2b('0x3')](_0x0a2b('0x4'),_0x398332['uniqueid']));if(_0x398332[_0x0a2b('0x5')]){utils[_0x0a2b('0x6')](_0x398332[_0x0a2b('0x5')])[_0x0a2b('0x7')](function(_0x5e61d8){if(_0x5e61d8){_0x398332[_0x0a2b('0x8')]=_0x5e61d8[_0x0a2b('0x9')];_0x398332[_0x0a2b('0xa')]=_0x5e61d8['id'];}utils[_0x0a2b('0xb')](_0x0a2b('0xc'),_0x398332);});}else{utils[_0x0a2b('0xb')](_0x0a2b('0xc'),_0x398332);}}exports[_0x0a2b('0xd')]=function(_0x3c575c){try{utils[_0x0a2b('0xe')](util[_0x0a2b('0x3')](_0x0a2b('0xf'),_0x3c575c[_0x0a2b('0x10')]),_0x3c575c);if(_0x3c575c[_0x0a2b('0x10')]==_0x3c575c[_0x0a2b('0x11')]){utils['info'](util[_0x0a2b('0x3')](_0x0a2b('0x12'),_0x3c575c[_0x0a2b('0x10')],_0x3c575c[_0x0a2b('0x13')],_0x3c575c['exten']));recordings[_0x3c575c[_0x0a2b('0x10')]]={'uniqueid':_0x3c575c['uniqueid'],'accountcode':_0x3c575c[_0x0a2b('0x5')],'exten':_0x3c575c[_0x0a2b('0x14')],'context':_0x3c575c[_0x0a2b('0x13')],'channel':_0x3c575c[_0x0a2b('0x15')],'monitors':[]};}}catch(_0x285057){utils[_0x0a2b('0x16')](util[_0x0a2b('0x3')](_0x0a2b('0xf'),_0x3c575c[_0x0a2b('0x10')]),_0x285057);}};exports[_0x0a2b('0x17')]=function(_0x53170a){try{utils['debug'](util['format'](_0x0a2b('0x18'),_0x53170a[_0x0a2b('0x10')]),_0x53170a);if(!_[_0x0a2b('0x19')](recordings[_0x53170a[_0x0a2b('0x10')]])&&_0x53170a['channelstate']==0x6){utils['info'](util[_0x0a2b('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x53170a[_0x0a2b('0x10')],_0x53170a['context'],_0x53170a[_0x0a2b('0x15')]));}else if(!_['isNil'](recordings[_0x53170a[_0x0a2b('0x11')]])&&_0x53170a[_0x0a2b('0x1a')]==0x6&&_0x53170a[_0x0a2b('0x13')]!=_0x0a2b('0x1b')){utils[_0x0a2b('0x1c')](util[_0x0a2b('0x3')](_0x0a2b('0x1d'),_0x53170a[_0x0a2b('0x10')],_0x53170a['linkedid'],_0x53170a[_0x0a2b('0x13')],_0x53170a[_0x0a2b('0x15')]));recordings[_0x53170a[_0x0a2b('0x11')]][_0x0a2b('0x5')]=_0x53170a[_0x0a2b('0x5')];}}catch(_0x40d48a){utils[_0x0a2b('0x16')](util[_0x0a2b('0x3')](_0x0a2b('0x18'),_0x53170a['uniqueid']),_0x40d48a);}};exports[_0x0a2b('0x1e')]=function(_0x54d83a){try{if(!_[_0x0a2b('0x19')](_0x54d83a[_0x0a2b('0x1f')])&&!_[_0x0a2b('0x19')](_0x54d83a['variable'][_0x0a2b('0x20')])){utils[_0x0a2b('0xe')](util[_0x0a2b('0x3')](_0x0a2b('0x21'),_0x54d83a[_0x0a2b('0x10')]),_0x54d83a);utils[_0x0a2b('0x1c')](util['format'](_0x0a2b('0x22'),_0x54d83a['uniqueid'],_0x54d83a['variable'],_0x54d83a[_0x0a2b('0x23')]));if(_[_0x0a2b('0x24')](_0x54d83a[_0x0a2b('0x23')],_0x0a2b('0x25'))){_0x54d83a[_0x0a2b('0x23')]=_0x54d83a['value'][_0x0a2b('0x26')](_0x0a2b('0x25'),'.WAV');}if(recordings[_0x54d83a[_0x0a2b('0x11')]]){var _0x803eae=_[_0x0a2b('0x27')](recordings[_0x54d83a[_0x0a2b('0x11')]]['monitors'],{'value':_0x54d83a[_0x0a2b('0x23')]});if(_[_0x0a2b('0x19')](_0x803eae)){recordings[_0x54d83a['linkedid']][_0x0a2b('0x28')][_0x0a2b('0x29')]({'value':_0x54d83a[_0x0a2b('0x23')]});}}}}catch(_0x3c0274){utils['error'](util[_0x0a2b('0x3')](_0x0a2b('0x21'),_0x54d83a['uniqueid']),_0x3c0274);}};exports[_0x0a2b('0x2a')]=function(_0x4fdbf1){try{if(!_[_0x0a2b('0x19')](recordings[_0x4fdbf1[_0x0a2b('0x10')]])){utils[_0x0a2b('0xe')](util[_0x0a2b('0x3')](_0x0a2b('0x2b'),_0x4fdbf1['uniqueid']),_0x4fdbf1);utils[_0x0a2b('0x1c')](util[_0x0a2b('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4fdbf1['uniqueid'],_0x4fdbf1['calleridnum'],_0x4fdbf1[_0x0a2b('0x2c')],_0x4fdbf1['cause-txt']));recordings[_0x4fdbf1[_0x0a2b('0x10')]]['calleridnum']=_0x4fdbf1[_0x0a2b('0x2d')];recordings[_0x4fdbf1['uniqueid']][_0x0a2b('0x2c')]=_0x4fdbf1[_0x0a2b('0x2c')];recordings[_0x4fdbf1[_0x0a2b('0x10')]][_0x0a2b('0x2e')]=_0x4fdbf1['connectedlinenum'];recordings[_0x4fdbf1['uniqueid']]['connectedlinename']=_0x4fdbf1[_0x0a2b('0x2f')];if(recordings[_0x4fdbf1['uniqueid']][_0x0a2b('0x30')]==_0x0a2b('0x31')&&recordings[_0x4fdbf1['uniqueid']][_0x0a2b('0x5')]){recordings[_0x4fdbf1[_0x0a2b('0x10')]][_0x0a2b('0x2e')]=recordings[_0x4fdbf1[_0x0a2b('0x10')]]['accountcode'];recordings[_0x4fdbf1[_0x0a2b('0x10')]][_0x0a2b('0x2f')]='';}recordings[_0x4fdbf1['uniqueid']][_0x0a2b('0x28')][_0x0a2b('0x32')](function(_0x3fbe67){var _0x214233=_['clone'](recordings[_0x4fdbf1['uniqueid']]);_0x214233[_0x0a2b('0x23')]=_0x3fbe67[_0x0a2b('0x23')];writeDB(_0x214233);});delete recordings[_0x4fdbf1[_0x0a2b('0x10')]];}}catch(_0x2b1fa9){utils[_0x0a2b('0x16')](util[_0x0a2b('0x3')](_0x0a2b('0x2b'),_0x4fdbf1[_0x0a2b('0x10')]),_0x2b1fa9);}};exports['newexten']=function(_0x405337){try{if(!_['isNil'](recordings[_0x405337[_0x0a2b('0x10')]])){utils[_0x0a2b('0xe')](util[_0x0a2b('0x3')](_0x0a2b('0x33'),_0x405337[_0x0a2b('0x10')]),_0x405337);utils[_0x0a2b('0x1c')](util[_0x0a2b('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x405337[_0x0a2b('0x10')],_0x405337[_0x0a2b('0x34')],_0x405337[_0x0a2b('0x35')]));if(_0x405337['application']['toLowerCase']()==_0x0a2b('0x36')&&_[_0x0a2b('0x37')](_0x405337['appdata'][_0x0a2b('0x38')](),'cdr')){var _0x247e8e=_0x405337[_0x0a2b('0x35')][_0x0a2b('0x39')]('=');var _0x3ef888=_0x247e8e[0x0][_0x0a2b('0x3a')](_0x247e8e[0x0][_0x0a2b('0x3b')]('(')+0x1,_0x247e8e[0x0][_0x0a2b('0x3b')](')'));var _0x5ddefe=_0x247e8e[0x1];recordings[_0x405337['uniqueid']][_0x3ef888]=_0x5ddefe;}}}catch(_0x7621ea){utils[_0x0a2b('0x16')](util[_0x0a2b('0x3')](_0x0a2b('0x33'),_0x405337['uniqueid']),_0x7621ea);}};exports[_0x0a2b('0x3c')]=function(_0xb757a4){try{if(!_['isNil'](recordings[_0xb757a4['uniqueid']])){utils[_0x0a2b('0xe')](util[_0x0a2b('0x3')]('[%s][recordings][queuecallerjoin]',_0xb757a4[_0x0a2b('0x10')]),_0xb757a4);utils[_0x0a2b('0x1c')](util[_0x0a2b('0x3')](_0x0a2b('0x3d'),_0xb757a4[_0x0a2b('0x10')],_0xb757a4[_0x0a2b('0x3e')]));recordings[_0xb757a4[_0x0a2b('0x10')]][_0x0a2b('0x3e')]=_0xb757a4['queue'];}}catch(_0x2919d4){utils[_0x0a2b('0x16')](util['format']('[%s][recordings][queuecallerjoin]',_0xb757a4[_0x0a2b('0x10')]),_0x2919d4);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2895ea7..b906788 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 _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 +var _0x6545=['transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info','transferercalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum'];(function(_0x1ff7de,_0x31fc27){var _0x523bf9=function(_0x103772){while(--_0x103772){_0x1ff7de['push'](_0x1ff7de['shift']());}};_0x523bf9(++_0x31fc27);}(_0x6545,0x75));var _0x5654=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6545[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5654('0x0'));var util=require('util');var utils=require(_0x5654('0x1'));function writeDB(_0x5f561d){utils['info'](util[_0x5654('0x2')](_0x5654('0x3'),_0x5f561d[_0x5654('0x4')]===_0x5654('0x5')?_0x5f561d[_0x5654('0x6')]:_0x5f561d[_0x5654('0x7')],_0x5f561d[_0x5654('0x4')]));utils[_0x5654('0x8')](_0x5654('0x9'),_0x5f561d);}exports[_0x5654('0xa')]=function(_0x14f04a){try{utils[_0x5654('0xb')](util[_0x5654('0x2')](_0x5654('0xc'),_0x14f04a[_0x5654('0x7')]),_0x14f04a);utils[_0x5654('0xd')](util[_0x5654('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x14f04a[_0x5654('0x7')],_0x14f04a['transferercalleridnum'],_0x14f04a[_0x5654('0xe')],_0x14f04a['transfereecalleridnum'],_0x14f04a['transfereecalleridname']));_0x14f04a[_0x5654('0x4')]=_0x5654('0xf');writeDB(_0x14f04a);}catch(_0x2ec15c){utils['error'](util[_0x5654('0x2')](_0x5654('0xc'),_0x14f04a[_0x5654('0x7')]),_0x2ec15c);}};exports[_0x5654('0x10')]=function(_0xf3031){try{utils[_0x5654('0xb')](util[_0x5654('0x2')]('[%s][transfers][attendedtransfer]',_0xf3031['origtransfereruniqueid']),_0xf3031);utils[_0x5654('0xd')](util[_0x5654('0x2')](_0x5654('0x11'),_0xf3031[_0x5654('0x6')],_0xf3031[_0x5654('0x12')],_0xf3031['origtransferercalleridname'],_0xf3031['transfertargetcalleridnum'],_0xf3031[_0x5654('0x13')]));_0xf3031=_[_0x5654('0x14')](_0xf3031,{'transfererchannel':_0xf3031[_0x5654('0x15')],'transferercalleridnum':_0xf3031['origtransferercalleridnum'],'transferercalleridname':_0xf3031[_0x5654('0x16')],'transfererconnectedlinenum':_0xf3031[_0x5654('0x17')],'transfererconnectedlinename':_0xf3031['secondtransfererconnectedlinename'],'transfereraccountcode':_0xf3031['origtransfereraccountcode'],'transferercontext':_0xf3031[_0x5654('0x18')],'transfererexten':_0xf3031[_0x5654('0x19')],'transfererlinkedid':_0xf3031[_0x5654('0x1a')],'context':_0xf3031[_0x5654('0x1b')],'extension':_0xf3031[_0x5654('0x1c')],'type':'attended'});if(_[_0x5654('0x1d')](_0xf3031['transfereechannel'])){_0xf3031=_[_0x5654('0x14')](_0xf3031,{'transfereechannel':_0xf3031['transfertargetchannel'],'transfereecalleridnum':_0xf3031['transfertargetcalleridnum'],'transfereecalleridname':_0xf3031[_0x5654('0x13')],'transfereeconnectedlinenum':_0xf3031['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xf3031[_0x5654('0x1e')],'transfereeaccountcode':_0xf3031[_0x5654('0x1f')],'transfereecontext':_0xf3031[_0x5654('0x20')],'transfereeexten':_0xf3031[_0x5654('0x21')],'transfereelinkedid':_0xf3031['transfertargetlinkedid']});}writeDB(_0xf3031);}catch(_0x276369){utils['error'](util[_0x5654('0x2')]('[%s][transfers][attendedtransfer]',_0xf3031['origtransfereruniqueid']),_0x276369);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e012194..1e0c9b7 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 _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 +var _0xae32=['xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','format','subtractTime','subtract','diffTime','diff','sumTime','now','YYYY-MM-DD\x20HH:mm:ss','isAfter','bluebird','jayson/promise','moment','util','client','http','../../config/logger'];(function(_0x2c2c3c,_0x4ed336){var _0x5c320e=function(_0x5c6e89){while(--_0x5c6e89){_0x2c2c3c['push'](_0x2c2c3c['shift']());}};_0x5c320e(++_0x4ed336);}(_0xae32,0x157));var _0x2ae3=function(_0x1077f2,_0x35e639){_0x1077f2=_0x1077f2-0x0;var _0x22ba90=_0xae32[_0x1077f2];return _0x22ba90;};'use strict';var BPromise=require(_0x2ae3('0x0'));var jayson=require(_0x2ae3('0x1'));var moment=require(_0x2ae3('0x2'));var util=require(_0x2ae3('0x3'));var client=jayson[_0x2ae3('0x4')][_0x2ae3('0x5')]({'port':0x2329});var logger=require(_0x2ae3('0x6'))(_0x2ae3('0x7'));exports[_0x2ae3('0x8')]=function(_0x451f55,_0x3c352f){logger[_0x2ae3('0x8')](_0x451f55,_0x3c352f?util[_0x2ae3('0x9')](_0x3c352f,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x2e182a,_0x3dd609){logger[_0x2ae3('0xa')](_0x2e182a,_0x3dd609?util[_0x2ae3('0x9')](_0x3dd609,{'showHidden':![],'depth':null}):'');};exports[_0x2ae3('0xb')]=function(_0x1ad7bf,_0x2beb82){logger[_0x2ae3('0xb')](_0x1ad7bf,_0x2beb82?util[_0x2ae3('0x9')](_0x2beb82,{'showHidden':![],'depth':null}):'');};exports[_0x2ae3('0xc')]=function(_0xb7733,_0x49d380){return client[_0x2ae3('0xc')](_0xb7733,{'body':_0x49d380})['then'](function(_0x303582){logger[_0x2ae3('0xa')](_0x2ae3('0xd'),_0xb7733,_0x303582?util['inspect'](_0x303582,{'showHidden':![],'depth':null}):'');})[_0x2ae3('0xe')](function(_0x29a005){logger[_0x2ae3('0xb')](_0x2ae3('0xd'),_0xb7733,_0x29a005?util[_0x2ae3('0x9')](_0x29a005,{'showHidden':![],'depth':null}):'');});};function getUser(_0x53404d){return client[_0x2ae3('0xc')](_0x2ae3('0xf'),{'options':{'raw':!![],'attributes':['id',_0x2ae3('0x10'),'name',_0x2ae3('0x11')],'where':_0x53404d,'limit':0x1}})[_0x2ae3('0x12')](function(_0xa7ad3a){logger[_0x2ae3('0xa')](_0x2ae3('0x13'),JSON[_0x2ae3('0x14')](_0x53404d),_0xa7ad3a?util[_0x2ae3('0x9')](_0xa7ad3a,{'showHidden':![],'depth':null}):'');return _0xa7ad3a[_0x2ae3('0x15')][_0x2ae3('0x16')]?_0xa7ad3a[_0x2ae3('0x15')][0x0]:null;});}exports[_0x2ae3('0x17')]=function(_0x3c0acd){return new BPromise(function(_0x3232d4,_0x121cfe){if(_0x3c0acd){return getUser({'internal':_0x3c0acd})['then'](function(_0x530236){logger[_0x2ae3('0x8')](_0x2ae3('0x18'),_0x3c0acd,_0x530236?'found':'notfound');return _0x3232d4(_0x530236);})[_0x2ae3('0xe')](function(_0x436dd4){logger[_0x2ae3('0xb')](_0x2ae3('0x19'),_0x436dd4?util[_0x2ae3('0x9')](_0x436dd4,{'showHidden':![],'depth':null}):'');return _0x3232d4(null);});}return _0x3232d4(null);});};exports['getUserByInterface']=function(_0x3d0f4c){return new BPromise(function(_0xbc4e07,_0x5aa169){if(_0x3d0f4c){return getUser({'interface':_0x3d0f4c})[_0x2ae3('0x12')](function(_0x455b60){logger[_0x2ae3('0x8')](_0x2ae3('0x1a'),_0x3d0f4c,_0x455b60?_0x2ae3('0x1b'):'notfound');return _0xbc4e07(_0x455b60);})['catch'](function(_0x419142){logger[_0x2ae3('0xb')](_0x2ae3('0x1c'),_0x419142?util[_0x2ae3('0x9')](_0x419142,{'showHidden':![],'depth':null}):'');return _0xbc4e07(null);});}return _0xbc4e07(null);});};exports[_0x2ae3('0x1d')]=function(_0x531691){return new BPromise(function(_0x5b9c55,_0x9c5526){if(_0x531691){return getUser({'name':_0x531691})[_0x2ae3('0x12')](function(_0x42e38f){logger[_0x2ae3('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x531691,_0x42e38f?_0x2ae3('0x1b'):_0x2ae3('0x1e'));return _0x5b9c55(_0x42e38f);})[_0x2ae3('0xe')](function(_0x3680d5){logger['error'](_0x2ae3('0x1f'),_0x3680d5?util[_0x2ae3('0x9')](_0x3680d5,{'showHidden':![],'depth':null}):'');return _0x5b9c55(null);});}return _0x5b9c55(null);});};exports[_0x2ae3('0x20')]=function(_0x1f79e1){return new BPromise(function(_0xf6e48,_0x370e85){if(_0x1f79e1){return client[_0x2ae3('0xc')](_0x2ae3('0x21'),{'options':{'raw':!![],'attributes':['id',_0x2ae3('0x22'),_0x2ae3('0x23'),'acw',_0x2ae3('0x24')],'where':{'name':_0x1f79e1},'limit':0x1}})[_0x2ae3('0x12')](function(_0x2b7116){logger[_0x2ae3('0xa')](_0x2ae3('0x25'),_0x1f79e1,_0x2b7116?util[_0x2ae3('0x9')](_0x2b7116,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x1f79e1,_0x2b7116?_0x2ae3('0x1b'):_0x2ae3('0x1e'));return _0xf6e48(_0x2b7116['result'][_0x2ae3('0x16')]?_0x2b7116[_0x2ae3('0x15')][0x0]:null);})[_0x2ae3('0xe')](function(_0x3534f8){logger[_0x2ae3('0xb')]('[utils][getVoiceQueueByName]',_0x3534f8?util[_0x2ae3('0x9')](_0x3534f8,{'showHidden':![],'depth':null}):'');return _0xf6e48(null);});}return _0xf6e48(null);});};exports[_0x2ae3('0x26')]=function(_0x41adb2,_0x180627){return moment(_0x41adb2)[_0x2ae3('0x27')](_0x180627,_0x2ae3('0x28'))[_0x2ae3('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2ae3('0x2a')]=function(_0x24eee4,_0x1b9ad6){return moment(_0x24eee4)[_0x2ae3('0x2b')](_0x1b9ad6,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2ae3('0x2c')]=function(_0x32c816,_0x435f36){return moment(_0x32c816)[_0x2ae3('0x2d')](moment(_0x435f36),'seconds');};exports[_0x2ae3('0x2e')]=function(_0x674f46,_0x2735a6){return parseInt(_0x674f46,0xa)+parseInt(_0x2735a6,0xa);};exports[_0x2ae3('0x2f')]=function(){return moment()['format'](_0x2ae3('0x30'));};exports[_0x2ae3('0x31')]=function(_0x1a3bde,_0x14d36f){if(_0x14d36f){return moment(_0x1a3bde)[_0x2ae3('0x31')](_0x14d36f);}return!![];};exports['isBefore']=function(_0x3c0421,_0x4cd631){if(_0x4cd631){return moment(_0x3c0421)['isBefore'](_0x4cd631);}else if(_0x3c0421){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 6c49d52..ef8f413 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 _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 +var _0x858a=['headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','test','url','setupLoggers','fs-extra','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','client','role','ensureDir','then','catch','user','no-user','data','timestamp','error','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method'];(function(_0x5382f1,_0x5704ec){var _0x914fae=function(_0x460173){while(--_0x460173){_0x5382f1['push'](_0x5382f1['shift']());}};_0x914fae(++_0x5704ec);}(_0x858a,0x1ad));var _0xa858=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x858a[_0x273c39];return _0x46d6b5;};var fs=require(_0xa858('0x0'));var _=require('lodash');var ewinston=require(_0xa858('0x1'));var path=require(_0xa858('0x2'));var util=require(_0xa858('0x3'));var fileLogger=require(_0xa858('0x4'))['fileLogger'];var safeTemplate=require(_0xa858('0x5'))[_0xa858('0x6')];var maskSensitiveData=require(_0xa858('0x7'))[_0xa858('0x8')];function ClientSideLogger(){function _0x2489f5(_0xf76095){var _0x360311=path[_0xa858('0x9')]('/var',_0xa858('0xa'),'xcally');var _0x3f1a52=path['join'](_0xa858('0xb'),_0xf76095[_0xa858('0xc')]+'-'+_0xf76095['name']);return fs[_0xa858('0xd')](path[_0xa858('0x9')](_0x360311,_0x3f1a52))[_0xa858('0xe')](function(){var _0x4c3d60=fileLogger(_0xa858('0xb'),path[_0xa858('0x9')](_0x360311,_0x3f1a52));return _0x4c3d60;})[_0xa858('0xf')](function(_0x2f0c60){throw _0x2f0c60;});}this[_0xa858('0xa')]=function(_0x14bf2c,_0x2b32d4,_0x417b64,_0x1a3315){return _0x2489f5(_0x14bf2c[_0xa858('0x10')])[_0xa858('0xe')](function(_0x564dfa){var _0x5eeec6=_0x564dfa[_0x2b32d4];return _0x5eeec6;})[_0xa858('0xe')](function(_0x30f905){var _0x5cae42=_0x14bf2c[_0xa858('0x10')]?_0x14bf2c[_0xa858('0x10')]['id']:_0xa858('0x11');var _0x50ba37=_0x1a3315[_0xa858('0x12')];var _0x4620d1=_0x1a3315[_0xa858('0x13')];var _0x21a66a=new Date(Number(_0x4620d1));return _0x30f905(_0x5cae42,_0x21a66a,_0x417b64,_0x50ba37);})[_0xa858('0xf')](function(_0x2c3656){fileLogger(_0xa858('0xb'))[_0xa858('0x14')](_0x2c3656);});};}function setupLoggers(_0x23afe5){return new Promise(function(_0x3f784d){var _0x1dbf83=new ClientSideLogger();var _0x424f74=fileLogger(_0xa858('0x15'));var _0x2b71e8=fileLogger('auth');_0x23afe5[_0xa858('0x16')](_0xa858('0x17'),_0x1dbf83);_0x23afe5[_0xa858('0x18')](ewinston[_0xa858('0x19')]({'winstonInstance':_0x424f74,'meta':![],'statusLevels':!![],'msg':function(_0xd32a03,_0x444311){var _0x435c72=_0xa858('0x1a');if(!_[_0xa858('0x1b')](_0xd32a03[_0xa858('0x1c')])){_0x435c72+='\x20body=%s';var _0x264491=_0xd32a03[_0xa858('0x1c')];maskSensitiveData(_0x264491);}return safeTemplate(util[_0xa858('0x1d')](_0x435c72,_0xd32a03[_0xa858('0x1e')],_0xd32a03[_0xa858('0x1f')]['x-forwarded-for']?_0xd32a03['headers'][_0xa858('0x20')]:_0xd32a03[_0xa858('0x21')][_0xa858('0x22')]||_0xd32a03['ip'],_0xd32a03['url'],_0x444311[_0xa858('0x23')],_0x444311[_0xa858('0x24')],_0xd32a03[_0xa858('0x10')]?_0xd32a03[_0xa858('0x10')]['id']:null,_0xd32a03[_0xa858('0x10')]?_0xd32a03['user'][_0xa858('0x25')]:null,_0xd32a03[_0xa858('0x10')]?_0xd32a03[_0xa858('0x10')][_0xa858('0xc')]:null,_0x264491?util['inspect'](_0x264491,![],null):''));}}));_0x23afe5[_0xa858('0x18')](ewinston[_0xa858('0x19')]({'winstonInstance':_0x2b71e8,'meta':![],'statusLevels':!![],'msg':function(_0x28a257,_0x41a1a5){var _0x5e1a5c=_0xa858('0x26');if(_0x28a257[_0xa858('0x1c')]&&_0x28a257['body'][_0xa858('0x27')]&&_0x28a257['body'][_0xa858('0x28')]){_0x5e1a5c=_0xa858('0x29');}return util[_0xa858('0x1d')](_0x5e1a5c,_0x28a257[_0xa858('0x1e')],_0x28a257[_0xa858('0x1f')][_0xa858('0x20')]?_0x28a257[_0xa858('0x1f')][_0xa858('0x20')]:_0x28a257['connection'][_0xa858('0x22')]||_0x28a257['ip'],_0x28a257['url'],_0x41a1a5[_0xa858('0x23')],_0x41a1a5[_0xa858('0x24')],_0x28a257[_0xa858('0x10')]?_0x28a257[_0xa858('0x10')]['id']:null,_0x28a257[_0xa858('0x10')]?_0x28a257[_0xa858('0x10')][_0xa858('0x25')]:null,_0x28a257[_0xa858('0x10')]?_0x28a257[_0xa858('0x10')][_0xa858('0xc')]:null,_0x28a257[_0xa858('0x1c')]&&_0x28a257[_0xa858('0x1c')][_0xa858('0x27')]?_0x28a257[_0xa858('0x1c')][_0xa858('0x27')]:'other',_0x28a257[_0xa858('0x1c')]&&_0x28a257[_0xa858('0x1c')][_0xa858('0x28')]?_0x28a257[_0xa858('0x1c')]['agent_id']:'',_0x28a257[_0xa858('0x1c')]&&_0x28a257['body'][_0xa858('0x2a')]?_0x28a257[_0xa858('0x1c')][_0xa858('0x2a')]:'');},'ignoreRoute':function(_0x5dfebf){var _0xb08c1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xb08c1[_0xa858('0x2b')](_0x5dfebf[_0xa858('0x2c')]);}}));return _0x3f784d();});}exports[_0xa858('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 4c8f601..883b119 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xcfb8=['iftime','lodash','moment-timezone','source','join','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','map','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','minutes','hours','isBefore','startOf','day','endOf','isBetween','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','monthCompare','isMoment','padStart','length'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0xcfb8,0x139));var _0x8cfb=function(_0x5a3b32,_0x1d92f4){_0x5a3b32=_0x5a3b32-0x0;var _0x9d9608=_0xcfb8[_0x5a3b32];return _0x9d9608;};var _=require(_0x8cfb('0x0'));var moment=require(_0x8cfb('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(_0xe00282){return _0xe00282[_0x8cfb('0x2')];})[_0x8cfb('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x8cfb('0x4');function throwIfDateNotValid(_0x4a638d){if(!_0x4a638d[_0x8cfb('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4e89d2){var _0x445dfd=_0x4e89d2[_0x8cfb('0x6')](':')['map'](function(_0x3bcb3e){return parseInt(_0x3bcb3e,0xa);});var _0x3bd4ed=_0x445dfd[0x0];var _0x34ba10=_0x445dfd[0x1];if(_0x3bd4ed<0x0||_0x3bd4ed>0x17||_0x34ba10<0x0||_0x34ba10>0x3b){throw new Error(EINVALID_DATE);}return[_0x3bd4ed,_0x34ba10];}function circularDoWInterval(_0x526028,_0x1ef1fb){if(_0x526028===_0x1ef1fb){return[_0x526028];}else{var _0x15b15a=moment[_0x8cfb('0x7')]();moment[_0x8cfb('0x7')]('en');var _0x1fa7a1=moment[_0x8cfb('0x8')]()[_0x8cfb('0x9')](function(_0x334ec1){return _0x334ec1[_0x8cfb('0xa')]();});moment[_0x8cfb('0x7')](_0x15b15a);var _0x2011ec=_0x1fa7a1[_0x8cfb('0xb')](_0x526028);var _0x5b583b=_0x1fa7a1[_0x8cfb('0xb')](_0x1ef1fb);if(_0x5b583b>_0x2011ec){return _0x1fa7a1[_0x8cfb('0xc')](_0x2011ec,_0x5b583b+0x1);}else{var _0x6b3325=_0x1fa7a1['slice'](0x0,_0x5b583b+0x1);var _0x1171d1=_0x1fa7a1[_0x8cfb('0xc')](_0x2011ec);return _0x1171d1[_0x8cfb('0xd')](_0x6b3325);}}}module[_0x8cfb('0xe')][_0x8cfb('0xf')]=circularDoWInterval;function circularMonthInterval(_0xadbd63,_0x1b914a){if(_0xadbd63===_0x1b914a){return[_0xadbd63];}else{var _0x556af2=moment[_0x8cfb('0x7')]();moment[_0x8cfb('0x7')]('en');var _0x1575d1=moment[_0x8cfb('0x10')]()['map'](function(_0x3c3950){return _0x3c3950[_0x8cfb('0xa')]();});moment[_0x8cfb('0x7')](_0x556af2);var _0x1d4941=_0x1575d1[_0x8cfb('0xb')](_0xadbd63);var _0x4036a2=_0x1575d1['indexOf'](_0x1b914a);if(_0x4036a2>_0x1d4941){return _0x1575d1[_0x8cfb('0xc')](_0x1d4941,_0x4036a2+0x1);}else{var _0xa7cb47=_0x1575d1[_0x8cfb('0xc')](0x0,_0x4036a2+0x1);var _0x1330ba=_0x1575d1['slice'](_0x1d4941);return _0x1330ba[_0x8cfb('0xd')](_0xa7cb47);}}}module['exports'][_0x8cfb('0x11')]=circularMonthInterval;function parseDom(_0x56086e){var _0x574c3f=parseInt(_0x56086e,0xa);if(_0x574c3f<0x1||_0x574c3f>0x1f){throw new Error(EINVALID_DATE);}return _0x574c3f;}function timeCompare(_0x515ffe,_0x51b8a8,_0x48d00a){var _0x2cce80=_0x515ffe[_0x8cfb('0x12')]();var _0x2d9901=extractTime(_0x51b8a8);var _0xc78280=_0x2d9901[0x0];var _0x2895a1=_0x2d9901[0x1];var _0x2ee7d6=_0x515ffe['clone']()['hours'](_0xc78280)[_0x8cfb('0x13')](_0x2895a1);throwIfDateNotValid(_0x2ee7d6);var _0x4b1d57=extractTime(_0x48d00a);var _0x3423f0=_0x4b1d57[0x0];var _0x21b3e6=_0x4b1d57[0x1];var _0x395095=_0x515ffe['clone']()[_0x8cfb('0x14')](_0x3423f0)[_0x8cfb('0x13')](_0x21b3e6);throwIfDateNotValid(_0x395095);if(_0x395095[_0x8cfb('0x15')](_0x2ee7d6)){var _0x3bc444=_0x2cce80[_0x8cfb('0x12')]()[_0x8cfb('0x16')](_0x8cfb('0x17'));var _0x117b1a=_0x2cce80[_0x8cfb('0x12')]()[_0x8cfb('0x18')](_0x8cfb('0x17'));return _0x2cce80[_0x8cfb('0x19')](_0x2ee7d6,_0x117b1a,undefined,'[]')||_0x2cce80[_0x8cfb('0x19')](_0x3bc444,_0x395095,undefined,'[]');}else{return _0x2cce80['isBetween'](_0x2ee7d6,_0x395095,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x32465f,_0x4fe8ef,_0x3a9525){var _0x5e5b22=_0x32465f[_0x8cfb('0x7')]('en')['format'](_0x8cfb('0x1a'))[_0x8cfb('0xa')]();return circularDoWInterval(_0x4fe8ef,_0x3a9525)[_0x8cfb('0x1b')](_0x5e5b22);}module[_0x8cfb('0xe')][_0x8cfb('0x1c')]=dowCompare;function domCompare(_0x4f4c9c,_0x67740f,_0x2ad843){var _0x42be86=_0x4f4c9c[_0x8cfb('0x1d')]();if(_0x67740f===_0x2ad843){return _0x42be86===_0x67740f;}else{var _0x56192a=_0x4f4c9c[_0x8cfb('0x1e')]();var _0x3559f3=_0x67740f<_0x2ad843;let _0x55371a=![];var _0x54a667=0x0;var _0x528374=0x0;if(_0x3559f3){_0x54a667=Math[_0x8cfb('0x1f')](0x1,_0x67740f);_0x528374=Math['min'](_0x2ad843,_0x56192a);_0x55371a=_0x42be86>=_0x54a667&&_0x42be86<=_0x528374;}else{_0x54a667=Math[_0x8cfb('0x20')](_0x67740f,_0x56192a);_0x528374=Math['max'](0x1,_0x2ad843);_0x55371a=_0x42be86>=_0x54a667||_0x42be86<=_0x528374;}return _0x55371a;}}module[_0x8cfb('0xe')][_0x8cfb('0x21')]=domCompare;function monthCompare(_0x982fdd,_0x4e4ca6,_0x4dc00f){var _0x51921c=_0x982fdd[_0x8cfb('0x7')]('en')['format']('MMM')[_0x8cfb('0xa')]();return circularMonthInterval(_0x4e4ca6,_0x4dc00f)[_0x8cfb('0x1b')](_0x51921c);}module[_0x8cfb('0xe')][_0x8cfb('0x22')]=monthCompare;function iftime(_0x466ee9,_0x902cd=moment['tz']['guess'](),_0x535788=moment()){if(!validateRx['test'](_0x466ee9)){throw new Error(EINVALID_STRING);}else{var _0x2e5287=(moment[_0x8cfb('0x23')](_0x535788)?_0x535788[_0x8cfb('0x12')]():moment(_0x535788))['tz'](_0x902cd)[_0x8cfb('0x7')]('en');throwIfDateNotValid(_0x2e5287);var _0x311268=_0x466ee9[_0x8cfb('0x6')](',');var _0x2c1ffa=_0x311268[0x0];var _0x49bb94=_0x311268[0x1];var _0x56ac15=_0x311268[0x2];var _0x220f0b=_0x311268[0x3];let _0x495677=!![];if(_0x2c1ffa!=='*'){var _0x485826=_0x2c1ffa[_0x8cfb('0x6')]('-');var _0x42d890=_[_0x8cfb('0x24')](_0x485826[0x0],0x5,'0');var _0x49a95b=_0x485826[_0x8cfb('0x25')]===0x2?_[_0x8cfb('0x24')](_0x485826[0x1],0x5,'0'):_0x42d890;_0x495677=timeCompare(_0x2e5287,_0x42d890,_0x49a95b);}let _0x16352f=!![];if(_0x49bb94!=='*'){var _0x31f10c=_0x49bb94[_0x8cfb('0x6')]('-');var _0x36e2e5=_0x31f10c[0x0];var _0x2b6491=_0x31f10c[_0x8cfb('0x25')]===0x2?_0x31f10c[0x1]:_0x36e2e5;_0x16352f=dowCompare(_0x2e5287,_0x36e2e5,_0x2b6491);}let _0x551354=!![];if(_0x56ac15!=='*'){var _0x315a44=_0x56ac15[_0x8cfb('0x6')]('-');var _0x369ca1=parseDom(_0x315a44[0x0]);var _0x178d21=_0x315a44[_0x8cfb('0x25')]===0x2?parseDom(_0x315a44[0x1]):_0x369ca1;_0x551354=domCompare(_0x2e5287,_0x369ca1,_0x178d21);}let _0x27c8e5=!![];if(_0x220f0b!=='*'){var _0x32bd65=_0x220f0b[_0x8cfb('0x6')]('-');var _0x132e91=_0x32bd65[0x0];var _0x12bb59=_0x32bd65[_0x8cfb('0x25')]===0x2?_0x32bd65[0x1]:_0x32bd65[0x0];_0x27c8e5=monthCompare(_0x2e5287,_0x132e91,_0x12bb59);}return _0x495677&&_0x16352f&&_0x551354&&_0x27c8e5;}}module['exports'][_0x8cfb('0x26')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index c384561..ae48611 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xd0d3=['Logger','transports','File','%s-%s','error','fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','bold\x20white','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','message','{{{','meta','keys','length','stringify','Console','warn'];(function(_0x294c01,_0x20edbb){var _0x4b8163=function(_0x298683){while(--_0x298683){_0x294c01['push'](_0x294c01['shift']());}};_0x4b8163(++_0x20edbb);}(_0xd0d3,0x192));var _0x3d0d=function(_0x5d7bfa,_0x4f9fd1){_0x5d7bfa=_0x5d7bfa-0x0;var _0x24106d=_0xd0d3[_0x5d7bfa];return _0x24106d;};'use strict';var path=require(_0x3d0d('0x0'));var util=require(_0x3d0d('0x1'));var moment=require('moment');var winston=require(_0x3d0d('0x2'));var config=require(_0x3d0d('0x3'));var debugLevel=config[_0x3d0d('0x4')]?config[_0x3d0d('0x4')][_0x3d0d('0x5')]():_0x3d0d('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x3d0d('0x7'),'warn':_0x3d0d('0x8'),'info':'white','print':_0x3d0d('0x9'),'success':'bold\x20green','http':_0x3d0d('0xa'),'verbose':_0x3d0d('0xb'),'debug':'bold\x20blue','silly':_0x3d0d('0xc')};winston[_0x3d0d('0xd')](XC_LOG_COLORS);function getLogFileName(_0x3a2f06,_0x38deef,_0x5a4cf4){var _0x541687=_0x3a2f06||_0x3d0d('0xe');return path[_0x3d0d('0xf')](_0x541687,util[_0x3d0d('0x10')](_0x3d0d('0x11'),_0x38deef,_0x5a4cf4));}function formatter(_0x5dab4c,_0x8458b9){_0x8458b9['message']=_0x8458b9['message']['replace'](/@@{/g,'{{{')[_0x3d0d('0x12')](/}@@/g,_0x3d0d('0x13'))['replace'](/@{/g,'{{')[_0x3d0d('0x12')](/}@/g,'}}');return util[_0x3d0d('0x10')](_0x3d0d('0x14'),moment()[_0x3d0d('0x10')](_0x3d0d('0x15')),_0x8458b9['level']['toUpperCase'](),_0x5dab4c,_0x8458b9[_0x3d0d('0x16')]);}function fileFormat(_0x5550fa,_0x5abd7e){_0x5abd7e[_0x3d0d('0x16')]=_0x5abd7e[_0x3d0d('0x16')][_0x3d0d('0x12')](/@@{/g,_0x3d0d('0x17'))['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x565410=_0x5abd7e[_0x3d0d('0x18')]&&Object[_0x3d0d('0x19')](_0x5abd7e['meta'])[_0x3d0d('0x1a')]?'\x0a\x09'+JSON[_0x3d0d('0x1b')](_0x5abd7e[_0x3d0d('0x18')]):'';return util[_0x3d0d('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x3d0d('0x15')),_0x5abd7e['level']['toUpperCase'](),_0x5550fa,_0x5abd7e[_0x3d0d('0x16')],_0x565410);}function consoleLogger(){var _0x5551bf=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x3d0d('0x1c'))]({'level':_0x3d0d('0x1d'),'json':![],'formatter':function(_0x37c160){return formatter('',_0x37c160);}})]});return _0x5551bf;}function fileLogger(_0x40d81f,_0x2042ee){var _0x78d1a8=new winston[(_0x3d0d('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3d0d('0x1f'))][(_0x3d0d('0x20'))]({'name':util[_0x3d0d('0x10')](_0x3d0d('0x21'),_0x40d81f,_0x3d0d('0x22')),'filename':getLogFileName(_0x2042ee,_0x40d81f,'error'),'level':_0x3d0d('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x49d836){return fileFormat(_0x40d81f,_0x49d836);}}),new winston[(_0x3d0d('0x1f'))][(_0x3d0d('0x20'))]({'name':util[_0x3d0d('0x10')](_0x3d0d('0x21'),_0x40d81f,debugLevel),'filename':getLogFileName(_0x2042ee,_0x40d81f,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b5bae){return fileFormat(_0x40d81f,_0x3b5bae);}}),new winston[(_0x3d0d('0x1f'))][(_0x3d0d('0x1c'))]({'level':_0x3d0d('0x1d'),'json':![],'formatter':function(_0x87ecd0){return fileFormat(_0x40d81f,_0x87ecd0);}})]});return _0x78d1a8;}exports['consoleLogger']=consoleLogger;exports[_0x3d0d('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 50eb0a3..bdb4c12 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 _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 +var _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0xabbb53,_0x5e2e4b){var _0x368b4a=function(_0x15e62e){while(--_0x15e62e){_0xabbb53['push'](_0xabbb53['shift']());}};_0x368b4a(++_0x5e2e4b);}(_0xda2d,0x102));var _0xdda2=function(_0x1cb72c,_0x56012b){_0x1cb72c=_0x1cb72c-0x0;var _0x51e056=_0xda2d[_0x1cb72c];return _0x51e056;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 932dab3..dc0b0f6 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 _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 +var _0xda3f=['isPlainObject','keys','exports','safeTemplate','{\x20{\x20','string','isArray','map'];(function(_0x10e151,_0x136e6a){var _0x1a0248=function(_0x41c7f5){while(--_0x41c7f5){_0x10e151['push'](_0x10e151['shift']());}};_0x1a0248(++_0x136e6a);}(_0xda3f,0xec));var _0xfda3=function(_0x416f7a,_0x2164d9){_0x416f7a=_0x416f7a-0x0;var _0x57a5eb=_0xda3f[_0x416f7a];return _0x57a5eb;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x89912f){return _0x89912f==='{{'?_0xfda3('0x0'):'\x20}\x20}';}function safeTemplate(_0x5299b0){var _0x5d7071=_0x5299b0;if(typeof _0x5299b0===_0xfda3('0x1')){_0x5d7071=_0x5299b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfda3('0x2')](_0x5299b0)){_0x5d7071=_0x5299b0[_0xfda3('0x3')](function(_0x516500){return safeTemplate(_0x516500);});}else if(_[_0xfda3('0x4')](_0x5299b0)){_0x5d7071=Object[_0xfda3('0x5')](_0x5299b0)['reduce'](function(_0x4e72d1,_0x316792){_0x4e72d1[_0x316792]=safeTemplate(_0x5299b0[_0x316792]);return _0x4e72d1;},{});}return _0x5d7071;}module[_0xfda3('0x6')][_0xfda3('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 0f68612..6fb3b08 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 _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 +var _0x7e38=['writeJSON','exports','fs-extra','../config/environment','root','server/app.json','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','updated','info'];(function(_0x3f5796,_0xad61e8){var _0x47cb37=function(_0x14cb99){while(--_0x14cb99){_0x3f5796['push'](_0x3f5796['shift']());}};_0x47cb37(++_0xad61e8);}(_0x7e38,0x1e2));var _0x87e3=function(_0x1e4abc,_0x2edf2d){_0x1e4abc=_0x1e4abc-0x0;var _0x2f3eee=_0x7e38[_0x1e4abc];return _0x2f3eee;};var fs=require(_0x87e3('0x0'));var path=require('path');var config=require(_0x87e3('0x1'));var root=config[_0x87e3('0x2')];var APP_JSON_PATH=path['resolve'](root,_0x87e3('0x3'));var NODEPATH=path[_0x87e3('0x4')](root,_0x87e3('0x5'));function setLegacyLibsNodeEnvPath(_0x4dbc3c){let _0x4dbfad=![];if(Array[_0x87e3('0x6')](_0x4dbc3c[_0x87e3('0x7')])){var _0x3582db=_0x4dbc3c[_0x87e3('0x7')][_0x87e3('0x8')](function(_0x1b2b18){return _0x1b2b18[_0x87e3('0x9')]===_0x87e3('0xa');});if(_0x3582db>-0x1){var _0x423890=_0x4dbc3c[_0x87e3('0x7')][_0x3582db];if(typeof _0x423890[_0x87e3('0xb')][_0x87e3('0xc')]!==_0x87e3('0xd')){_0x423890[_0x87e3('0xb')]['NODE_PATH']=NODEPATH;_0x4dbfad=!![];}}return{'appConfig':_0x4dbc3c,'updated':_0x4dbfad};}}function updateAppConfig(_0x4723a9){return fs[_0x87e3('0xe')](APP_JSON_PATH)[_0x87e3('0xf')](function(_0x4f760c){if(_0x4f760c){return fs['readJSON'](APP_JSON_PATH)[_0x87e3('0xf')](function(_0x1593eb){var _0x4a1740=setLegacyLibsNodeEnvPath(_0x1593eb);if(_0x4a1740[_0x87e3('0x10')]){_0x4723a9[_0x87e3('0x11')]('Updating\x20app.json');return fs[_0x87e3('0x12')](APP_JSON_PATH,_0x1593eb,{'spaces':0x2});}else{return Promise[_0x87e3('0x4')]();}});}else{return Promise['resolve']();}});}module[_0x87e3('0x13')]=updateAppConfig; \ No newline at end of file